diff --git a/assets/README.md b/assets/README.md index 272c31b0..e0a6e882 100644 --- a/assets/README.md +++ b/assets/README.md @@ -38,3 +38,4 @@ The following files have been manually modified after converting from a `.tmLang ### Non-submodule additions * `Assembly (x86_64)` has been manually added from https://github.com/13xforever/x86-assembly-textmate-bundle due to `git clone` recursion problems +* `Nim.sublime-syntax` has been added manually from https://github.com/getzola/zola/blob/master/sublime_syntaxes/Nim.sublime-syntax as there was no suitable Git repository for it. The original syntax seems to originate from https://github.com/Varriount/NimLime diff --git a/assets/syntaxes/Nim.sublime-syntax b/assets/syntaxes/Nim.sublime-syntax new file mode 100644 index 00000000..d693c3b0 --- /dev/null +++ b/assets/syntaxes/Nim.sublime-syntax @@ -0,0 +1,257 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: Nim +file_extensions: + - nim + - nims +scope: source.nim +contexts: + main: + - match: '(\#\[\s*(TODO|todo)?)' + comment: A multiline comment. + captures: + 1: punctuation.definition.multi-comment.nim + 2: invalid.illegal.TODO.nim + push: + - meta_scope: comment.line.number-sign.multi-comment.nim + - match: '(.*]\#)' + captures: + 1: punctuation.definition.multi-comment.nim + 2: invalid.illegal.TODO.nim + pop: true + - match: (##\s*(TODO|todo)?).+$\n? + comment: A documentation comment. + scope: comment.line.number-sign.doc-comment.nim + captures: + 1: punctuation.definition.doc-comment.nim + 2: invalid.illegal.TODO.nim + - match: (##\s*)$\n? + comment: An empty documentation comment. + scope: comment.line.number-sign.doc-comment.empty.nim + captures: + 1: punctuation.definition.doc-comment.empty.nim + - match: (#\s*(TODO|todo)?).*$\n? + comment: A regular comment + scope: comment.line.number-sign.comment.nim + captures: + 1: punctuation.definition.comment.nim + 2: invalid.illegal.TODO.nim + - match: '\{\.' + comment: Pragmas + push: + - meta_scope: pragma + - match: '\.?\}' + pop: true + - match: \" + push: + - meta_scope: string.something.nim + - match: \" + pop: true + - match: '([\w\x{80}-\x{10FFFF}]+)' + scope: entity.other.attribute-name.pragma.nim + - match: discard \"\"\" + comment: A discarded triple string literal comment + push: + - meta_scope: comment.line.discarded.nim + - match: \"\"\" + pop: true + - match: '(?|@|\$|~|&|%|!|\?|\^|\.|:|\\)+) + comment: Generic operators for expressions. + scope: keyword.operator.nim + - match: (for)\s+ + comment: in keyword in a 'for' loop + captures: + 1: keyword.control.nim + push: + - meta_scope: meta.forloop.nim + - match: (?=:) + captures: + 1: keyword.control.nim + pop: true + - match: '\ [\w\x{80}-\x{10FFFF},]+\s+(in)\s+' + captures: + 1: keyword.control.nim + - include: scope:source.nim + - match: '((import)\s+[\.|\w|\/]+,?)' + comment: Import syntax + captures: + 2: keyword.control.nim + - match: '(from)\s+[\/\w]+\s+(?=import)' + captures: + 1: keyword.control.nim + - match: (var|let)\s*\( + comment: Destructure syntax + captures: + 1: keyword.other.nim + push: + - match: \) + captures: + 1: keyword.other.nim + pop: true + - match: '((?