Compare commits

...

18 Commits

Author SHA1 Message Date
cn c0a38af087 Prepare 1.1.3 release 2018-02-21 21:29:30 +01:00
cn 5d647fd842 package: add keywords 2018-02-21 21:29:13 +01:00
Christian Nicolai 9e977f7abb Prepare 1.1.2 release 2018-02-21 15:54:33 +01:00
Christian Nicolai da21bc01cc grammar: try to detect regex values to avoid weird highlighting 2018-02-21 15:53:10 +01:00
cn 78ea23f555 Prepare 1.1.1 release 2017-11-25 11:15:20 +01:00
cn 3360373cb6 docs: add installation instructions and screenshot 2017-11-25 11:14:12 +01:00
cn 3c271eeed6 Prepare 1.1.0 release 2017-11-25 11:03:15 +01:00
cn 459fea5baa docs: fix typo 2017-11-25 11:03:01 +01:00
cn cbdeef4bba grammar: add (double quoted) string interpolations #{test} using Ruby
Related to adamchainz/fluentd.tmLanguage#3
2017-11-25 10:55:39 +01:00
cn 1d286163c9 grammar: support highlighting ${variables} for e.g. record_transformer
Related to adamchainz/fluentd.tmLanguage#4
2017-11-25 10:54:04 +01:00
cn 8396584552 grammar: support some flavors of value types like array/hash (using JSON source), integer etc 2017-11-25 10:52:54 +01:00
cn ee37db2d42 grammar: add support for escape sequenes in single, double and unquoted strings 2017-11-25 10:50:14 +01:00
cn f2d50423de grammar: add single and double quoted strings 2017-11-24 23:16:50 +01:00
cn 0b972b731f grammar: refactor global patterns into modular repository structure (comments, directives, parameters and values) 2017-11-24 23:14:19 +01:00
cn 0de289b882 settings: support toggling comments 2017-11-24 23:08:34 +01:00
cn 08ee38e700 docs: improve example again with more exotic features
Source: https://docs.fluentd.org/v0.12/articles/config-file
2017-11-24 23:06:43 +01:00
cn 3e2a3f0cd0 grammar: support folding markers 2017-11-23 20:34:40 +01:00
cn 813fde30c0 docs: change syntax name, add example 2017-11-23 20:15:36 +01:00
7 changed files with 359 additions and 42 deletions

View File

