From 8396584552d93ba6c9efa2afd2fe87e9fbcb10b7 Mon Sep 17 00:00:00 2001 From: cn Date: Fri, 24 Nov 2017 23:19:21 +0100 Subject: [PATCH] grammar: support some flavors of value types like array/hash (using JSON source), integer etc --- CHANGELOG.md | 2 ++ grammars/fluentd.cson | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 32b7913..019dadf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ NEW FEATURES: - Support folding markers for directives like `...` - 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`) IMPROVEMENTS: diff --git a/grammars/fluentd.cson b/grammars/fluentd.cson index 5274a88..df56d32 100644 --- a/grammars/fluentd.cson +++ b/grammars/fluentd.cson @@ -109,6 +109,46 @@ repository: {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: '\\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: '([^\\s]+?)' name: 'meta.string.unquoted.fluentd'