@ -1,5 +1,39 @@
# Changelog
## 1.1.3 (February 21, 2018)
IMPROVEMENTS:
- Add package keywords
## 1.1.2 (February 21, 2018)
IMPROVEMENTS:
- Detection of regex values (although not an official data type) to avoid weird highlighting
## 1.1.1 (November 25, 2017)
IMPROVEMENTS:
- Add installation instructions and screenshot
## 1.1.0 (November 25, 2017)
NEW FEATURES:
- Support folding markers for directives like `<source>...</source>`
- Support toggling comments
- Support escape sequenes like `foo\nbar` in single, double and unquoted strings
- Support array and hash (using JSON source) value types like `["foo","bar"]`
- Support integer, time and size value types (e.g. `property 100`, `bufsize 5M` or `finterval 5s`)
- Support highlighting `${variables}` (used by e.g. [record_transformer plugin](https://docs.fluentd.org/v0.12/articles/filter_record_transformer))
- Support (double quoted) string interpolations like `#{Time.new.to_i + 1}` (using Ruby source)
IMPROVEMENTS:
- Add example fluent.conf file using as many Fluentd features as possible (even if this package does not highlight it correctly)
## 1.0.0 (November 22, 2017)
NEW FEATURES:

View File

@ -1,6 +1,22 @@
# Fluentd Config File language support in Atom
# Fluentd Configuration language support in Atom
Adds basic syntax highlighting based on the [Sublime Text and TextMate package](https://github.com/adamchainz/fluentd.tmLanguage) to `fluent.conf` files in Atom.
Adds basic syntax highlighting to `fluent.conf` based on the [Sublime Text and TextMate package](https://github.com/adamchainz/fluentd.tmLanguage) with some improvements in Atom.
![Screenshot](/screenshot.png?raw=true)
## Installation
Available as [Atom package](https://atom.io/packages/language-fluentd):
```
apm install language-fluentd
```
Or directly via git:
```
git clone https://github.com/cmur2/language-fluentd.git ~/.atom/packages/language-fluentd
```
## License

115
example.fluent.conf Normal file
View File

@ -0,0 +1,115 @@
# Receive events from 24224/tcp
# This is used by log forwarding and the fluent-cat command
<source>
@type forward
port 24224
str1a_param "foo"
str1b_param "foo
bar"
str2a_param 'foo'
str2b_param 'foo
bar'
str2c_param "foo\nbar" # \n is interpreted as actual LF character
array_param [
"a", "b"
]
hash_param {
"k": "v",
"k1": 10
}
host_param "#{Socket.gethostname}" # host_param is actual hostname like `webserver1`.
env_param "foo-#{ENV["FOO_BAR"]}" # NOTE that foo-"#{ENV["FOO_BAR"]}" doesn't work.
tag "test.#{ENV['PROJECT_NAME']}"
</source>
<source>
@type tail
@label @SYSTEM
</source>
# http://this.host:9880/myapp.access?json={"event":"data"}
<source>
@type http
port 9880
</source>
<filter foo.bar>
@type record_transformer
<record>
hostname "#{Socket.gethostname}"
tag ${record["project_name"]}.scope.${tag}_old
key.flatten x
</record>
</filter>
<match myapp.access yourapp.access>
@type file
path /var/log/fluent/access
</match>
<label @SYSTEM>
<filter var.log.middleware.**>
@type grep
# ...
</filter>
<match **>
@type s3
include_tag_key true
buffer_chunk_limit 2M
buffer_queue_limit 32
flush_interval 5s
# ...
</match>
</label>
<system>
# equal to -qq option
log_level error
# equal to --without-source option
without_source
# ...
</system>
# Include config files in the ./config.d directory
@include config.d/*.conf
# =======================
# v1_literal_example.conf
# =======================
<section1>
key1 'text' # text
key2 '\'' # ' (1 char)
key3 '\\' # \ (1 char)
key4 '\t' # \t (2 char)
key5 '\[' # \[ (2 char)
key6 '\\[' # \[ (2 char)
key7 '#t' # #t (2 char)
key8 '\#{test}' # \#{test} (8 char)
key9 '#{test}' # #{test} (7 char)
key10 '\[(?<time>[^\]]*)\] (?<message>.*)' # \[(?<time>[^\]]*\] (?<message>.*)
</section1>
<section2>
key1 "text" # text
key2 "\"" # " (1 char)
key3 "\\" # \ (1 char)
key4 "\t" # TAB (1 char)
key5 "\[" # [ (1 char)
key6 "\\[" # \[ (2 char)
key7 "#t" # #t (2 char)
key8 "\#{test}" # #{test} (7 char)
key9 "#{test}" # replaced by eval('test')
key10 "\\[(?<time>[^\\]]*)\\] (?<message>.*)" # \[(?<time>[^\]]*\] (?<message>.*)
</section2>
<section3>
key1 text # text
key2 \ # \ (1 char)
key3 \\ # \\ (2 char)
key4 \t # \t (2 char)
key5 \[ # \[ (2 char)
key6 \\[ # \\[ (3 char)
key7 #t # #t (2 char)
key8 \#{test} # \#{test} (8 char)
key9 #{test} # #{test} (7 char)
key10 \[(?<time>[^\]]*)\] (?<message>.*) # \[(?<time>[^\]]*\] (?<message>.*)
</section3>

View File

@ -1,44 +1,186 @@
scopeName: 'source.fluentd'
name: 'Fluentd Config File'
name: 'Fluentd Configuration'
fileTypes: [
'fluent.conf'
]
foldingStartMarker: '<[^>]+>\\s*$'
foldingStopMarker: '^\\s*</[^>]+>'
patterns: [
{
match: "#.*"
name: "comment.line.number-sign.fluentd"
}
{
match: "(<)(\\w+)(\\s([^>]+?))?(>)"
name: "entity.tag.start.fluentd"
captures:
"1":
name: "punctuation.definition.tag.fluentd"
"2":
name: "entity.tag.fluentd"
"4":
name: "entity.other.attribute-name.fluentd"
"5":
name: "punctuation.definition.tag.fluentd"
}
{
match: "(</)(\\w+)(>)"
name: "entity.tag.end.fluentd"
captures:
"1":
name: "punctuation.definition.tag.fluentd"
"2":
name: "entity.tag.fluentd"
"3":
name: "punctuation.definition.tag.fluentd"
}
{
match: "([^\\s]+)(\\s+([^\\n]+))?"
name: "keyword.directive.generic.fluentd"
captures:
"1":
name: "keyword.directive.fluentd"
"3":
name: "string.unquoted.fluentd"
}
{include: '#comments'}
{include: '#directives'}
]
repository:
comments:
patterns: [
{
match: '#.*'
name: 'comment.line.number-sign.fluentd'
}
]
directives:
patterns: [
{
match: '((@)include)\\s+([^\\s]+)'
captures:
'1':
name: 'entity.directive.begin.fluentd'
'2':
name: 'punctuation.definition.directive.begin.fluentd'
'3':
name: 'entity.other.directive.attribute-name.fluentd'
}
{
begin: '((<)[^\\s]+(\\s+[^>]+)?(>))'
beginCaptures:
'1':
name: 'entity.directive.begin.fluentd'
'2':
name: 'punctuation.definition.directive.begin.fluentd'
'3':
name: 'entity.other.directive.attribute-name.fluentd'
'4':
name: 'punctuation.definition.directive.end.fluentd'
end: '((</)\\w+(>))'
endCaptures:
'1':
name: 'entity.directive.end.fluentd'
'2':
name: 'punctuation.definition.directive.begin.fluentd'
'3':
name: 'punctuation.definition.directive.end.fluentd'
name: 'meta.directive.fluentd'
patterns: [
{include: '#comments'}
{include: '#directives'}
{include: '#parameters'}
]
}
]
parameters:
patterns: [
{
begin: '(@[^\\s]+)|([^\\s]+)'
beginCaptures:
'1':
name: 'keyword.parameter.system.fluentd'
'2':
name: 'keyword.parameter.fluentd'
end: '\\n'
name: 'meta.parameter.fluentd'
patterns: [
{include: '#comments'}
{include: '#values'}
]
}
]
values:
patterns: [
{
match: '\\\\.'
name: 'value.string.escape.fluentd'
}
{
begin: '(")'
beginCaptures:
'1':
name: 'punctuation.definition.string.begin.fluentd'
end: '(")'
endCaptures:
'1':
name: 'punctuation.definition.string.end.fluentd'
name: 'meta.value.string.quoted.double.fluentd'
patterns: [
{include: '#stringescapes'}
{include: '#stringinterpolations'}
]
}
{
begin: "(')"
beginCaptures:
'1':
name: 'punctuation.definition.string.begin.fluentd'
end: "(')"
endCaptures:
'1':
name: 'punctuation.definition.string.end.fluentd'
name: 'meta.value.string.quoted.single.fluentd'
patterns: [
{include: '#stringescapes'}
]
}
{
begin: '(\\[)'
beginCaptures:
'1':
name: 'punctuation.definition.array.begin.fluentd'
end: '(\\])'
endCaptures:
'1':
name: 'punctuation.definition.array.end.fluentd'
name: 'meta.value.array.fluentd'
patterns: [
{include: 'source.json'}
]
}
{
begin: '\\{'
beginCaptures:
'1':
name: 'punctuation.definition.hash.begin.fluentd'
end: '\\}'
endCaptures:
'1':
name: 'punctuation.definition.hash.end.fluentd'
name: 'meta.value.hash.fluentd'
patterns: [
{include: 'source.json'}
]
}
{
match: '\/.+\/$'
name: 'value.string.regex.fluentd'
}
{
match: '\\b(\\d+)\\b'
name: 'value.constant.integer.fluentd'
}
{
match: '\\b(\\d+[kmgtKMGT])\\b'
name: 'value.constant.size.fluentd'
}
{
match: '\\b(\\d+[smhd])\\b'
name: 'value.constant.time.fluentd'
}
{
match: '(\\$\\{[^\\}]*\\})'
name: 'variable.string.fluentd'
}
{
match: '([^\\s]+?)'
name: 'meta.string.unquoted.fluentd'
captures:
'1':
name: 'string.unquoted.fluentd'
}
]
stringescapes:
patterns: [
{
match: '\\\\.'
name: 'constant.string.escape.fluentd'
}
]
stringinterpolations:
patterns: [
{
begin: '#\\{'
end: '\\}'
name: 'constant.string.interpolation.fluentd'
patterns: [
{include: 'source.ruby'}
]
}
]

View File

@ -1,7 +1,14 @@
{
"name": "language-fluentd",
"description": "Fluentd Config File language support in Atom",
"version": "1.0.0",
"description": "Fluentd Configuration language support in Atom",
"version": "1.1.3",
"keywords": [
"language",
"grammar",
"fluentd",
"configuration",
"logging"
],
"engines": {
"atom": "*"
},

BIN
screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

View File

@ -0,0 +1,3 @@
'.source.fluentd':
editor:
commentStart: '# '