diff --git a/.github/ISSUE_TEMPLATE/01-bug-syntax-highlighting.md b/.github/ISSUE_TEMPLATE/01-bug-syntax-highlighting.md new file mode 100644 index 0000000000..c95c3e13ed --- /dev/null +++ b/.github/ISSUE_TEMPLATE/01-bug-syntax-highlighting.md @@ -0,0 +1,25 @@ +--- +name: Syntax Highlighting problem +about: Create a bug report for mis-highlighted code in one of the default languages. + +--- + + + +- Sublime Version: +- OS Version: + + + +``` lang +# Minimum code snippet to demonstrate the issue +``` + + diff --git a/.github/ISSUE_TEMPLATE/02-bug-file-indexing.md b/.github/ISSUE_TEMPLATE/02-bug-file-indexing.md new file mode 100644 index 0000000000..44996ffb90 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/02-bug-file-indexing.md @@ -0,0 +1,26 @@ +--- +name: Go to Symbol problem +about: Create a bug report for file indexing in one of the default languages. + +--- + + + +- Sublime Version: +- OS Version: + +## Expected behavior + +## Actual behavior + +## Steps to reproduce + +1. +2. diff --git a/.github/ISSUE_TEMPLATE/03-supporting-files.md b/.github/ISSUE_TEMPLATE/03-supporting-files.md new file mode 100644 index 0000000000..f574ed342a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/03-supporting-files.md @@ -0,0 +1,26 @@ +--- +name: Snippet, Completion, Indentation, or Build problem +about: Suggest improvements for one of the default language support files. + +--- + + + +- Sublime Version: +- OS Version: + +## Expected behavior + +## Actual behavior + +## Steps to reproduce + +1. +2. diff --git a/.github/PULL_REQUEST_TEMPLATE/01-syntax-update-small.md b/.github/PULL_REQUEST_TEMPLATE/01-syntax-update-small.md new file mode 100644 index 0000000000..ccc3d92a75 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/01-syntax-update-small.md @@ -0,0 +1,11 @@ +--- +name: Small update to Syntax definition +about: I have made easily-reviewable changes to a `.sublime-syntax` file. +title: [PackageName] update_summary + +--- + +- [ ] My commit messages start with the package name in square brackets, e.g. `[XML]`. +- [ ] I have included new or enhanced [syntax tests][] to cover the changes. + +[syntax tests]: https://www.sublimetext.com/docs/3/syntax.html#testing diff --git a/.github/PULL_REQUEST_TEMPLATE/02-syntax-update-significant.md b/.github/PULL_REQUEST_TEMPLATE/02-syntax-update-significant.md new file mode 100644 index 0000000000..c369c92db4 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/02-syntax-update-significant.md @@ -0,0 +1,33 @@ +--- +name: Large update to Syntax definition +about: I have made significant changes to a `.sublime-syntax` file. +title: [PackageName] update_summary + +--- + +- [ ] My commit messages start with the package name in square brackets, e.g. `[XML]`. +- [ ] I have included new or enhanced [syntax tests][] to cover the changes. +- [ ] I have included a performance comparison below: + + +## Performance + + +### Before changes + +``` +Syntax "Packages/PackageName/lang.sublime-syntax" took an average of 10.0ms over 10 runs +Syntax "Packages/PackageName/lang-types.sublime-syntax" took an average of 2.0ms over 10 runs +``` + +### After changes + +``` +Syntax "Packages/PackageName/lang.sublime-syntax" took an average of 10.2ms over 10 runs +Syntax "Packages/PackageName/lang-types.sublime-syntax" took an average of 2.0ms over 10 runs +``` + +[syntax tests]: https://www.sublimetext.com/docs/3/syntax.html#testing diff --git a/.github/PULL_REQUEST_TEMPLATE/03-supporting-files.md b/.github/PULL_REQUEST_TEMPLATE/03-supporting-files.md new file mode 100644 index 0000000000..741b9fb00f --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/03-supporting-files.md @@ -0,0 +1,8 @@ +--- +name: Update to supporting files +about: My changes do not include any `.sublime-syntax` file. +title: [PackageName] update_summary + +--- + +- [ ] My commit messages start with the package name in square brackets, e.g. `[XML]`. diff --git a/.travis.yml b/.travis.yml index 74c85d2d8a..66fca00346 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,17 @@ +dist: bionic sudo: false language: c branches: except: - /^v[0-9]{4}$/ +before_install: + - sudo apt-get -y install libgl1-mesa-glx + - sudo apt-get -y install libglu1-mesa install: - - wget --content-disposition https://download.sublimetext.com/latest/dev/linux/x64/syntax_tests - - tar xf "$(ls st3_syntax_tests_build_*_x64.tar.bz2)" - - mv st3_syntax_tests/syntax_tests ./ - - rm -R st3_syntax_tests* + - wget --content-disposition https://download.sublimetext.com/st_syntax_tests_build_4052_x64.tar.bz2 + - tar xf "$(ls st_syntax_tests_build_*_x64.tar.bz2)" + - mv st_syntax_tests/syntax_tests ./ + - rm -R st_syntax_tests* before_script: - mkdir -p Data/Packages/ - find . -maxdepth 1 -mindepth 1 -type d -not -name 'Data' -exec mv '{}' Data/Packages/ \; diff --git a/ActionScript/ActionScript.sublime-syntax b/ActionScript/ActionScript.sublime-syntax index b08610c859..a1f0ae038a 100644 --- a/ActionScript/ActionScript.sublime-syntax +++ b/ActionScript/ActionScript.sublime-syntax @@ -54,6 +54,9 @@ contexts: captures: 0: punctuation.definition.comment.actionscript.2 pop: true + - match: ^\s*(\*)(?!/) + captures: + 1: punctuation.definition.comment.actionscript.2 - match: (//).*$\n? scope: comment.line.double-slash.actionscript.2 captures: diff --git a/ActionScript/syntax_test_as.as b/ActionScript/syntax_test_as.as new file mode 100644 index 0000000000..97a9ade072 --- /dev/null +++ b/ActionScript/syntax_test_as.as @@ -0,0 +1,5 @@ +/* SYNTAX TEST "Packages/ActionScript/ActionScript.sublime-syntax" */ + +/** + * +/* ^ comment.block.actionscript.2 punctuation.definition.comment.actionscript.2 */ \ No newline at end of file diff --git a/Batch File/Batch File.sublime-syntax b/Batch File/Batch File.sublime-syntax index d2306a3ee5..315aab42d6 100644 --- a/Batch File/Batch File.sublime-syntax +++ b/Batch File/Batch File.sublime-syntax @@ -27,8 +27,14 @@ contexts: - include: escaped_characters - include: variables - include: commands - - match: \b(?i)(?:goto|call|exit)\b + - match: \b(?i)exit\b scope: keyword.control.statement.dosbatch + - match: \b(?i)(goto|call)\b(?:\s*(:)?(?:(eof)|(\w+)))? + captures: + 1: keyword.control.statement.dosbatch + 2: punctuation.separator.dosbatch + 3: keyword.control.flow.return.dosbatch + 4: meta.function-call.dosbatch variable.function.dosbatch - match: \b(?i)(if)\s+(?:(not)\s+)?(exist|defined|errorlevel|cmdextversion)\b captures: 1: keyword.control.conditional.dosbatch @@ -232,6 +238,11 @@ contexts: scope: variable.parameter.dosbatch captures: 1: punctuation.definition.variable.dosbatch + - match: (?i)(%)errorlevel(%) + scope: variable.language.dosbatch + captures: + 1: punctuation.definition.variable.begin.dosbatch + 2: punctuation.definition.variable.end.dosbatch - include: variable - include: variable_delayed_expansion diff --git a/Batch File/Symbol List.tmPreferences b/Batch File/Symbol List.tmPreferences index 3e60a1b0bc..c9efab6d70 100644 --- a/Batch File/Symbol List.tmPreferences +++ b/Batch File/Symbol List.tmPreferences @@ -4,11 +4,13 @@ name Symbol List scope - source.dosbatch entity.name.label.dosbatch + source.dosbatch entity.name.label - meta.function-call settings showInSymbolList 1 + showInIndexedSymbolList + 1 diff --git a/Batch File/syntax_test_batch_file.bat b/Batch File/syntax_test_batch_file.bat index 8c578c8178..0495bcb4ea 100644 --- a/Batch File/syntax_test_batch_file.bat +++ b/Batch File/syntax_test_batch_file.bat @@ -67,6 +67,18 @@ ECHO " GOTO:EOF :: ^^^^ keyword.control.statement.dosbatch +:: ^ punctuation.separator.dosbatch +:: ^^^ keyword.control.flow.return.dosbatch + + GOTO :End +:: ^^^^ keyword.control.statement.dosbatch +:: ^ punctuation.separator.dosbatch +:: ^^^ meta.function-call.dosbatch variable.function.dosbatch + + GOTO:End +:: ^^^^ keyword.control.statement.dosbatch +:: ^ punctuation.separator.dosbatch +:: ^^^ meta.function-call.dosbatch variable.function.dosbatch :: Redirection ECHO Hello World! > hello.txt @@ -96,6 +108,13 @@ ECHO " :: ^^^ keyword.operator.logical.dosbatch :: ^^^ keyword.operator.comparison.dosbatch + + IF %ERRORLEVEL% NEQ 0 EXIT /B 1 +:: ^^ keyword.control.conditional.dosbatch +:: ^^^^^^^^^^^^ variable.language.dosbatch +:: ^ punctuation.definition.variable.begin.dosbatch +:: ^ variable.language.dosbatch punctuation.definition.variable.end.dosbatch + IF foo == bar :: ^^ keyword.control.conditional.dosbatch :: ^^ keyword.operator.comparison.dosbatch diff --git a/C#/C#.sublime-syntax b/C#/C#.sublime-syntax index c891a1d3ed..ed494f8b25 100644 --- a/C#/C#.sublime-syntax +++ b/C#/C#.sublime-syntax @@ -16,18 +16,11 @@ variables: bin_op: '(?:\+|->|-|\*|/|%|\|\||&&|\||&|\^|<<|>>|=>|<=|<|>=|>|==|!=|\?\?)' unary_op: '(?:\+\+|--|-|~|!|&|\*)' - # digit separators - digit_separators: '(?:(?:_+[0-9]+)*)' - - # integers - hex_numeral: '(0[xX])_*\h+(?:_+\h+)*' - binary_numeral: '(0[bB])_*[01]+(?:_+[01]+)*' - decimal_numeral: '(0|[1-9][0-9]*{{digit_separators}})((?i:ul|lu|u|l)?)' - - # floating point numbers - exponent: '[eE][+\-]?[0-9]+{{digit_separators}}' - floating_point: '([0-9]+{{digit_separators}}(?={{floating_point_suffix}}|[.Ee])(?:\.[0-9]+{{digit_separators}})?(?:{{exponent}})?)({{floating_point_suffix}}?)' - floating_point_suffix: '[fFdDmM]' + # numbers + dec_digits: (?:[\d_]*\d) + dec_exponent: (?:[eE][-+]??{{dec_digits}}) + float_suffix: '[fFdDmM]' + integer_suffix: '[uU][lL]?|[lL][uU]?' # characters unicode_char: '(?:\\u\h{4}|\\U\h{8})' @@ -79,6 +72,9 @@ contexts: - match: '\*/' scope: punctuation.definition.comment.end.cs pop: true + - match: ^\s*(\*)(?!/) + captures: + 1: punctuation.definition.comment.cs - include: comments_in comments_in: @@ -130,10 +126,10 @@ contexts: 1: keyword.other.preprocessor.cs 2: keyword.other.preprocessor.cs push: option_done - - match: '\b(line)\s+([0-9]*)\s+((").*("))?' + - match: '\b(line)\s+(\d*)\s+((").*("))?' captures: 1: keyword.other.preprocessor.cs - 2: constant.numeric.cs + 2: constant.numeric.integer.decimal.cs 3: string.quoted.double.cs 4: punctuation.definition.string.begin.cs 5: punctuation.definition.string.end.cs @@ -147,8 +143,8 @@ contexts: scope: punctuation.definition.string.begin.cs push: - meta_scope: string.quoted.double.hash.cs - - match: '[0-9a-fA-F-]+' - scope: constant.numeric.cs + - match: '[-\h]+' + scope: constant.numeric.integer.hexadecimal.cs - match: '}"' scope: punctuation.definition.string.end.cs pop: true @@ -955,7 +951,7 @@ contexts: 2: variable.other.cs 3: keyword.operator.assignment.variable.cs set: line_of_code_in - - match: (?=var\s+\() + - match: (?=var\s*\() push: var_declaration - include: lambdas - match: (?:\b(ref)\s+)?\b(?={{namespaced_name}}{{type_suffix}}\s+{{name}}(?!\s*(?:[(:]))) @@ -1534,22 +1530,24 @@ contexts: - match: (')[^']+(') scope: invalid.illegal.not_a_char.cs # numbers - - match: '{{hex_numeral}}' + - match: (0[xX])[\h_]*\h scope: constant.numeric.integer.hexadecimal.cs captures: - 1: punctuation.definition.numeric.hexadecimal.cs - - match: '{{binary_numeral}}' + 1: punctuation.definition.numeric.base.cs + - match: (0[bB])[01_]*[01] scope: constant.numeric.integer.binary.cs captures: - 1: punctuation.definition.numeric.binary.cs - - match: '{{floating_point}}' + 1: punctuation.definition.numeric.base.cs + - match: '{{dec_digits}}(?:(?:(?:(\.){{dec_digits}}){{dec_exponent}}?|{{dec_exponent}})({{float_suffix}})?|({{float_suffix}}))' + scope: constant.numeric.float.decimal.cs captures: - 1: constant.numeric.float.decimal.cs + 1: punctuation.separator.decimal.cs 2: storage.type.numeric.cs - - match: '{{decimal_numeral}}' + 3: storage.type.numeric.cs + - match: (?:0|[1-9]{{dec_digits}}?)({{integer_suffix}})? + scope: constant.numeric.integer.decimal.cs captures: - 1: constant.numeric.integer.decimal.cs - 2: storage.type.numeric.cs + 1: storage.type.numeric.cs # strings - match: '"' scope: punctuation.definition.string.begin.cs @@ -1558,11 +1556,16 @@ contexts: string: - meta_include_prototype: false - meta_scope: string.quoted.double.cs - - include: escaped + - include: string_escaped - match: '"' scope: punctuation.definition.string.end.cs pop: true - include: string_placeholders + - match: '(\{)(\d+)' + captures: + 1: punctuation.definition.placeholder.begin.cs + 2: constant.numeric.integer.decimal.cs + push: string_placeholder - match: $\n? scope: invalid.illegal.unclosed-string.cs pop: true @@ -1573,15 +1576,17 @@ contexts: - match: '"' scope: punctuation.definition.string.end.cs pop: true - - include: escaped + - include: string_escaped - include: string_placeholder_escape - match: \{ scope: punctuation.section.interpolation.begin.cs push: - - meta_scope: meta.string.interpolated.cs source.cs + - meta_scope: meta.string.interpolated.cs + - meta_content_scope: source.cs - clear_scopes: 2 - match: $ pop: true + - include: string_placeholder_format - include: string_interpolation - match: $\n? scope: invalid.illegal.unclosed-string.cs @@ -1590,8 +1595,7 @@ contexts: long_format_string: - meta_include_prototype: false - meta_scope: meta.string.interpolated.cs string.quoted.double.raw.cs - - match: '""' - scope: constant.character.escape.cs + - include: long_string_escaped - match: '"' scope: punctuation.definition.string.end.cs pop: true @@ -1599,8 +1603,10 @@ contexts: - match: \{ scope: punctuation.section.interpolation.begin.cs push: - - meta_scope: meta.string.interpolated.cs source.cs + - meta_scope: meta.string.interpolated.cs + - meta_content_scope: source.cs - clear_scopes: 2 + - include: long_string_placeholder_format - include: string_interpolation string_placeholder_escape: @@ -1615,32 +1621,37 @@ contexts: scope: constant.other.placeholder.cs captures: 1: punctuation.definition.placeholder.begin.cs - 2: constant.numeric.cs invalid.illegal.unclosed-string-placeholder.cs - - match: '(\{)(\d+)' - captures: - 1: punctuation.definition.placeholder.begin.cs - 2: constant.numeric.cs - push: string_placeholder + 2: constant.numeric.integer.decimal.cs invalid.illegal.unclosed-string-placeholder.cs - string_placeholder: - - meta_scope: constant.other.placeholder.cs + inside_string_placeholder: - match: '(\})(\}(?!\}))?' captures: 1: punctuation.definition.placeholder.end.cs 2: invalid.illegal.unescaped-placeholder.cs pop: true - - match: '(?=[}"])' + - match: (?=[}"]) pop: true + + string_placeholder: + - meta_scope: constant.other.placeholder.cs + - include: inside_string_placeholder - include: string_placeholder_format - match: '[^"}]+' scope: invalid.illegal.unexpected-character-in-placeholder.cs + long_string_placeholder: + - meta_scope: constant.other.placeholder.cs + - include: inside_string_placeholder + - include: long_string_placeholder_format + - match: '[^"}]+' + scope: invalid.illegal.unexpected-character-in-placeholder.cs + string_placeholder_format: - match: '\s*(?:(,)\s*(-?\d+)\s*)?' captures: 1: punctuation.separator.arguments.cs - 2: constant.numeric.formatting.cs - - match: ':(?="(?!"))' + 2: constant.numeric.integer.decimal.formatting.cs + - match: ':(?=")' scope: invalid.illegal.unclosed-string-placeholder.cs pop: true - match: ':' @@ -1648,17 +1659,40 @@ contexts: push: - meta_scope: constant.other.format-spec.cs - include: string_placeholder_escape - - include: escaped + - include: string_escaped - match: '(?=\})' pop: true - - match: '([^}"\\]+(\\.)*)+(?="(?!"))' + - match: '([^}"\\]+(\\.)*)+(?=")' scope: invalid.illegal.unclosed-string-placeholder.cs pop: true - match: '\{' scope: invalid.illegal.unescaped-placeholder.cs + long_string_placeholder_format: + - match: '\s*(?:(,)\s*(-?\d+)\s*)?' + captures: + 1: punctuation.separator.arguments.cs + 2: constant.numeric.integer.decimal.formatting.cs + - match: ':(?="(?!"))' + scope: invalid.illegal.unclosed-string-placeholder.cs + pop: true + - match: ':' + scope: punctuation.separator.cs + push: + - meta_scope: constant.other.format-spec.cs + - include: string_placeholder_escape + - include: long_string_escaped + - match: (?=\}) + pop: true + - match: \\(?:""|[^"]) + scope: constant.character.escape.cs + - match: (?:[^}"]+|"")+(?="(?!")) + scope: invalid.illegal.unclosed-string-placeholder.cs + pop: true + - match: \{ + scope: invalid.illegal.unescaped-placeholder.cs + string_interpolation: - - include: string_placeholder_format - match: '\}' scope: punctuation.section.interpolation.end.cs pop: true @@ -1667,9 +1701,13 @@ contexts: long_string: - meta_include_prototype: false - meta_scope: string.quoted.double.raw.cs - - match: '""' - scope: constant.character.escape.cs + - include: long_string_escaped - include: string_placeholders + - match: '(\{)(\d+)' + captures: + 1: punctuation.definition.placeholder.begin.cs + 2: constant.numeric.integer.decimal.cs + push: long_string_placeholder - match: '"' scope: punctuation.definition.string.end.cs pop: true @@ -1677,9 +1715,16 @@ contexts: escaped: - match: '{{escaped_char}}' scope: constant.character.escape.cs + + string_escaped: + - include: escaped - match: \\ scope: invalid.illegal.lone-escape.cs + long_string_escaped: + - match: '""' + scope: constant.character.escape.cs + initializer_constructor: - meta_content_scope: meta.instance.cs meta.braces.cs - match: \} @@ -1907,7 +1952,7 @@ contexts: pop: true var_declaration: - - match: (var)\s+(\() + - match: (var)\s*(\() captures: 1: storage.type.variable.cs 2: meta.group.tuple.cs punctuation.definition.group.begin.cs diff --git a/C#/Symbol List Classes.tmPreferences b/C#/Symbol List Classes.tmPreferences index ac3594e683..b7320d3ec4 100644 --- a/C#/Symbol List Classes.tmPreferences +++ b/C#/Symbol List Classes.tmPreferences @@ -11,10 +11,6 @@ 1 showInIndexedSymbolList 1 - symbolTransformation - - s/^/class /; - diff --git a/C#/Symbol List Enums.tmPreferences b/C#/Symbol List Enums.tmPreferences index bc727e5b6b..78d3c43fe7 100644 --- a/C#/Symbol List Enums.tmPreferences +++ b/C#/Symbol List Enums.tmPreferences @@ -11,10 +11,6 @@ 1 showInIndexedSymbolList 1 - symbolTransformation - - s/^/enum /; - diff --git a/C#/Symbol List Interfaces.tmPreferences b/C#/Symbol List Interfaces.tmPreferences index 0d1e01f785..95b950da6d 100644 --- a/C#/Symbol List Interfaces.tmPreferences +++ b/C#/Symbol List Interfaces.tmPreferences @@ -11,10 +11,6 @@ 1 showInIndexedSymbolList 1 - symbolTransformation - - s/^/interface /; - diff --git a/C#/Symbol List Namespace.tmPreferences b/C#/Symbol List Namespace.tmPreferences index c9fcdde0d3..54128ce219 100644 --- a/C#/Symbol List Namespace.tmPreferences +++ b/C#/Symbol List Namespace.tmPreferences @@ -9,8 +9,6 @@ showInSymbolList 1 - symbolTransformation - s/^/namespace /; diff --git a/C#/Symbol List Structs.tmPreferences b/C#/Symbol List Structs.tmPreferences new file mode 100644 index 0000000000..80ce2026a9 --- /dev/null +++ b/C#/Symbol List Structs.tmPreferences @@ -0,0 +1,16 @@ + + + + name + Symbol List: Struct + scope + source.cs entity.name.struct + settings + + showInSymbolList + 1 + showInIndexedSymbolList + 1 + + + diff --git a/C#/tests/syntax_test_C#7.cs b/C#/tests/syntax_test_C#7.cs index 23b7b88708..e125f0989d 100644 --- a/C#/tests/syntax_test_C#7.cs +++ b/C#/tests/syntax_test_C#7.cs @@ -26,7 +26,7 @@ void Main(string[] args) { /// ^^^ storage.type /// ^ - entity.name /// ^ keyword.operator.assignment -/// ^^ constant.numeric +/// ^^ constant.numeric.integer.decimal /// ^ punctuation.terminator // simple nested function @@ -138,23 +138,26 @@ void Main(string[] args) { /// ^^^ variable.function /// ^^^ meta.group meta.group /// ^ punctuation.section.group.begin -/// ^ constant.numeric +/// ^ constant.numeric.integer.decimal /// ^ punctuation.section.group.end /// ^ punctuation.section.group.end // https://github.com/dotnet/roslyn/pull/2950 int bin = 0b1001_1010_0001_0100; /// ^^^^^^^^^^^^^^^^^^^^^ constant.numeric.integer.binary -/// ^^ punctuation.definition.numeric.binary +/// ^^ punctuation.definition.numeric.base int hex = 0x1b_a0_44_fe; /// ^^^^^^^^^^^^^ constant.numeric.integer.hexadecimal -/// ^^ punctuation.definition.numeric.hexadecimal +/// ^^ punctuation.definition.numeric.base int dec = 33_554_432; /// ^^^^^^^^^^ constant.numeric.integer.decimal int weird = 1_2__3___4____5_____6______7_______8________9; /// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant.numeric.integer.decimal double real = 1_000.111_1e-1_000; /// ^^^^^^^^^^^^^^^^^^ constant.numeric.float.decimal +/// ^ punctuation.separator.decimal.cs + double real = 1_000e-1_000; +/// ^^^^^^^^^^^^ constant.numeric.float.decimal double dbl = 33_554_432.5_2; /// ^^^^^^^^^^^^^^ constant.numeric.float.decimal long lng = 33_554_4321L; @@ -163,15 +166,15 @@ void Main(string[] args) { bin = _0b1001_1010_0001_0100; /// ^^^^^^^^^^^^^^^^^^^^^^ variable.other bin = 0b1001_1010_0001_0100_; -/// ^ - constant.numeric +/// ^ - constant.numeric.integer.binary bin = 0b_1001_1010_0001_0100; -/// ^^^^^^^^^^^^^^^^^^^^^^ constant.numeric +/// ^^^^^^^^^^^^^^^^^^^^^^ constant.numeric.integer.binary bin = 0b__1001__1010__0001__0_1_0_0; -/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant.numeric +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant.numeric.integer.binary hex = _0x1b_a0_44_fe; /// ^^^^^^^^^^^^^^ variable.other hex = 0x_1b_a0_44_fe; -/// ^^^^^^^^^^^^^^ constant.numeric +/// ^^^^^^^^^^^^^^ constant.numeric.integer.hexadecimal int abc = _123; /// ^^^^ variable.other @@ -185,7 +188,7 @@ void Main(string[] args) { /// ^ punctuation.accessor.dot /// ^^^^ variable.other /// ^^ keyword.operator -/// ^ constant.numeric +/// ^ constant.numeric.integer.decimal /// ^ punctuation.separator.case-statement Console.WriteLine($"The shape: {sh.GetType().Name} with no dimensions"); break; @@ -197,7 +200,7 @@ void Main(string[] args) { /// ^^^^ keyword.control.switch.case.when /// ^^^^^^^ variable.other /// ^^ keyword.operator -/// ^ constant.numeric +/// ^ constant.numeric.integer.decimal /// ^ punctuation.separator.case-statement case Shape shape when shape.Area > 0: /// ^^^^ keyword.control.switch.case @@ -211,7 +214,7 @@ void Main(string[] args) { /// ^ punctuation.accessor.dot /// ^^^^ variable.other /// ^ keyword.operator -/// ^ constant.numeric +/// ^ constant.numeric.integer.decimal /// ^ punctuation.separator.case-statement } @@ -439,7 +442,7 @@ public void TupleTest () { /// ^ meta.group.tuple punctuation.section.group.begin /// ^^^^^^^^^^^^^^^^ meta.function.anonymous /// ^ punctuation.separator.tuple - meta.function.anonymous -/// ^ constant.numeric.float.decimal +/// ^ constant.numeric.integer.decimal /// ^ punctuation.accessor.dot /// ^^^^^^^^ variable.function /// ^ punctuation.section.group.begin @@ -465,6 +468,23 @@ public void TupleTest () { { Console.WriteLine($"{name} is {age} years old."); } + + var positions = new List<(int, int)> { (0, 1), (1, 2), (2, 4) }; + foreach (var(x, y) in positions) +/// ^ punctuation.section.group.begin +/// ^^^storage.type.variable +/// ^^^^^^ meta.group.tuple +/// ^ punctuation.definition.group.begin +/// ^ variable.other +/// ^ punctuation.separator.tuple +/// ^ variable.other +/// ^ punctuation.definition.group.end +/// ^^ keyword.control.flow +/// ^^^^^^^^^ variable.other +/// ^ punctuation.section.group.end + { + Console.WriteLine($"x={x} y={y}"); + } } private static (int Max, int Min) Range(IEnumerable numbers) diff --git a/C#/tests/syntax_test_Comments.cs b/C#/tests/syntax_test_Comments.cs index 304d155968..1dcfbb52e7 100755 --- a/C#/tests/syntax_test_Comments.cs +++ b/C#/tests/syntax_test_Comments.cs @@ -30,6 +30,10 @@ namespace HelloWorld //* ^ punctuation.separator.argument.value //* ^ punctuation.definition.tag.end //* ^^^^^^^^^ text.documentation + /** + * +//* ^ meta.namespace.cs meta.block.cs comment.block.cs punctuation.definition.comment.cs + */ class Hello { /// diff --git a/C#/tests/syntax_test_GeneralStructure.cs b/C#/tests/syntax_test_GeneralStructure.cs index fa0346e292..59ea150aa0 100755 --- a/C#/tests/syntax_test_GeneralStructure.cs +++ b/C#/tests/syntax_test_GeneralStructure.cs @@ -1236,6 +1236,25 @@ void TestMe () { /// ^^^^^ variable.other - variable.parameter /// ^^^^^ variable.other - variable.parameter /// ^^ keyword.operator - keyword.operator.assignment + formatted = string.Format(@"GMT is {0:yyyyMMdd\THHmmss\Z}", DateTime.Now.ToUniversalTime()); +/// ^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double.raw constant.other.placeholder + formatted = string.Format("GMT is {0:yyyyMMdd\\THHmmss\\Z}", DateTime.Now.ToUniversalTime()); +/// ^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double constant.other.placeholder + Console.WriteLine($@"GMT is {DateTime.Now:yyyyMMdd\THHmmss\Z}"); +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.interpolated +/// ^ punctuation.separator +/// ^^^^^^^^^^^^^^^^^^^ constant.other.format-spec + Console.WriteLine($"GMT is {DateTime.Now:yyyyMMdd\THHmmss\Z}"); +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.interpolated +/// ^ punctuation.separator +/// ^^^^^^^^^^^^^^^^^^^ constant.other.format-spec +/// ^ invalid.illegal.lone-escape +/// ^ invalid.illegal.lone-escape + Console.WriteLine($@"GMT is {DateTime.Now:yyyyMMdd\T\""\x1043HHmmss\Z}"); +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant.other.format-spec - invalid +/// ^^^^^^^ constant.character.escape +/// ^^^^^^^^^^ - constant.character.escape +/// ^^ constant.character.escape } } ///<- punctuation.section.block.end diff --git a/C#/tests/syntax_test_Generics.cs b/C#/tests/syntax_test_Generics.cs index d66e26a8ec..9c1a49c377 100755 --- a/C#/tests/syntax_test_Generics.cs +++ b/C#/tests/syntax_test_Generics.cs @@ -65,12 +65,12 @@ /// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.interpolated /// ^ variable.other /// ^ punctuation.separator -/// ^^^ constant.numeric +/// ^^^ constant.numeric.integer.decimal /// ^ punctuation.section.interpolation.end /// ^ punctuation.section.interpolation.begin /// ^ variable.other /// ^ punctuation.separator -/// ^ constant.numeric +/// ^ constant.numeric.integer.decimal /// ^ punctuation.separator /// ^^ constant.other.format-spec /// ^^ constant.character.escape @@ -103,7 +103,7 @@ string unclosed_interpolation = $"inner {2} /// ^ punctuation.section.interpolation.begin.cs -/// ^ constant.numeric +/// ^ constant.numeric.integer.decimal.cs /// ^ punctuation.section.interpolation.end.cs /// ^ invalid.illegal.unclosed-string.cs diff --git a/C#/tests/syntax_test_Operators.cs b/C#/tests/syntax_test_Operators.cs index ed049b05e8..fe7104e193 100755 --- a/C#/tests/syntax_test_Operators.cs +++ b/C#/tests/syntax_test_Operators.cs @@ -57,10 +57,10 @@ /// ^ punctuation.terminator var c = 5 * 4; -/// ^ constant.numeric +/// ^ constant.numeric.integer.decimal /// ^ keyword.operator /// ^ - keyword.operator.pointer -/// ^ constant.numeric +/// ^ constant.numeric.integer.decimal x >>= y /// ^^^ keyword.operator diff --git a/C#/tests/syntax_test_PreprocessorDirectives.cs b/C#/tests/syntax_test_PreprocessorDirectives.cs index 1c277a534a..bc5338cde4 100755 --- a/C#/tests/syntax_test_PreprocessorDirectives.cs +++ b/C#/tests/syntax_test_PreprocessorDirectives.cs @@ -13,7 +13,7 @@ #pragma checksum "file.cs" "{3673e4ca-6098-4ec1-890f-8fceb2a794a2}" "{012345678AB}" // New checksum // ^ keyword.other.preprocessor // ^ stirng.quoted.double -// ^ constant.numeric +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant.numeric.integer.hexadecimal #region /// ^^ meta.preprocessor keyword.other.preprocessor diff --git a/C#/tests/syntax_test_c#.cs b/C#/tests/syntax_test_c#.cs index 63d6b6a298..30932bd31b 100644 --- a/C#/tests/syntax_test_c#.cs +++ b/C#/tests/syntax_test_c#.cs @@ -149,52 +149,64 @@ int Zoo() class Syntax { public decimal decimal1 = 1.0m; - // ^^^ constant.numeric + // ^^^^ constant.numeric.float.decimal + // ^ punctuation.separator.decimal.cs // ^ storage.type.numeric public decimal decimal2 = 2.0M; - // ^^^ constant.numeric + // ^^^^ constant.numeric.float.decimal + // ^ punctuation.separator.decimal.cs // ^ storage.type.numeric public double double1 = 1.0d; - // ^^^ constant.numeric + // ^^^^ constant.numeric.float.decimal + // ^ punctuation.separator.decimal.cs // ^ storage.type.numeric public double double2 = 2.0D; - // ^^^ constant.numeric + // ^^^^ constant.numeric.float.decimal + // ^ punctuation.separator.decimal.cs // ^ storage.type.numeric + public double double3 = 2D; + // ^^ constant.numeric.float.decimal + // ^ storage.type.numeric public float float1 = 1.0f; - // ^^^ constant.numeric + // ^^^^ constant.numeric.float.decimal + // ^ punctuation.separator.decimal.cs // ^ storage.type.numeric public float float2 = 2.0F; - // ^^^ constant.numeric + // ^^^^ constant.numeric.float.decimal + // ^ punctuation.separator.decimal.cs + // ^ storage.type.numeric + public double double3 = 2f; + // ^^ constant.numeric.float.decimal // ^ storage.type.numeric public long long1 = 1l; - // ^ constant.numeric + // ^^ constant.numeric // ^ storage.type.numeric public long long2 = 2L; - // ^ constant.numeric + // ^^ constant.numeric // ^ storage.type.numeric public ulong ulong1 = 1ul; - // ^ constant.numeric + // ^^^ constant.numeric // ^^ storage.type.numeric public ulong ulong2 = 2UL; - // ^ constant.numeric + // ^^^ constant.numeric // ^^ storage.type.numeric public ulong ulong3 = 3lu; - // ^ constant.numeric + // ^^^ constant.numeric // ^^ storage.type.numeric public ulong ulong4 = 4LU; - // ^ constant.numeric + // ^^^ constant.numeric // ^^ storage.type.numeric public ulong ulong5 = 5uL; - // ^ constant.numeric + // ^^^ constant.numeric // ^^ storage.type.numeric public ulong ulong6 = 6Ul; - // ^ constant.numeric + // ^^^ constant.numeric // ^^ storage.type.numeric public ulong ulong7 = 7lU; - // ^ constant.numeric + // ^^^ constant.numeric // ^^ storage.type.numeric public ulong ulong8 = 8Lu; - // ^ constant.numeric + // ^^^ constant.numeric // ^^ storage.type.numeric public ulong bad = 1UU; // ^ - storage.type.numeric diff --git a/C++/C++.sublime-syntax b/C++/C++.sublime-syntax index c4775cb930..aa34cf5368 100644 --- a/C++/C++.sublime-syntax +++ b/C++/C++.sublime-syntax @@ -20,6 +20,21 @@ file_extensions: first_line_match: '-\*- C\+\+ -\*-' scope: source.c++ variables: + # number digits + dec_digits: '(?:\d(?:[\d'']*\d)?)' + + # number exponents + dec_exponent: '(?:[eE][-+]??{{dec_digits}})' + hex_exponent: '(?:[pP][-+]??{{dec_digits}})' + + # number suffixes + # note: nearly everything can be defined as suffix via `operator` keyword + # see: https://en.cppreference.com/w/cpp/numeric/complex/operator%22%22i + dec_suffix: '(?:[a-zA-Z_][[:alnum:]_]*|(?=[^[:alnum:]_'']))' + hex_suffix: '(?:[g-zG-Z_][[:alnum:]_]*|(?=[^[:alnum:]_'']))' + float_suffix: '[fF]' + integer_suffix: '[lL]{1,2}[uU]?|[uU][lL]{0,2}' + identifier: \b[[:alpha:]_][[:alnum:]_]*\b # upper and lowercase macro_identifier: \b[[:upper:]_][[:upper:][:digit:]_]{2,}\b # only uppercase, at least 3 chars path_lookahead: '(?:::\s*)?(?:{{identifier}}\s*::\s*)*(?:template\s+)?{{identifier}}' @@ -40,12 +55,13 @@ variables: non_angle_brackets: '(?=<<|<=)' regular: '[^(){}&;*^%=<>-]*' + regular_plus: '[^(){}&;*^%=<>-]+' paren_open: (?:\( paren_close: '\))?' - generic_open: (?:< - generic_close: '>)?' + generic_open: (?:{{regular_plus}}(?:< + generic_close: '>)?)?' balance_parentheses: '{{regular}}{{paren_open}}{{regular}}{{paren_close}}{{regular}}' - generic_lookahead: <{{regular}}{{generic_open}}{{regular}}{{generic_open}}{{regular}}{{generic_close}}\s*{{generic_close}}{{balance_parentheses}}> + generic_lookahead: <{{generic_open}}{{generic_open}}{{regular}}{{generic_close}}\s*{{generic_close}}{{balance_parentheses}}> data_structures_forward_decl_lookahead: '(\s+{{macro_identifier}})*\s*(:\s*({{path_lookahead}}|{{visibility_modifiers}}|,|\s|<[^;]*>)+)?;' non_func_keywords: 'if|for|switch|while|decltype|sizeof|__declspec|__attribute__|typeid|alignof|alignas|static_assert' @@ -129,47 +145,113 @@ contexts: scope: punctuation.definition.string.end.c++ pop: true - unique-numbers: + numbers: + # https://en.cppreference.com/w/cpp/language/floating_literal + + # decimal floats - match: |- - (?x) - (?: - # floats - (?: - (?:\b\d(?:[\d']*\d)?\.\d(?:[\d']*\d)?|\B\.\d(?:[\d']*\d)?)(?:[Ee][+-]?\d(?:[\d']*\d)?)?(?:[fFlL]|(?:i[fl]?|h|min|[mun]?s|_\w*))?\b - | - (?:\b\d(?:[\d']*\d)?\.)(?:\B|(?:[fFlL]|(?:i[fl]?|h|min|[mun]?s|_\w*))\b|(?:[Ee][+-]?\d(?:[\d']*\d)?)(?:[fFlL]|(?:i[fl]?|h|min|[mun]?s|_\w*))?\b) - | - \b\d(?:[\d']*\d)?(?:[Ee][+-]?\d(?:[\d']*\d)?)(?:[fFlL]|(?:i[fl]?|h|min|[mun]?s|_\w*))?\b - ) - | - # ints - \b(?: + (?x: + \b{{dec_digits}} (?: - # dec - [1-9](?:[\d']*\d)? - | - # oct - 0(?:[0-7']*[0-7])? - | - # hex - 0[Xx][\da-fA-F](?:[\da-fA-F']*[\da-fA-F])? - | - # bin - 0[Bb][01](?:[01']*[01])? + (?: + (\.) + (?: + # 1.1, 1.1e1, 1.1e-1, 1.1f, 1.1e1f, 1.1e-1f, 1.1L, 1.1e1L, 1.1e-1L + {{dec_digits}} {{dec_exponent}}? + # 1.e1, 1.e-1, 1.e1f, 1.e-1f, 1.e1L, 1.e-1L + | {{dec_exponent}} + # 1., 1.f, 1.L # but not `..` + | (?!\.) + ) + # 1e1 1e1f 1e1L + | {{dec_exponent}} + ) ({{dec_suffix}})? + # 1f + | ({{float_suffix}}) ) - # int suffixes - (?:(?:l{1,2}|L{1,2})[uU]?|[uU](?:l{0,2}|L{0,2})|(?:i[fl]?|h|min|[mun]?s|_\w*))?)\b + # .1, .1e1, .1e-1, .1f, .1e1f, .1e-1f, .1L, .1e1L, .1e-1L + | (\.) {{dec_digits}} {{dec_exponent}}? ({{dec_suffix}})? ) - (?!\.) # Number must not be followed by a decimal point - scope: constant.numeric.c++ + scope: constant.numeric.float.decimal.c++ + captures: + 1: punctuation.separator.decimal.c++ + 2: storage.type.numeric.c++ + 3: storage.type.numeric.c++ + 4: punctuation.separator.decimal.c++ + 5: storage.type.numeric.c++ + + # hexadecimal float (C99) + - match: \b0[xX](?=[[:alnum:]_''.]+?[pP]) + scope: punctuation.definition.numeric.base.c++ + push: + - meta_include_prototype: false + - meta_scope: constant.numeric.float.hexadecimal.c++ + - match: '{{hex_exponent}}' + pop: true + - match: \. + scope: punctuation.separator.decimal.c++ + - match: \H + scope: invalid.illegal.numeric.digit.c++ + + # https://en.cppreference.com/w/c/language/integer_constant + + # binary integer + - match: \b0[bB] + scope: punctuation.definition.numeric.base.c++ + push: + - meta_include_prototype: false + - meta_scope: constant.numeric.integer.binary.c++ + - include: decimal-suffix + - match: '[2-9]' + scope: invalid.illegal.numeric.digit.c++ + # hexadecimal integer + - match: \b0[xX] + scope: punctuation.definition.numeric.base.c++ + push: + - meta_include_prototype: false + - meta_scope: constant.numeric.integer.hexadecimal.c++ + - include: hexadecimal-suffix + # octal integer + - match: \b0(?=[\d'']) + scope: punctuation.definition.numeric.base.c++ + push: + - meta_include_prototype: false + - meta_scope: constant.numeric.integer.octal.c++ + - include: decimal-suffix + - match: '[89]' + scope: invalid.illegal.numeric.digit.c++ + # decimal integer + - match: \b\d+ + push: + - meta_include_prototype: false + - meta_scope: constant.numeric.integer.decimal.c++ + - include: decimal-suffix + + decimal-suffix: + - match: '{{dec_suffix}}' + scope: storage.type.numeric.c++ + pop: true + + hexadecimal-suffix: + - match: '{{hex_suffix}}' + scope: storage.type.numeric.c++ + pop: true identifiers: - - match: '{{identifier}}\s*(::)\s*' + - match: '(?:(::)\s*)?{{identifier}}\s*(::)\s*' captures: - 1: punctuation.accessor.c++ + 1: punctuation.accessor.double-colon.c++ + 2: punctuation.accessor.double-colon.c++ - match: '(?:(::)\s*)?{{identifier}}' captures: - 1: punctuation.accessor.c++ + 1: punctuation.accessor.double-colon.c++ + + identifier-path-generic: + - include: angle-brackets + - match: '(?:(::)\s*)?{{identifier}}\s*(?=(<.*>)?\s*(::))\s*' + captures: + 1: punctuation.accessor.double-colon.c++ + 2: punctuation.accessor.double-colon.c++ function-specifiers: - match: \b(const|final|noexcept|override)\b @@ -188,6 +270,7 @@ contexts: - include: template - match: (?=\S) set: global-modifier + - include: using-namespace - include: namespace - include: keywords-angle-brackets - match: '(?={{path_lookahead}}\s*<)' @@ -204,6 +287,9 @@ contexts: - match: \*/ scope: punctuation.definition.comment.c pop: true + - match: ^\s*(\*)(?!/) + captures: + 1: punctuation.definition.comment.c - include: early-expressions - match: ^\s*\b(extern)(?=\s+"C(\+\+)?") scope: storage.modifier.c++ @@ -253,7 +339,9 @@ contexts: - include: preprocessor-expressions - include: comments - include: case-default + - include: using-namespace - include: typedef + - include: using-alias - include: keywords-angle-brackets - include: keywords-parens - include: keywords @@ -344,10 +432,6 @@ contexts: - include: unique-strings - include: scope:source.c#strings - numbers: - - include: unique-numbers - - include: scope:source.c#numbers - ## C++-specific contexts case-default: @@ -451,8 +535,8 @@ contexts: pop: true - include: expressions - namespace: - - match: '\b(using)\s+(namespace)\s+(?={{path_lookahead}})' + using-namespace: + - match: '\b(using)\s+(namespace)\b' captures: 1: keyword.control.c++ 2: keyword.control.c++ @@ -460,6 +544,8 @@ contexts: - include: identifiers - match: '' pop: true + + namespace: - match: '\b(namespace)\s+(?=({{path_lookahead}})?(?!\s*[;,]))' scope: meta.namespace.c++ captures: @@ -525,15 +611,11 @@ contexts: - include: template-common generic-type: - - match: '(?=(?!template){{path_lookahead}}\s*{{generic_lookahead}}\s*\()' + - match: '(?=(?!template){{path_lookahead}}\s*{{generic_lookahead}}\s*(\(|\{))' push: - meta_scope: meta.function-call.c++ - match: \btemplate\b scope: storage.type.template.c++ - - match: '(?:(::)\s*)?{{identifier}}\s*(::)\s*' - captures: - 1: punctuation.accessor.double-colon.c++ - 2: punctuation.accessor.double-colon.c++ - match: (?:(::)\s*)?({{identifier}})\s*(<) captures: 1: punctuation.accessor.double-colon.c++ @@ -556,6 +638,19 @@ contexts: scope: meta.group.c++ punctuation.section.group.end.c++ pop: true - include: expressions + - match: (?:(::)\s*)?({{identifier}})\s*(\{) + captures: + 1: punctuation.accessor.double-colon.c++ + 2: variable.function.c++ + 3: punctuation.section.group.begin.c++ + set: + - meta_scope: meta.function-call.c++ + - meta_content_scope: meta.group.c++ + - match: '\}' + scope: meta.group.c++ punctuation.section.group.end.c++ + pop: true + - include: expressions + - include: identifiers - include: angle-brackets - match: '\(' scope: meta.group.c++ punctuation.section.group.begin.c++ @@ -566,6 +661,15 @@ contexts: scope: meta.group.c++ punctuation.section.group.end.c++ pop: true - include: expressions + - match: '\{' + scope: meta.group.c++ punctuation.section.group.begin.c++ + set: + - meta_scope: meta.function-call.c++ + - meta_content_scope: meta.group.c++ + - match: '\}' + scope: meta.group.c++ punctuation.section.group.end.c++ + pop: true + - include: expressions - match: '(?=(?!template){{path_lookahead}}\s*{{generic_lookahead}})' push: - include: identifiers @@ -599,19 +703,18 @@ contexts: - include: statements function-call: - - match: (?={{path_lookahead}}\s*\() + - match: (?={{path_lookahead}}\s*(\(|\{)) push: - meta_scope: meta.function-call.c++ - include: scope:source.c#c99 - match: '(?:(::)\s*)?{{identifier}}\s*(::)\s*' - scope: variable.function.c++ captures: - 1: punctuation.accessor.c++ - 2: punctuation.accessor.c++ - - match: '(?:(::)\s*)?{{identifier}}' - scope: variable.function.c++ + 1: punctuation.accessor.double-colon.c++ + 2: punctuation.accessor.double-colon.c++ + - match: '(?:(::)\s*)?({{identifier}})' captures: 1: punctuation.accessor.c++ + 2: variable.function.c++ - match: '\(' scope: meta.group.c++ punctuation.section.group.begin.c++ set: @@ -620,6 +723,14 @@ contexts: scope: meta.function-call.c++ meta.group.c++ punctuation.section.group.end.c++ pop: true - include: expressions + - match: '\{' + scope: meta.group.c++ punctuation.section.group.begin.c++ + set: + - meta_content_scope: meta.function-call.c++ meta.group.c++ + - match: '\}' + scope: meta.function-call.c++ meta.group.c++ punctuation.section.group.end.c++ + pop: true + - include: expressions members-inside-function-call: - meta_content_scope: meta.method-call.c++ meta.group.c++ @@ -714,6 +825,16 @@ contexts: scope: punctuation.accessor.arrow.c++ push: members-after-accessor-junction + using-alias: + # consume keyword if followed by typename + - match: '\b(using)\b(?=\s+typename\b)' + captures: + 1: keyword.control.c++ + - match: '\b(using)\b\s+({{identifier}})(?!\s*(<|::))' + captures: + 1: keyword.control.c++ + 2: entity.name.type.using.c++ + typedef: - match: \btypedef\b scope: storage.type.c++ @@ -778,28 +899,41 @@ contexts: - include: modifiers-parens - include: modifiers # Constructors and destructors don't have a type - - match: '(?={{path_lookahead}}\s*::\s*{{identifier}}\s*(\(|$))' + - match: '(?={{path_lookahead}}\s*(?:{{generic_lookahead}})?\s*::\s*{{identifier}}\s*\()' set: - - meta_content_scope: meta.function.c++ entity.name.function.constructor.c++ - - include: identifiers + - meta_content_scope: meta.function.c++ meta.toc-list.full-identifier.c++ + - include: identifier-path-generic + - match: '(?:(::)\s*)?({{identifier}})' + captures: + 1: punctuation.accessor.double-colon.c++ + 2: entity.name.function.constructor.c++ - match: '(?=[^\w\s])' set: function-definition-params - - match: '(?={{path_lookahead}}\s*::\s*~{{identifier}}\s*(\(|$))' + - match: '(?={{path_lookahead}}\s*(?:{{generic_lookahead}})?\s*::\s*~{{identifier}}\s*(\(|$))' set: - - meta_content_scope: meta.function.c++ entity.name.function.destructor.c++ - - include: identifiers - - match: '~{{identifier}}' + - meta_content_scope: meta.function.c++ meta.toc-list.full-identifier.c++ + - include: identifier-path-generic + - match: '(?:(::)\s*)?(~{{identifier}})' + captures: + 1: punctuation.accessor.double-colon.c++ + 2: entity.name.function.destructor.c++ - match: '(?=[^\w\s])' set: function-definition-params # If we see a path ending in :: before a newline, we don't know if it is # a constructor or destructor, or a long return type, so we are just going # to treat it like a regular function. Most likely it is a constructor, # since it doesn't seem most developers would create such a long typename. - - match: '(?={{path_lookahead}}\s*::\s*$)' + - match: '(?={{path_lookahead}}\s*(?:{{generic_lookahead}})?::\s*$)' set: - - meta_content_scope: meta.function.c++ entity.name.function.c++ - - include: identifiers - - match: '~{{identifier}}' + - meta_content_scope: meta.function.c++ meta.toc-list.full-identifier.c++ + - include: identifier-path-generic + - match: '(::)\s*$' + captures: + 1: punctuation.accessor.double-colon.c++ + - match: '(?:(::)\s*)?(~?{{identifier}})(?=\s*\()' + captures: + 1: punctuation.accessor.double-colon.c++ + 2: entity.name.function.c++ - match: '(?=[^\w\s])' set: function-definition-params - include: unique-strings @@ -885,8 +1019,12 @@ contexts: # Operator overloading - match: '(?=({{path_lookahead}}\s*(?:{{generic_lookahead}})?::\s*)?{{operator_method_name}}\s*(\(|$))' set: - - meta_content_scope: meta.function.c++ entity.name.function.c++ - - include: identifiers + - meta_content_scope: meta.function.c++ meta.toc-list.full-identifier.c++ + - include: identifier-path-generic + - match: '(?:(::)\s*)?({{operator_method_name}})(?=\s*\()' + captures: + 1: punctuation.accessor.double-colon.c++ + 2: entity.name.function.c++ - match: '(?=\s*(\(|$))' set: function-definition-params # Identifier that is not the function name - likely a macro or type @@ -906,26 +1044,21 @@ contexts: pop: true global-function-identifier-generic: - - include: angle-brackets - - match: '::' - scope: punctuation.accessor.c++ - - match: '(?={{identifier}}<.*>\s*\()' - push: - - meta_content_scope: entity.name.function.c++ - - include: identifiers - - match: '(?=<)' - pop: true - - match: '(?={{identifier}}\s*\()' - push: - - meta_content_scope: entity.name.function.c++ - - include: identifiers - - match: '' - pop: true + - meta_content_scope: meta.toc-list.full-identifier.c++ + - include: identifier-path-generic + - match: '(?:(::)\s*)?({{identifier}})(?=\s*(<.*>)?\s*\()' + captures: + 1: punctuation.accessor.double-colon.c++ + 2: entity.name.function.c++ - match: '(?=\()' pop: true global-function-identifier: - - meta_content_scope: entity.name.function.c++ + - meta_content_scope: meta.toc-list.full-identifier.c++ + - match: '(?:(::)\s*)?({{identifier}})(?!\s*(::))' + captures: + 1: punctuation.accessor.double-colon.c++ + 2: entity.name.function.c++ - include: identifiers - match: '(?=\S)' pop: true @@ -972,7 +1105,7 @@ contexts: - match: '&' scope: keyword.operator.c++ - match: \b0\b - scope: constant.numeric.c++ + scope: constant.numeric.integer.decimal.c++ - match: \b(default|delete)\b scope: storage.modifier.c++ - match: '(?=\{)' @@ -1037,9 +1170,15 @@ contexts: - match: '{{identifier}}(?={{data_structures_forward_decl_lookahead}})' scope: entity.name.class.forward-decl.c++ set: data-structures-class-definition-after-identifier - - match: '{{identifier}}' - scope: entity.name.class.c++ - set: data-structures-class-definition-after-identifier + - match: '(?={{path_lookahead}})' + set: + - meta_scope: meta.class.c++ + - match: '{{identifier}}(?!\s*::)' + scope: entity.name.class.c++ + set: data-structures-class-definition-after-identifier + - include: identifiers + - match: '(?=[^\w\s])' + set: data-structures-class-definition-after-identifier - match: '(?=[:{])' set: data-structures-class-definition-after-identifier - match: '(?=;)' @@ -1065,9 +1204,15 @@ contexts: - match: '{{identifier}}(?={{data_structures_forward_decl_lookahead}})' scope: entity.name.struct.forward-decl.c++ set: data-structures-struct-definition-after-identifier - - match: '{{identifier}}' - scope: entity.name.struct.c++ - set: data-structures-struct-definition-after-identifier + - match: '(?={{path_lookahead}})' + set: + - meta_scope: meta.struct.c++ + - match: '{{identifier}}(?!\s*::)' + scope: entity.name.struct.c++ + set: data-structures-struct-definition-after-identifier + - include: identifiers + - match: '(?=[^\w\s])' + set: data-structures-struct-definition-after-identifier - match: '(?=[:{])' set: data-structures-struct-definition-after-identifier - match: '(?=;)' @@ -1093,9 +1238,15 @@ contexts: - match: '{{identifier}}(?={{data_structures_forward_decl_lookahead}})' scope: entity.name.enum.forward-decl.c++ set: data-structures-enum-definition-after-identifier - - match: '{{identifier}}' - scope: entity.name.enum.c++ - set: data-structures-enum-definition-after-identifier + - match: '(?={{path_lookahead}})' + set: + - meta_scope: meta.enum.c++ + - match: '{{identifier}}(?!\s*::)' + scope: entity.name.enum.c++ + set: data-structures-enum-definition-after-identifier + - include: identifiers + - match: '(?=[^\w\s])' + set: data-structures-enum-definition-after-identifier - match: '(?=[:{])' set: data-structures-enum-definition-after-identifier - match: '(?=;)' @@ -1122,9 +1273,15 @@ contexts: - match: '{{identifier}}(?={{data_structures_forward_decl_lookahead}})' scope: entity.name.union.forward-decl.c++ set: data-structures-union-definition-after-identifier - - match: '{{identifier}}' - scope: entity.name.union.c++ - set: data-structures-union-definition-after-identifier + - match: '(?={{path_lookahead}})' + set: + - meta_scope: meta.union.c++ + - match: '{{identifier}}(?!\s*::)' + scope: entity.name.union.c++ + set: data-structures-union-definition-after-identifier + - include: identifiers + - match: '(?=[^\w\s])' + set: data-structures-union-definition-after-identifier - match: '(?=[{])' set: data-structures-union-definition-after-identifier - match: '(?=;)' @@ -1190,7 +1347,9 @@ contexts: - include: template - match: (?=\S) set: data-structures-modifier + - include: using-namespace - include: typedef + - include: using-alias - match: \b({{visibility_modifiers}})\s*(:)(?!:) captures: 1: storage.modifier.c++ @@ -1199,23 +1358,31 @@ contexts: push: data-structures-modifier - include: expressions-minus-generic-type + data-structures-modifier-friend: + - match: (?=;) + pop: true + - match: '\{' + scope: punctuation.section.block.begin.c++ + set: + - meta_scope: meta.block.c++ + - match: '\}' + scope: punctuation.section.block.end.c++ + pop: true + - include: statements + - include: expressions-minus-function-call + data-structures-modifier: - match: '\bfriend\b' scope: storage.modifier.c++ push: - - match: (?=;) - pop: true - - match: '\{' - scope: punctuation.section.block.begin.c++ - set: - - meta_scope: meta.block.c++ - - match: '\}' - scope: punctuation.section.block.end.c++ - pop: true - - include: statements + - include: comments - match: '\b({{before_tag}})\b' scope: storage.type.c++ - - include: expressions-minus-function-call + set: data-structures-modifier-friend + - match: '(?=\S)(?=[^;]+;)' + set: data-structures-modifier-friend + - match: '(?=\S)' + pop: true - include: comments - include: modifiers-parens - include: modifiers @@ -1404,7 +1571,7 @@ contexts: - match: '&' scope: keyword.operator.c++ - match: \b0\b - scope: constant.numeric.c++ + scope: constant.numeric.integer.decimal.c++ - match: \b(default|delete)\b scope: storage.modifier.c++ - match: '(?=:)' @@ -1477,7 +1644,7 @@ contexts: captures: 1: meta.preprocessor.c++ 2: keyword.control.import.c++ - 3: constant.numeric.preprocessor.c++ + 3: constant.numeric.integer.decimal.c++ push: - match: ^\s*(#\s*endif)\b captures: @@ -1503,7 +1670,7 @@ contexts: captures: 1: meta.preprocessor.c++ 2: keyword.control.import.c++ - 3: constant.numeric.preprocessor.c++ + 3: constant.numeric.integer.decimal.c++ push: - match: ^\s*(#\s*endif)\b captures: @@ -1547,7 +1714,7 @@ contexts: captures: 1: meta.preprocessor.c++ 2: keyword.control.import.c++ - 3: constant.numeric.preprocessor.c++ + 3: constant.numeric.integer.decimal.c++ push: - match: ^\s*(#\s*endif)\b captures: @@ -1574,7 +1741,7 @@ contexts: captures: 1: meta.preprocessor.c++ 2: keyword.control.import.c++ - 3: constant.numeric.preprocessor.c++ + 3: constant.numeric.integer.decimal.c++ push: - match: ^\s*(#\s*endif)\b captures: @@ -1679,7 +1846,7 @@ contexts: captures: 1: meta.preprocessor.c++ 2: keyword.control.import.c++ - 3: constant.numeric.preprocessor.c++ + 3: constant.numeric.integer.decimal.c++ push: - match: ^\s*(#\s*endif)\b captures: @@ -1705,7 +1872,7 @@ contexts: captures: 1: meta.preprocessor.c++ 2: keyword.control.import.c++ - 3: constant.numeric.preprocessor.c++ + 3: constant.numeric.integer.decimal.c++ push: - match: ^\s*(#\s*endif)\b captures: @@ -1920,6 +2087,16 @@ contexts: scope: punctuation.section.block.begin.c++ - match: '\}' scope: punctuation.section.block.end.c++ + # Captures the namespace macro idiom + - match: '\b(namespace)\s+(?={{path_lookahead}}\s*\{)' + scope: meta.namespace.c++ + captures: + 1: keyword.control.c++ + push: + - meta_content_scope: meta.namespace.c++ entity.name.namespace.c++ + - include: identifiers + - match: '(?=\S)' + pop: true - include: expressions preprocessor-practical-workarounds: diff --git a/C++/C.sublime-syntax b/C++/C.sublime-syntax index 859b0f3e7d..b6f96819a4 100644 --- a/C++/C.sublime-syntax +++ b/C++/C.sublime-syntax @@ -9,6 +9,15 @@ first_line_match: "-[*]-( Mode:)? C -[*]-" scope: source.c variables: + # number exponents + dec_exponent: '(?:[eE][-+]??\d+)' + hex_exponent: '(?:[pP][-+]??\d+)' + + # number suffixes + dec_suffix: '[a-zA-Z_][[:alnum:]_]*' + hex_suffix: '[g-zG-Z_][[:alnum:]_]*' + integer_suffix: '[lL]{1,2}[uU]?|[uU][lL]{0,2}' + identifier: \b[[:alpha:]_][[:alnum:]_]*\b # upper and lowercase macro_identifier: \b[[:upper:]_][[:upper:][:digit:]_]{2,}\b # only uppercase, at least 3 chars attr_macro_identifier: \b__[[:alnum:]_]{2,}\b # __aligned, __pci_driver @@ -209,8 +218,80 @@ contexts: scope: support.type.mac-classic.c numbers: - - match: '\b((0(x|X)[0-9a-fA-F]*(\.[0-9a-fA-F]+p-?\d+)?)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)([fF]|(l{1,2}|L{1,2})[uU]?|[uU](l{0,2}|L{0,2}))?\b' - scope: constant.numeric.c + # https://en.cppreference.com/w/c/language/floating_constant + + # decimal floats + - match: |- + (?x: + \b\d+ + (?: + (?: (\.) (?: \d+ {{dec_exponent}}? | {{dec_exponent}} | (?=[^.])) | {{dec_exponent}} ) + (?: ([fFlL])\b | ({{dec_suffix}})? ) | ([fF])\b + ) + | (\.) \d+ {{dec_exponent}}? (?: ([fFlL])\b | ({{dec_suffix}})? ) + ) + scope: constant.numeric.float.decimal.c + captures: + 1: punctuation.separator.decimal.c + 2: storage.type.numeric.c + 3: invalid.illegal.numeric.suffix.c + 4: storage.type.numeric.c + 5: punctuation.separator.decimal.c + 6: storage.type.numeric.c + 7: invalid.illegal.numeric.suffix.c + # hexadecimal float (C99) + - match: \b0[xX](?=[[:alnum:].]+?[pP]) + scope: punctuation.definition.numeric.base.c + push: + - meta_include_prototype: false + - meta_scope: constant.numeric.float.hexadecimal.c + - match: '{{hex_exponent}}\b' + pop: true + - match: \. + scope: punctuation.separator.decimal.c + - match: \H + scope: invalid.illegal.numeric.digit.c + + # https://en.cppreference.com/w/c/language/integer_constant + + # hexadecimal integer + - match: \b0[xX] + scope: punctuation.definition.numeric.base.c + push: + - meta_include_prototype: false + - meta_scope: constant.numeric.integer.hexadecimal.c + - include: hexadecimal-suffix + # octal integer + - match: \b0(?=\d) + scope: punctuation.definition.numeric.base.c + push: + - meta_include_prototype: false + - meta_scope: constant.numeric.integer.octal.c + - match: '[89]' + scope: invalid.illegal.numeric.digit.c + - include: decimal-suffix + # decimal integer + - match: \b\d+ + push: + - meta_include_prototype: false + - meta_scope: constant.numeric.integer.decimal.c + - include: decimal-suffix + + decimal-suffix: + - match: (?:{{integer_suffix}})?\b + scope: storage.type.numeric.c + pop: true + - match: '{{dec_suffix}}' + scope: invalid.illegal.numeric.suffix.c + pop: true + + hexadecimal-suffix: + - match: (?:{{integer_suffix}})?\b + scope: storage.type.numeric.c + pop: true + - match: '{{hex_suffix}}' + scope: invalid.illegal.numeric.suffix.c + pop: true operators: - match: (?:\+\+|--) @@ -250,7 +331,7 @@ contexts: 1: punctuation.accessor.c 2: variable.other.member.indexed.c - include: access-illegal - - match: \.(?!\.) + - match: \.(?!\.|\d) scope: punctuation.accessor.c label: @@ -1023,7 +1104,7 @@ contexts: captures: 1: meta.preprocessor.c 2: keyword.control.import.c - 3: constant.numeric.preprocessor.c + 3: constant.numeric.integer.decimal.c push: - match: ^\s*(#\s*endif)\b captures: @@ -1049,7 +1130,7 @@ contexts: captures: 1: meta.preprocessor.c 2: keyword.control.import.c - 3: constant.numeric.preprocessor.c + 3: constant.numeric.integer.decimal.c push: - match: ^\s*(#\s*endif)\b captures: @@ -1093,7 +1174,7 @@ contexts: captures: 1: meta.preprocessor.c 2: keyword.control.import.c - 3: constant.numeric.preprocessor.c + 3: constant.numeric.integer.decimal.c push: - match: ^\s*(#\s*endif)\b captures: @@ -1120,7 +1201,7 @@ contexts: captures: 1: meta.preprocessor.c 2: keyword.control.import.c - 3: constant.numeric.preprocessor.c + 3: constant.numeric.integer.decimal.c push: - match: ^\s*(#\s*endif)\b captures: @@ -1226,7 +1307,7 @@ contexts: captures: 1: meta.preprocessor.c 2: keyword.control.import.c - 3: constant.numeric.preprocessor.c + 3: constant.numeric.integer.decimal.c push: - match: ^\s*(#\s*endif)\b captures: @@ -1252,7 +1333,7 @@ contexts: captures: 1: meta.preprocessor.c 2: keyword.control.import.c - 3: constant.numeric.preprocessor.c + 3: constant.numeric.integer.decimal.c push: - match: ^\s*(#\s*endif)\b captures: diff --git a/C++/Snippets/#ifndef-#define-#endif.sublime-snippet b/C++/Snippets/#ifndef-#define-#endif.sublime-snippet index de39712654..fd3d8727e2 100644 --- a/C++/Snippets/#ifndef-#define-#endif.sublime-snippet +++ b/C++/Snippets/#ifndef-#define-#endif.sublime-snippet @@ -4,5 +4,5 @@ #define ${1:SYMBOL} ${2:value} #endif]]> def - source.c, source.c++, source.objc, source.objc++ + (source.c | source.objc | source.c++ | source.objc++) - meta.preprocessor.include - comment - string diff --git a/C++/Snippets/#include-(#inc angle).sublime-snippet b/C++/Snippets/#include-(#inc angle).sublime-snippet index 56952a40fd..b9ac3ce369 100644 --- a/C++/Snippets/#include-(#inc angle).sublime-snippet +++ b/C++/Snippets/#include-(#inc angle).sublime-snippet @@ -2,5 +2,5 @@ #include <…> ]]> inc - (source.c | source.objc | source.c++ | source.objc++) &meta.preprocessor.incomplete + (source.c | source.objc | source.c++ | source.objc++) & meta.preprocessor.incomplete - comment - string diff --git a/C++/Snippets/#include-(#inc).sublime-snippet b/C++/Snippets/#include-(#inc).sublime-snippet index 5007bb6e56..87dc70a424 100644 --- a/C++/Snippets/#include-(#inc).sublime-snippet +++ b/C++/Snippets/#include-(#inc).sublime-snippet @@ -2,5 +2,5 @@ #include "…" inc - (source.c | source.objc | source.c++ | source.objc++) & meta.preprocessor.incomplete + (source.c | source.objc | source.c++ | source.objc++) & meta.preprocessor.incomplete - comment - string diff --git a/C++/Snippets/#include-(inc angle).sublime-snippet b/C++/Snippets/#include-(inc angle).sublime-snippet index 56dbad549c..e432c196c3 100644 --- a/C++/Snippets/#include-(inc angle).sublime-snippet +++ b/C++/Snippets/#include-(inc angle).sublime-snippet @@ -2,5 +2,5 @@ #include <…> ]]> Inc - (source.c | source.objc | source.c++ | source.objc++) - meta.preprocessor.incomplete + (source.c | source.objc | source.c++ | source.objc++) - meta.preprocessor.incomplete - meta.preprocessor.include - comment - string diff --git a/C++/Snippets/#include-(inc).sublime-snippet b/C++/Snippets/#include-(inc).sublime-snippet index a0801803cf..f3d129b2db 100644 --- a/C++/Snippets/#include-(inc).sublime-snippet +++ b/C++/Snippets/#include-(inc).sublime-snippet @@ -2,5 +2,5 @@ #include "…" inc - (source.c | source.objc | source.c++ | source.objc++) - meta.preprocessor.incomplete + (source.c | source.objc | source.c++ | source.objc++) - meta.preprocessor.incomplete - meta.preprocessor.include - comment - string diff --git a/C++/Snippets/$1.begin()-$1.end()-(beginend).sublime-snippet b/C++/Snippets/$1.begin()-$1.end()-(beginend).sublime-snippet index 1b88c12766..e425d78592 100644 --- a/C++/Snippets/$1.begin()-$1.end()-(beginend).sublime-snippet +++ b/C++/Snippets/$1.begin()-$1.end()-(beginend).sublime-snippet @@ -2,5 +2,5 @@ $1.begin(), $1.end() )?$/(?2::(?1:>:.))/}begin(), ${1:v}${1/^.*?(-)?(>)?$/(?2::(?1:>:.))/}end()]]> beginend - source.c++, source.objc++ + (source.c++ | source.objc++) - meta.preprocessor.include - comment - string diff --git a/C++/Snippets/030-for-int-loop-(fori).sublime-snippet b/C++/Snippets/030-for-int-loop-(fori).sublime-snippet index a81273e0b0..5210ba9ec0 100644 --- a/C++/Snippets/030-for-int-loop-(fori).sublime-snippet +++ b/C++/Snippets/030-for-int-loop-(fori).sublime-snippet @@ -5,5 +5,5 @@ ${0:/* code */} }]]> for - source.c, source.objc, source.c++, source.objc++ + (source.c | source.objc | source.c++ | source.objc++) - meta.preprocessor.include - comment - string diff --git a/C++/Snippets/Enumeration.sublime-snippet b/C++/Snippets/Enumeration.sublime-snippet index eec353d16a..94604d272e 100644 --- a/C++/Snippets/Enumeration.sublime-snippet +++ b/C++/Snippets/Enumeration.sublime-snippet @@ -5,5 +5,5 @@ $0 };]]> enum - source.c++, source.objc++ + (source.c++ | source.objc++) - meta.preprocessor.include - comment - string diff --git a/C++/Snippets/Typedef.sublime-snippet b/C++/Snippets/Typedef.sublime-snippet index fe90adbcc0..413e2d2ee1 100644 --- a/C++/Snippets/Typedef.sublime-snippet +++ b/C++/Snippets/Typedef.sublime-snippet @@ -2,5 +2,5 @@ Typedef td - source.c, source.objc, source.c++, source.objc++ + (source.c | source.objc | source.c++ | source.objc++) - meta.preprocessor.include - comment - string diff --git a/C++/Snippets/class-..-(class).sublime-snippet b/C++/Snippets/class-..-(class).sublime-snippet index ed40113984..27eeaa60d4 100644 --- a/C++/Snippets/class-..-(class).sublime-snippet +++ b/C++/Snippets/class-..-(class).sublime-snippet @@ -1,5 +1,4 @@ - Class class - source.c++, source.objc++ + (source.c++ | source.objc++) - meta.preprocessor.include - comment - string diff --git a/C++/Snippets/do...while-loop-(do).sublime-snippet b/C++/Snippets/do...while-loop-(do).sublime-snippet index b9926b15d5..e33d110982 100644 --- a/C++/Snippets/do...while-loop-(do).sublime-snippet +++ b/C++/Snippets/do...while-loop-(do).sublime-snippet @@ -5,5 +5,5 @@ ${0:/* code */} } while (${1:/* condition */});]]> do - source.c, source.objc, source.c++, source.objc++ + (source.c | source.objc | source.c++ | source.objc++) - meta.preprocessor.include - comment - string diff --git a/C++/Snippets/forv.sublime-snippet b/C++/Snippets/forv.sublime-snippet index 0374dd8c8f..6593866730 100644 --- a/C++/Snippets/forv.sublime-snippet +++ b/C++/Snippets/forv.sublime-snippet @@ -5,5 +5,5 @@ $0 }]]> forv - source.c, source.objc, source.c++, source.objc++ + (source.c | source.objc | source.c++ | source.objc++) - meta.preprocessor.include - comment - string diff --git a/C++/Snippets/fprintf.sublime-snippet b/C++/Snippets/fprintf.sublime-snippet index e5f555c55f..ad0a43abfe 100644 --- a/C++/Snippets/fprintf.sublime-snippet +++ b/C++/Snippets/fprintf.sublime-snippet @@ -2,5 +2,5 @@ fprintf … fprintf - source.c, source.objc, source.c++, source.objc++ + (source.c | source.objc | source.c++ | source.objc++) - meta.preprocessor.include - comment - string diff --git a/C++/Snippets/if-..-(if).sublime-snippet b/C++/Snippets/if-..-(if).sublime-snippet index c690210ff8..05e0181144 100644 --- a/C++/Snippets/if-..-(if).sublime-snippet +++ b/C++/Snippets/if-..-(if).sublime-snippet @@ -5,5 +5,5 @@ ${0:/* code */} }]]> if - source.c, source.objc, source.c++, source.objc++ + (source.c | source.objc | source.c++ | source.objc++) - meta.preprocessor.include - comment - string diff --git a/C++/Snippets/main()-(int main).sublime-snippet b/C++/Snippets/main()-(int main).sublime-snippet index 132d0fa332..26b784ad3d 100644 --- a/C++/Snippets/main()-(int main).sublime-snippet +++ b/C++/Snippets/main()-(int main).sublime-snippet @@ -6,5 +6,5 @@ return 0; }]]> main - (source.c | source.objc | source.c++ | source.objc++) & entity.name.function + (source.c | source.objc | source.c++ | source.objc++) & entity.name.function - meta.preprocessor.include - comment - string diff --git a/C++/Snippets/main()-(main).sublime-snippet b/C++/Snippets/main()-(main).sublime-snippet index dc580bdd0b..1390ca11e4 100644 --- a/C++/Snippets/main()-(main).sublime-snippet +++ b/C++/Snippets/main()-(main).sublime-snippet @@ -6,5 +6,5 @@ return 0; }]]> main - (source.c | source.objc | source.c++ | source.objc++) - entity.name.function + (source.c | source.objc | source.c++ | source.objc++) - entity.name.function - meta.preprocessor.include - comment - string diff --git a/C++/Snippets/namespace-..-(namespace).sublime-snippet b/C++/Snippets/namespace-..-(namespace).sublime-snippet index be29a2bc2e..ea4ba09010 100644 --- a/C++/Snippets/namespace-..-(namespace).sublime-snippet +++ b/C++/Snippets/namespace-..-(namespace).sublime-snippet @@ -6,5 +6,5 @@ } ]]> ns - source.c++, source.objc++ + (source.c++ | source.objc++) - meta.preprocessor.include - comment - string diff --git a/C++/Snippets/printf-..-(printf).sublime-snippet b/C++/Snippets/printf-..-(printf).sublime-snippet index b13685a783..4eab293e76 100644 --- a/C++/Snippets/printf-..-(printf).sublime-snippet +++ b/C++/Snippets/printf-..-(printf).sublime-snippet @@ -2,5 +2,5 @@ printf … printf - source.c, source.objc, source.c++, source.objc++ + (source.c | source.objc | source.c++ | source.objc++) - meta.preprocessor.include - comment - string diff --git a/C++/Snippets/read-file-(readF).sublime-snippet b/C++/Snippets/read-file-(readF).sublime-snippet index 0760229084..dbdbac0a89 100644 --- a/C++/Snippets/read-file-(readF).sublime-snippet +++ b/C++/Snippets/read-file-(readF).sublime-snippet @@ -9,5 +9,5 @@ if (FILE${TM_C_POINTER: *}fp = fopen(${1:"filename"}, "r")) fclose(fp); }]]> readfile - source.c++, source.objc++ + (source.c++ | source.objc++) - meta.preprocessor.include - comment - string diff --git a/C++/Snippets/std-map-(map).sublime-snippet b/C++/Snippets/std-map-(map).sublime-snippet index 93622ad970..9b955dfe72 100644 --- a/C++/Snippets/std-map-(map).sublime-snippet +++ b/C++/Snippets/std-map-(map).sublime-snippet @@ -2,5 +2,5 @@ std::map map$0;]]> map - source.c++, source.objc++ + (source.c++ | source.objc++) - meta.preprocessor.include - comment - string diff --git a/C++/Snippets/std-vector-(v).sublime-snippet b/C++/Snippets/std-vector-(v).sublime-snippet index 43699f5a38..d57107eb61 100644 --- a/C++/Snippets/std-vector-(v).sublime-snippet +++ b/C++/Snippets/std-vector-(v).sublime-snippet @@ -2,5 +2,5 @@ std::vector v$0;]]> vector - source.c++, source.objc++ + (source.c++ | source.objc++) - meta.preprocessor.include - comment - string diff --git a/C++/Snippets/struct.sublime-snippet b/C++/Snippets/struct.sublime-snippet index fea222e1cc..ae642d529b 100644 --- a/C++/Snippets/struct.sublime-snippet +++ b/C++/Snippets/struct.sublime-snippet @@ -1,9 +1,9 @@ Struct - struct - source.c, source.objc, source.c++, source.objc++ + (source.c | source.objc | source.c++ | source.objc++) - meta.preprocessor.include - comment - string diff --git a/C++/Snippets/template-typename-..-(template).sublime-snippet b/C++/Snippets/template-typename-..-(template).sublime-snippet index c824c769f9..47b9f16c18 100644 --- a/C++/Snippets/template-typename-..-(template).sublime-snippet +++ b/C++/Snippets/template-typename-..-(template).sublime-snippet @@ -2,5 +2,5 @@ template <typename ${1:_InputIter}> ]]> tp - source.c++, source.objc++ + (source.c++ | source.objc++) - meta.preprocessor.include - comment - string diff --git a/C++/Symbol List - Namespace Spacing.tmPreferences b/C++/Symbol List - Namespace Spacing.tmPreferences index c4a86d4210..ea23339d52 100644 --- a/C++/Symbol List - Namespace Spacing.tmPreferences +++ b/C++/Symbol List - Namespace Spacing.tmPreferences @@ -4,7 +4,7 @@ name Symbol List scope - + settings symbolTransformation diff --git a/C++/syntax_test_c.c b/C++/syntax_test_c.c index 27707f701a..349d65309c 100644 --- a/C++/syntax_test_c.c +++ b/C++/syntax_test_c.c @@ -459,7 +459,7 @@ typedef char arrType[6]; /* ^^^^ storage.type.c */ /* ^^^^^^^ entity.name.type */ /* ^ punctuation.section.brackets.begin.c */ -/* ^ constant.numeric.c */ +/* ^ constant.numeric.integer.decimal.c */ /* ^ punctuation.section.brackets.end.c */ typedef char arrType[NUMBER_OF_ELEMENTS]; @@ -827,7 +827,7 @@ TRACE_EVENT(mmc_request_start, TRACE_EVENT(802154_rdev_add_virtual_intf, /* <-meta.function-call.c constant.other.macro.c */ /* ^ meta.function-call.parameters.c punctuation.section.group.begin.c */ -/* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ variable.other.c */ +/* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - variable.other.c TODO: Figure this out */ /* ^ punctuation.separator.c */ TP_STRUCT__entry( /*^^^^^^^^^^^^^^^^ meta.function-call.parameters.c meta.function-call.c variable.function.c */ @@ -1451,16 +1451,16 @@ void * const compat_sys_call_table[__NR_compat_syscalls] __aligned(4096) = { /* ^ meta.brackets.c punctuation.section.brackets.end.c */ /* ^^^^^^^^^ meta.function-call.c constant.other.macro.c */ /* ^^^^^^ meta.function-call.parameters.c */ -/* ^^^^ constant.numeric.c */ +/* ^^^^ constant.numeric.integer.decimal.c */ /* ^ keyword.operator.assignment.c */ /* ^ meta.block.c punctuation.section.block.begin.c */ [0 ... __NR_compat_syscalls - 1] = sys_ni_syscall, /*^ meta.brackets.c punctuation.section.brackets.begin.c */ -/* ^ constant.numeric.c */ +/* ^ constant.numeric.integer.decimal.c */ /* ^^^ keyword.operator.variadic.c */ /* ^^^^^^^^^^^^^^^^^^^^ variable.other.indexed.c */ /* ^ keyword.operator.arithmetic.c */ -/* ^ constant.numeric.c */ +/* ^ constant.numeric.integer.decimal.c */ /* ^ meta.brackets.c punctuation.section.brackets.end.c */ /* ^ keyword.operator.assignment.c */ /* ^^^^^^^^^^^^^^ variable.other.indexed.c */ @@ -1499,7 +1499,7 @@ struct mac_tfm_ctx { /* ^^^^^^^^^ meta.function-call.c constant.other.macro.c */ /* ^^^ meta.function-call.parameters.c */ /* ^ meta.group.c punctuation.section.group.begin.c */ -/* ^ constant.numeric.c */ +/* ^ constant.numeric.integer.decimal.c */ /* ^ meta.group.c punctuation.section.group.end.c */ /* ^^^^ entity.name.member.indexed.c */ /* ^ punctuation.terminator.c */ @@ -1508,7 +1508,7 @@ struct mac_tfm_ctx { /* ^^^^^^^^^ meta.function-call.c constant.other.macro.c */ /* ^^^ meta.function-call.parameters.c */ /* ^ meta.group.c punctuation.section.group.begin.c */ -/* ^ constant.numeric.c */ +/* ^ constant.numeric.integer.decimal.c */ /* ^ meta.group.c punctuation.section.group.end.c */ /* ^^^^^^ entity.name.member.indexed.c */ /* ^ meta.brackets.c punctuation.section.brackets.begin.c */ @@ -1520,7 +1520,7 @@ struct mac_tfm_ctx { /* ^^^^^^^^^ meta.function-call.c constant.other.macro.c */ /* ^^^ meta.function-call.parameters.c */ /* ^ meta.group.c punctuation.section.group.begin.c */ -/* ^ constant.numeric.c */ +/* ^ constant.numeric.integer.decimal.c */ /* ^ meta.group.c punctuation.section.group.end.c */ /* ^ punctuation.terminator.c */ @@ -1690,47 +1690,47 @@ TYPE(int) UPPER_VAR; void __printf(1) /* <- storage.type.c */ /* ^^^^^^^^ meta.function-call.c constant.other.macro.c */ -/* ^ constant.numeric.c */ +/* ^ constant.numeric.integer.decimal.c */ /* ^^^ meta.function-call.parameters.c */ __printf(1,) /* ^^^^^ meta.function-call.c constant.other.macro.c */ /* ^^^^ meta.function-call.parameters.c */ /* ^ punctuation.section.group.begin.c */ -/* ^ constant.numeric.c */ +/* ^ constant.numeric.integer.decimal.c */ /* ^ punctuation.separator.c */ /* ^ punctuation.section.group.end.c */ __printf(1, ) /* ^^^^^ meta.function-call.c constant.other.macro.c */ /* ^^^^^ meta.function-call.parameters.c */ /* ^ punctuation.section.group.begin.c */ -/* ^ constant.numeric.c */ +/* ^ constant.numeric.integer.decimal.c */ /* ^ punctuation.separator.c */ /* ^ punctuation.section.group.end.c */ __printf(1, 2) /* ^^^^^ meta.function-call.c constant.other.macro.c */ /* ^^^^^^ meta.function-call.parameters.c */ /* ^ punctuation.section.group.begin.c */ -/* ^ constant.numeric.c */ +/* ^ constant.numeric.integer.decimal.c */ /* ^ punctuation.separator.c */ -/* ^ constant.numeric.c */ +/* ^ constant.numeric.integer.decimal.c */ /* ^ punctuation.section.group.end.c */ __printf(1, 2, 3) /* ^^^^^ meta.function-call.c constant.other.macro.c */ /* ^^^^^^^^^ meta.function-call.parameters.c */ /* ^ punctuation.section.group.begin.c */ -/* ^ constant.numeric.c */ +/* ^ constant.numeric.integer.decimal.c */ /* ^ punctuation.separator.c */ -/* ^ constant.numeric.c */ +/* ^ constant.numeric.integer.decimal.c */ /* ^ punctuation.separator.c */ -/* ^ constant.numeric.c */ +/* ^ constant.numeric.integer.decimal.c */ /* ^ punctuation.section.group.end.c */ __printf(0x1, 0xA, sizeof(int)) /* ^^^^^ meta.function-call.c constant.other.macro.c */ /* ^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.parameters.c */ /* ^ punctuation.section.group.begin.c */ -/* ^^^ constant.numeric.c */ +/* ^^^ constant.numeric.integer.hexadecimal.c */ /* ^ punctuation.separator.c */ -/* ^^^ constant.numeric.c */ +/* ^^^ constant.numeric.integer.hexadecimal.c */ /* ^ punctuation.separator.c */ /* ^^^^^^ keyword.operator */ /* ^^^ storage.type.c */ @@ -1757,7 +1757,7 @@ enum { ENUM_B = 6, /* ^ entity.name.constant.enum.c */ /* ^ keyword.operator.assignment */ -/* ^ constant.numeric.c */ +/* ^ constant.numeric.integer.decimal.c */ /* ^ punctuation.separator.c */ #ifdef ENABLED_FEATURE /* <- meta.preprocessor.c keyword.control.import.c */ @@ -1788,7 +1788,7 @@ enum typec_mux { TYPEC_MUX_NONE = 0, /*^^^^^^^^^^^^^^ entity.name.constant.enum.c */ /* ^ keyword.operator.assignment.c */ -/* ^ constant.numeric.c */ +/* ^ constant.numeric.integer.decimal.c */ /* ^ punctuation.separator.c */ TYPEC_MUX_USB = MUX_USB_ENABLED, /*^^^^^^^^^^^^^ entity.name.constant.enum.c */ @@ -2174,34 +2174,242 @@ func_call(foo // Numeric Constants ///////////////////////////////////////////// +dec0 = 0; +/* ^ constant.numeric.integer.decimal */ +/* ^ punctuation.terminator - constant */ dec1 = 1234567890; -/* ^ constant.numeric */ -/* ^ constant.numeric */ +/* ^^^^^^^^^^ constant.numeric.integer.decimal */ +/* ^ punctuation.terminator - constant */ dec2 = 1234567890f; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -dec2 = 1234567890L; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -dec2 = 1234567890ul; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -dec4 = 1234567890Lu; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -dec3 = 1234567890LLU; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -dec3 = 1234567890uLL; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - +/* ^^^^^^^^^^^ constant.numeric.float.decimal */ +/* ^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +dec3 = 1234567890L; +/* ^^^^^^^^^^^ constant.numeric.integer.decimal */ +/* ^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +dec4 = 1234567890ul; +/* ^^^^^^^^^^^^ constant.numeric.integer.decimal */ +/* ^^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +dec5 = 1234567890Lu; +/* ^^^^^^^^^^^^ constant.numeric.integer.decimal */ +/* ^^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +dec6 = 1234567890LLU; +/* ^^^^^^^^^^^^^ constant.numeric.integer.decimal */ +/* ^^^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +dec7 = 1234567890uLL; +/* ^^^^^^^^^^^^^ constant.numeric.integer.decimal */ +/* ^^^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +dec8 = 1'234_567'890s0f; +/* ^ constant.numeric.integer.decimal */ +/* ^^^^^^^^^ string.quoted.single */ +/* ^^^^^^ constant.numeric.integer.decimal */ +/* ^^^ invalid.illegal.numeric.suffix */ +/* ^ punctuation.terminator - constant */ + +oct1 = 01234567; +/* ^^^^^^^^ constant.numeric.integer.octal */ +/* ^ punctuation.definition.numeric.base */ +/* ^ punctuation.terminator - constant */ + +oct2 = 01234567L; +/* ^^^^^^^^ constant.numeric.integer.octal */ +/* ^ punctuation.definition.numeric.base */ +/* ^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +oct3 = 01234567LL; +/* ^^^^^^^^^^ constant.numeric.integer.octal */ +/* ^ punctuation.definition.numeric.base */ +/* ^^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +oct4 = 01234567ulL; +/* ^^^^^^^^^^^ constant.numeric.integer.octal */ +/* ^ punctuation.definition.numeric.base */ +/* ^^^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +oct2 = 01284967Z0L; +/* ^^^^^^^^^^^ constant.numeric.integer.octal */ +/* ^ punctuation.definition.numeric.base */ +/* ^ invalid.illegal.numeric.digit */ +/* ^ invalid.illegal.numeric.digit */ +/* ^^^ invalid.illegal.numeric.suffix */ +/* ^ punctuation.terminator - constant */ + +hex1 = 0x0+0xFL+0xaull+0xallu+0xfu+0x'f'12_4uz; +/* ^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ storage.type.numeric */ +/* ^^^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^^^ storage.type.numeric */ +/* ^^^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^^^ storage.type.numeric */ +/* ^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ storage.type.numeric */ +/* ^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^^^ string.quoted.single */ +/* ^^^^^^ constant.numeric.integer.decimal */ +/* ^^^^ invalid.illegal.numeric.suffix */ +/* ^ punctuation.terminator - constant */ + +hex2 = 0xc1.01AbFp-1; +/* ^^^^^^^^^^^^^ constant.numeric.float.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ punctuation.separator.decimal */ +/* ^ punctuation.terminator - constant */ + +f = 1.1+1.1e1+1.1e-1+1.1f+1.1e1f+1.1e-1f+1.1L+1.1e1L+1.1e-1L; +/* ^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +f = 1.e1+1.e-1+1.e1f+1.e-1f+1.e1L+1.e-1L; +/* ^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +f = 1.+1.f+1.L+1..; +/* ^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^ constant.numeric.integer.decimal */ +/* ^^ invalid.illegal.syntax */ +/* ^ punctuation.terminator - constant */ + +f = 1e1+1e1f+1e1L; +/* ^^^ constant.numeric.float.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^ constant.numeric.float.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^ constant.numeric.float.decimal */ +/* ^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +f = .1+.1e1+.1e-1+.1f+.1e1f+.1e-1f+.1L+.1e1L+.1e-1L; +/* ^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +f = 1.0suff+1.suff*.0suff/{1suff} +/* ^^^ constant.numeric.float.decimal - invalid */ +/* ^^^^ constant.numeric.float.decimal invalid.illegal.numeric.suffix */ +/* ^ keyword.operator.arithmetic */ +/* ^^ constant.numeric.float.decimal - invalid */ +/* ^^^^ constant.numeric.float.decimal invalid.illegal.numeric.suffix */ +/* ^ keyword.operator */ +/* ^^ constant.numeric.float.decimal - invalid */ +/* ^^^^ constant.numeric.float.decimal invalid.illegal.numeric.suffix */ +/* ^ keyword.operator.arithmetic */ +/* ^ punctuation.section.block.begin */ +/* ^ constant.numeric.integer.decimal - invalid */ +/* ^^^^ constant.numeric.integer.decimal invalid.illegal.numeric.suffix */ +/* ^ punctuation.section.block.end */ scanf("%ms %as %*[, ]", &buf); /* ^^^ constant.other.placeholder */ @@ -2267,7 +2475,7 @@ int control_keywords() /* ^ punctuation.accessor.c */ /* ^^^^^^^^^ variable.other.member.indexed.c */ /* ^ keyword.operator.assignment.c */ -/* ^ constant.numeric.c */ +/* ^ constant.numeric.integer.decimal.c */ /* ^ punctuation.terminator.c */ do /* <- keyword.control */ diff --git a/C++/syntax_test_cpp.cpp b/C++/syntax_test_cpp.cpp index a86082e8ca..1924c2cbde 100644 --- a/C++/syntax_test_cpp.cpp +++ b/C++/syntax_test_cpp.cpp @@ -106,7 +106,8 @@ int main() { // constructor. FOOLIB_RESULT some_namespace::some_function(int a_parameter, double another_parameter) { - /* <- meta.function entity.name.function - entity.name.function.constructor */ + /* <- meta.function meta.toc-list.full-identifier */ + /* ^ entity.name.function - entity.name.function.constructor */ return FOOLIB_SUCCESS; } @@ -439,6 +440,51 @@ typedef struct Books { } Book; /*^ entity.name.type */ +using Alias = Foo; +/* <- keyword.control */ +/* ^^^^^ entity.name.type.using */ + +using Alias + = NewLineFoo; +/*^ - entity.name */ + +template +using TemplateAlias = Foo; +/* ^^^^^^^^^^^^^ entity.name.type.using */ + +using std::cout; +/* <- keyword.control */ +/* ^ - entity.name */ + +using std:: + cout; +/*^ - entity.name */ + +class MyClass : public SuperClass +{ + using This = MyClass; +/* ^ keyword.control */ +/* ^^^^ entity.name.type.using */ + + using MyInt +/* ^ keyword.control */ + = int32_t; + + using SuperClass::SuperClass; +/* ^ keyword.control */ +/* ^ - entity.name */ +}; + +class MyClass : public CrtpClass +{ + using typename CrtpClass::PointerType; +/* ^ keyword.control */ +/* ^ storage.modifier */ + using CrtpClass< +/* ^ keyword.control */ + MyClass>::method; +}; + typedef struct Books Book; /* ^ - entity.name.type.struct */ /* ^ entity.name.type.typedef */ @@ -496,25 +542,45 @@ void funcName() { } bool A::operator<(const A& a) { return false; } /* ^ storage.type */ -/* ^^^^^^^^^^^^ meta.function entity.name.function */ +/* ^^^^^^^^^ meta.function meta.toc-list.full-identifier */ +/* ^^^^^^^^^ entity.name.function */ /* ^ meta.function.parameters punctuation.section.group.begin */ template bool A::operator<(const A& a) { return false; } /* ^ storage.type.template */ /* ^ punctuation.section.generic.begin */ /* ^ punctuation.section.generic.end */ -/* ^^^^^^^^^^^^^^^ meta.function entity.name.function */ +/* ^^^^^^^^^^^^^^^ meta.function meta.toc-list.full-identifier */ +/* ^^^^^^^^^ entity.name.function */ /* ^ meta.function.parameters meta.group punctuation.section.group.begin */ template SomeType A::foobar(YetAnotherType&& asRValue) {} -/* ^^^^^^ meta.function entity.name.function */ +/* ^^^^^^^^^^^^^^ meta.function meta.toc-list.full-identifier */ +/* ^^^^^^ entity.name.function */ template SomeType A::foobar(YetAnotherType&& asRValue) {} -/* ^^^^^^ meta.function entity.name.function */ +/* ^^^^^^^^^^^^^^ meta.function meta.toc-list.full-identifier */ +/* ^^^^^^ entity.name.function */ + +template A::A(YetAnotherType&& asRValue) {} +/* ^^^^^^^^^ meta.function meta.toc-list.full-identifier */ +/* ^ entity.name.function */ + +template A::A(YetAnotherType&& asRValue) {} +/* ^^^^^^^^^ meta.function meta.toc-list.full-identifier */ +/* ^ entity.name.function.constructor */ + +template A::~A(YetAnotherType&& asRValue) {} +/* ^^^^^^^^^ meta.function meta.toc-list.full-identifier */ +/* ^ entity.name.function.destructor */ + template bool A::operator > (const A& other) { return false; } -/* ^^^^^^^^^^^^ meta.function entity.name.function */ +/* ^^^^^^^^^^^^^^^^^^ meta.function meta.toc-list.full-identifier */ +/* ^^^^^^^^^^^^ entity.name.function */ template bool A::operator == (const A& other) { return false; } -/* ^^^^^^^^^^^^^^ meta.function entity.name.function */ +/* ^^^^^^^^^^^^^^^^^^^^ meta.function meta.toc-list.full-identifier */ +/* ^^^^^^^^^^^^^^ entity.name.function */ + typedef std :: vector > Table; /* ^^ punctuation.accessor */ /* ^ punctuation.section.generic.begin */ @@ -724,15 +790,15 @@ void f() template C f(T t) { return C { g>(t) }; - /* ^ - variable.function */ - /* ^ punctuation.section.block.begin */ + /* ^ variable.function */ + /* ^ punctuation.section.group.begin */ } template C> f(T t) { return C> { g>(t) }; - /* ^ - variable.function */ - /* ^ punctuation.section.block.begin */ + /* ^ variable.function */ + /* ^ punctuation.section.group.begin */ } struct A { int foo; }; @@ -855,7 +921,7 @@ try { throw std :: string("xyz"); /* <- keyword.control.flow.throw */ - /* ^^^^^^^^^^^^^ variable.function */ + /* ^^^^^^ variable.function */ /* ^^ punctuation.accessor */ } catch (...) @@ -949,135 +1015,266 @@ std::cout << __LINE__ << '\n'; ///////////////////////////////////////////// dec1 = 1234567890; -/* ^ constant.numeric */ -/* ^ constant.numeric */ +/* ^^^^^^^^^^ constant.numeric.integer.decimal */ +/* ^ punctuation.terminator - constant */ dec2 = 1'924'013; -/* ^ constant.numeric */ -/* ^ constant.numeric */ +/* ^^^^^^^^^ constant.numeric.integer.decimal */ +/* ^ punctuation.terminator - constant */ dec3 = 124ul; -/* ^ constant.numeric */ -/* ^ constant.numeric */ +/* ^^^^^ constant.numeric.integer.decimal */ +/* ^^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ dec4 = 9'204lu; -/* ^ constant.numeric */ -/* ^ constant.numeric */ +/* ^^^^^^^ constant.numeric.integer.decimal */ +/* ^^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ dec5 = 2'354'202'076LL; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -int oct1 = 01234567; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -int oct2 = 014'70; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -int hex1 = 0x1234567890ABCDEF; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -int hex2 = 0X1234567890ABCDEF; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -int hex3 = 0x1234567890abcdef; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -int hex4 = 0xA7'45'8C'38; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -int bin1 = 0b010110; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -int bin2 = 0B010010; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -int bin3 = 0b1001'1101'0010'1100; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -units1 = 134h; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -units2 = 147min; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -units3 = 357s; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -units4 = 234_custom; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -fixed1 = 123.456; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -fixed2 = 12.; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -fixed3 = .35; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -fixed4 = 1'843'290.245'123; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -fixed5 = 0.3f; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -fixed6 = 0.82L; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -float sci1 = 1.23e10; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -float sci2 = 13e5; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -float sci3 = 14.23e+14; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -float sci4 = 14e+14; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -float sci5 = 18.84e-12; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -float sci6 = 46e-14; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -float sci7 = 2'837e1'000; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -float sci8 = 23e-1'000; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -double sci_hex = 0xc1.01AbFp-1; -/* ^^^^^^^^^^^^^ constant.numeric */ +/* ^^^^^^^^^^^^^^^ constant.numeric.integer.decimal */ +/* ^^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +oct1 = 0123_567; +/* ^^^^^^^^ constant.numeric.integer.octal */ +/* ^ punctuation.definition.numeric.base */ +/* ^^^^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +oct2 = 014'70; +/* ^^^^^^ constant.numeric.integer.octal */ +/* ^ punctuation.definition.numeric.base */ +/* ^ punctuation.terminator - constant */ + +hex1 = 0x1234567890ABCDEF; +/* ^^^^^^^^^^^^^^^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ punctuation.terminator - constant */ + +hex2 = 0X1234567890ABCDEF; +/* ^^^^^^^^^^^^^^^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ punctuation.terminator - constant */ + +hex3 = 0x1234567890abcdef; +/* ^^^^^^^^^^^^^^^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ punctuation.terminator - constant */ + +hex4 = 0xA7'45'8C'38; +/* ^^^^^^^^^^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ punctuation.terminator - constant */ + +hex5 = 0x0+0xFL+0xaull+0xallu+0xfu+0xf'12_4_uz; +/* ^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ storage.type.numeric */ +/* ^^^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^^^ storage.type.numeric */ +/* ^^^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^^^ storage.type.numeric */ +/* ^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ storage.type.numeric */ +/* ^^^^^^^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^^^^^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +hex2 = 0xc1.01AbFp-1; +/* ^^^^^^^^^^^^^ constant.numeric.float.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ punctuation.separator.decimal */ +/* ^ punctuation.terminator - constant */ + +bin1 = 0b010110; +/* ^^^^^^^^ constant.numeric.integer.binary */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ punctuation.terminator - constant */ + +bin2 = 0B010010; +/* ^^^^^^^^ constant.numeric.integer.binary */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ punctuation.terminator - constant */ + +bin3 = 0b1001'1101'0010'1100; +/* ^^^^^^^^^^^^^^^^^^^^^ constant.numeric.integer.binary */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ punctuation.terminator - constant */ + +f = 1.1+1.1e1+1.1e-1+1.1f+1.1e1f+1.1e-1f+1.1L+1.1e1L+1.1e-1L; +/* ^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +f = 1.e1+1.e-1+1.e1f+1.e-1f+1.e1L+1.e-1L; +/* ^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +f = 1.+1.f+1.L+1..; +/* ^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^ constant.numeric.integer.decimal */ +/* ^^ invalid.illegal.syntax */ +/* ^ punctuation.terminator - constant */ + +f = 1e1+1e1f+1e1L; +/* ^^^ constant.numeric.float.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^ constant.numeric.float.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^ constant.numeric.float.decimal */ +/* ^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +f = .1+.1e1+.1e-1+.1f+.1e1f+.1e-1f+.1L+.1e1L+.1e-1L; +/* ^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +f = 1'843'290.245'123; +/* ^^^^^^^^^^^^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ punctuation.terminator - constant */ + +f = 2'837e1'000; +/* ^^^^^^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.terminator - constant */ + +f = 23e-1'000; +/* ^^^^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.terminator - constant */ + +units1 = 134h + 123.45h; +/* ^^^^ constant.numeric.integer.decimal */ +/* ^ storage.type.numeric */ +/* ^^^ - constant */ +/* ^^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +units2 = 147min + 147.min; +/* ^^^^^^ constant.numeric.integer.decimal */ +/* ^^^ storage.type.numeric */ +/* ^^^ - constant */ +/* ^^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^^^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +units3 = 357s + 34.7s; +/* ^^^^ constant.numeric.integer.decimal */ +/* ^ storage.type.numeric */ +/* ^^^ - constant */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +units4 = 234_custom + 10e-1_custom; +/* ^^^^^^^^^^ constant.numeric.integer.decimal */ +/* ^^^^^^^ storage.type.numeric */ +/* ^^^ - constant */ +/* ^^^^^^^^^^^^ constant.numeric.float.decimal */ +/* ^^^^^^^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ ///////////////////////////////////////////// // Functions @@ -1202,7 +1399,8 @@ static const uint32_t * const MACRO funcname(); void FooBar :: baz(int a) /* ^^^^^^^^^^^^^^^^^^^^ meta.function */ -/* ^^^^^^^^^^^^^ entity.name.function */ +/* ^^^^^^^^^^^^^ meta.toc-list.full-identifier */ +/* ^^^ entity.name.function */ /* ^^ punctuation.accessor */ /* ^^^^^^^ meta.function.parameters meta.group */ /* ^ punctuation.section.group.begin */ @@ -1212,7 +1410,8 @@ void FooBar :: baz(int a) } /* A comment. */ void FooBar :: baz(int a) /* ^^^^^^^^^^^^^^^^^^^^ meta.function */ -/* ^^^^^^^^^^^^^ entity.name.function */ +/* ^^^^^^^^^^^^^ meta.toc-list.full-identifier */ +/* ^^^ entity.name.function */ /* ^^ punctuation.accessor */ /* ^^^^^^^ meta.function.parameters meta.group */ /* ^ punctuation.section.group.begin */ @@ -1222,13 +1421,15 @@ void FooBar :: baz(int a) } // prevent leading comment from function recognition /**/ HRESULT A::b() -/* ^ meta.function entity.name.function */ +/* ^ meta.function */ +/* ^ entity.name.function */ { return S_OK; } FooBar::FooBar(int a) /*^^^^^^^^^^^^^^^^^^^ meta.function */ -/*^^^^^^^^^^^^ entity.name.function */ +/*^^^^^^^^^^^^ meta.toc-list.full-identifier */ +/* ^^^^^^ entity.name.function */ /* ^^^^^^^ meta.function.parameters meta.group */ /* ^ punctuation.section.group.begin */ /* ^^^ storage.type */ @@ -1238,7 +1439,8 @@ FooBar::FooBar(int a) FooBar :: FooBar(int a) & = /*^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function */ -/*^^^^^^^^^^^^^^ entity.name.function */ +/*^^^^^^^^^^^^^^ meta.toc-list.full-identifier */ +/* ^^^^^^ entity.name.function */ /* ^^^^^^^ meta.function.parameters meta.group */ /* ^ punctuation.section.group.begin */ /* ^^^ storage.type */ @@ -1250,7 +1452,8 @@ default; /*^^^^^ meta.function storage.modifier */ FooBar::~FooBar -/*^^^^^^^^^^^^^ meta.function entity.name.function */ +/*^^^^^^^^^^^^^ meta.function meta.toc-list.full-identifier */ +/* ^^^^^^^ entity.name.function */ () { } /* <- meta.function.parameters meta.group punctuation.section.group.begin */ /* <- meta.function.parameters meta.group punctuation.section.group.end */ @@ -1258,13 +1461,14 @@ FooBar::~FooBar ThisIsAReallyReallyLongClassNameThatRequiresWrappingCodeInTheMiddleOfAPath:: ThisIsAReallyReallyLongClassNameThatRequiresWrappingCodeInTheMiddleOfAPath() -/* <- entity.name.function */ +/* <- meta.function meta.toc-list.full-identifier */ : var_name(nullptr) { } bool FooBar::operator==() {} /* ^^^^^^^^^^^^^^^^^^^^^^^ meta.function */ -/* ^^^^^^^^^^^^^^^^^^ entity.name.function */ +/* ^^^^^^^^^^^^^^^^^^ meta.toc-list.full-identifier */ +/* ^^^^^^^^^^ entity.name.function */ /* ^^ meta.function.parameters meta.group */ /* ^ punctuation.section.group.begin */ /* ^ punctuation.section.group.end */ @@ -1275,13 +1479,15 @@ bool FooBar::operator==() {} myns::FooBar::~FooBar() { } /*^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function */ +/*^^^^^^^^^^^^^^^^^^^ meta.toc-list.full-identifier */ /* ^^ meta.function.parameters meta.group */ /* ^ punctuation.section.group.begin */ /* ^ punctuation.section.group.end */ /* ^^^ meta.block */ /* ^ punctuation.section.block.begin */ /* ^ punctuation.section.block.end */ -/*^^^^^^^^^^^^^^^^^^^ entity.name.function */ +/*^^^^^^^^^^^^^^^^^^^ meta.toc-list.full-identifier */ +/* ^^^^^^^ entity.name.function */ extern "C" void test_in_extern_c_block() /* ^^^^^^^^^^^^^^^^^^^^^^^^ meta.function */ @@ -1374,6 +1580,18 @@ using namespace NAME __attribute__((visibility ("hidden"))); /* ^ storage.modifier */ /* ^ string */ +void func() { + using namespace NAME __attribute__((visibility ("hidden"))); +/* ^ keyword.control */ +/* ^ keyword.control */ +/* ^ storage.modifier */ +/* ^ string */ +} + +using namespace +/* <- keyword.control */ +/* ^ keyword.control */ + using namespace myNameSpace; /* <- keyword.control */ /* ^ keyword.control */ @@ -1722,9 +1940,9 @@ class FooBar { friend int func(int a, int b) { /* ^ storage.modifier */ /* ^ storage.type */ -/* ^ - entity.name.function */ +/* ^ entity.name.function */ /* ^ - meta.function-call */ -/* ^ meta.class meta.block meta.block punctuation.section.block.begin */ +/* ^ meta.class meta.block meta.method meta.block punctuation.section.block.begin */ int a = 1; } /* ^ meta.class meta.block meta.block punctuation.section.block.end */ @@ -1736,6 +1954,13 @@ class FooBar { /* ^^ punctuation.accessor */ /* ^ - entity */ + friend bool operator != (const X& lhs, const X& rhs) { + /* ^^^^^^^^^^^ entity.name.function */ + int a = 1; + } +/* ^ meta.class meta.block meta.block punctuation.section.block.end */ +/* ^ - meta.class meta.block meta.block */ + #if 0 /* ^ constant.numeric */ int disabled_func() { @@ -2028,6 +2253,60 @@ template class Sample { } }; +class Namespace::MyClass MACRO1 MACRO2 : public SuperClass +/* ^^^^^^^ entity.name.class */ +/* ^^ punctuation.accessor */ +/* ^ - entity.name */ +{ +}; + +struct Namespace::MyStruct +/* ^^^^^^^^ entity.name.struct */ +/* ^^ punctuation.accessor */ +{ +}; + +union Namespace::MyUnion +/* ^^^^^^^ entity.name.union */ +/* ^^ punctuation.accessor */ +{ +}; + +enum class Namespace::MyEnum +/* ^^^^^^ entity.name.enum */ +/* ^^ punctuation.accessor */ +{ +}; + +class Namespace:: +MyClass MACRO1 +/* <- entity.name.class */ +/* ^ - entity.name */ +{ +}; + +struct Namespace:: +MyStruct MACRO1 +/* <- entity.name.struct */ +/* ^ - entity.name */ +{ +}; + +union Namespace:: +MyUnion MACRO1 +/* <- entity.name.union */ +/* ^ - entity.name */ +{ +}; + +enum class Namespace:: +MyEnum MACRO1 +/* <- entity.name.enum */ +/* ^ - entity.name */ +{ +}; + + ///////////////////////////////////////////// // Test preprocessor branching and C blocks ///////////////////////////////////////////// @@ -2318,7 +2597,7 @@ void sayHi() ); if (::std::foo()) {} -/* ^^^^^^^^^^ variable.function */ +/* ^^^ variable.function */ /* ^^ punctuation.accessor */ /* ^^ punctuation.accessor */ @@ -2344,10 +2623,32 @@ void sayHi() /* ^ punctuation.section.generic.end */ /* ^^ meta.group */ + ::myns::foo(); +/* ^^ punctuation.accessor.double-colon */ +/* ^^ punctuation.accessor.double-colon */ +/* ^^^^^^^^^^^^^^^^^^ meta.function-call */ +/* ^^^ variable.function */ +/* ^^^ storage.type */ + + myns::FooClass{42}; +/* ^^ punctuation.accessor.double-colon */ +/* ^^^^^^^^^^^^^^^^^^ meta.function-call */ +/* ^^^^^^^^ variable.function */ + + ::myns::BarClass{}; +/* ^^ punctuation.accessor.double-colon */ +/* ^^ punctuation.accessor.double-colon */ +/* ^^^^^^^^^^^^^^^^^^^^^ meta.function-call */ +/* ^^^^^^^^ variable.function */ +/* ^^^ storage.type */ + int a[5]; /* ^^^ meta.brackets */ /* ^ punctuation.section.brackets.begin */ /* ^ punctuation.section.brackets.end */ + + std::cout << ">> Hi!\n"; +/* ^^ keyword.operator.arithmetic.c */ } ///////////////////////////////////////////// @@ -2379,3 +2680,7 @@ void sayHi() /* ^ punctuation.definition.string.begin */ /* ^^^^^^^^ string.quoted.other.lt-gt.include */ /* ^ punctuation.definition.string.end */ + +/** + * +/* ^ comment.block.c punctuation.definition.comment.c */ diff --git a/CSS/.python-version b/CSS/.python-version new file mode 100644 index 0000000000..98fccd6d02 --- /dev/null +++ b/CSS/.python-version @@ -0,0 +1 @@ +3.8 \ No newline at end of file diff --git a/CSS/CSS.sublime-syntax b/CSS/CSS.sublime-syntax index c5b200df9c..67ad7ac32d 100644 --- a/CSS/CSS.sublime-syntax +++ b/CSS/CSS.sublime-syntax @@ -18,8 +18,14 @@ variables: # Types # https://www.w3.org/TR/css3-values/#numeric-types + # https://www.w3.org/TR/css-syntax-3/#number-token-diagram integer: '(?:[-+]?\d+)' - number: '[-+]?(?:(?:\d*\.\d+(?:[eE]{{integer}})*)|{{integer}})' + exponent: '(?:[eE]{{integer}})' + float: |- + (?x: + [-+]? \d* (\.) \d+ {{exponent}}? + | [-+]? \d+ {{exponent}} + ) # Units # https://www.w3.org/TR/css3-values/#lengths @@ -127,6 +133,9 @@ contexts: - match: \*/ scope: punctuation.definition.comment.css pop: true + - match: ^\s*(\*)(?!/) + captures: + 1: punctuation.definition.comment.css at-charset: - match: \s*((@)charset\b)\s* @@ -257,11 +266,10 @@ contexts: push: - match: '(?=\})' pop: true - - match: '\s*(?:(from|to)|((?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)(%)))\s*,?\s*' - captures: - 1: keyword.keyframe-selector.css - 2: constant.numeric.css - 3: keyword.other.unit.css + - match: \b(from|to)\b + scope: keyword.keyframe-selector.css + - include: comma-delimiter + - include: numeric-values - include: main at-media: @@ -291,7 +299,7 @@ contexts: - include: comment-block - match: \b(?i:all|aural|braille|embossed|handheld|print|projection|screen|speech|tty|tv)\b scope: support.constant.media.css - - match: '\b(?i:and|or|not|only)\b' + - match: \b(?i:and|or|not|only)\b scope: keyword.operator.logic.media.css - match: ',' scope: punctuation.definition.arbitrary-repetition.css @@ -305,31 +313,29 @@ contexts: - match: |- (?x) ( + (?: (-webkit-|-o-)? - ((min|max)-)? + (?:min-|max-)? (-moz-)? - ( - ((device-)?(height|width|aspect-ratio|pixel-ratio))| - (color(-index)?)|monochrome|resolution + (?: + (?:device-)?(?:height|width|aspect-ratio|pixel-ratio) + |color(?:-index)?|monochrome|resolution ) - )|grid|scan|orientation - \s*(?=[:)]) + ) + |grid|scan|orientation + )\s*(:)? captures: - 0: support.type.property-name.media.css + 1: support.type.property-name.media.css 2: support.type.vendor-prefix.css - 5: support.type.vendor-prefix.css - push: - - match: (:)|(?=\)) - captures: - 1: punctuation.separator.key-value.css - pop: true - - match: \b(portrait|landscape|progressive|interlace) + 3: support.type.vendor-prefix.css + 4: punctuation.separator.key-value.css + - match: \b(portrait|landscape|progressive|interlace)\b scope: support.constant.property-value.css - match: \s*(\d+)(/)(\d+) captures: - 1: constant.numeric.css + 1: constant.numeric.integer.decimal.css 2: keyword.operator.arithmetic.css - 3: constant.numeric.css + 3: constant.numeric.integer.decimal.css - include: numeric-values media-query-list: @@ -466,7 +472,8 @@ contexts: | (extra|semi|ultra)-(condensed|expanded) | farthest-(corner|side)? | fill(-box|-opacity)? - | filter|fixed|flat + | filter|first|fixed|flat + | fit-content | flex((-basis|-end|-grow|-shrink|-start)|box)? | flip|flood-color | font(-size(-adjust)?|-stretch|-weight)? @@ -527,6 +534,7 @@ contexts: | run-in | ruby(-base|-text)?(-container)? | rtl|running|saturat(e|ion)|screen + | safe | scroll(-position|bar)? | separate|sepia | scale-down @@ -537,7 +545,7 @@ contexts: | slashed-zero|slice | small(-caps|er)? | smooth|snap|solid|soft-light - | space(-around|-between)? + | space(-around|-between|-evenly)? | span|sRGB | stack(ed-fractions)? | start(ColorStr)? @@ -560,7 +568,7 @@ contexts: | touch|traditional | transform(-origin)? | under(-edge|line)? - | unicase|unset|uppercase|upright + | unicase|unsafe|unset|uppercase|upright | use-(glyph-orientation|script) | verso | vertical(-align|-ideographic|-lr|-rl|-text)? @@ -636,10 +644,9 @@ contexts: 1: punctuation.terminator.rule.css pop: true - include: property-values + - include: comma-delimiter - match: '{{ident}}(\s+{{ident}})*' scope: string.unquoted.css - - match: ',' - scope: punctuation.separator.css - match: '' pop: true # Property names are sorted by popularity in descending order. @@ -733,7 +740,7 @@ contexts: - include: property-values selector: - - match: '\s*(?=[:.*#a-zA-Z\[])' + - match: (?=[:.*#a-zA-Z\[]) push: - meta_scope: meta.selector.css - match: "(?=[/@{)])" @@ -788,6 +795,7 @@ contexts: - match: '\]' scope: punctuation.definition.entity.css pop: true + - include: comma-delimiter # Pseudo Elements # https://drafts.csswg.org/selectors-4/#pseudo-elements @@ -876,10 +884,14 @@ contexts: pop: true - match: \b(even|odd)\b scope: keyword.other.pseudo-class.css - - match: '(?:[-+]?(?:\d+)?(n)(\s*[-+]\s*\d+)?|[-+]?\s*\d+)' - scope: constant.numeric.css + - match: '([-+]?\d*(n))\s*([-+]\s*\d+)?' captures: - 1: keyword.other.unit.css + 1: constant.numeric.integer.decimal.css + 2: keyword.other.unit.css + 3: constant.numeric.integer.decimal.css + - match: '[-+]\s+\d+n?|[-+]?\d+\s+n' + scope: invalid.illegal.numeric.css + - include: integer-type # Regular Pseudo Classes - match: '(:)({{ident}})' @@ -1014,6 +1026,7 @@ contexts: - meta_scope: meta.group.css - match: '(?=\))' pop: true + - include: literal-string - include: unquoted-string # Transform Functions @@ -1267,8 +1280,7 @@ contexts: - include: length-type - include: percentage-type - include: calc-function - - match: ',' - scope: punctuation.separator.sequence.css + - include: comma-delimiter # toggle() # https://www.w3.org/TR/css3-values/#toggle-notation @@ -1569,7 +1581,7 @@ contexts: - include: resolution-type - include: image-type - match: '[0-9]+(x)' - scope: constant.numeric.css + scope: constant.numeric.integer.decimal.css captures: 1: keyword.other.unit.css - include: unquoted-string @@ -1894,7 +1906,7 @@ contexts: comma-delimiter: - match: '\s*(,)\s*' captures: - 1: punctuation.separator.css + 1: punctuation.separator.sequence.css vendor-prefix: - match: "-(?:webkit|moz|ms|o)-" @@ -1928,31 +1940,30 @@ contexts: scope: string.unquoted.css literal-string: - - match: "'" + - match: \' scope: punctuation.definition.string.begin.css push: - meta_scope: string.quoted.single.css - - match: (')|(\n) - captures: - 1: punctuation.definition.string.end.css - 2: invalid.illegal.newline.css + - match: \' + scope: punctuation.definition.string.end.css pop: true - include: string-content - - match: '"' + - match: \" scope: punctuation.definition.string.begin.css push: - meta_scope: string.quoted.double.css - - match: (")|(\n) - captures: - 1: punctuation.definition.string.end.css - 2: invalid.illegal.newline.css + - match: \" + scope: punctuation.definition.string.end.css pop: true - include: string-content string-content: + - match: \n + scope: invalid.illegal.newline.css + pop: true - match: \\\s*\n scope: constant.character.escape.newline.css - - match: '\\(\h{1,6}|.)' + - match: \\(?:\h{1,6}|.) scope: constant.character.escape.css # https://www.w3.org/TR/css3-values/#numeric-types @@ -1961,19 +1972,30 @@ contexts: - include: percentage-type - include: number-type + float-type: + - match: '{{float}}' + scope: constant.numeric.float.decimal.css + captures: + 1: punctuation.separator.decimal.css + integer-type: - match: '{{integer}}' - scope: constant.numeric.css + scope: constant.numeric.integer.decimal.css # Make sure `number-type` is included after any other numeric values # as `number-type` will consume all numeric values. number-type: - - match: '{{number}}' - scope: constant.numeric.css + - include: float-type + - include: integer-type percentage-type: - - match: '{{number}}(%)' - scope: constant.numeric.css + - match: '{{float}}(%)' + scope: constant.numeric.float.decimal.css + captures: + 1: punctuation.separator.decimal.css + 2: keyword.other.unit.css + - match: '{{integer}}(%)' + scope: constant.numeric.integer.decimal.css captures: 1: keyword.other.unit.css @@ -1985,38 +2007,63 @@ contexts: - include: time-type length-type: - - match: '{{number}}({{font_relative_lengths}}|{{viewport_percentage_lengths}}|{{absolute_lengths}})\b' - scope: constant.numeric.css + - match: '{{float}}({{font_relative_lengths}}|{{viewport_percentage_lengths}}|{{absolute_lengths}})\b' + scope: constant.numeric.float.decimal.css + captures: + 1: punctuation.separator.decimal.css + 2: keyword.other.unit.css + - match: '{{integer}}({{font_relative_lengths}}|{{viewport_percentage_lengths}}|{{absolute_lengths}})\b' + scope: constant.numeric.integer.decimal.css captures: 1: keyword.other.unit.css - match: '0\b(?!%)' - scope: constant.numeric.css + scope: constant.numeric.integer.decimal.css time-type: - - match: '{{number}}({{duration_units}})\b' - scope: constant.numeric.css + - match: '{{float}}({{duration_units}})\b' + scope: constant.numeric.float.decimal.css + captures: + 1: punctuation.separator.decimal.css + 2: keyword.other.unit.css + - match: '{{integer}}({{duration_units}})\b' + scope: constant.numeric.integer.decimal.css captures: 1: keyword.other.unit.css frequency-type: - - match: '{{number}}({{frequency_units}})\b' - scope: constant.numeric.css + - match: '{{float}}({{frequency_units}})\b' + scope: constant.numeric.float.decimal.css + captures: + 1: punctuation.separator.decimal.css + 2: keyword.other.unit.css + - match: '{{integer}}({{frequency_units}})\b' + scope: constant.numeric.integer.decimal.css captures: 1: keyword.other.unit.css resolution-type: - - match: '{{number}}({{resolution_units}})\b' - scope: constant.numeric.css + - match: '{{float}}({{resolution_units}})\b' + scope: constant.numeric.float.decimal.css + captures: + 1: punctuation.separator.decimal.css + 2: keyword.other.unit.css + - match: '{{integer}}({{resolution_units}})\b' + scope: constant.numeric.integer.decimal.css captures: 1: keyword.other.unit.css angle-type: - - match: '{{number}}({{angle_units}})\b' - scope: constant.numeric.css + - match: '{{float}}({{angle_units}})\b' + scope: constant.numeric.float.decimal.css + captures: + 1: punctuation.separator.decimal.css + 2: keyword.other.unit.css + - match: '{{integer}}({{angle_units}})\b' + scope: constant.numeric.integer.decimal.css captures: 1: keyword.other.unit.css - match: '0\b(?!%)' - scope: constant.numeric.css + scope: constant.numeric.integer.decimal.css # https://drafts.csswg.org/css-images-3/#typedef-image image-type: diff --git a/CSS/css_completions.py b/CSS/css_completions.py index fe955f3749..f7e25ddcb4 100644 --- a/CSS/css_completions.py +++ b/CSS/css_completions.py @@ -280,7 +280,7 @@ 'grid-row': [''], 'grid-row-end': [''], 'grid-row-start': [''], - 'height': ['', '', 'auto'], + 'height': ['', '', 'auto', 'fit-content'], 'hyphens': ['none', 'manual', 'auto'], 'image-rendering': [ 'auto', 'optimizeSpeed', 'optimizeQuality', 'pixelated' @@ -288,7 +288,11 @@ 'ime-mode': ['auto', 'normal', 'active', 'inactive', 'disabled'], 'isolation': ['auto', 'isolation'], 'justify-content': [ - 'flex-start', 'flex-end', 'center', 'space-between', 'space-around' + 'start', 'end', 'flex-start', 'flex-end', 'center', 'left', 'right', + 'safe start', 'safe end', 'safe flex-start', 'safe flex-end', 'safe center', 'safe left', 'safe right', + 'unsafe start', 'unsafe end', 'unsafe flex-start', 'unsafe flex-end', 'unsafe center', 'unsafe left', 'unsafe right', + 'normal', 'baseline', 'first baseline', 'last baseline', + 'space-between', 'space-around', 'space-evenly', 'stretch' ], 'kerning': ['auto'], 'left': ['', '', 'auto'], @@ -307,10 +311,10 @@ 'marks': ['crop', 'cross', 'none'], 'mask': ['', 'none'], 'mask-type': ['luminance', 'alpha'], - 'max-height': ['', '', 'none'], - 'max-width': ['', '', 'none'], - 'min-height': ['', ''], - 'min-width': ['', ''], + 'max-height': ['', '', 'fit-content', 'none'], + 'max-width': ['', '', 'fit-content', 'none'], + 'min-height': ['', '', 'fit-content'], + 'min-width': ['', '', 'fit-content'], 'mix-blend-mode': [''], 'object-fit': ['fill', 'contain', 'cover', 'none', 'scale-down'], 'object-position': [''], @@ -406,7 +410,7 @@ 'visibility': ['visible', 'hidden', 'collapse'], 'white-space': ['normal', 'pre', 'nowrap', 'pre-wrap', 'pre-line'], 'widows': [''], - 'width': ['', '', 'auto'], + 'width': ['', '', 'auto', 'fit-content'], 'will-change': ['auto', 'contents', 'scroll-position', ''], 'word-break': ['normal', 'break-all', 'keep-all'], 'word-spacing': ['normal', ''], diff --git a/CSS/syntax_test_css.css b/CSS/syntax_test_css.css index d4eec80823..8d62321cdb 100644 --- a/CSS/syntax_test_css.css +++ b/CSS/syntax_test_css.css @@ -1,19 +1,23 @@ /* SYNTAX TEST "Packages/CSS/CSS.sublime-syntax" */ /* What am I, a comment? */ -/* ^^ punctuation.definition.comment.css */ -/* ^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block.css */ +/* ^^ punctuation.definition.comment.css */ +/* ^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block.css */ /* ^^ punctuation.definition.comment.css */ + /** + * +/* ^ comment.block.css punctuation.definition.comment.css */ + .test-strings { content: "double"; -/* ^^^^^^^^ string.quoted.double.css */ -/* ^ punctuation.definition.string.begin.css */ -/* ^ punctuation.definition.string.end.css */ +/* ^^^^^^^^ string.quoted.double.css */ +/* ^ punctuation.definition.string.begin.css */ +/* ^ punctuation.definition.string.end.css */ content: 'single'; -/* ^^^^^^^^ string.quoted.single.css */ -/* ^ punctuation.definition.string.begin.css */ -/* ^ punctuation.definition.string.end.css */ +/* ^^^^^^^^ string.quoted.single.css */ +/* ^ punctuation.definition.string.begin.css */ +/* ^ punctuation.definition.string.end.css */ content: 'invalid; /* ^ invalid.illegal.newline.css */ @@ -22,46 +26,64 @@ .test-punctuation { /* ^ punctuation.section.property-list.css */ top: 1px; -/* ^ punctuation.separator.key-value.css */ -/* ^ punctuation.terminator.rule.css */ +/* ^ punctuation.separator.key-value.css */ +/* ^ punctuation.terminator.rule.css */ top: cubic-bezier(0.2, 0, 0.13, 2); -/* ^ punctuation.separator.css*/ +/* ^^^ constant.numeric.float.decimal.css */ +/* ^ punctuation.separator.decimal.css */ +/* ^ punctuation.separator.sequence.css*/ +/* ^ constant.numeric.integer.decimal.css */ +/* ^ punctuation.separator.sequence.css*/ +/* ^^^^ constant.numeric.float.decimal.css */ +/* ^ punctuation.separator.decimal.css */ top: url("image"); -/* ^ punctuation.definition.group.begin.css */ +/* ^ punctuation.definition.group.begin.css */ /* ^ punctuation.definition.group.end.css */ } /* < punctuation.section.property-list.css */ .classname {} +/*^^ - meta.selector.css */ /* ^^^^^^^^^^^ meta.selector.css */ -/* ^ punctuation.definition.entity.css */ +/* ^^ - meta.selector.css */ +/* ^ punctuation.definition.entity.css */ /* ^^^^^^^^^ entity.other.attribute-name.class.css */ #id {} -/* ^ punctuation.definition.entity.css */ +/*^^ - meta.selector.css */ +/* ^^^^ meta.selector.css */ +/* ^^ - meta.selector.css */ +/* ^ punctuation.definition.entity.css */ /* ^^ entity.other.attribute-name.id.css */ - html {} + html, h1 {} +/*^^ - meta.selector.css */ +/* ^^^^^^^^^ meta.selector.css */ +/* ^^ - meta.selector.css */ /* ^^^^ entity.name.tag.css */ +/* ^ punctuation.separator.sequence.css */ +/* ^^ entity.name.tag.css */ +/* ^ punctuation.section.property-list.css */ +/* ^ punctuation.section.property-list.css */ @charset "UTF-8"; /* ^^^^^^^^^^^^^^^^ meta.at-rule.charset.css */ -/* ^ punctuation.definition.keyword.css */ +/* ^ punctuation.definition.keyword.css */ /* ^^^^^^^ keyword.control.at-rule.charset.css */ @import "x" print; /* ^^^^^^^^^^^^^^^^^ meta.at-rule.import.css */ -/* ^ punctuation.definition.keyword.css */ -/* ^^^^^^ keyword.control.at-rule.import.css */ -/* ^^^^^ support.constant.media.css */ +/* ^ punctuation.definition.keyword.css */ +/* ^^^^^^ keyword.control.at-rule.import.css */ +/* ^^^^^ support.constant.media.css */ @namespace svg "http://www.w3.org/1999/xhtml"; /* ^^^^^^^^^^^^^^^^^ meta.at-rule.namespace.css */ -/* ^ punctuation.definition.keyword.css */ -/* ^^^^^^^^^ keyword.control.at-rule.namespace.css */ -/* ^^^ entity.other.namespace-prefix.css */ +/* ^ punctuation.definition.keyword.css */ +/* ^^^^^^^^^ keyword.control.at-rule.namespace.css */ +/* ^^^ entity.other.namespace-prefix.css */ @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* only needed once */ /* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.at-rule.namespace.css */ @@ -73,108 +95,118 @@ @page :left {} /* ^^^^^^^^^^^^^^ meta.at-rule.page.css */ -/* ^ punctuation.definition.keyword.css */ -/* ^^^^ keyword.control.at-rule.page.css */ +/* ^ punctuation.definition.keyword.css */ +/* ^^^^ keyword.control.at-rule.page.css */ @media only screen {} /* ^^^^^^^^^^^^^^^^^^^ meta.at-rule.media.css */ -/* ^ punctuation.definition.keyword.css */ -/* ^^^^^ keyword.control.at-rule.media.css */ -/* ^^^^ keyword.operator.logic.media.css */ -/* ^^^^^^ support.constant.media.css */ +/* ^ punctuation.definition.keyword.css */ +/* ^^^^^ keyword.control.at-rule.media.css */ +/* ^^^^ keyword.operator.logic.media.css */ +/* ^^^^^^ support.constant.media.css */ @media (min-width: 700px) {} /* ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.at-rule.media.css */ -/* ^ punctuation.definition.keyword.css */ -/* ^^^^^ keyword.control.at-rule.media.css */ +/* ^ punctuation.definition.keyword.css */ +/* ^^^^^ keyword.control.at-rule.media.css */ /* ^ punctuation.definition.group.begin.css */ -/* ^^^^^^^^^ support.type.property-name.media.css */ -/* ^^^^^ constant.numeric.css */ +/* ^^^^^^^^^ support.type.property-name.media.css */ +/* ^^^^^ constant.numeric.integer.decimal.css */ /* ^ punctuation.definition.group.end.css */ @media (min-width: 700px) and (max-width: 2000px) {} /* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.at-rule.media.css */ -/* ^ punctuation.definition.keyword.css */ -/* ^^^^^ keyword.control.at-rule.media.css */ +/* ^ punctuation.definition.keyword.css */ +/* ^^^^^ keyword.control.at-rule.media.css */ /* ^ punctuation.definition.group.begin.css */ /* ^^^^^^^^^ support.type.property-name.media.css */ -/* ^^^^^ constant.numeric.css */ +/* ^^^^^ constant.numeric.integer.decimal.css */ /* ^ punctuation.definition.group.end.css */ /* ^^^ keyword.operator.logic */ /* ^ punctuation.definition.group.begin.css */ /* ^^^^^^^^^ support.type.property-name.media.css */ -/* ^^^^^^ constant.numeric.css */ +/* ^^^^^^ constant.numeric.integer.decimal.css */ /* ^ punctuation.definition.group.end.css */ @media only screen and (-webkit-min-device-pixel-ratio: /* comment */ 1.3), /* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.at-rule.media.css */ -/* ^ punctuation.definition.keyword.css */ -/* ^^^^^ keyword.control.at-rule.media.css */ -/* ^^^^ keyword.operator.logic.media.css */ +/* ^ punctuation.definition.keyword.css */ +/* ^^^^^ keyword.control.at-rule.media.css */ +/* ^^^^ keyword.operator.logic.media.css */ /* ^^^^^^ support.constant.media.css */ /* ^^^ keyword.operator.logic.media.css */ /* ^ punctuation.definition.group.begin.css */ /* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ support.type.property-name.media.css */ /* ^ punctuation.separator.key-value.css */ /* ^^^^^^^^^^^^^ comment.block.css */ -/* ^^^ constant.numeric.css */ +/* ^^^ constant.numeric.float.decimal.css */ /* ^ punctuation.definition.group.end.css */ /* ^ punctuation.definition.arbitrary-repetition */ only screen and (-o-min-device-pixel-ratio: 13/10), /* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.at-rule.media.css */ -/* ^^^^ keyword.operator.logic.media.css */ +/* ^^^^ keyword.operator.logic.media.css */ /* ^^^^^^ support.constant.media.css */ /* ^^^ keyword.operator.logic.media.css */ /* ^ punctuation.definition.group.begin.css */ /* ^^^^^^^^^^^^^^^^^^^^^^^^^ support.type.property-name.media.css */ /* ^ punctuation.separator.key-value.css */ -/* ^^ constant.numeric.css */ +/* ^^ constant.numeric.integer.decimal.css */ /* ^ keyword.operator */ -/* ^^ constant.numeric.css */ +/* ^^ constant.numeric.integer.decimal.css */ /* ^ punctuation.definition.group.end.css */ /* ^ punctuation.definition.arbitrary-repetition */ only screen and (min-resolution: 120dpi) /* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.at-rule.media.css */ -/* ^^^^ keyword.operator.logic.media.css */ +/* ^^^^ keyword.operator.logic.media.css */ /* ^^^^^^ support.constant.media.css */ /* ^^^ keyword.operator.logic.media.css */ /* ^ punctuation.definition.group.begin.css */ /* ^^^^^^^^^^^^^^ support.type.property-name.media.css */ /* ^ punctuation.separator.key-value.css */ -/* ^^^^^^ constant.numeric.css */ +/* ^^^^^^ constant.numeric.integer.decimal.css */ /* ^ punctuation.definition.group.end.css */ {} @custom-media --a-b (width: 1px); /* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.at-rule.custom-media.css */ -/* ^ punctuation.definition.keyword.css */ -/* ^^^^^^^^^^^^ keyword.control.at-rule.custom-media.css */ -/* ^^^^^ support.type.property-name.media.css */ +/* ^ punctuation.definition.keyword.css */ +/* ^^^^^^^^^^^^ keyword.control.at-rule.custom-media.css */ +/* ^^^^^ support.type.property-name.media.css */ @keyframes beat, bounce {} /* ^^^^^^^^^^^^^^^^^^^^^^^^ meta.at-rule.keyframe.css */ -/* ^ punctuation.definition.keyword.css */ -/* ^^^^^^^^^ keyword.control.at-rule.keyframe.css */ -/* ^^^^ entity.other.animation-name.css */ -/* ^ punctuation.definition.arbitrary-repetition.css */ -/* ^^^^^^ entity.other.animation-name.css */ +/* ^ punctuation.definition.keyword.css */ +/* ^^^^^^^^^ keyword.control.at-rule.keyframe.css */ +/* ^^^^ entity.other.animation-name.css */ +/* ^ punctuation.definition.arbitrary-repetition.css */ +/* ^^^^^^ entity.other.animation-name.css */ @keyframes test-keyframes-keywords { from, to {} -/* ^^^^ keyword.keyframe-selector.css */ +/* ^^^^ keyword.keyframe-selector.css */ +/* ^ punctuation.separator.sequence.css */ /* ^^ keyword.keyframe-selector.css */ 0%, 100% {} -/* ^^ constant.numeric.css */ -/* ^^^^ constant.numeric.css */ - +/* ^^ constant.numeric.integer.decimal.css */ +/* ^ keyword.other.unit.css */ +/* ^ punctuation.separator.sequence.css */ +/* ^^^^ constant.numeric.integer.decimal.css */ +/* ^ keyword.other.unit.css */ .99%, 100.99% {} -/* ^^^^ constant.numeric.css */ -/* ^^^^^^^ constant.numeric.css */ +/* ^^^^ constant.numeric.float.decimal.css */ +/* ^ punctuation.separator.decimal.css */ +/* ^ keyword.other.unit.css */ +/* ^ punctuation.separator.sequence.css */ +/* ^^^^^^^ constant.numeric.float.decimal.css */ +/* ^ punctuation.separator.decimal.css */ +/* ^ keyword.other.unit.css */ 0%, to {} -/* ^^ constant.numeric.css */ +/* ^^ constant.numeric.integer.decimal.css */ +/* ^ keyword.other.unit.css */ +/* ^ punctuation.separator.sequence.css */ /* ^^ keyword.keyframe-selector.css */ } @@ -189,7 +221,7 @@ @document url(http://www), /* ^^^ support.function.url.css */ /* ^^^^^^^^^^ string.unquoted.css */ -/* ^ punctuation.separator.css */ +/* ^ punctuation.separator.sequence.css */ url-prefix("http://www"), /* ^^^^^^^^^^ support.function.url-prefix.css */ /* ^^^^^^^^^^^^ string.quoted.double.css */ @@ -209,7 +241,7 @@ @font-face { /* ^^^^^^^^^^^ meta.at-rule.font-face.css */ -/* ^ punctuation.definition.keyword.css */ +/* ^ punctuation.definition.keyword.css */ /* ^^^^^^^^^ keyword.control.at-rule.font-face.css */ src: local(Font), @@ -219,7 +251,7 @@ @font-face /* ^^^^^^^^^^^ meta.at-rule.font-face.css */ -/* ^ punctuation.definition.keyword.css */ +/* ^ punctuation.definition.keyword.css */ /* ^^^^^^^^^ keyword.control.at-rule.font-face.css */ { font-family: monospace, @@ -231,7 +263,7 @@ @supports not ( and ( top: 2px ) ) { } /* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.at-rule.supports.css */ -/* ^ punctuation.definition.keyword.css */ +/* ^ punctuation.definition.keyword.css */ /* ^^^^^^^^ keyword.control.at-rule.supports.css */ /* ^^^ keyword.operator.logic.css */ /* ^ meta.group.css punctuation.definition.group.begin.css */ @@ -239,7 +271,7 @@ /* ^ meta.group.css punctuation.definition.group.begin.css */ /* ^^^ support.type.property-name.css */ /* ^ punctuation.separator.key-value.css */ -/* ^^ constant.numeric.css keyword.other.unit.css */ +/* ^^ constant.numeric.integer.decimal.css keyword.other.unit.css */ /* ^ meta.group.css punctuation.definition.group.end.css */ /* ^ meta.group.css punctuation.definition.group.end.css */ /* ^^^ meta.block.css */ @@ -259,7 +291,7 @@ /* ^^^^ meta.at-rule.supports.css meta.selector.css */ @counter-style {} -/* ^ punctuation.definition.keyword.css */ +/* ^ punctuation.definition.keyword.css */ /* ^^^^^^^^^^^^^^ keyword.control.at-rule.counter-style.css */ @counter-style none {} @@ -269,7 +301,7 @@ /* ^^^^^^^ invalid.illegal.counter-style-name.css */ @counter-style name { -/* ^ punctuation.definition.keyword.css */ +/* ^ punctuation.definition.keyword.css */ /* ^^^^^^^^^^^^^^ keyword.control.at-rule.counter-style.css */ /* ^^^^ entity.other.counter-style-name.css */ symbols: "‣"; @@ -294,9 +326,9 @@ } .test-var { --test-var: arial; } -/* ^^^^^^^^^^ support.type.custom-property.css */ -/* ^^ punctuation.definition.custom-property */ -/* ^^^^^^^^ support.type.custom-property.name.css */ +/* ^^^^^^^^^^ support.type.custom-property.css */ +/* ^^ punctuation.definition.custom-property */ +/* ^^^^^^^^ support.type.custom-property.name.css */ .test-deprecated-var { var-deprecated- } /* ^^^^^^^^^^^^^^^ invalid.deprecated.custom-property.css */ @@ -304,22 +336,36 @@ .test-types { top: 20; -/* ^^ constant.numeric.css */ +/* ^^ constant.numeric.integer.decimal.css */ top: +.95e-20; -/* ^^^^^^^^ constant.numeric.css */ +/* ^^^^^^^^ constant.numeric.float.decimal.css */ +/* ^ punctuation.separator.decimal.css */ + top: +1e1e1 .1e1e1; +/* ^^^^ constant.numeric.float.decimal.css */ +/* ^ - constant.numeric */ +/* ^^^^ constant.numeric.float.decimal.css */ +/* ^ - constant.numeric */ top: -1.5e+93%; -/* ^^^^^^^^^ constant.numeric.css */ +/* ^^^^^^^^^ constant.numeric.float.decimal.css */ +/* ^ punctuation.separator.decimal.css */ } .test-units { top: 1px; -/* ^^ keyword.other.unit.css */ +/* ^^^ constant.numeric.integer.decimal.css */ +/* ^^ keyword.other.unit.css */ top: 1.1em; -/* ^^ keyword.other.unit.css */ +/* ^^^^^ constant.numeric.float.decimal.css */ +/* ^ punctuation.separator.decimal.css */ +/* ^^ keyword.other.unit.css */ top: -100%; -/* ^ keyword.other.unit.css */ +/* ^^^^^ constant.numeric.integer.decimal.css */ +/* ^ keyword.other.unit.css */ top: 1.1.1deg; -/* ^^^ keyword.other.unit.css */ +/* ^^^^^^^^ constant.numeric.float.decimal.css */ +/* ^ punctuation.separator.decimal.css */ +/* ^ punctuation.separator.decimal.css */ +/* ^^^ keyword.other.unit.css */ } .test-properties { @@ -361,62 +407,91 @@ /* Test Functional Pseudo Class Meta Scopes */ .test:nth-child(even) {} -/* ^^^^^^^^^^^^^^^^ meta.function-call.css */ -/* ^^^^^^ meta.group.css */ -/* ^ punctuation.definition.group.begin.css */ -/* ^ punctuation.definition.group.end.css */ +/*^^^^^^^^^^^^^^^^^^^^ meta.selector.css */ +/* ^ - meta.selector.css */ +/* ^^^^^^^^^^^^^^^^ meta.function-call.css */ +/* ^^^^^^ meta.group.css */ +/* ^ punctuation.definition.group.begin.css */ +/* ^ punctuation.definition.group.end.css */ + +.test:nth-child(+2n + 3) {} +/* ^^^ constant.numeric.integer.decimal.css */ +/* ^ - constant */ +/* ^^^ constant.numeric.integer.decimal.css */ + +.test:nth-child(-n+ 3) {} +/* ^^^^^ constant.numeric.integer.decimal.css */ + +.test:nth-child(-n +3) {} +/* ^^ constant.numeric.integer.decimal.css */ +/* ^ - constant */ +/* ^^ constant.numeric.integer.decimal.css */ + +.test:nth-child(+3) {} +/* ^^ constant.numeric.integer.decimal.css */ + +.test:nth-child(+ 3) {} +/* ^^^ invalid.illegal.numeric.css */ + +.test:nth-child(+ 3n) {} +/* ^^^ invalid.illegal.numeric.css */ + +.test:nth-child(+3 n) {} +/* ^^^^ invalid.illegal.numeric.css */ .test-pseudo-classes:nth-child(2):hover {} -/* ^^^^^^^^^ entity.other.pseudo-class.css */ -/* ^ constant.numeric.css */ -/* ^ punctuation.definition.entity.css */ -/* ^^^^^ entity.other.pseudo-class.css */ +/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.selector.css */ +/* ^ - meta.selector.css */ +/* ^^^^^^^^^ entity.other.pseudo-class.css */ +/* ^ constant.numeric.integer.decimal.css */ +/* ^ punctuation.definition.entity.css */ +/* ^^^^^ entity.other.pseudo-class.css */ .test-pseudo-class-numerics:nth-last-of-type(-n+3) {} -/* ^^^^^^^^^^^^^^^^^ entity.other.pseudo-class.css */ -/* ^^^^ constant.numeric.css */ +/* ^^^^^^^^^^^^^^^^^ entity.other.pseudo-class.css */ +/* ^^^^ constant.numeric.integer.decimal.css */ .test-pseudo-class-keywords:nth-of-type(odd) {} -/* ^^^^^^^^^^^^ entity.other.pseudo-class.css */ +/* ^^^^^^^^^^^^ entity.other.pseudo-class.css */ /* ^^^ keyword.other.pseudo-class.css */ .test-pseudo-class-strings:dir(ltr) {} -/* ^^^^ entity.other.pseudo-class.css */ -/* ^^^ string.unquoted.css */ +/* ^^^^ entity.other.pseudo-class.css */ +/* ^^^ string.unquoted.css */ .test-pseudo-class-tag:not(*) {} -/* ^^^^ entity.other.pseudo-class.css */ -/* ^ entity.name.tag.wildcard.css */ +/* ^^^^ entity.other.pseudo-class.css */ +/* ^ entity.name.tag.wildcard.css */ .test-pseudo-elements::before {} -/* ^^ punctuation.definition.entity.css */ -/* ^^^^^^^^ entity.other.pseudo-element.css */ +/* ^^ punctuation.definition.entity.css */ +/* ^^^^^^^^ entity.other.pseudo-element.css */ .test-pseudo-elements:after {} -/* ^ punctuation.definition.entity.css */ -/* ^^^^^^ entity.other.pseudo-element.css */ +/* ^ punctuation.definition.entity.css */ +/* ^^^^^^ entity.other.pseudo-element.css */ .test-pseudo-elements::-webkit-slider-runnable-track -/* ^^ punctuation.definition.entity.css */ +/* ^^ punctuation.definition.entity.css */ /* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ entity.other.pseudo-element.css */ .test-unicode { top: "\2764 \273e"; } -/* ^^^^^ constant.character.escape.css */ +/* ^^^^^ constant.character.escape.css */ /* ^^^^^ constant.character.escape.css */ .test-unicode-range { unicode-range: U+0025-00FF, U+4??; -/* ^^^^^^^^^^^ support.unicode-range.css */ -/* ^^ support.constant.unicode-range.prefix.css */ -/* ^^^^^^^^^ constant.codepoint-range.css */ -/* ^ punctuation.section.range.css */ -/* ^^^^^ support.unicode-range.css */ -/* ^^ support.constant.unicode-range.prefix.css */ -/* ^^^ constant.codepoint-range.css */ +/* ^^^^^^^^^^^ support.unicode-range.css */ +/* ^^ support.constant.unicode-range.prefix.css */ +/* ^^^^^^^^^ constant.codepoint-range.css */ +/* ^ punctuation.section.range.css */ +/* ^^^^^ support.unicode-range.css */ +/* ^^ support.constant.unicode-range.prefix.css */ +/* ^^^ constant.codepoint-range.css */ } .test-escape-character { top: "\nstring\n"; } -/* ^^ constant.character.escape.css */ +/* ^^ constant.character.escape.css */ /* ^^ constant.character.escape.css */ .test-attribute-selectors[disabled][type=button] {} @@ -443,7 +518,7 @@ /* ^^ keyword.operator.attribute-selector.css */ .test-attribute-selectors-whitespace[a = ""] {} -/* ^ entity.other.attribute-name.css */ +/* ^ entity.other.attribute-name.css */ /* ^ keyword.operator.attribute-selector.css */ .test-attribute-selectors-flags[a="" i] {} @@ -453,28 +528,28 @@ /* ^ entity.name.tag.wildcard.css */ .test-combinators >>> a >> a > a + b ~ a {} -/* ^^^ punctuation.separator.combinator.css */ -/* ^^ punctuation.separator.combinator.css */ -/* ^ punctuation.separator.combinator.css */ -/* ^ punctuation.separator.combinator.css */ +/* ^^^ punctuation.separator.combinator.css */ +/* ^^ punctuation.separator.combinator.css */ +/* ^ punctuation.separator.combinator.css */ +/* ^ punctuation.separator.combinator.css */ /* ^ punctuation.separator.combinator.css */ .test-invalid-combinators +>> a +++ a ~+> {} -/* ^^^ invalid.illegal.combinator.css */ -/* ^^^ invalid.illegal.combinator.css */ +/* ^^^ invalid.illegal.combinator.css */ +/* ^^^ invalid.illegal.combinator.css */ /* ^^^ invalid.illegal.combinator.css */ .test-generic-font-families { font: serif; -/* ^^^^^ support.constant.font-name.css */ +/* ^^^^^ support.constant.font-name.css */ font: sans-serif; /* ^^^^^^^^^^ support.constant.font-name.css */ font: cursive; -/* ^^^^^^^ support.constant.font-name.css */ +/* ^^^^^^^ support.constant.font-name.css */ font: fantasy; -/* ^^^^^^^ support.constant.font-name.css */ +/* ^^^^^^^ support.constant.font-name.css */ font: monospace; -/* ^^^^^^^^^ support.constant.font-name.css */ +/* ^^^^^^^^^ support.constant.font-name.css */ } .test-unquoted-font-name { @@ -536,24 +611,24 @@ .test-function-meta { top: filter(param1, 20px); /* ^^^^^^^^^^^^^^^^^^^^ meta.function-call.css */ -/* ^^^^^^^^^^^^^^ meta.group.css */ +/* ^^^^^^^^^^^^^^ meta.group.css */ } .test-color-functions { top: rgb(1, 4.5%); -/* ^^^ support.function.color.css */ -/* ^ constant.numeric.css */ -/* ^ punctuation.separator.css */ -/* ^^^^ constant.numeric.css */ +/* ^^^ support.function.color.css */ +/* ^ constant.numeric.integer.decimal.css */ +/* ^ punctuation.separator.sequence.css */ +/* ^^^^ constant.numeric.float.decimal.css */ top: rgba(); /* ^^^^ support.function.color.css */ top: hsl(1deg, 4.5%); -/* ^^^ support.function.color.css */ -/* ^^^^ constant.numeric.css */ -/* ^ punctuation.separator.css */ -/* ^^^^ constant.numeric.css */ +/* ^^^ support.function.color.css */ +/* ^^^^ constant.numeric.integer.decimal.css */ +/* ^ punctuation.separator.sequence.css */ +/* ^^^^ constant.numeric.float.decimal.css */ top: hsla(); /* ^^^^ support.function.color.css */ @@ -563,47 +638,47 @@ top: gray(1, 4.5%); -/* ^^^^ support.function.color.css */ -/* ^ constant.numeric.css */ -/* ^ punctuation.separator.css */ -/* ^^^^ constant.numeric.css */ +/* ^^^^ support.function.color.css */ +/* ^ constant.numeric.integer.decimal.css */ +/* ^ punctuation.separator.sequence.css */ +/* ^^^^ constant.numeric.float.decimal.css */ top: device-cmyk(0.5, 1%, red()); -/* ^^^^^^^^^^^ support.function.color.css */ -/* ^^^ constant.numeric.css */ -/* ^ punctuation.separator.css */ -/* ^^ constant.numeric.css */ +/* ^^^^^^^^^^^ support.function.color.css */ +/* ^^^ constant.numeric.float.decimal.css */ +/* ^ punctuation.separator.sequence.css */ +/* ^^ constant.numeric.integer.decimal.css */ /* ^^^ support.function.color.css */ top: color(w() s()); -/* ^^^^^ support.function.color.css */ -/* ^ support.function.color.css */ +/* ^^^^^ support.function.color.css */ +/* ^ support.function.color.css */ /* ^ support.function.color.css */ top: alpha(- 1.5%); -/* ^^^^^ support.function.color.css */ -/* ^ keyword.operator.css */ -/* ^^^^ constant.numeric.css */ +/* ^^^^^ support.function.color.css */ +/* ^ keyword.operator.css */ +/* ^^^^ constant.numeric.float.decimal.css */ top: h(+ 1.5deg); -/* ^ support.function.color.css */ -/* ^ keyword.operator.css */ -/* ^^^^^^ constant.numeric.css */ +/* ^ support.function.color.css */ +/* ^ keyword.operator.css */ +/* ^^^^^^ constant.numeric.float.decimal.css */ top: w(* 1.5%); -/* ^ support.function.color.css */ -/* ^ keyword.operator.css */ -/* ^^^^ constant.numeric.css */ +/* ^ support.function.color.css */ +/* ^ keyword.operator.css */ +/* ^^^^ constant.numeric.float.decimal.css */ top: shade(1.5%); -/* ^^^^^ support.function.color.css */ -/* ^^^^ constant.numeric.css */ +/* ^^^^^ support.function.color.css */ +/* ^^^^ constant.numeric.float.decimal.css */ top: blenda(red 50% hsl); -/* ^^^^^^ support.function.color.css */ -/* ^^^ support.constant.color.w3c-standard-color-name.css */ -/* ^^^ constant.numeric.css */ -/* ^^^ keyword.other.color-space.css */ +/* ^^^^^^ support.function.color.css */ +/* ^^^ support.constant.color.w3c-standard-color-name.css */ +/* ^^^ constant.numeric.integer.decimal.css */ +/* ^^^ keyword.other.color-space.css */ background-color: color(var(--background) blend(var(--foreground) 80%)); /* ^^^^^^^^^^^^^^^^ support.type.property-name.css */ @@ -620,71 +695,71 @@ /* ^ punctuation.definition.group.begin.css */ /* ^^^^^^^^^^^^ support.type.custom-property.css */ /* ^ punctuation.definition.group.end.css */ -/* ^^^ constant.numeric.css */ +/* ^^^ constant.numeric.integer.decimal.css */ /* ^^ punctuation.definition.group.end.css */ /* ^ punctuation.terminator.rule.css */ } .test-transform-functions { top: rotate(0); -/* ^^^^^^ support.function.transform.css */ -/* ^ constant.numeric.css */ +/* ^^^^^^ support.function.transform.css */ +/* ^ constant.numeric.integer.decimal.css */ top: rotate(1) -/* ^^^^^^ support.function.transform.css */ -/* ^ - constant.numeric.css */ +/* ^^^^^^ support.function.transform.css */ +/* ^ - constant.numeric.integer.decimal.css */ top: rotate3d(-1, 2deg); -/* ^^^^^^^^ support.function.transform.css */ -/* ^^ constant.numeric.css */ -/* ^^^^ constant.numeric.css */ +/* ^^^^^^^^ support.function.transform.css */ +/* ^^ constant.numeric.integer.decimal.css */ +/* ^^^^ constant.numeric.integer.decimal.css */ top: matrix3d(1, 0); -/* ^^^^^^^^ support.function.transform.css */ -/* ^ constant.numeric.css */ -/* ^ punctuation.separator.css */ -/* ^ constant.numeric.css */ +/* ^^^^^^^^ support.function.transform.css */ +/* ^ constant.numeric.integer.decimal.css */ +/* ^ punctuation.separator.sequence.css */ +/* ^ constant.numeric.integer.decimal.css */ top: translate3d(1, 2px, 3%); -/* ^^^^^^^^^^^ support.function.transform.css */ -/* ^ constant.numeric.css */ -/* ^ punctuation.separator.css */ -/* ^^^ constant.numeric.css */ -/* ^^ constant.numeric.css */ +/* ^^^^^^^^^^^ support.function.transform.css */ +/* ^ constant.numeric.integer.decimal.css */ +/* ^ punctuation.separator.sequence.css */ +/* ^^^ constant.numeric.integer.decimal.css */ +/* ^^ constant.numeric.integer.decimal.css */ top: translateY(2px); -/* ^^^^^^^^^^ support.function.transform.css */ -/* ^^^ constant.numeric.css */ +/* ^^^^^^^^^^ support.function.transform.css */ +/* ^^^ constant.numeric.integer.decimal.css */ top: translateX(1%); /* ^^^^^^^^^^ support.function.transform */ -/* ^^ constant.numeric.css */ +/* ^^ constant.numeric.integer.decimal.css */ top: translateZ(0); /* ^^^^^^^^^^ support.function.transform */ -/* ^ constant.numeric.css */ +/* ^ constant.numeric.integer.decimal.css */ top: skewY(1deg); -/* ^^^^^ support.function.transform.css */ -/* ^^^^ constant.numeric.css */ +/* ^^^^^ support.function.transform.css */ +/* ^^^^ constant.numeric.integer.decimal.css */ top: skew(1deg, 2turn); -/* ^^^^ support.function.transform.css */ -/* ^^^^ constant.numeric.css */ -/* ^ punctuation.separator.css */ -/* ^^^^^ constant.numeric.css */ +/* ^^^^ support.function.transform.css */ +/* ^^^^ constant.numeric.integer.decimal.css */ +/* ^ punctuation.separator.sequence.css */ +/* ^^^^^ constant.numeric.integer.decimal.css */ top: perspective(17px); -/* ^^^^^^^^^^^ support.function.transform.css */ -/* ^^^^ constant.numeric.css */ +/* ^^^^^^^^^^^ support.function.transform.css */ +/* ^^^^ constant.numeric.integer.decimal.css */ top: scaleY(2); -/* ^^^^^^ support.function.transform.css */ -/* ^ constant.numeric.css */ +/* ^^^^^^ support.function.transform.css */ +/* ^ constant.numeric.integer.decimal.css */ top: skewY(1rad) rotate(1turn); -/* ^^^^^^ support.function.transform.css */ -/* ^^^^^ constant.numeric.css */ +/* ^^^^^^ support.function.transform.css */ +/* ^^^^^ constant.numeric.integer.decimal.css */ transform: translate(var(--center), 0) scale(var(--ripple-scale), 1); /* ^^^^^^^^^ support.function.transform */ @@ -696,12 +771,12 @@ .test-timing-functions { top: cubic-bezier(0.42, 0, 0.58, 1); -/* ^^^^^^^^^^^^ support.function.timing.css */ -/* ^^^^ constant.numeric.css */ +/* ^^^^^^^^^^^^ support.function.timing.css */ +/* ^^^^ constant.numeric.float.decimal.css */ top: steps(020, start); -/* ^^^^^ support.function.timing.css */ -/* ^^^ constant.numeric.css */ +/* ^^^^^ support.function.timing.css */ +/* ^^^ constant.numeric.integer.decimal.css */ /* ^^^^^ support.keyword.timing-direction.css */ top: steps(1, end); @@ -713,97 +788,97 @@ .test-shape-functions { top: circle(at top 5.5e20em); -/* ^^^^^^ support.function.shape.css */ -/* ^^ keyword.other.css */ -/* ^^^ support.constant.property-value.css */ -/* ^^^^^^^^ constant.numeric.css */ +/* ^^^^^^ support.function.shape.css */ +/* ^^ keyword.other.css */ +/* ^^^ support.constant.property-value.css */ +/* ^^^^^^^^ constant.numeric.float.decimal.css */ top: ellipse(at 0%); -/* ^^^^^^^ support.function.shape.css */ -/* ^^ keyword.other.css */ -/* ^^ constant.numeric.css */ +/* ^^^^^^^ support.function.shape.css */ +/* ^^ keyword.other.css */ +/* ^^ constant.numeric.integer.decimal.css */ top: ellipse(closest-side); /* ^^^^^^^^^^^^ support.constant.property-value.css */ top: inset(1.1px round 50%); -/* ^^^^^ support.function.shape.css */ -/* ^^^^^ constant.numeric.css */ -/* ^^^^^ keyword.other.css */ +/* ^^^^^ support.function.shape.css */ +/* ^^^^^ constant.numeric.float.decimal.css */ +/* ^^^^^ keyword.other.css */ top: rect(auto); -/* ^^^^ support.function.shape.css */ +/* ^^^^ support.function.shape.css */ /* ^^^^ support.constant.property-value.css */ top: rect(1px); -/* ^^^ constant.numeric.css */ +/* ^^^ constant.numeric.integer.decimal.css */ } .test-calc-function { top: calc(1.1px + 2rad); -/* ^^^^ support.function.calc.css */ -/* ^^^^^ constant.numeric.css */ -/* ^^^^ constant.numeric.css */ +/* ^^^^ support.function.calc.css */ +/* ^^^^^ constant.numeric.float.decimal.css */ +/* ^^^^ constant.numeric.integer.decimal.css */ top: calc(attr(start, 1) - 1); /* ^^^^ support.function.attr.css */ top: calc(calc() * calc()); -/* ^^^^ support.function.calc.css */ -/* ^^^^ support.function.calc.css */ -/* ^ keyword.operator.css */ -/* ^^^^ support.function.calc.css */ +/* ^^^^ support.function.calc.css */ +/* ^^^^ support.function.calc.css */ +/* ^ keyword.operator.css */ +/* ^^^^ support.function.calc.css */ top: calc(100% - (1 * 10px) / 1 - (1 * 10px) / 1 - (1 * 10px) / 1); /* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.css */ /* ^^^^ support.function.calc.css */ /* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.group.css */ /* ^ punctuation.definition.group.begin.css */ -/* ^^^ constant.numeric.css */ +/* ^^^ constant.numeric.integer.decimal.css */ /* ^ keyword.operator.css */ /* ^ punctuation.definition.group.begin.css */ /* ^^^^^^^^^^ meta.group.css meta.group.css */ /* ^ punctuation.definition.group.end.css */ /* ^ keyword.operator.css */ /* ^ punctuation.definition.group.begin.css */ -/* ^^ constant.numeric.css */ +/* ^^ constant.numeric.integer.decimal.css */ /* ^^ keyword.other.unit.css */ /* ^ punctuation.definition.group.end.css */ /* ^ keyword.operator.css */ /* ^ keyword.operator.css */ /* ^ punctuation.definition.group.begin.css */ -/* ^ constant.numeric.css */ +/* ^ constant.numeric.integer.decimal.css */ /* ^ keyword.operator.css */ -/* ^^ constant.numeric.css */ +/* ^^ constant.numeric.integer.decimal.css */ /* ^ punctuation.definition.group.end.css */ /* ^ keyword.operator.css */ -/* ^ constant.numeric.css */ +/* ^ constant.numeric.integer.decimal.css */ /* ^ punctuation.definition.group.end.css */ /* ^ punctuation.terminator.rule.css - meta.group */ } .test-toggle-function { top: toggle(5px red preserve-3d); -/* ^^^^^^ support.function.toggle.css */ -/* ^^^ constant.numeric.css */ -/* ^^^ support.constant.color.w3c-standard-color-name.css */ -/* ^^^^^^^^^^^ support.constant.property-value.css */ +/* ^^^^^^ support.function.toggle.css */ +/* ^^^ constant.numeric.integer.decimal.css */ +/* ^^^ support.constant.color.w3c-standard-color-name.css */ +/* ^^^^^^^^^^^ support.constant.property-value.css */ } .test-attr-function { top: attr(*|c); -/* ^^^^ support.function.attr.css */ -/* ^ entity.name.namespace.wildcard.css */ -/* ^ punctuation.separator.namespace.css */ -/* ^ entity.other.attribute-name.css */ +/* ^^^^ support.function.attr.css */ +/* ^ entity.name.namespace.wildcard.css */ +/* ^ punctuation.separator.namespace.css */ +/* ^ entity.other.attribute-name.css */ top: attr(n|size); -/* ^ entity.other.namespace-prefix.css */ -/* ^^^^ entity.other.attribute-name.css */ +/* ^ entity.other.namespace-prefix.css */ +/* ^^^^ entity.other.attribute-name.css */ top: attr(size px, auto); -/* ^^^^ entity.other.attribute-name.css */ -/* ^^ keyword.other.unit.css */ -/* ^ punctuation.separator.css */ +/* ^^^^ entity.other.attribute-name.css */ +/* ^^ keyword.other.unit.css */ +/* ^ punctuation.separator.sequence.css */ /* ^^^^ support.constant.property-value.css */ top: attr(preserve-3d); @@ -812,7 +887,7 @@ .test-url-function { top: url("a"); -/* ^^^ support.function.url.css */ +/* ^^^ support.function.url.css */ /* ^^^ string.quoted.double.css */ top: url(a); @@ -821,30 +896,30 @@ .test-image-functions { top: image("a"); -/* ^^^^^ support.function.image.css */ -/* ^^^ string.quoted.double.css */ +/* ^^^^^ support.function.image.css */ +/* ^^^ string.quoted.double.css */ top: image(a); /* ^ string.unquoted.css */ top: image("a", rgb(0, 0, 0)); -/* ^ punctuation.separator.css */ -/* ^ constant.numeric.css */ +/* ^ punctuation.separator.sequence.css */ +/* ^ constant.numeric.integer.decimal.css */ top: image-set("a" 1x, a 4dpi); -/* ^^^ string.quoted.double.css */ -/* ^^ constant.numeric.css */ -/* ^ keyword.other.unit.css */ -/* ^ punctuation.separator.css */ -/* ^ string.unquoted.css */ -/* ^^^^ constant.numeric.css */ +/* ^^^ string.quoted.double.css */ +/* ^^ constant.numeric.integer.decimal.css */ +/* ^ keyword.other.unit.css */ +/* ^ punctuation.separator.sequence.css */ +/* ^ string.unquoted.css */ +/* ^^^^ constant.numeric.integer.decimal.css */ top: cross-fade(50% "a", b); -/* ^^^^^^^^^^ support.function.image.css */ -/* ^^^ constant.numeric.css */ -/* ^^^ string.quoted.double.css */ -/* ^ punctuation.separator.css */ -/* ^ string.unquoted.css */ +/* ^^^^^^^^^^ support.function.image.css */ +/* ^^^ constant.numeric.integer.decimal.css */ +/* ^^^ string.quoted.double.css */ +/* ^ punctuation.separator.sequence.css */ +/* ^ string.unquoted.css */ } .test-gradient-functions { @@ -852,18 +927,18 @@ /* ^^^^^^^^^^^^^^^ support.function.gradient.css */ top: linear-gradient(45deg, white); -/* ^^^^^ constant.numeric.css */ -/* ^ punctuation.separator.css */ +/* ^^^^^ constant.numeric.integer.decimal.css */ +/* ^ punctuation.separator.sequence.css */ /* ^^^^^ support.constant.color.w3c-standard-color-name.css */ top: linear-gradient(to top left); -/* ^^ keyword.other.css */ -/* ^^^ support.constant.property-value.css */ +/* ^^ keyword.other.css */ +/* ^^^ support.constant.property-value.css */ /* ^^^^ support.constant.property-value.css */ top: linear-gradient(0%, 100%); -/* ^^ constant.numeric.css */ -/* ^^^^ constant.numeric.css */ +/* ^^ constant.numeric.integer.decimal.css */ +/* ^^^^ constant.numeric.integer.decimal.css */ top: repeating-linear-gradient(); /* ^^^^^^^^^^^^^^^^^^^^^^^^^ support.function.gradient.css */ @@ -872,14 +947,14 @@ /* ^^^^^^^^^^^^^^^ support.function.gradient.css */ top: radial-gradient(circle at top left); -/* ^^^^^^ keyword.other.css */ -/* ^^ keyword.other.css */ -/* ^^^ support.constant.property-value.css */ +/* ^^^^^^ keyword.other.css */ +/* ^^ keyword.other.css */ +/* ^^^ support.constant.property-value.css */ /* ^^^^ support.constant.property-value.css */ top: radial-gradient(red, blue); -/* ^^^ support.constant.color.w3c-standard-color-name.css */ -/* ^ punctuation.separator.css */ +/* ^^^ support.constant.color.w3c-standard-color-name.css */ +/* ^ punctuation.separator.sequence.css */ top: repeating-radial-gradient(); /* ^^^^^^^^^^^^^^^^^^^^^^^^^ support.function.gradient.css */ @@ -887,46 +962,46 @@ .test-counter-functions { top: counter(name, decimal-leading-zero); -/* ^^^^^^^ support.function.counter.css */ -/* ^^^^ entity.other.counter-name.css string.unquoted.css */ -/* ^ punctuation.separator.css */ +/* ^^^^^^^ support.function.counter.css */ +/* ^^^^ entity.other.counter-name.css string.unquoted.css */ +/* ^ punctuation.separator.sequence.css */ /* ^^^^^^^^^^^^^^^^^^^^ support.constant.property-value.counter-style.css */ top: counters(name, "str", none); -/* ^^^^^^^^ support.function.counter.css */ -/* ^^^^ entity.other.counter-name.css string.unquoted.css */ -/* ^ punctuation.separator.css */ -/* ^^^^^ string.quoted.double.css */ -/* ^ punctuation.separator.css */ +/* ^^^^^^^^ support.function.counter.css */ +/* ^^^^ entity.other.counter-name.css string.unquoted.css */ +/* ^ punctuation.separator.sequence.css */ +/* ^^^^^ string.quoted.double.css */ +/* ^ punctuation.separator.sequence.css */ /* ^^^^ support.constant.property-value.counter-style.css */ top: symbols(fixed "\2020" url()); -/* ^^^^^^^ support.function.counter.css */ -/* ^^^^^ support.constant.symbol-type.css */ -/* ^^^^^^^ string.quoted.double.css */ -/* ^^^ support.function.url.css */ +/* ^^^^^^^ support.function.counter.css */ +/* ^^^^^ support.constant.symbol-type.css */ +/* ^^^^^^^ string.quoted.double.css */ +/* ^^^ support.function.url.css */ } .test-grid-functions { grid: repeat(20) / auto-flow 1fr; -/* ^^^^^^ support.function.grid.css */ -/* ^^ constant.numeric.css */ +/* ^^^^^^ support.function.grid.css */ +/* ^^ constant.numeric.integer.decimal.css */ /* ^^^^^^^^^ support.constant.property-value.css */ top: repeat(auto-fit, 2fr minmax(auto) 5%); -/* ^^^^^^^^ support.keyword.repetitions.css */ -/* ^ punctuation.separator.css */ -/* ^^^ constant.numeric.css */ -/* ^^^^^^ support.function.grid.css */ -/* ^^^^ support.constant.property-value.css */ -/* ^^ constant.numeric.css */ +/* ^^^^^^^^ support.keyword.repetitions.css */ +/* ^ punctuation.separator.sequence.css */ +/* ^^^ constant.numeric.integer.decimal.css */ +/* ^^^^^^ support.function.grid.css */ +/* ^^^^ support.constant.property-value.css */ +/* ^^ constant.numeric.integer.decimal.css */ top: minmax(min-content, 1fr, 10%); -/* ^^^^^^ support.function.grid.css */ -/* ^^^^^^^^^^^ support.constant.property-value.css */ -/* ^ punctuation.separator.css */ -/* ^^^ constant.numeric.css */ -/* ^^^ constant.numeric.css */ +/* ^^^^^^ support.function.grid.css */ +/* ^^^^^^^^^^^ support.constant.property-value.css */ +/* ^ punctuation.separator.sequence.css */ +/* ^^^ constant.numeric.integer.decimal.css */ +/* ^^^ constant.numeric.integer.decimal.css */ grid-template: repeat(2, var(--size)) / repeat(2, 50%); /* ^^^ support.function.var.css */ /* ^^^^^^ support.type.custom-property.css */ @@ -935,54 +1010,66 @@ grid-template-columns: [a-line-name] auto /* ^ punctuation.section.begin.css */ -/* ^^^^^^^^^^^ string.unquoted.line-name.css */ +/* ^^^^^^^^^^^ string.unquoted.line-name.css */ /* ^ punctuation.section.end.css */ [b] minmax(min-content, 1fr) [b c d] repeat(2, [e] 40px) -/* ^ punctuation.section.begin.css */ -/* ^ string.unquoted.line-name.css */ -/* ^ - string.unquoted.line-name.css */ -/* ^ string.unquoted.line-name.css */ -/* ^ punctuation.section.end.css */ -/* ^ punctuation.section.begin.css */ -/* ^ string.unquoted.line-name.css */ +/* ^ punctuation.section.begin.css */ +/* ^ string.unquoted.line-name.css */ +/* ^ - string.unquoted.line-name.css */ +/* ^ string.unquoted.line-name.css */ +/* ^ punctuation.section.end.css */ +/* ^ punctuation.section.begin.css */ +/* ^ string.unquoted.line-name.css */ /* ^ punctuation.section.end.css */ repeat(5, auto); } .test-filter-functions { top: filter(url(), blur()); -/* ^^^^^^ support.function.filter.css */ -/* ^^^ support.function.url.css */ +/* ^^^^^^ support.function.filter.css */ +/* ^^^ support.function.url.css */ /* ^^^^ support.function.filter.css */ top: blur(1px); -/* ^^^^ support.function.filter.css */ +/* ^^^^ support.function.filter.css */ top: sepia(1% 1); -/* ^^^^^ support.function.filter.css */ -/* ^^ constant.numeric.css */ -/* ^ constant.numeric.css */ +/* ^^^^^ support.function.filter.css */ +/* ^^ constant.numeric.integer.decimal.css */ +/* ^ constant.numeric.integer.decimal.css */ top: drop-shadow(1px rgb()); -/* ^^^^^^^^^^^ support.function.filter.css */ -/* ^^^ constant.numeric.css */ -/* ^^^ support.function.color.css */ +/* ^^^^^^^^^^^ support.function.filter.css */ +/* ^^^ constant.numeric.integer.decimal.css */ +/* ^^^ support.function.color.css */ top: hue-rotate(1turn); -/* ^^^^^^^^^^ support.function.filter.css */ -/* ^^^^^ constant.numeric.css */ +/* ^^^^^^^^^^ support.function.filter.css */ +/* ^^^^^ constant.numeric.integer.decimal.css */ } /* Test Font Functions: format() & local() */ @font-face { src: format("embedded-opentype"); -/* ^^^^^^ support.function.font-face.css */ -/* ^^^^^^^^^^^^^^^^^^^ string.quoted.double.css */ +/* ^^^^^^ support.function.font-face.css */ +/* ^^^^^^^^^^^^^^^^^^^ string.quoted.double.css */ src: local(Gentium-Bold); -/* ^^^^^ support.function.font-face.css */ -/* ^^^^^^^^^^^^ string.unquoted.css */ +/* ^^^^^ support.function.font-face.css */ +/* ^^^^^^^^^^^^ string.unquoted.css */ + + src: local('Gentium-Bold'); +/* ^^^^^ support.function.font-face.css */ +/* ^^^^^^^^^^^^^^ string.quoted.single.css */ +/* ^ punctuation.definition.string.begin.css */ +/* ^ punctuation.definition.string.end.css */ + + src: local("Gentium-Bold"); +/* ^^^^^ support.function.font-face.css */ +/* ^^^^^^^^^^^^^^ string.quoted.double.css */ +/* ^ punctuation.definition.string.begin.css */ +/* ^ punctuation.definition.string.end.css */ } @font-face { @@ -993,9 +1080,9 @@ .test-var-function { top: var(--name); -/* ^^^ support.function.var.css */ -/* ^^ punctuation.definition.custom-property.css */ -/* ^^^^ support.type.custom-property.name.css */ +/* ^^^ support.function.var.css */ +/* ^^ punctuation.definition.custom-property.css */ +/* ^^^^ support.type.custom-property.name.css */ } .test-custom-tags > div > span + cust·m-tÀg > div-cøstom-tag ~ form-Çust😀m-tag.classname:last-child:hover {} @@ -1066,7 +1153,7 @@ a { height:calc(10px/*); font-family:"a*/); -/* ^^^^^^^^^^^^^^^ comment.block.css */ +/* ^^^^^^^^^^^^^^^ comment.block.css */ /* ^ punctuation.definition.group.end.css */ } diff --git a/Clojure/Clojure.sublime-syntax b/Clojure/Clojure.sublime-syntax index e2f643c7e9..5da06ef144 100644 --- a/Clojure/Clojure.sublime-syntax +++ b/Clojure/Clojure.sublime-syntax @@ -25,13 +25,12 @@ variables: # Similar to the number regexps in the Clojure reader. # This doesn't include evil octals and dot-terminated decimals. sign: '[-+]?' - integer: '({{sign}})\d+(N?)(?=[{{non_number_chars}}])' - hex_integer: '({{sign}})(0[Xx])[0-9A-Fa-f]+(N?)(?=[{{non_number_chars}}])' - n_radix_integer: '({{sign}})((?:[2-9]|[1-9]\d+)[Rr])[0-9A-Za-z]+(?=[{{non_number_chars}}])' - ratio: '({{sign}})\d+(/)\d+(?=[{{non_number_chars}}])' - # Why are we calling the dot notation "decimal"? - # It could be used with any radix... - decimal: '({{sign}})\d+(?:(\.)\d+)?(?:[Ee][-+]?\d+)?(M?)(?=[{{non_number_chars}}])' + exponent: (?:[eE]{{sign}}\d+) + dec_integer: ({{sign}})\d+(N?)(?=[{{non_number_chars}}]) + hex_integer: ({{sign}})(0[Xx])\h+(N?)(?=[{{non_number_chars}}]) + other_integer: ({{sign}})((?:[2-9]|[1-9]\d+)[Rr])[0-9A-Za-z]+(?=[{{non_number_chars}}]) + rational: ({{sign}})\d+(/)\d+(?=[{{non_number_chars}}]) + float: ({{sign}})\d+(?:(?:(\.)\d+{{exponent}}?|{{exponent}})(M)?|(M))(?=[{{non_number_chars}}]) contexts: main: @@ -77,33 +76,34 @@ contexts: 1: punctuation.definition.keyword.clojure - match: '{{evil_octal}}' scope: invalid.deprecated.clojure - - match: '{{integer}}' - scope: constant.numeric.integer.clojure + - match: '{{dec_integer}}' + scope: constant.numeric.integer.decimal.clojure captures: 1: punctuation.definition.numeric.sign.clojure - 2: storage.type.numeric.bigint.clojure + 2: storage.type.numeric.clojure - match: '{{hex_integer}}' scope: constant.numeric.integer.hexadecimal.clojure captures: 1: punctuation.definition.numeric.sign.clojure - 2: punctuation.definition.numeric.hexadecimal.clojure - 3: storage.type.numeric.bigint.clojure - - match: '{{n_radix_integer}}' - scope: constant.numeric.integer.clojure + 2: punctuation.definition.numeric.base.clojure + 3: storage.type.numeric.clojure + - match: '{{other_integer}}' + scope: constant.numeric.integer.other.clojure captures: 1: punctuation.definition.numeric.sign.clojure - 2: punctuation.definition.numeric.radix.clojure - - match: '{{ratio}}' - scope: constant.numeric.ratio.clojure + 2: punctuation.definition.numeric.base.clojure + - match: '{{rational}}' + scope: constant.numeric.rational.decimal.clojure captures: 1: punctuation.definition.numeric.sign.clojure - 2: punctuation.separator.ratio.clojure - - match: '{{decimal}}' - scope: constant.numeric.float.clojure + 2: punctuation.separator.rational.clojure + - match: '{{float}}' + scope: constant.numeric.float.decimal.clojure captures: 1: punctuation.definition.numeric.sign.clojure 2: punctuation.separator.decimal.clojure - 3: storage.type.numeric.bigdec.clojure + 3: storage.type.numeric.clojure + 4: storage.type.numeric.clojure - match: '{{atom}}' pop-expr: @@ -151,37 +151,38 @@ contexts: - match: '{{evil_octal}}' scope: invalid.deprecated.clojure pop: true - - match: '{{integer}}' - scope: constant.numeric.integer.clojure + - match: '{{dec_integer}}' + scope: constant.numeric.integer.decimal.clojure captures: 1: punctuation.definition.numeric.sign.clojure - 2: storage.type.numeric.bigint.clojure + 2: storage.type.numeric.clojure pop: true - match: '{{hex_integer}}' scope: constant.numeric.integer.hexadecimal.clojure captures: 1: punctuation.definition.numeric.sign.clojure - 2: punctuation.definition.numeric.hexadecimal.clojure - 3: storage.type.numeric.bigint.clojure + 2: punctuation.definition.numeric.base.clojure + 3: storage.type.numeric.clojure pop: true - - match: '{{n_radix_integer}}' - scope: constant.numeric.integer.clojure + - match: '{{other_integer}}' + scope: constant.numeric.integer.other.clojure captures: 1: punctuation.definition.numeric.sign.clojure - 2: punctuation.definition.numeric.radix.clojure + 2: punctuation.definition.numeric.base.clojure pop: true - - match: '{{ratio}}' - scope: constant.numeric.ratio.clojure + - match: '{{rational}}' + scope: constant.numeric.rational.decimal.clojure captures: 1: punctuation.definition.numeric.sign.clojure - 2: punctuation.separator.ratio.clojure + 2: punctuation.separator.rational.clojure pop: true - - match: '{{decimal}}' - scope: constant.numeric.float.clojure + - match: '{{float}}' + scope: constant.numeric.float.decimal.clojure captures: 1: punctuation.definition.numeric.sign.clojure 2: punctuation.separator.decimal.clojure - 3: storage.type.numeric.bigdec.clojure + 3: storage.type.numeric.clojure + 4: storage.type.numeric.clojure pop: true - match: '{{atom}}' pop: true diff --git a/Clojure/tests/syntax_test_clojure.clj b/Clojure/tests/syntax_test_clojure.clj index b65a400525..e5bd7491f5 100644 --- a/Clojure/tests/syntax_test_clojure.clj +++ b/Clojure/tests/syntax_test_clojure.clj @@ -43,9 +43,9 @@ true false nil ; ^^^^ constant.language.clojure -; ^- constant +; ^ - constant ; ^^^^^ constant.language.clojure -; ^- constant +; ^ - constant ; ^^^ constant.language.clojure ; ## Breaks @@ -70,318 +70,318 @@ ; ## No highlighting nill nil- -nil nil? -; ^^^^^^^^^^^^^^^^^^^- constant +; ^^^^^^^^^^^^^^^^^^^ - constant ; # Numbers 1234 1234N +1234 +1234N -1234 -1234N -; ^^^^ constant.numeric.integer.clojure -; ^- constant -; ^^^^^ constant.numeric.integer.clojure -; ^ storage.type.numeric.bigint.clojure -; ^- constant +; ^^^^ constant.numeric.integer.decimal.clojure +; ^ - constant +; ^^^^^ constant.numeric.integer.decimal.clojure +; ^ storage.type.numeric.clojure +; ^ - constant ; ^ punctuation.definition.numeric.sign.clojure -; ^^^^^ constant.numeric.integer.clojure -; ^- constant +; ^^^^^ constant.numeric.integer.decimal.clojure +; ^ - constant ; ^ punctuation.definition.numeric.sign.clojure -; ^^^^^^ constant.numeric.integer.clojure -; ^ storage.type.numeric.bigint.clojure -; ^- constant +; ^^^^^^ constant.numeric.integer.decimal.clojure +; ^ storage.type.numeric.clojure +; ^ - constant ; ^ punctuation.definition.numeric.sign.clojure -; ^^^^^ constant.numeric.integer.clojure -; ^- constant +; ^^^^^ constant.numeric.integer.decimal.clojure +; ^ - constant ; ^ punctuation.definition.numeric.sign.clojure -; ^^^^^^ constant.numeric.integer.clojure -; ^ storage.type.numeric.bigint.clojure +; ^^^^^^ constant.numeric.integer.decimal.clojure +; ^ storage.type.numeric.clojure 0x1234af 0x1234afN 0X1234AF 0X1234AFN -; ^^ punctuation.definition.numeric.hexadecimal.clojure +; ^^ punctuation.definition.numeric.base.clojure ; ^^^^^^^^ constant.numeric.integer.hexadecimal.clojure -; ^- constant -; ^^ punctuation.definition.numeric.hexadecimal.clojure +; ^ - constant +; ^^ punctuation.definition.numeric.base.clojure ; ^^^^^^^^^ constant.numeric.integer.hexadecimal.clojure -; ^ storage.type.numeric.bigint.clojure -; ^- constant -; ^^ punctuation.definition.numeric.hexadecimal.clojure +; ^ storage.type.numeric.clojure +; ^ - constant +; ^^ punctuation.definition.numeric.base.clojure ; ^^^^^^^^ constant.numeric.integer.hexadecimal.clojure -; ^- constant -; ^^ punctuation.definition.numeric.hexadecimal.clojure +; ^ - constant +; ^^ punctuation.definition.numeric.base.clojure ; ^^^^^^^^^ constant.numeric.integer.hexadecimal.clojure -; ^ storage.type.numeric.bigint.clojure +; ^ storage.type.numeric.clojure +0x1234af +0x1234afN +0X1234AF +0X1234AFN ; ^ punctuation.definition.numeric.sign.clojure -; ^^ punctuation.definition.numeric.hexadecimal.clojure +; ^^ punctuation.definition.numeric.base.clojure ; ^^^^^^^^^ constant.numeric.integer.hexadecimal.clojure -; ^- constant +; ^ - constant ; ^ punctuation.definition.numeric.sign.clojure -; ^^ punctuation.definition.numeric.hexadecimal.clojure +; ^^ punctuation.definition.numeric.base.clojure ; ^^^^^^^^^^ constant.numeric.integer.hexadecimal.clojure -; ^ storage.type.numeric.bigint.clojure -; ^- constant +; ^ storage.type.numeric.clojure +; ^ - constant ; ^ punctuation.definition.numeric.sign.clojure -; ^^ punctuation.definition.numeric.hexadecimal.clojure +; ^^ punctuation.definition.numeric.base.clojure ; ^^^^^^^^ constant.numeric.integer.hexadecimal.clojure -; ^- constant +; ^ - constant ; ^ punctuation.definition.numeric.sign.clojure -; ^^ punctuation.definition.numeric.hexadecimal.clojure +; ^^ punctuation.definition.numeric.base.clojure ; ^^^^^^^^^^ constant.numeric.integer.hexadecimal.clojure -; ^ storage.type.numeric.bigint.clojure +; ^ storage.type.numeric.clojure -0x1234af -0x1234afN -0X1234AF -0X1234AFN ; ^ punctuation.definition.numeric.sign.clojure -; ^^ punctuation.definition.numeric.hexadecimal.clojure +; ^^ punctuation.definition.numeric.base.clojure ; ^^^^^^^^^ constant.numeric.integer.hexadecimal.clojure -; ^- constant +; ^ - constant ; ^ punctuation.definition.numeric.sign.clojure -; ^^ punctuation.definition.numeric.hexadecimal.clojure +; ^^ punctuation.definition.numeric.base.clojure ; ^^^^^^^^^^ constant.numeric.integer.hexadecimal.clojure -; ^ storage.type.numeric.bigint.clojure -; ^- constant +; ^ storage.type.numeric.clojure +; ^ - constant ; ^ punctuation.definition.numeric.sign.clojure -; ^^ punctuation.definition.numeric.hexadecimal.clojure +; ^^ punctuation.definition.numeric.base.clojure ; ^^^^^^^^^ constant.numeric.integer.hexadecimal.clojure -; ^- constant +; ^ - constant ; ^ punctuation.definition.numeric.sign.clojure -; ^^ punctuation.definition.numeric.hexadecimal.clojure +; ^^ punctuation.definition.numeric.base.clojure ; ^^^^^^^^^^ constant.numeric.integer.hexadecimal.clojure -; ^ storage.type.numeric.bigint.clojure +; ^ storage.type.numeric.clojure 2r1010 16r1234af 32r1234az 2R1010 16R1234AF 32R1234AZ -; ^^ punctuation.definition.numeric.radix.clojure -; ^^^^^^ constant.numeric.integer.clojure -; ^- constant -; ^^^ punctuation.definition.numeric.radix.clojure -; ^^^^^^^^^ constant.numeric.integer.clojure -; ^- constant -; ^^^ punctuation.definition.numeric.radix.clojure -; ^^^^^^^^^ constant.numeric.integer.clojure -; ^- constant -; ^^ punctuation.definition.numeric.radix.clojure -; ^^^^^^ constant.numeric.integer.clojure -; ^- constant -; ^^^ punctuation.definition.numeric.radix.clojure -; ^^^^^^^^^ constant.numeric.integer.clojure -; ^- constant -; ^^^ punctuation.definition.numeric.radix.clojure -; ^^^^^^^^^ constant.numeric.integer.clojure +; ^^ punctuation.definition.numeric.base.clojure +; ^^^^^^ constant.numeric.integer.other.clojure +; ^ - constant +; ^^^ punctuation.definition.numeric.base.clojure +; ^^^^^^^^^ constant.numeric.integer.other.clojure +; ^ - constant +; ^^^ punctuation.definition.numeric.base.clojure +; ^^^^^^^^^ constant.numeric.integer.other.clojure +; ^ - constant +; ^^ punctuation.definition.numeric.base.clojure +; ^^^^^^ constant.numeric.integer.other.clojure +; ^ - constant +; ^^^ punctuation.definition.numeric.base.clojure +; ^^^^^^^^^ constant.numeric.integer.other.clojure +; ^ - constant +; ^^^ punctuation.definition.numeric.base.clojure +; ^^^^^^^^^ constant.numeric.integer.other.clojure +2r1010 +16r1234af +32r1234az +2R1010 +16R1234AF +32R1234AZ ; ^ punctuation.definition.numeric.sign.clojure -; ^^ punctuation.definition.numeric.radix.clojure -; ^^^^^^^ constant.numeric.integer.clojure -; ^- constant +; ^^ punctuation.definition.numeric.base.clojure +; ^^^^^^^ constant.numeric.integer.other.clojure +; ^ - constant ; ^ punctuation.definition.numeric.sign.clojure -; ^^^ punctuation.definition.numeric.radix.clojure -; ^^^^^^^^^^ constant.numeric.integer.clojure -; ^- constant +; ^^^ punctuation.definition.numeric.base.clojure +; ^^^^^^^^^^ constant.numeric.integer.other.clojure +; ^ - constant ; ^ punctuation.definition.numeric.sign.clojure -; ^^^ punctuation.definition.numeric.radix.clojure -; ^^^^^^^^^^ constant.numeric.integer.clojure -; ^- constant +; ^^^ punctuation.definition.numeric.base.clojure +; ^^^^^^^^^^ constant.numeric.integer.other.clojure +; ^ - constant ; ^ punctuation.definition.numeric.sign.clojure -; ^^ punctuation.definition.numeric.radix.clojure -; ^^^^^^^ constant.numeric.integer.clojure -; ^- constant +; ^^ punctuation.definition.numeric.base.clojure +; ^^^^^^^ constant.numeric.integer.other.clojure +; ^ - constant ; ^ punctuation.definition.numeric.sign.clojure -; ^^^ punctuation.definition.numeric.radix.clojure -; ^^^^^^^^^ constant.numeric.integer.clojure -; ^- constant +; ^^^ punctuation.definition.numeric.base.clojure +; ^^^^^^^^^ constant.numeric.integer.other.clojure +; ^ - constant ; ^ punctuation.definition.numeric.sign.clojure -; ^^^ punctuation.definition.numeric.radix.clojure -; ^^^^^^^^^^ constant.numeric.integer.clojure +; ^^^ punctuation.definition.numeric.base.clojure +; ^^^^^^^^^^ constant.numeric.integer.other.clojure -2r1010 -16r1234af -32r1234az -2R1010 -16R1234AF -32R1234AZ ; ^ punctuation.definition.numeric.sign.clojure -; ^^ punctuation.definition.numeric.radix.clojure -; ^^^^^^^ constant.numeric.integer.clojure -; ^- constant +; ^^ punctuation.definition.numeric.base.clojure +; ^^^^^^^ constant.numeric.integer.other.clojure +; ^ - constant ; ^ punctuation.definition.numeric.sign.clojure -; ^^^ punctuation.definition.numeric.radix.clojure -; ^^^^^^^^^ constant.numeric.integer.clojure -; ^- constant +; ^^^ punctuation.definition.numeric.base.clojure +; ^^^^^^^^^ constant.numeric.integer.other.clojure +; ^ - constant ; ^ punctuation.definition.numeric.sign.clojure -; ^^^ punctuation.definition.numeric.radix.clojure -; ^^^^^^^^^^ constant.numeric.integer.clojure -; ^- constant +; ^^^ punctuation.definition.numeric.base.clojure +; ^^^^^^^^^^ constant.numeric.integer.other.clojure +; ^ - constant ; ^ punctuation.definition.numeric.sign.clojure -; ^^ punctuation.definition.numeric.radix.clojure -; ^^^^^^^ constant.numeric.integer.clojure -; ^- constant +; ^^ punctuation.definition.numeric.base.clojure +; ^^^^^^^ constant.numeric.integer.other.clojure +; ^ - constant ; ^ punctuation.definition.numeric.sign.clojure -; ^^^ punctuation.definition.numeric.radix.clojure -; ^^^^^^^^^^ constant.numeric.integer.clojure -; ^- constant +; ^^^ punctuation.definition.numeric.base.clojure +; ^^^^^^^^^^ constant.numeric.integer.other.clojure +; ^ - constant ; ^ punctuation.definition.numeric.sign.clojure -; ^^^ punctuation.definition.numeric.radix.clojure -; ^^^^^^^^^^ constant.numeric.integer.clojure +; ^^^ punctuation.definition.numeric.base.clojure +; ^^^^^^^^^^ constant.numeric.integer.other.clojure 0/10 10/20 30/0 -; ^^^^ constant.numeric.ratio.clojure -; ^ punctuation.separator.ratio.clojure -; ^- constant -; ^^^^^ constant.numeric.ratio.clojure -; ^ punctuation.separator.ratio.clojure -; ^- constant -; ^^^^ constant.numeric.ratio.clojure -; ^ punctuation.separator.ratio.clojure +; ^^^^ constant.numeric.rational.decimal.clojure +; ^ punctuation.separator.rational.clojure +; ^ - constant +; ^^^^^ constant.numeric.rational.decimal.clojure +; ^ punctuation.separator.rational.clojure +; ^ - constant +; ^^^^ constant.numeric.rational.decimal.clojure +; ^ punctuation.separator.rational.clojure +0/10 +10/20 +30/0 -; ^^^^^ constant.numeric.ratio.clojure +; ^^^^^ constant.numeric.rational.decimal.clojure ; ^ punctuation.definition.numeric.sign.clojure -; ^ punctuation.separator.ratio.clojure -; ^- constant -; ^^^^^^ constant.numeric.ratio.clojure +; ^ punctuation.separator.rational.clojure +; ^ - constant +; ^^^^^^ constant.numeric.rational.decimal.clojure ; ^ punctuation.definition.numeric.sign.clojure -; ^ punctuation.separator.ratio.clojure -; ^- constant -; ^^^^^ constant.numeric.ratio.clojure +; ^ punctuation.separator.rational.clojure +; ^ - constant +; ^^^^^ constant.numeric.rational.decimal.clojure ; ^ punctuation.definition.numeric.sign.clojure -; ^ punctuation.separator.ratio.clojure +; ^ punctuation.separator.rational.clojure -0/10 -10/20 -30/0 -; ^^^^^ constant.numeric.ratio.clojure +; ^^^^^ constant.numeric.rational.decimal.clojure ; ^ punctuation.definition.numeric.sign.clojure -; ^ punctuation.separator.ratio.clojure -; ^- constant -; ^^^^^^ constant.numeric.ratio.clojure +; ^ punctuation.separator.rational.clojure +; ^ - constant +; ^^^^^^ constant.numeric.rational.decimal.clojure ; ^ punctuation.definition.numeric.sign.clojure -; ^ punctuation.separator.ratio.clojure -; ^- constant -; ^^^^^ constant.numeric.ratio.clojure +; ^ punctuation.separator.rational.clojure +; ^ - constant +; ^^^^^ constant.numeric.rational.decimal.clojure ; ^ punctuation.definition.numeric.sign.clojure -; ^ punctuation.separator.ratio.clojure +; ^ punctuation.separator.rational.clojure 1234M 1234.0M 1234.1234M -; ^^^^^ constant.numeric.float.clojure -; ^ storage.type.numeric.bigdec.clojure -; ^- constant -; ^^^^^^^ constant.numeric.float.clojure +; ^^^^^ constant.numeric.float.decimal.clojure +; ^ storage.type.numeric.clojure +; ^ - constant +; ^^^^^^^ constant.numeric.float.decimal.clojure ; ^ punctuation.separator.decimal.clojure -; ^ storage.type.numeric.bigdec.clojure -; ^- constant -; ^^^^^^^^^^ constant.numeric.float.clojure +; ^ storage.type.numeric.clojure +; ^ - constant +; ^^^^^^^^^^ constant.numeric.float.decimal.clojure ; ^ punctuation.separator.decimal.clojure -; ^ storage.type.numeric.bigdec.clojure +; ^ storage.type.numeric.clojure +1234M +1234.0M +1234.1234M -; ^^^^^^ constant.numeric.float.clojure +; ^^^^^^ constant.numeric.float.decimal.clojure ; ^ punctuation.definition.numeric.sign.clojure -; ^ storage.type.numeric.bigdec.clojure -; ^- constant -; ^^^^^^^^ constant.numeric.float.clojure +; ^ storage.type.numeric.clojure +; ^ - constant +; ^^^^^^^^ constant.numeric.float.decimal.clojure ; ^ punctuation.definition.numeric.sign.clojure ; ^ punctuation.separator.decimal.clojure -; ^ storage.type.numeric.bigdec.clojure -; ^- constant -; ^^^^^^^^^^^ constant.numeric.float.clojure +; ^ storage.type.numeric.clojure +; ^ - constant +; ^^^^^^^^^^^ constant.numeric.float.decimal.clojure ; ^ punctuation.definition.numeric.sign.clojure ; ^ punctuation.separator.decimal.clojure -; ^ storage.type.numeric.bigdec.clojure +; ^ storage.type.numeric.clojure -1234M -1234.0M -1234.1234M -; ^^^^^^ constant.numeric.float.clojure +; ^^^^^^ constant.numeric.float.decimal.clojure ; ^ punctuation.definition.numeric.sign.clojure -; ^ storage.type.numeric.bigdec.clojure -; ^- constant -; ^^^^^^^^ constant.numeric.float.clojure +; ^ storage.type.numeric.clojure +; ^ - constant +; ^^^^^^^^ constant.numeric.float.decimal.clojure ; ^ punctuation.definition.numeric.sign.clojure ; ^ punctuation.separator.decimal.clojure -; ^ storage.type.numeric.bigdec.clojure -; ^- constant -; ^^^^^^^^^^^ constant.numeric.float.clojure +; ^ storage.type.numeric.clojure +; ^ - constant +; ^^^^^^^^^^^ constant.numeric.float.decimal.clojure ; ^ punctuation.definition.numeric.sign.clojure ; ^ punctuation.separator.decimal.clojure -; ^ storage.type.numeric.bigdec.clojure +; ^ storage.type.numeric.clojure 1234e10 1234E10M 1234.1234e10M 1234.1234E10M -; ^^^^^^^ constant.numeric.float.clojure -; ^- constant -; ^^^^^^^ constant.numeric.float.clojure -; ^ storage.type.numeric.bigdec.clojure -; ^- constant -; ^^^^^^^^^^^^^ constant.numeric.float.clojure +; ^^^^^^^ constant.numeric.float.decimal.clojure +; ^ - constant +; ^^^^^^^ constant.numeric.float.decimal.clojure +; ^ storage.type.numeric.clojure +; ^ - constant +; ^^^^^^^^^^^^^ constant.numeric.float.decimal.clojure ; ^ punctuation.separator.decimal.clojure -; ^ storage.type.numeric.bigdec.clojure -; ^- constant -; ^^^^^^^^^^^^^ constant.numeric.float.clojure +; ^ storage.type.numeric.clojure +; ^ - constant +; ^^^^^^^^^^^^^ constant.numeric.float.decimal.clojure ; ^ punctuation.separator.decimal.clojure -; ^ storage.type.numeric.bigdec.clojure +; ^ storage.type.numeric.clojure +1234e10 +1234E10M +1234.1234e10M +1234.1234E10M -; ^^^^^^^^ constant.numeric.float.clojure +; ^^^^^^^^ constant.numeric.float.decimal.clojure ; ^ punctuation.definition.numeric.sign.clojure -; ^- constant -; ^^^^^^^^^ constant.numeric.float.clojure +; ^ - constant +; ^^^^^^^^^ constant.numeric.float.decimal.clojure ; ^ punctuation.definition.numeric.sign.clojure -; ^ storage.type.numeric.bigdec.clojure -; ^- constant -; ^^^^^^^^^^^^^^ constant.numeric.float.clojure +; ^ storage.type.numeric.clojure +; ^ - constant +; ^^^^^^^^^^^^^^ constant.numeric.float.decimal.clojure ; ^ punctuation.definition.numeric.sign.clojure ; ^ punctuation.separator.decimal.clojure -; ^ storage.type.numeric.bigdec.clojure -; ^- constant -; ^^^^^^^^^^^^^^ constant.numeric.float.clojure +; ^ storage.type.numeric.clojure +; ^ - constant +; ^^^^^^^^^^^^^^ constant.numeric.float.decimal.clojure ; ^ punctuation.definition.numeric.sign.clojure ; ^ punctuation.separator.decimal.clojure -; ^ storage.type.numeric.bigdec.clojure +; ^ storage.type.numeric.clojure -1234e10 -1234E10M -1234.1234e10M -1234.1234E10M -; ^^^^^^^^ constant.numeric.float.clojure +; ^^^^^^^^ constant.numeric.float.decimal.clojure ; ^ punctuation.definition.numeric.sign.clojure -; ^- constant -; ^^^^^^^^^ constant.numeric.float.clojure +; ^ - constant +; ^^^^^^^^^ constant.numeric.float.decimal.clojure ; ^ punctuation.definition.numeric.sign.clojure -; ^ storage.type.numeric.bigdec.clojure -; ^- constant -; ^^^^^^^^^^^^^^ constant.numeric.float.clojure +; ^ storage.type.numeric.clojure +; ^ - constant +; ^^^^^^^^^^^^^^ constant.numeric.float.decimal.clojure ; ^ punctuation.definition.numeric.sign.clojure ; ^ punctuation.separator.decimal.clojure -; ^ storage.type.numeric.bigdec.clojure -; ^- constant -; ^^^^^^^^^^^^^^ constant.numeric.float.clojure +; ^ storage.type.numeric.clojure +; ^ - constant +; ^^^^^^^^^^^^^^ constant.numeric.float.decimal.clojure ; ^ punctuation.definition.numeric.sign.clojure ; ^ punctuation.separator.decimal.clojure -; ^ storage.type.numeric.bigdec.clojure +; ^ storage.type.numeric.clojure 1234.1234e+10 1234.1234E+10 1234.1234e-10 1234.1234E-10 -; ^^^^^^^^^^^^^ constant.numeric.float.clojure +; ^^^^^^^^^^^^^ constant.numeric.float.decimal.clojure ; ^ punctuation.separator.decimal.clojure -; ^- constant -; ^^^^^^^^^^^^^ constant.numeric.float.clojure +; ^ - constant +; ^^^^^^^^^^^^^ constant.numeric.float.decimal.clojure ; ^ punctuation.separator.decimal.clojure -; ^- constant -; ^^^^^^^^^^^^^ constant.numeric.float.clojure +; ^ - constant +; ^^^^^^^^^^^^^ constant.numeric.float.decimal.clojure ; ^ punctuation.separator.decimal.clojure -; ^- constant -; ^^^^^^^^^^^^^ constant.numeric.float.clojure +; ^ - constant +; ^^^^^^^^^^^^^ constant.numeric.float.decimal.clojure ; ^ punctuation.separator.decimal.clojure +1234.1234e+10M +1234.1234E+10M +1234.1234e-10M +1234.1234E-10M -; ^^^^^^^^^^^^^^^ constant.numeric.float.clojure +; ^^^^^^^^^^^^^^^ constant.numeric.float.decimal.clojure ; ^ punctuation.definition.numeric.sign.clojure ; ^ punctuation.separator.decimal.clojure -; ^ storage.type.numeric.bigdec.clojure -; ^- constant -; ^^^^^^^^^^^^^^^ constant.numeric.float.clojure +; ^ storage.type.numeric.clojure +; ^ - constant +; ^^^^^^^^^^^^^^^ constant.numeric.float.decimal.clojure ; ^ punctuation.definition.numeric.sign.clojure ; ^ punctuation.separator.decimal.clojure -; ^ storage.type.numeric.bigdec.clojure -; ^- constant +; ^ storage.type.numeric.clojure +; ^ - constant ; ^ punctuation.definition.numeric.sign.clojure -; ^^^^^^^^^^^^^^^ constant.numeric.float.clojure +; ^^^^^^^^^^^^^^^ constant.numeric.float.decimal.clojure ; ^ punctuation.separator.decimal.clojure -; ^ storage.type.numeric.bigdec.clojure -; ^- constant -; ^^^^^^^^^^^^^^^ constant.numeric.float.clojure +; ^ storage.type.numeric.clojure +; ^ - constant +; ^^^^^^^^^^^^^^^ constant.numeric.float.decimal.clojure ; ^ punctuation.definition.numeric.sign.clojure ; ^ punctuation.separator.decimal.clojure -; ^ storage.type.numeric.bigdec.clojure +; ^ storage.type.numeric.clojure -1234.1234e+10M -1234.1234E+10M -1234.1234e-10M -1234.1234E-10M -; ^^^^^^^^^^^^^^^ constant.numeric.float.clojure +; ^^^^^^^^^^^^^^^ constant.numeric.float.decimal.clojure ; ^ punctuation.definition.numeric.sign.clojure ; ^ punctuation.separator.decimal.clojure -; ^ storage.type.numeric.bigdec.clojure -; ^- constant -; ^^^^^^^^^^^^^^^ constant.numeric.float.clojure +; ^ storage.type.numeric.clojure +; ^ - constant +; ^^^^^^^^^^^^^^^ constant.numeric.float.decimal.clojure ; ^ punctuation.definition.numeric.sign.clojure ; ^ punctuation.separator.decimal.clojure -; ^ storage.type.numeric.bigdec.clojure -; ^- constant -; ^^^^^^^^^^^^^^^ constant.numeric.float.clojure +; ^ storage.type.numeric.clojure +; ^ - constant +; ^^^^^^^^^^^^^^^ constant.numeric.float.decimal.clojure ; ^ punctuation.definition.numeric.sign.clojure ; ^ punctuation.separator.decimal.clojure -; ^ storage.type.numeric.bigdec.clojure -; ^- constant -; ^^^^^^^^^^^^^^^ constant.numeric.float.clojure +; ^ storage.type.numeric.clojure +; ^ - constant +; ^^^^^^^^^^^^^^^ constant.numeric.float.decimal.clojure ; ^ punctuation.definition.numeric.sign.clojure ; ^ punctuation.separator.decimal.clojure -; ^ storage.type.numeric.bigdec.clojure +; ^ storage.type.numeric.clojure ; ## Breaks @@ -473,19 +473,19 @@ ; ^^^^^^^ invalid.deprecated.clojure ; ^ keyword.operator.macro.clojure 10-20 10+20 1234n 1234m 1234. 1234.M -; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- constant +; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - constant 10.0/20 10/20.0 10/+20 10/-20 -; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- constant +; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - constant 10:20:30 -; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- constant +; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - constant 1r000 -; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- constant +; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - constant ; ## Ignore ; valid symbols .1234 .1234M -; ^^^^^^^^^^^^- constant +; ^^^^^^^^^^^^ - constant @@ -551,7 +551,7 @@ :! :$ :% :& :* :- :_ := :+ :| :< :> :. :/ :? ; ^^ constant.other.keyword.clojure -; ^- constant +; ^ - constant ; ^^ constant.other.keyword.clojure ; ^^ constant.other.keyword.clojure ; ^^ constant.other.keyword.clojure @@ -568,7 +568,7 @@ ; ^^ constant.other.keyword.clojure :++ :-- ; ^^^ constant.other.keyword.clojure -; ^- constant +; ^ - constant ; ^^^ constant.other.keyword.clojure :blah ; ^^^^^ constant.other.keyword.clojure @@ -611,7 +611,7 @@ :' :# :### :10 :10.20 ; ^^ constant.other.keyword.clojure -; ^- constant +; ^ - constant ; ^^ constant.other.keyword.clojure ; ^^^^ constant.other.keyword.clojure ; ^^^ constant.other.keyword.clojure @@ -620,10 +620,10 @@ ; ## Breaks :,blah -; ^- constant +; ^ - constant ; ^ comment.punctuation.comma.clojure :;blah -; ^- constant +; ^ - constant ; ^ comment.line.clojure punctuation.definition.comment :blah,:blah,:blah ; ^^^^^ constant.other.keyword.clojure @@ -649,9 +649,9 @@ ; ## These are invalid, but I couldn't get the regex right : -; ^^- constant +; ^^ - constant :::blah -; ^^^^^^^- constant +; ^^^^^^^ - constant :// :10/20 :blah10/20 @@ -667,16 +667,16 @@ \0 \; \, ; ^^ constant.character.clojure -; ^- constant.character.clojure +; ^ - constant.character.clojure ; ^^ constant.character.clojure -; ^- constant.character.clojure +; ^ - constant.character.clojure ; ^^ constant.character.clojure ; ^^ constant.character.clojure \newline ; ^^^^^^^^ constant.character.clojure blah \c blah \c ; ^^ constant.character.clojure -; ^- constant.character.clojure +; ^ - constant.character.clojure ; ^^ constant.character.clojure ; ## Invalid but highlight anyway @@ -733,7 +733,7 @@ ; ^ punctuation.section.parens.end.clojure ; ^ punctuation.section.parens.begin.clojure ; ^^ constant.character.clojure -; ^- constant.character.clojure +; ^ - constant.character.clojure ; ^ punctuation.section.parens.end.clojure diff --git a/D/Comments.tmPreferences b/D/Comments.tmPreferences index c59ed6a974..8d4c87de81 100644 --- a/D/Comments.tmPreferences +++ b/D/Comments.tmPreferences @@ -13,31 +13,31 @@ name TM_COMMENT_START value - /* + // name - TM_COMMENT_END + TM_COMMENT_START_2 value - */ + /* name - TM_COMMENT_MODE + TM_COMMENT_END_2 value - block + */ name - TM_COMMENT_DISABLE_INDENT + TM_COMMENT_MODE_2 value - yes + block name - TM_COMMENT_START_2 + TM_COMMENT_DISABLE_INDENT_2 value - // + yes name @@ -57,6 +57,66 @@ value block + + name + TM_COMMENT_DISABLE_INDENT_3 + value + yes + + + name + TM_COMMENT_START_4 + value + /// + + + name + TM_COMMENT_START_5 + value + /** + + + name + TM_COMMENT_END_5 + value + */ + + + name + TM_COMMENT_MODE_5 + value + block + + + name + TM_COMMENT_DISABLE_INDENT_5 + value + yes + + + name + TM_COMMENT_START_6 + value + /++ + + + name + TM_COMMENT_END_6 + value + +/ + + + name + TM_COMMENT_MODE_6 + value + block + + + name + TM_COMMENT_DISABLE_INDENT_6 + value + yes + diff --git a/D/Completion Rules.tmPreferences b/D/Completion Rules.tmPreferences new file mode 100644 index 0000000000..33f93cb542 --- /dev/null +++ b/D/Completion Rules.tmPreferences @@ -0,0 +1,12 @@ + + + + scope + source.d + settings + + cancelCompletion + ^\s*(\}?\s*(else|try|do|finally|synchonized|struct|union|unittest|debug)|(class|struct|interface|union)\s*[a-zA-Z_0-9]+*)$ + + + diff --git a/D/D dub.sublime-build b/D/D dub.sublime-build new file mode 100644 index 0000000000..f5a35db815 --- /dev/null +++ b/D/D dub.sublime-build @@ -0,0 +1,8 @@ +{ + "shell_cmd": "dub build", + "file_regex": "^(.*?)\\(([0-9]+)(,[0-9]+)?\\)", + "working_dir": "${folder:${project_path:${file_path}}}", + "selector": "source.d", + "syntax": "Packages/D/DMD Output.sublime-syntax", + "keyfiles": ["dub.sdl", "dub.json"], +} diff --git a/D/D.sublime-build b/D/D.sublime-build index 19f3835568..1d92b89173 100644 --- a/D/D.sublime-build +++ b/D/D.sublime-build @@ -1,5 +1,14 @@ { - "cmd": ["dmd", "$file"], - "file_regex": "^(.*?)\\(([0-9]+)\\)", - "selector": "source.d" + "shell_cmd": "dmd \"$file\"", + "file_regex": "^(.*?)\\(([0-9]+)(,[0-9]+)?\\)", + "selector": "source.d", + "syntax": "Packages/D/DMD Output.sublime-syntax", + + "variants": + [ + { + "name": "Run", + "shell_cmd": "rdmd \"$file\"", + } + ] } diff --git a/D/D.sublime-syntax b/D/D.sublime-syntax index 5008d52290..eece8dae20 100644 --- a/D/D.sublime-syntax +++ b/D/D.sublime-syntax @@ -8,339 +8,2263 @@ file_extensions: - di first_line_match: ^#!.*\bg?dmd\b. scope: source.d +variables: + name: '[[:alpha:]_][[:alpha:]0-9_]*' + name_lookahead: '(?=\b{{name}}\b)' + identifier_ref: '\.?\s*{{name}}(\s*\.\s*{{name}})*' + string_postfix: '[cwd]?' + escape_sequence: '\\([''"?\\0abfnrtv]|x\h{2}|[0-7]{1,3}|u\h{4}|U\h{8}|&\w+;)' + + # number lookaheads + number_lookahead: '(?=(\b|\.)\d)' + integer_lookahead: '(?=\b\d)' + + # number digits + bin_digits: '(?:[01][01_]*)' + hex_digits: '(?:\h[\h_]*)' + dec_digits: '(?:\d[\d_]*)' + dec_integer: '(?:0_*|[1-9][0-9_]*)' + + # number suffixes + imaginary_suffix: '[fFL]?i' + integer_suffix: 'L[uU]|[uU]L|[LuU]' + integer_float_suffix: '[fFL]' + float_suffix: '[fF]' + + # number exponents + exponent: '[-+]??\d+' + dec_exponent: '(?:[eE]{{exponent}})' + hex_exponent: '(?:[pP]{{exponent}})' + + character_lookahead: (?=') + string_lookahead: '(?=`|[rxq]?"|q{)' + + definitely_value_lookahead: '(?=!|~|\+|\-|\*|&|\bcast\b|\bdelete\b|\bnew\b|\bimport\b|\bmixin\b|\bis\b|\b__traits\b|\bfunction\b|\bdelegate\b|[0-9]|\[|\(|{{string_lookahead}}|\b({{language_constant}})\b|\b({{language_variable}})\b)' + definitely_declaration_lookahead: '(?=({{name}}|\]|\))(\s+{{name}})|\b({{type_qualifier}})\b)' + + type_qualifier: 'const|immutable|inout|shared' + type_qualifier_lookahead: '(?=\b({{type_qualifier}})\b)' + attribute_lookahead: '(?=@|\b({{attributes}}|extern|align|deprecated|pragma|private|protected|public|export|package)\b)' + attributes: 'static|abstract|final|override|synchronized|scope|__gshared|nothrow|pure|ref|return|auto' + at_attributes: 'disable|nogc|property|safe|system|trusted' + function_attribute_lookahead: '{{attribute_lookahead}}|{{type_qualifier_lookahead}}' + parameter_attribute_lookahead: '(?=\b({{parameter_attribute}})\b)' + parameter_attribute: 'in|lazy|out|alias' + + construction_lookahead: '(?=~?\s*this\s*\()' + + keyword: 'else|enum|export|extern|debug|default|delegate|delete|deprecated|do|body|break|case|cast|catch|class|const|continue|abstract|alias|align|asm|assert|auto|final|finally|for|foreach|foreach_reverse|function|goto|if|immutable|import|in|inout|interface|invariant|is|lazy|macro|mixin|module|new|nothrow|out|override|package|pragma|private|protected|public|pure|ref|return|scope|shared|static|struct|switch|synchronized|template|throw|try|typeid|typeof|union|unittest|version|while|with|__gshared|__traits|__vector|__parameters' + basic_type: 'bool|byte|cdouble|cent|cfloat|char|creal|dchar|double|float|idouble|ifloat|int|ireal|long|real|short|ubyte|ucent|uint|ulong|ushort|void|wchar|string|dstring|wstring' + language_constant: 'null|true|false|__FILE__|__FILE_FULL_PATH__|__MODULE__|__LINE__|__FUNCTION__|__PRETTY_FUNCTION__|__DATE__|__EOF__|__TIME__|__TIMESTAMP__|__VENDOR__|__VERSION__|__ctfe' + language_variable: 'this|super' + reserved: '{{keyword}}|{{basic_type}}|{{language_constant}}|{{language_variable}}' + + operator_overloads: 'opNeg|opCom|opPostInc|opPostDec|opCast|opAdd|opSub|opSub_r|opMul|opDiv|opDiv_r|opMod|opMod_r|opAnd|opOr|opXor|opShl|opShl_r|opShr|opShr_r|opUShr|opUShr_r|opCat|opCat_r|opEquals|opEquals|opCmp|opCmp|opCmp|opCmp|opAddAssign|opSubAssign|opMulAssign|opDivAssign|opModAssign|opAndAssign|opOrAssign|opXorAssign|opShlAssign|opShrAssign|opUShrAssign|opCatAssign|opIndex|opIndexAssign|opCall|opSlice|opSliceAssign|opPos|opAdd_r|opMul_r|opAnd_r|opOr_r|opXor_r' + + block_statement_loohahead: '(?={)' + contexts: + prototype: + - include: comment-in + main: - - match: /\*\*/ - scope: comment.block.empty.d punctuation.definition.comment.d - - include: scope:text.html.javadoc - - match: |- - (?x)^\s* - ((?:\b(private|package|protected|public|export|static|final|native|synchronized|abstract)\b\s*)*) # modifier - (class|interface)\s+ - (\w+)\s* # identifier - (?:\(\s*([^\)]+)\s*\)|)\s* # Template type - (?: - \s*(:)\s* - (\w+) - (?:\s*,\s*(\w+))? - (?:\s*,\s*(\w+))? - (?:\s*,\s*(\w+))? - (?:\s*,\s*(\w+))? - (?:\s*,\s*(\w+))? - (?:\s*,\s*(\w+))? - )? # super class - captures: - 1: storage.modifier.d - 3: storage.type.d - 4: entity.name.type.class.d - 5: storage.type.template.d - 6: punctuation.separator.inheritance.d - 7: entity.other.inherited-class.d - 8: entity.other.inherited-class.d - 9: entity.other.inherited-class.d - 10: entity.other.inherited-class.d - 11: entity.other.inherited-class.d - 12: entity.other.inherited-class.d - 13: entity.other.inherited-class.d + - match: '^#!' + scope: punctuation.definition.comment.number-sign.d push: - - meta_scope: meta.class.d - - match: \b(_|:)\b - captures: - 1: storage.modifier.d + - meta_include_prototype: false + - meta_scope: comment.line.number-sign.d + - match: '$\n?' + pop: true + - include: module-in + - include: statement-list-in + module-in: + - match: \bmodule\b + scope: keyword.declaration.namespace.d + push: + - meta_scope: meta.namespace.d + - match: '{{name}}(?=\s*(;|$))' + scope: meta.path.d entity.name.namespace.d + - match: '{{name}}' + scope: meta.path.d variable.other.d push: - - meta_scope: meta.definition.class.extends.d - - match: "(?={)" - captures: - 1: storage.modifier.d + - match: \. + scope: meta.path.d punctuation.accessor.dot.d pop: true - - include: all-types - - match: '(?<=\})' + - include: not-whitespace-illegal-pop + - include: expect-end-of-line + + statement-list-in: + - include: import-in + - include: alias-in + - include: class-in + - include: interface-in + - include: struct-in + - include: union-in + - include: enum-in + - include: conditional-declaration-in + - include: static-foreach-in + - include: static-assert-in + - include: constructions-in + - include: invariant-in + - include: unittest-in + - include: template-in + - include: mixin-in + - include: block-statement-in + - include: conditional-in + - include: loop-in + - include: flow-statement-in + - include: with-in + - include: synchronized-in + - include: try-in + - include: throw-in + - include: scope-in + - include: asm-in + - include: switch-in + - include: attribute-specifier-in + - include: statement-label-in + - include: end-of-line-in + - include: check-brackets-in + - include: value-or-declaration-in + + block-statement-in: + - match: '{{block_statement_loohahead}}' + push: block-statement + block-statement: + - match: '{' + scope: punctuation.section.block.begin.d + set: + - meta_scope: meta.block.d + - match: '}' + scope: punctuation.section.block.end.d pop: true - - include: $top_level_main - - match: |- - (?x)^\s* - ((?:\b(private|package|protected|public|export|static|final|native|synchronized|abstract|const)\b\s*)*) # modifier - (struct)\s+ - (\w+)\s* # identifier - (?:\(\s*([^\)]+)\s*\)|)\s* # Template type - captures: - 1: storage.modifier.d - 3: storage.type.d - 4: entity.name.type.struct.d - 5: storage.type.template.d + - include: statement-list-in + - include: not-whitespace-illegal-pop + optional-block-statement: + - match: '{{block_statement_loohahead}}' + set: block-statement + - match: '(?=\S)' + pop: true + + optional-block-statement-or-label: + - match: ':' + scope: punctuation.separator.d + pop: true + - include: optional-block-statement + + comment-in: + - match: /\*(\*(?!/))? + scope: punctuation.definition.comment.d push: - - meta_scope: meta.definition.struct.d - - match: "(?={|//|;)" + - meta_scope: comment.block.d + - match: \*/ + scope: punctuation.definition.comment.d pop: true - - match: \b(_|:)\b + - match: ^\s*(\*)(?!/) captures: - 1: storage.modifier.d - push: - - meta_scope: meta.definition.class.extends.d - - match: "(?={)" - captures: - 1: storage.modifier.d - pop: true - - include: all-types - - match: |- - (?x)^\s* - ((?:\b(private|package|protected|public|export|static|final|native|synchronized|abstract|threadsafe|transient|shared|__gshared)\b\s*)*) # modifier - (\b(this))\s* # identifier - (?!.*;) # abort if line has a ; - (?=\() - captures: - 1: storage.modifier.d - 3: entity.name.function.constructor.d + 1: punctuation.definition.comment.d + - match: (///?).*$\n? + scope: comment.line.double-slash.d + captures: + 1: punctuation.definition.comment.d + - include: nested-comment + nested-comment: + - match: /\+(\+(?!/))? + scope: punctuation.definition.comment.d push: - - meta_scope: meta.function.d meta.function.constructor.d - - include: function_assertions - - include: $top_level_main + - meta_scope: comment.block.nested.d + - match: \+/ + scope: punctuation.definition.comment.d + pop: true + - match: ^\s*(\+)(?!/) + captures: + 1: punctuation.definition.comment.d + - include: nested-comment + + number-in: + - match: '{{number_lookahead}}' + push: number + number-opt: + - include: floating-point-opt + - include: integer-opt + number: + - include: number-opt + - include: not-whitespace-illegal-pop + + integer: + - include: integer-opt + - include: not-whitespace-illegal-pop + integer-opt: + - match: '(0[bB])(_?){{bin_digits}}({{integer_suffix}})?' + scope: constant.numeric.integer.binary.d + captures: + 1: punctuation.definition.numeric.base.d + 2: invalid.illegal.numeric.d + 3: storage.type.numeric.d + pop: true + - match: '(0[xX])(_?){{hex_digits}}({{integer_suffix}})?' + scope: constant.numeric.integer.hexadecimal.d + captures: + 1: punctuation.definition.numeric.base.d + 2: invalid.illegal.numeric.d + 3: storage.type.numeric.d + pop: true + - match: '{{dec_integer}}({{integer_suffix}})?' + scope: constant.numeric.integer.decimal.d + captures: + 1: storage.type.numeric.d + pop: true + + floating-point: + - include: floating-point-opt + - include: not-whitespace-illegal-pop + floating-point-opt: + # decimal imaginary numbers + - match: '{{dec_integer}}?(?:(\.){{dec_digits}}?)?{{dec_exponent}}?({{imaginary_suffix}})' + scope: constant.numeric.imaginary.decimal.d + captures: + 1: punctuation.separator.decimal.d + 2: storage.type.numeric.d + pop: true + # decimal floats - match: |- - (?x) - (?: ^ # begin-of-line - | (?: (?")({{string_postfix}})' + captures: + 1: punctuation.definition.string.end.d + 2: storage.type.string.d + pop: true + - match: (q)("{) + captures: + 1: storage.modifier.string.d + 2: punctuation.definition.string.begin.d + set: + - meta_include_prototype: false + - meta_scope: meta.string.d string.quoted.double.raw.d + - match: '(}")({{string_postfix}})' + captures: + 1: punctuation.definition.string.end.d + 2: storage.type.string.d + pop: true + # Other deliminated string + - match: '(q)(")(.)' + captures: + 1: storage.modifier.string.d + 2: punctuation.definition.string.begin.d + 3: constant.other.delimeter.d + set: + - meta_include_prototype: false + - meta_scope: meta.string.d string.quoted.double.raw.d + - match: '(\3)(?:(")|(.))({{string_postfix}})' + captures: + 1: constant.other.delimeter.d + 2: punctuation.definition.string.end.d + 3: invalid.illegal.d + 4: storage.type.string.d + pop: true + # Token string + - match: '(q)({)' + captures: + 1: storage.modifier.string.d + 2: punctuation.definition.string.begin.d + scope: string.unquoted.embedded.d + set: + - meta_scope: meta.string.d + - match: '}' + scope: string.unquoted.embedded.d punctuation.definition.string.end.d + pop: true + - include: tokens-in + + # Purely a set of un-verified tokens + tokens-in: + - match: '\b({{keyword}})\b' + scope: keyword.d + - match: '\b({{basic_type}})\b' + scope: storage.type.d + - match: '\b({{language_constant}})\b' + scope: constant.language.d + - match: '\b({{language_variable}})\b' + scope: variable.language.d + - include: character-in + - include: string-in + - include: number-in + - match: '{{name}}' + - match: '(/|&|\||-|\+|<<|<>|>>|>>>||\*|%|\^|\^\^|~)=' + scope: keyword.operator.assignment.d + - match: '(/|<=|>=|==|!<>=|!<=|!>=|\.\.\.|\.\.|&|&&|\||\|\||-|--|\+|\+\+|<|<<|<>|>|>>|>>>|!|!<>|!<|!>|\?|,|:|\$|\*|%|\^|\^\^|~|@|=>|#)' + scope: keyword.operator.d + - match: ';' + scope: punctuation.terminator.d + - match: '\.' + scope: punctuation.accessor.dot.d + - match: '\(' + scope: punctuation.section.parens.begin.d push: - - meta_scope: meta.function.d meta.function.destructor.d - - include: function_assertions - - include: $top_level_main - - match: |- - (?x)^\s* - (?!else(?:\s+static)?\s+if\b) - ((?:\b(?:private|package|protected|public|export|static|final|native|lazy|synchronized|abstract|threadsafe|transient|override|pure|nothrow)\b\s*)*+) # modifier - (\b(?:void|boolean|byte|char|short|int|float|long|double|[\w_]+[\w0-9_]*|(?:\w+\.)*[A-Z]\w+)\b(?:<(?:(?:(?:\w+\.)*[A-Z]\w+)(?:\s*,\s*)?)+>|(?:\[\s*\])*)?|typeof\(.*?\)|const\(.*?\)\*?)\s* # type - (\w+)\s* # identifier - (?!.*;) # abort if line has a ; - (?=\() - captures: - 1: storage.modifier.d - 2: storage.type.d - 3: entity.name.function.d + - match: '\)' + scope: punctuation.section.parens.end.d + pop: true + - include: tokens-in + - match: '\[' + scope: punctuation.section.brackets.begin.d push: - - meta_scope: meta.function.d - - include: function_assertions - - include: $top_level_main + - match: '\]' + scope: punctuation.section.brackets.end.d + pop: true + - include: tokens-in - match: '\{' + scope: punctuation.section.braces.begin.d push: - - meta_scope: meta.block.d - match: '\}' + scope: punctuation.section.braces.end.d + pop: true + - include: tokens-in + - include: not-whitespace-illegal + + attribute-specifier-in: + - match: '{{attribute_lookahead}}' + push: [attribute-specifier-after, attribute] + - match: '\b({{type_qualifier}})\b(?!\s*\()' + scope: storage.modifier.d + push: attribute-specifier-after + attribute-specifier-after: + - match: ':' + scope: punctuation.separator.d + pop: true + - include: end-of-line + - match: '{{block_statement_loohahead}}' + set: block-statement + - match: '{{attribute_lookahead}}' + push: attribute + - match: '\b({{type_qualifier}})\b(?!\s*\()' + scope: storage.modifier.d + - match: '(?=\b({{reserved}})\b)' + pop: true + - match: '{{construction_lookahead}}' + set: construction + - match: '(?=\b{{name}}\b\s*[,=\()])' + set: [function-or-variable-after-type] + - match: '(?=\S)' + set: [function-or-variable-after-type, type] + - include: not-whitespace-illegal-pop + + parameter-attribute-in: + - match: '{{attribute_lookahead}}' + push: [parameter-attribute-after, attribute] + - match: '\b({{parameter_attribute}})\b' + scope: storage.modifier.d + push: parameter-attribute-after + - match: '\b({{type_qualifier}})\b(?!\s*\()' + scope: storage.modifier.d + push: parameter-attribute-after + parameter-attribute-after: + - match: '{{attribute_lookahead}}' + set: [parameter-attribute-after, attribute] + - match: '\b({{parameter_attribute}})\b' + scope: storage.modifier.d + set: parameter-attribute-after + - match: '\b({{type_qualifier}})\b(?!\s*\()' + scope: storage.modifier.d + set: parameter-attribute-after + - match: '(?=\S)' + pop: true + + function-attribute-in: + - include: attribute-in + - match: '\b({{type_qualifier}})\b' + scope: storage.modifier.d + + attribute-in: + - match: '{{attribute_lookahead}}' + push: attribute + + attribute: + - match: '\b({{attributes}})\b' + scope: storage.modifier.d + pop: true + - match: '@(?=\s*({{at_attributes}})\b)' + scope: storage.modifier.d + set: at-attribute + - match: '@' + scope: punctuation.definition.annotation.begin.d + set: at-attribute + - match: '\b(extern)\s*(\()' + captures: + 1: keyword.other.external.d + 2: punctuation.section.parens.begin.d + set: extern-attribute + - match: '\b(extern)\b' + scope: storage.modifier.external.d + pop: true + - match: '\b(align)\b' + scope: keyword.other.alignment.d + set: + - match: '\(' + scope: punctuation.section.parens.begin.d + set: [align-attribute-after, value] + - match: '(?=\S)' + pop: true + - match: '\b(deprecated)\b' + scope: keyword.other.deprecated.d + set: + - match: '\(' + scope: punctuation.section.parens.begin.d + set: [deprecated-attribute-after, value] + - match: '(?=\S)' pop: true - - include: $top_level_main - - match: '\b([A-Z][A-Z0-9_]+)\b' - scope: constant.other.d - - include: comments - - include: all-types - - match: \b(private|protected|public|export)\b + - match: '\b(private|protected|public|export)\b' scope: storage.modifier.access-control.d - - match: \b(auto|static|override|final|const|abstract|volatile|synchronized|lazy|immutable|shared|__gshared|pure|nothrow|ref)\b + pop: true + - match: '\b(package)\b' + scope: storage.modifier.access-control.d + set: + - match: '\(' + scope: punctuation.section.parens.begin.d + set: [attribute-parens-after, identifier] + - match: (?=\S) + pop: true + - match: '\b(pragma)\b' + scope: keyword.other.pragma.d + set: + - match: '\(' + scope: punctuation.section.parens.begin.d + set: pragma-attribute + - include: not-whitespace-illegal-pop + - include: not-whitespace-illegal-pop + attribute-parens-after: + - match: '\)' + scope: punctuation.section.parens.end.d + pop: true + - include: not-whitespace-illegal-pop + at-attribute: + - match: '({{at_attributes}})\b' scope: storage.modifier.d - - match: '@[a-zA-Z]\w+\b' - scope: storage.attribute.d - - match: \b(template|interface|class|enum|struct|union)\b - scope: storage.type.d - - match: \b(ushort|int|uint|long|ulong|float|void|byte|ubyte|double|bit|char|wchar|ucent|cent|short|bool|dchar|real|ireal|ifloat|idouble|creal|cfloat|cdouble|string)\b + pop: true + - match: '\(' + scope: punctuation.section.parens.begin.d + set: [uda-after, value-list] + - match: '({{name}})\s*(\()' + scope: meta.function-call.d + captures: + 1: meta.path.d storage.type.d + 2: punctuation.section.parens.begin.d + set: [meta-function-call, uda-after, value-list] + - match: '({{name}})\b' + scope: meta.path.d storage.type.d + pop: true + uda-after: + - match: '\)' + scope: punctuation.section.parens.end.d + pop: true + - include: not-whitespace-illegal-pop + extern-attribute: + - match: '(C\+\+|C|D|Windows|System|Objective-C)' + scope: string.other.d + set: extern-attribute-after + - match: (?=\S) + set: [extern-attribute-after, identifier] + extern-attribute-after: + - match: ',' + scope: punctuation.separator.sequence.d + set: extern-attribute + - match: '\)' + scope: punctuation.section.parens.end.d + pop: true + - include: not-whitespace-illegal-pop + align-attribute-after: + - match: '\)' + scope: punctuation.section.parens.end.d + pop: true + deprecated-attribute-after: + - match: '\)' + scope: punctuation.section.parens.end.d + pop: true + pragma-attribute: + - match: '\b({{name}})\b' + scope: variable.function.d + set: + - match: '\)' + scope: punctuation.section.parens.end.d + pop: true + - match: ',' + scope: punctuation.separator.sequence.d + set: [pragma-attribute-after, value-list] + - include: not-whitespace-illegal-pop + - include: not-whitespace-illegal-pop + pragma-attribute-after: + - match: '\)' + scope: punctuation.section.parens.end.d + pop: true + - include: not-whitespace-illegal-pop + + # TODO: Maybe make imports non-indexed entities (as opposed to variables) + import-in: + - match: '\b(import)(?!\s*\()\b' + scope: keyword.control.import.d + push: [import-list, identifier] + import-list: + - match: ':' + scope: punctuation.separator.import-binding.d + set: [import-binding-list, identifier] + - match: ',' + scope: punctuation.separator.sequence.d + set: [import-list, identifier] + - match: '=' + scope: keyword.operator.assignment.d + set: [import-list-after-assignment, identifier] + - include: expect-end-of-line + import-list-after-assignment: + - match: ',' + scope: punctuation.separator.sequence.d + set: [import-list, identifier] + - include: expect-end-of-line + import-binding-list: + - match: ',' + scope: punctuation.separator.sequence.d + set: [import-binding-list, identifier] + - match: '=' + scope: keyword.operator.assignment.d + set: [import-binding-list-after-assignment, identifier] + - include: expect-end-of-line + import-binding-list-after-assignment: + - match: ',' + scope: punctuation.separator.sequence.d + set: [import-binding-list, identifier] + - include: expect-end-of-line + + type: + - match: '\b({{type_qualifier}})\b' + scope: storage.modifier.d + set: + - match: '\(' + scope: punctuation.section.group.begin.d + set: [basic-type2, type-storage-modifier-end, type] + - match: '(?=\S)' + set: type + - match: '(?=\S)' + set: basic-type + type-storage-modifier-end: + - match: '\)' + scope: punctuation.section.group.end.d + pop: true + - include: not-whitespace-illegal-pop + + basic-type: + - include: attribute-in + - match: '\btypeof\b' + scope: keyword.other.d + set: + - match: '\(' + scope: punctuation.section.parens.begin.d + set: [basic-type2, basic-type2-after-parens, typeof-value] + - match: '\bauto\b' + scope: keyword.other.d + pop: true + - match: '{{name_lookahead}}' + set: [basic-type2, type-identifier-ref] + - match: '(?=\S)' + pop: true + + basic-type2: + - match: '\*' + scope: keyword.operator.pointer.d + - match: '\[' + scope: punctuation.section.brackets.begin.d + push: [basic-type2-after-brackets, value-list] + - match: '\b(delegate|function)\b' + scope: keyword.other.d + set: [basic-type2, function-type] + - match: '!(?!=|is\b)' + scope: meta.function-call.d keyword.operator.d + set: + - match: '\(' + scope: punctuation.section.parens.begin.d + set: [basic-type2, basic-type2-after-call, value-list] + - match: '(?=\S)' + set: [basic-type2, meta-function-call, value-template-single] + - match: '\.(?!\.\.)' scope: storage.type.d - - match: \b(try|catch|finally|throw)\b - scope: keyword.control.exception.d - - match: \b(return|break|case|continue|default|do|while|for|switch|if|else)\b - scope: keyword.control.d - - match: \b(if|else|switch|iftype)\b + set: + - match: '\b({{name}})\b' + scope: storage.type.d + set: basic-type2 + - match: '(?=\S)' + pop: true + basic-type2-after-brackets: + - match: '\]' + scope: punctuation.section.brackets.end.d + pop: true + - include: not-whitespace-illegal-pop + basic-type2-after-parens: + - match: '\)' + scope: punctuation.section.parens.end.d + pop: true + - include: not-whitespace-illegal-pop + basic-type2-after-call: + - meta_scope: meta.function-call.d + - include: basic-type2-after-parens + + typeof-value: + - match: '\breturn\b' + scope: keyword.other.d + pop: true + - include: value + + function-type: + - match: (?=\() + set: [function-type-after, function-type-argument-definition-list] + - include: not-whitespace-illegal-pop + function-type-after: + - include: function-attribute-in + - match: '(?=\S)' + pop: true + + # Function type arguments are slightly different to regular function + # arguments. With regular arguments a standalone "name" is asssumed to be a + # template argument, but with function types they must be a type. + function-type-argument-definition-list: + - match: '\(' + scope: punctuation.section.group.begin.d + set: + - match: '\)' + scope: punctuation.section.group.end.d + pop: true + - match: '(?=\S)' + set: [function-type-argument, function-type-argument-type] + - include: not-whitespace-illegal-pop + function-type-argument-type: + - include: parameter-attribute-in + - match: '\.\.\.' + scope: keyword.operator.variadic.d + pop: true + - include: type + function-type-argument: + - match: '\b{{name}}\b' + scope: variable.parameter.d + set: + - match: '\.\.\.' + scope: keyword.operator.variadic.d + - match: ',' + scope: punctuation.separator.sequence.d + set: [function-type-argument, function-type-argument-type] + - match: '=' + scope: keyword.operator.assignment.d + push: value + - match: ':' + scope: keyword.operator.comparison.d + push: value + - match: '\)' + scope: punctuation.section.group.end.d + pop: true + - include: not-whitespace-illegal-pop + - match: ',' + scope: punctuation.separator.sequence.d + push: function-type-argument-type + - match: '\)' + scope: punctuation.section.group.end.d + pop: true + - include: not-whitespace-illegal-pop + + function-or-variable-after-type: + - match: '\b({{operator_overloads}})\s*(?=\(|$)' + scope: meta.function.d + captures: + 1: entity.name.function.operator.d + set: function-definition-begin + - match: '\b({{name}})\s*(?=\(|$)' + scope: meta.function.d + captures: + 1: entity.name.function.d + set: function-definition-begin + - match: '(?=\S)' + set: variable-definition-begin + function-definition-begin: + - match: '(?=\()' + set: [function-definition-after-first-argument-list, function-argument-definition-list] + - include: not-whitespace-illegal-pop + function-definition-after-first-argument-list: + - match: '(?=\()' + set: [function-definition-before-after-arguments, function-argument-definition-list] + - match: '(?=\S)' + set: function-definition-after-arguments + function-definition-before-after-arguments: + - match: '' + set: function-definition-after-arguments + function-definition-after-arguments: + - meta_scope: meta.function.d + - include: function-attribute-in + - match: '=' + scope: keyword.operator.assignment.d + set: [meta-function, expect-end-of-line, value] + - match: '\bif\b' scope: keyword.control.conditional.d - - match: \b(goto|break|continue)\b - scope: keyword.control.branch.d - - match: \b(while|for|foreach(_reverse)?)\b - scope: keyword.control.repeat.d - - match: \b(version|return|with|invariant|body|scope|in|out|inout|asm|mixin|function|delegate)\b - scope: keyword.control.statement.d - - match: \b(pragma)\b - scope: keyword.control.pragma.d - - match: \b(alias|typedef)\b - scope: keyword.control.alias.d - - match: \b(import)\b + set: [meta-function, function-definition-after-condition, condition] + - match: '(?=\S)' + set: [meta-function, function-definition-after-condition] + function-definition-after-condition: + - match: '\bin\b' + scope: keyword.control.conditional.d + set: + - match: '(?=\()' + set: [function-definition-after-condition, assert-arguments] + - match: '{{block_statement_loohahead}}' + set: [function-definition-after-condition, block-statement] + - include: not-whitespace-illegal-pop + - match: '\bout\b' + scope: keyword.control.conditional.d + push: function-out-contract + - match: '\b(do|body)\b' + scope: keyword.other.d + set: block-statement + - match: '{{block_statement_loohahead}}' + set: block-statement + - include: expect-end-of-line + function-out-contract: + - match: '\(' + scope: punctuation.section.parens.begin.d + set: + - match: '{{name}}' + scope: variable.parameter.d + set: + - match: ';' + scope: punctuation.separator.sequence.d + set: [function-out-contract-after, value-list] + - match: '(?=\S)' + set: [block-statement, function-out-contract-after] + - match: ';' + scope: punctuation.separator.sequence.d + set: [function-out-contract-after, value-list] + - include: not-whitespace-illegal-pop + - match: '{{block_statement_loohahead}}' + set: block-statement + - include: not-whitespace-illegal-pop + function-out-contract-after: + - match: '\)' + scope: punctuation.section.parens.end.d + pop: true + - include: not-whitespace-illegal-pop + function-argument-definition-list: + - match: '\(' + scope: punctuation.section.group.begin.d + set: function-argument-definition-list-content + - include: not-whitespace-illegal-pop + function-argument-definition-list-content: + - meta_scope: meta.function.parameters.d + - match: '\)' + scope: punctuation.section.group.end.d + pop: true + - match: '(?=\S)' + set: [meta-function-parameters, function-argument, function-argument-or-type] + function-argument-or-type: + - include: parameter-attribute-in + - match: '\.\.\.' + scope: keyword.operator.variadic.d + pop: true + - match: '(?={{name}}\s*([,=:\)]|\.\.\.))' + pop: true + - include: type + function-argument: + - match: '\b{{name}}\b' + scope: variable.parameter.d + set: + - match: '\.\.\.' + scope: keyword.operator.variadic.d + - match: ',' + scope: punctuation.separator.sequence.d + set: [function-argument, function-argument-or-type] + - match: '=' + scope: keyword.operator.assignment.d + push: value + - match: ':' + scope: keyword.operator.comparison.d + push: value + - match: '\)' + scope: punctuation.section.group.end.d + pop: true + - include: not-whitespace-illegal-pop + - match: ',' + scope: punctuation.separator.sequence.d + push: type + - match: '\)' + scope: punctuation.section.group.end.d + pop: true + - include: not-whitespace-illegal-pop + + optional-template-body-block: + - match: '{{block_statement_loohahead}}' + set: block-statement + - match: '\bif\b' + scope: keyword.control.conditional.d + set: [block-statement, condition] + - include: expect-end-of-line + + variable-definition-begin: + - match: '\b{{name}}\b' + scope: variable.other.d + set: + - match: '(?=,)' + set: variable-definition-after + - match: '=' + scope: keyword.operator.assignment.d + set: [variable-definition-after, value] + - include: expect-end-of-line + - include: not-whitespace-illegal-pop + variable-definition-after: + - match: ',' + scope: punctuation.separator.sequence.d + set: variable-definition-begin + - include: expect-end-of-line + + value-or-declaration-in: + - match: '{{definitely_value_lookahead}}' + push: [maybe-end-of-line, value-list] + - match: '{{definitely_declaration_lookahead}}' + push: [function-or-variable-after-type, type] + - match: '(?=\S)' + push: [maybe-end-of-line, first-value] + + # The first value in an expression ending with a * is always a function/variable definition, otherwise it could be either + # We highlight as if it were a value, but switch to a definition if it turns out to be one + first-value: + - match: '\btypeof\b' + scope: keyword.other.d + set: + - match: '\(' + scope: punctuation.section.parens.begin.d + set: [first-value-parens-after, typeof-value] + - match: '\b({{basic_type}})\b' + scope: storage.type.d + set: first-value-after + # Match a regular function call so we properly highlight the name as a + # function + - match: '(?=[[:alpha:]0-9_\.]+\s*\()' + set: value-list + - match: '{{name_lookahead}}' + scope: variable.other.d + set: [first-value-after, value-identifier] + - match: '(?=\S)' + set: value-list + first-value-after: + - match: '\.' + scope: meta.path.d punctuation.accessor.dot.d + push: value-identifier + - match: '!(?!=|is\b)' + scope: meta.function-call.d keyword.operator.d + set: + - match: '\(' + scope: punctuation.section.parens.begin.d + set: [first-value-call-after, value-list] + - match: '(?=\S)' + set: [first-value-after, meta-function-call, value-template-single] + - match: '\[' + scope: punctuation.section.brackets.begin.d + set: [first-value-bracket-after, value-list] + - match: ',' + scope: punctuation.separator.sequence.d + set: value-list + # Attempt to match pointers + - match: '(?=\*\s*([\*\[]|$))' + set: [function-or-variable-after-type, basic-type2] + - match: '(?=\*\s*{{name}}\s*[=;\(])' + set: [function-or-variable-after-type, basic-type2] + - match: '(?=\b(function|delegate)\b)' + set: [value-list-after, value] + scope: keyword.other.d + - match: '(?={{name}}\s*([;=\(,]|$))' + set: function-or-variable-after-type + - match: '(?=\S)' + set: [value-list-after, value-after] + first-value-bracket-after: + - match: '\]' + scope: punctuation.section.brackets.end.d + set: first-value-after + - include: not-whitespace-illegal-pop + first-value-parens-after: + - match: '\)' + scope: punctuation.section.parens.end.d + set: first-value-after + - include: not-whitespace-illegal-pop + first-value-call-after: + - meta_scope: meta.function-call.d + - include: first-value-parens-after + + value: + - include: attribute-in + - match: '!' + scope: keyword.operator.logical.d + set: value + - match: '~' + scope: keyword.operator.bitwise.d + set: value + - match: '(\+\+|--|\+|-)' + scope: keyword.operator.arithmetic.d + set: value + - match: '(\*|&)' + scope: keyword.operator.bitwise.d + set: value + - match: '\bcast\b' + scope: keyword.operator.word.d + set: + - match: '\(' + scope: punctuation.section.parens.begin.d + set: [cast-after, type] + - include: not-whitespace-illegal-pop + - match: '\bdelete\b' + scope: keyword.operator.word.d + set: value + - match: '\bnew\b' + scope: keyword.operator.word.d + set: + - match: '\(' + scope: punctuation.section.parens.begin.d + set: [new-after-parens, value-list] + - match: '(?=\S)' + set: new-after + - match: '\bimport\b' scope: keyword.control.import.d - - match: '^\s*(module)\s+([^ ;]+?);' - scope: meta.module.d - captures: - 1: keyword.control.module.d - 2: entity.name.function.package.d - - match: \b(true|false)\b - scope: constant.language.boolean.d - - match: \b(__FILE__|__LINE__|__DATE__|__TIME__|__TIMESTAMP__|null)\b + set: + - match: '\(' + scope: punctuation.section.parens.begin.d + set: [value-parens-after, value] + - include: not-whitespace-illegal-pop + - match: '\bmixin\b' + scope: keyword.control.d + set: + - match: '\(' + scope: punctuation.section.parens.begin.d + set: [value-parens-after, value-list] + - include: not-whitespace-illegal-pop + - match: \bassert\b + scope: keyword.other.assert.d + set: [value-after, assert-arguments] + - match: '\bis\b' + scope: keyword.other.d + set: + - match: '\(' + scope: punctuation.section.parens.begin.d + set: [value-after, is-after-type, type] + - include: not-whitespace-illegal-pop + - match: '\btypeof\b' + scope: keyword.other.d + set: + - match: '\(' + scope: punctuation.section.parens.begin.d + set: [value-parens-after, typeof-value] + - match: '\b__traits\b' + scope: keyword.other.d + set: + - match: '\(' + scope: punctuation.section.parens.begin.d + set: + - match: '\b{{name}}\b' + scope: variable.function.d + set: + - match: ',' + scope: punctuation.separator.sequence.d + set: [value-parens-after, value-list] + - match: '\b(function|delegate)\b' + scope: meta.function.d keyword.other.d + set: + - meta_scope: meta.function.d + - match: '(?=\()' + set: [value-after, function-definition-begin] + - match: '(?=\S)' + set: [value-after, function-definition-begin, meta-function, type] + - match: '(\()\s*(\))' + scope: meta.function.parameters.d + captures: + 1: punctuation.section.parens.begin.d + 2: punctuation.section.parens.end.d + set: [value-after, value-group-after-parens] + - match: '\(' + scope: punctuation.section.group.begin.d + set: + - match: '{{parameter_attribute_lookahead}}' + set: [value-group-after-parens, function-argument, function-argument-or-type] + - match: '(?=\S)' + set: [value-group-after, value] + - match: '(?={)' + set: [value-after, block-statement] + - match: '\[' + scope: punctuation.section.brackets.begin.d + set: [value-bracket-after, value-array-list] + - match: '{{type_qualifier_lookahead}}' + set: [value-after, type] + - match: '{{number_lookahead}}' + set: [value-after, number] + - match: '{{character_lookahead}}' + set: [value-after, character] + - match: '{{string_lookahead}}' + set: [value-after, string] + - match: '\b({{language_constant}})\b' scope: constant.language.d - - match: \b(this|super)\b + set: value-after + - match: '\b({{language_variable}})\b' scope: variable.language.d - - match: |- - (?x) - ( - (\b0(x|X)[0-9a-fA-F](_[0-9a-fA-F]+)*) # 0x0, 0X0, 0x000_000 - | - ( - (\b[0-9]+(_[0-9]+)*\.?([0-9]+_[0-9]+)?[0-9]*) # 0.0, 0_0.0, 0.0_0 - | - (\.[0-9]+(_[0-9]+)*) # .0, .0_0 - )((e|E)(\+|-)?[0-9]+)? # 0e+5 - ) - ([LlFfUuDd]|UL|ul)? # 0l, 0U, 0Lu, 0UL - \b - scope: constant.numeric.d - - include: string_escaped_char - - include: strings - - match: (==|!=|<=|>=|<>|<|>) + set: value-after + - match: '\$' + scope: variable.language.d + set: value-after + - match: '\b({{basic_type}})\b' + scope: storage.type.d + set: value-after + - match: '\b({{name}})\s*(=>)' + captures: + 1: variable.parameter.d + 2: storage.type.function.d keyword.declaration.function.lambda.d + set: [meta-function, value] + - match: \. + scope: meta.path.d punctuation.accessor.dot.d + set: [value-after, value-identifier] + - match: '\b({{name}})\s*(:)' + captures: + 1: variable.other.d + 2: punctuation.separator.mapping.key-value.d + set: value + - match: '{{name_lookahead}}' + set: [value-after, value-identifier] + - include: not-whitespace-illegal-pop + cast-after: + - match: '\)' + scope: punctuation.section.parens.end.d + set: value + - include: not-whitespace-illegal-pop + new-after-parens: + - match: '\)' + scope: punctuation.section.parens.end.d + set: new-after + - include: not-whitespace-illegal-pop + new-after: + - match: '\bclass\b' + scope: meta.class.d storage.type.class.d keyword.declaration.class.d + set: [meta-class, new-class] + - match: (?={{identifier_ref}}\s*\() + set: [new-after-named, new-type-identifier-ref] + - match: (?=\S) + set: [new-after-named, type] + new-class: + - match: '\(' + scope: punctuation.section.parens.begin.d + set: [new-anonymous-after-args, value-list] + - match: '(?={)' + set: optional-template-body-block + - match: '(?=\S)' + set: [optional-template-body-block, base-class-list] + new-after-named: + - meta_scope: meta.function-call.d + - match: '\(' + scope: punctuation.section.parens.begin.d + set: [value-call-parens-after, value-list] + - match: (?=\S) + set: value-after + new-anonymous-after-args: + - match: '\)' + scope: punctuation.section.parens.end.d + set: + - match: '(?={)' + set: optional-template-body-block + - match: '(?=\S)' + set: [optional-template-body-block, base-class-list] + - include: not-whitespace-illegal-pop + is-after-type: + - match: '\b({{name}})\b' + scope: variable.parameter.d + - match: '\)' + scope: punctuation.section.parens.end.d + pop: true + - match: '\=\=|:' scope: keyword.operator.comparison.d - - match: (\-\-|\+\+) - scope: keyword.operator.increment-decrement.d - - match: (\-|\+|\*|\/|~|%) + set: [is-after, type-specialization] + is-after: + - match: ',' + scope: punctuation.separator.sequence.d + set: function-argument-definition-list-content + - match: '\)' + scope: punctuation.section.parens.end.d + pop: true + - include: not-whitespace-illegal-pop + type-specialization: + - match: '\b(?:__vector|function|delegate|__parameters)\b' + scope: keyword.other.d + set: + - match: '(?=\))' + pop: true + - include: type-specialization + - match: '\breturn\b' + scope: keyword.control.flow.d + set: + - match: '(?=\))' + pop: true + - include: type-specialization + - match: '\bsuper\b' + scope: variable.language.d + set: + - match: '(?=\))' + pop: true + - include: type-specialization + - match: '\b(?:struct|union|class|interface|enum)\b' + scope: storage.type.d keyword.declaration.d + set: + - match: '(?=\))' + pop: true + - include: type-specialization + - match: '(?=\S)' + set: type + - include: not-whitespace-illegal-pop + value-group-after: + - match: '\b(function|delegate)\b' + scope: keyword.other.d + set: [value-group-after, basic-type2, function-type] + - match: '\)' + scope: punctuation.section.group.end.d + set: value-group-after-parens + - match: '\b({{name}})\b' + scope: variable.parameter.d + set: value-group-after + - match: ',' + scope: punctuation.separator.sequence.d + set: [value-group-after-parens, function-argument, function-argument-or-type] + - match: '\.\.\.' + scope: keyword.operator.variadic.d + - include: not-whitespace-illegal-pop + value-group-after-parens: + - match: '{{function_attribute_lookahead}}' + set: value-group-after-lambda + - match: (?={) + set: [value-after, meta-function, block-statement] + - match: '=>' + scope: meta.function.d storage.type.function.d keyword.declaration.function.lambda.d + set: [meta-function, value] + - match: (?=\S) + set: value-after + value-group-after-lambda: + - meta_scope: meta.function.d + - include: function-attribute-in + - match: (?={) + set: [value-after, meta-function, block-statement] + - match: '=>' + scope: meta.function.d storage.type.function.d keyword.declaration.function.lambda.d + set: [meta-function, value] + - include: not-whitespace-illegal-pop + value-identifier: + - match: '\b{{name}}\b(?=\s*(\(|!(?!=|is\b)))' + scope: meta.function-call.d meta.path.d variable.function.d + pop: true + - match: '\b{{name}}\b' + scope: meta.path.d variable.other.d + set: + - match: \.(?!\.) + scope: meta.path.d punctuation.accessor.dot.d + set: value-identifier + - match: (?=\S) + pop: true + - include: not-whitespace-illegal-pop + value-after: + - match: '\.\.(?!\.)' + scope: keyword.operator.slice.d + set: value + - match: '\.(?!\.\.)' + scope: meta.path.d punctuation.accessor.dot.d + set: [value-after, value-identifier] + - match: '\(' + scope: punctuation.section.parens.begin.d + set: [value-call-parens-after, value-list] + - match: '\[' + scope: punctuation.section.brackets.begin.d + set: [value-bracket-after, value-list] + - match: '(\+\+|--)' scope: keyword.operator.arithmetic.d - - match: (!|&&|\|\|) + set: value-after + - match: '(&&|\|\|)' scope: keyword.operator.logical.d - - match: \b(opNeg|opCom|opPostInc|opPostDec|opCast|opAdd|opSub|opSub_r|opMul|opDiv|opDiv_r|opMod|opMod_r|opAnd|opOr|opXor|opShl|opShl_r|opShr|opShr_r|opUShr|opUShr_r|opCat|opCat_r|opEquals|opEquals|opCmp|opCmp|opCmp|opCmp|opAddAssign|opSubAssign|opMulAssign|opDivAssign|opModAssign|opAndAssign|opOrAssign|opXorAssign|opShlAssign|opShrAssign|opUShrAssign|opCatAssign|opIndex|opIndexAssign|opCall|opSlice|opSliceAssign|opPos|opAdd_r|opMul_r|opAnd_r|opOr_r|opXor_r)\b - scope: keyword.operator.overload.d - - match: \b(new|delete|typeof|typeid|cast|align|is)\b - scope: keyword.other.d - - match: \b(new|throws)\b - scope: keyword.other.class-fns.d - - match: \b(package|extern)\b - scope: keyword.other.external.d - - match: \b(deprecated|unittest|debug)\b - scope: keyword.other.debug.d - - match: \b(u_char|u_short|u_int|u_long|ushort|uint|u_quad_t|quad_t|qaddr_t|caddr_t|daddr_t|dev_t|fixpt_t|blkcnt_t|blksize_t|gid_t|in_addr_t|in_port_t|ino_t|key_t|mode_t|nlink_t|id_t|pid_t|off_t|segsz_t|swblk_t|uid_t|id_t|clock_t|size_t|ssize_t|time_t|useconds_t|suseconds_t)\b - scope: support.type.sys-types.c - - match: \b(pthread_attr_t|pthread_cond_t|pthread_condattr_t|pthread_mutex_t|pthread_mutexattr_t|pthread_once_t|pthread_rwlock_t|pthread_rwlockattr_t|pthread_t|pthread_key_t)\b - scope: support.type.pthread.c - - match: \b(int8_t|int16_t|int32_t|int64_t|uint8_t|uint16_t|uint32_t|uint64_t|int_least8_t|int_least16_t|int_least32_t|int_least64_t|uint_least8_t|uint_least16_t|uint_least32_t|uint_least64_t|int_fast8_t|int_fast16_t|int_fast32_t|int_fast64_t|uint_fast8_t|uint_fast16_t|uint_fast32_t|uint_fast64_t|intptr_t|uintptr_t|intmax_t|intmax_t|uintmax_t|uintmax_t)\b - scope: support.type.stdint.c - all-types: - - include: support-type-built-ins-d - - include: support-type-d - - include: storage-type-d - comments: - - match: /\* - scope: punctuation.definition.comment.d + set: value + - match: '(\+|-|/|%|\*|&|\||\^\^|\^|~|<<|>>>|>>)=' + scope: keyword.operator.assignment.d + set: value + - match: '(\+|\-|/|%|\^\^)' + scope: keyword.operator.arithmetic.d + set: value + - match: '~' + scope: keyword.operator.concatenation.d + set: value + - match: '(<<|>>>|>>|\||\^|&)' + scope: keyword.operator.bitwise.d + set: value + - match: '(==|!=|\bis\b|!is\b|<=|<|>=|>|\bin\b|!in\b)' + scope: keyword.operator.comparison.d + set: value + - match: '=' + scope: keyword.operator.assignment.d + set: value + - match: '!' + scope: meta.function-call.d punctuation.section.generic.begin.d + set: + - match: '\(' + scope: punctuation.section.parens.begin.d + set: [value-call-parens-after, value-list] + - match: '(?=\S)' + set: [value-after, meta-function-call, value-template-single] + - match: \*(?=\s*[\),;\]\*]) + scope: keyword.operator.pointer.d + set: value-maybe-pointer-after + - match: \* + scope: keyword.operator.arithmetic.d + set: value-maybe-pointer-after + - match: '\?' + scope: keyword.operator.ternary.d + set: [value-condition-after, value] + - match: '(?=\b(function|delegate)\b)' + set: [value-after, basic-type2] + - match: '(?=\S)' + pop: true + value-template-single: + - match: '\b({{basic_type}})\b' + scope: storage.type.d + pop: true + - match: '{{number_lookahead}}' + set: number + - match: '{{character_lookahead}}' + set: character + - match: '{{string_lookahead}}' + set: string + - match: '\b({{language_constant}})\b' + scope: constant.language.d + pop: true + - match: '\b({{language_variable}})\b' + scope: variable.language.d + pop: true + - match: '{{name_lookahead}}|\.' + set: identifier-ref + - include: not-whitespace-illegal-pop + value-maybe-pointer-after: + # This can also be a pointer in some situations + - match: '(?=[\),;\]])' + pop: true + - match: '(?=\*)' + set: basic-type2 + - match: '(?=\S)' + set: value + value-condition-after: + - match: ':' + scope: keyword.operator.ternary.d + set: value + - include: not-whitespace-illegal-pop + value-parens-after: + - match: '\)' + scope: punctuation.section.parens.end.d + set: value-after + - include: not-whitespace-illegal-pop + value-call-parens-after: + - meta_scope: meta.function-call.d + - include: value-parens-after + value-bracket-after: + - match: '\]' + scope: punctuation.section.brackets.end.d + set: value-after + - include: not-whitespace-illegal-pop + + value-list: + - match: '(?=\)|}|]|;|:)' + pop: true + - match: '(?=\S)' + set: [value-list-after, value] + value-list-after: + - match: '(?=\)|}|]|;|:)' + pop: true + - match: ',' + scope: punctuation.separator.sequence.d + set: value-list + - include: not-whitespace-illegal-pop + + value-array-list: + - match: '(?=\])' + pop: true + - match: '(?=\S)' + set: [value-array-list-after, value] + value-array-list-after: + - match: ':' + scope: punctuation.separator.mapping.key-value.d + set: [value-array-list-after-value, value] + - include: value-array-list-after-value + value-array-list-after-value: + - match: '(?=\])' + pop: true + - match: ',' + scope: punctuation.separator.sequence.d + set: value-array-list + - include: not-whitespace-illegal-pop + + alias-in: + - match: '\b(alias)\b(?=[^;]*\bthis\s*;)' + scope: keyword.control.alias.d + push: [alias-this-after, identifier] + - match: '\b(alias)\b' + scope: keyword.control.alias.d push: - - meta_scope: comment.block.d - - match: \*/ - scope: punctuation.definition.comment.d + - match: '{{type_qualifier_lookahead}}' + set: [alias-old, type] + - match: '\b({{name}})\s*(?=\(|=)' + captures: + 1: entity.name.type.d + set: alias-new + - match: (?=\S) + set: [alias-old, type] + alias-this-after: + - match: \b(this)\b + scope: keyword.control.alias.d + set: expect-end-of-line + - include: not-whitespace-illegal-pop + alias-old: + - match: '\b({{name}})\b' + scope: entity.name.type.d + set: + - match: ',' + scope: punctuation.separator.sequence.d + set: alias-old + - include: expect-end-of-line + - include: not-whitespace-illegal-pop + alias-new: + - match: '(?=\()' + push: function-argument-definition-list + - match: '(?==)' + set: alias-new-assign + - include: not-whitespace-illegal-pop + alias-new-assign: + - match: '=' + scope: keyword.operator.assignment.d + set: [alias-new-after-type, value] + - include: not-whitespace-illegal-pop + alias-new-after-type: + - match: ',' + scope: punctuation.separator.sequence.d + set: + - match: '\b{{name}}\b' + scope: entity.name.type.d + set: alias-new + - include: not-whitespace-illegal-pop + - include: expect-end-of-line + + class-in: + - match: '\b(class)\b' + scope: storage.type.class.d keyword.declaration.class.d + push: [meta-class, class-name] + class-name: + - match: '\b({{name}})\b' + scope: entity.name.class.d + set: + - match: '(?=\()' + set: [class-after, function-argument-definition-list] + - match: '(?=\S)' + set: class-after + - include: not-whitespace-illegal-pop + class-after: + - include: end-of-line + - match: ':' + scope: punctuation.separator.mapping.d + set: [optional-template-body-block, base-class-list] + - match: '(?=\S)' + set: optional-template-body-block + + base-class-list: + - match: '' + set: [base-class-list-after, basic-type] + base-class-list-after: + - match: ',' + scope: punctuation.separator.sequence.d + set: base-class-list + - match: '(?={)' + pop: true + - include: not-whitespace-illegal-pop + + interface-in: + - match: '\b(interface)\b' + scope: storage.type.interface.d keyword.declaration.interface.d + push: [meta-interface, interface-name] + interface-name: + - match: '\b({{name}})\b' + scope: entity.name.interface.d + set: + - match: '(?=\()' + set: [interface-after, function-argument-definition-list] + - match: '(?=\S)' + set: interface-after + - include: not-whitespace-illegal-pop + interface-after: + - match: ':' + scope: punctuation.separator.mapping.d + set: [optional-template-body-block, base-class-list] + - match: '(?={)' + set: optional-template-body-block + - include: expect-end-of-line + + struct-in: + - match: '\b(struct)\b' + scope: storage.type.struct.d keyword.declaration.struct.d + push: [meta-struct, struct-name] + struct-name: + - match: '\b({{name}})\b' + scope: entity.name.struct.d + set: + - match: '(?=\()' + set: [optional-template-body-block, function-argument-definition-list] + - match: '(?=\S)' + set: optional-template-body-block + - match: '(?={)' + set: optional-template-body-block + - include: not-whitespace-illegal-pop + + union-in: + - match: '\b(union)\b' + scope: storage.type.union.d keyword.declaration.union.d + push: [meta-union, union-name] + union-name: + - match: '\b({{name}})\b' + scope: entity.name.union.d + set: + - match: '(?=\()' + set: [optional-template-body-block, function-argument-definition-list] + - match: '(?=\S)' + set: optional-template-body-block + - match: '(?={)' + set: optional-template-body-block + - include: not-whitespace-illegal-pop + + enum-in: + - match: '\b(enum)\b' + scope: storage.type.enum.d keyword.declaration.enum.d + push: [meta-enum, enum-after-kw] + enum-after-kw: + - match: '(?=\b({{basic_type}})\b)' + push: type + - match: '{{type_qualifier_lookahead}}' + push: type + - match: '\b({{name}})(?=\s*({|:|=|\(|;|$))\b' + scope: entity.name.enum.d + set: enum-after + - match: ':' + scope: punctuation.separator.mapping.d + set: [enum-body, type] + - match: '(?={)' + set: anonymous-enum-body + - match: '(?=\S)' + push: type + enum-after: + - match: '(?={)' + set: enum-body + - match: ':' + scope: punctuation.separator.mapping.d + set: [enum-body, type] + - match: '(?==|\()' + set: enum-assignment + - match: '\b({{name}})\b' + scope: entity.name.enum.d + - include: expect-end-of-line + + enum-body: + - match: '{' + scope: punctuation.section.block.begin.d + set: + - match: '}' + scope: punctuation.section.block.end.d pop: true - - match: /\+ - scope: punctuation.definition.comment.d - push: - - meta_scope: comment.block.nested.d - - match: \+/ - scope: punctuation.definition.comment.d + - match: '(?=\b({{name}})\b)' + push: enum-member + - include: not-whitespace-illegal + - include: expect-end-of-line + + enum-assignment: + - match: '=' + scope: keyword.operator.assignment.d + set: [enum-assignment-after, value] + - match: '(?=\()' + push: function-argument-definition-list + - include: not-whitespace-illegal-pop + enum-assignment-after: + - match: ',' + scope: punctuation.separator.sequence.d + set: + - match: '\b({{name}})\b' + scope: entity.name.enum.d + set: enum-assignment + - include: not-whitespace-illegal-pop + - include: expect-end-of-line + + anonymous-enum-body: + - match: '{' + scope: punctuation.section.block.begin.d + set: + - match: '}' + scope: punctuation.section.block.end.d pop: true - - match: (//).*$\n? - scope: comment.line.double-slash.d + - include: attribute-in + - match: '(?=\b({{name}})\s*(=|,|}|/|$))' + push: enum-member + - match: '(?=\S)' + push: [enum-member, type] + - include: not-whitespace-illegal-pop + + enum-member: + - match: '\b({{name}})\b' + scope: entity.name.constant.d + set: + - match: '=' + scope: keyword.operator.assignment.d + set: [enum-member-after, value] + - match: ',' + scope: punctuation.separator.sequence.d + pop: true + - match: '(?=})' + pop: true + - include: not-whitespace-illegal-pop + - include: not-whitespace-illegal-pop + enum-member-after: + - match: ',' + scope: punctuation.separator.sequence.d + pop: true + - match: '(?=})' + pop: true + - include: not-whitespace-illegal-pop + + conditional-declaration-in: + - match: '\bversion\b' + scope: keyword.control.conditional.d + push: version-condition + - match: '\bdebug\b' + scope: keyword.control.conditional.d + push: debug-condition + conditional-declaration-after-parens: + - match: '\)' + scope: punctuation.section.parens.end.d + set: optional-block-statement-or-label + - include: not-whitespace-illegal-pop + conditional-declaration-assignment: + - match: '\b{{name}}\b' + scope: entity.name.constant.d + set: expect-end-of-line + - match: '{{integer_lookahead}}' + set: [expect-end-of-line, integer] + - include: not-whitespace-illegal-pop + version-condition: + - match: '\(' + scope: punctuation.section.parens.begin.d + set: + - match: \bunittest\b + scope: keyword.control.conditional.d + set: conditional-declaration-after-parens + - match: \bassert\b + scope: keyword.other.assert.d + set: conditional-declaration-after-parens + - match: '\b({{name}})\b' + scope: constant.other.d + set: conditional-declaration-after-parens + - match: '{{integer_lookahead}}' + set: [conditional-declaration-after-parens, integer] + - include: not-whitespace-illegal + - match: '=' + scope: keyword.operator.assignment.d + set: conditional-declaration-assignment + - include: not-whitespace-illegal-pop + debug-condition: + - match: '\(' + scope: punctuation.section.parens.begin.d + set: + - match: '\b({{name}})\b' + scope: constant.other.d + set: conditional-declaration-after-parens + - match: '{{integer_lookahead}}' + set: [conditional-declaration-after-parens, integer] + - include: not-whitespace-illegal + - match: '=' + scope: keyword.operator.assignment.d + set: conditional-declaration-assignment + - match: '(?=\S)' + set: optional-block-statement-or-label + + static-foreach-in: + - match: '\b(static)\s+(foreach|foreach_reverse)\b' captures: - 1: punctuation.definition.comment.d - constant_placeholder: - - match: '(?i:%(\([a-z_]+\))?#?0?\-?[ ]?\+?([0-9]*|\*)(\.([0-9]*|\*))?[hL]?[a-z%])' - scope: constant.other.placeholder.d - function_assertions: - - match: '(in|out)\s*(?=\{)' + 1: keyword.control.loop.d + 2: keyword.control.loop.d + push: [optional-block-statement, foreach-arguments] + + static-assert-in: + - match: '\b(static)\s+(assert)\b' + captures: + 1: keyword.other.assert.d + 2: keyword.other.assert.d + push: [expect-end-of-line, assert-arguments] + + constructions-in: + - match: '{{construction_lookahead}}' + push: construction + construction: + # Post-blit constructor + - match: '\b(this)\s*(\()\s*(this)\s*(\))' + captures: + 1: meta.function.d entity.name.function.post-blit.d + 2: meta.function.parameters.d punctuation.section.group.begin.d + 3: meta.function.parameters.d variable.language.d + 4: meta.function.parameters.d punctuation.section.group.end.d + set: function-definition-after-arguments + - match: '\b(this)\s*(?=\(|$)' captures: - 1: keyword.control.statement.d + 1: meta.function.d entity.name.function.constructor.d + 2: punctuation.section.group.begin.d + set: constructor-argument-list + - match: '~\s*this' + scope: meta.function.d entity.name.function.destructor.d + set: destructor-arguments + - include: not-whitespace-illegal-pop + # This could either be function/template parameters or arguments. Assume + # arguments and switch to parameters when possible + constructor-argument-list: + - meta_scope: meta.function.parameters.d + - match: '\(' + scope: punctuation.section.group.begin.d + set: + - meta_scope: meta.function.parameters.d + - match: '\)' + scope: punctuation.section.group.end.d + set: function-definition-after-first-argument-list + - match: '{{parameter_attribute_lookahead}}' + set: [function-definition-after-first-argument-list, meta-function-parameters, function-argument-definition-list-content] + - match: '(?=\S)' + set: [constructor-argument-list-after-value, value] + - include: not-whitespace-illegal-pop + constructor-argument-list-after-value: + - meta_scope: meta.function.parameters.d + - match: ',' + scope: punctuation.separator.sequence.d + set: [constructor-argument-list-after-value, value] + - match: '\)' + scope: punctuation.section.group.end.d + set: function-definition-after-first-argument-list + - match: '(?=\S)' + set: [function-definition-after-first-argument-list, meta-function-parameters, function-argument] + destructor-arguments: + - match: '\(' + scope: meta.function.parameters.d punctuation.section.group.begin.d + set: + - meta_scope: meta.function.parameters.d + - match: '\)' + scope: punctuation.section.group.end.d + set: function-definition-after-arguments + - include: not-whitespace-illegal-pop + - include: not-whitespace-illegal-pop + + invariant-in: + - match: '\b(invariant)\b' + scope: keyword.other.invariant.d push: - - match: '\{' # Push onto the stack for blocks so that } pops functions/methods/classes properly - push: - - meta_scope: meta.block.d - - match: '\}' - pop: true - - include: $top_level_main - - match: (in|out) - scope: keyword.control.statement.d - - match: (?=body|do) + - match: '(?=\()' + set: [invariant-block, assert-arguments] + - match: '(?={)' + set: invariant-block + - include: not-whitespace-illegal-pop + invariant-block: + - match: '{' + scope: punctuation.section.block.begin.d + set: + - match: '}' + scope: punctuation.section.block.end.d pop: true - - match: '(?<=\})' - pop: true - regular_expressions: - - include: scope:source.regexp.python - statement-remainder: - - match: \( + - include: statement-list-in + - include: expect-end-of-line + + unittest-in: + - match: '\b(unittest)\b' + scope: keyword.control.conditional.d push: - - meta_scope: meta.definition.param-list.d - - match: (?=\)) - pop: true - - include: all-types - - match: (throws) + - match: '(?={)' + set: block-statement + - include: attribute-in + - include: not-whitespace-illegal-pop + + template-in: + - match: '\b(template)\b' + scope: storage.type.d keyword.declaration.template.d + push: template + template: + - match: '\b({{name}})\b' + scope: entity.name.template.d + set: template-definition-begin + - include: not-whitespace-illegal-pop + template-definition-begin: + - match: '(?=\()' + set: [optional-template-body-block, function-argument-definition-list] + - include: not-whitespace-illegal-pop + + mixin-in: + - match: '\b(mixin)\s+(template)\b' + captures: + 1: keyword.control.d + 2: storage.type.d keyword.declaration.template.d + push: template + - match: '\b(mixin)(?!\s*\()' + scope: keyword.control.d + push: [mixin-after, value] + mixin-after: + - match: '\b({{name}})\b' + scope: variable.other.d + set: expect-end-of-line + - include: expect-end-of-line + + statement-label-in: + - match: '\b({{name}})\s*(:)' captures: - 1: keyword.other.class-fns.d + 1: entity.name.label.d + 2: punctuation.separator.d + + conditional-in: + - match: '\bif\b' + scope: keyword.control.conditional.d + push: [optional-block-statement-or-label, condition] + - match: '\belse\b' + scope: keyword.control.conditional.d + push: optional-block-statement-or-label + + loop-in: + - match: '\bwhile\b' + scope: keyword.control.loop.d + push: [optional-block-statement, condition] + - match: '\bdo\b' + scope: keyword.control.loop.d + push: optional-block-statement + - match: '\bfor\b' + scope: keyword.control.loop.d + push: [optional-block-statement, for-arguments] + - match: '\b(foreach|foreach_reverse)\b' + scope: keyword.control.loop.d + push: [optional-block-statement, foreach-arguments] + + flow-statement-in: + - match: '\b(continue|break)\b' + scope: keyword.control.flow.d push: - - meta_scope: meta.definition.throws.d - - match: "(?={)" - captures: - 1: keyword.other.class-fns.d - pop: true - - include: all-types - storage-type-d: - - match: '\b(void|byte|short|char|int|long|float|double|boolean|([a-z]\w+\.)*[A-Z]\w+(?![\(\.]))\b' - scope: storage.type.d - string_escaped_char: - - match: '\\(\\|[abefnprtv''"?]|[0-3]\d{,2}|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8}|&\w+;)' - scope: constant.character.escape.d - - match: \\. - scope: invalid.illegal.unknown-escape.d - strings: - - match: '"' - scope: punctuation.definition.string.begin.d + - match: \b{{name}}\b + scope: variable.other.constant.d + set: expect-end-of-line + - include: expect-end-of-line + - match: '\breturn\b' + scope: keyword.control.flow.d + push: + - include: end-of-line + - match: '(?=\S)' + set: [expect-end-of-line, value] + - match: '\bgoto\b' + scope: keyword.control.flow.d + push: + - match: '\bdefault\b' + scope: keyword.control.flow.d + set: expect-end-of-line + - match: '\bcase\b' + scope: keyword.control.flow.d + set: + - include: end-of-line + - match: '(?=\S)' + set: [expect-end-of-line, value] + - match: '\b{{name}}\b' + scope: variable.other.constant.d + set: expect-end-of-line + - include: not-whitespace-illegal-pop + + with-in: + - match: '\bwith\b' + scope: keyword.other.with.d + push: + - match: '\(' + scope: punctuation.section.parens.begin.d + set: [with-after, value] + - include: not-whitespace-illegal-pop + with-after: + - match: '\)' + scope: punctuation.section.parens.end.d + set: optional-block-statement + - include: not-whitespace-illegal-pop + + synchronized-in: + - match: '\bsynchronized\b' + scope: keyword.other.synchronized.d push: - - meta_scope: string.quoted.double.d - - match: '"' - scope: punctuation.definition.string.end.d + - match: '\(' + scope: punctuation.section.parens.begin.d + set: [synchronized-after, value] + - match: '(?=\S)' + set: optional-block-statement + synchronized-after: + - match: '\)' + scope: punctuation.section.parens.end.d + set: optional-block-statement + - include: not-whitespace-illegal-pop + + try-in: + - match: '\btry\b' + scope: keyword.control.exception.d + push: optional-block-statement + - match: '\bcatch\b' + scope: keyword.control.exception.d + push: [optional-block-statement, catch-arguments] + - match: '\bfinally\b' + scope: keyword.control.exception.d + push: optional-block-statement + catch-arguments: + - match: '\(' + scope: punctuation.section.parens.begin.d + set: [catch-arguments-after, type] + - include: not-whitespace-illegal-pop + catch-arguments-after: + - match: '\b{{name}}\b' + scope: variable.parameter.d + set: + - match: '\)' + scope: punctuation.section.parens.end.d pop: true - - include: string_escaped_char - - match: (r)(") + - include: not-whitespace-illegal-pop + - match: '\)' + scope: punctuation.section.parens.end.d + pop: true + - include: not-whitespace-illegal-pop + + throw-in: + - match: '\bthrow\b' + scope: keyword.control.flow.exception.d + push: [expect-end-of-line, value] + + scope-in: + - match: '\b(scope)\s*(\()\s*(exit|success|failure)\s*(\))' captures: - 1: storage.type.string.d - 2: punctuation.definition.string.begin.d + 1: keyword.control.flow.d + 2: punctuation.section.parens.begin.d + 3: keyword.control.flow.d + 4: punctuation.section.parens.end.d + push: optional-block-statement + + asm-in: + - match: '\basm\b' + scope: keyword.declaration.asm.d push: - - meta_scope: string.quoted.double.raw.d - - match: ((?<=")(")|") - captures: - 1: punctuation.definition.string.end.d - 2: meta.empty-string.double.d - pop: true - - include: regular_expressions - - match: "`" - scope: punctuation.definition.string.begin.d + - include: attribute-in + - match: '{' + scope: punctuation.section.block.begin.d + set: + - match: '}' + scope: punctuation.section.block.end.d + pop: true + - include: tokens-in + - include: not-whitespace-illegal-pop + + switch-in: + - match: '\bswitch\b' + scope: keyword.control.flow.d push: - - meta_scope: string.quoted.double.raw.backtick.d - - match: ((?<=`)(`)|`) - captures: - 1: punctuation.definition.string.end.d - 2: meta.empty-string.double.d - pop: true - - match: "'" - scope: punctuation.definition.string.begin.d + - match: '\(' + scope: punctuation.section.parens.begin.d + set: [switch-after, value] + - match: '\bcase\b' + scope: keyword.control.flow.d + push: [case-after, value-list] + - match: '\bdefault\b' + scope: keyword.control.flow.d push: - - meta_scope: string.quoted.single.d - - match: "'" - scope: punctuation.definition.string.end.d - pop: true - - include: string_escaped_char - support-type-built-ins-classes-d: - - match: \b(AbstractServer|ArchiveMember|ArgParser|Barrier|BomSniffer|Buffer|BufferInput|BufferOutput|BufferSlice|BufferedFile|BufferedStream|BzipInput|BzipOutput|CFile|CacheInvalidatee|CacheInvalidator|CacheServer|CacheThread|Certificate|CertificateStore|CertificateStoreCtx|ChunkInput|ChunkOutput|ClassInfo|Cluster|ClusterCache|ClusterQueue|ClusterThread|CmdParser|ComObject|Compress|Condition|Conduit|Cookie|CookieParser|CookieStack|CounterInput|CounterOutput|DataFileInput|DataFileOutput|DataInput|DataOutput|Database|DatagramConduit|DeviceConduit|DigestInput|DigestOutput|DocPrinter|Document|DummyInputStream|DummyOutputStream|EndianInput|EndianOutput|EndianProtocol|EndianStream|EventSeekInputStream|EventSeekOutputStream|FTPConnection|Fiber|Field|File|FileConduit|FileFolder|FileGroup|FileInput|FileOutput|FilePath|FileScan|FilterStream|Foo|FormatOutput|GreedyInput|GreedyOutput|Gregorian|GrowBuffer|HeapCopy|HeapSlice|Hierarchy|HttpClient|HttpCookies|HttpCookiesView|HttpGet|HttpHeaders|HttpHeadersView|HttpParams|HttpPost|HttpStack|HttpTokens|HttpTriplet|IPv4Address|IUnknown|InputFilter|InternetAddress|InternetHost|Layout|LineInput|LineIterator|LinkedFolder|Log|MapInput|MapOutput|MappedBuffer|Md2|Md4|MemoryQueue|MemoryStream|MmFile|MmFileStream|ModuleInfo|MulticastConduit|Mutex|NativeProtocol|NetCall|NetHost|NetworkAlert|NetworkCache|NetworkCall|NetworkClient|NetworkCombo|NetworkMessage|NetworkQueue|NetworkRegistry|NetworkTask|NotImplemented|Object|Observer|OutBuffer|OutputFilter|PersistQueue|Pipe|PipeConduit|Print|PrivateKey|Process|Properties|Protocol|ProtocolReader|ProtocolWriter|PublicKey|PullParser|QueueFile|QueueServer|QueueThread|QueuedCache|QuoteIterator|Random|Range|ReadWriteMutex|Reader|Record|RegExp|RegExpT|RegexIterator|RollCall|SSLCtx|SSLServerSocket|SSLSocketConduit|SaxParser|SelectionKey|Semaphore|ServerSocket|ServerThread|Service|SimpleIterator|SliceInputStream|SliceSeekInputStream|SliceSeekOutputStream|SliceStream|SnoopInput|SnoopOutput|Socket|SocketConduit|SocketListener|SocketSet|SocketStream|Sprint|Stream|StreamIterator|TArrayStream|TaskServer|TaskThread|TcpSocket|Telnet|TempFile|Text|TextFileInput|TextFileOutput|TextView|Thread|ThreadGroup|ThreadLocal|ThreadPool|Token|TypeInfo|TypeInfo_AC|TypeInfo_Aa|TypeInfo_Ab|TypeInfo_Ac|TypeInfo_Ad|TypeInfo_Ae|TypeInfo_Af|TypeInfo_Ag|TypeInfo_Ah|TypeInfo_Ai|TypeInfo_Aj|TypeInfo_Ak|TypeInfo_Al|TypeInfo_Am|TypeInfo_Ao|TypeInfo_Ap|TypeInfo_Aq|TypeInfo_Ar|TypeInfo_Array|TypeInfo_As|TypeInfo_AssociativeArray|TypeInfo_At|TypeInfo_Au|TypeInfo_Av|TypeInfo_Aw|TypeInfo_C|TypeInfo_Class|TypeInfo_D|TypeInfo_Delegate|TypeInfo_Enum|TypeInfo_Function|TypeInfo_Interface|TypeInfo_P|TypeInfo_Pointer|TypeInfo_StaticArray|TypeInfo_Struct|TypeInfo_Tuple|TypeInfo_Typedef|TypeInfo_a|TypeInfo_b|TypeInfo_c|TypeInfo_d|TypeInfo_e|TypeInfo_f|TypeInfo_g|TypeInfo_h|TypeInfo_i|TypeInfo_j|TypeInfo_k|TypeInfo_l|TypeInfo_m|TypeInfo_o|TypeInfo_p|TypeInfo_q|TypeInfo_r|TypeInfo_s|TypeInfo_t|TypeInfo_u|TypeInfo_v|TypeInfo_w|TypedInput|TypedOutput|URIerror|UdpSocket|UnCompress|UniText|UnicodeBom|UnicodeFile|UnknownAddress|Uri|UtfInput|UtfOutput|VirtualFolder|WrapSeekInputStream|WrapSeekOutputStream|Writer|XmlPrinter|ZipArchive|ZipBlockReader|ZipBlockWriter|ZipEntry|ZipEntryVerifier|ZipFile|ZipFileGroup|ZipFolder|ZipSubFolder|ZipSubFolderEntry|ZipSubFolderGroup|ZlibInput|ZlibOutput)\b - scope: support.type.built-ins.classes.d - support-type-built-ins-d: - - include: support-type-built-ins-exceptions-d - - include: support-type-built-ins-classes-d - - include: support-type-built-ins-interfaces-d - - include: support-type-built-ins-structs-d - support-type-built-ins-exceptions-d: - - match: \b(AddressException|ArrayBoundsError|ArrayBoundsException|AssertError|AssertException|Base64CharException|Base64Exception|BzipClosedException|BzipException|ClusterEmptyException|ClusterFullException|ConvError|ConvOverflowError|ConversionException|CorruptedIteratorException|DatabaseException|DateParseError|Exception|FTPException|FiberException|FileException|FinalizeException|FormatError|HostException|IOException|IllegalArgumentException|IllegalElementException|InvalidKeyException|InvalidTypeException|LocaleException|ModuleCtorError|NoSuchElementException|OpenException|OpenRJException|OutOfMemoryException|PlatformException|ProcessCreateException|ProcessException|ProcessForkException|ProcessKillException|ProcessWaitException|ReadException|RegExpException|RegexException|RegistryException|SeekException|SharedLibException|SocketAcceptException|SocketException|StdioException|StreamException|StreamFileException|StringException|SwitchError|SwitchException|SyncException|TextException|ThreadError|ThreadException|UnboxException|UnicodeException|UtfException|VariantTypeMismatchException|Win32Exception|WriteException|XmlException|ZipChecksumException|ZipException|ZipExhaustedException|ZipNotSupportedException|ZlibClosedException|ZlibException|OurUnwindException|SysError)\b - scope: support.type.built-ins.exceptions.d - support-type-built-ins-interfaces-d: - - match: \b(Buffered|HttpParamsView|ICache|IChannel|IClassFactory|ICluster|IConduit|IConsumer|IEvent|IHierarchy|ILevel|IListener|IMessage|IMessageLoader|IOStream|IReadable|ISelectable|ISelectionSet|ISelector|IServer|IUnknown|IWritable|IXmlPrinter|InputStream|OutputStream|PathView|VfsFile|VfsFiles|VfsFolder|VfsFolderEntry|VfsFolders|VfsHost|VfsSync|ZipReader|ZipWriter)\b - scope: support.type.built-ins.interfaces.d - support-type-built-ins-structs-d: - - match: \b(ABC|ABCFLOAT|ACCEL|ACCESSTIMEOUT|ACCESS_ALLOWED_ACE|ACCESS_DENIED_ACE|ACE_HEADER|ACL|ACL_REVISION_INFORMATION|ACL_SIZE_INFORMATION|ACTION_HEADER|ADAPTER_STATUS|ADDJOB_INFO_1|ANIMATIONINFO|APPBARDATA|Argument|Atomic|Attribute|BITMAP|BITMAPCOREHEADER|BITMAPCOREINFO|BITMAPINFO|BITMAPINFOHEADER|BITMAPV4HEADER|BLOB|BROWSEINFO|BY_HANDLE_FILE_INFORMATION|Bar|Baz|BitArray|Box|BracketResult|ByteSwap|CANDIDATEFORM|CANDIDATELIST|CBTACTIVATESTRUCT|CBT_CREATEWND|CHARFORMAT|CHARRANGE|CHARSET|CHARSETINFO|CHAR_INFO|CIDA|CIEXYZ|CIEXYZTRIPLE|CLIENTCREATESTRUCT|CMINVOKECOMMANDINFO|COLORADJUSTMENT|COLORMAP|COMMCONFIG|COMMPROP|COMMTIMEOUTS|COMPAREITEMSTRUCT|COMPCOLOR|COMPOSITIONFORM|COMSTAT|CONNECTDLGSTRUCT|CONSOLE_CURSOR_INFO|CONTEXT|CONVCONTEXT|CONVINFO|COORD|COPYDATASTRUCT|CPINFO|CPLINFO|CREATESTRUCT|CREATE_PROCESS_DEBUG_INFO|CREATE_THREAD_DEBUG_INFO|CRITICAL_SECTION|CRITICAL_SECTION_DEBUG|CURRENCYFMT|CURSORSHAPE|CWPRETSTRUCT|CWPSTRUCT|CharClass|CharRange|Clock|CodePage|Console|DATATYPES_INFO_1|DCB|DDEACK|DDEADVISE|DDEDATA|DDELN|DDEML_MSG_HOOK_DATA|DDEPOKE|DDEUP|DEBUGHOOKINFO|DEBUG_EVENT|DELETEITEMSTRUCT|DEVMODE|DEVNAMES|DEV_BROADCAST_HDR|DEV_BROADCAST_OEM|DEV_BROADCAST_PORT|DEV_BROADCAST_VOLUME|DIBSECTION|DIR|DISCDLGSTRUCT|DISK_GEOMETRY|DISK_PERFORMANCE|DOCINFO|DOC_INFO_1|DOC_INFO_2|DRAGLISTINFO|DRAWITEMSTRUCT|DRAWTEXTPARAMS|DRIVER_INFO_1|DRIVER_INFO_2|DRIVER_INFO_3|DRIVE_LAYOUT_INFORMATION|Date|DateParse|DateTime|DirEntry|DynArg|EDITSTREAM|EMPTYRECORD|EMR|EMRABORTPATH|EMRANGLEARC|EMRARC|EMRBITBLT|EMRCREATEBRUSHINDIRECT|EMRCREATECOLORSPACE|EMRCREATEDIBPATTERNBRUSHPT|EMRCREATEMONOBRUSH|EMRCREATEPALETTE|EMRCREATEPEN|EMRELLIPSE|EMREOF|EMREXCLUDECLIPRECT|EMREXTCREATEFONTINDIRECTW|EMREXTCREATEPEN|EMREXTFLOODFILL|EMREXTSELECTCLIPRGN|EMREXTTEXTOUTA|EMRFILLPATH|EMRFILLRGN|EMRFORMAT|EMRFRAMERGN|EMRGDICOMMENT|EMRINVERTRGN|EMRLINETO|EMRMASKBLT|EMRMODIFYWORLDTRANSFORM|EMROFFSETCLIPRGN|EMRPLGBLT|EMRPOLYDRAW|EMRPOLYDRAW16|EMRPOLYLINE|EMRPOLYLINE16|EMRPOLYPOLYLINE|EMRPOLYPOLYLINE16|EMRPOLYTEXTOUTA|EMRRESIZEPALETTE|EMRRESTOREDC|EMRROUNDRECT|EMRSCALEVIEWPORTEXTEX|EMRSELECTCLIPPATH|EMRSELECTCOLORSPACE|EMRSELECTOBJECT|EMRSELECTPALETTE|EMRSETARCDIRECTION|EMRSETBKCOLOR|EMRSETCOLORADJUSTMENT|EMRSETDIBITSTODEVICE|EMRSETMAPPERFLAGS|EMRSETMITERLIMIT|EMRSETPALETTEENTRIES|EMRSETPIXELV|EMRSETVIEWPORTEXTEX|EMRSETVIEWPORTORGEX|EMRSETWORLDTRANSFORM|EMRSTRETCHBLT|EMRSTRETCHDIBITS|EMRTEXT|ENCORRECTTEXT|ENDROPFILES|ENHMETAHEADER|ENHMETARECORD|ENOLEOPFAILED|ENPROTECTED|ENSAVECLIPBOARD|ENUMLOGFONT|ENUMLOGFONTEX|ENUM_SERVICE_STATUS|EVENTLOGRECORD|EVENTMSG|EXCEPTION_DEBUG_INFO|EXCEPTION_POINTERS|EXCEPTION_RECORD|EXIT_PROCESS_DEBUG_INFO|EXIT_THREAD_DEBUG_INFO|EXTLOGFONT|EXTLOGPEN|EXT_BUTTON|EmptySlot|EndOfCDRecord|Environment|FILETIME|FILTERKEYS|FINDREPLACE|FINDTEXTEX|FIND_NAME_BUFFER|FIND_NAME_HEADER|FIXED|FLOATING_SAVE_AREA|FMS_GETDRIVEINFO|FMS_GETFILESEL|FMS_LOAD|FMS_TOOLBARLOAD|FOCUS_EVENT_RECORD|FONTSIGNATURE|FORMATRANGE|FORMAT_PARAMETERS|FORM_INFO_1|FileConst|FileHeader|FileRoots|FileSystem|FoldingCaseData|Foo|FtpConnectionDetail|FtpFeature|FtpFileInfo|FtpResponse|GC|GCP_RESULTS|GCStats|GENERIC_MAPPING|GLYPHMETRICS|GLYPHMETRICSFLOAT|GROUP_INFO_2|GUID|HANDLETABLE|HD_HITTESTINFO|HD_ITEM|HD_LAYOUT|HD_NOTIFY|HELPINFO|HELPWININFO|HIGHCONTRAST|HSZPAIR|HeaderElement|HttpConst|HttpHeader|HttpHeaderName|HttpResponses|HttpStatus|HttpToken|ICONINFO|ICONMETRICS|IMAGEINFO|IMAGE_DOS_HEADER|INPUT_RECORD|ITEMIDLIST|IeeeFlags|Interface|JOB_INFO_1|JOB_INFO_2|KERNINGPAIR|LANA_ENUM|LAYERPLANEDESCRIPTOR|LDT_ENTRY|LIST_ENTRY|LOAD_DLL_DEBUG_INFO|LOCALESIGNATURE|LOCALGROUP_INFO_0|LOCALGROUP_MEMBERS_INFO_0|LOCALGROUP_MEMBERS_INFO_3|LOGBRUSH|LOGCOLORSPACE|LOGFONT|LOGFONTA|LOGFONTW|LOGPALETTE|LOGPEN|LUID_AND_ATTRIBUTES|LV_COLUMN|LV_DISPINFO|LV_FINDINFO|LV_HITTESTINFO|LV_ITEM|LV_KEYDOWN|LocalFileHeader|MAT2|MD5_CTX|MDICREATESTRUCT|MEASUREITEMSTRUCT|MEMORYSTATUS|MEMORY_BASIC_INFORMATION|MENUEX_TEMPLATE_HEADER|MENUEX_TEMPLATE_ITEM|MENUITEMINFO|MENUITEMTEMPLATE|MENUITEMTEMPLATEHEADER|MENUTEMPLATE|MENU_EVENT_RECORD|METAFILEPICT|METARECORD|MINIMIZEDMETRICS|MINMAXINFO|MODEMDEVCAPS|MODEMSETTINGS|MONCBSTRUCT|MONCONVSTRUCT|MONERRSTRUCT|MONHSZSTRUCT|MONITOR_INFO_1|MONITOR_INFO_2|MONLINKSTRUCT|MONMSGSTRUCT|MOUSEHOOKSTRUCT|MOUSEKEYS|MOUSE_EVENT_RECORD|MSG|MSGBOXPARAMS|MSGFILTER|MULTIKEYHELP|NAME_BUFFER|NCB|NCCALCSIZE_PARAMS|NDDESHAREINFO|NETCONNECTINFOSTRUCT|NETINFOSTRUCT|NETRESOURCE|NEWCPLINFO|NEWTEXTMETRIC|NEWTEXTMETRICEX|NMHDR|NM_LISTVIEW|NM_TREEVIEW|NM_UPDOWNW|NONCLIENTMETRICS|NS_SERVICE_INFO|NUMBERFMT|OFNOTIFY|OFSTRUCT|OPENFILENAME|OPENFILENAMEA|OPENFILENAMEW|OSVERSIONINFO|OUTLINETEXTMETRIC|OUTPUT_DEBUG_STRING_INFO|OVERLAPPED|OffsetTypeInfo|PAINTSTRUCT|PALETTEENTRY|PANOSE|PARAFORMAT|PARTITION_INFORMATION|PERF_COUNTER_BLOCK|PERF_COUNTER_DEFINITION|PERF_DATA_BLOCK|PERF_INSTANCE_DEFINITION|PERF_OBJECT_TYPE|PIXELFORMATDESCRIPTOR|POINT|POINTFLOAT|POINTFX|POINTL|POINTS|POLYTEXT|PORT_INFO_1|PORT_INFO_2|PREVENT_MEDIA_REMOVAL|PRINTER_DEFAULTS|PRINTER_INFO_1|PRINTER_INFO_2|PRINTER_INFO_3|PRINTER_INFO_4|PRINTER_INFO_5|PRINTER_NOTIFY_INFO|PRINTER_NOTIFY_INFO_DATA|PRINTER_NOTIFY_OPTIONS|PRINTER_NOTIFY_OPTIONS_TYPE|PRINTPROCESSOR_INFO_1|PRIVILEGE_SET|PROCESS_HEAPENTRY|PROCESS_INFORMATION|PROPSHEETHEADER|PROPSHEETHEADER_U1|PROPSHEETHEADER_U2|PROPSHEETHEADER_U3|PROPSHEETPAGE|PROPSHEETPAGE_U1|PROPSHEETPAGE_U2|PROTOCOL_INFO|PROVIDOR_INFO_1|PSHNOTIFY|PUNCTUATION|PassByCopy|PassByRef|Phase1Info|PropertyConfigurator|QUERY_SERVICE_CONFIG|QUERY_SERVICE_LOCK_STATUS|RASAMB|RASCONN|RASCONNSTATUS|RASDIALEXTENSIONS|RASDIALPARAMS|RASENTRYNAME|RASPPPIP|RASPPPIPX|RASPPPNBF|RASTERIZER_STATUS|REASSIGN_BLOCKS|RECT|RECTL|REMOTE_NAME_INFO|REPASTESPECIAL|REQRESIZE|RGBQUAD|RGBTRIPLE|RGNDATA|RGNDATAHEADER|RIP_INFO|Runtime|SCROLLINFO|SECURITY_ATTRIBUTES|SECURITY_DESCRIPTOR|SECURITY_QUALITY_OF_SERVICE|SELCHANGE|SERIALKEYS|SERVICE_ADDRESS|SERVICE_ADDRESSES|SERVICE_INFO|SERVICE_STATUS|SERVICE_TABLE_ENTRY|SERVICE_TYPE_INFO_ABS|SERVICE_TYPE_VALUE_ABS|SESSION_BUFFER|SESSION_HEADER|SET_PARTITION_INFORMATION|SHFILEINFO|SHFILEOPSTRUCT|SHITEMID|SHNAMEMAPPING|SID|SID_AND_ATTRIBUTES|SID_IDENTIFIER_AUTHORITY|SINGLE_LIST_ENTRY|SIZE|SMALL_RECT|SOUNDSENTRY|STARTUPINFO|STICKYKEYS|STRRET|STYLEBUF|STYLESTRUCT|SYSTEMTIME|SYSTEM_AUDIT_ACE|SYSTEM_INFO|SYSTEM_INFO_U|SYSTEM_POWER_STATUS|Signal|SjLj_Function_Context|SpecialCaseData|TAPE_ERASE|TAPE_GET_DRIVE_PARAMETERS|TAPE_GET_MEDIA_PARAMETERS|TAPE_GET_POSITION|TAPE_PREPARE|TAPE_SET_DRIVE_PARAMETERS|TAPE_SET_MEDIA_PARAMETERS|TAPE_SET_POSITION|TAPE_WRITE_MARKS|TBADDBITMAP|TBBUTTON|TBNOTIFY|TBSAVEPARAMS|TCHOOSECOLOR|TCHOOSEFONT|TC_HITTESTINFO|TC_ITEM|TC_ITEMHEADER|TC_KEYDOWN|TEXTMETRIC|TEXTMETRICA|TEXTRANGE|TFINDTEXT|TIME_ZONE_INFORMATION|TOGGLEKEYS|TOKEN_CONTROL|TOKEN_DEFAULT_DACL|TOKEN_GROUPS|TOKEN_OWNER|TOKEN_PRIMARY_GROUP|TOKEN_PRIVILEGES|TOKEN_SOURCE|TOKEN_STATISTICS|TOKEN_USER|TOOLINFO|TOOLTIPTEXT|TPAGESETUPDLG|TPMPARAMS|TRANSMIT_FILE_BUFFERS|TREEITEM|TSMALLPOINT|TTHITTESTINFO|TTPOLYCURVE|TTPOLYGONHEADER|TVARIANT|TV_DISPINFO|TV_HITTESTINFO|TV_INSERTSTRUCT|TV_ITEM|TV_KEYDOWN|TV_SORTCB|Time|TimeOfDay|TimeSpan|Tuple|UDACCEL|ULARGE_INTEGER|UNIVERSAL_NAME_INFO|UNLOAD_DLL_DEBUG_INFO|USEROBJECTFLAGS|USER_INFO_0|USER_INFO_2|USER_INFO_3|UnicodeData|VALENT|VA_LIST|VERIFY_INFORMATION|VS_FIXEDFILEINFO|Variant|VfsFilterInfo|WIN32_FILE_ATTRIBUTE_DATA|WIN32_FIND_DATA|WIN32_FIND_DATAW|WIN32_STREAM_ID|WINDOWINFO|WINDOWPLACEMENT|WINDOWPOS|WINDOW_BUFFER_SIZE_RECORD|WNDCLASS|WNDCLASSA|WNDCLASSEX|WNDCLASSEXA|WSADATA|WallClock|XFORM|ZipEntryInfo)\b - scope: support.type.built-ins.structs.d - support-type-d: - - match: '\b((?:tango|std)\.[\w\.]+)\b' - scope: support.type.d + - match: ':' + scope: punctuation.separator.case-statement.d + pop: true + - include: not-whitespace-illegal-pop + switch-after: + - match: '\)' + scope: punctuation.section.parens.end.d + set: optional-block-statement + - include: not-whitespace-illegal-pop + case-after: + - match: ':' + scope: punctuation.separator.case-statement.d + set: + - match: '\.\.(?!\.)' + scope: keyword.operator.d + set: + - match: '\bcase\b' + scope: keyword.control.flow.d + set: [case-after, value] + - include: not-whitespace-illegal-pop + - match: '(?=\S)' + pop: true + - include: not-whitespace-illegal-pop + + for-arguments: + - match: '\(' + scope: punctuation.section.parens.begin.d + set: + - match: '\)' + scope: punctuation.section.parens.end.d + pop: true + - include: statement-list-in + - include: not-whitespace-illegal-pop + + foreach-arguments: + - match: '\(' + scope: punctuation.section.parens.begin.d + set: [foreach-arguments-end, foreach-parameter-list] + - include: not-whitespace-illegal-pop + foreach-parameter-list: + - match: '(?=;)' + pop: true + - match: '(?=\b{{name}}\s*[;,])' + set: foreach-parameter-after-type + - include: parameter-attribute-in + - match: '(?=\S)' + set: [foreach-parameter-after-type, type] + foreach-parameter-after-type: + - match: '\b({{name}})\b' + scope: variable.parameter.d + set: + - match: ',' + scope: punctuation.separator.sequence.d + set: foreach-parameter-list + - match: '(?=;)' + pop: true + - include: not-whitespace-illegal-pop + - include: not-whitespace-illegal-pop + foreach-arguments-end: + - match: ';' + scope: punctuation.separator.sequence.d + set: [foreach-arguments-after, value] + - include: not-whitespace-illegal-pop + foreach-arguments-after: + - match: '\)' + scope: punctuation.section.parens.end.d + pop: true + - include: not-whitespace-illegal-pop + + assert-arguments: + - match: '\(' + scope: punctuation.section.parens.begin.d + set: [assert-arguments-after, value-list] + - include: not-whitespace-illegal-pop + assert-arguments-after: + - match: '\)' + scope: punctuation.section.parens.end.d + pop: true + - include: not-whitespace-illegal-pop + + condition: + - match: '\(' + scope: punctuation.section.parens.begin.d + set: [condition-after, value] + - include: not-whitespace-illegal-pop + condition-after: + - match: '\)' + scope: punctuation.section.parens.end.d + pop: true + - include: not-whitespace-illegal-pop + + identifier: + - match: '\b{{name}}\b' + scope: meta.path.d variable.other.d + set: + - match: \. + scope: meta.path.d punctuation.accessor.dot.d + set: identifier + - match: '(?=\S)' + pop: true + - include: not-whitespace-illegal-pop + identifier-ref: + - match: \. + scope: meta.path.d punctuation.accessor.dot.d + set: identifier + - match: '(?=\S)' + set: identifier + + type-identifier: + - match: '\b{{name}}\b(?=\s*!)' + scope: meta.function-call.d meta.path.d variable.function.d + pop: true + - match: '\b{{name}}\b' + scope: meta.path.d storage.type.d + set: + - match: \. + scope: meta.path.d punctuation.accessor.dot.d + set: type-identifier + - match: '(?=\S)' + pop: true + - include: not-whitespace-illegal-pop + type-identifier-ref: + - match: \. + scope: meta.path.d punctuation.accessor.dot.d + set: type-identifier + - match: '(?=\S)' + set: type-identifier + + new-type-identifier: + - match: '\b{{name}}(?=\s*\()' + scope: meta.function-call.d meta.path.d variable.function.d + pop: true + - match: '\b{{name}}\b' + scope: meta.path.d storage.type.d + set: + - match: \. + scope: meta.path.d punctuation.accessor.dot.d + set: new-type-identifier + - match: '(?=\S)' + pop: true + - include: not-whitespace-illegal-pop + new-type-identifier-ref: + - match: \. + scope: meta.path.d punctuation.accessor.dot.d + set: new-type-identifier + - match: '(?=\S)' + set: new-type-identifier + + not-whitespace-illegal: + - match: '\S' + scope: invalid.illegal.d + not-whitespace-illegal-pop: + - match: '\S' + scope: invalid.illegal.d + pop: true + + end-of-line-in: + - match: ';' + scope: punctuation.terminator.d + end-of-line: + - match: ';' + scope: punctuation.terminator.d + pop: true + expect-end-of-line: + - include: end-of-line + - include: not-whitespace-illegal-pop + maybe-end-of-line: + - include: end-of-line + - match: '(?=\S)' + pop: true + + check-brackets-in: + - match: '[\}\]\)]' + scope: invalid.illegal.d + + meta-function: + - meta_scope: meta.function.d + - match: '' + pop: true + + meta-function-parameters: + - meta_scope: meta.function.parameters.d + - match: '' + pop: true + + meta-function-call: + - meta_scope: meta.function-call.d + - match: '' + pop: true + + meta-class: + - meta_scope: meta.class.d + - match: '' + pop: true + + meta-interface: + - meta_scope: meta.interface.d + - match: '' + pop: true + + meta-struct: + - meta_scope: meta.struct.d + - match: '' + pop: true + + meta-union: + - meta_scope: meta.union.d + - match: '' + pop: true + + meta-enum: + - meta_scope: meta.enum.d + - match: '' + pop: true diff --git a/D/DMD Output.sublime-syntax b/D/DMD Output.sublime-syntax new file mode 100644 index 0000000000..9b3334328e --- /dev/null +++ b/D/DMD Output.sublime-syntax @@ -0,0 +1,16 @@ +%YAML 1.2 +--- +name: DMD Output +hidden: true +scope: source.build_output.dmd +contexts: + main: + - match: '^(.*?)\(([0-9]+)(?:,\s*([0-9]+))?\): ' + captures: + 1: entity.name.filename.dmd + 2: constant.numeric.line-number.dmd + 3: constant.numeric.line-number.dmd + - match: '\b(Warning|Error)(:) ' + captures: + 1: message.error.dmd + 2: punctuation.separator.dmd diff --git a/D/Indentation Rules.tmPreferences b/D/Indentation Rules.tmPreferences index 117ea29782..7212904bab 100644 --- a/D/Indentation Rules.tmPreferences +++ b/D/Indentation Rules.tmPreferences @@ -8,15 +8,24 @@ settings decreaseIndentPattern - ^(.*\*/)?\s*\}([^}{"']*\{)?[;\s]*(//.*|/\*.*\*/\s*)?$|^\s*(public|private|protected):\s*$ + (?x) + ^ (.*\*/)? \s* \} + | ^ \s* (public|private|protected|package): \s* $ + increaseIndentPattern - ^.*\{[^}"']*$|^\s*(public|private|protected):\s*$ + (?x) + ^ .* \{ [^}"']* $ + | ^ \s* (public|private|protected|package): \s* $ + bracketIndentNextLinePattern (?x) - ^ \s* \b(if|while|else|foreach)\b [^;]* $ - | ^ \s* \b(for)\b .* $ + ^ \s* \b(if|while|else)\b [^;]* $ + | ^ \s* \b(for|foreach|foreach_reverse)\b .* $ + + indentSquareBrackets + diff --git a/D/Snippets/foreach-reverse.sublime-snippet b/D/Snippets/foreach-reverse.sublime-snippet index 2d48423718..39688ed07d 100644 --- a/D/Snippets/foreach-reverse.sublime-snippet +++ b/D/Snippets/foreach-reverse.sublime-snippet @@ -1,9 +1,9 @@ - fer source.d - foreach_reverse(…; …) { … } + foreach_reverse (…; …) { … } diff --git a/D/Snippets/foreach.sublime-snippet b/D/Snippets/foreach.sublime-snippet index 50ba615a41..dbadab50c0 100644 --- a/D/Snippets/foreach.sublime-snippet +++ b/D/Snippets/foreach.sublime-snippet @@ -1,5 +1,5 @@ - diff --git a/D/Snippets/if-else.sublime-snippet b/D/Snippets/if-else.sublime-snippet index 023ec80530..5f2749243a 100644 --- a/D/Snippets/if-else.sublime-snippet +++ b/D/Snippets/if-else.sublime-snippet @@ -1,5 +1,5 @@ - - diff --git a/D/Snippets/main-with-args.sublime-snippet b/D/Snippets/main-with-args.sublime-snippet index 56e9ed9fbc..9af27f97a4 100644 --- a/D/Snippets/main-with-args.sublime-snippet +++ b/D/Snippets/main-with-args.sublime-snippet @@ -1,9 +1,9 @@ - maina source.d - void main(string[] args) { … } + int main(string[] args) { … } diff --git a/D/Snippets/main.sublime-snippet b/D/Snippets/main.sublime-snippet index 80f29be6ac..c4442e4e96 100644 --- a/D/Snippets/main.sublime-snippet +++ b/D/Snippets/main.sublime-snippet @@ -1,9 +1,9 @@ - main source.d - void main() { … } + int main() { … } diff --git a/D/Snippets/version.sublime-snippet b/D/Snippets/version.sublime-snippet index a53516310a..b7d9ff73b5 100644 --- a/D/Snippets/version.sublime-snippet +++ b/D/Snippets/version.sublime-snippet @@ -1,5 +1,5 @@ - diff --git a/D/Snippets/while.sublime-snippet b/D/Snippets/while.sublime-snippet index 93b0184708..6f6c825f48 100644 --- a/D/Snippets/while.sublime-snippet +++ b/D/Snippets/while.sublime-snippet @@ -1,5 +1,5 @@ - diff --git a/D/Symbol Index Hide Special Functions.tmPreferences b/D/Symbol Index Hide Special Functions.tmPreferences new file mode 100644 index 0000000000..3adce7f135 --- /dev/null +++ b/D/Symbol Index Hide Special Functions.tmPreferences @@ -0,0 +1,12 @@ + + + + scope + + settings + + showInIndexedSymbolList + 0 + + + diff --git a/D/Symbol List.tmPreferences b/D/Symbol List.tmPreferences new file mode 100644 index 0000000000..d8d31de90d --- /dev/null +++ b/D/Symbol List.tmPreferences @@ -0,0 +1,16 @@ + + + + name + Symbol List + scope + source.d entity.name + settings + + showInSymbolList + 1 + showInIndexedSymbolList + 1 + + + diff --git a/D/tests/syntax_test_d.d b/D/tests/syntax_test_d.d new file mode 100644 index 0000000000..1ccd41d9b4 --- /dev/null +++ b/D/tests/syntax_test_d.d @@ -0,0 +1,2819 @@ +// SYNTAX TEST "Packages/D/D.sublime-syntax" + +module foo.a.b1_3; +// <- meta.namespace.d keyword.declaration.namespace.d + // <- meta.namespace.d keyword.declaration.namespace.d +//^^^^ keyword.declaration.namespace.d +//^^^^^^^^^^^^^^^^ meta.namespace.d +// ^^^^^^^^^^ meta.path.d +// ^^^ variable.other.d +// ^ punctuation.accessor.dot.d +// ^ variable.other.d +// ^ punctuation.accessor.dot.d +// ^^^^ entity.name.namespace.d +// ^ punctuation.terminator.d + module foo.a.b1_3; +//^^^^^^^^^^^^^^^^^^ meta.namespace.d +//^^^^^^ keyword.declaration.namespace.d +// ^^^^^^^^^^ meta.path.d +// ^^^ variable.other.d +// ^ punctuation.accessor.dot.d +// ^ variable.other.d +// ^ punctuation.accessor.dot.d +// ^^^^ entity.name.namespace.d +// ^ punctuation.terminator.d + + /+ +//^^ comment.block.nested.d punctuation.definition.comment.d + /+ +//^^ comment.block.nested.d comment.block.nested.d punctuation.definition.comment.d + +/ +//^^ comment.block.nested.d comment.block.nested.d punctuation.definition.comment.d + +/ +//^^ comment.block.nested.d punctuation.definition.comment.d + + /++ + + +// ^ comment.block.nested.d punctuation.definition.comment.d + +/ +/++/ +//^^ comment.block.nested.d punctuation.definition.comment.d + + /** + * +// ^ comment.block.d punctuation.definition.comment.d + */ +/**/ +//^^ comment.block.d punctuation.definition.comment.d + +//<- - comment + +auto wysiwyg = r"f// \n\"; +// ^^^^^^^^^^ meta.string.d string.quoted.double.raw.d +// ^ storage.modifier.string.d +// ^ punctuation.definition.string.begin.d +// ^^ - constant.character.escape.d +// ^ punctuation.definition.string.end.d +auto wysiwygAlt = `f//\n\`; +// ^^^^^^^^ meta.string.d string.quoted.double.raw.backtick.d +// ^ punctuation.definition.string.begin.d +// ^^ - constant.character.escape.d +// ^ punctuation.definition.string.end.d +auto doubleQuoted = "c://\'\"\?\\\0\a\b\f\n\r\t\v\x0B\2\12\762\u0feb\Uabcdef98\""; +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.d string.quoted.double.d +// ^ punctuation.definition.string.begin.d +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant.character.escape.d +// ^ punctuation.definition.string.end.d +auto invalidEscape = "\p"; +// ^^ string.quoted.double.d invalid.illegal.unknown-escape.d +auto invalidEscape2 = "\u0fe"; +// ^^^^^^^ meta.string.d string.quoted.double.d +// ^^ invalid.illegal.unknown-escape.d +auto invalidEscape3 = "\&;"; +// ^^^^^ meta.string.d string.quoted.double.d +// ^^ invalid.illegal.unknown-escape.d +auto invalidEscape4 = "\u12398"; +// ^^^^^^^^^ meta.string.d string.quoted.double.d +// ^^^^^^ constant.character.escape.d +// ^ - constant.character.escape.d +auto hexString = x"00 ba +// ^^^^^^^^ meta.string.d string.quoted.double.raw.d +// ^ storage.modifier.string.d +// ^ punctuation.definition.string.begin.d + 5 5 b"; +// ^^^^^^^ meta.string.d string.quoted.double.raw.d +// ^^^ string.quoted.double.raw.d constant.character.escape.d +// ^ string.quoted.double.raw.d invalid.illegal.unknown-escape.d +// ^ string.quoted.double.raw.d punctuation.definition.string.end.d +auto deliminated = q"SQL_1 +// ^^^^^^^^ meta.string.d string.quoted.double.raw.d +// ^ storage.modifier.string.d +// ^ punctuation.definition.string.begin.d +// ^^^^^ constant.other.delimeter.d + select foo \n +// ^^^^^^^^^^^^^^ meta.string.d string.quoted.double.raw.d +SQL_1"; +// <- meta.string.d string.quoted.double.raw.d constant.other.delimeter.d +//^^^^ meta.string.d string.quoted.double.raw.d +// ^^ constant.other.delimeter.d +// ^ punctuation.definition.string.end.d +// ^ punctuation.terminator.d +// - meta.string.d +auto deliminatedBad = q"SQL\ +// ^ meta.string.d string.quoted.double.raw.d invalid.illegal.d +SQL"; +auto deliminatedNested = q"(f("))" + q"{f{"}}" + q"[f["]]" + q">"; +// ^^^^^^^^^ meta.string.d string.quoted.double.raw.d +// ^ storage.modifier.string.d +// ^^ punctuation.definition.string.begin.d +// ^^ punctuation.definition.string.end.d +// ^^^^^^^^^ meta.string.d string.quoted.double.raw.d +// ^ storage.modifier.string.d +// ^^ punctuation.definition.string.begin.d +// ^^ punctuation.definition.string.end.d +// ^^^^^^^^^ meta.string.d string.quoted.double.raw.d +// ^ storage.modifier.string.d +// ^^ punctuation.definition.string.begin.d +// ^^ punctuation.definition.string.end.d +// ^^^^^^^^^ meta.string.d string.quoted.double.raw.d +// ^ storage.modifier.string.d +// ^^ punctuation.definition.string.begin.d +// ^^ punctuation.definition.string.end.d +auto deliminatedAny = q"/foo(xxx)/"; +// ^^^^^^^^^^^^^ meta.string.d string.quoted.double.raw.d +// ^ storage.modifier.string.d +// ^ punctuation.definition.string.begin.d +// ^ constant.other.delimeter.d +// ^ constant.other.delimeter.d +// ^ punctuation.definition.string.end.d +auto stringPostfix = ``c + ""w + q"//"d; +// ^ meta.string.d string.quoted.double.raw.backtick.d storage.type.string.d +// ^ meta.string.d string.quoted.double.d storage.type.string.d +// ^ meta.string.d string.quoted.double.raw.d storage.type.string.d +auto tokenString = q{ +// ^^ meta.string.d string.unquoted.embedded.d +// ^ storage.modifier.string.d +// ^ punctuation.definition.string.begin.d + this is not real code 12 +// ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.d +// ^^^^ variable.language.d +// ^^ keyword.d +// ^^^^ storage.type.d +// ^^ constant.numeric.integer.decimal.d + /*}*/ +// ^^^^^^ meta.string.d +// ^^ punctuation.definition.comment.d +// ^^ punctuation.definition.comment.d +// ^^^^^ comment.block.d + '' 'a' +// ^^^^^^^^ meta.string.d +// ^^ invalid.illegal.d +// ^^^ string.quoted.single.d + __TIME__ +// ^^^^^^^^ meta.string.d constant.language.d +}; +// <- meta.string.d string.unquoted.embedded.d punctuation.definition.string.end.d + +auto c = 'a'; +// ^^^ meta.string.d string.quoted.single.d +c = 'Ó'; +// ^^^ meta.string.d string.quoted.single.d +c = '\n'; +// ^^^^ meta.string.d string.quoted.single.d +// ^^ constant.character.escape.d +c = '\x'; +// ^^^^ invalid.illegal.d +c = 'aa'; +// ^^^^ invalid.illegal.d +c = '\'; +// ^^^ invalid.illegal.d +c = ''; +// ^^ invalid.illegal.d +c = '''; +// ^^ invalid.illegal.d + +auto dec = 2_0__000; +// ^^^^^^^^ constant.numeric.integer.decimal.d +dec = 1L; +// ^^ constant.numeric.integer.decimal.d +// ^ storage.type.numeric.d +dec = 1u; +// ^^ constant.numeric.integer.decimal.d +// ^ storage.type.numeric.d +dec = 1U; +// ^^ constant.numeric.integer.decimal.d +// ^ storage.type.numeric.d +dec = 1Lu; +// ^^^ constant.numeric.integer.decimal.d +// ^^ storage.type.numeric.d +dec = 1LU; +// ^^^ constant.numeric.integer.decimal.d +// ^^ storage.type.numeric.d +dec = 1uL; +// ^^^ constant.numeric.integer.decimal.d +// ^^ storage.type.numeric.d +dec = 1UL; +// ^^^ constant.numeric.integer.decimal.d +// ^^ storage.type.numeric.d +auto bin = 0b1; +// ^^ punctuation.definition.numeric.base.d +// ^^^ constant.numeric.integer.binary.d +bin = 0b10__1; +// ^^ punctuation.definition.numeric.base.d +// ^^^^^^^ constant.numeric.integer.binary.d +bin = 0B1; +// ^^ punctuation.definition.numeric.base.d +// ^^^ constant.numeric.integer.binary.d +auto hex = 0xFf; +// ^^ punctuation.definition.numeric.base.d +// ^^^^ constant.numeric.integer.hexadecimal.d +hex = 0x012_3; +// ^^ punctuation.definition.numeric.base.d +// ^^^^^^^ constant.numeric.integer.hexadecimal.d +hex = 0X1; +// ^^ punctuation.definition.numeric.base.d +// ^^^ constant.numeric.integer.hexadecimal.d + +imag = 123_45i + 0_.1_i + 12_.e1i; +// ^^^^^^^ constant.numeric.imaginary.decimal.d +// ^ storage.type.numeric.d +// ^ keyword.operator.arithmetic.d +// ^^^^^^ constant.numeric.imaginary.decimal.d +// ^ punctuation.separator.decimal.d +// ^ storage.type.numeric.d +// ^^^^^^^ constant.numeric.imaginary.decimal.d +// ^ punctuation.separator.decimal.d +// ^ storage.type.numeric.d +imag = 23134723__742e1i; +// ^^^^^^^^^^^^^^^^ constant.numeric.imaginary.decimal.d +// ^ storage.type.numeric.d +imag = 0x_3472389742f_i; +// ^^^^^^^^^^^^^^^^ constant.numeric.imaginary.hexadecimal.d +// ^^ punctuation.definition.numeric.base.d +// ^ invalid.illegal.numeric.d +// ^ storage.type.numeric.d +imag = 0x_34723897p-34i; +// ^^^^^^^^^^^^^^^^ constant.numeric.imaginary.hexadecimal.d +// ^^ punctuation.definition.numeric.base.d +// ^ invalid.illegal.numeric.d +// ^ storage.type.numeric.d +imag = 0x347._23897p-34i; +// ^^^^^ constant.numeric.integer.hexadecimal.d +// ^^ punctuation.definition.numeric.base.d +// ^ punctuation.accessor.dot.d +// ^^^^^^^ variable.other.d +// ^ keyword.operator.arithmetic.d +// ^^^ constant.numeric.imaginary.decimal.d +imag = 0b_0100_010_00_i; +// ^^^^^^^^^^^^^^^^ constant.numeric.imaginary.binary.d +// ^^ punctuation.definition.numeric.base.d +// ^ invalid.illegal.numeric.d +// ^ storage.type.numeric.d + +auto f = 0_.0_; +// ^^^^^ constant.numeric.float.decimal.d +// ^ punctuation.separator.decimal.d +f = 0_.; +// ^^^ constant.numeric.float.decimal.d +// ^ punctuation.separator.decimal.d +f = .123_1243; +// ^ punctuation.separator.decimal.d +// ^^^^^^^^^ constant.numeric.float.decimal.d +f = ._123_1243 + 1._123; +// ^ punctuation.accessor.dot.d +// ^^^^^^^^^ variable.other.d +// ^ keyword.operator.arithmetic.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.accessor.dot.d +// ^^^^ variable.other.d +f = 3423.2e-45; +// ^^^^^^^^^^ constant.numeric.float.decimal.d +// ^ punctuation.separator.decimal.d +f = 2.e-45; +// ^^^^^^ constant.numeric.float.decimal.d +// ^ punctuation.separator.decimal.d +f = .4E+4L; +// ^ punctuation.separator.decimal.d +// ^^^^^^ constant.numeric.float.decimal.d +// ^ storage.type.numeric.d +f = 1f; +// ^^ constant.numeric.float.decimal.d +// ^ storage.type.numeric.d +f = 0x123p2f; +// ^^ punctuation.definition.numeric.base.d +// ^^^^^^^^ constant.numeric.float.hexadecimal.d +// ^ storage.type.numeric.d +f = 0b10101101f; +// ^^ punctuation.definition.numeric.base.d +// ^^^^^^^^^^^ constant.numeric.float.binary.d +// ^ storage.type.numeric.d +f = 0x.1aFp2; +// ^^ punctuation.definition.numeric.base.d +// ^^^^^^^^ constant.numeric.float.hexadecimal.d +// ^ punctuation.separator.decimal.d +f = 0xF.AP-2f; +// ^^ punctuation.definition.numeric.base.d +// ^^^^^^^^^ constant.numeric.float.hexadecimal.d +// ^ punctuation.separator.decimal.d +// ^ storage.type.numeric.d + + @foo: +//^ punctuation.definition.annotation.begin.d +// ^^^ meta.path.d storage.type.d +// ^ punctuation.separator.d + @("oo")@safer@Foo(2, 4)@property +//^ punctuation.definition.annotation.begin.d +// ^ punctuation.section.parens.begin.d +// ^^^^ string.quoted.double.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.definition.annotation.begin.d +// ^^^^^ meta.path.d storage.type.d +// ^ punctuation.definition.annotation.begin.d +// ^^^^^^^^^ meta.function-call.d +// ^^^ meta.path.d storage.type.d +// ^ punctuation.section.parens.begin.d +// ^ constant.numeric.integer.decimal.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.section.parens.end.d +// ^^^^^^^^^ storage.modifier.d + static shared const immutable final __gshared nothrow pure ref +//^^^^^^ storage.modifier.d +// ^^^^^^ storage.modifier.d +// ^^^^^ storage.modifier.d +// ^^^^^^^^^ storage.modifier.d +// ^^^^^ storage.modifier.d +// ^^^^^^^^^ storage.modifier.d +// ^^^^^^^ storage.modifier.d +// ^^^^ storage.modifier.d +// ^^^ storage.modifier.d + extern(C) extern (C++, foo.a) +//^^^^^^ keyword.other.external.d +// ^ punctuation.section.parens.begin.d +// ^ string.other.d +// ^ punctuation.section.parens.end.d +// ^^^^^^ keyword.other.external.d +// ^ punctuation.section.parens.begin.d +// ^^^ string.other.d +// ^ punctuation.separator.sequence.d +// ^^^ variable.other.d +// ^ punctuation.accessor.dot.d +// ^ variable.other.d +// ^ punctuation.section.parens.end.d +extern(1) +// ^ invalid.illegal.d + align align(1) align(foo * 2) +//^^^^^ keyword.other.alignment.d +// ^^^^^ keyword.other.alignment.d +// ^ punctuation.section.parens.begin.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.section.parens.end.d +// ^^^^^ keyword.other.alignment.d +// ^ punctuation.section.parens.begin.d +// ^^^ variable.other.d +// ^ keyword.operator.arithmetic.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.section.parens.end.d + deprecated +//^^^^^^^^^^ keyword.other.deprecated.d + deprecated( "message") deprecated(q{void}) +//^^^^^^^^^^ keyword.other.deprecated.d +// ^ punctuation.section.parens.begin.d +// ^^^^^^^^^ string.quoted.double.d +// ^ punctuation.section.parens.end.d +// ^^^^^^^^^^ keyword.other.deprecated.d +// ^ punctuation.section.parens.begin.d +// ^^^^ source.d storage.type.d +// ^ punctuation.section.parens.end.d + private protected public export package +//^^^^^^^ storage.modifier.access-control.d +// ^^^^^^^^^ storage.modifier.access-control.d +// ^^^^^^ storage.modifier.access-control.d +// ^^^^^^ storage.modifier.access-control.d +// ^^^^^^^ storage.modifier.access-control.d + package(foo.bar.2) +//^^^^^^^ storage.modifier.access-control.d +// ^ punctuation.section.parens.begin.d +// ^^^^^^^^ meta.path.d +// ^^^ variable.other.d +// ^ punctuation.accessor.dot.d +// ^^^ variable.other.d +// ^ punctuation.accessor.dot.d +// ^ invalid.illegal.d +// ^ punctuation.section.parens.end.d + pragma(f) pragma(test, void): +//^^^^^^ keyword.other.pragma.d +// ^ punctuation.section.parens.begin.d +// ^ variable.function.d +// ^ punctuation.section.parens.end.d +// ^^^^^^ keyword.other.pragma.d +// ^ punctuation.section.parens.begin.d +// ^^^^ variable.function.d +// ^^^^ storage.type.d +// ^ punctuation.section.parens.end.d + private: +//^^^^^^^ storage.modifier.access-control.d +// ^ punctuation.separator.d + + import foo; +//^^^^^^ keyword.control.import.d +// ^^^ meta.path.d variable.other.d +// ^ punctuation.terminator.d + import std.foo; import core.thread; +//^^^^^^ keyword.control.import.d +// ^^^^^^^ meta.path.d +// ^^^ variable.other.d +// ^ punctuation.accessor.dot.d +// ^^^ variable.other.d +// ^ punctuation.terminator.d +// ^^^^^^ keyword.control.import.d +// ^^^^^^^^^^^ meta.path.d +// ^^^^ variable.other.d +// ^ punctuation.accessor.dot.d +// ^^^^^^ variable.other.d +// ^ punctuation.terminator.d + import foo'; +// ^ invalid.illegal.d + import foo, a = bar, std : foo, bar, c = d; +//^^^^^^ keyword.control.import.d +// ^^^ meta.path.d variable.other.d +// ^ punctuation.separator.sequence.d +// ^ meta.path.d variable.other.d +// ^ keyword.operator.assignment.d +// ^^^ meta.path.d variable.other.d +// ^ punctuation.separator.sequence.d +// ^^^ meta.path.d variable.other.d +// ^ punctuation.separator.import-binding.d +// ^^^ meta.path.d variable.other.d +// ^ punctuation.separator.sequence.d +// ^^^ meta.path.d variable.other.d +// ^ punctuation.separator.sequence.d +// ^ meta.path.d variable.other.d +// ^ keyword.operator.assignment.d +// ^ meta.path.d variable.other.d +// ^ punctuation.terminator.d + string foo = import("foo.txt"); +//^^^^^^ storage.type.d +// ^^^ variable.other.d +// ^ keyword.operator.assignment.d +// ^^^^^^ keyword.control.import.d +// ^ punctuation.section.parens.begin.d +// ^^^^^^^^^ string.quoted.double.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.terminator.d + import("foo").each!writeln; +//^^^^^^ keyword.control.import.d +// ^ punctuation.section.parens.begin.d +// ^^^^^ string.quoted.double.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.accessor.dot.d +// ^^^^^^^^^^^^ meta.function-call.d +// ^^^^ meta.path.d variable.function.d +// ^ punctuation.section.generic.begin.d +// ^^^^^^^ meta.path.d variable.other.d +// ^ punctuation.terminator.d + + alias foo = int; +//^^^^^ keyword.control.alias.d +// ^^^ entity.name.type.d +// ^ keyword.operator.assignment.d +// ^^^ storage.type.d +// ^ punctuation.terminator.d + alias Foo = const int[string], bar = long!int; +//^^^^^ keyword.control.alias.d +// ^^^ entity.name.type.d +// ^ keyword.operator.assignment.d +// ^^^^^ storage.modifier.d +// ^^^ storage.type.d +// ^ punctuation.section.brackets.begin.d +// ^^^^^^ storage.type.d +// ^ punctuation.section.brackets.end.d +// ^ punctuation.separator.sequence.d +// ^^^ entity.name.type.d +// ^ keyword.operator.assignment.d +// ^^^^ storage.type.d +// ^ punctuation.section.generic.begin.d +// ^^^ storage.type.d +// ^ punctuation.terminator.d + alias int a; +//^^^^^ keyword.control.alias.d +// ^^^ storage.type.d +// ^ entity.name.type.d +// ^ punctuation.terminator.d + alias const foo[string] long_name, foo, b; +//^^^^^ keyword.control.alias.d +// ^^^^^ storage.modifier.d +// ^^^ storage.type.d +// ^ punctuation.section.brackets.begin.d +// ^^^^^^ storage.type.d +// ^ punctuation.section.brackets.end.d +// ^^^^^^^^^ entity.name.type.d +// ^ punctuation.separator.sequence.d +// ^^^ entity.name.type.d +// ^ punctuation.separator.sequence.d +// ^ entity.name.type.d +// ^ punctuation.terminator.d + alias foo this; +//^^^^^ keyword.control.alias.d +// ^^^ meta.path.d variable.other.d +// ^^^^ keyword.control.alias.d +// ^ punctuation.terminator.d + alias foo.bar.baz this; +//^^^^^ keyword.control.alias.d +// ^^^^^^^^^^^ meta.path.d +// ^^^ variable.other.d +// ^ punctuation.accessor.dot.d +// ^^^ variable.other.d +// ^ punctuation.accessor.dot.d +// ^^^ variable.other.d +// ^^^^ keyword.control.alias.d +// ^ punctuation.terminator.d + alias F(x) = foo*; +//^^^^^ keyword.control.alias.d +// ^ entity.name.type.d +// ^ punctuation.section.group.begin.d +// ^ variable.parameter.d +// ^ punctuation.section.group.end.d +// ^ keyword.operator.assignment.d +// ^^^ meta.path.d variable.other.d +// ^ keyword.operator.pointer.d +// ^ punctuation.terminator.d + alias rSave = a => a; +//^^^^^ keyword.control.alias.d +// ^^^^^ entity.name.type.d +// ^ keyword.operator.assignment.d +// ^^^^^^ meta.function.d +// ^ variable.parameter.d +// ^^ storage.type.function.d keyword.declaration.function.lambda.d +// ^ meta.path.d variable.other.d +// ^ punctuation.terminator.d + + int a; +//^^^ storage.type.d +// ^ variable.other.d +// ^ punctuation.terminator.d + foo[string] b = 123; +//^^^ variable.other.d +// ^ punctuation.section.brackets.begin.d +// ^^^^^^ storage.type.d +// ^ punctuation.section.brackets.end.d +// ^ variable.other.d +// ^ keyword.operator.assignment.d +// ^^^ constant.numeric.integer.decimal.d +// ^ punctuation.terminator.d + bar* some_long_Name; +//^^^ variable.other.d +// ^ keyword.operator.pointer.d +// ^^^^^^^^^^^^^^ variable.other.d +// ^ punctuation.terminator.d + auto foo = 3; +//^^^^ storage.modifier.d +// ^^^ variable.other.d +// ^ keyword.operator.assignment.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.terminator.d + auto +//^^^^ storage.modifier.d + asjfaisdjaksdjaklsjdnaskjjks = 3; +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^ variable.other.d +// ^ keyword.operator.assignment.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.terminator.d + char[] buffer_, encoded_; +//^^^^ storage.type.d +// ^ punctuation.section.brackets.begin.d +// ^ punctuation.section.brackets.end.d +// ^^^^^^^ variable.other.d +// ^ punctuation.separator.sequence.d +// ^^^^^^^^ variable.other.d +// ^ punctuation.terminator.d + + class Foo; +//^^^^^^^^^ meta.class.d +//^^^^^ storage.type.class.d keyword.declaration.class.d +// ^^^ entity.name.class.d +// ^ punctuation.terminator.d + + class Bar : Foo, b { +//^^^^^^^^^^^^^^^^^^^^^ meta.class.d +//^^^^^ storage.type.class.d keyword.declaration.class.d +// ^^^ entity.name.class.d +// ^ punctuation.separator.mapping.d +// ^^^ storage.type.d +// ^ punctuation.separator.sequence.d +// ^ storage.type.d +// ^ punctuation.section.block.begin.d + class b {} + //^^^^^^^^^^ meta.class.d meta.block.d meta.class.d + //^^^^^ storage.type.class.d keyword.declaration.class.d + // ^ entity.name.class.d + // ^ punctuation.section.block.begin.d + // ^ punctuation.section.block.end.d + } +//^ meta.class.d punctuation.section.block.end.d + class b(T, int s) { +//^^^^^^^^^^^^^^^^^^^^ meta.class.d +//^^^^^ storage.type.class.d keyword.declaration.class.d +// ^ entity.name.class.d +// ^ punctuation.section.group.begin.d +// ^ variable.parameter.d +// ^ punctuation.separator.sequence.d +// ^^^ storage.type.d +// ^ variable.parameter.d +// ^ punctuation.section.group.end.d +// ^ punctuation.section.block.begin.d + } +//^ meta.class.d punctuation.section.block.end.d + + interface S; +//^^^^^^^^^^^^ meta.interface.d +//^^^^^^^^^ storage.type.interface.d keyword.declaration.interface.d +// ^ entity.name.interface.d +// ^ punctuation.terminator.d + interface Foo: Bar, Baz { +//^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.interface.d +//^^^^^^^^^ storage.type.interface.d keyword.declaration.interface.d +// ^^^ entity.name.interface.d +// ^ punctuation.separator.mapping.d +// ^^^ storage.type.d +// ^ punctuation.separator.sequence.d +// ^^^ storage.type.d +// ^ punctuation.section.block.begin.d + interface c{} + //^^^^^^^^^^^^^ meta.interface.d meta.block.d meta.interface.d + //^^^^^^^^^ storage.type.interface.d keyword.declaration.interface.d + // ^ entity.name.interface.d + // ^ punctuation.section.block.begin.d + // ^ punctuation.section.block.end.d + } +//^ meta.interface.d meta.block.d punctuation.section.block.end.d + interface A(T, float f) { +//^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.interface.d +//^^^^^^^^^ storage.type.interface.d keyword.declaration.interface.d +// ^ entity.name.interface.d +// ^ punctuation.section.group.begin.d +// ^ variable.parameter.d +// ^ punctuation.separator.sequence.d +// ^^^^^ storage.type.d +// ^ variable.parameter.d +// ^ punctuation.section.group.end.d +// ^ punctuation.section.block.begin.d + } +//^ meta.interface.d meta.block.d punctuation.section.block.end.d + + struct Foo { +//^^^^^^^^^^^^^ meta.struct.d +//^^^^^^ storage.type.struct.d keyword.declaration.struct.d +// ^^^ entity.name.struct.d +// ^ punctuation.section.block.begin.d + struct { + //^^^^^^^^^ meta.struct.d meta.block.d meta.struct.d + //^^^^^^ storage.type.struct.d keyword.declaration.struct.d + // ^ punctuation.section.block.begin.d + union {} + //^^^^^^^^ meta.struct.d meta.block.d meta.struct.d meta.block.d meta.union.d + //^^^^^ storage.type.union.d keyword.declaration.union.d + // ^ punctuation.section.block.begin.d + // ^ punctuation.section.block.end.d + } + //^ meta.struct.d meta.block.d meta.struct.d meta.block.d punctuation.section.block.end.d + } +//^ meta.struct.d meta.block.d punctuation.section.block.end.d + struct F(int a, T) { +//^^^^^^^^^^^^^^^^^^^^^ meta.struct.d +//^^^^^^ storage.type.struct.d keyword.declaration.struct.d +// ^ entity.name.struct.d +// ^ punctuation.section.group.begin.d +// ^^^ storage.type.d +// ^ variable.parameter.d +// ^ punctuation.separator.sequence.d +// ^ variable.parameter.d +// ^ punctuation.section.group.end.d +// ^ punctuation.section.block.begin.d + } +//^ meta.struct.d meta.block.d punctuation.section.block.end.d + + union Foo {} +//^^^^^^^^^^^^ meta.union.d +//^^^^^ storage.type.union.d keyword.declaration.union.d +// ^^^ entity.name.union.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d + union Test(string s, F) {} +//^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.union.d +//^^^^^ storage.type.union.d keyword.declaration.union.d +// ^^^^ entity.name.union.d +// ^ punctuation.section.group.begin.d +// ^^^^^^ storage.type.d +// ^ variable.parameter.d +// ^ punctuation.separator.sequence.d +// ^ variable.parameter.d +// ^ punctuation.section.group.end.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d + + enum Foo { +//^^^^^^^^^^^ meta.enum.d +//^^^^ storage.type.enum.d keyword.declaration.enum.d +// ^^^ entity.name.enum.d +// ^ punctuation.section.block.begin.d + foo, + //^^^^^ meta.enum.d + //^^^ entity.name.constant.d + // ^ punctuation.separator.sequence.d + bar = 2, + //^^^^^^^^^ meta.enum.d + //^^^ entity.name.constant.d + // ^ keyword.operator.assignment.d + // ^ constant.numeric.integer.decimal.d + // ^ punctuation.separator.sequence.d + 1 + //^ meta.enum.d invalid.illegal.d + } +//^ meta.enum.d punctuation.section.block.end.d + enum Foo : int { a = 12 } +//^^^^^^^^^^^^^^^^^^^^^^^^^ meta.enum.d +//^^^^ storage.type.enum.d keyword.declaration.enum.d +// ^^^ entity.name.enum.d +// ^ punctuation.separator.mapping.d +// ^^^ storage.type.d +// ^ punctuation.section.block.begin.d +// ^ entity.name.constant.d +// ^ keyword.operator.assignment.d +// ^^ constant.numeric.integer.decimal.d +// ^ punctuation.section.block.end.d + enum : foo[string] { TEST } +//^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.enum.d +//^^^^ storage.type.enum.d keyword.declaration.enum.d +// ^ punctuation.separator.mapping.d +// ^^^ storage.type.d +// ^ punctuation.section.brackets.begin.d +// ^^^^^^ storage.type.d +// ^ punctuation.section.brackets.end.d +// ^ punctuation.section.block.begin.d +// ^^^^ entity.name.constant.d +// ^ punctuation.section.block.end.d + enum { int a = 12, +//^^^^^^^^^^^^^^^^^^^ meta.enum.d +//^^^^ storage.type.enum.d keyword.declaration.enum.d +// ^ punctuation.section.block.begin.d +// ^^^ storage.type.d +// ^ entity.name.constant.d +// ^ keyword.operator.assignment.d +// ^^ constant.numeric.integer.decimal.d +// ^ punctuation.separator.sequence.d + Foo // f +// ^^^^^^^^^ meta.enum.d +// ^^^ entity.name.constant.d +// ^^^^^ comment.line.double-slash.d + 2 + //^ meta.enum.d invalid.illegal.d + } +//^ meta.enum.d punctuation.section.block.end.d + enum f = 12; +//^^^^^^^^^^^^ meta.enum.d +//^^^^ storage.type.enum.d keyword.declaration.enum.d +// ^ entity.name.enum.d +// ^ keyword.operator.assignment.d +// ^^ constant.numeric.integer.decimal.d +// ^ punctuation.terminator.d + enum f(x, int t) = cast(x)t; +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.enum.d +//^^^^ storage.type.enum.d keyword.declaration.enum.d +// ^ entity.name.enum.d +// ^ punctuation.section.group.begin.d +// ^ variable.parameter.d +// ^ punctuation.separator.sequence.d +// ^^^ storage.type.d +// ^ variable.parameter.d +// ^ punctuation.section.group.end.d +// ^ keyword.operator.assignment.d +// ^^^^ keyword.operator.word.d +// ^ punctuation.section.parens.begin.d +// ^ storage.type.d +// ^ punctuation.section.parens.end.d +// ^ variable.other.d +// ^ punctuation.terminator.d + enum bool[] foo = 12; +//^^^^^^^^^^^^^^^^^^^^^ meta.enum.d +//^^^^ storage.type.enum.d keyword.declaration.enum.d +// ^^^^ storage.type.d +// ^ punctuation.section.brackets.begin.d +// ^ punctuation.section.brackets.end.d +// ^^^ entity.name.enum.d +// ^ keyword.operator.assignment.d +// ^^ constant.numeric.integer.decimal.d +// ^ punctuation.terminator.d + enum fool +//^^^^^^^^^^ meta.enum.d +//^^^^ storage.type.enum.d keyword.declaration.enum.d +// ^^^^ entity.name.enum.d + { +//^ meta.enum.d punctuation.section.block.begin.d + } +//^ meta.enum.d punctuation.section.block.end.d + enum uint a = 1, b = 2, exponentBits = 3; +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.enum.d +//^^^^ storage.type.enum.d keyword.declaration.enum.d +// ^^^^ storage.type.d +// ^ entity.name.enum.d +// ^ keyword.operator.assignment.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.separator.sequence.d +// ^ entity.name.enum.d +// ^ keyword.operator.assignment.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.separator.sequence.d +// ^^^^^^^^^^^^ entity.name.enum.d +// ^ keyword.operator.assignment.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.terminator.d + enum immutable(Char)[] seqBefore = "["; +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.enum.d +//^^^^ storage.type.enum.d keyword.declaration.enum.d +// ^^^^^^^^^ storage.modifier.d +// ^ punctuation.section.group.begin.d +// ^^^^ storage.type.d +// ^ punctuation.section.group.end.d +// ^ punctuation.section.brackets.begin.d +// ^ punctuation.section.brackets.end.d +// ^^^^^^^^^ entity.name.enum.d +// ^ keyword.operator.assignment.d +// ^^^ string.quoted.double.d +// ^ punctuation.terminator.d + enum foo : int; +//^^^^^^^^^^^^^^^ meta.enum.d +//^^^^ storage.type.enum.d keyword.declaration.enum.d +// ^^^ entity.name.enum.d +// ^ punctuation.separator.mapping.d +// ^^^ meta.path.d storage.type.d +// ^ punctuation.terminator.d + enum ulong +//^^^^^^^^^^^ meta.enum.d +//^^^^ storage.type.enum.d keyword.declaration.enum.d +// ^^^^^ storage.type.d + a = 1 << 2, + //^^^^^^^^^^^^ meta.enum.d + //^ entity.name.enum.d + // ^ keyword.operator.assignment.d + // ^ constant.numeric.integer.decimal.d + // ^^ keyword.operator.bitwise.d + // ^ constant.numeric.integer.decimal.d + // ^ punctuation.separator.sequence.d + b = 1 << 3; + //^^^^^^^^^^^ meta.enum.d + //^ entity.name.enum.d + // ^ keyword.operator.assignment.d + // ^ constant.numeric.integer.decimal.d + // ^^ keyword.operator.bitwise.d + // ^ constant.numeric.integer.decimal.d + // ^ punctuation.terminator.d + enum foo +//^^^^^^^^^ meta.enum.d +//^^^^ storage.type.enum.d keyword.declaration.enum.d +// ^^^ entity.name.enum.d + bar = 2; + //^^^^^^^^ meta.enum.d + //^^^ entity.name.enum.d + // ^ keyword.operator.assignment.d + // ^ constant.numeric.integer.decimal.d + // ^ punctuation.terminator.d + enum Attr; +//^^^^^^^^^^ meta.enum.d +//^^^^ storage.type.enum.d keyword.declaration.enum.d + + version(unittest) {} +//^^^^^^^ keyword.control.conditional.d +// ^ punctuation.section.parens.begin.d +// ^^^^^^^^ keyword.control.conditional.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d + version(assert) {} +//^^^^^^^ keyword.control.conditional.d +// ^ punctuation.section.parens.begin.d +// ^^^^^^ keyword.other.assert.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d + version(foo) {} +//^^^^^^^ keyword.control.conditional.d +// ^ punctuation.section.parens.begin.d +// ^^^ constant.other.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d + version(1): +//^^^^^^^ keyword.control.conditional.d +// ^ punctuation.section.parens.begin.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.separator.d + + debug: +//^^^^^ keyword.control.conditional.d +// ^ punctuation.separator.d + debug {} else {} +//^^^^^ keyword.control.conditional.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d +// ^^^^ keyword.control.conditional.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d + debug(foo) {} else: +//^^^^^ keyword.control.conditional.d +// ^ punctuation.section.parens.begin.d +// ^^^ constant.other.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d +// ^^^^ keyword.control.conditional.d +// ^ punctuation.separator.d + debug foo bar; +//^^^^^ keyword.control.conditional.d +// ^^^ storage.type.d +// ^^^ variable.other.d +// ^ punctuation.terminator.d + + debug = 2; +//^^^^^ keyword.control.conditional.d +// ^ keyword.operator.assignment.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.terminator.d + version = foo; +//^^^^^^^ keyword.control.conditional.d +// ^ keyword.operator.assignment.d +// ^^^ entity.name.constant.d +// ^ punctuation.terminator.d + version +//^^^^^^^ keyword.control.conditional.d + = 5; +// ^ keyword.operator.assignment.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.terminator.d + int foo = true; + static if (12 + 5): +//^^^^^^ storage.modifier.d +// ^^ keyword.control.conditional.d +// ^ punctuation.section.parens.begin.d +// ^^ constant.numeric.integer.decimal.d +// ^ keyword.operator.arithmetic.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.separator.d + static if (true) {} else {} +//^^^^^^ storage.modifier.d +// ^^ keyword.control.conditional.d +// ^ punctuation.section.parens.begin.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d +// ^^^^ keyword.control.conditional.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d + static if (0) { +//^^^^^^ storage.modifier.d +// ^^ keyword.control.conditional.d +// ^ punctuation.section.parens.begin.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.section.block.begin.d + } else static if (1) { +//^ punctuation.section.block.end.d +// ^^^^ keyword.control.conditional.d +// ^^^^^^ storage.modifier.d +// ^^ keyword.control.conditional.d +// ^ punctuation.section.parens.begin.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.section.block.begin.d + } +//^ punctuation.section.block.end.d + + static foreach (int foo, f; 12..3) { +//^^^^^^ keyword.control.loop.d +// ^^^^^^^ keyword.control.loop.d +// ^ punctuation.section.parens.begin.d + static foreach (int a; 123) { + //^^^^^^ keyword.control.loop.d + // ^^^^^^^ keyword.control.loop.d + // ^ punctuation.section.parens.begin.d + // ^^^ storage.type.d + // ^ variable.parameter.d + // ^ punctuation.separator.sequence.d + // ^^^ constant.numeric.integer.decimal.d + // ^ punctuation.section.parens.end.d + // ^ punctuation.section.block.begin.d + // ^ + } + //^ punctuation.section.block.end.d + } +//^ punctuation.section.block.end.d + + static assert(12); +//^^^^^^ keyword.other.assert.d +// ^^^^^^ keyword.other.assert.d +// ^ punctuation.section.parens.begin.d +// ^^ constant.numeric.integer.decimal.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.terminator.d + static assert(12, "foobar"); +//^^^^^^ keyword.other.assert.d +// ^^^^^^ keyword.other.assert.d +// ^ punctuation.section.parens.begin.d +// ^^ constant.numeric.integer.decimal.d +// ^ punctuation.separator.sequence.d +// ^^^^^^^^ string.quoted.double.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.terminator.d + + int[string] foo() {} +//^^^ storage.type.d +// ^ punctuation.section.brackets.begin.d +// ^^^^^^ storage.type.d +// ^ punctuation.section.brackets.end.d +// ^^^ meta.function.d entity.name.function.d +// ^^ meta.function.parameters.d +// ^ punctuation.section.group.begin.d +// ^ punctuation.section.group.end.d +// ^^ meta.function.d meta.block.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d + void bar(); + //^^^^ storage.type.d + // ^^^ meta.function.d entity.name.function.d + // ^^ meta.function.parameters.d + // ^ punctuation.section.group.begin.d + // ^ punctuation.section.group.end.d + // ^ meta.function.d punctuation.terminator.d + int[] map(int[] array, ) { + //^^^ storage.type.d + // ^ punctuation.section.brackets.begin.d + // ^ punctuation.section.brackets.end.d + // ^^^ meta.function.d entity.name.function.d + // ^^^^^^^^^^^^^^^ meta.function.parameters.d + // ^ punctuation.section.group.begin.d + // ^^^ storage.type.d + // ^ punctuation.section.brackets.begin.d + // ^ punctuation.section.brackets.end.d + // ^^^^^ variable.parameter.d + // ^ punctuation.separator.sequence.d + // ^ + // ^ meta.function.d meta.block.d punctuation.section.block.begin.d + foo(); + //^^^^^^^ meta.function.d meta.block.d + //^^^ variable.function.d + } + //^ meta.function.d meta.block.d punctuation.section.block.end.d + T[] map(T, void fn)(T[] array) { + //^ variable.other.d + // ^ punctuation.section.brackets.begin.d + // ^ punctuation.section.brackets.end.d + // ^^^ meta.function.d entity.name.function.d + // ^^^^^^^^^^^^^^^^^^^^^^^ meta.function.parameters.d + // ^ punctuation.section.group.begin.d + // ^ variable.parameter.d + // ^ punctuation.separator.sequence.d + // ^^^^ storage.type.d + // ^^ variable.parameter.d + // ^ punctuation.section.group.end.d + // ^ punctuation.section.group.begin.d + // ^ storage.type.d + // ^ punctuation.section.brackets.begin.d + // ^ punctuation.section.brackets.end.d + // ^^^^^ variable.parameter.d + // ^ punctuation.section.group.end.d + // ^ meta.function.d meta.block.d punctuation.section.block.begin.d + } + //^ meta.function.d meta.block.d punctuation.section.block.end.d + VeryLongTypeNameThatWillForceALineWrapWith80WidthLines +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ variable.other.d + veryLongFunctionNameToHelpWithTheLineWrappingThing +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.d entity.name.function.d + ( +//^ meta.function.parameters.d punctuation.section.group.begin.d + int aVeryLongArgumentName, + //^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.parameters.d + //^^^ storage.type.d + // ^^^^^^^^^^^^^^^^^^^^^ variable.parameter.d + // ^ punctuation.separator.sequence.d + ) +//^ meta.function.parameters.d punctuation.section.group.end.d + { +//^ meta.function.d meta.block.d punctuation.section.block.begin.d + int a; + //^^^^^^^ meta.function.d meta.block.d + //^^^ storage.type.d + // ^ variable.other.d + // ^ punctuation.terminator.d + } +//^ meta.function.d meta.block.d punctuation.section.block.end.d + void foo(T)(ref T[] a) {} +//^^^^ storage.type.d +// ^^^ meta.function.d entity.name.function.d +// ^^^^^^^^^^^^^^ meta.function.parameters.d +// ^ punctuation.section.group.begin.d +// ^ variable.parameter.d +// ^ punctuation.section.group.end.d +// ^ punctuation.section.group.begin.d +// ^^^ storage.modifier.d +// ^ storage.type.d +// ^ punctuation.section.brackets.begin.d +// ^ punctuation.section.brackets.end.d +// ^ variable.parameter.d +// ^ punctuation.section.group.end.d +// ^^ meta.function.d meta.block.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d + void f(T..., string[] B...)(ref T[] a...) {} +//^^^^ storage.type.d +// ^ meta.function.d entity.name.function.d +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.parameters.d +// ^ punctuation.section.group.begin.d +// ^ variable.parameter.d +// ^^^ keyword.operator.variadic.d +// ^ punctuation.separator.sequence.d +// ^^^^^^ storage.type.d +// ^ punctuation.section.brackets.begin.d +// ^ punctuation.section.brackets.end.d +// ^ variable.parameter.d +// ^^^ keyword.operator.variadic.d +// ^ punctuation.section.group.end.d +// ^ punctuation.section.group.begin.d +// ^^^ storage.modifier.d +// ^ storage.type.d +// ^ punctuation.section.brackets.begin.d +// ^ punctuation.section.brackets.end.d +// ^ variable.parameter.d +// ^^^ keyword.operator.variadic.d +// ^ punctuation.section.group.end.d +// ^^ meta.function.d meta.block.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d + void f(T = int)(T[] a = [1, 2, 3]) {} +//^^^^ storage.type.d +// ^ meta.function.d entity.name.function.d +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.parameters.d +// ^ punctuation.section.group.begin.d +// ^ variable.parameter.d +// ^ keyword.operator.assignment.d +// ^^^ storage.type.d +// ^ punctuation.section.group.end.d +// ^ punctuation.section.group.begin.d +// ^ storage.type.d +// ^ punctuation.section.brackets.begin.d +// ^ punctuation.section.brackets.end.d +// ^ variable.parameter.d +// ^ keyword.operator.assignment.d +// ^ punctuation.section.brackets.begin.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.separator.sequence.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.separator.sequence.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.section.brackets.end.d +// ^ punctuation.section.group.end.d +// ^^ meta.function.d meta.block.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d + void foo(in int a, out int f) {} +//^^^^ storage.type.d +// ^^^ meta.function.d entity.name.function.d +// ^^^^^^^^^^^^^^^^^^^^^ meta.function.parameters.d +// ^ punctuation.section.group.begin.d +// ^^ storage.modifier.d +// ^^^ storage.type.d +// ^ variable.parameter.d +// ^ punctuation.separator.sequence.d +// ^^^ storage.modifier.d +// ^^^ storage.type.d +// ^ variable.parameter.d +// ^ punctuation.section.group.end.d +// ^^ meta.function.d meta.block.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d + void opEquals(int a) {} +//^^^^ storage.type.d +// ^^^^^^^^ meta.function.d entity.name.function.operator.d +// ^^^^^^^ meta.function.parameters.d +// ^ punctuation.section.group.begin.d +// ^^^ storage.type.d +// ^ variable.parameter.d +// ^ punctuation.section.group.end.d +// ^^ meta.function.d meta.block.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d + caster foo() {} +//^^^^^^ storage.type.d +// ^^^ meta.function.d entity.name.function.d +// ^^ meta.function.parameters.d +// ^ punctuation.section.group.begin.d +// ^ punctuation.section.group.end.d +// ^^ meta.function.d meta.block.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d + auto foo() {} +//^^^^ storage.modifier.d +// ^^^ meta.function.d entity.name.function.d +// ^^ meta.function.parameters.d +// ^ punctuation.section.group.begin.d +// ^ punctuation.section.group.end.d +// ^^ meta.function.d meta.block.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d + static foo() {} +//^^^^^^ storage.modifier.d +// ^^^ meta.function.d entity.name.function.d +// ^^ meta.function.parameters.d +// ^ punctuation.section.group.begin.d +// ^ punctuation.section.group.end.d +// ^^ meta.function.d meta.block.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d + @property foo() {} +//^^^^^^^^^ storage.modifier.d +// ^^^ meta.function.d entity.name.function.d +// ^^ meta.function.parameters.d +// ^ punctuation.section.group.begin.d +// ^ punctuation.section.group.end.d +// ^^ meta.function.d meta.block.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d + pure foo() {} +//^^^^ storage.modifier.d +// ^^^ meta.function.d entity.name.function.d +// ^^ meta.function.parameters.d +// ^ punctuation.section.group.begin.d +// ^ punctuation.section.group.end.d +// ^^ meta.function.d meta.block.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d + const(string) foo(T)(ref const(int) a, auto ref T b) {} +//^^^^^ storage.modifier.d +// ^ punctuation.section.group.begin.d +// ^^^^^^ storage.type.d +// ^ punctuation.section.group.end.d +// ^^^ meta.function.d entity.name.function.d +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.parameters.d +// ^ punctuation.section.group.begin.d +// ^ variable.parameter.d +// ^ punctuation.section.group.end.d +// ^ punctuation.section.group.begin.d +// ^^^ storage.modifier.d +// ^^^^^ storage.modifier.d +// ^ punctuation.section.group.begin.d +// ^^^ storage.type.d +// ^ punctuation.section.group.end.d +// ^ variable.parameter.d +// ^ punctuation.separator.sequence.d +// ^^^^ storage.modifier.d +// ^^^ storage.modifier.d +// ^ storage.type.d +// ^ variable.parameter.d +// ^ punctuation.section.group.end.d +// ^^ meta.function.d meta.block.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d + void foo(A : int, string a : "s") {} +//^^^^ storage.type.d +// ^^^ meta.function.d entity.name.function.d +// ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.parameters.d +// ^ punctuation.section.group.begin.d +// ^ variable.parameter.d +// ^ keyword.operator.comparison.d +// ^^^ storage.type.d +// ^ punctuation.separator.sequence.d +// ^^^^^^ storage.type.d +// ^ variable.parameter.d +// ^ keyword.operator.comparison.d +// ^^^ string.quoted.double.d +// ^ punctuation.section.group.end.d +// ^^ meta.function.d meta.block.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d + void foo() const inout @property {} +//^^^^ storage.type.d +// ^^^ meta.function.d entity.name.function.d +// ^^ meta.function.parameters.d +// ^ punctuation.section.group.begin.d +// ^ punctuation.section.group.end.d +// ^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.d +// ^^^^^ storage.modifier.d +// ^^^^^ storage.modifier.d +// ^^^^^^^^^ storage.modifier.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d + void f() +//^^^^ storage.type.d +// ^ meta.function.d entity.name.function.d +// ^^ meta.function.parameters.d +// ^ punctuation.section.group.begin.d +// ^ punctuation.section.group.end.d + in(true) +//^^^^^^^^^ meta.function.d +//^^ keyword.control.conditional.d +// ^ punctuation.section.parens.begin.d +// ^^^^ constant.language.d +// ^ punctuation.section.parens.end.d + in(true || false) +//^^^^^^^^^^^^^^^^^^ meta.function.d +//^^ keyword.control.conditional.d +// ^ punctuation.section.parens.begin.d +// ^^^^ constant.language.d +// ^^ keyword.operator.logical.d +// ^^^^^ constant.language.d +// ^ punctuation.section.parens.end.d + out(; false || true) +//^^^^^^^^^^^^^^^^^^^^^ meta.function.d +//^^^ keyword.control.conditional.d +// ^ punctuation.section.parens.begin.d +// ^ punctuation.separator.sequence.d +// ^^^^^ constant.language.d +// ^^ keyword.operator.logical.d +// ^^^^ constant.language.d +// ^ punctuation.section.parens.end.d + {} +//^^ meta.function.d +//^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d + void f(A)() if (is(A : B)) +//^^^^ storage.type.d +// ^ meta.function.d entity.name.function.d +// ^^^^^ meta.function.parameters.d +// ^ punctuation.section.group.begin.d +// ^ variable.parameter.d +// ^ +// ^ punctuation.section.group.begin.d +// ^ punctuation.section.group.end.d +// ^^^^^^^^^^^^^^^ meta.function.d +// ^^ keyword.control.conditional.d +// ^ punctuation.section.parens.begin.d +// ^^ keyword.other.d +// ^ punctuation.section.parens.begin.d +// ^ storage.type.d +// ^ keyword.operator.comparison.d +// ^ storage.type.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.section.parens.end.d + in {} +//^^^^^^ meta.function.d +//^^ keyword.control.conditional.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d + out (foo) { +//^^^^^^^^^^^^ meta.function.d +//^^^ keyword.control.conditional.d +// ^ punctuation.section.parens.begin.d +// ^^^ variable.parameter.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.section.block.begin.d + assert(true); + //^^^^^^^^^^^^^^ meta.function.d meta.block.d + //^^^^^^ keyword.other.assert.d + // ^ punctuation.section.parens.begin.d + // ^^^^ constant.language.d + // ^ punctuation.section.parens.end.d + // ^ punctuation.terminator.d + foo(4); + //^^^^^^^^ meta.function.d meta.block.d + //^^^^^^ meta.function-call.d + //^^^ meta.path.d variable.function.d + // ^ punctuation.section.parens.begin.d + // ^ constant.numeric.integer.decimal.d + // ^ punctuation.section.parens.end.d + // ^ punctuation.terminator.d + } +//^ meta.function.d meta.block.d punctuation.section.block.end.d + body { +//^^^^ keyword.other.d +// ^ punctuation.section.block.begin.d + } + void f() +//^^^^ storage.type.d +// ^ meta.function.d entity.name.function.d +// ^^ meta.function.parameters.d +// ^ punctuation.section.group.begin.d +// ^ punctuation.section.group.end.d + out (foo; foo == true) {} +//^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.d +//^^^ keyword.control.conditional.d +// ^ punctuation.section.parens.begin.d +// ^^^ variable.parameter.d +// ^ punctuation.separator.sequence.d +// ^^^ variable.other.d +// ^^ keyword.operator.comparison.d +// ^^^^ constant.language.d +// ^ punctuation.section.parens.end.d +// ^^ meta.block.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d + void f(...); +//^^^^ storage.type.d +// ^ entity.name.function.d +// ^ punctuation.section.group.begin.d +// ^^^ keyword.operator.variadic.d +// ^ punctuation.section.group.end.d +// ^ punctuation.terminator.d + + this(int foo) { +//^^^^ meta.function.d entity.name.function.constructor.d +// ^^^^^^^^^ meta.function.parameters.d +// ^ punctuation.section.group.begin.d +// ^^^ storage.type.d +// ^^^ variable.parameter.d +// ^ punctuation.section.group.end.d +// ^ meta.function.d meta.block.d punctuation.section.block.begin.d + } +//^ meta.function.d meta.block.d punctuation.section.block.end.d + ~this() @disable; +//^^^^^ meta.function.d entity.name.function.destructor.d +// ^^ meta.function.parameters.d +// ^ punctuation.section.group.begin.d +// ^ punctuation.section.group.end.d +// ^^^^^^^^^ meta.function.d +// ^^^^^^^^ storage.modifier.d +// ^ punctuation.terminator.d + this(this) {} +//^^^^ meta.function.d entity.name.function.post-blit.d +// ^^^^^^ meta.function.d meta.function.parameters.d +// ^ punctuation.section.group.begin.d +// ^^^^ variable.language.d +// ^ punctuation.section.group.end.d +// ^^ meta.function.d meta.block.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d + this(1, 2, 3); +//^^^^ meta.function.d entity.name.function.constructor.d +// ^^^^^^^^^ meta.function.parameters.d +// ^ punctuation.section.group.begin.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.separator.sequence.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.separator.sequence.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.section.group.end.d +// ^ meta.function.d punctuation.terminator.d + this(T)(T foo); +//^^^^ meta.function.d entity.name.function.constructor.d +// ^^^^^^^^^^ meta.function.parameters.d +// ^ punctuation.section.group.begin.d +// ^ variable.other.d +// ^ punctuation.section.group.end.d +// ^ punctuation.section.group.begin.d +// ^ storage.type.d +// ^^^ variable.parameter.d +// ^ punctuation.section.group.end.d +// ^ meta.function.d punctuation.terminator.d + this(in ref foo t) {} +//^^^^ meta.function.d entity.name.function.constructor.d +// ^^^^^^^^^^^^^^ meta.function.parameters.d meta.function.parameters.d +// ^ punctuation.section.group.begin.d +// ^^ storage.modifier.d +// ^^^ storage.modifier.d +// ^^^ storage.type.d +// ^ variable.parameter.d +// ^ punctuation.section.group.end.d +// ^^ meta.function.d meta.block.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d + + static this(int foo) { int b; } +//^^^^^^ storage.modifier.d +// ^^^^ meta.function.d entity.name.function.constructor.d +// ^^^^^^^^^ meta.function.parameters.d +// ^ punctuation.section.group.begin.d +// ^^^ storage.type.d +// ^^^ variable.parameter.d +// ^ punctuation.section.group.end.d +// ^^^^^^^^^^ meta.function.d meta.block.d +// ^ punctuation.section.block.begin.d +// ^^^ storage.type.d +// ^ variable.other.d +// ^ punctuation.terminator.d +// ^ punctuation.section.block.end.d + static ~this() { int a; } +//^^^^^^ storage.modifier.d +// ^^^^^ meta.function.d entity.name.function.destructor.d +// ^^ meta.function.parameters.d +// ^ punctuation.section.group.begin.d +// ^ punctuation.section.group.end.d +// ^^^^^^^^^^ meta.function.d meta.block.d +// ^ punctuation.section.block.begin.d +// ^^^ storage.type.d +// ^ variable.other.d +// ^ punctuation.terminator.d +// ^ punctuation.section.block.end.d + + invariant(0, "test") { +//^^^^^^^^^ keyword.other.invariant.d +// ^ punctuation.section.parens.begin.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.separator.sequence.d +// ^^^^^^ string.quoted.double.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.section.block.begin.d + invariant(); + //^^^^^^^^^ keyword.other.invariant.d + // ^ punctuation.section.parens.begin.d + // ^ punctuation.section.parens.end.d + invariant {} + //^^^^^^^^^ keyword.other.invariant.d + // ^ punctuation.section.block.begin.d + // ^ punctuation.section.block.end.d + } +//^ punctuation.section.block.end.d + + unittest { +//^^^^^^^^ keyword.control.conditional.d +// ^ punctuation.section.block.begin.d + unittest @safe { + //^^^^^^^^ keyword.control.conditional.d + // ^^^^^ meta.block.d storage.modifier.d + // ^ meta.block.d meta.block.d punctuation.section.block.begin.d + } + //^ punctuation.section.block.end.d + } +//^ punctuation.section.block.end.d + + template foo(T, A) { +//^^^^^^^^ storage.type.d keyword.declaration.template.d +// ^^^ entity.name.template.d +// ^ punctuation.section.group.begin.d +// ^ variable.parameter.d +// ^ punctuation.separator.sequence.d +// ^ variable.parameter.d +// ^ punctuation.section.group.end.d +// ^ punctuation.section.block.begin.d + template a(size_t f) { + //^^^^^^^^ storage.type.d keyword.declaration.template.d + // ^ entity.name.template.d + // ^ punctuation.section.group.begin.d + // ^^^^^^ storage.type.d + // ^ variable.parameter.d + // ^ punctuation.section.group.end.d + // ^ punctuation.section.block.begin.d + } + //^ punctuation.section.block.end.d + } +//^ punctuation.section.block.end.d + template foo(T) if (is(T : class)) {} +//^^^^^^^^ storage.type.d keyword.declaration.template.d +// ^^^ entity.name.template.d +// ^ punctuation.section.group.begin.d +// ^ variable.parameter.d +// ^ punctuation.section.group.end.d +// ^^ keyword.control.conditional.d +// ^ punctuation.section.parens.begin.d +// ^^ keyword.other.d +// ^ punctuation.section.parens.begin.d +// ^ storage.type.d +// ^ keyword.operator.comparison.d +// ^^^^^ storage.type.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d + @property foo(T) = { +//^^^^^^^^^ storage.modifier.d +// ^^^ entity.name.function.d +// ^ punctuation.section.group.begin.d +// ^ variable.parameter.d +// ^ punctuation.section.group.end.d +// ^ keyword.operator.assignment.d +// ^ punctuation.section.block.begin.d + T a; + //^ storage.type.d + // ^ variable.other.d + // ^ punctuation.terminator.d + }(); +//^ punctuation.section.block.end.d +// ^ punctuation.section.parens.begin.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.terminator.d + + mixin template f(int a) { +//^^^^^ keyword.control.d +// ^^^^^^^^ storage.type.d keyword.declaration.template.d +// ^ entity.name.template.d +// ^ punctuation.section.group.begin.d +// ^^^ storage.type.d +// ^ variable.parameter.d +// ^ punctuation.section.group.end.d +// ^ punctuation.section.block.begin.d + } +//^ punctuation.section.block.end.d + mixin Foo!("foo"); +//^^^^^ keyword.control.d +// ^^^^^^^^^^^ meta.function-call.d +// ^^^ variable.function.d +// ^ punctuation.section.generic.begin.d +// ^ punctuation.section.parens.begin.d +// ^^^^^ string.quoted.double.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.terminator.d + mixin Template e; +//^^^^^ keyword.control.d +// ^^^^^^^^ variable.other.d +// ^ variable.other.d +// ^ punctuation.terminator.d + mixin("foo"); +//^^^^^ keyword.control.d +// ^ punctuation.section.parens.begin.d +// ^ punctuation.definition.string.begin.d +// ^^^^^ string.quoted.double.d +// ^ punctuation.definition.string.end.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.terminator.d + + foo: +//^^^ entity.name.label.d +// ^ punctuation.separator.d + + if (2) { +//^^ keyword.control.conditional.d +// ^ punctuation.section.parens.begin.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.section.block.begin.d + } +//^ punctuation.section.block.end.d + if (1) {} else {} +//^^ keyword.control.conditional.d +// ^ punctuation.section.parens.begin.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d +// ^^^^ keyword.control.conditional.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d + if (1) 1; + if (1) {} else 1; +//^^ keyword.control.conditional.d +// ^ punctuation.section.parens.begin.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d +// ^^^^ keyword.control.conditional.d +// ^ constant.numeric.integer.decimal.d + + while (2) 1; +//^^^^^ keyword.control.loop.d +// ^ punctuation.section.parens.begin.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.section.parens.end.d +// ^ constant.numeric.integer.decimal.d + while (2) +//^^^^^ keyword.control.loop.d +// ^ punctuation.section.parens.begin.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.section.parens.end.d + { +//^ punctuation.section.block.begin.d + do 2; + //^^ keyword.control.loop.d + // ^ constant.numeric.integer.decimal.d + while (3); + //^^^^^ keyword.control.loop.d + // ^ punctuation.section.parens.begin.d + // ^ constant.numeric.integer.decimal.d + // ^ punctuation.section.parens.end.d + do + //^^ keyword.control.loop.d + { + //^ punctuation.section.block.begin.d + } while (1); + //^ punctuation.section.block.end.d + // ^^^^^ keyword.control.loop.d + // ^ punctuation.section.parens.begin.d + // ^ constant.numeric.integer.decimal.d + // ^ punctuation.section.parens.end.d + } +//^ punctuation.section.block.end.d + for (1; 2; 3) { +//^^^ keyword.control.loop.d +// ^ punctuation.section.parens.begin.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.terminator.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.terminator.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.section.block.begin.d + } +//^ punctuation.section.block.end.d + for(int a;;12) { +//^^^ keyword.control.loop.d +// ^ punctuation.section.parens.begin.d +// ^^^ storage.type.d +// ^ variable.other.d +// ^^ punctuation.terminator.d +// ^^ constant.numeric.integer.decimal.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.section.block.begin.d + } + for (size_t i; !val.empty; val.popFront(), ++i) {} +//^^^ keyword.control.loop.d +// ^ punctuation.section.parens.begin.d +// ^^^^^^ storage.type.d +// ^ variable.other.d +// ^ punctuation.terminator.d +// ^ keyword.operator.logical.d +// ^^^ variable.other.d +// ^ punctuation.accessor.dot.d +// ^^^^^ variable.other.d +// ^ punctuation.terminator.d +// ^^^ variable.other.d +// ^ punctuation.accessor.dot.d +// ^^^^^^^^^^ meta.function-call.d +// ^^^^^^^^ variable.function.d +// ^ punctuation.section.parens.begin.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.separator.sequence.d +// ^^ keyword.operator.arithmetic.d +// ^ variable.other.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d + for (; a *b < cast(int)2;) {} +//^^^ keyword.control.loop.d +// ^ punctuation.section.parens.begin.d +// ^ punctuation.terminator.d +// ^ variable.other.d +// ^ keyword.operator.arithmetic.d +// ^ variable.other.d +// ^ keyword.operator.comparison.d +// ^^^^ keyword.operator.word.d +// ^ punctuation.section.parens.begin.d +// ^^^ storage.type.d +// ^ punctuation.section.parens.end.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.terminator.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d + foreach (int a; 2..5) { +//^^^^^^^ keyword.control.loop.d +// ^ punctuation.section.parens.begin.d +// ^^^ storage.type.d +// ^ variable.parameter.d +// ^ punctuation.separator.sequence.d +// ^ constant.numeric.integer.decimal.d +// ^^ keyword.operator.slice.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.section.block.begin.d + foreach_reverse (int a; 2) { + //^^^^^^^^^^^^^^^ keyword.control.loop.d + // ^ punctuation.section.parens.begin.d + // ^^^ storage.type.d + // ^ variable.parameter.d + // ^ punctuation.separator.sequence.d + // ^ constant.numeric.integer.decimal.d + // ^ punctuation.section.parens.end.d + // ^ punctuation.section.block.begin.d + } + //^ punctuation.section.block.end.d + } +//^ punctuation.section.block.end.d + foreach (ref a; foo) {} +//^^^^^^^ keyword.control.loop.d +// ^ punctuation.section.parens.begin.d +// ^^^ storage.modifier.d +// ^ variable.parameter.d +// ^ punctuation.separator.sequence.d +// ^^^ variable.other.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d + + continue; +//^^^^^^^^ keyword.control.flow.d +// ^ punctuation.terminator.d + continue foo; +//^^^^^^^^ keyword.control.flow.d +// ^^^ variable.other.constant.d +// ^ punctuation.terminator.d + break; +//^^^^^ keyword.control.flow.d +// ^ punctuation.terminator.d + break foo; +//^^^^^ keyword.control.flow.d +// ^^^ variable.other.constant.d +// ^ punctuation.terminator.d + return; +//^^^^^^ keyword.control.flow.d +// ^ punctuation.terminator.d + return 2; +//^^^^^^ keyword.control.flow.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.terminator.d + goto foo; +//^^^^ keyword.control.flow.d +// ^^^ variable.other.constant.d +// ^ punctuation.terminator.d + goto default; +//^^^^ keyword.control.flow.d +// ^^^^^^^ keyword.control.flow.d +// ^ punctuation.terminator.d + goto case; +//^^^^ keyword.control.flow.d +// ^^^^ keyword.control.flow.d +// ^ punctuation.terminator.d + goto case 2; +//^^^^ keyword.control.flow.d +// ^^^^ keyword.control.flow.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.terminator.d + + with (2) {} +//^^^^ keyword.other.with.d +// ^ punctuation.section.parens.begin.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d + with (2) 3; +//^^^^ keyword.other.with.d +// ^ punctuation.section.parens.begin.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.section.parens.end.d +// ^ constant.numeric.integer.decimal.d + + synchronized (3) {} +//^^^^^^^^^^^^ keyword.other.synchronized.d +// ^ punctuation.section.parens.begin.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d + synchronized(3); +//^^^^^^^^^^^^ keyword.other.synchronized.d +// ^ punctuation.section.parens.begin.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.section.parens.end.d + + try { +//^^^ keyword.control.exception.d +// ^ punctuation.section.block.begin.d + } catch (int a) { +//^ punctuation.section.block.end.d +// ^^^^^ keyword.control.exception.d +// ^ punctuation.section.parens.begin.d +// ^^^ storage.type.d +// ^ variable.parameter.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.section.block.begin.d + } catch (Throwable; foo a) { +//^ punctuation.section.block.end.d +// ^^^^^ keyword.control.exception.d +// ^ punctuation.section.parens.begin.d +// ^^^^^^^^^ storage.type.d +// ^ invalid.illegal.d +// ^^^ meta.path.d storage.type.d +// ^ invalid.illegal.d +// ^ punctuation.section.block.begin.d + } +//^ punctuation.section.block.end.d + finally { +//^^^^^^^ keyword.control.exception.d +// ^ punctuation.section.block.begin.d + } +//^ punctuation.section.block.end.d + throw 3; +//^^^^^ keyword.control.flow.exception.d +// ^ constant.numeric.integer.decimal.d + + scope (exit) {} +//^^^^^ keyword.control.flow.d +// ^ punctuation.section.parens.begin.d +// ^^^^ keyword.control.flow.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d + scope(failure) {} +//^^^^^ keyword.control.flow.d +// ^ punctuation.section.parens.begin.d +// ^^^^^^^ keyword.control.flow.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d + scope(success) 2; +//^^^^^ keyword.control.flow.d +// ^ punctuation.section.parens.begin.d +// ^^^^^^^ keyword.control.flow.d +// ^ punctuation.section.parens.end.d +// ^ constant.numeric.integer.decimal.d + + asm { +//^^^ keyword.declaration.asm.d +// ^ punctuation.section.block.begin.d + foo; // foo +// ^ punctuation.terminator.d +// ^^^^^^ comment.line.double-slash.d + foo bar; +// ^ punctuation.terminator.d + } +//^ punctuation.section.block.end.d + asm nothrow @safe {} +//^^^ keyword.declaration.asm.d +// ^^^^^^^ storage.modifier.d +// ^^^^^ storage.modifier.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d + + f a = new (12, "foo") string[12]("foo", "bar")[14]; +//^ storage.type.d +// ^ variable.other.d +// ^ keyword.operator.assignment.d +// ^^^ keyword.operator.word.d +// ^ punctuation.section.parens.begin.d +// ^^ constant.numeric.integer.decimal.d +// ^ punctuation.separator.sequence.d +// ^^^^^ string.quoted.double.d +// ^ punctuation.section.parens.end.d +// ^^^^^^ storage.type.d +// ^ punctuation.section.brackets.begin.d +// ^^ constant.numeric.integer.decimal.d +// ^ punctuation.section.brackets.end.d +// ^ punctuation.section.parens.begin.d +// ^^^^^ string.quoted.double.d +// ^ punctuation.separator.sequence.d +// ^^^^^ string.quoted.double.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.section.brackets.begin.d +// ^^ constant.numeric.integer.decimal.d +// ^ punctuation.section.brackets.end.d +// ^ punctuation.terminator.d + i = new Foo(); +//^ variable.other.d +// ^ keyword.operator.assignment.d +// ^^^ keyword.operator.word.d +// ^^^^^ meta.function-call.d +// ^^^ variable.function.d +// ^ punctuation.section.parens.begin.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.terminator.d + new(1, 2, 3) string[12]; +//^^^ keyword.operator.word.d +// ^ punctuation.section.parens.begin.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.separator.sequence.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.separator.sequence.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.section.parens.end.d +// ^^^^^^ storage.type.d +// ^ punctuation.section.brackets.begin.d +// ^^ constant.numeric.integer.decimal.d +// ^ punctuation.section.brackets.end.d +// ^ punctuation.terminator.d + auto c = new class (12) T, Bar { +//^^^^ storage.modifier.d +// ^ variable.other.d +// ^ keyword.operator.assignment.d +// ^^^ keyword.operator.word.d +// ^^^^^^^^^^^^^^^^^^^^ meta.class.d +// ^^^^^ storage.type.class.d keyword.declaration.class.d +// ^ punctuation.section.parens.begin.d +// ^^ constant.numeric.integer.decimal.d +// ^ punctuation.section.parens.end.d +// ^ storage.type.d +// ^ punctuation.separator.sequence.d +// ^^^ storage.type.d +// ^ meta.block.d punctuation.section.block.begin.d + private int foo; + //^^^^^^^^^^^^^^^^^ meta.class.d meta.block.d + //^^^^^^^ storage.modifier.access-control.d + // ^^^ storage.type.d + // ^^^ variable.other.d + // ^ punctuation.terminator.d + + this(int num) { + //^^^^^^^^^^^^^^^^ meta.class.d meta.block.d + //^^^^ entity.name.function.constructor.d + // ^ punctuation.section.group.begin.d + // ^^^ storage.type.d + // ^^^ variable.parameter.d + // ^ punctuation.section.group.end.d + // ^ punctuation.section.block.begin.d + this.foo = num; + //^^^^^^^^^^^^^^^^ meta.class.d meta.block.d meta.function.d meta.block.d + //^^^^ variable.language.d + // ^^^^ meta.path.d + // ^ punctuation.accessor.dot.d + // ^^^ variable.other.d + // ^ keyword.operator.assignment.d + // ^^^ variable.other.d + // ^ punctuation.terminator.d + } + //^ meta.class.d meta.block.d meta.function.d meta.block.d punctuation.section.block.end.d + + override int foo() { + //^^^^^^^^^^^^^^^^^^^^^ meta.class.d meta.block.d + //^^^^^^^^ storage.modifier.d + // ^^^ storage.type.d + // ^^^ meta.function.d entity.name.function.d + // ^^ meta.block.d meta.function.parameters.d + // ^ punctuation.section.group.begin.d + // ^ punctuation.section.group.end.d + // ^ meta.function.d meta.block.d punctuation.section.block.begin.d + return num * 3; + //^^^^^^^^^^^^^^^^ meta.class.d meta.block.d meta.function.d meta.block.d + //^^^^^^ keyword.control.flow.d + // ^^^ meta.path.d variable.other.d + // ^ keyword.operator.arithmetic.d + // ^ constant.numeric.integer.decimal.d + // ^ punctuation.terminator.d + } + //^ meta.class.d meta.block.d meta.function.d meta.block.d punctuation.section.block.end.d + }; +//^ meta.class.d meta.block.d punctuation.section.block.end.d +// ^ punctuation.terminator.d + + mixin("a") = (12 ^^ 4) % 5 / (3++ + --4) ~ "foo"; +//^^^^^ keyword.control.d +// ^ punctuation.section.parens.begin.d +// ^^^ string.quoted.double.d +// ^ punctuation.section.parens.end.d +// ^ keyword.operator.assignment.d +// ^ punctuation.section.group.begin.d +// ^^ constant.numeric.integer.decimal.d +// ^^ keyword.operator.arithmetic.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.section.group.end.d +// ^ keyword.operator.arithmetic.d +// ^ constant.numeric.integer.decimal.d +// ^ keyword.operator.arithmetic.d +// ^ punctuation.section.group.begin.d +// ^ constant.numeric.integer.decimal.d +// ^^ keyword.operator.arithmetic.d +// ^ keyword.operator.arithmetic.d +// ^^ keyword.operator.arithmetic.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.section.group.end.d +// ^ keyword.operator.concatenation.d +// ^^^^^ string.quoted.double.d +// ^ punctuation.terminator.d + + auto f = foo ? 12 : 15; +//^^^^ storage.modifier.d +// ^ variable.other.d +// ^ keyword.operator.assignment.d +// ^^^ meta.path.d variable.other.d +// ^ keyword.operator.ternary.d +// ^^ constant.numeric.integer.decimal.d +// ^ keyword.operator.ternary.d +// ^^ constant.numeric.integer.decimal.d +// ^ punctuation.terminator.d + + foreach (ref a; foo) {} +//^^^^^^^ keyword.control.loop.d +// ^ punctuation.section.parens.begin.d +// ^^^ storage.modifier.d +// ^ variable.parameter.d +// ^ punctuation.separator.sequence.d +// ^^^ meta.path.d variable.other.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d + + int a = 2, b = 3; +//^^^ storage.type.d +// ^ variable.other.d +// ^ keyword.operator.assignment.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.separator.sequence.d +// ^ variable.other.d +// ^ keyword.operator.assignment.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.terminator.d + + a = "foo", b = "bar"; +//^ meta.path.d variable.other.d +// ^ keyword.operator.assignment.d +// ^^^^^ string.quoted.double.d +// ^ punctuation.separator.sequence.d +// ^ meta.path.d variable.other.d +// ^ keyword.operator.assignment.d +// ^^^^^ string.quoted.double.d +// ^ punctuation.terminator.d + + string[] f = [ +//^^^^^^ storage.type.d +// ^ punctuation.section.brackets.begin.d +// ^ punctuation.section.brackets.end.d +// ^ variable.other.d +// ^ keyword.operator.assignment.d +// ^ punctuation.section.brackets.begin.d + 1: 2, + //^ constant.numeric.integer.decimal.d + // ^ punctuation.separator.mapping.key-value.d + // ^ constant.numeric.integer.decimal.d + // ^ punctuation.separator.sequence.d + "foo", + //^^^^^ string.quoted.double.d + // ^ punctuation.separator.sequence.d + "bar", + //^^^^^ string.quoted.double.d + // ^ punctuation.separator.sequence.d + ]; +//^ punctuation.section.brackets.end.d + + switch (2 * 3) +//^^^^^^ keyword.control.flow.d +// ^ punctuation.section.parens.begin.d +// ^ constant.numeric.integer.decimal.d +// ^ keyword.operator.arithmetic.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.section.parens.end.d + { +//^ punctuation.section.block.begin.d + case 2 ^^ 2: + //^^^^ keyword.control.flow.d + // ^ constant.numeric.integer.decimal.d + // ^^ keyword.operator.arithmetic.d + // ^ constant.numeric.integer.decimal.d + // ^ punctuation.separator.case-statement.d + case 2, "foo": + //^^^^ keyword.control.flow.d + // ^ constant.numeric.integer.decimal.d + // ^ punctuation.separator.sequence.d + // ^ meta.string.d string.quoted.double.d punctuation.definition.string.begin.d + // ^^^^ meta.string.d string.quoted.double.d + // ^ punctuation.separator.case-statement.d + //^^^^^^^^^^^^^^ meta.block.d + case 2: .. case 4: + //^^^^ keyword.control.flow.d + // ^ constant.numeric.integer.decimal.d + // ^ punctuation.separator.case-statement.d + // ^^ keyword.operator.d + // ^^^^ keyword.control.flow.d + // ^ constant.numeric.integer.decimal.d + // ^ punctuation.separator.case-statement.d + default: + //^^^^^^^ keyword.control.flow.d + // ^ punctuation.separator.case-statement.d + } +//^ punctuation.section.block.end.d + + is(int T == class, T, int foo); +//^^ keyword.other.d +// ^ punctuation.section.parens.begin.d +// ^^^ storage.type.d +// ^ variable.parameter.d +// ^^ keyword.operator.comparison.d +// ^^^^^ storage.type.d +// ^ punctuation.separator.sequence.d +// ^ variable.parameter.d +// ^ punctuation.separator.sequence.d +// ^^^ storage.type.d +// ^^^ variable.parameter.d +// ^ punctuation.section.group.end.d +// ^ punctuation.terminator.d + is(int : foo); +//^^ keyword.other.d +// ^ punctuation.section.parens.begin.d +// ^^^ storage.type.d +// ^ keyword.operator.comparison.d +// ^^^ storage.type.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.terminator.d + is(T); +//^^ keyword.other.d +// ^ punctuation.section.parens.begin.d +// ^ meta.path.d storage.type.d +// ^ punctuation.section.parens.end.d + is(T : immutable); +//^^ keyword.other.d +// ^ punctuation.section.parens.begin.d +// ^ meta.path.d storage.type.d +// ^ keyword.operator.comparison.d +// ^^^^^^^^^ storage.modifier.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.terminator.d + is(immutable Range == immutable T[]); +//^^ keyword.other.d +// ^ punctuation.section.parens.begin.d +// ^^^^^^^^^ storage.modifier.d +// ^^^^^ meta.path.d storage.type.d +// ^^ keyword.operator.comparison.d +// ^^^^^^^^^ storage.modifier.d +// ^ meta.path.d storage.type.d +// ^ punctuation.section.brackets.begin.d +// ^ punctuation.section.brackets.end.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.terminator.d + is(foo : super); +//^^ keyword.other.d +// ^ punctuation.section.parens.begin.d +// ^^^ meta.path.d storage.type.d +// ^ keyword.operator.comparison.d +// ^^^^^ variable.language.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.terminator.d + is(foo : return); +//^^ keyword.other.d +// ^ punctuation.section.parens.begin.d +// ^^^ meta.path.d storage.type.d +// ^ keyword.operator.comparison.d +// ^^^^^^ keyword.control.flow.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.terminator.d + is(foo : class); +//^^ keyword.other.d +// ^ punctuation.section.parens.begin.d +// ^^^ meta.path.d storage.type.d +// ^ keyword.operator.comparison.d +// ^^^^^ storage.type.d keyword.declaration.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.terminator.d + + typeof(2) a(typeof('f') b); +//^^^^^^ keyword.other.d +// ^ punctuation.section.parens.begin.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.section.parens.end.d +// ^ meta.function.d entity.name.function.d +// ^^^^^^^^^^^^^^^ meta.function.parameters.d +// ^ punctuation.section.group.begin.d +// ^^^^^^ keyword.other.d +// ^ punctuation.section.parens.begin.d +// ^^^ string.quoted.single.d +// ^ punctuation.section.parens.end.d +// ^ variable.parameter.d +// ^ punctuation.section.group.end.d +// ^ meta.function.d punctuation.terminator.d + typeof(return); +//^^^^^^ keyword.other.d +// ^ punctuation.section.parens.begin.d +// ^^^^^^ keyword.other.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.terminator.d + + () @trusted => 2; +//^^ meta.function.parameters.d +//^ punctuation.section.parens.begin.d +// ^ punctuation.section.parens.end.d +// ^^^^^^^^^^^^^ meta.function.d +// ^^^^^^^^ storage.modifier.d +// ^^ storage.type.function.d keyword.declaration.function.lambda.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.terminator.d + (a => 2); +//^ punctuation.section.group.begin.d +// ^^^^^^ meta.function.d +// ^ variable.parameter.d +// ^^ storage.type.function.d keyword.declaration.function.lambda.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.section.group.end.d +// ^ punctuation.terminator.d + (foo) @trusted => foo(3); +//^ punctuation.section.group.begin.d +// ^^^ variable.other.d +// ^ punctuation.section.group.end.d +// ^^^^^^^^^^^^^^^^^^ meta.function.d +// ^^^^^^^^ storage.modifier.d +// ^^ storage.type.function.d keyword.declaration.function.lambda.d +// ^^^^^^ meta.function-call.d +// ^^^ variable.function.d +// ^ punctuation.section.parens.begin.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.terminator.d + (foo..., bar) @safe {}; +//^ punctuation.section.group.begin.d +// ^^^ variable.other.d +// ^^^ keyword.operator.variadic.d +// ^ punctuation.separator.sequence.d +// ^^^ variable.parameter.d +// ^ punctuation.section.group.end.d +// ^^^^^^^^ meta.function.d +// ^^^^^ storage.modifier.d +// ^^ meta.block.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d +// ^ punctuation.terminator.d + (foo) {} (); +//^ punctuation.section.group.begin.d +// ^^^ variable.other.d +// ^ punctuation.section.group.end.d +// ^^ meta.function.d meta.block.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d +// ^ punctuation.section.parens.begin.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.terminator.d + (int foo) pure @safe {}; +//^ punctuation.section.group.begin.d +// ^^^ storage.type.d +// ^^^ variable.parameter.d +// ^ punctuation.section.group.end.d +// ^^^^^^^^^^^^^ meta.function.d +// ^^^^ storage.modifier.d +// ^^^^^ storage.modifier.d +// ^^ meta.block.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d +// ^ punctuation.terminator.d + (a, int b, c, int d) {}; +//^ punctuation.section.group.begin.d +// ^ variable.other.d +// ^ punctuation.separator.sequence.d +// ^^^ storage.type.d +// ^ variable.parameter.d +// ^ punctuation.separator.sequence.d +// ^ variable.parameter.d +// ^ punctuation.separator.sequence.d +// ^^^ storage.type.d +// ^ variable.parameter.d +// ^ punctuation.section.group.end.d +// ^^ meta.function.d meta.block.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d +// ^ punctuation.terminator.d + + void delegate(int a ..., foo) foo; +//^^^^ storage.type.d +// ^^^^^^^^ keyword.other.d +// ^ punctuation.section.group.begin.d +// ^^^ storage.type.d +// ^ variable.parameter.d +// ^^^ keyword.operator.variadic.d +// ^ punctuation.separator.sequence.d +// ^^^ storage.type.d +// ^ punctuation.section.group.end.d +// ^^^ variable.other.d +// ^ punctuation.terminator.d + void delegate()[] foo() {} +//^^^^ storage.type.d +// ^^^^^^^^ keyword.other.d +// ^ punctuation.section.group.begin.d +// ^ punctuation.section.group.end.d +// ^ punctuation.section.brackets.begin.d +// ^ punctuation.section.brackets.end.d +// ^^^ meta.function.d entity.name.function.d +// ^^ meta.function.parameters.d +// ^ punctuation.section.group.begin.d +// ^ punctuation.section.group.end.d +// ^^ meta.function.d meta.block.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d + (void function(int foo)).sizeof; +//^ punctuation.section.group.begin.d +// ^^^^ storage.type.d +// ^^^^^^^^ keyword.other.d +// ^ punctuation.section.group.begin.d +// ^^^ storage.type.d +// ^^^ variable.parameter.d +// ^^ punctuation.section.group.end.d +// ^^^^^^^ meta.path.d +// ^ punctuation.accessor.dot.d +// ^^^^^^ variable.other.d +// ^ punctuation.terminator.d + void fn(int delegate(ref Foo, scope float function(int a)) f); +//^^^^ storage.type.d +// ^^ meta.function.d entity.name.function.d +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.parameters.d +// ^ punctuation.section.group.begin.d +// ^^^ storage.type.d +// ^^^^^^^^ keyword.other.d +// ^ punctuation.section.group.begin.d +// ^^^ storage.modifier.d +// ^^^ storage.type.d +// ^ punctuation.separator.sequence.d +// ^^^^^ storage.modifier.d +// ^^^^^ storage.type.d +// ^^^^^^^^ keyword.other.d +// ^ punctuation.section.group.begin.d +// ^^^ storage.type.d +// ^ variable.parameter.d +// ^^ punctuation.section.group.end.d +// ^ variable.parameter.d +// ^ punctuation.section.group.end.d +// ^ meta.function.d punctuation.terminator.d + return () @trusted inout {}; +//^^^^^^ keyword.control.flow.d +// ^^ meta.function.parameters.d +// ^ punctuation.section.parens.begin.d +// ^ punctuation.section.parens.end.d +// ^^^^^^^^^^^^^^^^^ meta.function.d +// ^^ meta.block.d + (in ref a) {}; +//^ punctuation.section.group.begin.d +// ^^ storage.modifier.d +// ^^^ storage.modifier.d +// ^ variable.parameter.d +// ^ punctuation.section.group.end.d +// ^^ meta.function.d meta.block.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d +// ^ punctuation.terminator.d + void delegate(int) shared dg1; +//^^^^ storage.type.d +// ^^^^^^^^ keyword.other.d +// ^ punctuation.section.group.begin.d +// ^^^ storage.type.d +// ^ punctuation.section.group.end.d +// ^^^^^^ storage.modifier.d +// ^^^ variable.other.d +// ^ punctuation.terminator.d + function(int a, string b) @trusted {}; +//^^^^^^^^ meta.function.d keyword.other.d +// ^^^^^^^^^^^^^^^^^ meta.function.parameters.d +// ^ punctuation.section.group.begin.d +// ^^^ storage.type.d +// ^ variable.parameter.d +// ^ punctuation.separator.sequence.d +// ^^^^^^ storage.type.d +// ^ variable.parameter.d +// ^ punctuation.section.group.end.d +// ^^^^^^^^^^^ meta.function.d +// ^^^^^^^^ storage.modifier.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d +// ^ punctuation.terminator.d + function size_t(foo a) {}; +//^^^^^^^^^^^^^^^ meta.function.d +//^^^^^^^^ keyword.other.d +// ^^^^^^ storage.type.d +// ^^^^^^^ meta.function.parameters.d +// ^ punctuation.section.group.begin.d +// ^^^ storage.type.d +// ^ variable.parameter.d +// ^ punctuation.section.group.end.d +// ^^ meta.function.d meta.block.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d +// ^ punctuation.terminator.d + void delegate(...) f; +//^^^^ storage.type.d +// ^^^^^^^^ keyword.other.d +// ^ punctuation.section.group.begin.d +// ^^^ keyword.operator.variadic.d +// ^ punctuation.section.group.end.d +// ^ variable.other.d +// ^ punctuation.terminator.d + + __traits(foo, a); +//^^^^^^^^ keyword.other.d +// ^ punctuation.section.parens.begin.d +// ^^^ variable.function.d +// ^ punctuation.separator.sequence.d +// ^ meta.path.d variable.other.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.terminator.d + values ~= toValue(__traits(getMember, this, primaryKey)); +//^^^^^^ meta.path.d variable.other.d +// ^^ keyword.operator.assignment.d +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.d +// ^^^^^^^ variable.function.d +// ^ punctuation.section.parens.begin.d +// ^^^^^^^^ keyword.other.d +// ^ punctuation.section.parens.begin.d +// ^^^^^^^^^ variable.function.d +// ^ punctuation.separator.sequence.d +// ^^^^ variable.language.d +// ^ punctuation.separator.sequence.d +// ^^^^^^^^^^ meta.path.d variable.other.d +// ^^ punctuation.section.parens.end.d +// ^ punctuation.terminator.d + + 3 != 3 && "s" !in [2]; +//^ constant.numeric.integer.decimal.d +// ^^ keyword.operator.comparison.d +// ^ constant.numeric.integer.decimal.d +// ^^ keyword.operator.logical.d +// ^^^ string.quoted.double.d +// ^^^ keyword.operator.comparison.d +// ^ punctuation.section.brackets.begin.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.section.brackets.end.d +// ^ punctuation.terminator.d + j ^^= 11; +//^ variable.other.d +// ^^^ keyword.operator.assignment.d +// ^^ constant.numeric.integer.decimal.d +// ^ punctuation.terminator.d + k ^^ 11 == j; +//^ variable.other.d +// ^^ keyword.operator.arithmetic.d +// ^^ constant.numeric.integer.decimal.d +// ^^ keyword.operator.comparison.d +// ^ variable.other.d +// ^ punctuation.terminator.d + x *= 12345; +//^ variable.other.d +// ^^ keyword.operator.assignment.d +// ^^^^^ constant.numeric.integer.decimal.d +// ^ punctuation.terminator.d + foo(); +//^^^^^ meta.function-call.d +//^^^ variable.function.d +// ^ punctuation.section.parens.begin.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.terminator.d + a != 2; +//^ variable.other.d +// ^^ keyword.operator.comparison.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.terminator.d + + .AliasSeq!(immutable char, int); +//^ punctuation.accessor.dot.d +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.d +// ^^^^^^^^ variable.function.d +// ^ punctuation.section.generic.begin.d +// ^ punctuation.section.parens.begin.d +// ^^^^^^^^^ storage.modifier.d +// ^^^^ storage.type.d +// ^ punctuation.separator.sequence.d +// ^^^ storage.type.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.terminator.d + + cast(Unqual!T*).foo; +//^^^^ keyword.operator.word.d +// ^ punctuation.section.parens.begin.d +// ^^^^^^^^ meta.function-call.d +// ^^^^^^ meta.path.d variable.function.d +// ^ keyword.operator.d +// ^ meta.path.d variable.other.d +// ^ keyword.operator.pointer.d +// ^ punctuation.section.parens.end.d +// ^^^^ meta.path.d +// ^ punctuation.accessor.dot.d +// ^^^ variable.other.d +// ^ punctuation.terminator.d + + void toString(Writer)(ref Writer w, const ref FormatSpec!char fmt) {} +//^^^^ storage.type.d +// ^^^^^^^^ meta.function.d entity.name.function.d +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.parameters.d +// ^ punctuation.section.group.begin.d +// ^^^^^^ variable.parameter.d +// ^ punctuation.section.group.end.d +// ^ punctuation.section.group.begin.d +// ^^^ storage.modifier.d +// ^^^^^^ storage.type.d +// ^ variable.parameter.d +// ^ punctuation.separator.sequence.d +// ^^^^^ storage.modifier.d +// ^^^ storage.modifier.d +// ^^^^^^^^^^^^^^^ meta.function-call.d +// ^^^^^^^^^^ variable.function.d +// ^ keyword.operator.d +// ^^^^ storage.type.d +// ^^^ variable.parameter.d +// ^ punctuation.section.group.end.d +// ^^ meta.function.d meta.block.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d + + auto sc1 = const(S1)(); +//^^^^ storage.modifier.d +// ^^^ variable.other.d +// ^ keyword.operator.assignment.d +// ^^^^^ storage.modifier.d +// ^ punctuation.section.group.begin.d +// ^^ storage.type.d +// ^ punctuation.section.group.end.d +// ^ punctuation.section.parens.begin.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.terminator.d + + auto reference = new ubyte[](2048 + 1); +//^^^^ storage.modifier.d +// ^^^^^^^^^ variable.other.d +// ^ keyword.operator.assignment.d +// ^^^ keyword.operator.word.d +// ^^^^^ storage.type.d +// ^ punctuation.section.brackets.begin.d +// ^ punctuation.section.brackets.end.d +// ^ punctuation.section.parens.begin.d +// ^^^^ constant.numeric.integer.decimal.d +// ^ keyword.operator.arithmetic.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.terminator.d + + auto staticArray(size_t n, T)(scope T a) {} +//^^^^ storage.modifier.d +// ^^^^^^^^^^^ meta.function.d entity.name.function.d +// ^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.parameters.d +// ^ punctuation.section.group.begin.d +// ^^^^^^ storage.type.d +// ^ variable.parameter.d +// ^ punctuation.separator.sequence.d +// ^ variable.parameter.d +// ^ punctuation.section.group.end.d +// ^ punctuation.section.group.begin.d +// ^^^^^ storage.modifier.d +// ^ storage.type.d +// ^ variable.parameter.d +// ^ punctuation.section.group.end.d +// ^^ meta.function.d meta.block.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d + + static foreach (Sint; AliasSeq!(S, const S, immutable S)) +//^^^^^^ keyword.control.loop.d +// ^^^^^^^ keyword.control.loop.d +// ^ punctuation.section.parens.begin.d +// ^^^^ variable.parameter.d +// ^ punctuation.separator.sequence.d +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.d +// ^^^^^^^^ meta.path.d variable.function.d +// ^ punctuation.section.generic.begin.d +// ^ punctuation.section.parens.begin.d +// ^ meta.path.d variable.other.d +// ^ punctuation.separator.sequence.d +// ^^^^^ storage.modifier.d +// ^ meta.path.d storage.type.d +// ^ punctuation.separator.sequence.d +// ^^^^^^^^^ storage.modifier.d +// ^ meta.path.d storage.type.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.section.parens.end.d + static foreach (Uint; AliasSeq!(U, const U, immutable U)) {} +//^^^^^^ keyword.control.loop.d +// ^^^^^^^ keyword.control.loop.d +// ^ punctuation.section.parens.begin.d +// ^^^^ variable.parameter.d +// ^ punctuation.separator.sequence.d +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.d +// ^^^^^^^^ meta.path.d variable.function.d +// ^ punctuation.section.generic.begin.d +// ^ punctuation.section.parens.begin.d +// ^ meta.path.d variable.other.d +// ^ punctuation.separator.sequence.d +// ^^^^^ storage.modifier.d +// ^ meta.path.d storage.type.d +// ^ punctuation.separator.sequence.d +// ^^^^^^^^^ storage.modifier.d +// ^ meta.path.d storage.type.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d + + switch (foo) with (bar) {} +//^^^^^^ keyword.control.flow.d +// ^ punctuation.section.parens.begin.d +// ^^^ meta.path.d variable.other.d +// ^ punctuation.section.parens.end.d +// ^^^^ keyword.other.with.d +// ^ punctuation.section.parens.begin.d +// ^^^ meta.path.d variable.other.d +// ^ punctuation.section.parens.end.d +// ^^ meta.block.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d + + Foo!2 foo; +//^^^^^ meta.function-call.d +//^^^ meta.path.d variable.function.d +// ^ keyword.operator.d +// ^ constant.numeric.integer.decimal.d +// ^^^ variable.other.d +// ^ punctuation.terminator.d + + void[int**]* foo; +//^^^^ storage.type.d +// ^ punctuation.section.brackets.begin.d +// ^^^ storage.type.d +// ^^ keyword.operator.pointer.d +// ^ punctuation.section.brackets.end.d +// ^ keyword.operator.pointer.d +// ^^^ variable.other.d +// ^ punctuation.terminator.d + a * 2; +//^ meta.path.d variable.other.d +// ^ keyword.operator.arithmetic.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.terminator.d + void* foo() {} +//^^^^ storage.type.d +// ^ keyword.operator.pointer.d +// ^^^ meta.function.d entity.name.function.d +// ^^ meta.function.parameters.d +// ^ punctuation.section.group.begin.d +// ^ punctuation.section.group.end.d +// ^^ meta.function.d meta.block.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d + a[b] * c; +//^ meta.path.d variable.other.d +// ^ punctuation.section.brackets.begin.d +// ^ meta.path.d variable.other.d +// ^ punctuation.section.brackets.end.d +// ^ keyword.operator.pointer.d +// ^ variable.other.d +// ^ punctuation.terminator.d + a **2; +//^ meta.path.d variable.other.d +// ^^ keyword.operator.pointer.d +// ^ invalid.illegal.d +// ^ punctuation.terminator.d + void* +//^^^^ storage.type.d +// ^ keyword.operator.pointer.d + foo(); +//^^^ meta.function.d entity.name.function.d +// ^^ meta.function.parameters.d +// ^ punctuation.section.group.begin.d +// ^ punctuation.section.group.end.d +// ^ meta.function.d punctuation.terminator.d + + } +//^ invalid.illegal.d + ) +//^ invalid.illegal.d + ] +//^ invalid.illegal.d + + extern extern(C) int a; +//^^^^^^ storage.modifier.external.d +// ^^^^^^ keyword.other.external.d +// ^ punctuation.section.parens.begin.d +// ^ string.other.d +// ^ punctuation.section.parens.end.d +// ^^^ meta.path.d storage.type.d +// ^ variable.other.d +// ^ punctuation.terminator.d + + assert(foo !is bar); +//^^^^^^ keyword.other.assert.d +// ^ punctuation.section.parens.begin.d +// ^^^ meta.path.d variable.other.d +// ^^^ keyword.operator.comparison.d +// ^^^ meta.path.d variable.other.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.terminator.d + + a = (immutable ref Outer.Inner inner) => inner.x; +//^ meta.path.d variable.other.d +// ^ keyword.operator.assignment.d +// ^ punctuation.section.group.begin.d +// ^^^^^^^^^ storage.modifier.d +// ^^^ storage.modifier.d +// ^^^^^^^^^^^ meta.path.d +// ^^^^^ storage.type.d +// ^ punctuation.accessor.dot.d +// ^^^^^ storage.type.d +// ^^^^^ variable.parameter.d +// ^ punctuation.section.group.end.d +// ^^^^^^^^^^ meta.function.d +// ^^ storage.type.function.d keyword.declaration.function.lambda.d +// ^^^^^^^ meta.path.d +// ^^^^^ variable.other.d +// ^ punctuation.accessor.dot.d +// ^ variable.other.d + + pure Pair!int* makePair(int x) {} +//^^^^ storage.modifier.d +// ^^^^^^^^ meta.function-call.d +// ^^^^ meta.path.d variable.function.d +// ^ keyword.operator.d +// ^^^ storage.type.d +// ^ keyword.operator.pointer.d +// ^^^^^^^^ meta.function.d entity.name.function.d +// ^^^^^^^ meta.function.parameters.d +// ^ punctuation.section.group.begin.d +// ^^^ meta.path.d storage.type.d +// ^ variable.parameter.d +// ^ punctuation.section.group.end.d +// ^^ meta.function.d meta.block.d +// ^ punctuation.section.block.begin.d +// ^ punctuation.section.block.end.d + alias const(int) constInt; +//^^^^^ keyword.control.alias.d +// ^^^^^ storage.modifier.d +// ^ punctuation.section.group.begin.d +// ^^^ meta.path.d storage.type.d +// ^ punctuation.section.group.end.d +// ^^^^^^^^ entity.name.type.d +// ^ punctuation.terminator.d + + S s = { a: 1, b: "hi", +//^ meta.path.d storage.type.d +// ^ variable.other.d +// ^ keyword.operator.assignment.d +// ^^^^^^^^^^^^^^^^^ meta.block.d +// ^ punctuation.section.block.begin.d +// ^ entity.name.label.d +// ^ punctuation.separator.d +// ^ constant.numeric.integer.decimal.d +// ^ punctuation.separator.sequence.d +// ^ variable.other.d +// ^ punctuation.separator.mapping.key-value.d +// ^^^^ meta.string.d string.quoted.double.d +// ^ punctuation.separator.sequence.d + c: 5.sqrt(12) }.foo(); +// ^^^^^^^^^^^^^^^ meta.block.d +// ^ variable.other.d +// ^ punctuation.separator.mapping.key-value.d +// ^ constant.numeric.integer.decimal.d +// ^ meta.path.d punctuation.accessor.dot.d +// ^^^^ meta.function-call.d meta.path.d variable.function.d +// ^ meta.function-call.d punctuation.section.parens.begin.d +// ^^ meta.function-call.d constant.numeric.integer.decimal.d +// ^ meta.function-call.d punctuation.section.parens.end.d +// ^ punctuation.section.block.end.d +// ^ meta.path.d punctuation.accessor.dot.d +// ^^^^^ meta.function-call.d +// ^^^ meta.path.d variable.function.d +// ^ punctuation.section.parens.begin.d +// ^ punctuation.section.parens.end.d +// ^ punctuation.terminator.d + + s = 5._method(12._); +// ^ constant.numeric.integer.decimal.d +// ^ meta.path.d punctuation.accessor.dot.d +// ^^^^^^^ meta.function-call.d meta.path.d variable.function.d +// ^ meta.function-call.d punctuation.section.parens.begin.d +// ^^ meta.function-call.d constant.numeric.integer.decimal.d +// ^ meta.function-call.d meta.path.d punctuation.accessor.dot.d +// ^ meta.function-call.d meta.path.d variable.other.d +// ^ meta.function-call.d punctuation.section.parens.end.d +// ^ punctuation.terminator.d diff --git a/D/syntax_test_d.d b/D/tests/syntax_test_old.d similarity index 84% rename from D/syntax_test_d.d rename to D/tests/syntax_test_old.d index 6243a5af27..33a2aed18a 100644 --- a/D/syntax_test_d.d +++ b/D/tests/syntax_test_old.d @@ -21,7 +21,8 @@ shared int b = 5000; // ^ constant.numeric int c = 0x0; -// ^ constant.numeric +// ^^ punctuation.definition.numeric.base +// ^ constant.numeric int d = 0x0_00; // ^ constant.numeric float e = .0_0; @@ -52,36 +53,36 @@ template testTemplate(X) } @safe pure nothrow @nogc unittest {} -// ^ storage.attribute +// ^ storage.modifier // ^ storage.modifier // ^ storage.modifier -// ^ storage.attribute +// ^ storage.modifier auto takeByRef(ref int h) -// ^ storage.type +// ^ storage.modifier // ^ storage.modifier // ^ storage.type { synchronized - // ^ storage.modifier + // ^ keyword.other { h += 1; } } void main(char[][] args) -// ^ meta.function entity.name.function +// ^ entity.name.function { -// <- meta.function meta.block +// <- meta.block foreach(argc, argv; args) { - // <- meta.function meta.block meta.block + // <- meta.block meta.block auto cl = new CmdLin(argc, argv); - // ^ keyword.other + // ^ keyword.operator.word // ^ meta.block - keyword.type writefln("%s%s arg: %s", cl.argnum, cl.suffix, cl.argv); delete cl; - // ^ keyword.other + // ^ keyword.operator.word } struct specs @@ -91,7 +92,7 @@ void main(char[][] args) specs argspecs(char[][] args) in { - // ^ meta.function meta.block meta.function meta.block + // ^ meta.block meta.block assert (args.length > 0); } out (result) { @@ -100,8 +101,8 @@ void main(char[][] args) assert(result.allocated > 0); } body { - // ^ meta.function meta.block meta.function keyword.control.statement - // ^ meta.function meta.block meta.function meta.block + // ^ meta.block keyword.other + // ^ meta.block meta.block specs* s = new specs; s.count = args.length; s.allocated = typeof(args).sizeof; @@ -119,9 +120,9 @@ void main(char[][] args) class CmdLin { -// <- meta.class meta.block +// <- meta.block private { - // ^ meta.class meta.block meta.block + // ^ meta.block meta.block int _argc; char[] _argv; static uint _totalc; @@ -176,7 +177,7 @@ class CmdLin static typeof(_totalc) total() // ^ storage.modifier - // ^ storage.type + // ^ meta.block.d keyword.other.d // ^ entity.name { return _totalc; @@ -205,5 +206,5 @@ in { assert(true); } do { -// <- meta.function keyword.control +// <- keyword.other } diff --git a/D/tests/syntax_test_shebang.d b/D/tests/syntax_test_shebang.d new file mode 100644 index 0000000000..977129eb08 --- /dev/null +++ b/D/tests/syntax_test_shebang.d @@ -0,0 +1,10 @@ +#! SYNTAX TEST "Packages/D/D.sublime-syntax" +#! <- comment.line.number-sign.d punctuation.definition.comment.number-sign.d + #! <- comment.line.number-sign.d punctuation.definition.comment.number-sign.d +#!^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.d +; +// foo +#! ^^^ comment.line.double-slash.d + +#! foo +#! ^^^ comment.line.number-sign.d diff --git a/Diff/.python-version b/Diff/.python-version new file mode 100644 index 0000000000..98fccd6d02 --- /dev/null +++ b/Diff/.python-version @@ -0,0 +1 @@ +3.8 \ No newline at end of file diff --git a/Diff/Diff.sublime-syntax b/Diff/Diff.sublime-syntax index 087537213f..bb01911225 100644 --- a/Diff/Diff.sublime-syntax +++ b/Diff/Diff.sublime-syntax @@ -24,29 +24,29 @@ contexts: captures: 1: punctuation.definition.separator.diff - match: ^\d+(,\d+)*(a|d|c)\d+(,\d+)*$\n? - scope: meta.diff.range.normal + scope: meta.diff.range.normal meta.range.normal.diff - match: ^(@@)\s*(.+?)\s*(@@)\s*(.*?)\s*$\n? - scope: meta.diff.range.unified + scope: meta.diff.range.unified meta.range.unified.diff captures: 1: punctuation.definition.range.diff 2: meta.toc-list.line-number.diff 3: punctuation.definition.range.diff 4: entity.name.section.diff - match: '^(((\-{3}) .+ (\-{4}))|((\*{3}) .+ (\*{4})))$\n?' - scope: meta.diff.range.context + scope: meta.diff.range.context meta.range.context.diff captures: 3: punctuation.definition.range.diff 4: punctuation.definition.range.diff 6: punctuation.definition.range.diff 7: punctuation.definition.range.diff - match: '(^(((-{3}) .+)|((\*{3}) .+))$\n?|^(={4}) .+(?= - ))' - scope: meta.diff.header.from-file + scope: meta.diff.header.from-file meta.header.from-file.diff captures: 4: punctuation.definition.from-file.diff 6: punctuation.definition.from-file.diff 7: punctuation.definition.from-file.diff - match: '(^(\+{3}) .+$\n?| (-) .* (={4})$\n?)' - scope: meta.diff.header.to-file + scope: meta.diff.header.to-file meta.header.to-file.diff captures: 2: punctuation.definition.to-file.diff 3: punctuation.definition.to-file.diff @@ -66,7 +66,7 @@ contexts: 3: punctuation.definition.deleted.diff 6: punctuation.definition.deleted.diff - match: ^Index(:) (.+)$\n? - scope: meta.diff.index + scope: meta.diff.index meta.index.diff captures: 1: punctuation.separator.key-value.diff 2: meta.toc-list.file-name.diff diff --git a/Diff/diff.py b/Diff/diff.py index 667b0c9627..4a006b1021 100644 --- a/Diff/diff.py +++ b/Diff/diff.py @@ -7,19 +7,32 @@ import sublime_plugin +def splitlines_keep_ends(text): + lines = text.split('\n') + + # Need to insert back the newline characters between lines, difflib + # requires this. + if len(lines) > 0: + for i in range(len(lines) - 1): + lines[i] += '\n' + + return lines + + def read_file_lines(fname): - with open(fname, mode="rt", encoding="utf-8", newline=None) as f: - lines = f.readlines() + with open(fname, mode="rt", encoding="utf-8") as f: + lines = splitlines_keep_ends(f.read()) # as `difflib` doesn't work properly when the file does not end # with a new line character (https://bugs.python.org/issue2142), # we add a warning ourselves to fix it add_no_eol_warning_if_applicable(lines) + return lines def add_no_eol_warning_if_applicable(lines): - if len(lines) > 0 and not lines[-1].endswith('\n'): + if len(lines) > 0 and lines[-1]: # note we update the last line rather than adding a new one # so that the diff will show the warning with the last line lines[-1] += '\n\\ No newline at end of file\n' @@ -52,7 +65,7 @@ def run(self, files): v.set_name(os.path.basename(files[1]) + " -> " + os.path.basename(files[0])) v.set_scratch(True) v.assign_syntax('Packages/Diff/Diff.sublime-syntax') - v.run_command('append', {'characters': difftxt}) + v.run_command('append', {'characters': difftxt, 'disable_tab_translation': True}) def is_visible(self, files): return len(files) == 2 @@ -74,7 +87,8 @@ def run(self, edit): sublime.status_message("Diff only works with UTF-8 files") return - b = self.view.substr(sublime.Region(0, self.view.size())).splitlines(True) + b = splitlines_keep_ends(self.view.substr(sublime.Region(0, self.view.size()))) + add_no_eol_warning_if_applicable(b) adate = time.ctime(os.stat(fname).st_mtime) @@ -100,7 +114,7 @@ def run(self, edit): v.assign_syntax('Packages/Diff/Diff.sublime-syntax') v.settings().set('word_wrap', self.view.settings().get('word_wrap')) - v.run_command('append', {'characters': difftxt}) + v.run_command('append', {'characters': difftxt, 'disable_tab_translation': True}) if not use_buffer: win.run_command("show_panel", {"panel": "output.unsaved_changes"}) diff --git a/Diff/syntax_test_diff.diff b/Diff/syntax_test_diff.diff index 6e96ed1204..d562019112 100644 --- a/Diff/syntax_test_diff.diff +++ b/Diff/syntax_test_diff.diff @@ -1,20 +1,20 @@ # SYNTAX TEST "Packages/Diff/Diff.sublime-syntax" --- Path to Original File -#^^^^^^^^^^^^^^^^^^^^^^^^ meta.diff.header.from-file +#^^^^^^^^^^^^^^^^^^^^^^^^ meta.diff.header.from-file meta.header.from-file.diff # <- punctuation.definition.from-file.diff #^^ punctuation.definition.from-file.diff +++ Path to Modified File -#^^^^^^^^^^^^^^^^^^^^^^^^ meta.diff.header.to-file +#^^^^^^^^^^^^^^^^^^^^^^^^ meta.diff.header.to-file meta.header.to-file.diff # <- punctuation.definition.to-file.diff #^^ punctuation.definition.to-file.diff 28a211 -#^^^^^ meta.diff.range.normal +#^^^^^ meta.diff.range.normal meta.range.normal.diff @@ -2,8 +2,11 @@ -#^^^^^^^^^^^^^^^ meta.diff.range.unified +#^^^^^^^^^^^^^^^ meta.diff.range.unified meta.range.unified.diff # <- punctuation.definition.range.diff #^ punctuation.definition.range.diff # ^ - punctuation @@ -24,7 +24,7 @@ # ^ - entity - punctuation @@ -2,8 +2,11 @@ function_hint(int var) -#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.diff.range.unified +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.diff.range.unified meta.range.unified.diff # <- punctuation.definition.range.diff #^ punctuation.definition.range.diff # ^ - punctuation @@ -36,13 +36,13 @@ # ^ - entity.name.section.diff --- Range ---- -#^^^^^^^^^^^^^ meta.diff.range.context +#^^^^^^^^^^^^^ meta.diff.range.context meta.range.context.diff # <- punctuation.definition.range.diff #^^ punctuation.definition.range.diff # ^^^^ punctuation.definition.range.diff *** Range **** -#^^^^^^^^^^^^^ meta.diff.range.context +#^^^^^^^^^^^^^ meta.diff.range.context meta.range.context.diff # <- punctuation.definition.range.diff #^^ punctuation.definition.range.diff # ^^^^ punctuation.definition.range.diff @@ -91,6 +91,6 @@ Plain Text # ^^^^^^^^ markup.changed.diff Index: value -#^^^^^^^^^^^ meta.diff.index +#^^^^^^^^^^^ meta.diff.index meta.index.diff # ^ punctuation.separator.key-value.diff # ^^^^^ meta.toc-list.file-name.diff diff --git a/Erlang/Comments.tmPreferences b/Erlang/Comments.tmPreferences index 47cc16b7bf..078860f2da 100644 --- a/Erlang/Comments.tmPreferences +++ b/Erlang/Comments.tmPreferences @@ -1,8 +1,6 @@ - name - Comments scope source.erlang settings diff --git a/Erlang/Completion Rules.tmPreferences b/Erlang/Completion Rules.tmPreferences new file mode 100644 index 0000000000..a0cef8e842 --- /dev/null +++ b/Erlang/Completion Rules.tmPreferences @@ -0,0 +1,20 @@ + + + + scope + source.erlang + settings + + cancelCompletion + + + + diff --git a/Erlang/Erlang.sublime-build b/Erlang/Erlang.sublime-build index 6aaf47f531..9ae7f20e90 100644 --- a/Erlang/Erlang.sublime-build +++ b/Erlang/Erlang.sublime-build @@ -1,5 +1,5 @@ { "cmd": ["erl", "-compile", "$file"], "file_regex":"^([^:]+):([0-9]*):?(.*):?(.*)", - "selector": "source.erl" + "selector": "source.erlang" } diff --git a/Erlang/Erlang.sublime-settings b/Erlang/Erlang.sublime-settings new file mode 100644 index 0000000000..9abdfe8a3b --- /dev/null +++ b/Erlang/Erlang.sublime-settings @@ -0,0 +1,5 @@ +{ + // Characters that are considered to separate words + // Note: default separators without `@` + "word_separators": "./\\()\"'-:,.;<>~!#$%^&*|+=[]{}`~?", +} diff --git a/Erlang/Erlang.sublime-syntax b/Erlang/Erlang.sublime-syntax index 08fdb9446a..75a3894990 100644 --- a/Erlang/Erlang.sublime-syntax +++ b/Erlang/Erlang.sublime-syntax @@ -1,707 +1,2091 @@ %YAML 1.2 --- -# http://www.sublimetext.com/docs/3/syntax.html +# http://erlang.org/doc/reference_manual +# https://www.sublimetext.com/docs/3/syntax.html name: Erlang -# The recognition of function definitions and compiler directives (such as -# module, record and macro definitions) requires that each of the aforementioned -# constructs must be the first string inside a line (except for whitespace). -# Also, the function/module/record/macro names must be given unquoted. -- desp file_extensions: - erl - hrl - Emakefile - emakefile + - escript +first_line_match: |- + (?x: + ^ \#! .* \b(erlang|escript)\b | # shebang + ^ \s* \%+ \s* -\*- .*? \b[Ee]rlang\b .*? -\*- # editorconfig + ) scope: source.erlang + +variables: + # http://erlang.org/doc/reference_manual/data_types.html#atom + # an atom starts with lowercase alphanumeric + atom_unquoted: '[a-z]{{ident_char}}*' + + # http://erlang.org/doc/reference_manual/expressions.html#variables + # a variable starts with uppercase alphanumeric or underscore + variable: '[_A-Z]{{ident_char}}*' + + # an identifier can contain lowercase, uppercase, digits, underscore and @ + ident_char: '[_A-Za-z\d@]' + # the character which identifies the end of an identifier + # Note: need the character as embedded positvie lookaheads don't work + ident_break_char: '[^{{ident_char}}]' + # end of identifier lookahead + # Note: avoid negative lookahead as it is 6-8% slower + ident_break: (?={{ident_break_char}}) + # a quoted identifier with possibly escaped single quote + # preceeded by an arbitary number of excaped backslashes + ident_quoted: \'((?:\\\\)*\\\'|[^''])*\' + # an identifier can be an atom or a variable + ident_unquoted: '[_A-Za-z]{{ident_char}}*' + # all characters not being used to indicate a context change + illegal_ident: '[^\s,:.;''(){}\[\]%=|/]+' + # quoted/unquoted/macro identifier + ident: \?{,2}(?:{{ident_unquoted}}|{{ident_quoted}}) + + # http://erlang.org/doc/reference_manual/macros.html#predefined-macros + erlang_macros: |- + (?x: + MODULE|FUNCTION_NAME|FUNCTION_ARITY|MODULE_STRING| + FILE|LINE|MACHINE|OTP_RELEASE + ){{ident_break}} + + # http://erlang.org/doc/man/erlang.html#exports + erlang_functions: |- + (?x: + abs|adler32|adler32_combine|append_element|apply|atom_to_binary|atom_to_list| + binary_part|binary_to_atom|binary_to_existing_atom|binary_to_float| + binary_to_integer|binary_to_list|binary_to_term|bit_size|bitstring_to_list| + bump_reductions|byte_size|cancel_timer|ceil|check_old_code|check_process_code| + convert_time_unit|crc32|crc32_combine|date|decode_packet|delete_element| + delete_module|demonitor|disconnect_node|display|dist_ctrl_get_data| + dist_ctrl_get_data_notification|dist_ctrl_input_handler|dist_ctrl_put_data| + element|erase|error|exit|external_size|float|float_to_binary|float_to_list| + floor|fun_info|fun_to_list|function_exported|garbage_collect|get|get_cookie| + get_keys|get_stacktrace|group_leader|halt|hd|hibernate|insert_element| + integer_to_binary|integer_to_list|iolist_size|iolist_to_binary| + iolist_to_iovec|is_alive|is_atom|is_binary|is_bitstring|is_boolean|is_builtin| + is_float|is_function|is_integer|is_list|is_map|is_map_key|is_number|is_pid| + is_port|is_process_alive|is_record|is_reference|is_tuple|length|link| + list_to_atom|list_to_binary|list_to_bitstring|list_to_existing_atom| + list_to_float|list_to_integer|list_to_pid|list_to_port|list_to_ref| + list_to_tuple|load_module|load_nif|loaded|localtime| + localtime_to_universaltime|make_ref|make_tuple|map_get|map_size| + match_spec_test|max|md5|md5_final|md5_init|md5_update|memory|min| + module_loaded|monitor|monitor_node|monotonic_time|nif_error|node|nodes|now| + open_port|phash|phash2|pid_to_list|port_call|port_close|port_command| + port_connect|port_control|port_info|port_to_list|ports|pre_loaded| + process_display|process_flag|process_info|processes|purge_module|put|raise| + read_timer|ref_to_list|register|registered|resume_process|round|self|send| + send_after|send_nosuspend|set_cookie|setelement|size|spawn|spawn_link| + spawn_monitor|spawn_opt|split_binary|start_timer|statistics|suspend_process| + system_flag|system_info|system_monitor|system_profile|system_time| + term_to_binary|throw|time|time_offset|timestamp|tl|trace|trace_delivered| + trace_info|trace_pattern|trunc|tuple_size|tuple_to_list|unique_integer| + universaltime|universaltime_to_localtime|unlink|unregister|whereis|yield + ){{ident_break}} + + erlang_types: |- + (?x: + # builtin data types + # http://erlang.org/doc/reference_manual/typespec.html#the-erlang-type-language + any|arity|atom|binary|bitstring|boolean|byte|char|float|fun|function| + identifier|integer|iodata|iolist|list|map|maybe_improper_list|mfa|module|nil| + no_return|node|none|non_neg_integer|neg_integer|pos_integer|nonempty_list| + nonempty_maybe_improper_list|nonempty_improper_list| + nonempty_maybe_improper_list|nonempty_string| + number|pid|port|record|reference|string|term|timeout|tuple| + + # erlang library + # http://erlang.org/doc/man/erlang.html#data-types + dist_handle|ext_binary|iovec|message_queue_data|nif_resource| + deprecated_time_unit|timeout|timestamp|time_unit + ){{ident_break}} + + support_namespaces: |- + (?x: + # builtin namespace + erlang| + + # erlang otp libraries + # https://github.com/erlang/otp + asn1|common_test|compiler|crypto|debugger|dialyzer|diameter|edoc|eldap| + erl_(docgen|interface)|et|eunit|ftp|hipe|inets|jinterface|kernel| + megaco|mnesia|observer|odbc|os_mon|parsetools|public_key|reltool| + runtime_tools|sasl|snmp|ssh|ssl|stdlib|syntax_tools|tftp|tools|wx|xmerl + ){{ident_break}} + contexts: + main: - - include: module-directive - - include: import-export-directive - - include: record-directive - - include: define-directive - - include: macro-directive - - include: directive + - match: ^\#! + scope: punctuation.definition.comment.shell + set: + - meta_include_prototype: false + - meta_scope: comment.line.number-sign.shell + - match: \b(erlang|escript)\b + scope: constant.language.erlang + - match: \n + set: statements + - match: '' + set: statements + + prototype: + - include: comment + + statements: + - include: preproc-control + - include: preproc-undef + - include: preproc-define + - include: preproc-export + - include: preproc-import + - include: preproc-include + - include: preproc-module + - include: preproc-record + - include: preproc-spec + - include: preproc-type + - include: preproc-attribute - include: function - - include: everything-else + - include: illegal-stray + # fallback incase preprocessor or function didn't match + - match: (?=\S) + push: + - include: eol-pop + - include: terminator-clause + - include: separator-clauses + - include: separator-expressions + - include: expressions + + terms: + - include: constant + - include: keyword + - include: operator + - include: character + - include: macro + - include: number + - include: record + - include: string + - include: operator-unary + - include: variable-anonymous + - include: atom + + common: + - include: map-of-expressions + - include: expr-control + - include: expr-try + - include: expr-fun + - include: function-call + - include: terms + + expressions-nested: + - include: binary + - include: group-of-expressions + - include: list-of-expressions + - include: tuple-of-expressions + + expressions: + - include: expressions-nested + - include: namespace + - include: common + - include: variable-other + + function-parameter-nested: + - include: binary-function-parameter + - include: group-of-function-parameters + - include: list-of-function-parameters + - include: tuple-of-function-parameters + + function-parameter: + - include: parameters-end-pop + - include: function-parameter-nested + - include: namespace + - include: common + - include: variable-parameter + + type-common: + - include: illegal-type-keyword + - include: map-of-types + - include: separator-type + - include: separator-union + - include: type-namespace + - include: type-call + + type-expressions: + - include: binary + - include: group-of-types + - include: list-of-types + - include: tuple-of-types + - include: type-common + - include: terms + - include: variable-other + + type-parameter-nested: + - include: binary-type-parameter + - include: group-of-type-parameters + - include: list-of-type-parameters + - include: tuple-of-type-parameters + - include: type-common + + type-parameter: + - include: parameters-end-pop + - include: type-parameter-nested + - include: terms + - include: variable-parameter + +###[ COMMENTS ]############################################################### + comment: - match: \% - scope: punctuation.definition.comment.erlang + scope: punctuation.definition.comment.percentage.erlang push: - - meta_scope: comment.line.erlang - - match: $\n? + - meta_scope: comment.line.percentage.erlang + - match: \n pop: true - atom: - - match: "'" - scope: punctuation.definition.symbol.begin.erlang - push: - - meta_scope: constant.other.symbol.quoted.single.erlang - - match: "'" - scope: punctuation.definition.symbol.end.erlang - pop: true - - match: (\\)([bdefnrstv\\''"]|(\^)[@-_]|[0-7]{1,3}) - captures: - 0: constant.other.symbol.escape.erlang - 1: punctuation.definition.escape.erlang - 3: punctuation.definition.escape.erlang - - match: \\\^?.? - scope: invalid.illegal.atom.erlang - - match: '[a-z][a-zA-Z\d@_]*+' - scope: constant.other.symbol.unquoted.erlang - binary: - - match: << - scope: punctuation.definition.binary.begin.erlang - push: - - meta_scope: meta.structure.binary.erlang - - match: '>>' - scope: punctuation.definition.binary.end.erlang - pop: true - - match: (,)|(:) - captures: - 1: punctuation.separator.binary.erlang - 2: punctuation.separator.value-size.erlang - - include: internal-type-specifiers - - include: everything-else - character: - - match: (\$)((\\)([bdefnrstv\\''"]|(\^)[@-_]|[0-7]{1,3})) - scope: constant.character.erlang + +###[ PREPROCESSOR CONTROL ]################################################### + + preproc-control: + # http://erlang.org/doc/reference_manual/macros.html#flow-control-in-macros + # Note: + # The `-` is scoped as `punctuation.definition` because: + # 1. derectives are most likely one-liners (with exceptions!) + # 2. the hyphon is compared to the hash-tag in C/C++ preprocessors + # 3. the `.` is meant to share the scope `punctuation.terminator.clause` + # with clauses/functions as it has the same meaning. + - match: (-)\s*(ifdef|ifndef){{ident_break}} captures: - 1: punctuation.definition.character.erlang - 2: constant.character.escape.erlang - 3: punctuation.definition.escape.erlang - 5: punctuation.definition.escape.erlang - - match: \$\\\^?.? - scope: invalid.illegal.character.erlang - - match: (\$)\S - scope: constant.character.erlang + 1: punctuation.definition.keyword.erlang + 2: keyword.control.directive.conditional.erlang + push: [preproc-control-meta, preproc-control-definitions] + - match: (-)\s*(if|elif){{ident_break}} + captures: + 1: punctuation.definition.keyword.erlang + 2: keyword.control.directive.conditional.erlang + push: [preproc-control-meta, preproc-control-expressions] + - match: (-)\s*(else|endif){{ident_break}} + captures: + 1: punctuation.definition.keyword.erlang + 2: keyword.control.directive.conditional.erlang + push: preproc-control-meta + + preproc-control-meta: + - meta_scope: meta.preprocessor.conditional.erlang + - include: preproc-expect-end + + preproc-control-definitions: + - match: (?=\() + set: + - clear_scopes: 1 + - match: \( + scope: punctuation.section.arguments.begin.erlang + set: + - - clear_scopes: 1 + - meta_scope: meta.preprocessor.conditional.arguments.erlang + - include: expect-arguments-end + - constant-other-macro + - include: preproc-stray-arguments-end + + preproc-control-expressions: + - match: (?=\() + set: + - clear_scopes: 1 + - match: \( + scope: punctuation.section.arguments.begin.erlang + set: + - clear_scopes: 1 + - meta_scope: meta.preprocessor.conditional.arguments.erlang + - include: arguments-common + - include: expressions + - include: preproc-stray-arguments-end + +###[ PREPROCESSOR UNDEF ]##################################################### + + preproc-undef: + - match: (-)\s*(undef){{ident_break}} captures: - 1: punctuation.definition.character.erlang - - match: \$.? - scope: invalid.illegal.character.erlang - define-directive: - - match: ^\s*+(-)\s*+(define)\s*+(\()\s*+([a-zA-Z\d@_]++)\s*+(,) + 1: punctuation.definition.keyword.erlang + 2: keyword.control.directive.undef.erlang + push: + - - meta_scope: meta.preprocessor.undef.erlang + - include: preproc-expect-end + - - match: (?=\() + set: + - clear_scopes: 1 + - match: \( + scope: punctuation.section.arguments.begin.erlang + set: + - - clear_scopes: 1 + - meta_scope: meta.preprocessor.undef.arguments.erlang + - include: expect-arguments-end + - entity-name-macro + - include: preproc-stray-arguments-end + +###[ PREPROCESSOR DEFINE ]#################################################### + + preproc-define: + # http://erlang.org/doc/reference_manual/macros.html#defining-and-using-macros + - match: (-)\s*(define){{ident_break}} captures: - 1: punctuation.section.directive.begin.erlang + 1: punctuation.definition.keyword.erlang 2: keyword.control.directive.define.erlang - 3: punctuation.definition.parameters.begin.erlang - 4: entity.name.function.macro.definition.erlang - 5: punctuation.separator.parameters.erlang - push: - - meta_scope: meta.directive.define.erlang - - match: (\))\s*+(\.) - captures: - 1: punctuation.definition.parameters.end.erlang - 2: punctuation.section.directive.end.erlang - pop: true - - include: everything-else - - match: (?=^\s*+-\s*+define\s*+\(\s*+[a-zA-Z\d@_]++\s*+\() - push: - - meta_scope: meta.directive.define.erlang - - match: (\))\s*+(\.) - captures: - 1: punctuation.definition.parameters.end.erlang - 2: punctuation.section.directive.end.erlang - pop: true - - match: ^\s*+(-)\s*+(define)\s*+(\()\s*+([a-zA-Z\d@_]++)\s*+(\() - captures: - 1: punctuation.section.directive.begin.erlang - 2: keyword.control.directive.define.erlang - 3: punctuation.definition.parameters.begin.erlang - 4: entity.name.function.macro.definition.erlang - 5: punctuation.definition.parameters.begin.erlang - push: - - match: (\))\s*(,) - captures: - 1: punctuation.definition.parameters.end.erlang - 2: punctuation.separator.parameters.erlang - pop: true - - match: \, - scope: punctuation.separator.parameters.erlang - - include: everything-else - - match: \|\||\||:|;|,|\.|-> - scope: punctuation.separator.define.erlang - - include: everything-else - directive: - - match: ^\s*+(-)\s*+([a-z][a-zA-Z\d@_]*+)\s*+(\() + push: + - - meta_scope: meta.preprocessor.define.erlang + - include: preproc-expect-end + - - match: (?=\() + set: + - clear_scopes: 1 + - match: \( + scope: punctuation.section.arguments.begin.erlang + set: + - preproc-define-arguments-body + - expect-arguments-separator + - preproc-define-arguments-parameters + - entity-name-macro + - include: preproc-stray-arguments-end + + preproc-define-arguments-parameters: + - meta_content_scope: meta.macro.name.erlang + - match: (?=\() + set: + - match: \( + scope: punctuation.section.parameters.begin.erlang + set: + - meta_scope: meta.macro.parameters.erlang + - include: parameters-common + - include: function-parameter + - include: else-pop + + preproc-define-arguments-body: + - clear_scopes: 1 + - meta_scope: meta.preprocessor.define.arguments.erlang + - include: separator-clauses + - include: separator-expressions + - include: separator-union + - include: expressions + - include: arguments-end + +###[ PREPROCESSOR EXPORT ]#################################################### + + preproc-export: + # http://erlang.org/doc/reference_manual/modules.html#pre-defined-module-attributes + - match: (-)\s*(export(_type)?){{ident_break}} captures: - 1: punctuation.section.directive.begin.erlang - 2: keyword.control.directive.erlang - 3: punctuation.definition.parameters.begin.erlang - push: - - meta_scope: meta.directive.erlang - - match: (\))\s*+(\.) - captures: - 1: punctuation.definition.parameters.end.erlang - 2: punctuation.section.directive.end.erlang - pop: true - - include: everything-else - - match: ^\s*+(-)\s*+([a-z][a-zA-Z\d@_]*+)\s*+(\.) - scope: meta.directive.erlang + 1: punctuation.definition.keyword.erlang + 2: keyword.control.directive.export.erlang + push: + - - meta_scope: meta.preprocessor.export.erlang + - include: preproc-expect-end + - - match: (?=\() + set: + - clear_scopes: 1 + - match: \( + scope: punctuation.section.arguments.begin.erlang + set: + - - clear_scopes: 1 + - meta_scope: meta.preprocessor.export.arguments.erlang + - include: expect-arguments-end + - preproc-expect-references + - include: preproc-stray-arguments-end + + preproc-expect-references: + - match: \[ + scope: punctuation.section.sequence.begin.erlang + set: + - meta_scope: meta.sequence.list.erlang + - include: list-common + - include: namespace + - include: reference + - match: (?=[.)]) + pop: true + - match: \S + scope: invalid.illegal.expect-list.erlang + +###[ PREPROCESSOR IMPORT ]#################################################### + + preproc-import: + # http://erlang.org/doc/reference_manual/modules.html#pre-defined-module-attributes + - match: (-)\s*(import){{ident_break}} captures: - 1: punctuation.section.directive.begin.erlang - 2: keyword.control.directive.erlang - 3: punctuation.section.directive.end.erlang - everything-else: - - include: comment - - include: record-usage - - include: macro-usage - - include: expression - - include: keyword - - include: textual-operator - - include: function-call - - include: tuple - - include: list + 1: punctuation.definition.keyword.erlang + 2: keyword.control.directive.import.erlang + push: + - - meta_scope: meta.preprocessor.import.erlang + - include: preproc-expect-end + - - match: (?=\() + set: + - clear_scopes: 1 + - match: \( + scope: punctuation.section.arguments.begin.erlang + set: + - - clear_scopes: 1 + - meta_scope: meta.preprocessor.import.arguments.erlang + - include: expect-arguments-end + - preproc-expect-references + - expect-arguments-separator + - entity-name-module + - include: preproc-stray-arguments-end + +###[ PREPROCESSOR INCLUDE ]################################################### + + preproc-include: + # http://erlang.org/doc/reference_manual/macros.html#file-inclusion + - match: (-)\s*(include(_lib)?){{ident_break}} + captures: + 1: punctuation.definition.keyword.erlang + 2: keyword.control.directive.include.erlang + push: + - - meta_scope: meta.preprocessor.include.erlang + - include: preproc-expect-end + - - match: (?=\() + set: + - clear_scopes: 1 + - match: \( + scope: punctuation.section.arguments.begin.erlang + set: + - - clear_scopes: 1 + - meta_scope: meta.preprocessor.include.arguments.erlang + - include: expect-arguments-end + - - match: \" + scope: punctuation.definition.string.begin.erlang + set: [string-body, string-maybe-env] + - include: else-pop + - include: preproc-stray-arguments-end + +###[ PREPROCESSOR MODULE ]#################################################### + + preproc-module: + # http://erlang.org/doc/reference_manual/modules.html#module-syntax + - match: (-)\s*(module){{ident_break}} + captures: + 1: punctuation.definition.keyword.erlang + 2: keyword.control.directive.namespace.erlang + push: + - - meta_scope: meta.preprocessor.namespace.erlang + - include: preproc-expect-end + - - match: (?=\() + set: + - clear_scopes: 1 + - match: \( + scope: punctuation.section.arguments.begin.erlang + set: + - - clear_scopes: 1 + - meta_scope: meta.preprocessor.namespace.arguments.erlang + - include: expect-arguments-end + - entity-name-module + - include: preproc-stray-arguments-end + +###[ PREPROCESSOR ATTRIBUTE ]################################################# + + preproc-attribute: + - match: -(?=\s*{{ident}}) + scope: punctuation.definition.keyword.erlang + push: + - - meta_scope: meta.preprocessor.attribute.erlang + - include: preproc-expect-end + # ordinary directive `-name( ... ).` + - - match: (?=\() + set: + - clear_scopes: 1 + - match: \( + scope: punctuation.section.arguments.begin.erlang + set: + - clear_scopes: 1 + - meta_scope: meta.preprocessor.attribute.arguments.erlang + - include: arguments-common + - include: preproc-attribute-argument + # spec/type like directive `-attribute ... .` + - match: (?=\S) + set: + - include: separator-expressions + - include: expressions + - include: clause-end-pop + - include: eol-pop + # keyword + - - match: '{{atom_unquoted}}' + scope: meta.atom.erlang keyword.control.directive.attribute.erlang + pop: true + - match: \' + scope: punctuation.definition.atom.begin.erlang + set: + - meta_include_prototype: false + - meta_scope: meta.atom.erlang keyword.control.directive.attribute.erlang + - include: atom-quoted-common + - include: macro-pop + - include: atom-expect-end + + preproc-attribute-argument: + # http://erlang.org/doc/reference_manual/expressions.html#parenthesized-expressions + - match: \( + scope: punctuation.section.group.begin.erlang + push: + - meta_scope: meta.group.erlang + - include: group-common + - include: preproc-attribute-argument + # http://erlang.org/doc/reference_manual/data_types.html#list + - match: \[ + scope: punctuation.section.sequence.begin.erlang + push: + - meta_scope: meta.sequence.list.erlang + - include: list-common + - include: preproc-attribute-argument + # http://erlang.org/doc/reference_manual/data_types.html#tuple + - match: \{ + scope: punctuation.section.sequence.begin.erlang + push: + - meta_scope: meta.sequence.tuple.erlang + - include: tuple-common + - include: preproc-attribute-argument - include: binary - - include: parenthesized-expression - - include: character - - include: number - - include: atom - - include: string - - include: symbolic-operator - - include: variable - expression: - - match: \bif\b - scope: keyword.control.if.erlang - push: - - meta_scope: meta.expression.if.erlang - - match: \bend\b - scope: keyword.control.end.erlang - pop: true - - include: internal-expression-punctuation - - include: everything-else - - match: \bcase\b - scope: keyword.control.case.erlang - push: - - meta_scope: meta.expression.case.erlang - - match: \bend\b - scope: keyword.control.end.erlang - pop: true - - include: internal-expression-punctuation - - include: everything-else - - match: \breceive\b - scope: keyword.control.receive.erlang - push: - - meta_scope: meta.expression.receive.erlang - - match: \bend\b - scope: keyword.control.end.erlang - pop: true - - include: internal-expression-punctuation - - include: everything-else - - match: \b(fun)\s*+(([a-z][a-zA-Z\d@_]*+)\s*+(:)\s*+)?([a-z][a-zA-Z\d@_]*+)\s*(/) + - include: namespace + - include: reference + - include: common + - include: variable-other + +###[ PREPROCESSOR RECORD ]#################################################### + + preproc-record: + # http://erlang.org/doc/reference_manual/modules.html#record-definitions + - match: (-)\s*(record){{ident_break}} captures: - 1: keyword.control.fun.erlang - 3: entity.name.type.class.module.erlang - 4: punctuation.separator.module-function.erlang - 5: entity.name.function.erlang - 6: punctuation.separator.function-arity.erlang - - match: \bfun\b - scope: keyword.control.fun.erlang - push: - - meta_scope: meta.expression.fun.erlang - - match: \bend\b - scope: keyword.control.end.erlang - pop: true - - match: (?=\() + 1: punctuation.definition.keyword.erlang + 2: keyword.control.directive.record.erlang + push: + - - meta_scope: meta.preprocessor.record.erlang + - include: preproc-expect-end + - - match: (?=\() + set: + - clear_scopes: 1 + - match: \( + scope: punctuation.section.arguments.begin.erlang + set: + - - clear_scopes: 1 + - meta_scope: meta.preprocessor.record.arguments.erlang + - include: expect-arguments-end + - record-body + - expect-arguments-separator + - record-name + - entity-name-record + - include: preproc-stray-arguments-end + + record-body: + - match: \{ + scope: punctuation.section.fields.begin.erlang + set: + - meta_scope: meta.record.fields.erlang + - include: record-fields-common + - match: ',?' + scope: punctuation.separator.expressions.erlang push: - - match: (;)|(?=\bend\b) - captures: - 1: punctuation.separator.clauses.erlang - pop: true - - include: internal-function-parts - - include: everything-else - - match: \btry\b - scope: keyword.control.try.erlang - push: - - meta_scope: meta.expression.try.erlang - - match: \bend\b - scope: keyword.control.end.erlang - pop: true - - include: internal-expression-punctuation - - include: everything-else - - match: \bbegin\b - scope: keyword.control.begin.erlang - push: - - meta_scope: meta.expression.begin.erlang - - match: \bend\b - scope: keyword.control.end.erlang - pop: true - - include: internal-expression-punctuation - - include: everything-else - - match: \bquery\b - scope: keyword.control.query.erlang - push: - - meta_scope: meta.expression.query.erlang - - match: \bend\b - scope: keyword.control.end.erlang - pop: true - - include: everything-else - function: - - match: ^\s*+([a-z][a-zA-Z\d@_]*+)\s*+(?=\() + - - meta_content_scope: meta.field.name.erlang + - include: immediatelly-pop + - - include: variable-anonymous-pop + - match: '{{atom_unquoted}}' + scope: meta.atom.erlang entity.name.field.erlang + pop: true + - match: \' + scope: punctuation.definition.atom.begin.erlang + set: + - meta_include_prototype: false + - meta_scope: meta.atom.erlang entity.name.field.erlang + - include: atom-quoted-common + - include: macro-pop + - include: atom-expect-end + - include: else-pop + +###[ PREPROCESSOR SPEC ]###################################################### + + preproc-spec: + # http://erlang.org/doc/reference_manual/typespec.html#specifications-for-functions + - match: (-)\s*(callback|spec){{ident_break}} captures: - 1: entity.name.function.definition.erlang + 1: punctuation.definition.keyword.erlang + 2: keyword.control.directive.spec.erlang push: - - meta_scope: meta.function.erlang - - match: \. - scope: punctuation.terminator.function.erlang - pop: true - - match: ^\s*+([a-z][a-zA-Z\d@_]*+)\s*+(?=\() - captures: - 1: entity.name.function.erlang - - match: (?=\() + - meta_scope: meta.preprocessor.spec.erlang + - include: terminator-clause-pop + - include: separator-clauses + # NOTE: function name is optional for all but the first clauses + - match: (?={{ident}}\s*:[^:]) push: - - match: (;)|(?=\.) - captures: - 1: punctuation.separator.clauses.erlang - pop: true - - include: parenthesized-expression - - include: internal-function-parts - - include: everything-else - function-call: - - match: (?=[a-z][a-zA-Z\d@_]*+\s*+(\(|:\s*+[a-z][a-zA-Z\d@_]*+\s*+\()) + - preproc-spec-return + - preproc-spec-parameters + - preproc-spec-path + - entity-name-function + - namespace-accessor + - namespace-qualifier + - match: (?=\S) + push: + - preproc-spec-return + - preproc-spec-parameters + - preproc-spec-name + - entity-name-function + + preproc-spec-name: + - meta_scope: meta.preprocessor.spec.name.erlang + - include: else-pop + + preproc-spec-path: + - meta_scope: meta.preprocessor.spec.name.erlang meta.path.erlang + - include: else-pop + + preproc-spec-parameters: + - clear_scopes: 1 + - match: \( + scope: punctuation.section.parameters.begin.erlang + set: + - clear_scopes: 1 + - meta_scope: meta.preprocessor.spec.parameters.erlang + - include: parameters-common + - include: type-parameter + - include: else-pop + + preproc-spec-return: + - match: -> + scope: punctuation.separator.parameters-return-type.erlang + set: + - clear_scopes: 1 + - meta_content_scope: meta.preprocessor.spec.return-type.erlang + - include: preproc-spec-guards + - include: separator-expressions + - include: type-expressions + - include: preproc-spec-guards + - include: illegal-group + - match: '{{illegal_ident}}|\S' + scope: invalid.illegal.expect-separator.erlang + + preproc-spec-guards: + - match: (?=when{{ident_break_char}}) + set: + - clear_scopes: 1 + - match: when + scope: keyword.control.conditional.when.erlang + set: + - clear_scopes: 1 + - meta_scope: meta.preprocessor.spec.guards.erlang + - include: separator-expressions + - include: type-expressions + - include: clause-end-pop + - include: clause-end-pop + +###[ PREPROCESSOR TYPE ]###################################################### + + preproc-type: + # http://erlang.org/doc/reference_manual/typespec.html#typespec-of-user-defined-types + - match: (-)\s*(opaque|type){{ident_break}} + captures: + 1: punctuation.definition.keyword.erlang + 2: keyword.control.directive.type.erlang push: - - meta_scope: meta.function-call.erlang - - match: \) - scope: punctuation.section.parameters.end.erlang + - - meta_scope: meta.preprocessor.type.erlang + - include: preproc-expect-end + - - match: (?=\S) + set: + - preproc-type-body + - preproc-type-parameters + - preproc-type-name + - entity-name-type + + preproc-type-name: + - meta_scope: meta.preprocessor.type.name.erlang + - include: else-pop + + preproc-type-parameters: + - clear_scopes: 1 + - match: \( + scope: punctuation.section.parameters.begin.erlang + set: + - clear_scopes: 1 + - meta_scope: meta.preprocessor.type.parameters.erlang + - include: parameters-common + - include: type-parameter + - include: else-pop + + preproc-type-body: + - match: '::' + scope: punctuation.separator.type-head-body.erlang + set: + - include: type-expressions + - include: clause-end-pop + - include: clause-end-pop + # anything else is invalid + - include: illegal-group + - match: '{{illegal_ident}}|\S' + scope: invalid.illegal.expect-separator.erlang + +###[ PREPROCESSOR PROTOTYPES ]################################################ + + preproc-stray-arguments-end: + - match: \) + scope: invalid.illegal.stray-arguments-end.erlang + pop: true + - include: eol-pop + - include: else-pop + + preproc-expect-end: + - include: terminator-clause-pop + - match: \n + scope: invalid.illegal.expect-terminator.erlang + pop: true + - match: '[^\s.]+' + scope: invalid.illegal.expect-terminator.erlang + +###[ CONTROL EXPRESSION ]##################################################### + + expr-control: + # http://erlang.org/doc/reference_manual/expressions.html#if + - match: if{{ident_break}} + scope: keyword.control.conditional.if.erlang + push: + - meta_scope: meta.if.erlang + - include: expr-control-conditional-end + - include: expr-control-body + # http://erlang.org/doc/reference_manual/expressions.html#case + - match: case{{ident_break}} + scope: keyword.control.conditional.case.erlang + push: + - meta_scope: meta.case.erlang + - include: expr-control-conditional-end + - include: expr-control-body + # http://erlang.org/doc/reference_manual/expressions.html#receive + - match: receive{{ident_break}} + scope: keyword.control.flow.receive.erlang + push: + - meta_scope: meta.receive.erlang + - include: expr-control-flow-end + - include: expr-control-body + # http://erlang.org/doc/reference_manual/expressions.html#block-expressions + - match: begin{{ident_break}} + scope: keyword.control.flow.begin.erlang + push: + - meta_scope: meta.block.erlang + - include: expr-control-flow-end + - include: expr-control-body + # http://erlang.org/doc/reference_manual/...? + - match: query{{ident_break}} + scope: keyword.control.flow.query.erlang + push: + - meta_scope: meta.query.erlang + - include: expr-control-flow-end + - include: expr-control-body + # http://erlang.org/doc/reference_manual/expressions.html#guard-sequences + - match: when{{ident_break}} + scope: keyword.control.conditional.when.erlang + push: + - match: (?=->|\.|(end|after|catch){{ident_break_char}}) + pop: true + - include: expr-control-body + - match: -> + scope: punctuation.separator.clause-head-body.erlang + + expr-control-body: + - include: separator-clauses + - include: separator-expressions + - include: expressions + + expr-control-conditional-end: + - match: end{{ident_break}}|(?=\.) + scope: keyword.control.conditional.end.erlang + pop: true + + expr-control-flow-end: + - match: end{{ident_break}}|(?=\.) + scope: keyword.control.flow.end.erlang + pop: true + +###[ TRY-CATCH EXPRESSION ]################################################### + + expr-try: + # http://erlang.org/doc/reference_manual/expressions.html#try + - match: try{{ident_break}} + scope: keyword.control.exception.try.erlang + push: + - meta_scope: meta.exception.try.erlang + - match: end{{ident_break}}|(?=\.) + scope: keyword.control.exception.end.erlang pop: true - - match: ((erlang)\s*+(:)\s*+)?(is_atom|is_binary|is_constant|is_float|is_function|is_integer|is_list|is_number|is_pid|is_port|is_reference|is_tuple|is_record|abs|element|hd|length|node|round|self|size|tl|trunc)\s*+(\() - captures: - 2: entity.name.type.class.module.erlang - 3: punctuation.separator.module-function.erlang - 4: variable.function.guard.erlang - 5: punctuation.section.parameters.begin.erlang + - match: catch{{ident_break}} + scope: keyword.control.exception.catch.erlang push: - - match: (?=\)) + - clear_scopes: 1 + - meta_scope: meta.exception.catch.erlang + - match: (?=\.|(end|after){{ident_break_char}}) pop: true - - match: "," - scope: punctuation.separator.parameters.erlang - - include: everything-else - - match: (([a-z][a-zA-Z\d@_]*+)\s*+(:)\s*+)?([a-z][a-zA-Z\d@_]*+)\s*+(\() - captures: - 2: entity.name.type.class.module.erlang - 3: punctuation.separator.module-function.erlang - 4: variable.function.erlang - 5: punctuation.section.parameters.begin.erlang + - match: -> + scope: punctuation.separator.clause-head-body.erlang + push: + - match: (?=[.;]|(end|after|catch){{ident_break_char}}) + pop: true + - include: separator-expressions + - include: expressions + # Don't match namespaces in exception patterns + - match: ':' + scope: punctuation.separator.patterns.erlang + - include: separator-clauses + - include: expressions-nested + - include: common + - include: variable-other + - match: after{{ident_break}} + scope: keyword.control.exception.after.erlang push: - - match: (?=\)) + - clear_scopes: 1 + - meta_scope: meta.exception.after.erlang + - match: (?=\.|(end|after|catch){{ident_break_char}}) pop: true - - match: "," - scope: punctuation.separator.parameters.erlang - - include: everything-else - import-export-directive: - - match: ^\s*+(-)\s*+(import)\s*+(\()\s*+([a-z][a-zA-Z\d@_]*+)\s*+(,) - captures: - 1: punctuation.section.directive.begin.erlang - 2: keyword.control.directive.import.erlang - 3: punctuation.section.parameters.begin.erlang - 4: entity.name.type.class.module.erlang - 5: punctuation.separator.parameters.erlang - push: - - meta_scope: meta.directive.import.erlang - - match: (\))\s*+(\.) - captures: - 1: punctuation.section.parameters.end.erlang - 2: punctuation.section.directive.end.erlang - pop: true - - include: internal-function-list - - match: ^\s*+(-)\s*+(export)\s*+(\() - captures: - 1: punctuation.section.directive.begin.erlang - 2: keyword.control.directive.export.erlang - 3: punctuation.section.parameters.begin.erlang + - include: expr-control-body + - include: expr-control-body + +###[ FUN EXPRESSION ]######################################################### + + expr-fun: + # http://erlang.org/doc/reference_manual/expressions.html#fun-expressions + - match: fun{{ident_break}} + scope: keyword.declaration.function.erlang push: - - meta_scope: meta.directive.export.erlang - - match: (\))\s*+(\.) - captures: - 1: punctuation.section.parameters.end.erlang - 2: punctuation.section.directive.end.erlang - pop: true - - include: internal-function-list - internal-expression-punctuation: - - match: (->)|(;)|(,) - captures: - 1: punctuation.separator.clause-head-body.erlang - 2: punctuation.separator.clauses.erlang - 3: punctuation.separator.expressions.erlang - internal-function-list: + - - meta_scope: meta.fun.erlang + - include: immediatelly-pop + # function reference (e.g.: FuncName = fun module:name/arity) + # keyword `fun` followed by a `function-declaration` but without `end`. + - - include: namespace-pop + - include: reference-pop + # function expression (e.g.: FuncName = fun(arg) ... end) + - match: (?=\S) + set: expr-fun-anonymous + + expr-fun-anonymous: + - match: end{{ident_break}}|(?=\.) + scope: keyword.declaration.end.erlang + pop: true + - include: separator-clauses + - match: (?=\S) + push: + # 3. function body + - - match: (?=[.;]|end{{ident_break_char}}) + pop: true + - include: separator-expressions + - include: expressions + # 2. function parameters + - - clear_scopes: 1 + - match: \( + scope: punctuation.section.parameters.begin.erlang + set: + - clear_scopes: 1 + - meta_scope: meta.fun.parameters.erlang + - include: parameters-common + - include: function-parameter + - include: else-pop + # 1. function name + - - meta_scope: meta.fun.name.erlang + - include: else-pop + - - include: variable-other-pop + - include: macro-pop + - match: '{{illegal_ident}}' + scope: invalid.illegal.expect-variable.erlang + pop: true + - include: else-pop + +###[ FUNCTION DEFINITION ]#################################################### + + function: + # http://erlang.org/doc/reference_manual/functions.html#function-declaration-syntax + # Function names can be (un-)quoted atoms or nested (un-)quoted macros + # which can contain escape sequences as ordinary strings. + # Example: ?'fu % na\'me' (arguments) + - match: (?={{ident}}\s*\() + push: [function-meta, function-body, function-parameters, entity-name-function] + + function-parameters: + - clear_scopes: 1 + - meta_scope: meta.function.name.erlang + - match: (?=\() + set: + - clear_scopes: 1 + - match: \( + scope: punctuation.section.parameters.begin.erlang + set: + - clear_scopes: 1 + - meta_scope: meta.function.parameters.erlang + - include: parameters-common + - include: function-parameter + - include: else-pop + + function-body: + - match: \. + scope: punctuation.terminator.clause.erlang + pop: true + - match: ';' + scope: punctuation.separator.clauses.erlang + pop: true + - include: separator-expressions + - include: expressions + + function-meta: + - meta_scope: meta.function.erlang + - include: immediatelly-pop + +###[ FUNCTION CALL ]########################################################## + + function-call: + - match: (?={{ident}}\s*\() + push: [function-call-arguments, function-call-name, variable-function] + + function-call-pop: + - match: (?={{ident}}\s*\() + set: [function-call-arguments, function-call-path, variable-function] + + function-call-name: + - meta_scope: meta.function-call.name.erlang + - include: else-pop + + function-call-path: + - meta_scope: meta.path.erlang meta.function-call.name.erlang + - include: else-pop + + function-call-arguments: + - match: \( + scope: punctuation.section.arguments.begin.erlang + set: + - meta_scope: meta.function-call.arguments.erlang + - include: arguments-common + - include: expressions + - include: else-pop + +###[ TYPE CALL ]############################################################## + + type-call: + # http://erlang.org/doc/reference_manual/typespec.html + # A function type looks like: + # fun() %% any function + # fun((...) -> Type) %% any arity, returning Type + # fun(() -> Type) + # fun((TList) -> Type) + - match: fun{{ident_break}} + scope: support.type.erlang + push: [type-call-fun-arguments, type-call-name] + # other type definition + - match: (?={{ident}}\s*\() + push: [type-call-other-arguments, type-call-name, storage-type] + + type-call-pop: + - match: fun{{ident_break}} + scope: support.type.erlang + set: [type-call-fun-arguments, type-call-path] + - match: (?={{ident}}\s*\() + set: [type-call-other-arguments, type-call-path, storage-type] + + type-call-name: + - meta_scope: meta.type-call.name.erlang + - include: else-pop + + type-call-path: + - meta_scope: meta.path.erlang meta.type-call.name.erlang + - include: else-pop + + type-call-fun-arguments: + - match: \( + scope: punctuation.section.arguments.begin.erlang + set: + - - meta_scope: meta.type-call.arguments.erlang + - include: expect-arguments-end + # 2. function return-type + - - match: -> + scope: punctuation.separator.parameters-return-type.erlang + set: + - meta_content_scope: meta.fun.return-type.erlang + - match: (?=[.;)]) + pop: true + - include: type-expressions + - include: else-pop + # 1. function parameters + - - match: \( + scope: punctuation.section.parameters.begin.erlang + set: + - meta_scope: meta.fun.parameters.erlang + - include: variable-any + - include: parameters-common + - include: type-parameter + - include: else-pop + - include: else-pop + + type-call-other-arguments: + - match: \( + scope: punctuation.section.arguments.begin.erlang + set: + - meta_scope: meta.type-call.arguments.erlang + - include: arguments-common + - include: type-expressions + - include: else-pop + +###[ GROUPS ]################################################################# + + group-of-expressions: + # http://erlang.org/doc/reference_manual/expressions.html#parenthesized-expressions + - match: \( + scope: punctuation.section.group.begin.erlang + push: + - meta_scope: meta.group.erlang + - include: group-common + - include: expressions + + group-of-function-parameters: + # http://erlang.org/doc/reference_manual/expressions.html#parenthesized-expressions + - match: \( + scope: punctuation.section.group.begin.erlang + push: + - meta_scope: meta.group.erlang + - include: group-common + - include: function-parameter + + group-of-types: + # http://erlang.org/doc/reference_manual/expressions.html#parenthesized-expressions + - match: \( + scope: punctuation.section.group.begin.erlang + push: + - meta_scope: meta.group.erlang + - include: group-common + - include: type-expressions + + group-of-type-parameters: + # http://erlang.org/doc/reference_manual/expressions.html#parenthesized-expressions + - match: \( + scope: punctuation.section.group.begin.erlang + push: + - meta_scope: meta.group.erlang + - include: group-common + - include: type-parameter + + group-common: + - match: \) + scope: punctuation.section.group.end.erlang + pop: true + - include: clause-end-or-stray + +###[ LISTS ]################################################################## + + list-of-expressions: + # http://erlang.org/doc/reference_manual/data_types.html#list - match: \[ - scope: punctuation.section.list.begin.erlang + scope: punctuation.section.sequence.begin.erlang push: - - meta_scope: meta.structure.list.function.erlang - - match: \] - scope: punctuation.section.list.end.erlang - pop: true - - match: ([a-z][a-zA-Z\d@_]*+)\s*+(/) - captures: - 1: entity.name.function.erlang - 2: punctuation.separator.function-arity.erlang + - meta_scope: meta.sequence.list.erlang + - include: list-common + - include: expressions + + list-of-function-parameters: + # http://erlang.org/doc/reference_manual/data_types.html#list + - match: \[ + scope: punctuation.section.sequence.begin.erlang + push: + - meta_scope: meta.sequence.list.erlang + - include: list-common + - include: function-parameter + + list-of-types: + # http://erlang.org/doc/reference_manual/data_types.html#list + - match: \[ + scope: punctuation.section.sequence.begin.erlang + push: + - meta_scope: meta.sequence.list.erlang + - include: variable-any + - include: list-common + - include: type-expressions + + list-of-type-parameters: + # http://erlang.org/doc/reference_manual/data_types.html#list + - match: \[ + scope: punctuation.section.sequence.begin.erlang + push: + - meta_scope: meta.sequence.list.erlang + - include: variable-any + - include: list-common + - include: type-parameter + + list-common: + - match: \] + scope: punctuation.section.sequence.end.erlang + pop: true + - include: operator-comprehension + - include: separator-sequence + - include: separator-union + - include: clause-end-or-stray + +###[ MAPS ]################################################################### + + map-of-expressions: + # http://erlang.org/doc/reference_manual/data_types.html#map + # http://erlang.org/doc/reference_manual/expressions.html#map-expressions + - match: '#{' + scope: meta.mapping.erlang punctuation.section.mapping.begin.erlang + push: + - include: map-common + # value + - match: =>|\:= + scope: meta.mapping.erlang punctuation.separator.mapping.key-value.erlang push: - - match: (,)|(?=\]) - captures: - 1: punctuation.separator.list.erlang + - meta_content_scope: meta.mapping.value.erlang + - include: expressions + - include: value-end-pop + # key + - match: ',?' + scope: meta.mapping.erlang punctuation.separator.mapping.pair.erlang + push: + - meta_content_scope: meta.mapping.key.erlang + - match: (?==>|\:=) pop: true - - include: everything-else - - include: everything-else - internal-function-parts: - - match: (?=\() + - include: expressions + - include: value-end-pop + - include: map-separator + + map-of-types: + # http://erlang.org/doc/reference_manual/data_types.html#map + # http://erlang.org/doc/reference_manual/expressions.html#map-expressions + - match: '#{' + scope: meta.mapping.erlang punctuation.section.mapping.begin.erlang push: - - match: -> - scope: punctuation.separator.clause-head-body.erlang - pop: true - - match: \( - scope: punctuation.section.parameters.begin.erlang + - include: map-common + # value + - match: =>|\:= + scope: meta.mapping.erlang punctuation.separator.mapping.key-value.erlang + push: + - meta_content_scope: meta.mapping.value.erlang + - include: type-expressions + - include: value-end-pop + # key + - match: ',?' + scope: meta.mapping.erlang punctuation.separator.mapping.pair.erlang push: - - match: \) - scope: punctuation.section.parameters.end.erlang + - meta_content_scope: meta.mapping.key.erlang + - match: (?==>|\:=) pop: true - - match: "," - scope: punctuation.separator.parameters.erlang - - include: everything-else - - match: ",|;" - scope: punctuation.separator.guards.erlang - - include: everything-else - - match: "," - scope: punctuation.separator.expressions.erlang - - include: everything-else - internal-record-body: + - include: type-expressions + - include: value-end-pop + - include: map-separator + + map-separator: + - match: =>|\:= + scope: punctuation.separator.mapping.key-value.erlang + + map-common: + - match: \} + scope: meta.mapping.erlang punctuation.section.mapping.end.erlang + pop: true + - include: clause-end-or-stray + +###[ RECORDS ]################################################################ + + record: + # http://erlang.org/doc/reference_manual/records.html + - match: \#(?={{ident}}) + scope: punctuation.definition.record.erlang + push: [record-fields, record-name, variable-other-record] + # records may look like normal variables in macro definitions + - match: '{{variable}}(?=\.{{ident}})' + scope: meta.record.name.erlang variable.other.erlang + push: record-fields + + record-name: + - meta_scope: meta.record.name.erlang + - include: else-pop + + variable-other-record: + - match: '{{atom_unquoted}}' + scope: meta.atom.erlang variable.other.record.erlang + pop: true + - match: \' + scope: punctuation.definition.atom.begin.erlang + set: + - meta_include_prototype: false + - meta_scope: meta.atom.erlang variable.other.record.erlang + - include: atom-quoted-common + - include: macro-pop + - include: atom-expect-end + + record-fields: + - match: \. + scope: meta.record.erlang punctuation.accessor.dot.erlang + set: + - - meta_content_scope: meta.record.field.erlang + - include: immediatelly-pop + - - include: variable-other-field + - include: eol-pop - match: \{ - scope: punctuation.section.class.record.begin.erlang + scope: punctuation.section.fields.begin.erlang + set: + - meta_scope: meta.record.fields.erlang + - include: record-fields-common + - match: ',?' + scope: punctuation.separator.expressions.erlang + push: + - - meta_content_scope: meta.field.name.erlang + - include: immediatelly-pop + - - include: variable-anonymous-pop + - include: variable-other-field + - include: else-pop + + record-fields-common: + - match: \} + scope: punctuation.section.fields.end.erlang + pop: true + # field value + - match: = + scope: meta.field.erlang keyword.operator.assignment.erlang push: - - meta_scope: meta.structure.record.erlang - - match: (?=\}) + - meta_content_scope: meta.field.value.erlang + - match: (?=::) pop: true - - match: (([a-z][a-zA-Z\d@_]*+)|(_))\s*+(=) - captures: - 2: variable.other.field.erlang - 3: variable.language.omitted.field.erlang - 4: keyword.operator.assignment.erlang - push: - - match: (,)|(?=\}) - captures: - 1: punctuation.separator.class.record.erlang - pop: true - - include: everything-else - - match: ([a-z][a-zA-Z\d@_]*+)\s*+(,)? - captures: - 1: variable.other.field.erlang - 2: punctuation.separator.class.record.erlang - - include: everything-else - internal-type-specifiers: + - include: expressions + - include: value-end-pop + # field type + - match: '::' + scope: meta.field.erlang punctuation.separator.variable-type.erlang + push: + - meta_content_scope: meta.field.type.erlang + - include: type-expressions + - include: value-end-pop + - include: clause-end-or-stray + + variable-other-field: + - match: '{{atom_unquoted}}' + scope: meta.atom.erlang variable.other.field.erlang + pop: true + - match: \' + scope: punctuation.definition.atom.begin.erlang + set: + - meta_include_prototype: false + - meta_scope: meta.atom.erlang variable.other.field.erlang + - include: atom-quoted-common + - include: macro-pop + - include: atom-expect-end + +###[ TUPLES ]################################################################# + + tuple-of-expressions: + # http://erlang.org/doc/reference_manual/data_types.html#tuple + - match: \{ + scope: punctuation.section.sequence.begin.erlang + push: + - meta_scope: meta.sequence.tuple.erlang + - include: tuple-common + - include: expressions + + tuple-of-function-parameters: + # http://erlang.org/doc/reference_manual/data_types.html#tuple + - match: \{ + scope: punctuation.section.sequence.begin.erlang + push: + - meta_scope: meta.sequence.tuple.erlang + - include: tuple-common + - include: function-parameter + + tuple-of-types: + # http://erlang.org/doc/reference_manual/data_types.html#tuple + - match: \{ + scope: punctuation.section.sequence.begin.erlang + push: + - meta_scope: meta.sequence.tuple.erlang + - include: variable-any + - include: tuple-common + - include: type-expressions + + tuple-of-type-parameters: + # http://erlang.org/doc/reference_manual/data_types.html#tuple + - match: \{ + scope: punctuation.section.sequence.begin.erlang + push: + - meta_scope: meta.sequence.tuple.erlang + - include: variable-any + - include: tuple-common + - include: type-parameter + + tuple-common: + - match: \} + scope: punctuation.section.sequence.end.erlang + pop: true + - include: operator-comprehension + - include: separator-sequence + - include: clause-end-or-stray + +###[ KEYWORDS ]############################################################### + + constant: + # http://erlang.org/doc/reference_manual/data_types.html#boolean + - match: (false|true){{ident_break}} + scope: constant.language.boolean.erlang + # http://erlang.org/doc/reference_manual/errors.html#exceptions + - match: (error|exit|ok|throw){{ident_break}} + scope: constant.language.exception.type.erlang + - match: (badarg|badarith|badmatch|function_clause|case_clause|if_clause|try_clause|undef|badfun|badarity|timeout_value|noproc|nocatch|system_limit){{ident_break}} + scope: constant.language.exception.reason.erlang + # http://erlang.org/doc/reference_manual/records.html#defining-records + - match: (none|undefined){{ident_break}} + scope: constant.language.undefined.erlang + # http://erlang.org/doc/man/erlang.html#data-types + - match: (off_heap|on_heap){{ident_break}} + scope: constant.language.message-queue-data.erlang + - match: ((milli|micro|nano)?second|native|perf_counter|infinity){{ident_break}} + scope: constant.language.time.erlang + - match: ((milli|micro|nano)_)?seconds{{ident_break}} + scope: constant.language.time.erlang invalid.deprecated.erlang + + keyword: + # keywords which are not otherwise matched already and don't need fallbacks + - match: catch{{ident_break}} + scope: keyword.control.exception.erlang + - match: (after|cond|end|let|of){{ident_break}} + scope: keyword.control.flow.erlang + + illegal-type-keyword: + # The following keywords are not part of the type/spec language and must + # not be used as types/constants as they are part of the reserved words. + # http://erlang.org/doc/reference_manual/introduction.html#reserved-words + - match: (after|andalso|begin|case|catch|cond|end|if|let|of|orelse|receive|try|when){{ident_break}} + scope: invalid.illegal.keyword.erlang + +###[ NAMESPACE ]############################################################## + + namespace: + - match: (?={{ident}}\s*:[^:=]) + push: [namespace-member, namespace-accessor, namespace-qualifier] + + namespace-pop: + - match: (?={{ident}}\s*:[^:=]) + set: [namespace-member, namespace-accessor, namespace-qualifier] + + type-namespace: + - match: (?={{ident}}\s*:[^:=]) + push: [type-namespace-member, namespace-accessor, namespace-qualifier] + + namespace-member: + - meta_scope: meta.path.erlang + - include: function-call-pop + - match: (?=\S)|$ + set: [namespace-meta, namespace-member-other] + + type-namespace-member: + - meta_scope: meta.path.erlang + - include: type-call-pop + - match: (?=\S)|$ + set: [namespace-meta, namespace-member-other] + + namespace-meta: + - meta_scope: meta.path.erlang + - include: immediatelly-pop + + namespace-member-other: + - include: reference-pop + - include: constant + - include: atom-pop + - include: macro-pop + - include: variable-other-pop + - include: immediatelly-pop + + namespace-accessor: + - match: ':' + scope: punctuation.accessor.double-colon.erlang + pop: true + + namespace-qualifier: + - match: '{{support_namespaces}}' + scope: meta.atom.erlang support.namespace.erlang + pop: true + - match: '{{atom_unquoted}}' + scope: meta.atom.erlang variable.namespace.erlang + pop: true + - include: variable-other-pop + - match: \' + scope: punctuation.definition.atom.begin.erlang + set: + - meta_include_prototype: false + - meta_scope: meta.atom.erlang variable.namespace.erlang + - include: atom-quoted-common + - include: macro-pop + +###[ REFERENCE ]############################################################## + + reference: + - match: (?={{ident}}\s*/) + push: [reference-arity, reference-name, variable-function] + + reference-pop: + - match: (?={{ident}}\s*/) + set: [reference-arity, reference-name, variable-function] + + reference-name: + - meta_content_scope: meta.reference.function.name.erlang + - include: else-pop + + reference-arity: + - match: / + scope: meta.reference.function.erlang punctuation.separator.reference.erlang + set: + - - meta_content_scope: meta.reference.function.arity.erlang + - include: immediatelly-pop + - - match: \d+ + scope: constant.numeric.integer.decimal.erlang + pop: true + - include: variable-anonymous-pop + - include: variable-other-pop + - include: macro-pop + - match: '{{illegal_ident}}' + scope: invalid.illegal.expect-integer.erlang + pop: true + - include: else-pop + - include: else-pop + +###[ VARIABLE ]############################################################### + + variable-anonymous: + - match: _{{ident_break}} + scope: variable.language.anonymous.erlang + + variable-anonymous-pop: + - match: _{{ident_break}} + scope: variable.language.anonymous.erlang + pop: true + + variable-any: + - match: \.{3} + scope: variable.language.any.erlang + + variable-other: + - match: '{{variable}}' + scope: variable.other.erlang + + variable-other-pop: + - match: '{{variable}}' + scope: variable.other.erlang + pop: true + + variable-parameter: + - match: '{{variable}}' + scope: variable.parameter.erlang + +###[ IDENTIFIERS ]############################################################ + + atom: + # http://erlang.org/doc/reference_manual/data_types.html#atom + - match: '{{atom_unquoted}}' + scope: meta.atom.erlang constant.other.symbol.erlang + - match: \' + scope: punctuation.definition.atom.begin.erlang + push: + - meta_include_prototype: false + - meta_scope: meta.atom.erlang constant.other.symbol.erlang + - include: atom-quoted-common + + atom-pop: + # http://erlang.org/doc/reference_manual/data_types.html#atom + - match: '{{atom_unquoted}}' + scope: meta.atom.erlang constant.other.symbol.erlang + pop: true + - match: \' + scope: punctuation.definition.atom.begin.erlang + set: + - meta_include_prototype: false + - meta_scope: meta.atom.erlang constant.other.symbol.erlang + - include: atom-quoted-common + + entity-name-function: + # function name must be an atom + - match: '{{atom_unquoted}}' + scope: meta.atom.erlang entity.name.function.erlang + pop: true + - match: \' + scope: punctuation.definition.atom.begin.erlang + set: + - meta_include_prototype: false + - meta_scope: meta.atom.erlang entity.name.function.erlang + - include: atom-quoted-common + - include: macro-pop + - include: atom-expect-end + + entity-name-macro: + - match: '{{ident_unquoted}}' + scope: meta.atom.erlang entity.name.constant.macro.erlang + pop: true + - match: \' + scope: punctuation.definition.atom.begin.erlang + set: + - meta_include_prototype: false + - meta_scope: meta.atom.erlang entity.name.constant.macro.erlang + - include: atom-quoted-common + - include: macro-pop + - include: ident-expect-end + + entity-name-module: + - match: '{{atom_unquoted}}' + scope: meta.atom.erlang entity.name.namespace.erlang + pop: true + - match: \' + scope: punctuation.definition.atom.begin.erlang + set: + - meta_include_prototype: false + - meta_scope: meta.atom.erlang entity.name.namespace.erlang + - include: atom-quoted-common + - include: macro-pop + - include: atom-expect-end + + entity-name-record: + - match: '{{atom_unquoted}}' + scope: meta.atom.erlang entity.name.record.erlang + pop: true + - match: \' + scope: punctuation.definition.atom.begin.erlang + set: + - meta_include_prototype: false + - meta_scope: meta.atom.erlang entity.name.record.erlang + - include: atom-quoted-common + - include: macro-pop + - include: atom-expect-end + + entity-name-type: + - match: '{{atom_unquoted}}' + scope: meta.atom.erlang entity.name.type.erlang + pop: true + - match: \' + scope: punctuation.definition.atom.begin.erlang + set: + - meta_include_prototype: false + - meta_scope: meta.atom.erlang entity.name.type.erlang + - include: atom-quoted-common + - include: macro-pop + - include: atom-expect-end + + constant-other-macro: + - match: '{{ident_unquoted}}' + scope: meta.atom.erlang constant.other.macro.erlang + pop: true + - match: \' + scope: punctuation.definition.atom.begin.erlang + set: + - meta_include_prototype: false + - meta_scope: meta.atom.erlang constant.other.macro.erlang + - include: atom-quoted-common + - include: ident-expect-end + + storage-type: + - match: '{{erlang_types}}' + scope: meta.atom.erlang support.type.erlang + pop: true + - match: '{{atom_unquoted}}' + scope: meta.atom.erlang storage.type.erlang + pop: true + - match: \' + scope: punctuation.definition.atom.begin.erlang + set: + - meta_include_prototype: false + - meta_scope: meta.atom.erlang storage.type.erlang + - include: atom-quoted-common + - include: macro-pop + - include: atom-expect-end + + variable-function: + - match: '{{erlang_functions}}' + scope: meta.atom.erlang support.function.erlang + pop: true + - match: '{{atom_unquoted}}' + scope: meta.atom.erlang variable.function.erlang + pop: true + - match: \' + scope: punctuation.definition.atom.begin.erlang + set: + - meta_include_prototype: false + - meta_scope: meta.atom.erlang variable.function.erlang + - include: atom-quoted-common + - include: variable-other-pop + - include: macro-pop + - include: ident-expect-end + + atom-quoted-common: + - match: \' + scope: punctuation.definition.atom.end.erlang + pop: true + - match: (?=\\) + push: escape + + atom-expect-end: + - match: '{{illegal_ident}}' + scope: invalid.illegal.expect-atom.erlang + pop: true + - include: else-pop + + ident-expect-end: + - match: '{{illegal_ident}}' + scope: invalid.illegal.expect-identifier.erlang + pop: true + - include: else-pop + +###[ ATOMIC DATA TYPES ]###################################################### + + binary: + # http://erlang.org/doc/reference_manual/data_types.html#bit-strings-and-binaries + # http://erlang.org/doc/reference_manual/expressions.html#bit_syntax + - match: << + scope: punctuation.definition.sequence.begin.erlang + push: + - meta_scope: meta.sequence.binary.erlang + - include: binary-common + - include: expressions-nested + - include: common + - include: variable-other + + binary-function-parameter: + # http://erlang.org/doc/reference_manual/data_types.html#bit-strings-and-binaries + # http://erlang.org/doc/reference_manual/expressions.html#bit_syntax + - match: << + scope: punctuation.definition.sequence.begin.erlang + push: + - meta_scope: meta.sequence.binary.erlang + - include: binary-common + - include: function-parameter-nested + - include: common + - include: variable-parameter + + binary-type-parameter: + # http://erlang.org/doc/reference_manual/data_types.html#bit-strings-and-binaries + # http://erlang.org/doc/reference_manual/expressions.html#bit_syntax + - match: << + scope: punctuation.definition.sequence.begin.erlang + push: + - meta_scope: meta.sequence.binary.erlang + - include: binary-common + - include: type-parameter-nested + - include: terms + - include: variable-parameter + + binary-common: + - match: '>>' + scope: punctuation.definition.sequence.end.erlang + pop: true + - match: ':' + scope: punctuation.separator.value-size.erlang - match: / scope: punctuation.separator.value-type.erlang push: - - match: (?=,|:|>>) + - match: (?=>>|[.,;]) pop: true - - match: (integer|float|binary)|(signed|unsigned)|(big|little|native)|(unit)|(-) - captures: - 1: storage.type.erlang - 2: storage.modifier.signedness.erlang - 3: storage.modifier.endianness.erlang - 4: storage.modifier.unit.erlang - 5: punctuation.separator.type-specifiers.erlang - keyword: - - match: \b(after|begin|case|catch|cond|end|fun|if|let|of|query|try|receive|when)\b - scope: keyword.control.erlang - list: - - match: \[ - scope: punctuation.section.list.begin.erlang + - match: '-' + scope: punctuation.separator.type-specifiers.erlang + - match: ':' + scope: punctuation.separator.unit-value.erlang + - match: (integer|float|binary|bytes|bitstring|bits|utf8|utf16|utf32){{ident_break}} + scope: storage.type.erlang + - match: (signed|unsigned){{ident_break}} + scope: storage.modifier.signedness.erlang + - match: (big|little|native){{ident_break}} + scope: storage.modifier.endianness.erlang + - match: unit{{ident_break}} + scope: storage.modifier.unit.erlang + - include: number + - include: macro + - include: operator-comprehension + - include: separator-sequence + - include: clause-end-pop + + character: + - match: \$ + scope: constant.character.erlang punctuation.definition.character.erlang push: - - meta_scope: meta.structure.list.erlang - - match: \] - scope: punctuation.section.list.end.erlang + - meta_include_prototype: false + - include: escape + - match: . + scope: constant.character.erlang pop: true - - match: \||\|\||, - scope: punctuation.separator.list.erlang - - include: everything-else - macro-directive: - - match: ^\s*+(-)\s*+(ifdef)\s*+(\()\s*+([a-zA-z\d@_]++)\s*+(\))\s*+(\.) - scope: meta.directive.ifdef.erlang + + escape: + # http://erlang.org/doc/reference_manual/data_types.html#escape-sequences + - match: (\\)[bdefnrstv\\''"$~] + scope: constant.character.escape.erlang captures: - 1: punctuation.section.directive.begin.erlang - 2: keyword.control.directive.ifdef.erlang - 3: punctuation.section.parameters.begin.erlang - 4: entity.name.function.macro.erlang - 5: punctuation.section.parameters.end.erlang - 6: punctuation.section.directive.end.erlang - - match: ^\s*+(-)\s*+(ifndef)\s*+(\()\s*+([a-zA-z\d@_]++)\s*+(\))\s*+(\.) - scope: meta.directive.ifndef.erlang + 1: punctuation.definition.escape.erlang + pop: true + # Character with octal representation + - match: (\\)[0-7]{1,3} + scope: constant.character.escape.erlang captures: - 1: punctuation.section.directive.begin.erlang - 2: keyword.control.directive.ifndef.erlang - 3: punctuation.section.parameters.begin.erlang - 4: entity.name.function.macro.erlang - 5: punctuation.section.parameters.end.erlang - 6: punctuation.section.directive.end.erlang - - match: ^\s*+(-)\s*+(undef)\s*+(\()\s*+([a-zA-z\d@_]++)\s*+(\))\s*+(\.) - scope: meta.directive.undef.erlang + 1: punctuation.definition.escape.erlang + pop: true + # Character with hexadecimal representation + - match: (\\x)\h{2} + scope: constant.character.escape.erlang captures: - 1: punctuation.section.directive.begin.erlang - 2: keyword.control.directive.undef.erlang - 3: punctuation.section.parameters.begin.erlang - 4: entity.name.function.macro.erlang - 5: punctuation.section.parameters.end.erlang - 6: punctuation.section.directive.end.erlang - macro-usage: - - match: (\?\??)\s*+([a-zA-Z\d@_]++) - scope: meta.macro-usage.erlang + 1: punctuation.definition.escape.erlang + pop: true + - match: \\x\{ + scope: punctuation.definition.escape.begin.erlang + set: + - meta_scope: constant.character.escape.erlang + - include: clause-end-pop + - match: \}|$ + scope: punctuation.definition.escape.end.erlang + pop: true + - match: \H + scope: invalid.illegal.hex.erlang + - match: (\\x)\S{2} + scope: constant.character.escape.erlang invalid.illegal.escape.erlang + captures: + 1: punctuation.definition.escape.erlang + pop: true + # Control A to control Z and Control [, ] seen in default libs + - match: (\\\^)[A-Za-z\[\]] + scope: constant.character.escape.erlang + captures: + 1: punctuation.definition.escape.erlang + pop: true + - match: (\\\^?).? + scope: constant.character.escape.erlang invalid.illegal.escape.erlang captures: - 1: keyword.operator.macro.erlang - 2: entity.name.function.macro.erlang - module-directive: - - match: ^\s*+(-)\s*+(module)\s*+(\()\s*+([a-z][a-zA-Z\d@_]*+)\s*+(\))\s*+(\.) - scope: meta.directive.module.erlang + 1: punctuation.definition.escape.erlang + pop: true + + macro: + # http://erlang.org/doc/reference_manual/macros.html#predefined-macros + - match: (\?{1,2}){{erlang_macros}} + scope: constant.language.macro.erlang captures: - 1: punctuation.section.directive.begin.erlang - 2: keyword.control.directive.module.erlang - 3: punctuation.section.parameters.begin.erlang - 4: entity.name.type.class.module.section.erlang - 5: punctuation.section.parameters.end.erlang - 6: punctuation.section.directive.end.erlang + 1: punctuation.definition.macro.erlang + # http://erlang.org/doc/reference_manual/macros.html#defining-and-using-macros + - match: \?{1,2} + scope: + constant.other.macro.erlang + punctuation.definition.macro.erlang + push: constant-other-macro + + macro-pop: + # predefined macro + - match: (\?{1,2}){{erlang_macros}} + scope: constant.language.macro.erlang + captures: + 1: punctuation.definition.macro.erlang + pop: true + # user defined macro + - match: \?{1,2} + scope: + constant.other.macro.erlang + punctuation.definition.macro.erlang + set: constant-other-macro + number: - - match: (?=\d) - push: - - match: (?!\d) - pop: true - - match: \d++(\.)\d++(([eE][\+\-])?\d++)? - scope: constant.numeric.float.erlang - captures: - 1: punctuation.separator.integer-float.erlang - 3: punctuation.separator.float-exponent.erlang - - match: 2(#)[0-1]++ - scope: constant.numeric.integer.binary.erlang - captures: - 1: punctuation.separator.base-integer.erlang - - match: 3(#)[0-2]++ - scope: constant.numeric.integer.base-3.erlang - captures: - 1: punctuation.separator.base-integer.erlang - - match: 4(#)[0-3]++ - scope: constant.numeric.integer.base-4.erlang - captures: - 1: punctuation.separator.base-integer.erlang - - match: 5(#)[0-4]++ - scope: constant.numeric.integer.base-5.erlang - captures: - 1: punctuation.separator.base-integer.erlang - - match: 6(#)[0-5]++ - scope: constant.numeric.integer.base-6.erlang - captures: - 1: punctuation.separator.base-integer.erlang - - match: 7(#)[0-6]++ - scope: constant.numeric.integer.base-7.erlang - captures: - 1: punctuation.separator.base-integer.erlang - - match: 8(#)[0-7]++ - scope: constant.numeric.integer.octal.erlang - captures: - 1: punctuation.separator.base-integer.erlang - - match: 9(#)[0-8]++ - scope: constant.numeric.integer.base-9.erlang - captures: - 1: punctuation.separator.base-integer.erlang - - match: 10(#)\d++ - scope: constant.numeric.integer.decimal.erlang - captures: - 1: punctuation.separator.base-integer.erlang - - match: 11(#)[\daA]++ - scope: constant.numeric.integer.base-11.erlang - captures: - 1: punctuation.separator.base-integer.erlang - - match: 12(#)[\da-bA-B]++ - scope: constant.numeric.integer.base-12.erlang - captures: - 1: punctuation.separator.base-integer.erlang - - match: 13(#)[\da-cA-C]++ - scope: constant.numeric.integer.base-13.erlang - captures: - 1: punctuation.separator.base-integer.erlang - - match: 14(#)[\da-dA-D]++ - scope: constant.numeric.integer.base-14.erlang - captures: - 1: punctuation.separator.base-integer.erlang - - match: 15(#)[\da-eA-E]++ - scope: constant.numeric.integer.base-15.erlang - captures: - 1: punctuation.separator.base-integer.erlang - - match: 16(#)\h++ - scope: constant.numeric.integer.hexadecimal.erlang - captures: - 1: punctuation.separator.base-integer.erlang - - match: 17(#)[\da-gA-G]++ - scope: constant.numeric.integer.base-17.erlang - captures: - 1: punctuation.separator.base-integer.erlang - - match: 18(#)[\da-hA-H]++ - scope: constant.numeric.integer.base-18.erlang - captures: - 1: punctuation.separator.base-integer.erlang - - match: 19(#)[\da-iA-I]++ - scope: constant.numeric.integer.base-19.erlang - captures: - 1: punctuation.separator.base-integer.erlang - - match: 20(#)[\da-jA-J]++ - scope: constant.numeric.integer.base-20.erlang - captures: - 1: punctuation.separator.base-integer.erlang - - match: 21(#)[\da-kA-K]++ - scope: constant.numeric.integer.base-21.erlang - captures: - 1: punctuation.separator.base-integer.erlang - - match: 22(#)[\da-lA-L]++ - scope: constant.numeric.integer.base-22.erlang - captures: - 1: punctuation.separator.base-integer.erlang - - match: 23(#)[\da-mA-M]++ - scope: constant.numeric.integer.base-23.erlang - captures: - 1: punctuation.separator.base-integer.erlang - - match: 24(#)[\da-nA-N]++ - scope: constant.numeric.integer.base-24.erlang - captures: - 1: punctuation.separator.base-integer.erlang - - match: 25(#)[\da-oA-O]++ - scope: constant.numeric.integer.base-25.erlang - captures: - 1: punctuation.separator.base-integer.erlang - - match: 26(#)[\da-pA-P]++ - scope: constant.numeric.integer.base-26.erlang - captures: - 1: punctuation.separator.base-integer.erlang - - match: 27(#)[\da-qA-Q]++ - scope: constant.numeric.integer.base-27.erlang - captures: - 1: punctuation.separator.base-integer.erlang - - match: 28(#)[\da-rA-R]++ - scope: constant.numeric.integer.base-28.erlang - captures: - 1: punctuation.separator.base-integer.erlang - - match: 29(#)[\da-sA-S]++ - scope: constant.numeric.integer.base-29.erlang - captures: - 1: punctuation.separator.base-integer.erlang - - match: 30(#)[\da-tA-T]++ - scope: constant.numeric.integer.base-30.erlang - captures: - 1: punctuation.separator.base-integer.erlang - - match: 31(#)[\da-uA-U]++ - scope: constant.numeric.integer.base-31.erlang - captures: - 1: punctuation.separator.base-integer.erlang - - match: 32(#)[\da-vA-V]++ - scope: constant.numeric.integer.base-32.erlang - captures: - 1: punctuation.separator.base-integer.erlang - - match: 33(#)[\da-wA-W]++ - scope: constant.numeric.integer.base-33.erlang - captures: - 1: punctuation.separator.base-integer.erlang - - match: 34(#)[\da-xA-X]++ - scope: constant.numeric.integer.base-34.erlang - captures: - 1: punctuation.separator.base-integer.erlang - - match: 35(#)[\da-yA-Y]++ - scope: constant.numeric.integer.base-35.erlang - captures: - 1: punctuation.separator.base-integer.erlang - - match: 36(#)[\da-zA-Z]++ - scope: constant.numeric.integer.base-36.erlang - captures: - 1: punctuation.separator.base-integer.erlang - - match: \d++#[\da-zA-Z]++ - scope: invalid.illegal.integer.erlang - - match: \d++ - scope: constant.numeric.integer.decimal.erlang - parenthesized-expression: + # http://erlang.org/doc/reference_manual/data_types.html#number + - match: \d+(\.)\d+([eE][-+]?\d+)?\b + scope: constant.numeric.float.decimal.erlang + captures: + 1: punctuation.separator.decimal.erlang + - match: |- + (?x:((2\#)[0-1]+) # binary + | ((8\#)[0-7]+) # octal + | ((10\#)[0-9]+) # decimal + | ((16\#)[\da-fA-F]+) # hexadecimal + | ((3\#)[0-2]+ + | (4\#)[0-3]+ + | (5\#)[0-4]+ + | (6\#)[0-5]+ + | (7\#)[0-6]+ + | (9\#)[0-8]+ + | (11\#)[\daA]+ + | (12\#)[\da-bA-B]+ + | (13\#)[\da-cA-C]+ + | (14\#)[\da-dA-D]+ + | (15\#)[\da-eA-E]+ + | (17\#)[\da-gA-G]+ + | (18\#)[\da-hA-H]+ + | (19\#)[\da-iA-I]+ + | (20\#)[\da-jA-J]+ + | (21\#)[\da-kA-K]+ + | (22\#)[\da-lA-L]+ + | (23\#)[\da-mA-M]+ + | (24\#)[\da-nA-N]+ + | (25\#)[\da-oA-O]+ + | (26\#)[\da-pA-P]+ + | (27\#)[\da-qA-Q]+ + | (28\#)[\da-rA-R]+ + | (29\#)[\da-sA-S]+ + | (30\#)[\da-tA-T]+ + | (31\#)[\da-uA-U]+ + | (32\#)[\da-vA-V]+ + | (33\#)[\da-wA-W]+ + | (34\#)[\da-xA-X]+ + | (35\#)[\da-yA-Y]+ + | (36\#)[\da-zA-Z]+) # other + | ((\d+\#)\S+) # illegal + )\b + captures: + 1: constant.numeric.integer.binary.erlang + 2: punctuation.definition.numeric.base.erlang + 3: constant.numeric.integer.octal.erlang + 4: punctuation.definition.numeric.base.erlang + 5: constant.numeric.integer.decimal.erlang + 6: punctuation.definition.numeric.base.erlang + 7: constant.numeric.integer.hexadecimal.erlang + 8: punctuation.definition.numeric.base.erlang + 9: constant.numeric.integer.other.erlang + 10: punctuation.definition.numeric.base.erlang + 11: punctuation.definition.numeric.base.erlang + 12: punctuation.definition.numeric.base.erlang + 13: punctuation.definition.numeric.base.erlang + 14: punctuation.definition.numeric.base.erlang + 15: punctuation.definition.numeric.base.erlang + 16: punctuation.definition.numeric.base.erlang + 17: punctuation.definition.numeric.base.erlang + 18: punctuation.definition.numeric.base.erlang + 19: punctuation.definition.numeric.base.erlang + 20: punctuation.definition.numeric.base.erlang + 21: punctuation.definition.numeric.base.erlang + 22: punctuation.definition.numeric.base.erlang + 23: punctuation.definition.numeric.base.erlang + 24: punctuation.definition.numeric.base.erlang + 25: punctuation.definition.numeric.base.erlang + 26: punctuation.definition.numeric.base.erlang + 27: punctuation.definition.numeric.base.erlang + 28: punctuation.definition.numeric.base.erlang + 29: punctuation.definition.numeric.base.erlang + 30: punctuation.definition.numeric.base.erlang + 31: punctuation.definition.numeric.base.erlang + 32: punctuation.definition.numeric.base.erlang + 33: punctuation.definition.numeric.base.erlang + 34: punctuation.definition.numeric.base.erlang + 35: punctuation.definition.numeric.base.erlang + 36: punctuation.definition.numeric.base.erlang + 37: punctuation.definition.numeric.base.erlang + 38: punctuation.definition.numeric.base.erlang + 39: punctuation.definition.numeric.base.erlang + 40: punctuation.definition.numeric.base.erlang + 41: invalid.illegal.integer.erlang + 42: punctuation.definition.numeric.base.erlang + - match: \d+\b + scope: constant.numeric.integer.decimal.erlang + - match: \d\w+ + scope: invalid.illegal.integer.erlang + + string: + # http://erlang.org/doc/reference_manual/data_types.html#string + - match: \" + scope: punctuation.definition.string.begin.erlang + push: string-body + + string-body: + - meta_include_prototype: false + - meta_scope: string.quoted.double.erlang + - match: \" + scope: punctuation.definition.string.end.erlang + pop: true + - match: (?=\\) + push: escape + # http://erlang.org/doc/man/io.html + # The general format of a control sequence is ~F.P.PadModC. + - match: |- + (?x: + (~) + (?: (\-?\*) | (\-?\d+) )? # F - field width + (?: + (\.) (?: (\*) | (\d+) )? # P - precision + (?: (\.) (.) )? # Pad - padding character + )? + ([lt]{0,2}) # Mod - control modifier + ([~cfegswpWPBX#bx\+ni]) # C - control sequence + ) + captures: + 1: constant.other.placeholder.erlang punctuation.definition.placeholder.erlang + 2: constant.other.placeholder.width.asterisk.erlang + 3: constant.other.placeholder.width.integer.erlang + 4: constant.other.placeholder.precision.erlang punctuation.separator.placeholder.erlang + 5: constant.other.placeholder.precision.asterisk.erlang + 6: constant.other.placeholder.precision.integer.erlang + 7: constant.other.placeholder.separator.erlang punctuation.separator.placeholder.erlang + 8: constant.other.placeholder.padding.character.erlang + 9: constant.other.placeholder.control.modifier.erlang + 10: constant.other.placeholder.control.character.erlang + + string-maybe-env: + - match: (\$){{ident_unquoted}} + scope: variable.language.environment.erlang + captures: + 1: punctuation.definition.variable.erlang + pop: true + - include: else-pop + +###[ OPERATORS ]############################################################## + + operator-comprehension: + - match: \|\| + scope: keyword.operator.comprehension.erlang + + operator-unary: + # http://erlang.org/doc/reference_manual/expressions.html#list-comprehensions + - match: <=|<- + scope: keyword.operator.generator.erlang + # http://erlang.org/doc/reference_manual/expressions.html#term-comparisons + - match: =/=|=:=|/=|==|=<|>=|=!|[<>!] + scope: keyword.operator.logical.erlang + # http://erlang.org/doc/reference_manual/expressions.html#list-operations + - match: \+\+|-- + scope: keyword.operator.lists.erlang + # http://erlang.org/doc/reference_manual/expressions.html#arithmetic-expressions + - match: '[-+*/]' + scope: keyword.operator.arithmetic.erlang + - match: '=' + scope: keyword.operator.assignment.erlang + + operator: + # http://erlang.org/doc/reference_manual/expressions.html#arithmetic-expressions + - match: (div|rem){{ident_break}} + scope: keyword.operator.arithmetic.erlang + - match: (band|bor|bxor|bnot|bsl|bsr){{ident_break}} + scope: keyword.operator.bitwise.erlang + # http://erlang.org/doc/reference_manual/expressions.html#boolean-expressions + # http://erlang.org/doc/reference_manual/expressions.html#short-circuit-expressions + - match: (and|or|xor|not|andalso|orelse){{ident_break}} + scope: keyword.operator.logical.erlang + +###[ SEPARATORS ]############################################################# + + separator-clauses: + - match: ';' + scope: punctuation.separator.clauses.erlang + + separator-expressions: + - match: ',' + scope: punctuation.separator.expressions.erlang + + separator-sequence: + - match: ',' + scope: punctuation.separator.sequence.erlang + + separator-type: + - match: \.\. + scope: punctuation.separator.range.erlang + - match: '::' + scope: punctuation.separator.variable-type.erlang + + separator-union: + - match: \| + scope: punctuation.separator.sequence.erlang + + terminator-clause: + - match: \. + scope: punctuation.terminator.clause.erlang + + terminator-clause-pop: + - match: \. + scope: punctuation.terminator.clause.erlang + pop: true + +###[ ARGUMENTS ]############################################################## + + arguments-common: + - include: arguments-end + - match: ',' + scope: punctuation.separator.arguments.erlang + + arguments-end: + - match: \) + scope: punctuation.section.arguments.end.erlang + pop: true + - include: clause-end-or-stray + + expect-arguments-end: + - include: arguments-end + - include: illegal-group + - match: \S + scope: invalid.illegal.expect-arguments-end.erlang + + expect-arguments-separator: + - match: ',' + scope: punctuation.separator.arguments.erlang + pop: true + - match: \s+(?!,) + scope: invalid.illegal.expect-separator.erlang + pop: true + - include: else-pop + +###[ CONTEXT POP OFFS ]####################################################### + + parameters-common: + - match: \) + scope: punctuation.section.parameters.end.erlang + pop: true + - match: ',' + scope: punctuation.separator.parameters.erlang + - include: clause-end-or-stray + + parameters-end-pop: + # bailout from parameter lists if guard or clause body starts + - match: (?=->|when{{ident_break_char}}) + pop: true + + immediatelly-pop: + - match: '' + pop: true + + eol-pop: + - match: $ + pop: true + + else-pop: + - match: (?=\S) + pop: true + + clause-end-pop: + - match: (?=[.;]) + pop: true + + clause-end-or-stray: + - include: clause-end-pop + - include: illegal-stray + + value-end-pop: + # a `value body` ends with + # - the end of a clause (`;` or `.`) + # - the end of a clause body (`end`, `after`, `catch`) + # - the end of a section (`)`, `]`, `}`) + # - an separator (`,`, `:`) + - match: (?=->|[,:.;)}\]]|(end|after|catch){{ident_break_char}}) + pop: true + +###[ ILLEGALS ]############################################################### + + illegal-group: + # Note: To try to prevent breaking highlighting it is important to keep + # parens/brackets/braces in balance if the opening bracket is not + # expected at its current position and marked illegal. - match: \( - scope: punctuation.section.expression.begin.erlang push: - - meta_scope: meta.expression.parenthesized + - meta_scope: invalid.illegal.unexpected-group.erlang - match: \) - scope: punctuation.section.expression.end.erlang pop: true - - include: everything-else - record-directive: - - match: ^\s*+(-)\s*+(record)\s*+(\()\s*+([a-z][a-zA-Z\d@_]*+)\s*+(,) - captures: - 1: punctuation.section.directive.begin.erlang - 2: keyword.control.directive.import.erlang - 3: punctuation.section.parameters.begin.erlang - 4: entity.name.type.class.record.section.erlang - 5: punctuation.separator.parameters.erlang - push: - - meta_scope: meta.directive.record.erlang - - match: ((\}))\s*+(\))\s*+(\.) - captures: - 1: meta.structure.record.erlang - 2: punctuation.section.class.record.end.erlang - 3: punctuation.section.parameters.end.erlang - 4: punctuation.section.directive.end.erlang + - include: illegal-group-body + - match: \[ + push: + - meta_scope: invalid.illegal.unexpected-list.erlang + - match: \] pop: true - - include: internal-record-body - record-usage: - - match: (#)\s*+([a-z][a-zA-Z\d@_]*+)\s*+(\.)\s*+([a-z][a-zA-Z\d@_]*+) - scope: meta.record-usage.erlang - captures: - 1: keyword.operator.record.erlang - 2: entity.name.type.class.record.erlang - 3: punctuation.separator.record-field.erlang - 4: variable.other.field.erlang - - match: (#)\s*+([a-z][a-zA-Z\d@_]*+) - captures: - 1: keyword.operator.record.erlang - 2: entity.name.type.class.record.erlang + - include: illegal-group-body + - match: \#?\{ push: - - meta_scope: meta.record-usage.erlang + - meta_scope: invalid.illegal.unexpected-tuple.erlang - match: \} - scope: meta.structure.record.erlang punctuation.section.class.record.end.erlang pop: true - - include: internal-record-body - string: - - match: '"' - scope: punctuation.definition.string.begin.erlang + - include: illegal-group-body + + illegal-group-body: + # consume numbers to prevent matching decimal separater as clause-end + - match: \d+\.\d*|\.\d+ + - include: clause-end-pop + - match: \( push: - - meta_scope: string.quoted.double.erlang - - match: '"' - scope: punctuation.definition.string.end.erlang + - match: \) pop: true - - match: (\\)([bdefnrstv\\''"]|(\^)[@-_]|[0-7]{1,3}) - scope: constant.character.escape.erlang - captures: - 1: punctuation.section.escape.erlang - 3: punctuation.section.escape.erlang - - match: \\\^?.? - scope: invalid.illegal.string.erlang - - match: (~)((\-)?\d++|(\*))?((\.)(\d++|(\*)))?((\.)((\*)|.))?[~cfegswpWPBX#bx\+ni] - scope: constant.other.placeholder.erlang - captures: - 1: punctuation.definition.placeholder.erlang - 3: punctuation.separator.placeholder-parts.erlang - 4: punctuation.separator.placeholder-parts.erlang - 6: punctuation.separator.placeholder-parts.erlang - 8: punctuation.separator.placeholder-parts.erlang - 10: punctuation.separator.placeholder-parts.erlang - 12: punctuation.separator.placeholder-parts.erlang - - match: (~)(\*)?(\d++)?[~du\-#fsacl] - scope: constant.other.placeholder.erlang - captures: - 1: punctuation.definition.placeholder.erlang - 2: punctuation.separator.placeholder-parts.erlang - symbolic-operator: - - match: \+\+|\+|--|-|\*|/=|/|=/=|=:=|==|=<|=|<-|<|>=|>|! - scope: keyword.operator.symbolic.erlang - textual-operator: - - match: \b(andalso|band|and|bxor|xor|bor|orelse|or|bnot|not|bsl|bsr|div|rem)\b - scope: keyword.operator.textual.erlang - tuple: - - match: \{ - scope: punctuation.section.tuple.begin.erlang + - include: illegal-group-body + - match: \[ + push: + - match: \] + pop: true + - include: illegal-group-body + - match: \#?\{ push: - - meta_scope: meta.structure.tuple.erlang - match: \} - scope: punctuation.section.tuple.end.erlang pop: true - - match: "," - scope: punctuation.separator.tuple.erlang - - include: everything-else - variable: - - match: (_[a-zA-Z\d@_]++|[A-Z][a-zA-Z\d@_]*+)|(_) - captures: - 1: variable.other.erlang - 2: variable.language.omitted.erlang + - include: illegal-group-body + + illegal-stray: + - match: '[)\]}]' + scope: invalid.illegal.stray.erlang diff --git a/Erlang/HTML (Erlang).sublime-completions b/Erlang/HTML (Erlang).sublime-completions new file mode 100644 index 0000000000..15357f7f8a --- /dev/null +++ b/Erlang/HTML (Erlang).sublime-completions @@ -0,0 +1,6 @@ +{ + "scope": "text.html.erlang - comment - string - source - meta.tag", + "completions": [ + {"trigger": "erl\tTag", "contents": "$0"} + ] +} diff --git a/Erlang/HTML (Erlang).sublime-syntax b/Erlang/HTML (Erlang).sublime-syntax index ac6d94cd4b..062eaf8840 100644 --- a/Erlang/HTML (Erlang).sublime-syntax +++ b/Erlang/HTML (Erlang).sublime-syntax @@ -4,17 +4,47 @@ name: HTML (Erlang) file_extensions: - yaws -scope: text.html.erlang.yaws +scope: text.html.erlang + +variables: + # https://html.spec.whatwg.org/multipage/parsing.html#tag-name-state + break_char: '[\t\n\f /<>]' + contexts: main: - - match: - captures: - 0: punctuation.section.embedded.erlang - push: - - meta_scope: source.erlang.embedded.html - - match: - captures: - 0: punctuation.section.embedded.erlang - pop: true - - include: scope:source.erlang + - include: tag-erlang - include: scope:text.html.basic + +###[ PUBLIC CONTEXT ]######################################################### + + tag-erlang: + # Note: This context can be included in other HTML + # variants to support the Erlang custom tag. + # Use: - import: scope:text.html.erlang#tag-erlang + - match: (<)((?i:erl))(?={{break_char}}) + captures: + 1: punctuation.definition.tag.begin.html + 2: entity.name.tag.erl.html + push: [tag-erlang-body, tag-erlang-attributes] + +###[ PRIVATE CONTEXTS ]####################################################### + + tag-erlang-attributes: + - meta_scope: meta.tag.erl.begin.html + - include: scope:text.html.basic#tag-end + - include: scope:text.html.basic#tag-attributes + + tag-erlang-body: + - match: ( - name - Indentation Rules scope source.erlang settings decreaseIndentPattern - ^\s*\b(end)\b + ^\s*end(?![\w@]) increaseIndentPattern - (\s*%.*)?$)]]> + ` or `of` + (->|(^|[^\w@])of)\s*(%.*)?$ | + # line start or word break without `@` + (^|[^\w@]) + # line contains special keyword ... + (if|case|receive|after|fun|try|catch|begin|query)(?![\w@]) + # ... but no `end` found after it + (?!.*[^\w@]end(?![\w@])) + ))]]> diff --git a/Erlang/Indexed Reference List.tmPreferences b/Erlang/Indexed Reference List.tmPreferences new file mode 100644 index 0000000000..819eec1bef --- /dev/null +++ b/Erlang/Indexed Reference List.tmPreferences @@ -0,0 +1,23 @@ + + + + scope + + source.erlang meta.record.name variable.other.record, + source.erlang meta.function-call.name constant.language.macro, + source.erlang meta.function-call.name constant.other.macro, + source.erlang meta.type-call.name storage.type, + source.erlang meta.type-call.name support.type + + settings + + showInIndexedReferenceList + 1 + symbolIndexTransformation + + s/^[?#'']// + s/'$// + + + + diff --git a/Erlang/Indexed Symbol List.tmPreferences b/Erlang/Indexed Symbol List.tmPreferences new file mode 100644 index 0000000000..35b975373e --- /dev/null +++ b/Erlang/Indexed Symbol List.tmPreferences @@ -0,0 +1,23 @@ + + + + scope + + source.erlang meta.preprocessor.define entity.name.constant.macro, + source.erlang meta.preprocessor.export variable.function, + source.erlang meta.preprocessor.import variable.function, + source.erlang meta.preprocessor.namespace entity.name.namespace, + source.erlang meta.preprocessor.record entity.name.record + + settings + + showInIndexedSymbolList + 1 + symbolIndexTransformation + + s/^[?#'']// + s/'$// + + + + diff --git a/Erlang/Snippets/Behaviour-Directive.sublime-snippet b/Erlang/Snippets/Behaviour-Directive.sublime-snippet index 38479c057a..e4a426b02f 100644 --- a/Erlang/Snippets/Behaviour-Directive.sublime-snippet +++ b/Erlang/Snippets/Behaviour-Directive.sublime-snippet @@ -1,5 +1,5 @@ - + beh source.erlang Behaviour Directive diff --git a/Erlang/Snippets/Define-Directive.sublime-snippet b/Erlang/Snippets/Define-Directive.sublime-snippet index 32af465ae5..f8e61f9098 100644 --- a/Erlang/Snippets/Define-Directive.sublime-snippet +++ b/Erlang/Snippets/Define-Directive.sublime-snippet @@ -1,5 +1,5 @@ - + def source.erlang Define Directive diff --git a/Erlang/Snippets/Export-Directive.sublime-snippet b/Erlang/Snippets/Export-Directive.sublime-snippet index a33b1e5c39..8f13ccda2b 100644 --- a/Erlang/Snippets/Export-Directive.sublime-snippet +++ b/Erlang/Snippets/Export-Directive.sublime-snippet @@ -1,5 +1,5 @@ - + exp source.erlang Export Directive diff --git a/Erlang/Snippets/Ifdef-Directive.sublime-snippet b/Erlang/Snippets/Ifdef-Directive.sublime-snippet index 60f456deee..2426fccb0e 100644 --- a/Erlang/Snippets/Ifdef-Directive.sublime-snippet +++ b/Erlang/Snippets/Ifdef-Directive.sublime-snippet @@ -1,5 +1,5 @@ - + ifdef source.erlang Ifdef Directive diff --git a/Erlang/Snippets/Ifndef-Directive.sublime-snippet b/Erlang/Snippets/Ifndef-Directive.sublime-snippet index 3830b208cd..a438dd2474 100644 --- a/Erlang/Snippets/Ifndef-Directive.sublime-snippet +++ b/Erlang/Snippets/Ifndef-Directive.sublime-snippet @@ -1,5 +1,5 @@ - + ifndef source.erlang Ifndef Directive diff --git a/Erlang/Snippets/Import-Directive.sublime-snippet b/Erlang/Snippets/Import-Directive.sublime-snippet index d85318b97a..03035e29c3 100644 --- a/Erlang/Snippets/Import-Directive.sublime-snippet +++ b/Erlang/Snippets/Import-Directive.sublime-snippet @@ -1,5 +1,5 @@ - + imp source.erlang Import Directive diff --git a/Erlang/Snippets/Include-Directive.sublime-snippet b/Erlang/Snippets/Include-Directive.sublime-snippet index 8cd113884d..b4fbabd261 100644 --- a/Erlang/Snippets/Include-Directive.sublime-snippet +++ b/Erlang/Snippets/Include-Directive.sublime-snippet @@ -1,5 +1,5 @@ - + inc source.erlang Include Directive diff --git a/Erlang/Snippets/Module-Directive.sublime-snippet b/Erlang/Snippets/Module-Directive.sublime-snippet index e1c81f65ff..99f946080f 100644 --- a/Erlang/Snippets/Module-Directive.sublime-snippet +++ b/Erlang/Snippets/Module-Directive.sublime-snippet @@ -1,5 +1,5 @@ - + mod source.erlang Module Directive diff --git a/Erlang/Snippets/Record-Directive.sublime-snippet b/Erlang/Snippets/Record-Directive.sublime-snippet index 0ad1fa3882..0e1b53f747 100644 --- a/Erlang/Snippets/Record-Directive.sublime-snippet +++ b/Erlang/Snippets/Record-Directive.sublime-snippet @@ -1,5 +1,5 @@ - + rec source.erlang Record Directive diff --git a/Erlang/Snippets/Undef-Directive.sublime-snippet b/Erlang/Snippets/Undef-Directive.sublime-snippet index fa2f75e7b2..56955cd4a1 100644 --- a/Erlang/Snippets/Undef-Directive.sublime-snippet +++ b/Erlang/Snippets/Undef-Directive.sublime-snippet @@ -1,5 +1,5 @@ - + undef source.erlang Undef Directive diff --git a/Erlang/Function Symbols.tmPreferences b/Erlang/Symbol List - Exports.tmPreferences similarity index 61% rename from Erlang/Function Symbols.tmPreferences rename to Erlang/Symbol List - Exports.tmPreferences index 12c17aa5b6..84fc4ceaed 100644 --- a/Erlang/Function Symbols.tmPreferences +++ b/Erlang/Symbol List - Exports.tmPreferences @@ -1,16 +1,16 @@ - name - Function Symbols scope - source.erlang entity.name.function.definition + source.erlang meta.preprocessor.export meta.reference.function settings showInSymbolList 1 symbolTransformation - s,$,/, + + s/^/-export / + diff --git a/D/Symbol List-Method-Constructor.tmPreferences b/Erlang/Symbol List - Function Definition.tmPreferences similarity index 57% rename from D/Symbol List-Method-Constructor.tmPreferences rename to Erlang/Symbol List - Function Definition.tmPreferences index 6b0b1bb0df..9aca31d5d1 100644 --- a/D/Symbol List-Method-Constructor.tmPreferences +++ b/Erlang/Symbol List - Function Definition.tmPreferences @@ -1,16 +1,19 @@ - name - Symbol List: Method / Constructor scope - source.d meta.block entity.name + + source.erlang meta.function.name constant.other.macro, + source.erlang meta.function.name entity.name.function + settings showInSymbolList 1 symbolTransformation - s/^\s*([^\)]+)/ $1/; # pad + + s/$/\(\)/ + diff --git a/Erlang/Macro Symbols.tmPreferences b/Erlang/Symbol List - Function Specification.tmPreferences similarity index 61% rename from Erlang/Macro Symbols.tmPreferences rename to Erlang/Symbol List - Function Specification.tmPreferences index 63e63094de..8010a36e95 100644 --- a/Erlang/Macro Symbols.tmPreferences +++ b/Erlang/Symbol List - Function Specification.tmPreferences @@ -1,16 +1,17 @@ - name - Macro Symbols scope - source.erlang entity.name.function.macro.definition + source.erlang meta.preprocessor.spec entity.name.function settings showInSymbolList 1 symbolTransformation - s/^/?/ + + s/^/-spec / + s/$/\(\)/ + diff --git a/Erlang/Record Symbols.tmPreferences b/Erlang/Symbol List - Imports.tmPreferences similarity index 60% rename from Erlang/Record Symbols.tmPreferences rename to Erlang/Symbol List - Imports.tmPreferences index 03e52db5ca..78523ce73a 100644 --- a/Erlang/Record Symbols.tmPreferences +++ b/Erlang/Symbol List - Imports.tmPreferences @@ -1,16 +1,16 @@ - name - Record Symbols scope - source.erlang entity.name.type.class.record.definition + source.erlang meta.preprocessor.import meta.reference.function settings showInSymbolList 1 symbolTransformation - s/^/#/ + + s/^/-import / + diff --git a/Erlang/Module Symbols.tmPreferences b/Erlang/Symbol List - Macro.tmPreferences similarity index 59% rename from Erlang/Module Symbols.tmPreferences rename to Erlang/Symbol List - Macro.tmPreferences index e4087daa98..7454a4a2ec 100644 --- a/Erlang/Module Symbols.tmPreferences +++ b/Erlang/Symbol List - Macro.tmPreferences @@ -1,16 +1,16 @@ - name - Module Symbols scope - source.erlang entity.name.type.class.module.definition.erlang + source.erlang meta.preprocessor.define entity.name.constant settings showInSymbolList 1 symbolTransformation - s/^/-/ + + s/^/-define / + diff --git a/Erlang/Symbol List - Record.tmPreferences b/Erlang/Symbol List - Record.tmPreferences new file mode 100644 index 0000000000..420d3ebc3c --- /dev/null +++ b/Erlang/Symbol List - Record.tmPreferences @@ -0,0 +1,16 @@ + + + + scope + source.erlang meta.preprocessor.record entity.name.record + settings + + showInSymbolList + 1 + symbolTransformation + + s/^/-record / + + + + diff --git a/Erlang/Symbol List - Type.tmPreferences b/Erlang/Symbol List - Type.tmPreferences new file mode 100644 index 0000000000..600266da79 --- /dev/null +++ b/Erlang/Symbol List - Type.tmPreferences @@ -0,0 +1,16 @@ + + + + scope + entity.name.type.erlang + settings + + showInSymbolList + 1 + symbolTransformation + + s/^/-type / + + + + diff --git a/Erlang/syntax_test_erlang.erl b/Erlang/syntax_test_erlang.erl index e71857ae6d..d4908922ce 100644 --- a/Erlang/syntax_test_erlang.erl +++ b/Erlang/syntax_test_erlang.erl @@ -1,72 +1,5304 @@ % SYNTAX TEST "Packages/Erlang/Erlang.sublime-syntax" -% <- comment.line punctuation.definition.comment -% ^ comment.line -% ^^ comment.line +% <- comment.line.percentage.erlang punctuation.definition.comment.percentage.erlang +% ^ comment.line.percentage.erlang +% ^^ comment.line.percentage.erlang -show_name(Mod, Name) -> -% <- meta.function entity.name.function.definition - % ^^ meta.function keyword.operator.symbolic +% Atom tests + +atom_tests() -> . + + foo_Bar7@Baz +% ^^^^^^^^^^^^ constant.other.symbol.erlang + + 'Atom \^d \b \7 \^@ \" \' bar' +% ^ punctuation.definition.atom.begin.erlang +% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +% ^ punctuation.definition.escape.erlang +% ^^^ constant.character.escape.erlang +% ^ punctuation.definition.escape.erlang +% ^^ constant.character.escape.erlang +% ^ punctuation.definition.escape.erlang +% ^^ constant.character.escape.erlang +% ^^^ invalid.illegal.escape.erlang +% ^ punctuation.definition.escape.erlang +% ^^ constant.character.escape.erlang +% ^ punctuation.definition.escape.erlang +% ^^ constant.character.escape.erlang +% ^ punctuation.definition.atom.end.erlang + +% Special atom tests + + true +% ^^^^ constant.language.boolean.erlang + + false +% ^^^^^ constant.language.boolean.erlang + + error +% ^^^^^ constant.language.exception.type.erlang + + exit +% ^^^^ constant.language.exception.type.erlang + + throw +% ^^^^ constant.language.exception.type.erlang + + ok +% ^^ constant.language.exception.type.erlang + + badmatch +% ^^^^^^^^ constant.language.exception.reason.erlang + + none +% ^^^^ constant.language.undefined.erlang + + undefined +% ^^^^^^^^^ constant.language.undefined.erlang + + millisecond +% ^^^^^^^^^^^ constant.language.time.erlang + + milli_seconds +% ^^^^^^^^^^^^^ constant.language.time.erlang invalid.deprecated.erlang + +binary_tests() -> . + +% Bit String tests + + << . +% ^^^ meta.sequence.binary.erlang +% ^^ punctuation.definition.sequence.begin.erlang +% ^ punctuation.terminator.clause.erlang - meta.sequence.binary + + << ; +% ^^^ meta.sequence.binary.erlang +% ^^ punctuation.definition.sequence.begin.erlang +% ^ punctuation.separator.clauses.erlang - meta.sequence.binary + + <> +% ^^^^^^^^^ meta.sequence.binary.erlang +% ^^ punctuation.definition.sequence.begin.erlang +% ^^ constant.numeric.integer.decimal.erlang +% ^ punctuation.separator.sequence.erlang +% ^^ constant.numeric.integer.decimal.erlang +% ^^ punctuation.definition.sequence.end.erlang + + << 10 , 20 >> +% ^^^^^^^^^^^^^ meta.sequence.binary.erlang +% ^^ punctuation.definition.sequence.begin.erlang +% ^^ constant.numeric.integer.decimal.erlang +% ^ punctuation.separator.sequence.erlang +% ^^ constant.numeric.integer.decimal.erlang +% ^^ punctuation.definition.sequence.end.erlang + + <<1:1,0:1>> +% ^^^^^^^^^^^ meta.sequence.binary.erlang +% ^^ punctuation.definition.sequence.begin.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^ punctuation.separator.value-size.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^ punctuation.separator.sequence.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^ punctuation.separator.value-size.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^^ punctuation.definition.sequence.end.erlang + + << 1 : 1 , 0 : 1 >> +% ^^^^^^^^^^^^^^^^^^^ meta.sequence.binary.erlang +% ^^ punctuation.definition.sequence.begin.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^ punctuation.separator.value-size.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^ punctuation.separator.sequence.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^ punctuation.separator.value-size.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^^ punctuation.definition.sequence.end.erlang + + <> +% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.sequence.binary.erlang +% ^^ punctuation.definition.sequence.begin.erlang +% ^ variable.other.erlang +% ^ punctuation.separator.value-size.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^ punctuation.separator.value-type.erlang +% ^^^^^^^^ storage.modifier.signedness.erlang +% ^ punctuation.separator.type-specifiers.erlang +% ^^^^ storage.modifier.unit.erlang +% ^ punctuation.separator.unit-value.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^ punctuation.separator.type-specifiers.erlang +% ^^^^^^^ storage.type.erlang +% ^^ punctuation.definition.sequence.end.erlang + + << A : 8 / unsigned - unit : 1 - integer >> +% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.sequence.binary.erlang +% ^^ punctuation.definition.sequence.begin.erlang +% ^ variable.other.erlang +% ^ punctuation.separator.value-size.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^ punctuation.separator.value-type.erlang +% ^^^^^^^^ storage.modifier.signedness.erlang +% ^ punctuation.separator.type-specifiers.erlang +% ^^^^ storage.modifier.unit.erlang +% ^ punctuation.separator.unit-value.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^ punctuation.separator.type-specifiers.erlang +% ^^^^^^^ storage.type.erlang +% ^^ punctuation.definition.sequence.end.erlang + + << A : ?size / ?sign - ?unit : ?value - ?type >> +% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.sequence.binary.erlang +% ^^ punctuation.definition.sequence.begin.erlang +% ^ variable.other.erlang +% ^ punctuation.separator.value-size.erlang +% ^^^^^ constant.other.macro.erlang +% ^ punctuation.separator.value-type.erlang +% ^^^^^ constant.other.macro.erlang +% ^ punctuation.separator.type-specifiers.erlang +% ^^^^^ constant.other.macro.erlang +% ^ punctuation.separator.unit-value.erlang +% ^^^^^^ constant.other.macro.erlang +% ^ punctuation.separator.type-specifiers.erlang +% ^^^^^ constant.other.macro.erlang +% ^^ punctuation.definition.sequence.end.erlang + + <<$a/utf8,$b/utf8,$c/utf8>> +% ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.sequence.binary.erlang +% ^^ punctuation.definition.sequence.begin.erlang +% ^ punctuation.definition.character.erlang +% ^^ constant.character.erlang +% ^ punctuation.separator.value-type.erlang +% ^^^^ storage.type.erlang +% ^ punctuation.separator.sequence.erlang +% ^ punctuation.definition.character.erlang +% ^^ constant.character.erlang +% ^ punctuation.separator.value-type.erlang +% ^^^^ storage.type.erlang +% ^ punctuation.separator.sequence.erlang +% ^ punctuation.definition.character.erlang +% ^^ constant.character.erlang +% ^ punctuation.separator.value-type.erlang +% ^^^^ storage.type.erlang +% ^^ punctuation.definition.sequence.end.erlang + + <<"ab.c"/utf8>> +% ^^^^^^^^^^^^^^^ meta.sequence.binary.erlang +% ^^ punctuation.definition.sequence.begin.erlang +% ^ punctuation.definition.string.begin.erlang +% ^^^^^^ string.quoted.double.erlang +% ^ punctuation.definition.string.end.erlang +% ^ punctuation.separator.value-type.erlang +% ^^^^ storage.type.erlang +% ^^ punctuation.definition.sequence.end.erlang + +% Bit String Comprehension tests + + << << (X*2) >> || <> <= << 1,2,3 >> >> +% ^ - meta.sequence.binary.erlang +% ^^^ meta.sequence.binary.erlang - meta.sequence.binary.erlang meta.sequence.binary.erlang +% ^^^^^^^^^^^ meta.sequence.binary.erlang meta.sequence.binary.erlang +% ^^^^^ meta.group.erlang +% ^^^^ meta.sequence.binary.erlang - meta.sequence.binary.erlang meta.sequence.binary.erlang +% ^^^^^ meta.sequence.binary.erlang meta.sequence.binary.erlang +% ^^^^ meta.sequence.binary.erlang - meta.sequence.binary.erlang meta.sequence.binary.erlang +% ^^^^^^^^^^^ meta.sequence.binary.erlang meta.sequence.binary.erlang +% ^^^ meta.sequence.binary.erlang - meta.sequence.binary.erlang meta.sequence.binary.erlang +% ^ - meta.sequence.binary.erlang +% ^^ punctuation.definition.sequence.begin.erlang +% ^^ punctuation.definition.sequence.begin.erlang +% ^ punctuation.section.group.begin.erlang +% ^ variable.other.erlang +% ^ keyword.operator.arithmetic.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^ punctuation.section.group.end.erlang +% ^^ punctuation.definition.sequence.end.erlang +% ^^ keyword.operator.comprehension.erlang +% ^^ punctuation.definition.sequence.begin.erlang +% ^ variable.other.erlang +% ^^ punctuation.definition.sequence.end.erlang +% ^^ keyword.operator.generator.erlang +% ^^ punctuation.definition.sequence.begin.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^ punctuation.separator.sequence.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^ punctuation.separator.sequence.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^^ punctuation.definition.sequence.end.erlang +% ^^ punctuation.definition.sequence.end.erlang + +% Character tests + +character_tests() -> . + + $a $% +% ^ punctuation.definition.character.erlang +% ^^ constant.character.erlang +% ^ punctuation.definition.character.erlang +% ^^ constant.character.erlang - comment + + $\1 +% ^ constant.character.erlang punctuation.definition.character.erlang +% ^ punctuation.definition.escape.erlang +% ^^ constant.character.escape.erlang - constant.character.erlang + + $\8 +% ^ constant.character.erlang punctuation.definition.character.erlang +% ^^ constant.character.escape.erlang invalid.illegal.escape.erlang + + $\57 +% ^ constant.character.erlang punctuation.definition.character.erlang +% ^ punctuation.definition.escape.erlang +% ^^^ constant.character.escape.erlang - constant.character.erlang + + $\58 +% ^ constant.character.erlang punctuation.definition.character.erlang +% ^ punctuation.definition.escape.erlang +% ^^ constant.character.escape.erlang - constant.character.erlang +% ^ constant.numeric.integer.decimal.erlang + + $\85 +% ^ constant.character.erlang punctuation.definition.character.erlang +% ^^ constant.character.escape.erlang invalid.illegal.escape.erlang +% ^ constant.numeric.integer.decimal.erlang + + $\127 +% ^ constant.character.erlang punctuation.definition.character.erlang +% ^ punctuation.definition.escape.erlang +% ^^^^ constant.character.escape.erlang - constant.character.erlang + + $\xaf +% ^ constant.character.erlang punctuation.definition.character.erlang +% ^^ punctuation.definition.escape.erlang +% ^^^^ constant.character.escape.erlang + + $\x9a +% ^ constant.character.erlang punctuation.definition.character.erlang +% ^^ punctuation.definition.escape.erlang +% ^^^^ constant.character.escape.erlang + + $\xbf123 +% ^ constant.character.erlang punctuation.definition.character.erlang +% ^^ punctuation.definition.escape.erlang +% ^^^^ constant.character.escape.erlang +% ^^^ constant.numeric.integer.decimal.erlang + + $\xbz123 +% ^ constant.character.erlang punctuation.definition.character.erlang +% ^^ punctuation.definition.escape.erlang +% ^^^^ constant.character.escape.erlang invalid.illegal.escape.erlang +% ^^^ constant.numeric.integer.decimal.erlang + + $\x{9ab1} +% ^ constant.character.erlang punctuation.definition.character.erlang +% ^^^^^^^^ constant.character.escape.erlang +% ^^^ punctuation.definition.escape.begin.erlang +% ^ punctuation.definition.escape.end.erlang + + $\x{9az1} +% ^ constant.character.erlang punctuation.definition.character.erlang +% ^^^^^^^^ constant.character.escape.erlang +% ^^^ punctuation.definition.escape.begin.erlang +% ^ invalid.illegal.hex.erlang +% ^ punctuation.definition.escape.end.erlang + + $\x{1%0} +% ^^^^ comment.line.percentage.erlang + + $\x{1. +% ^ constant.character.erlang punctuation.definition.character.erlang +% ^^^^ constant.character.escape.erlang +% ^ punctuation.terminator.clause.erlang - constant + $\x{1 +% ^ constant.character.erlang punctuation.definition.character.erlang +% ^^^^ constant.character.escape.erlang +% - constant + } +% ^ invalid.illegal.stray.erlang + + $\a +% ^ constant.character.erlang punctuation.definition.character.erlang +% ^ punctuation.definition.escape.erlang +% ^^ constant.character.escape.erlang invalid.illegal.escape.erlang + + $\b $\d $\e $\f $\n $\r $\s $\t $\v $\\ $\' $\" $\$ +% ^ constant.character.erlang punctuation.definition.character.erlang +% ^ punctuation.definition.escape.erlang +% ^^ constant.character.escape.erlang - constant.character.erlang +% ^ constant.character.erlang punctuation.definition.character.erlang +% ^ punctuation.definition.escape.erlang +% ^^ constant.character.escape.erlang - constant.character.erlang +% ^ constant.character.erlang punctuation.definition.character.erlang +% ^ punctuation.definition.escape.erlang +% ^^ constant.character.escape.erlang - constant.character.erlang +% ^ constant.character.erlang punctuation.definition.character.erlang +% ^ punctuation.definition.escape.erlang +% ^^ constant.character.escape.erlang - constant.character.erlang +% ^ constant.character.erlang punctuation.definition.character.erlang +% ^ punctuation.definition.escape.erlang +% ^^ constant.character.escape.erlang - constant.character.erlang +% ^ constant.character.erlang punctuation.definition.character.erlang +% ^ punctuation.definition.escape.erlang +% ^^ constant.character.escape.erlang - constant.character.erlang +% ^ constant.character.erlang punctuation.definition.character.erlang +% ^ punctuation.definition.escape.erlang +% ^^ constant.character.escape.erlang - constant.character.erlang +% ^ constant.character.erlang punctuation.definition.character.erlang +% ^ punctuation.definition.escape.erlang +% ^^ constant.character.escape.erlang - constant.character.erlang +% ^ constant.character.erlang punctuation.definition.character.erlang +% ^ punctuation.definition.escape.erlang +% ^^ constant.character.escape.erlang - constant.character.erlang +% ^ constant.character.erlang punctuation.definition.character.erlang +% ^ punctuation.definition.escape.erlang +% ^^ constant.character.escape.erlang - constant.character.erlang +% ^ constant.character.erlang punctuation.definition.character.erlang +% ^ punctuation.definition.escape.erlang +% ^^ constant.character.escape.erlang - constant.character.erlang +% ^ constant.character.erlang punctuation.definition.character.erlang +% ^ punctuation.definition.escape.erlang +% ^^ constant.character.escape.erlang - constant.character.erlang +% ^ constant.character.erlang punctuation.definition.character.erlang +% ^ punctuation.definition.escape.erlang +% ^^ constant.character.escape.erlang - constant.character.erlang + + $\^A $\^Z $\^a $\^z $\^5 +% ^ constant.character.erlang punctuation.definition.character.erlang +% ^^ punctuation.definition.escape.erlang +% ^^^ constant.character.escape.erlang - constant.character.erlang +% ^ constant.character.erlang punctuation.definition.character.erlang +% ^^ punctuation.definition.escape.erlang +% ^^^ constant.character.escape.erlang - constant.character.erlang +% ^ constant.character.erlang punctuation.definition.character.erlang +% ^^ punctuation.definition.escape.erlang +% ^^^ constant.character.escape.erlang - constant.character.erlang +% ^ constant.character.erlang punctuation.definition.character.erlang +% ^^ punctuation.definition.escape.erlang +% ^ constant.character.erlang punctuation.definition.character.erlang +% ^^ punctuation.definition.escape.erlang +% ^^^ constant.character.escape.erlang invalid.illegal.escape.erlang - constant.character.erlang + +% List tests + +list_tests() -> . + + [] +% ^ - meta.sequence +% ^ meta.sequence.list.erlang punctuation.section.sequence.begin.erlang +% ^ meta.sequence.list.erlang punctuation.section.sequence.end.erlang +% ^ - meta.sequence + + [c|[]] +% ^ - meta.sequence +% ^^^ meta.sequence.list.erlang - meta.sequence.list.erlang meta.sequence.list.erlang +% ^^ meta.sequence.list.erlang meta.sequence.list.erlang +% ^ meta.sequence.list.erlang - meta.sequence.list.erlang meta.sequence.list.erlang +% ^ - meta.sequence +% ^ punctuation.section.sequence.begin.erlang +% ^ constant.other.symbol.erlang +% ^ punctuation.separator.sequence.erlang +% ^ punctuation.section.sequence.begin.erlang +% ^^ punctuation.section.sequence.end.erlang + + [b|[c|[]]] +% ^ - meta.sequence +% ^^^ meta.sequence.list.erlang - meta.sequence.list.erlang meta.sequence.list.erlang +% ^^^ meta.sequence.list.erlang meta.sequence.list.erlang - meta.sequence.list.erlang meta.sequence.list.erlang meta.sequence.list.erlang +% ^^ meta.sequence.list.erlang meta.sequence.list.erlang meta.sequence.list.erlang +% ^ meta.sequence.list.erlang meta.sequence.list.erlang - meta.sequence.list.erlang meta.sequence.list.erlang meta.sequence.list.erlang +% ^ meta.sequence.list.erlang - meta.sequence.list.erlang meta.sequence.list.erlang +% ^ - meta.sequence +% ^ punctuation.section.sequence.begin.erlang +% ^ constant.other.symbol.erlang +% ^ punctuation.separator.sequence.erlang +% ^ punctuation.section.sequence.begin.erlang +% ^ constant.other.symbol.erlang +% ^ punctuation.separator.sequence.erlang +% ^ punctuation.section.sequence.begin.erlang +% ^^^ punctuation.section.sequence.end.erlang + + [a,b,c] +% ^ - meta.sequence +% ^^^^^^^ meta.sequence.list.erlang +% ^ - meta.sequence +% ^ punctuation.section.sequence.begin.erlang +% ^ constant.other.symbol.erlang +% ^ punctuation.separator.sequence.erlang +% ^ constant.other.symbol.erlang +% ^ punctuation.separator.sequence.erlang +% ^ constant.other.symbol.erlang +% ^ punctuation.section.sequence.end.erlang + +% List Comprehension tests + + [X*2 || X <- [1,2,3]] +% ^ - meta.sequence +% ^^^^^^^^^^^^^ meta.sequence.list.erlang - meta.sequence.list.erlang meta.sequence.list.erlang +% ^^^^^^^ meta.sequence.list.erlang meta.sequence.list.erlang +% ^ meta.sequence.list.erlang - meta.sequence.list.erlang meta.sequence.list.erlang +% ^ - meta.sequence +% ^ punctuation.section.sequence.begin.erlang +% ^ variable.other.erlang +% ^ keyword.operator.arithmetic.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^^ keyword.operator.comprehension.erlang +% ^ variable.other.erlang +% ^^ keyword.operator.generator.erlang +% ^ punctuation.section.sequence.begin.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^ punctuation.separator.sequence.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^ punctuation.separator.sequence.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^^ punctuation.section.sequence.end.erlang + + [2 || true] +% ^ - meta.sequence +% ^^^^^^^^^^^ meta.sequence.list.erlang +% ^ - meta.sequence +% ^ punctuation.section.sequence.begin.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^^ keyword.operator.comprehension.erlang +% ^^^^ constant.language.boolean.erlang +% ^ punctuation.section.sequence.end.erlang + + [2 || is_integer(2)] +% ^ - meta.sequence +% ^^^^^^^^^^^^^^^^^^^^ meta.sequence.list.erlang +% ^^^^^^^^^^ meta.function-call.name.erlang - meta.function-call.arguments.erlang +% ^^^ meta.function-call.arguments.erlang - meta.function-call.name.erlang +% ^ - meta.sequence +% ^ punctuation.section.sequence.begin.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^^ keyword.operator.comprehension.erlang +% ^ punctuation.section.sequence.end.erlang + +% Map tests + +map_tests() -> . + + #{} +% ^ - meta.mapping +% ^^^ meta.mapping.erlang +% ^^ punctuation.section.mapping.begin.erlang +% ^ punctuation.section.mapping.end.erlang +% ^ - meta.mapping + + #{ key1 , key2 , => val } +% ^ - meta.mapping +% ^^ meta.mapping.erlang - meta.mapping.key.erlang - meta.mapping.value.erlang +% ^^^^^^ meta.mapping.key.erlang - meta.mapping.value.erlang - meta.mapping.erlang +% ^ meta.mapping.erlang - meta.mapping.key.erlang - meta.mapping.value.erlang +% ^^^^^^ meta.mapping.key.erlang - meta.mapping.value.erlang - meta.mapping.erlang +% ^ meta.mapping.erlang - meta.mapping.key.erlang - meta.mapping.value.erlang +% ^ meta.mapping.key.erlang - meta.mapping.value.erlang - meta.mapping.erlang +% ^^ meta.mapping.erlang - meta.mapping.key.erlang - meta.mapping.value.erlang +% ^^^^^ meta.mapping.value.erlang - meta.mapping.key.erlang - meta.mapping.erlang +% ^ meta.mapping.erlang - meta.mapping.key.erlang - meta.mapping.value.erlang +% ^ - meta.mapping +% ^^ punctuation.section.mapping.begin.erlang +% ^ punctuation.separator.mapping.pair.erlang +% ^ punctuation.separator.mapping.pair.erlang +% ^ punctuation.section.mapping.end.erlang + + Expr#{name=>"adam",{age,24}:=fct(),4.0=>{july,29},kay:=value} +% ^ - meta.mapping +% ^^ meta.mapping.erlang - meta.mapping.key.erlang - meta.mapping.value.erlang +% ^^^^ meta.mapping.key.erlang - meta.mapping.value.erlang - meta.mapping.erlang +% ^^ meta.mapping.erlang - meta.mapping.key.erlang - meta.mapping.value.erlang +% ^^^^^^ meta.mapping.value.erlang - meta.mapping.key.erlang - meta.mapping.erlang +% ^ meta.mapping.erlang - meta.mapping.key.erlang - meta.mapping.value.erlang +% ^^^^^^^^ meta.mapping.key.erlang - meta.mapping.value.erlang - meta.mapping.erlang meta.sequence.tuple.erlang +% ^^ meta.mapping.erlang - meta.mapping.key.erlang - meta.mapping.value.erlang +% ^^^^^ meta.mapping.value.erlang - meta.mapping.key.erlang - meta.mapping.erlang meta.function-call.name.erlang +% ^ meta.mapping.erlang - meta.mapping.key.erlang - meta.mapping.value.erlang +% ^^^ meta.mapping.key.erlang - meta.mapping.value.erlang - meta.mapping.erlang +% ^^ meta.mapping.erlang - meta.mapping.key.erlang - meta.mapping.value.erlang +% ^^^^^^^^^ meta.mapping.value.erlang - meta.mapping.key.erlang - meta.mapping.erlang meta.sequence.tuple.erlang +% ^ meta.mapping.erlang - meta.mapping.key.erlang - meta.mapping.value.erlang +% ^^^ meta.mapping.key.erlang meta.atom.erlang +% ^^ meta.mapping.erlang +% ^^^^^ meta.mapping.value.erlang meta.atom.erlang +% ^ meta.mapping.erlang - meta.atom +% ^ - meta.mapping +% ^^^^ variable.other.erlang +% ^^ punctuation.section.mapping.begin.erlang +% ^^^^ constant.other.symbol.erlang +% ^^ punctuation.separator.mapping.key-value.erlang +% ^^^^^^ string.quoted.double.erlang +% ^ punctuation.separator.mapping.pair.erlang +% ^ punctuation.section.sequence.begin.erlang +% ^^^ constant.other.symbol.erlang +% ^ punctuation.separator.sequence.erlang +% ^^ constant.numeric.integer.decimal.erlang +% ^ punctuation.section.sequence.end.erlang +% ^^ punctuation.separator.mapping.key-value.erlang +% ^^^ variable.function.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.separator.mapping.pair.erlang +% ^^^ constant.numeric.float.decimal.erlang +% ^^ punctuation.separator.mapping.key-value.erlang +% ^ punctuation.section.sequence.begin.erlang +% ^^^^ constant.other.symbol.erlang +% ^ punctuation.separator.sequence.erlang +% ^^ constant.numeric.integer.decimal.erlang +% ^ punctuation.section.sequence.end.erlang +% ^ punctuation.separator.mapping.pair.erlang +% ^^^ constant.other.symbol.erlang +% ^^ punctuation.separator.mapping.key-value.erlang +% ^^^^^ constant.other.symbol.erlang +% ^ punctuation.section.mapping.end.erlang +% + + #{ name => "adam" , { age , 24 } => fct () , 4.0 := { july , 29 } } +% ^ - meta.mapping +% ^^ meta.mapping.erlang - meta.mapping.key.erlang - meta.mapping.value.erlang +% ^^^^^^ meta.mapping.key.erlang - meta.mapping.value.erlang - meta.mapping.erlang +% ^^ meta.mapping.erlang - meta.mapping.key.erlang - meta.mapping.value.erlang +% ^^^^^^^^ meta.mapping.value.erlang - meta.mapping.key.erlang - meta.mapping.erlang +% ^ meta.mapping.erlang - meta.mapping.key.erlang - meta.mapping.value.erlang +% ^^^^^^^^^^^^^^ meta.mapping.key.erlang - meta.mapping.value.erlang - meta.mapping.erlang meta.sequence.tuple.erlang +% ^^ meta.mapping.erlang - meta.mapping.key.erlang - meta.mapping.value.erlang +% ^^^^^^^^ meta.mapping.value.erlang - meta.mapping.key.erlang - meta.mapping.erlang meta.function-call.name.erlang +% ^ meta.mapping.erlang - meta.mapping.key.erlang - meta.mapping.value.erlang +% ^^^^^ meta.mapping.key.erlang - meta.mapping.value.erlang - meta.mapping.erlang +% ^^ meta.mapping.erlang - meta.mapping.key.erlang - meta.mapping.value.erlang +% ^^^^^^^^^^^^^^^ meta.mapping.value.erlang - meta.mapping.key.erlang - meta.mapping.erlang meta.sequence.tuple.erlang +% ^ meta.mapping.erlang - meta.mapping.key.erlang - meta.mapping.value.erlang +% ^ - meta.mapping +% ^^ punctuation.section.mapping.begin.erlang +% ^^^^ constant.other.symbol.erlang +% ^^ punctuation.separator.mapping.key-value.erlang +% ^^^^^^ string.quoted.double.erlang +% ^ punctuation.separator.mapping.pair.erlang +% ^ punctuation.section.sequence.begin.erlang +% ^^^ constant.other.symbol.erlang +% ^ punctuation.separator.sequence.erlang +% ^^ constant.numeric.integer.decimal.erlang +% ^ punctuation.section.sequence.end.erlang +% ^^ punctuation.separator.mapping.key-value.erlang +% ^^^ variable.function.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.separator.mapping.pair.erlang +% ^^^ constant.numeric.float.decimal.erlang +% ^^ punctuation.separator.mapping.key-value.erlang +% ^ punctuation.section.sequence.begin.erlang +% ^^^^ constant.other.symbol.erlang +% ^ punctuation.separator.sequence.erlang +% ^^ constant.numeric.integer.decimal.erlang +% ^ punctuation.section.sequence.end.erlang +% ^ punctuation.section.mapping.end.erlang + + #{ +% ^ - meta.mapping.erlang +% ^^ meta.mapping.erlang - meta.mapping.key.erlang - meta.mapping.value.erlang +% ^ meta.mapping.key.erlang - meta.mapping.value.erlang - meta.mapping.erlang +% ^^ punctuation.section.mapping.begin.erlang + name +% ^^^^^^ meta.mapping.key.erlang - meta.mapping.value.erlang - meta.mapping.erlang +% ^^^^ constant.other.symbol.erlang + => +% ^ meta.mapping.key.erlang - meta.mapping.value.erlang - meta.mapping.erlang +% ^^ meta.mapping.erlang - meta.mapping.key.erlang - meta.mapping.value.erlang +% ^ meta.mapping.value.erlang - meta.mapping.key.erlang - meta.mapping.erlang +% ^^ punctuation.separator.mapping.key-value.erlang + "adam" +% ^^^^^^^^ meta.mapping.value.erlang - meta.mapping.key.erlang - meta.mapping.erlang +% ^^^^^^ string.quoted.double.erlang + , +% ^ meta.mapping.value.erlang - meta.mapping.key.erlang - meta.mapping.erlang +% ^ meta.mapping.erlang - meta.mapping.key.erlang - meta.mapping.value.erlang +% ^ meta.mapping.key.erlang - meta.mapping.value.erlang - meta.mapping.erlang +% ^ punctuation.separator.mapping.pair.erlang + { +% ^^^ meta.mapping.key.erlang - meta.mapping.value.erlang - meta.mapping.erlang +% ^ punctuation.section.sequence.begin.erlang + age +% ^^^^^ meta.mapping.key.erlang - meta.mapping.value.erlang - meta.mapping.erlang +% ^^^ constant.other.symbol.erlang + , +% ^^^ meta.mapping.key.erlang - meta.mapping.value.erlang - meta.mapping.erlang +% ^ punctuation.separator.sequence.erlang + 24 +% ^^^^ meta.mapping.key.erlang - meta.mapping.value.erlang - meta.mapping.erlang +% ^^ constant.numeric.integer.decimal.erlang + } +% ^^^ meta.mapping.key.erlang - meta.mapping.value.erlang - meta.mapping.erlang +% ^ punctuation.section.sequence.end.erlang + => +% ^ meta.mapping.key.erlang - meta.mapping.value.erlang - meta.mapping.erlang +% ^^ meta.mapping.erlang - meta.mapping.key.erlang - meta.mapping.value.erlang +% ^ meta.mapping.value.erlang - meta.mapping.key.erlang - meta.mapping.erlang +% ^^ punctuation.separator.mapping.key-value.erlang + fct () +% ^^^^^^^^ meta.mapping.value.erlang - meta.mapping.key.erlang - meta.mapping.erlang +% ^^^ variable.function.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang + , +% ^ meta.mapping.value.erlang - meta.mapping.key.erlang - meta.mapping.erlang +% ^ meta.mapping.erlang - meta.mapping.key.erlang - meta.mapping.value.erlang +% ^ meta.mapping.key.erlang - meta.mapping.value.erlang - meta.mapping.erlang +% ^ punctuation.separator.mapping.pair.erlang + 4.0 +% ^^^^^ meta.mapping.key.erlang - meta.mapping.value.erlang - meta.mapping.erlang +% ^^^ constant.numeric.float.decimal.erlang + := +% ^ meta.mapping.key.erlang - meta.mapping.value.erlang - meta.mapping.erlang +% ^^ meta.mapping.erlang - meta.mapping.key.erlang - meta.mapping.value.erlang +% ^ meta.mapping.value.erlang - meta.mapping.key.erlang - meta.mapping.erlang +% ^^ punctuation.separator.mapping.key-value.erlang + { +% ^^^ meta.mapping.value.erlang - meta.mapping.key.erlang - meta.mapping.erlang +% ^ punctuation.section.sequence.begin.erlang + july +% ^^^^^^ meta.mapping.value.erlang - meta.mapping.key.erlang - meta.mapping.erlang +% ^^^^ constant.other.symbol.erlang + , +% ^^^ meta.mapping.value.erlang - meta.mapping.key.erlang - meta.mapping.erlang +% ^ punctuation.separator.sequence.erlang + 29 +% ^^^^ meta.mapping.value.erlang - meta.mapping.key.erlang - meta.mapping.erlang +% ^^ constant.numeric.integer.decimal.erlang + } +% ^^^ meta.mapping.value.erlang - meta.mapping.key.erlang - meta.mapping.erlang +% ^ punctuation.section.sequence.end.erlang + } +% ^ meta.mapping.value.erlang - meta.mapping.key.erlang - meta.mapping.erlang +% ^ meta.mapping.erlang - meta.mapping.key.erlang - meta.mapping.value.erlang +% ^ - meta.mapping +% ^ punctuation.section.mapping.end.erlang + +% Number tests + +numbers_test() -> . + + 2 +% ^ constant.numeric.integer.decimal.erlang + + 45a +% ^^^ invalid.illegal.integer.erlang + + 2.3 +% ^^^ constant.numeric.float.decimal.erlang +% ^ punctuation.separator.decimal.erlang + + 2.3e3 +% ^^^^^ constant.numeric.float.decimal.erlang +% ^ punctuation.separator.decimal.erlang + + 2.3e+3 +% ^^^^^^ constant.numeric.float.decimal.erlang +% ^ punctuation.separator.decimal.erlang + + 2.3e-3 +% ^^^^^^ constant.numeric.float.decimal.erlang +% ^ punctuation.separator.decimal.erlang + + 1#0 +% ^^^ invalid.illegal.integer.erlang +% ^^ punctuation.definition.numeric.base.erlang + + 2#01 2#012 +% ^^^^ constant.numeric.integer.binary.erlang +% ^^ punctuation.definition.numeric.base.erlang +% ^^^^^ invalid.illegal.integer.erlang +% ^^ punctuation.definition.numeric.base.erlang + + 3#012 3#123 +% ^^^^^ constant.numeric.integer.other.erlang +% ^^ punctuation.definition.numeric.base.erlang +% ^^^^^ invalid.illegal.integer.erlang +% ^^ punctuation.definition.numeric.base.erlang + + 4#0123 4#1234 +% ^^^^^^ constant.numeric.integer.other.erlang +% ^^ punctuation.definition.numeric.base.erlang +% ^^^^^^ invalid.illegal.integer.erlang +% ^^ punctuation.definition.numeric.base.erlang + + 8#0723 8#1834 +% ^^^^^^ constant.numeric.integer.octal.erlang +% ^^ punctuation.definition.numeric.base.erlang +% ^^^^^^ invalid.illegal.integer.erlang +% ^^ punctuation.definition.numeric.base.erlang + + 10#0943 10#183A +% ^^^^^^^ constant.numeric.integer.decimal.erlang +% ^^^ punctuation.definition.numeric.base.erlang +% ^^^^^^ invalid.illegal.integer.erlang +% ^^^ punctuation.definition.numeric.base.erlang + + 16#0F2B 16#F8G4 +% ^^^^^^^ constant.numeric.integer.hexadecimal.erlang +% ^^^ punctuation.definition.numeric.base.erlang +% ^^^^^^^ invalid.illegal.integer.erlang +% ^^^ punctuation.definition.numeric.base.erlang + + 35#0Y2B 35#F8Z4 +% ^^^^^^^ constant.numeric.integer.other.erlang +% ^^^ punctuation.definition.numeric.base.erlang +% ^^^^^^^ invalid.illegal.integer.erlang +% ^^^ punctuation.definition.numeric.base.erlang + + 37#ABC +% ^^^^^^ invalid.illegal.integer.erlang +% ^^^ punctuation.definition.numeric.base.erlang + +% String tests + +strings_test() -> . + + "foo \^A \^Z \^a \^z \^5 \'bar\' \x{9az1} baz\" \$" +% ^ - string +% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double.erlang +% ^ punctuation.definition.string.begin.erlang +% ^^ punctuation.definition.escape.erlang +% ^^^ constant.character.escape.erlang - constant.character.erlang +% ^^ punctuation.definition.escape.erlang +% ^^^ constant.character.escape.erlang - constant.character.erlang +% ^^ punctuation.definition.escape.erlang +% ^^^ constant.character.escape.erlang - constant.character.erlang +% ^^ punctuation.definition.escape.erlang +% ^^ punctuation.definition.escape.erlang +% ^^^ constant.character.escape.erlang invalid.illegal.escape.erlang - constant.character.erlang +% ^ punctuation.definition.escape.erlang +% ^^ constant.character.escape.erlang +% ^ punctuation.definition.escape.erlang +% ^^ constant.character.escape.erlang +% ^^^^^^^^ constant.character.escape.erlang +% ^^^ punctuation.definition.escape.begin.erlang +% ^ invalid.illegal.hex.erlang +% ^ punctuation.definition.escape.end.erlang +% ^ punctuation.definition.escape.erlang +% ^^ constant.character.escape.erlang +% ^ punctuation.definition.escape.erlang +% ^^ constant.character.escape.erlang +% ^ punctuation.definition.string.end.erlang +% ^ - string + + "out: ~8f" +% ^ - string +% ^ punctuation.definition.string.begin.erlang +% ^^^^^^ string.quoted.double.erlang - constant.other.placeholder +% ^ string.quoted.double.erlang constant.other.placeholder.erlang punctuation.definition.placeholder.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.width.integer.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.control.character.erlang +% ^ string.quoted.double.erlang punctuation.definition.string.end.erlang - constant.other.placeholder +% ^ - string + + "out: ~.8f" +% ^ - string +% ^ punctuation.definition.string.begin.erlang +% ^^^^^^ string.quoted.double.erlang - constant.other.placeholder +% ^ string.quoted.double.erlang constant.other.placeholder.erlang punctuation.definition.placeholder.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.precision.erlang punctuation.separator.placeholder.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.precision.integer.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.control.character.erlang +% ^ string.quoted.double.erlang punctuation.definition.string.end.erlang - constant.other.placeholder +% ^ - string + + "out: ~..#f" +% ^ - string +% ^ punctuation.definition.string.begin.erlang +% ^^^^^^ string.quoted.double.erlang - constant.other.placeholder +% ^ string.quoted.double.erlang constant.other.placeholder.erlang punctuation.definition.placeholder.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.precision.erlang punctuation.separator.placeholder.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.separator.erlang punctuation.separator.placeholder.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.padding.character.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.control.character.erlang +% ^ string.quoted.double.erlang punctuation.definition.string.end.erlang - constant.other.placeholder +% ^ - string + + "out: ~*.*.0f" +% ^ - string +% ^ punctuation.definition.string.begin.erlang +% ^^^^^^ string.quoted.double.erlang - constant.other.placeholder +% ^ string.quoted.double.erlang constant.other.placeholder.erlang punctuation.definition.placeholder.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.width.asterisk.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.precision.erlang punctuation.separator.placeholder.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.precision.asterisk.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.separator.erlang punctuation.separator.placeholder.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.padding.character.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.control.character.erlang +% ^ string.quoted.double.erlang punctuation.definition.string.end.erlang - constant.other.placeholder +% ^ - string + + "out: ~-*.*.*f" +% ^ - string +% ^ punctuation.definition.string.begin.erlang +% ^^^^^^ string.quoted.double.erlang - constant.other.placeholder +% ^ string.quoted.double.erlang constant.other.placeholder.erlang punctuation.definition.placeholder.erlang +% ^^ string.quoted.double.erlang constant.other.placeholder.width.asterisk.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.precision.erlang punctuation.separator.placeholder.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.precision.asterisk.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.separator.erlang punctuation.separator.placeholder.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.padding.character.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.control.character.erlang +% ^ string.quoted.double.erlang punctuation.definition.string.end.erlang - constant.other.placeholder +% ^ - string + + "out: ~8.12.ff" +% ^ - string +% ^ punctuation.definition.string.begin.erlang +% ^^^^^^ string.quoted.double.erlang - constant.other.placeholder +% ^ string.quoted.double.erlang constant.other.placeholder.erlang punctuation.definition.placeholder.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.width.integer.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.precision.erlang punctuation.separator.placeholder.erlang +% ^^ string.quoted.double.erlang constant.other.placeholder.precision.integer.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.separator.erlang punctuation.separator.placeholder.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.padding.character.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.control.character.erlang +% ^ string.quoted.double.erlang punctuation.definition.string.end.erlang - constant.other.placeholder +% ^ - string + + "out: ~p ~tp ~lp ~tlp ~ltp ~15p ~15lp ~15tp ~15tlp ~15ltp" +% ^ - string +% ^ punctuation.definition.string.begin.erlang +% ^^^^^^ string.quoted.double.erlang - constant.other.placeholder +% ^ string.quoted.double.erlang constant.other.placeholder.erlang punctuation.definition.placeholder.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.control.character.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.erlang punctuation.definition.placeholder.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.control.modifier.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.control.character.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.erlang punctuation.definition.placeholder.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.control.modifier.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.control.character.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.erlang punctuation.definition.placeholder.erlang +% ^^ string.quoted.double.erlang constant.other.placeholder.control.modifier.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.control.character.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.erlang punctuation.definition.placeholder.erlang +% ^^ string.quoted.double.erlang constant.other.placeholder.control.modifier.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.control.character.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.erlang punctuation.definition.placeholder.erlang +% ^^ string.quoted.double.erlang constant.other.placeholder.width.integer.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.control.character.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.erlang punctuation.definition.placeholder.erlang +% ^^ string.quoted.double.erlang constant.other.placeholder.width.integer.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.control.modifier.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.control.character.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.erlang punctuation.definition.placeholder.erlang +% ^^ string.quoted.double.erlang constant.other.placeholder.width.integer.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.control.modifier.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.control.character.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.erlang punctuation.definition.placeholder.erlang +% ^^ string.quoted.double.erlang constant.other.placeholder.width.integer.erlang +% ^^ string.quoted.double.erlang constant.other.placeholder.control.modifier.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.control.character.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.erlang punctuation.definition.placeholder.erlang +% ^^ string.quoted.double.erlang constant.other.placeholder.width.integer.erlang +% ^^ string.quoted.double.erlang constant.other.placeholder.control.modifier.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.control.character.erlang +% ^ string.quoted.double.erlang punctuation.definition.string.end.erlang - constant.other.placeholder +% ^ - string + + "out: ~B ~.16B ~4.16B ~4.16.#B ~# ~.10# ~+ ~.10+ ~X ~.16X ~-5.16X ~-5.16. X" +% ^ - string +% ^ punctuation.definition.string.begin.erlang +% ^^^^^^ string.quoted.double.erlang - constant.other.placeholder +% ^ string.quoted.double.erlang constant.other.placeholder.erlang punctuation.definition.placeholder.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.control.character.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.erlang punctuation.definition.placeholder.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.precision.erlang punctuation.separator.placeholder.erlang +% ^^ string.quoted.double.erlang constant.other.placeholder.precision.integer.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.control.character.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.erlang punctuation.definition.placeholder.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.width.integer.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.precision.erlang punctuation.separator.placeholder.erlang +% ^^ string.quoted.double.erlang constant.other.placeholder.precision.integer.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.control.character.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.erlang punctuation.definition.placeholder.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.width.integer.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.precision.erlang punctuation.separator.placeholder.erlang +% ^^ string.quoted.double.erlang constant.other.placeholder.precision.integer.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.separator.erlang punctuation.separator.placeholder.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.padding.character.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.control.character.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.erlang punctuation.definition.placeholder.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.control.character.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.erlang punctuation.definition.placeholder.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.precision.erlang punctuation.separator.placeholder.erlang +% ^^ string.quoted.double.erlang constant.other.placeholder.precision.integer.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.control.character.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.erlang punctuation.definition.placeholder.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.control.character.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.erlang punctuation.definition.placeholder.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.precision.erlang punctuation.separator.placeholder.erlang +% ^^ string.quoted.double.erlang constant.other.placeholder.precision.integer.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.control.character.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.erlang punctuation.definition.placeholder.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.control.character.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.erlang punctuation.definition.placeholder.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.precision.erlang punctuation.separator.placeholder.erlang +% ^^ string.quoted.double.erlang constant.other.placeholder.precision.integer.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.control.character.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.erlang punctuation.definition.placeholder.erlang +% ^^ string.quoted.double.erlang constant.other.placeholder.width.integer.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.precision.erlang punctuation.separator.placeholder.erlang +% ^^ string.quoted.double.erlang constant.other.placeholder.precision.integer.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.control.character.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.erlang punctuation.definition.placeholder.erlang +% ^^ string.quoted.double.erlang constant.other.placeholder.width.integer.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.precision.erlang punctuation.separator.placeholder.erlang +% ^^ string.quoted.double.erlang constant.other.placeholder.precision.integer.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.separator.erlang punctuation.separator.placeholder.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.padding.character.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.control.character.erlang +% ^ string.quoted.double.erlang punctuation.definition.string.end.erlang - constant.other.placeholder +% ^ - string + +% Tuple tests + +tuple_tests() -> . + + {} +% ^ - meta.sequence.tuple.erlang +% ^ meta.sequence.tuple.erlang punctuation.section.sequence.begin.erlang +% ^ meta.sequence.tuple.erlang punctuation.section.sequence.end.erlang +% ^ - meta.sequence.tuple.erlang + + {adam,24,{july,29}} +% ^ - meta.sequence.tuple.erlang +% ^^^^^^^^^ meta.sequence.tuple.erlang - meta.sequence.tuple.erlang meta.sequence.tuple.erlang +% ^^^^^^^^^ meta.sequence.tuple.erlang meta.sequence.tuple.erlang +% ^ meta.sequence.tuple.erlang - meta.sequence.tuple.erlang meta.sequence.tuple.erlang +% ^ - meta.sequence.tuple.erlang +% ^ punctuation.section.sequence.begin.erlang +% ^ punctuation.separator.sequence.erlang +% ^ punctuation.separator.sequence.erlang +% ^ punctuation.section.sequence.begin.erlang +% ^ punctuation.separator.sequence.erlang +% ^^ punctuation.section.sequence.end.erlang + + { adam , 24 , { july , 29 } } +% ^ - meta.sequence.tuple.erlang +% ^^^^^^^^^^^^^^ meta.sequence.tuple.erlang - meta.sequence.tuple.erlang meta.sequence.tuple.erlang +% ^^^^^^^^^^^^^ meta.sequence.tuple.erlang meta.sequence.tuple.erlang +% ^^ meta.sequence.tuple.erlang - meta.sequence.tuple.erlang meta.sequence.tuple.erlang +% ^ - meta.sequence.tuple.erlang +% ^ punctuation.section.sequence.begin.erlang +% ^ punctuation.separator.sequence.erlang +% ^ punctuation.separator.sequence.erlang +% ^ punctuation.section.sequence.begin.erlang +% ^ punctuation.separator.sequence.erlang +% ^ punctuation.section.sequence.end.erlang +% ^ punctuation.section.sequence.end.erlang + + { +% ^ - meta.sequence.tuple.erlang +% ^^ meta.sequence.tuple.erlang - meta.sequence.tuple.erlang meta.sequence.tuple.erlang +% ^ punctuation.section.sequence.begin.erlang + adam, +%^^^^^^^^^^^^^ meta.sequence.tuple.erlang - meta.sequence.tuple.erlang meta.sequence.tuple.erlang +% ^ punctuation.separator.sequence.erlang + 24, +%^^^^^^^^^^^ meta.sequence.tuple.erlang - meta.sequence.tuple.erlang meta.sequence.tuple.erlang +% ^ punctuation.separator.sequence.erlang + {july,29} +%^^^^^^^ meta.sequence.tuple.erlang - meta.sequence.tuple.erlang meta.sequence.tuple.erlang +% ^^^^^^^^^ meta.sequence.tuple.erlang meta.sequence.tuple.erlang +% ^ meta.sequence.tuple.erlang - meta.sequence.tuple.erlang meta.sequence.tuple.erlang +% ^ punctuation.section.sequence.begin.erlang +% ^ punctuation.separator.sequence.erlang +% ^ punctuation.section.sequence.end.erlang +% ^ meta.sequence.tuple.erlang - meta.sequence.tuple.erlang meta.sequence.tuple.erlang + } +%^^^^ meta.sequence.tuple.erlang +% ^ punctuation.section.sequence.end.erlang +% ^ - meta.sequence.tuple.erlang + +% Variables tests + +variables_tests() -> . + + Foo +% ^^^ variable.other.erlang + _foo +% ^^^^ variable.other.erlang + _Foo@bar_baz +% ^^^^^^^^^^^^ variable.other.erlang + _Foo +% ^^^^ variable.other.erlang + _@ +% ^^ variable.other.erlang + __ +% ^^ variable.other.erlang + _1 +% ^^ variable.other.erlang + _ +% ^ variable.language.anonymous.erlang + _+ +% ^ variable.language.anonymous.erlang +% ^ keyword.operator.arithmetic.erlang + [_,_,_] +% ^ variable.language.anonymous.erlang +% ^ variable.language.anonymous.erlang +% ^ variable.language.anonymous.erlang + + namespace: +% ^^^^^^^^^ variable.namespace.erlang +% ^ punctuation.accessor.double-colon.erlang + +% Operator tests + +operator_tests() -> . + + X++Y +% ^^ keyword.operator.lists.erlang + + X--Y +% ^^ keyword.operator.lists.erlang + + 2 /= 3 +% ^^ keyword.operator.logical.erlang + + 2 == 3 +% ^^ keyword.operator.logical.erlang + + 2 >= 3 +% ^^ keyword.operator.logical.erlang + + 2 =< 3 +% ^^ keyword.operator.logical.erlang + + X =:= 3 +% ^^^ keyword.operator.logical.erlang + + X =/= 3 +% ^^^ keyword.operator.logical.erlang + + X =! 3 +% ^^ keyword.operator.logical.erlang + + X <- [1,2,3] +% ^ variable.other.erlang +% ^^ keyword.operator.generator.erlang +% ^ punctuation.section.sequence.begin.erlang +% ^^^^^^^ meta.sequence.list.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^ punctuation.separator.sequence.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^ punctuation.separator.sequence.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^ punctuation.section.sequence.end.erlang + + <> <= << 1,2,3 >> +% ^^ punctuation.definition.sequence.begin.erlang +% ^^^^^ meta.sequence.binary.erlang +% ^ variable.other.erlang +% ^^ punctuation.definition.sequence.end.erlang +% ^^ keyword.operator.generator.erlang +% ^^ punctuation.definition.sequence.begin.erlang +% ^^^^^^^^^^^ meta.sequence.binary.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^ punctuation.separator.sequence.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^ punctuation.separator.sequence.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^^ punctuation.definition.sequence.end.erlang + + {A, B, C} -> 0, 1, D. +% ^^^^^^^^^ meta.sequence.tuple.erlang +% ^^ punctuation.separator.clause-head-body.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^ punctuation.separator.expressions.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^ punctuation.separator.expressions.erlang +% ^ variable.other.erlang + + a := b +% ^ meta.atom.erlang constant.other.symbol.erlang +% ^^ punctuation.separator.mapping.key-value.erlang +% ^ meta.atom.erlang constant.other.symbol.erlang + + a => b +% ^ meta.atom.erlang constant.other.symbol.erlang +% ^^ punctuation.separator.mapping.key-value.erlang +% ^ meta.atom.erlang constant.other.symbol.erlang + +% directive-control-flow tests + +preprocessor_control_tests() -> . + + 4 -if end +% ^ constant.numeric.integer.decimal.erlang +% ^ keyword.operator.arithmetic.erlang - keyword.control.conditional.erlang +% ^ keyword.control.conditional - meta.preprocessor + + 4 -if() end +% ^ constant.numeric.integer.decimal.erlang +% ^ keyword.operator.arithmetic.erlang - keyword.control.conditional.erlang +% ^ keyword.control.conditional - meta.preprocessor + + -if +% ^^^^ meta.preprocessor.conditional.erlang - meta.preprocessor.conditional.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^ keyword.control.directive.conditional.erlang + + -if (). +% ^^^^ meta.preprocessor.conditional.erlang - meta.preprocessor.conditional.arguments.erlang +% ^^ meta.preprocessor.conditional.arguments.erlang +% ^ meta.preprocessor.conditional.erlang - meta.preprocessor.conditional.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^ keyword.control.directive.conditional.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.terminator.clause.erlang + + - if ( ) . +% ^^^^^^^ meta.preprocessor.conditional.erlang - meta.preprocessor.conditional.arguments.erlang +% ^^^ meta.preprocessor.conditional.arguments.erlang +% ^^ meta.preprocessor.conditional.erlang - meta.preprocessor.conditional.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^ keyword.control.directive.conditional.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.terminator.clause.erlang + + -if(?OTP_RELEASE >= 22). +% ^^^ meta.preprocessor.conditional.erlang - meta.preprocessor.conditional.arguments.erlang +% ^^^^^^^^^^^^^^^^^^^^ meta.preprocessor.conditional.arguments.erlang +% ^ meta.preprocessor.conditional.erlang - meta.preprocessor.conditional.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^ keyword.control.directive.conditional.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.definition.macro.erlang +% ^^^^^^^^^^^^ constant.language.macro.erlang +% ^^ keyword.operator.logical.erlang +% ^^ constant.numeric.integer.decimal.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.terminator.clause.erlang + + -elif(?OTP_RELEASE >= 22). +% ^^^^^ meta.preprocessor.conditional.erlang - meta.preprocessor.conditional.arguments.erlang +% ^^^^^^^^^^^^^^^^^^^^ meta.preprocessor.conditional.arguments.erlang +% ^ meta.preprocessor.conditional.erlang - meta.preprocessor.conditional.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^ keyword.control.directive.conditional.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.definition.macro.erlang +% ^^^^^^^^^^^^ constant.language.macro.erlang +% ^^ keyword.operator.logical.erlang +% ^^ constant.numeric.integer.decimal.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.terminator.clause.erlang + + -ifdef(MACRO_NAME). +% ^^^^^^ meta.preprocessor.conditional.erlang - meta.preprocessor.conditional.arguments.erlang +% ^^^^^^^^^^^^ meta.preprocessor.conditional.arguments.erlang +% ^ meta.preprocessor.conditional.erlang - meta.preprocessor.conditional.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^ keyword.control.directive.conditional.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^^^^^^^^^^ constant.other.macro.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.terminator.clause.erlang + + -ifdef(MACRO_NAME illegal). +% ^^^^^^ meta.preprocessor.conditional.erlang - meta.preprocessor.conditional.arguments.erlang +% ^^^^^^^^^^^^^^^^^^^^ meta.preprocessor.conditional.arguments.erlang +% ^ meta.preprocessor.conditional.erlang - meta.preprocessor.conditional.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^ keyword.control.directive.conditional.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^^^^^^^^^^ constant.other.macro.erlang +% ^^^^^^^ invalid.illegal.expect-arguments-end.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.terminator.clause.erlang + + 4 -ifndef +% ^ constant.numeric.integer.decimal.erlang +% ^ keyword.operator.arithmetic.erlang - keyword.control.erlang +% ^ constant.other.symbol.erlang - keyword.control.directive.attribute.erlang + + 4 -ifndef() +% ^ constant.numeric.integer.decimal.erlang +% ^ keyword.operator.arithmetic.erlang - keyword.control.erlang +% ^ variable.function.erlang - keyword.control.directive.attribute.erlang + + -ifndef +% ^^^^^^^^ meta.preprocessor.conditional.erlang - meta.preprocessor.conditional.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.conditional.erlang + + -ifndef() +% ^^^^^^^ meta.preprocessor.conditional.erlang - meta.preprocessor.conditional.arguments.erlang +% ^^ meta.preprocessor.conditional.arguments.erlang +% ^ meta.preprocessor.conditional.erlang - meta.preprocessor.conditional.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.conditional.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ invalid.illegal.expect-terminator.erlang + + -ifndef(macro_name). +% ^^^^^^^ meta.preprocessor.conditional.erlang - meta.preprocessor.conditional.arguments.erlang +% ^^^^^^^^^^^^ meta.preprocessor.conditional.arguments.erlang +% ^ meta.preprocessor.conditional.erlang - meta.preprocessor.conditional.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.conditional.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^^^^^^^^^^ constant.other.macro.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.terminator.clause.erlang + + 4 -else +% ^ constant.numeric.integer.decimal.erlang +% ^ keyword.operator.arithmetic.erlang - keyword.control.erlang +% ^ constant.other.symbol.erlang - keyword.control.directive.attribute.erlang + + 4 -else() +% ^ constant.numeric.integer.decimal.erlang +% ^ keyword.operator.arithmetic.erlang - keyword.control.erlang +% ^ variable.function.erlang - keyword.control.directive.attribute.erlang + + -else. +% ^^^^^^ meta.preprocessor.conditional.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^ keyword.control.directive.conditional.erlang +% ^ punctuation.terminator.clause.erlang + + - else . +% ^^^^^^^^ meta.preprocessor.conditional.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^ keyword.control.directive.conditional.erlang +% ^ punctuation.terminator.clause.erlang + + -else(). +% ^^^^^^ meta.preprocessor.conditional.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^ keyword.control.directive.conditional.erlang +% ^^ invalid.illegal.expect-terminator.erlang +% ^ punctuation.terminator.clause.erlang + + -endif. +% ^^^^^^^ meta.preprocessor.conditional.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^ keyword.control.directive.conditional.erlang +% ^ punctuation.terminator.clause.erlang + + - endif . +% ^^^^^^^^^ meta.preprocessor.conditional.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^ keyword.control.directive.conditional.erlang +% ^ punctuation.terminator.clause.erlang + + -endif(). +% ^^^^^^^ meta.preprocessor.conditional.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^ keyword.control.directive.conditional.erlang +% ^^ invalid.illegal.expect-terminator.erlang +% ^ punctuation.terminator.clause.erlang + +% directive-undef tests + +preprocessor_undef_tests() -> . + + 4 -undef +% ^ constant.numeric.integer.decimal.erlang +% ^ keyword.operator.arithmetic.erlang - keyword.declaration.undef.erlang +% ^^^^^ constant.language.exception.reason.erlang - keyword.control.directive.undef.erlang + + 4 -undef() +% ^ constant.numeric.integer.decimal.erlang +% ^ keyword.operator.arithmetic.erlang - keyword.declaration.undef.erlang +% ^ variable.function.erlang - keyword.control.directive.undef.erlang + + -undef +% ^^^^^^^ meta.preprocessor.undef.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^ keyword.control.directive.undef.erlang + + -undef( +% ^^^^^^ meta.preprocessor.undef.erlang - meta.preprocessor.undef.arguments.erlang +% ^^ meta.preprocessor.undef.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^ keyword.control.directive.undef.erlang +% ^ punctuation.section.arguments.begin.erlang + + -undef) +% ^^^^^^^^ meta.preprocessor.undef.arguments.erlang +% ^ meta.preprocessor.undef.erlang - meta.preprocessor.undef.arguments.erlang +% ^^^^^^ invalid.illegal.expect-identifier.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ invalid.illegal.expect-terminator.erlang + + -undef() +% ^^^^^^ meta.preprocessor.undef.erlang - meta.preprocessor.undef.arguments.erlang +% ^^ meta.preprocessor.undef.arguments.erlang +% ^ meta.preprocessor.undef.erlang - meta.preprocessor.undef.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^ keyword.control.directive.undef.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ invalid.illegal.expect-terminator.erlang + + -undef(). +% ^^^^^^ meta.preprocessor.undef.erlang - meta.preprocessor.undef.arguments.erlang +% ^^ meta.preprocessor.undef.arguments.erlang +% ^ meta.preprocessor.undef.erlang - meta.preprocessor.undef.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^ keyword.control.directive.undef.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.terminator.clause.erlang + + -undef(name) +% ^^^^^^ meta.preprocessor.undef.erlang - meta.preprocessor.undef.arguments.erlang +% ^^^^^^ meta.preprocessor.undef.arguments.erlang +% ^ meta.preprocessor.undef.erlang - meta.preprocessor.undef.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^ keyword.control.directive.undef.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^^^^ entity.name.constant.macro.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ invalid.illegal.expect-terminator.erlang + + - undef ( name illegal ) illegal . +% ^^^^^^^^ meta.preprocessor.undef.erlang - meta.preprocessor.undef.arguments.erlang +% ^^^^^^^^^^^^^^^^ meta.preprocessor.undef.arguments.erlang +% ^^^^^^^^^ meta.preprocessor.undef.erlang - meta.preprocessor.undef.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^ keyword.control.directive.undef.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^^^^ entity.name.constant.macro.erlang +% ^^^^^^^ invalid.illegal.expect-arguments-end.erlang +% ^ punctuation.section.arguments.end.erlang +% ^^^^^^^ invalid.illegal.expect-terminator.erlang +% ^ punctuation.terminator.clause.erlang + +% directive-define tests + +preprocessor_define_tests() -> . + + 4 -define +% ^ constant.numeric.integer.decimal.erlang +% ^ keyword.operator.arithmetic.erlang - keyword.declaration.define.erlang +% ^ constant.other.symbol.erlang - keyword.control.directive.define.erlang + + 4 -define() +% ^ constant.numeric.integer.decimal.erlang +% ^ keyword.operator.arithmetic.erlang - keyword.declaration.define.erlang +% ^ variable.function.erlang - keyword.control.directive.define.erlang + + -define +% ^^^^^^^^ meta.preprocessor.define.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.define.erlang + + -define( +% ^^^^^^^ meta.preprocessor.define.erlang - meta.preprocessor.define.arguments.erlang +% ^^ meta.preprocessor.define.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.define.erlang +% ^ punctuation.section.arguments.begin.erlang + + -define) +% ^^^^^^^^^ meta.preprocessor.define.arguments.erlang +% ^ meta.preprocessor.define.erlang - meta.preprocessor.define.arguments.erlang +% ^ - entity - invalid +% ^^^^^^^ invalid.illegal.expect-identifier.erlang +% ^ punctuation.section.arguments.end.erlang - entity - invalid +% ^ invalid.illegal.expect-terminator.erlang + + -define() +% ^^^^^^^ meta.preprocessor.define.erlang - meta.preprocessor.define.arguments.erlang +% ^^ meta.preprocessor.define.arguments.erlang +% ^ meta.preprocessor.define.erlang - meta.preprocessor.define.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.define.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ invalid.illegal.expect-terminator.erlang + + -define(). +% ^^^^^^^ meta.preprocessor.define.erlang - meta.preprocessor.define.arguments.erlang +% ^^ meta.preprocessor.define.arguments.erlang +% ^ meta.preprocessor.define.erlang - meta.preprocessor.define.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.define.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.terminator.clause.erlang + + -define(,) +% ^^^^^^^ meta.preprocessor.define.erlang - meta.preprocessor.define.arguments.erlang +% ^^^ meta.preprocessor.define.arguments.erlang +% ^ meta.preprocessor.define.erlang - meta.preprocessor.define.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.define.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.separator.arguments.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ invalid.illegal.expect-terminator.erlang + + -define(.) +% ^^^^^^^ meta.preprocessor.define.erlang - meta.preprocessor.define.arguments.erlang +% ^ meta.preprocessor.define.arguments.erlang +% ^ meta.preprocessor.define.erlang - meta.preprocessor.define.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.define.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.terminator.clause.erlang +% ^ invalid.illegal.stray.erlang + + -define(,,) +% ^^^^^^^ meta.preprocessor.define.erlang - meta.preprocessor.define.arguments.erlang +% ^^^^ meta.preprocessor.define.arguments.erlang +% ^ meta.preprocessor.define.erlang - meta.preprocessor.define.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.define.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.separator.arguments.erlang +% ^ punctuation.separator.expressions.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ invalid.illegal.expect-terminator.erlang + + -define(name,) +% ^^^^^^^ meta.preprocessor.define.erlang - meta.preprocessor.define.arguments.erlang +% ^^^^^^^ meta.preprocessor.define.arguments.erlang +% ^ meta.preprocessor.define.erlang - meta.preprocessor.define.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.define.erlang +% ^ punctuation.section.arguments.begin.erlang - entity - invalid +% ^^^^ entity.name.constant.macro.erlang +% ^ punctuation.separator.arguments.erlang - entity - invalid +% ^ punctuation.section.arguments.end.erlang +% ^ invalid.illegal.expect-terminator.erlang + + -define( Name , ) +% ^^^^^^^ meta.preprocessor.define.erlang - meta.preprocessor.define.arguments.erlang +% ^^^^^^^^^^ meta.preprocessor.define.arguments.erlang +% ^ meta.preprocessor.define.erlang - meta.preprocessor.define.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.define.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ - entity +% ^^^^ entity.name.constant.macro.erlang +% ^ - entity +% ^ punctuation.separator.arguments.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ invalid.illegal.expect-terminator.erlang + + -define(NAME, 16#1AF). +% ^^^^^^^ meta.preprocessor.define.erlang - meta.preprocessor.define.arguments.erlang +% ^^^^^^^^^^^^^^ meta.preprocessor.define.arguments.erlang +% ^ meta.preprocessor.define.erlang - meta.preprocessor.define.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.define.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^^^^ entity.name.constant.macro.erlang +% ^ punctuation.separator.arguments.erlang +% ^^^^^^ constant.numeric.integer.hexadecimal.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.terminator.clause.erlang + + -define('name', 16#1AF). +% ^^^^^^^ meta.preprocessor.define.erlang - meta.preprocessor.define.arguments.erlang +% ^^^^^^^^^^^^^^^^ meta.preprocessor.define.arguments.erlang +% ^ meta.preprocessor.define.erlang - meta.preprocessor.define.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.define.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^^^^^^ entity.name.constant.macro.erlang +% ^ punctuation.separator.arguments.erlang +% ^^^^^^ constant.numeric.integer.hexadecimal.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.terminator.clause.erlang + + -define(?NAME, 16#1AF). +% ^^^^^^^ meta.preprocessor.define.erlang - meta.preprocessor.define.arguments.erlang +% ^^^^^^^^^^^^^^^ meta.preprocessor.define.arguments.erlang +% ^ meta.preprocessor.define.erlang - meta.preprocessor.define.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.define.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^^^^^ constant.other.macro.erlang +% ^ punctuation.separator.arguments.erlang +% ^^^^^^ constant.numeric.integer.hexadecimal.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.terminator.clause.erlang + + -define(HASH, sha1() | sha2() ; ripemd160 ). +% ^^^^^^^ meta.preprocessor.define.erlang - meta.preprocessor.define.arguments.erlang +% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.preprocessor.define.arguments.erlang +% ^ meta.preprocessor.define.erlang - meta.preprocessor.define.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.define.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^^^^ entity.name.constant.macro.erlang +% ^ punctuation.separator.arguments.erlang +% ^ punctuation.separator.sequence.erlang +% ^ punctuation.separator.clauses.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.terminator.clause.erlang + + -define(FUNC(X, Y), {a, X, b, Y}). +% ^^^^^^^ meta.preprocessor.define.erlang - meta.preprocessor.define.arguments.erlang +% ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.preprocessor.define.arguments.erlang +% ^ - meta.macro +% ^^^^ meta.macro.name.erlang - meta.macro.parameters +% ^^^^^^ meta.macro.parameters.erlang +% ^ - meta.macro +% ^^^^^^^^^^^^ meta.sequence.tuple.erlang +% ^ meta.preprocessor.define.erlang - meta.preprocessor.define.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.define.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^^^^ entity.name.constant.macro.erlang +% ^ punctuation.separator.arguments.erlang +% ^ punctuation.section.sequence.begin.erlang +% ^ constant.other.symbol.erlang +% ^ punctuation.separator.sequence.erlang +% ^ variable.other.erlang +% ^ punctuation.separator.sequence.erlang +% ^ constant.other.symbol.erlang +% ^ punctuation.separator.sequence.erlang +% ^ variable.other.erlang +% ^ punctuation.section.sequence.end.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.terminator.clause.erlang + + -define('E...'(X), ?'2bin'(X)/binary ). +% ^^^^^^^ meta.preprocessor.define.erlang - meta.preprocessor.define.arguments.erlang +% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.preprocessor.define.arguments.erlang +% ^ - meta.macro +% ^^^^^^ meta.macro.name.erlang - meta.macro.parameters +% ^^^ meta.macro.parameters.erlang +% ^ - meta.macro +% ^^^^^^^ meta.function-call.name.erlang +% ^^^ meta.function-call.arguments.erlang +% ^ meta.preprocessor.define.erlang - meta.preprocessor.define.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.define.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^^^^^^ entity.name.constant.macro.erlang +% ^ punctuation.section.parameters.begin.erlang +% ^ variable.parameter.erlang +% ^ punctuation.section.parameters.end.erlang +% ^ punctuation.separator.arguments.erlang +% ^ punctuation.definition.macro.erlang +% ^^^^^^^ constant.other.macro.erlang +% ^ punctuation.definition.atom.begin.erlang +% ^ punctuation.definition.atom.end.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ variable.other.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ keyword.operator.arithmetic.erlang +% ^^^^^^ constant.other.symbol.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.terminator.clause.erlang + + -define(CALL(Rec, Func, Args), +% ^^^^^^^ meta.preprocessor.define.erlang - meta.preprocessor.define.arguments.erlang +% ^^^^^^^^^^^^^^^^^^^^^^^^ meta.preprocessor.define.arguments.erlang + erlang:apply(Rec.mod, Func, Args ++ [Rec.mod_state]) +% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.preprocessor.define.arguments.erlang +% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.erlang +% ^^^^^^^^^^^^^^^ meta.sequence.list.erlang +% ^^^^^^ meta.path.erlang support.namespace.erlang +% ^ meta.path.erlang punctuation.accessor.double-colon.erlang +% ^^^^^ meta.path.erlang meta.function-call.name.erlang support.function.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^^^ variable.other.erlang +% ^ punctuation.accessor.dot.erlang +% ^^^ variable.other.field.erlang +% ^ punctuation.separator.arguments.erlang +% ^^^^ variable.other.erlang +% ^ punctuation.separator.arguments.erlang +% ^^^^ variable.other.erlang +% ^^ keyword.operator.lists.erlang +% ^^^ variable.other.erlang +% ^ punctuation.accessor.dot.erlang +% ^^^^^^^^^ variable.other.field.erlang +). +% <- punctuation.section.arguments.end.erlang +%^ punctuation.terminator.clause.erlang + +-define(_get_stacktrace_(), + try exit('$get_stacktrace') catch exit:'$get_stacktrace':Stacktrace -> Stacktrace end). +% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.preprocessor.define.arguments.erlang +% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.exception.try.erlang +% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.exception.catch.erlang +% ^^^ meta.exception.try.erlang +% ^^^^ meta.function-call.name.erlang +% ^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.erlang +% ^^^ keyword.control.exception.try.erlang +% ^^^^ support.function.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.definition.atom.begin.erlang +% ^^^^^^^^^^^^^^^^^ constant.other.symbol.erlang +% ^ punctuation.definition.atom.end.erlang +% ^ punctuation.section.arguments.end.erlang +% ^^^^^ keyword.control.exception.catch.erlang +% ^^^^ constant.language.exception.type.erlang +% ^ punctuation.separator.patterns.erlang +% ^ punctuation.definition.atom.begin.erlang +% ^^^^^^^^^^^^^^^^^ constant.other.symbol.erlang +% ^ punctuation.definition.atom.end.erlang +% ^ punctuation.separator.patterns.erlang +% ^^^^^^^^^^ variable.other.erlang +% ^^ punctuation.separator.clause-head-body.erlang +% ^^^^^^^^^^ variable.other.erlang +% ^^^ keyword.control.exception.end.erlang +% + +% directive-export tests + +preprocessor_export_tests() -> . + + 4 -export +% ^ constant.numeric.integer.decimal.erlang +% ^ keyword.operator.arithmetic.erlang - keyword.declaration.export.erlang +% ^ constant.other.symbol.erlang - keyword.control.directive.export.erlang + + 4 -export() +% ^ constant.numeric.integer.decimal.erlang +% ^ keyword.operator.arithmetic.erlang - keyword.declaration.export.erlang +% ^ variable.function.erlang - keyword.control.directive.export.erlang + + -export +% ^^^^^^^^ meta.preprocessor.export.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.export.erlang + + -export( + illegal +% ^ invalid.illegal.expect-list.erlang + [ref/] +% ^^^^^^ meta.sequence.list.erlang + illegal +% ^ invalid.illegal.expect-arguments-end.erlang + . +% ^ punctuation.terminator.clause.erlang +% ^ - meta.preprocessor.export + + -export( +% ^^^^^^^ meta.preprocessor.export.erlang - meta.preprocessor.export.arguments.erlang +% ^^ meta.preprocessor.export.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.export.erlang +% ^ punctuation.section.arguments.begin.erlang + + -export) +% ^^^^^^^^^ meta.preprocessor.export.arguments.erlang +% ^ meta.preprocessor.export.erlang - meta.preprocessor.export.arguments.erlang +% ^^^^^^^ invalid.illegal.expect-list.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ invalid.illegal.expect-terminator.erlang + + -export() +% ^^^^^^^ meta.preprocessor.export.erlang - meta.preprocessor.export.arguments.erlang +% ^^ meta.preprocessor.export.arguments.erlang +% ^ meta.preprocessor.export.erlang - meta.preprocessor.export.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.export.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ invalid.illegal.expect-terminator.erlang + + -export(). +% ^^^^^^^ meta.preprocessor.export.erlang - meta.preprocessor.export.arguments.erlang +% ^^ meta.preprocessor.export.arguments.erlang +% ^ meta.preprocessor.export.erlang - meta.preprocessor.export.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.export.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.terminator.clause.erlang + + -export([start_link/1, report / 2, stop/a, FooBar/2, fooBar/]). +% ^^^^^^^ meta.preprocessor.export.erlang - meta.preprocessor.export.arguments.erlang +% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.preprocessor.export.arguments.erlang +% ^ meta.preprocessor.export.erlang - meta.preprocessor.export.arguments.erlang +% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.sequence.list.erlang +% ^^^^^^^^^^ meta.reference.function.name.erlang +% ^ meta.reference.function.erlang - meta.reference.name - mete.reference.arity +% ^ meta.reference.function.arity.erlang +% ^^^^^^^ meta.reference.function.name.erlang +% ^ meta.reference.function.erlang - meta.reference.name - mete.reference.arity +% ^^ meta.reference.function.arity.erlang +% ^^^^ meta.reference.function.name.erlang +% ^ meta.reference.function.erlang - meta.reference.name - mete.reference.arity +% ^ meta.reference.function.arity.erlang +% ^^^^^^ meta.reference.function.name.erlang +% ^ meta.reference.function.erlang - meta.reference.name - mete.reference.arity +% ^ meta.reference.function.arity.erlang +% ^^^^^^ meta.reference.function.name.erlang +% ^ meta.reference.function.erlang - meta.reference.name - mete.reference.arity% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.export.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.sequence.begin.erlang +% ^^^^^^^^^^ variable.function.erlang +% ^ punctuation.separator.reference.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^ punctuation.separator.sequence.erlang +% ^^^^^^ variable.function.erlang +% ^ punctuation.separator.reference.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^ punctuation.separator.sequence.erlang +% ^^^^ variable.function.erlang +% ^ punctuation.separator.reference.erlang +% ^ invalid.illegal.expect-integer.erlang +% ^ punctuation.separator.sequence.erlang +% ^^^^^^ variable.other.erlang +% ^ punctuation.separator.reference.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^ punctuation.separator.sequence.erlang +% ^^^^^^ variable.function.erlang +% ^ punctuation.separator.reference.erlang +% ^ punctuation.section.sequence.end.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.terminator.clause.erlang + +% directive-export_type tests + + 4 -export_type +% ^ constant.numeric.integer.decimal.erlang +% ^ keyword.operator.arithmetic.erlang - keyword.declaration.export.erlang +% ^ constant.other.symbol.erlang - keyword.control.directive.export.erlang + + 4 -export_type() +% ^ constant.numeric.integer.decimal.erlang +% ^ keyword.operator.arithmetic.erlang - keyword.declaration.export.erlang +% ^ variable.function.erlang - keyword.control.directive.export.erlang + + -export_type +% ^^^^^^^^^^^^^ meta.preprocessor.export.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^^^^^^ keyword.control.directive.export.erlang + + -export_type( +% ^^^^^^^^^^^^ meta.preprocessor.export.erlang - meta.preprocessor.export.arguments.erlang +% ^^ meta.preprocessor.export.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^^^^^^ keyword.control.directive.export.erlang +% ^ punctuation.section.arguments.begin.erlang + + -export_type) +% ^^^^^^^^^^^^^^ meta.preprocessor.export.arguments.erlang +% ^ meta.preprocessor.export.erlang - meta.preprocessor.export.arguments.erlang +% ^^^^^^^^^^^^ invalid.illegal.expect-list.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ invalid.illegal.expect-terminator.erlang + + -export_type() +% ^^^^^^^^^^^^ meta.preprocessor.export.erlang - meta.preprocessor.export.arguments.erlang +% ^^ meta.preprocessor.export.arguments.erlang +% ^ meta.preprocessor.export.erlang - meta.preprocessor.export.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^^^^^^ keyword.control.directive.export.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ invalid.illegal.expect-terminator.erlang + + -export_type(). +% ^^^^^^^^^^^^ meta.preprocessor.export.erlang - meta.preprocessor.export.arguments.erlang +% ^^ meta.preprocessor.export.arguments.erlang +% ^ meta.preprocessor.export.erlang - meta.preprocessor.export.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^^^^^^ keyword.control.directive.export.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.terminator.clause.erlang + + -export_type([start_link/1, report / 2, stop/a, FooBar/2, fooBar/]). +% ^^^^^^^^^^^^ meta.preprocessor.export.erlang - meta.preprocessor.export.arguments.erlang +% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.preprocessor.export.arguments.erlang +% ^ meta.preprocessor.export.erlang - meta.preprocessor.export.arguments.erlang +% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.sequence.list.erlang +% ^^^^^^^^^^ meta.reference.function.name.erlang +% ^ meta.reference.function.erlang - meta.reference.name - mete.reference.arity +% ^ meta.reference.function.arity.erlang +% ^^^^^^^ meta.reference.function.name.erlang +% ^ meta.reference.function.erlang - meta.reference.name - mete.reference.arity +% ^^ meta.reference.function.arity.erlang +% ^^^^ meta.reference.function.name.erlang +% ^ meta.reference.function.erlang - meta.reference.name - mete.reference.arity +% ^ meta.reference.function.arity.erlang +% ^^^^^^ meta.reference.function.name.erlang +% ^ meta.reference.function.erlang - meta.reference.name - mete.reference.arity +% ^ meta.reference.function.arity.erlang +% ^^^^^^ meta.reference.function.name.erlang +% ^ meta.reference.function.erlang - meta.reference.name - mete.reference.arity +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^^^^^^ keyword.control.directive.export.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.sequence.begin.erlang +% ^^^^^^^^^^ variable.function.erlang +% ^ punctuation.separator.reference.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^ punctuation.separator.sequence.erlang +% ^^^^^^ variable.function.erlang +% ^ punctuation.separator.reference.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^ punctuation.separator.sequence.erlang +% ^^^^ variable.function.erlang +% ^ punctuation.separator.reference.erlang +% ^ invalid.illegal.expect-integer.erlang +% ^ punctuation.separator.sequence.erlang +% ^^^^^^ variable.other.erlang +% ^ punctuation.separator.reference.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^ punctuation.separator.sequence.erlang +% ^^^^^^ variable.function.erlang +% ^ punctuation.separator.reference.erlang +% ^ punctuation.section.sequence.end.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.terminator.clause.erlang + +% directive-import tests + +preprocessor_import_tests() -> . + + 4 -import +% ^ constant.numeric.integer.decimal.erlang +% ^ keyword.operator.arithmetic.erlang - keyword.declaration.import.erlang +% ^ constant.other.symbol.erlang - keyword.control.directive.import.erlang + + 4 -import() +% ^ constant.numeric.integer.decimal.erlang +% ^ keyword.operator.arithmetic.erlang - keyword.declaration.import.erlang +% ^ variable.function.erlang - keyword.control.directive.import.erlang + + -import +% ^^^^^^^^ meta.preprocessor.import.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.import.erlang + + -import. +% ^^^^^^^^ meta.preprocessor.import.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.import.erlang + + -import). +% ^^^^^^^^ meta.preprocessor.import.erlang - meta.preprocessor.import.arguments.erlang +% ^ meta.preprocessor.import.erlang - meta.preprocessor.import.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.import.erlang +% ^ invalid.illegal.stray-arguments-end.erlang + + -import( +% ^^^^^^^ meta.preprocessor.import.erlang - meta.preprocessor.import.arguments.erlang +% ^^ meta.preprocessor.import.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.import.erlang +% ^ punctuation.section.arguments.begin.erlang + + -import) +% ^^^^^^^^^ meta.preprocessor.import.arguments.erlang +% ^ meta.preprocessor.import.erlang - meta.preprocessor.import.arguments.erlang +% ^^^^^^^ invalid.illegal.expect-atom.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ invalid.illegal.expect-terminator.erlang + + -import() +% ^^^^^^^ meta.preprocessor.import.erlang - meta.preprocessor.import.arguments.erlang +% ^^ meta.preprocessor.import.arguments.erlang +% ^ meta.preprocessor.import.erlang - meta.preprocessor.import.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.import.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ invalid.illegal.expect-terminator.erlang + + -import(). +% ^^^^^^^ meta.preprocessor.import.erlang - meta.preprocessor.import.arguments.erlang +% ^^ meta.preprocessor.import.arguments.erlang +% ^ meta.preprocessor.import.erlang - meta.preprocessor.import.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.import.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.terminator.clause.erlang + + -import(,) +% ^^^^^^^ meta.preprocessor.import.erlang - meta.preprocessor.import.arguments.erlang +% ^^^ meta.preprocessor.import.arguments.erlang +% ^ meta.preprocessor.import.erlang - meta.preprocessor.import.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.import.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.separator.arguments.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ invalid.illegal.expect-terminator.erlang + + -import(,,) +% ^^^^^^^ meta.preprocessor.import.erlang - meta.preprocessor.import.arguments.erlang +% ^^^^ meta.preprocessor.import.arguments.erlang +% ^ meta.preprocessor.import.erlang - meta.preprocessor.import.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.import.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.separator.arguments.erlang +% ^ invalid.illegal.expect-list.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ invalid.illegal.expect-terminator.erlang + + -import(name,) +% ^^^^^^^ meta.preprocessor.import.erlang - meta.preprocessor.import.arguments.erlang +% ^^^^^^^ meta.preprocessor.import.arguments.erlang +% ^ meta.preprocessor.import.erlang - meta.preprocessor.import.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.import.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^^^^ entity.name.namespace.erlang +% ^ punctuation.separator.arguments.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ invalid.illegal.expect-terminator.erlang + + -import(Name,) +% ^^^^^^^ meta.preprocessor.import.erlang - meta.preprocessor.import.arguments.erlang +% ^^^^^^^ meta.preprocessor.import.arguments.erlang +% ^ meta.preprocessor.import.erlang - meta.preprocessor.import.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.import.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^^^^ invalid.illegal.expect-atom.erlang +% ^ punctuation.separator.arguments.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ invalid.illegal.expect-terminator.erlang + + -import('Mod-name',) +% ^^^^^^^ meta.preprocessor.import.erlang - meta.preprocessor.import.arguments.erlang +% ^^^^^^^^^^^^^ meta.preprocessor.import.arguments.erlang +% ^ meta.preprocessor.import.erlang - meta.preprocessor.import.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.import.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.definition.atom.begin.erlang +% ^^^^^^^^ entity.name.namespace.erlang +% ^ punctuation.definition.atom.end.erlang +% ^ punctuation.separator.arguments.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ invalid.illegal.expect-terminator.erlang + + -import( [start_link/1, report / 2, stop/a, FooBar/2, fooBar/]). +% ^^^^^^^ meta.preprocessor.import.erlang - meta.preprocessor.import.arguments.erlang +% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.preprocessor.import.arguments.erlang +% ^ meta.preprocessor.import.erlang - meta.preprocessor.import.arguments.erlang +% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.sequence.list.erlang +% ^^^^^^^^^^ meta.reference.function.name.erlang +% ^ meta.reference.function.erlang - meta.reference.name - mete.reference.arity +% ^ meta.reference.function.arity.erlang +% ^^^^^^^ meta.reference.function.name.erlang +% ^ meta.reference.function.erlang - meta.reference.name - mete.reference.arity +% ^^ meta.reference.function.arity.erlang +% ^^^^ meta.reference.function.name.erlang +% ^ meta.reference.function.erlang - meta.reference.name - mete.reference.arity +% ^ meta.reference.function.arity.erlang +% ^^^^^^ meta.reference.function.name.erlang +% ^ meta.reference.function.erlang - meta.reference.name - mete.reference.arity +% ^ meta.reference.function.arity.erlang +% ^^^^^^ meta.reference.function.name.erlang +% ^ meta.reference.function.erlang - meta.reference.name - mete.reference.arity +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.import.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.sequence.begin.erlang +% ^^^^^^^^^^ variable.function.erlang +% ^ punctuation.separator.reference.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^ punctuation.separator.sequence.erlang +% ^^^^^^ variable.function.erlang +% ^ punctuation.separator.reference.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^ punctuation.separator.sequence.erlang +% ^^^^ variable.function.erlang +% ^ punctuation.separator.reference.erlang +% ^ invalid.illegal.expect-integer.erlang +% ^ punctuation.separator.sequence.erlang +% ^^^^^^ variable.other.erlang +% ^ punctuation.separator.reference.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^ punctuation.separator.sequence.erlang +% ^^^^^^ variable.function.erlang +% ^ punctuation.separator.reference.erlang +% ^ punctuation.section.sequence.end.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.terminator.clause.erlang + + -import(module, [start_link/1, report / 2, stop/a, FooBar/2, fooBar/]). +% ^^^^^^^ meta.preprocessor.import.erlang - meta.preprocessor.import.arguments.erlang +% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.preprocessor.import.arguments.erlang +% ^ meta.preprocessor.import.erlang - meta.preprocessor.import.arguments.erlang +% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.sequence.list.erlang +% ^^^^^^^^^^ meta.reference.function.name.erlang +% ^ meta.reference.function.erlang - meta.reference.name - mete.reference.arity +% ^ meta.reference.function.arity.erlang +% ^^^^^^^ meta.reference.function.name.erlang +% ^ meta.reference.function.erlang - meta.reference.name - mete.reference.arity +% ^^ meta.reference.function.arity.erlang +% ^^^^ meta.reference.function.name.erlang +% ^ meta.reference.function.erlang - meta.reference.name - mete.reference.arity +% ^ meta.reference.function.arity.erlang +% ^^^^^^ meta.reference.function.name.erlang +% ^ meta.reference.function.erlang - meta.reference.name - mete.reference.arity +% ^ meta.reference.function.arity.erlang +% ^^^^^^ meta.reference.function.name.erlang +% ^ meta.reference.function.erlang - meta.reference.name - mete.reference.arity +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.import.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^^^^^^ entity.name.namespace.erlang +% ^ punctuation.separator.arguments.erlang +% ^ punctuation.section.sequence.begin.erlang +% ^^^^^^^^^^ variable.function.erlang +% ^ punctuation.separator.reference.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^ punctuation.separator.sequence.erlang +% ^^^^^^ variable.function.erlang +% ^ punctuation.separator.reference.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^ punctuation.separator.sequence.erlang +% ^^^^ variable.function.erlang +% ^ punctuation.separator.reference.erlang +% ^ invalid.illegal.expect-integer.erlang +% ^ punctuation.separator.sequence.erlang +% ^^^^^^ variable.other.erlang +% ^ punctuation.separator.reference.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^ punctuation.separator.sequence.erlang +% ^^^^^^ variable.function.erlang +% ^ punctuation.separator.reference.erlang +% ^ punctuation.section.sequence.end.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.terminator.clause.erlang + +% include tests + +preprocessor_include_tests() -> . + + 4 -include +% ^ constant.numeric.integer.decimal.erlang +% ^ keyword.operator.arithmetic.erlang - keyword.declaration.include.erlang +% ^ constant.other.symbol.erlang - keyword.control.directive.include.erlang + + 4 -include() +% ^ constant.numeric.integer.decimal.erlang +% ^ keyword.operator.arithmetic.erlang - keyword.declaration.include.erlang +% ^ variable.function.erlang - keyword.control.directive.include.erlang + + -include +% ^^^^^^^^ meta.preprocessor.include.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^^ keyword.control.directive.include.erlang + + -include( +% ^^^^^^^^ meta.preprocessor.include.erlang - meta.preprocessor.include.arguments.erlang +% ^^ meta.preprocessor.include.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^^ keyword.control.directive.include.erlang +% ^ punctuation.section.arguments.begin.erlang + + -include) +% ^^^^^^^^^^ meta.preprocessor.include.arguments.erlang +% ^ meta.preprocessor.include.erlang - meta.preprocessor.include.arguments.erlang +% ^^^^^^^^ invalid.illegal.expect-arguments-end.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ invalid.illegal.expect-terminator.erlang + + -include() +% ^^^^^^^^ meta.preprocessor.include.erlang - meta.preprocessor.include.arguments.erlang +% ^^ meta.preprocessor.include.arguments.erlang +% ^ meta.preprocessor.include.erlang - meta.preprocessor.include.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^^ keyword.control.directive.include.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ invalid.illegal.expect-terminator.erlang + + -include(). +% ^^^^^^^^ meta.preprocessor.include.erlang - meta.preprocessor.include.arguments.erlang +% ^^ meta.preprocessor.include.arguments.erlang +% ^ meta.preprocessor.include.erlang - meta.preprocessor.include.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^^ keyword.control.directive.include.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.terminator.clause.erlang + + -include(illegal). +% ^^^^^^^^ meta.preprocessor.include.erlang - meta.preprocessor.include.arguments.erlang +% ^^^^^^^^^ meta.preprocessor.include.arguments.erlang +% ^ meta.preprocessor.include.erlang - meta.preprocessor.include.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^^ keyword.control.directive.include.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^^^^^^^ invalid.illegal.expect-arguments-end.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.terminator.clause.erlang + + -include("$foo/bar/baz.hrl" illegal). +% ^^^^^^^^ meta.preprocessor.include.erlang - meta.preprocessor.include.arguments.erlang +% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.preprocessor.include.arguments.erlang +% ^ meta.preprocessor.include.erlang - meta.preprocessor.include.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^^ keyword.control.directive.include.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.definition.string.begin.erlang +% ^^^^^^^^^^^^^^^^^^ string.quoted.double.erlang +% ^ punctuation.definition.variable.erlang +% ^^^^ variable.language.environment.erlang +% ^ punctuation.definition.string.end.erlang +% ^^^^^^^ invalid.illegal.expect-arguments-end.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.terminator.clause.erlang + + 4 -include_lib +% ^ constant.numeric.integer.decimal.erlang +% ^ keyword.operator.arithmetic.erlang - keyword.declaration.include.erlang +% ^ constant.other.symbol.erlang - keyword.control.directive.include.erlang + + -include_lib +% ^^^^^^^^^^^^ meta.preprocessor.include.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^^^^^^ keyword.control.directive.include.erlang + + -include_lib( +% ^^^^^^^^^^^^ meta.preprocessor.include.erlang - meta.preprocessor.include.arguments.erlang +% ^^ meta.preprocessor.include.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^^^^^^ keyword.control.directive.include.erlang +% ^ punctuation.section.arguments.begin.erlang + + -include_lib) +% ^^^^^^^^^^^^^^ meta.preprocessor.include.arguments.erlang +% ^ meta.preprocessor.include.erlang - meta.preprocessor.include.arguments.erlang +% ^^^^^^^^^^^^ invalid.illegal.expect-arguments-end.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ invalid.illegal.expect-terminator.erlang + + -include_lib() +% ^^^^^^^^^^^^ meta.preprocessor.include.erlang - meta.preprocessor.include.arguments.erlang +% ^^ meta.preprocessor.include.arguments.erlang +% ^ meta.preprocessor.include.erlang - meta.preprocessor.include.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^^^^^^ keyword.control.directive.include.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ invalid.illegal.expect-terminator.erlang + + -include_lib(). +% ^^^^^^^^^^^^ meta.preprocessor.include.erlang - meta.preprocessor.include.arguments.erlang +% ^^ meta.preprocessor.include.arguments.erlang +% ^ meta.preprocessor.include.erlang - meta.preprocessor.include.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^^^^^^ keyword.control.directive.include.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.terminator.clause.erlang + + -include_lib("foo/bar/baz.hrl"). +% ^^^^^^^^^^^^ meta.preprocessor.include.erlang - meta.preprocessor.include.arguments.erlang +% ^^^^^^^^^^^^^^^^^^^ meta.preprocessor.include.arguments.erlang +% ^ meta.preprocessor.include.erlang - meta.preprocessor.include.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^^^^^^ keyword.control.directive.include.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.terminator.clause.erlang + +% directive-module tests + +preprocessor_module_tests() -> . + + 4 -module +% ^ constant.numeric.integer.decimal.erlang +% ^ keyword.operator.arithmetic.erlang - keyword.declaration.namespace.erlang +% ^ constant.other.symbol.erlang - keyword.control.directive.namespace.erlang + + -module +% ^^^^^^^^ meta.preprocessor.namespace.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.namespace.erlang + + -module( +% ^^^^^^^ meta.preprocessor.namespace.erlang - meta.preprocessor.namespace.arguments.erlang +% ^^ meta.preprocessor.namespace.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.namespace.erlang +% ^ punctuation.section.arguments.begin.erlang + + -module) +% ^^^^^^^^^ meta.preprocessor.namespace.arguments.erlang +% ^ meta.preprocessor.namespace.erlang - meta.preprocessor.namespace.arguments.erlang +% ^ - entity - illegal +% ^^^^^^^ invalid.illegal.expect-atom.erlang +% ^ punctuation.section.arguments.end.erlang - entity - illegal +% ^ invalid.illegal.expect-terminator.erlang + + -module() +% ^^^^^^^ meta.preprocessor.namespace.erlang - meta.preprocessor.namespace.arguments.erlang +% ^^ meta.preprocessor.namespace.arguments.erlang +% ^ meta.preprocessor.namespace.erlang - meta.preprocessor.namespace.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.namespace.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ invalid.illegal.expect-terminator.erlang + + -module(). +% ^^^^^^^ meta.preprocessor.namespace.erlang - meta.preprocessor.namespace.arguments.erlang +% ^^ meta.preprocessor.namespace.arguments.erlang +% ^ meta.preprocessor.namespace.erlang - meta.preprocessor.namespace.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.namespace.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.terminator.clause.erlang + + -module(,) +% ^^^^^^^ meta.preprocessor.namespace.erlang - meta.preprocessor.namespace.arguments.erlang +% ^^^ meta.preprocessor.namespace.arguments.erlang +% ^ meta.preprocessor.namespace.erlang - meta.preprocessor.namespace.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.namespace.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ invalid.illegal.expect-arguments-end.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ invalid.illegal.expect-terminator.erlang + + -module(name) +% ^^^^^^^ meta.preprocessor.namespace.erlang - meta.preprocessor.namespace.arguments.erlang +% ^^^^^^ meta.preprocessor.namespace.arguments.erlang +% ^ meta.preprocessor.namespace.erlang - meta.preprocessor.namespace.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.namespace.erlang +% ^ punctuation.section.arguments.begin.erlang - entity +% ^^^^ entity.name.namespace.erlang +% ^ punctuation.section.arguments.end.erlang - entity +% ^ invalid.illegal.expect-terminator.erlang + + -module(Name) +% ^^^^^^^ meta.preprocessor.namespace.erlang - meta.preprocessor.namespace.arguments.erlang +% ^^^^^^ meta.preprocessor.namespace.arguments.erlang +% ^ meta.preprocessor.namespace.erlang - meta.preprocessor.namespace.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.namespace.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^^^^ invalid.illegal.expect-atom.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ invalid.illegal.expect-terminator.erlang + + -module('Mod-name') +% ^^^^^^^ meta.preprocessor.namespace.erlang - meta.preprocessor.namespace.arguments.erlang +% ^^^^^^^^^^^^ meta.preprocessor.namespace.arguments.erlang +% ^ meta.preprocessor.namespace.erlang - meta.preprocessor.namespace.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.namespace.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.definition.atom.begin.erlang +% ^^^^^^^^ entity.name.namespace.erlang +% ^ punctuation.definition.atom.end.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ invalid.illegal.expect-terminator.erlang + + -module(?MOD_NAME) +% ^^^^^^^ meta.preprocessor.namespace.erlang - meta.preprocessor.namespace.arguments.erlang +% ^^^^^^^^^^^ meta.preprocessor.namespace.arguments.erlang +% ^ meta.preprocessor.namespace.erlang - meta.preprocessor.namespace.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.namespace.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.definition.macro.erlang +% ^^^^^^^^^ constant.other.macro.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ invalid.illegal.expect-terminator.erlang + + -module(?'ModName') +% ^^^^^^^ meta.preprocessor.namespace.erlang - meta.preprocessor.namespace.arguments.erlang +% ^^^^^^^^^^^^ meta.preprocessor.namespace.arguments.erlang +% ^ meta.preprocessor.namespace.erlang - meta.preprocessor.namespace.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.namespace.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.definition.macro.erlang +% ^^^^^^^^^^ constant.other.macro.erlang +% ^ punctuation.definition.atom.begin.erlang +% ^ punctuation.definition.atom.end.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ invalid.illegal.expect-terminator.erlang + +% directive on_load tests + +preprocessor_onload_tests() -> . + + 4 -on_load +% ^ constant.numeric.integer.decimal.erlang +% ^ keyword.operator.arithmetic.erlang - keyword.control.directive.attribute.erlang +% ^ constant.other.symbol.erlang - keyword.control.directive.attribute.erlang + + -on_load +% ^^^^^^^^^ meta.preprocessor.attribute.erlang - meta.preprocessor.attribute.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^^ keyword.control.directive.attribute.erlang + + -on_load( +% ^^^^^^^^ meta.preprocessor.attribute.erlang - meta.preprocessor.attribute.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^^ keyword.control.directive.attribute.erlang +% ^^ meta.preprocessor.attribute.arguments.erlang +% ^ punctuation.section.arguments.begin.erlang + + -on_load) +% ^^^^^^^^^ meta.preprocessor.attribute.arguments.erlang +% ^ meta.preprocessor.attribute.erlang - meta.preprocessor.attribute.arguments.erlang +% ^^^^^^^^ - keyword.control.directive +% ^ punctuation.section.arguments.end.erlang +% ^ invalid.illegal.expect-terminator.erlang + + -on_load(function/0). +% ^^^^^^^^ meta.preprocessor.attribute.erlang - meta.preprocessor.attribute.arguments.erlang +% ^^^^^^^^^^^^ meta.preprocessor.attribute.arguments.erlang +% ^^^^^^^^ meta.reference.function.name.erlang +% ^ meta.reference.function.erlang - meta.reference.name - mete.reference.arity +% ^ meta.reference.function.arity.erlang +% ^ meta.preprocessor.attribute.erlang - meta.preprocessor.attribute.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^^ keyword.control.directive.attribute.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^^^^^^^^ variable.function.erlang +% ^ punctuation.separator.reference.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.terminator.clause.erlang + + -on_load(module:function/0). +% ^^^^^^^^ meta.preprocessor.attribute.erlang - meta.preprocessor.attribute.arguments.erlang +% ^^^^^^^^^^^^^^^^^^^ meta.preprocessor.attribute.arguments.erlang +% ^^^^^^^^^^^^^^^^^ meta.path.erlang +% ^ meta.preprocessor.attribute.erlang - meta.preprocessor.attribute.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^^ keyword.control.directive.attribute.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^^^^^^ variable.namespace.erlang +% ^^^^^^^^ variable.function.erlang +% ^ punctuation.separator.reference.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.terminator.clause.erlang + +% directive-other tests + +preprocessor_other_tests() -> . + + 4 -other +% ^ constant.numeric.integer.decimal.erlang +% ^ keyword.operator.arithmetic.erlang - keyword.declaration.other.erlang +% ^^^^^ constant.other.symbol.erlang - keyword.control.directive.attribute.erlang + + -other +% ^^^^^^^ meta.preprocessor.attribute.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^ keyword.control.directive.attribute.erlang + + -other( +% ^^^^^^ meta.preprocessor.attribute.erlang - meta.preprocessor.attribute.arguments.erlang +% ^^ meta.preprocessor.attribute.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^ keyword.control.directive.attribute.erlang +% ^ punctuation.section.arguments.begin.erlang + + -other) +% ^^^^^^^^ meta.preprocessor.attribute.arguments.erlang +% ^ meta.preprocessor.attribute.erlang - meta.preprocessor.attribute.arguments.erlang +% ^^^^^^ - keyword.control.directive.attribute.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ invalid.illegal.expect-terminator.erlang + + -other() +% ^^^^^^ meta.preprocessor.attribute.erlang - meta.preprocessor.attribute.arguments.erlang +% ^^ meta.preprocessor.attribute.arguments.erlang +% ^ meta.preprocessor.attribute.erlang - meta.preprocessor.attribute.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^ keyword.control.directive.attribute.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ invalid.illegal.expect-terminator.erlang + + -other(). +% ^^^^^^ meta.preprocessor.attribute.erlang - meta.preprocessor.attribute.arguments.erlang +% ^^ meta.preprocessor.attribute.arguments.erlang +% ^ meta.preprocessor.attribute.erlang - meta.preprocessor.attribute.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^ keyword.control.directive.attribute.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.terminator.clause.erlang + + -other(,) +% ^^^^^^ meta.preprocessor.attribute.erlang - meta.preprocessor.attribute.arguments.erlang +% ^^^ meta.preprocessor.attribute.arguments.erlang +% ^ meta.preprocessor.attribute.erlang - meta.preprocessor.attribute.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^ keyword.control.directive.attribute.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.separator.arguments.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ invalid.illegal.expect-terminator.erlang + + -other([func/?AR]). +% ^^^^^^ meta.preprocessor.attribute.erlang - meta.preprocessor.attribute.arguments.erlang +% ^ meta.preprocessor.attribute.arguments.erlang - meta.sequence.list - meta.reference +% ^ meta.preprocessor.attribute.arguments.erlang meta.sequence.list.erlang - meta.reference +% ^^^^ meta.preprocessor.attribute.arguments.erlang meta.sequence.list.erlang meta.reference.function.name.erlang +% ^ meta.preprocessor.attribute.arguments.erlang meta.sequence.list.erlang meta.reference.function.erlang +% ^^^ meta.preprocessor.attribute.arguments.erlang meta.sequence.list.erlang meta.reference.function.arity.erlang +% ^ meta.preprocessor.attribute.arguments.erlang meta.sequence.list.erlang - meta.reference +% ^ meta.preprocessor.attribute.arguments.erlang - meta.sequence.list - meta.reference +% ^ meta.preprocessor.attribute.erlang - meta.preprocessor.attribute.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^ keyword.control.directive.attribute.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.sequence.begin.erlang - variable.function +% ^^^^ variable.function.erlang +% ^ punctuation.separator.reference.erlang - variable.function +% ^ punctuation.definition.macro.erlang +% ^^^ constant.other.macro.erlang - variable.function +% ^ punctuation.section.sequence.end.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.terminator.clause.erlang + + -other Foo + bar, baz();. +% ^^^^^^^^^^^^^^^^^^^^^^^^ meta.preprocessor.attribute.erlang - meta.preprocessor.attribute.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^ keyword.control.directive.attribute.erlang +% ^^^ variable.other.erlang +% ^ keyword.operator.arithmetic.erlang +% ^^^ constant.other.symbol.erlang +% ^ punctuation.separator.expressions.erlang +% ^^^ variable.function.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ invalid.illegal.expect-terminator.erlang +% ^ punctuation.terminator.clause.erlang + + -'my-other' Foo + bar. +% ^^^^^^^^^^^^^^^^^^^^^ meta.preprocessor.attribute.erlang - meta.preprocessor.attribute.arguments.erlang +% ^ punctuation.definition.keyword.erlang +% ^ punctuation.definition.atom.begin.erlang +% ^^^^^^^^^^ keyword.control.directive.attribute.erlang +% ^ punctuation.definition.atom.end.erlang +% ^^^ variable.other.erlang +% ^ keyword.operator.arithmetic.erlang +% ^^^ constant.other.symbol.erlang +% ^ punctuation.terminator.clause.erlang + +% Function specification tests + +preprocessor_spec_tests() -> . + +5 -spec +% ^^^^ - keyword.control.directive.spec.erlang + +-spec. +%<- meta.preprocessor.spec.erlang punctuation.definition.keyword.erlang +%^^^^^ source.erlang meta.preprocessor.spec.erlang +%^^^^ keyword.control.directive.spec.erlang +- spec . +%^^^^^^^ source.erlang meta.preprocessor.spec.erlang +%^ - keyword +% ^^^^ keyword.control.directive.spec.erlang +% ^ - keyword + +-spec foo. +%^^^^^ source.erlang meta.preprocessor.spec.erlang +% ^^^ source.erlang meta.preprocessor.spec.name.erlang +% ^ source.erlang meta.preprocessor.spec.erlang +%^^^^ keyword.control.directive.spec.erlang +% ^^^ entity.name.function.erlang +% ^ punctuation.terminator.clause.erlang + +-spec foo(. +%^^^^^ source.erlang meta.preprocessor.spec.erlang +% ^^^ source.erlang meta.preprocessor.spec.name.erlang +% ^ source.erlang meta.preprocessor.spec.parameters.erlang +% ^ source.erlang meta.preprocessor.spec.erlang +%^^^^ keyword.control.directive.spec.erlang +% ^^^ entity.name.function.erlang +% ^ punctuation.section.parameters.begin.erlang +% ^ punctuation.terminator.clause.erlang + +-spec foo({. +%^^^^^ source.erlang meta.preprocessor.spec.erlang +% ^^^ source.erlang meta.preprocessor.spec.name.erlang +% ^^ source.erlang meta.preprocessor.spec.parameters.erlang +% ^ source.erlang meta.preprocessor.spec.erlang +%^^^^ keyword.control.directive.spec.erlang +% ^^^ entity.name.function.erlang +% ^ punctuation.section.parameters.begin.erlang +% ^ punctuation.section.sequence.begin.erlang +% ^ punctuation.terminator.clause.erlang + +-spec foo({{. +%^^^^^ source.erlang meta.preprocessor.spec.erlang +% ^^^ source.erlang meta.preprocessor.spec.name.erlang +% ^^^ source.erlang meta.preprocessor.spec.parameters.erlang +% ^ source.erlang meta.preprocessor.spec.erlang +%^^^^ keyword.control.directive.spec.erlang +% ^^^ entity.name.function.erlang +% ^ punctuation.section.parameters.begin.erlang +% ^^ punctuation.section.sequence.begin.erlang +% ^ punctuation.terminator.clause.erlang + +-spec foo({ -> int(). +%^^^^^ source.erlang meta.preprocessor.spec.erlang +% ^^^ source.erlang meta.preprocessor.spec.name.erlang +% ^^^ source.erlang meta.preprocessor.spec.parameters.erlang +% ^^ source.erlang meta.preprocessor.spec.erlang +% ^^^^^ source.erlang meta.preprocessor.spec.return-type.erlang +%^^^^ keyword.control.directive.spec.erlang +% ^^^ entity.name.function.erlang +% ^ punctuation.section.parameters.begin.erlang +% ^ punctuation.section.sequence.begin.erlang +% ^^ punctuation.separator.parameters-return-type.erlang +% ^^^ storage.type.erlang +% ^ punctuation.terminator.clause.erlang + +-spec foo() illegal. +%^^^^^ source.erlang meta.preprocessor.spec.erlang +% ^^^ source.erlang meta.preprocessor.spec.name.erlang - meta.preprocessor.spec.parameters - meta.preprocessor.spec.guards - meta.preprocessor.spec.return-type +% ^^ source.erlang meta.preprocessor.spec.parameters.erlang +% ^^^^^^^^^ source.erlang meta.preprocessor.spec.erlang - meta.preprocessor.spec.parameters - meta.preprocessor.spec.guards - meta.preprocessor.spec.return-type +% ^^^^^^^ invalid.illegal.expect-separator.erlang +% ^ punctuation.terminator.clause.erlang + +-spec foo() when Guard. +%^^^^^ source.erlang meta.preprocessor.spec.erlang +% ^^^ source.erlang meta.preprocessor.spec.name.erlang - meta.preprocessor.spec.parameters - meta.preprocessor.spec.guards - meta.preprocessor.spec.return-type +% ^^ source.erlang meta.preprocessor.spec.parameters.erlang +% ^ source.erlang meta.preprocessor.spec.erlang - meta.preprocessor.spec.parameters - meta.preprocessor.spec.guards - meta.preprocessor.spec.return-type +% ^^^^^^^^^^ source.erlang meta.preprocessor.spec.guards.erlang - meta.preprocessor.spec.erlang - meta.preprocessor.spec.parameters - meta.preprocessor.spec.return-type +% ^ source.erlang meta.preprocessor.spec.erlang - meta.preprocessor.spec.parameters - meta.preprocessor.spec.guards - meta.preprocessor.spec.return-type +% ^^^^ keyword.control.conditional.when.erlang +% ^^^^^ variable.other.erlang +% ^ punctuation.terminator.clause.erlang + +-spec foo(Pid) -> boolean() when Pid :: pid() | if() [term(), .... +%^^^^^ source.erlang meta.preprocessor.spec.erlang +% ^^^ source.erlang meta.preprocessor.spec.name.erlang - meta.preprocessor.spec.parameters - meta.preprocessor.spec.guards - meta.preprocessor.spec.return-type +% ^^^^^ source.erlang meta.preprocessor.spec.parameters.erlang +% ^^^ source.erlang meta.preprocessor.spec.erlang - meta.preprocessor.spec.parameters - meta.preprocessor.spec.guards - meta.preprocessor.spec.return-type +% ^^^^^^^^^^^ source.erlang meta.preprocessor.spec.return-type.erlang - meta.preprocessor.spec.erlang - meta.preprocessor.spec.parameters - meta.preprocessor.spec.guard +% ^^^^^^^^^^^^^^^^^^^^^^^^^ source.erlang meta.preprocessor.spec.guards.erlang - meta.preprocessor.spec.erlang - meta.preprocessor.spec.parameters - meta.preprocessor.spec.return-type - meta.sequence.list +% ^^^^^^^^^^^^ source.erlang meta.preprocessor.spec.guards.erlang meta.sequence.list.erlang - meta.preprocessor.spec.erlang - meta.preprocessor.spec.parameters - meta.preprocessor.spec.return-type +% ^ source.erlang meta.preprocessor.spec.erlang - meta.preprocessor.spec.parameters - meta.preprocessor.spec.guards - meta.preprocessor.spec.return-type +%^^^^ keyword.control.directive.spec.erlang +% ^^^ entity.name.function.erlang +% ^ punctuation.section.parameters.begin.erlang +% ^^^ variable.parameter.erlang +% ^ punctuation.section.parameters.end.erlang +% ^^ punctuation.separator.parameters-return-type.erlang +% ^^^^^^^ support.type.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^^^^ keyword.control.conditional.when.erlang +% ^^^ variable.other.erlang +% ^^ punctuation.separator.variable-type.erlang +% ^^^ support.type.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.separator.sequence.erlang +% ^^ invalid.illegal.keyword.erlang +% ^ punctuation.section.group.begin.erlang +% ^ punctuation.section.group.end.erlang +% ^ punctuation.section.sequence.begin.erlang +% ^^^^ support.type.erlang +% ^ punctuation.separator.sequence.erlang +% ^^^ variable.language.any.erlang +% ^ punctuation.terminator.clause.erlang + +-spec Foo. +%^^^^^ source.erlang meta.preprocessor.spec.erlang +% ^^^ source.erlang meta.preprocessor.spec.name.erlang +%^^^^ keyword.control.directive.spec.erlang +% ^^^ invalid.illegal.expect-atom.erlang +% ^ punctuation.terminator.clause.erlang + +-spec Foo() -> int(). +%^^^^^ source.erlang meta.preprocessor.spec.erlang +% ^^^ source.erlang meta.preprocessor.spec.name.erlang +% ^^ source.erlang meta.preprocessor.spec.parameters.erlang +% ^^^ source.erlang meta.preprocessor.spec.erlang +% ^^^^^^ source.erlang meta.preprocessor.spec.return-type.erlang +% ^ source.erlang meta.preprocessor.spec.erlang +%^^^^ keyword.control.directive.spec.erlang +% ^^^ invalid.illegal.expect-atom.erlang +% ^ punctuation.section.parameters.begin.erlang +% ^ punctuation.section.parameters.end.erlang +% ^^ punctuation.separator.parameters-return-type.erlang +% ^^^ storage.type.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.terminator.clause.erlang + +-spec mod:foo({X, integer()}) -> X when X :: atom() +%^^^^^ source.erlang meta.preprocessor.spec.erlang - meta.path +% ^^^^^^^ source.erlang meta.preprocessor.spec.name.erlang meta.path.erlang +% ^^^^^^^^^^^^^^^^ source.erlang meta.preprocessor.spec.parameters.erlang - meta.path +% ^^^ source.erlang meta.preprocessor.spec.erlang +% ^^^ source.erlang meta.preprocessor.spec.return-type.erlang +% ^^^^^^^^^^^^^^^^^ source.erlang meta.preprocessor.spec.guards.erlang +% ^^^ variable.namespace.erlang +% ^ punctuation.accessor.double-colon.erlang +% ^^^ entity.name.function.erlang + + ; mod:foo(X::string()) -> int() +% ^^ source.erlang meta.preprocessor.spec.erlang - meta.path +% ^^^^^^^ source.erlang meta.preprocessor.spec.name.erlang meta.path.erlang +% ^^^^^^^^^^^^^ source.erlang meta.preprocessor.spec.parameters.erlang - meta.path +% ^^^ source.erlang meta.preprocessor.spec.erlang +% ^^^^^^ source.erlang meta.preprocessor.spec.return-type.erlang +% ^ punctuation.separator.clauses.erlang +% ^^^ variable.namespace.erlang +% ^ punctuation.accessor.double-colon.erlang +% ^^^ entity.name.function.erlang + + ; ?mod:?foo(X::string()) -> int() +% ^^ source.erlang meta.preprocessor.spec.erlang - meta.path +% ^^^^^^^^^ source.erlang meta.preprocessor.spec.name.erlang meta.path.erlang +% ^^^^^^^^^^^^^ source.erlang meta.preprocessor.spec.parameters.erlang - meta.path +% ^^^ source.erlang meta.preprocessor.spec.erlang +% ^^^^^^ source.erlang meta.preprocessor.spec.return-type.erlang +% ^ punctuation.separator.clauses.erlang +% ^^^^ constant.other.macro.erlang +% ^ punctuation.accessor.double-colon.erlang +% ^^^^ constant.other.macro.erlang + + ; ([Y]) -> Y when Y :: number(). +% ^^ source.erlang meta.preprocessor.spec.erlang +% ^^^^^ source.erlang meta.preprocessor.spec.parameters.erlang +% ^^^ source.erlang meta.preprocessor.spec.erlang +% ^^ source.erlang meta.preprocessor.spec.return-type.erlang +% ^^^^^^^^^^^^^^^^^^ source.erlang meta.preprocessor.spec.guards.erlang +% ^ source.erlang meta.preprocessor.spec.erlang +% ^ - meta.preprocessor.spec +% ^ punctuation.separator.clauses.erlang + +-spec 'F\1':'\2r'() -> int(). +% ^^^^^ source.erlang meta.preprocessor.spec.name.erlang meta.path.erlang variable.namespace +% ^ source.erlang meta.preprocessor.spec.name.erlang meta.path.erlang punctuation.accessor.double-colon.erlang +% ^^^^^ source.erlang meta.preprocessor.spec.name.erlang meta.path.erlang entity.name.function.erlang +% ^^ source.erlang meta.preprocessor.spec.parameters.erlang +% ^^^ source.erlang meta.preprocessor.spec.erlang - meta.preprocessor.spec.parameters - meta.preprocessor.spec.return-type +% ^^^^^^ source.erlang meta.preprocessor.spec.return-type.erlang +% ^ - meta.preprocessor + +-spec ?MODULE:. +%^^^^^ source.erlang meta.preprocessor.spec.erlang +% ^^^^^^^^ source.erlang meta.preprocessor.spec.name.erlang meta.path.erlang +% ^ source.erlang meta.preprocessor.spec.erlang +%^^^^ keyword.control.directive.spec.erlang +% ^ punctuation.definition.macro.erlang +% ^^^^^^^ constant.language.macro.erlang +% ^ punctuation.accessor.double-colon.erlang +% ^ punctuation.terminator.clause.erlang + +-spec ?MODULE:foo. +%^^^^^ source.erlang meta.preprocessor.spec.erlang +% ^^^^^^^^^^^ source.erlang meta.preprocessor.spec.name.erlang meta.path.erlang +% ^ source.erlang meta.preprocessor.spec.erlang +%^^^^ keyword.control.directive.spec.erlang +% ^ punctuation.definition.macro.erlang +% ^^^^^^^ constant.language.macro.erlang +% ^ punctuation.accessor.double-colon.erlang +% ^^^ entity.name.function.erlang +% ^ punctuation.terminator.clause.erlang + +-spec ?MODULE:?FUNCTION_NAME() -> int(). +% ^^^^^^^ source.erlang meta.preprocessor.spec.name.erlang meta.path.erlang constant.language.macro.erlang +% ^ source.erlang meta.preprocessor.spec.name.erlang meta.path.erlang punctuation.accessor.double-colon.erlang +% ^^^^^^^^^^^^^^ source.erlang meta.preprocessor.spec.name.erlang meta.path.erlang constant.language.macro.erlang +% ^^ source.erlang meta.preprocessor.spec.parameters.erlang +% ^^^ source.erlang meta.preprocessor.spec.erlang - meta.preprocessor.spec.parameters - meta.preprocessor.spec.return-type +% ^^^^^^ source.erlang meta.preprocessor.spec.return-type.erlang +% ^ - meta.preprocessor + +-spec ?FOO:?BAR() -> int(). +% ^^^^ source.erlang meta.preprocessor.spec.name.erlang meta.path.erlang constant.other.macro.erlang +% ^ source.erlang meta.preprocessor.spec.name.erlang meta.path.erlang punctuation.accessor.double-colon.erlang +% ^^^^ source.erlang meta.preprocessor.spec.name.erlang meta.path.erlang constant.other.macro.erlang +% ^^ source.erlang meta.preprocessor.spec.parameters.erlang +% ^^^ source.erlang meta.preprocessor.spec.erlang - meta.preprocessor.spec.parameters - meta.preprocessor.spec.return-type +% ^^^^^^ source.erlang meta.preprocessor.spec.return-type.erlang +% ^ - meta.preprocessor + +-spec 'fun-\nabled' ( Tag :: trace_status, +%^^^^^ source.erlang meta.preprocessor.spec.erlang +% ^^^^^^^^^^^^^^ source.erlang meta.preprocessor.spec.name.erlang - meta.preprocessor.spec.parameters +% ^^^^^^^^^^^^^^^^^^^^^^^ source.erlang meta.preprocessor.spec.parameters.erlang +%^^^^ keyword.control.directive.spec.erlang +% ^ punctuation.definition.atom.begin.erlang +% ^^^^^^^^^^^ entity.name.function.erlang +% ^ punctuation.definition.atom.end.erlang +% ^ punctuation.section.parameters.begin.erlang +% ^^^ variable.parameter.erlang +% ^^ punctuation.separator.variable-type.erlang +% ^^^^^^^^^^^^ constant.other.symbol.erlang +% ^ punctuation.separator.parameters.erlang + Tracee :: tracee()) -> +% ^^^^^^^^^^^^^^^^^^^^ source.erlang meta.preprocessor.spec.parameters.erlang - meta.preprocessor.spec.return-type.erlang +% ^^^ source.erlang meta.preprocessor.spec.erlang - meta.preprocessor.spec.parameters.erlang - meta.preprocessor.spec.return-type.erlang +% ^ source.erlang meta.preprocessor.spec.return-type.erlang +% ^^^^^^ variable.parameter.erlang +% ^^ punctuation.separator.variable-type.erlang +% ^^^^^^ storage.type.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.section.parameters.end.erlang +% ^^ punctuation.separator.parameters-return-type.erlang + trace | remove; +% ^^^^^^^^^^^^^^^ source.erlang meta.preprocessor.spec.return-type.erlang +% ^ source.erlang meta.preprocessor.spec.erlang +% ^^^^^ constant.other.symbol.erlang +% ^ punctuation.separator.sequence.erlang +% ^^^^^^ constant.other.symbol.erlang +% ^ punctuation.separator.clauses.erlang + ( +% ^ source.erlang meta.preprocessor.spec.parameters.erlang punctuation.section.parameters.begin.erlang + Tag :: trace_tag() | seq_trace, +% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.erlang meta.preprocessor.spec.parameters.erlang +% ^^^^^^^^^ meta.type-call.name.erlang +% ^^ meta.type-call.arguments.erlang +% ^^ source.erlang meta.preprocessor.spec.parameters.erlang +% ^^^ variable.parameter.erlang +% ^^ punctuation.separator.variable-type.erlang +% ^ storage.type.erlang +% ^ punctuation.separator.sequence.erlang +% ^^^^^^^^^ constant.other.symbol.erlang +% ^ punctuation.separator.parameters.erlang + Tracee :: tracee() +% ^^^^^^ variable.parameter.erlang +% ^^ punctuation.separator.variable-type.erlang +% ^ storage.type.erlang + ) -> +% ^ source.erlang meta.preprocessor.spec.parameters.erlang +% ^^^ source.erlang meta.preprocessor.spec.erlang - meta.preprocessor.spec.parameters.erlang - meta.preprocessor.spec.return-type.erlang +% ^ source.erlang meta.preprocessor.spec.return-type.erlang +% ^ punctuation.section.parameters.end.erlang + trace | discard when +% ^^^^^^^^^^^^^^^^^ source.erlang meta.preprocessor.spec.return-type.erlang +% ^^^^^ source.erlang meta.preprocessor.spec.guards.erlang +% ^^^^^ constant.other.symbol.erlang +% ^ punctuation.separator.sequence.erlang +% ^^^^^^^ constant.other.symbol.erlang +% ^^^^ keyword.control.conditional.when.erlang + Tag :: string(), +% ^^^^^^^^^^^^^^^^^^ source.erlang meta.preprocessor.spec.guards.erlang +% ^^^^^^ meta.type-call.name.erlang - meta.type-call.arguments.erlang +% ^^ meta.type-call.arguments.erlang +% ^^^ variable.other.erlang +% ^^ punctuation.separator.variable-type.erlang +% ^^^^^^ support.type.erlang +% ^ punctuation.separator.expressions.erlang + Tracee :: 2..36. +% ^^^^^^^^^^^^^^^^ source.erlang meta.preprocessor.spec.guards.erlang +% ^ source.erlang meta.preprocessor.spec.erlang - meta.function +% ^^^^^^ variable.other.erlang +% ^^ punctuation.separator.variable-type.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^^ punctuation.separator.range.erlang +% ^^ constant.numeric.integer.decimal.erlang +% ^ punctuation.terminator.clause.erlang + +% Typing tests + +preprocessor_type_tests() -> . + +5 -type +% ^^^^ - keyword.control.directive.type.erlang + +-type. +% <- source.erlang meta.preprocessor.type.erlang punctuation.definition.keyword.erlang - keyword +%^^^^^ source.erlang meta.preprocessor.type.erlang +%^^^^ keyword.control.directive.type.erlang + +- type . +% <- source.erlang meta.preprocessor.type.erlang punctuation.definition.keyword.erlang - keyword +%^^^^^^^ source.erlang meta.preprocessor.type.erlang +% ^ - meta.preprocessor +%^ - keyword +% ^^^^ keyword.control.directive.type.erlang +% ^ - keyword + +-type (. +% <- source.erlang meta.preprocessor.type.erlang punctuation.definition.keyword.erlang - keyword +%^^^^^ source.erlang meta.preprocessor.type.erlang +% ^ source.erlang meta.preprocessor.type.parameters.erlang +% ^ source.erlang meta.preprocessor.type.erlang +% ^ - meta.preprocessor - invalid +%^^^^ keyword.control.directive.type.erlang +% ^ punctuation.section.parameters.begin.erlang +% ^ punctuation.terminator.clause.erlang + +-type (.) +% <- source.erlang meta.preprocessor.type.erlang punctuation.definition.keyword.erlang - keyword +%^^^^^ source.erlang meta.preprocessor.type.erlang +% ^ source.erlang meta.preprocessor.type.parameters.erlang +% ^ source.erlang meta.preprocessor.type.erlang +%^^^^ keyword.control.directive.type.erlang +% ^ punctuation.section.parameters.begin.erlang +% ^ punctuation.terminator.clause.erlang +% ^ invalid.illegal.stray.erlang - meta.preprocessor + +-type (2.4). +% <- source.erlang meta.preprocessor.type.erlang punctuation.definition.keyword.erlang - keyword +%^^^^^ source.erlang meta.preprocessor.type.erlang +% ^^^^^ source.erlang meta.preprocessor.type.parameters.erlang +% ^ source.erlang meta.preprocessor.type.erlang +%^^^^ keyword.control.directive.type.erlang +% ^ punctuation.section.parameters.begin.erlang +% ^^^ constant.numeric.float.decimal.erlang +% ^ punctuation.terminator.clause.erlang + +-type [. +% <- source.erlang meta.preprocessor.type.erlang punctuation.definition.keyword.erlang - keyword +%^^^^^^^ source.erlang meta.preprocessor.type.erlang +% ^ - meta.preprocessor - invalid +%^^^^ keyword.control.directive.type.erlang +% ^ invalid.illegal.unexpected-list.erlang +% ^ punctuation.terminator.clause.erlang + +-type [.] +% <- source.erlang meta.preprocessor.type.erlang punctuation.definition.keyword.erlang - keyword +%^^^^^^^ source.erlang meta.preprocessor.type.erlang +%^^^^ keyword.control.directive.type.erlang +% ^ invalid.illegal.unexpected-list.erlang +% ^ punctuation.terminator.clause.erlang +% ^ invalid.illegal.stray.erlang - meta.preprocessor + +-type [1.]. +% <- source.erlang meta.preprocessor.type.erlang punctuation.definition.keyword.erlang - keyword +%^^^^^^^^^^ source.erlang meta.preprocessor.type.erlang +% ^ - meta.preprocessor - invalid +%^^^^ keyword.control.directive.type.erlang +% ^^^^ invalid.illegal.unexpected-list.erlang +% ^ punctuation.terminator.clause.erlang + +-type {. +% <- source.erlang meta.preprocessor.type.erlang punctuation.definition.keyword.erlang - keyword +%^^^^^^^ source.erlang meta.preprocessor.type.erlang +% ^ - meta.preprocessor - invalid +%^^^^ keyword.control.directive.type.erlang +% ^ invalid.illegal.unexpected-tuple.erlang +% ^ punctuation.terminator.clause.erlang +-type {.} +% <- source.erlang meta.preprocessor.type.erlang punctuation.definition.keyword.erlang - keyword +%^^^^^^^ source.erlang meta.preprocessor.type.erlang +%^^^^ keyword.control.directive.type.erlang +% ^ invalid.illegal.unexpected-tuple.erlang +% ^ punctuation.terminator.clause.erlang +% ^ invalid.illegal.stray.erlang - meta.preprocessor +-type {2.4}. +% <- source.erlang meta.preprocessor.type.erlang punctuation.definition.keyword.erlang - keyword +%^^^^^^^^^^^ source.erlang meta.preprocessor.type.erlang +% ^ - meta.preprocessor - invalid +%^^^^ keyword.control.directive.type.erlang +% ^^^^^ invalid.illegal.unexpected-tuple.erlang +% ^ punctuation.terminator.clause.erlang + +-type Foo. +% <- source.erlang meta.preprocessor.type.erlang punctuation.definition.keyword.erlang - keyword +%^^^^^ source.erlang meta.preprocessor.type.erlang +% ^^^ source.erlang meta.preprocessor.type.name.erlang +% ^ source.erlang meta.preprocessor.type.erlang +% ^ - meta.preprocessor +%^^^^ keyword.control.directive.type.erlang +% ^^^ invalid.illegal.expect-atom.erlang +% ^ punctuation.terminator.clause.erlang + +-type Foo :: int(). +% <- source.erlang meta.preprocessor.type.erlang punctuation.definition.keyword.erlang - keyword +%^^^^^ source.erlang meta.preprocessor.type.erlang +% ^^^^ source.erlang meta.preprocessor.type.name.erlang +% ^^^^^^^^^ source.erlang meta.preprocessor.type.erlang +% ^ - meta.preprocessor +%^^^^ keyword.control.directive.type.erlang +% ^^^ invalid.illegal.expect-atom.erlang +% ^^ punctuation.separator.type-head-body.erlang +% ^^^ storage.type.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.terminator.clause.erlang + +-type foo. +% <- source.erlang meta.preprocessor.type.erlang punctuation.definition.keyword.erlang - keyword +% ^^^ source.erlang meta.preprocessor.type.name.erlang +% ^ source.erlang meta.preprocessor.type.erlang +% ^ - meta.preprocessor +%^^^^ keyword.control.directive.type.erlang +% ^^^ entity.name.type.erlang +% ^ punctuation.terminator.clause.erlang + +-type foo ::. +% <- source.erlang meta.preprocessor.type.erlang punctuation.definition.keyword.erlang - keyword +%^^^^^ source.erlang meta.preprocessor.type.erlang +% ^^^^ source.erlang meta.preprocessor.type.name.erlang +% ^^^ source.erlang meta.preprocessor.type.erlang +% ^ - meta.preprocessor +%^^^^ keyword.control.directive.type.erlang +% ^^^ entity.name.type.erlang +% ^^ punctuation.separator.type-head-body.erlang +% ^ punctuation.terminator.clause.erlang + +-type foo(). +% <- source.erlang meta.preprocessor.type.erlang punctuation.definition.keyword.erlang - keyword +%^^^^^ source.erlang meta.preprocessor.type.erlang +% ^^^ source.erlang meta.preprocessor.type.name.erlang +% ^^ source.erlang meta.preprocessor.type.parameters.erlang +% ^ source.erlang meta.preprocessor.type.erlang +% ^ - meta.preprocessor +%^^^^ keyword.control.directive.type.erlang +% ^^^ entity.name.type.erlang +% ^ punctuation.section.parameters.begin.erlang +% ^ punctuation.section.parameters.end.erlang +% ^ punctuation.terminator.clause.erlang + +-type foo()::. +% <- source.erlang meta.preprocessor.type.erlang punctuation.definition.keyword.erlang - keyword +%^^^^^ source.erlang meta.preprocessor.type.erlang +% ^^^ source.erlang meta.preprocessor.type.name.erlang +% ^^ source.erlang meta.preprocessor.type.parameters.erlang +% ^^^ source.erlang meta.preprocessor.type.erlang +% ^ - meta.preprocessor +%^^^^ keyword.control.directive.type.erlang +% ^^^ entity.name.type.erlang +% ^ punctuation.section.parameters.begin.erlang +% ^ punctuation.section.parameters.end.erlang +% ^^ punctuation.separator.type-head-body.erlang +% ^ punctuation.terminator.clause.erlang + +-type foo( :: int( . +% <- source.erlang meta.preprocessor.type.erlang punctuation.definition.keyword.erlang - keyword +%^^^^^ source.erlang meta.preprocessor.type.erlang +% ^^^ source.erlang meta.preprocessor.type.name.erlang +% ^^^^^^^^^^ source.erlang meta.preprocessor.type.parameters.erlang +% ^ source.erlang meta.preprocessor.type.erlang +% ^ - meta.preprocessor +%^^^^ keyword.control.directive.type.erlang +% ^^^ entity.name.type.erlang +% ^ punctuation.section.parameters.begin.erlang +% ^^ punctuation.separator.variable-type.erlang +% ^^^ storage.type.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.terminator.clause.erlang + +-type foo() illegal. +% <- source.erlang meta.preprocessor.type.erlang punctuation.definition.keyword.erlang - keyword +%^^^^^ source.erlang meta.preprocessor.type.erlang +% ^^^ source.erlang meta.preprocessor.type.name.erlang +% ^^ source.erlang meta.preprocessor.type.parameters.erlang +% ^^^^^^^^^ source.erlang meta.preprocessor.type.erlang +% ^ - meta.preprocessor +%^^^^ keyword.control.directive.type.erlang +% ^^^ entity.name.type.erlang +% ^ punctuation.section.parameters.begin.erlang +% ^ punctuation.section.parameters.end.erlang +% ^^^^^^^ invalid.illegal.expect-separator.erlang +% ^ punctuation.terminator.clause.erlang + +-type :: int(). +% <- source.erlang meta.preprocessor.type.erlang punctuation.definition.keyword.erlang - keyword +%^^^^^^^^^^^^^^ source.erlang meta.preprocessor.type.erlang +%^^^^ keyword.control.directive.type.erlang +% ^^ punctuation.separator.type-head-body.erlang +% ^^^ storage.type.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.terminator.clause.erlang + +-type map() :: #{ . +% <- source.erlang meta.preprocessor.type.erlang punctuation.definition.keyword.erlang - keyword +%^^^^^ source.erlang meta.preprocessor.type.erlang +% ^^^ source.erlang meta.preprocessor.type.name.erlang +% ^^ source.erlang meta.preprocessor.type.parameters.erlang +% ^^^^^^^ source.erlang meta.preprocessor.type.erlang +% ^ punctuation.terminator.clause.erlang - meta.mapping +% ^ - meta.preprocessor + +-type map() :: #{ term( . +% <- source.erlang meta.preprocessor.type.erlang punctuation.definition.keyword.erlang - keyword +%^^^^^ source.erlang meta.preprocessor.type.erlang +% ^^^ source.erlang meta.preprocessor.type.name.erlang +% ^^ source.erlang meta.preprocessor.type.parameters.erlang +% ^^^^^^^^^^^^^ source.erlang meta.preprocessor.type.erlang +% ^ punctuation.terminator.clause.erlang - meta.mapping +% ^ - meta.preprocessor + +-type map() :: #{ _ => _ . +% <- source.erlang meta.preprocessor.type.erlang punctuation.definition.keyword.erlang - keyword +%^^^^^ source.erlang meta.preprocessor.type.erlang +% ^^^ source.erlang meta.preprocessor.type.name.erlang +% ^^ source.erlang meta.preprocessor.type.parameters.erlang +% ^^^^^^^^^^^^^^^ source.erlang meta.preprocessor.type.erlang +% ^ punctuation.terminator.clause.erlang - meta.mapping +% ^ - meta.preprocessor + +-type Map() :: #{any() => Any}. +% <- source.erlang meta.preprocessor.type.erlang punctuation.definition.keyword.erlang - keyword +%^^^^^ source.erlang meta.preprocessor.type.erlang +% ^^^ source.erlang meta.preprocessor.type.name.erlang +% ^^ source.erlang meta.preprocessor.type.parameters.erlang +% ^^^^^^^^^^^^^^^^^^^^ source.erlang meta.preprocessor.type.erlang +% ^^ meta.mapping.erlang - meta.mapping.key.erlang - meta.mapping.value.erlang +% ^^^^^^ meta.mapping.key.erlang - meta.mapping.erlang - meta.mapping.value.erlang +% ^^^ meta.type-call.name.erlang - meta.type-call.arguments.erlang +% ^^ meta.type-call.arguments.erlang - meta.type-call.name.erlang +% ^^ meta.mapping.erlang - meta.mapping.key.erlang - meta.mapping.value.erlang +% ^^^^ meta.mapping.value.erlang - meta.mapping.erlang - meta.mapping.key.erlang +% ^ meta.mapping.erlang - meta.mapping.key.erlang - meta.mapping.value.erlang +% ^ - meta.mapping +% ^ - meta.preprocessor +%^^^^ keyword.control.directive.type.erlang +% ^^^ invalid.illegal.expect-atom.erlang +% ^ punctuation.section.parameters.begin.erlang +% ^ punctuation.section.parameters.end.erlang +% ^^ punctuation.separator.type-head-body.erlang +% ^^ punctuation.section.mapping.begin.erlang +% ^^^ support.type.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^^ punctuation.separator.mapping.key-value.erlang +% ^^^ variable.other.erlang +% ^ punctuation.section.mapping.end.erlang +% ^ punctuation.terminator.clause.erlang + +-type map() :: #{ _ => _ }. +% <- source.erlang meta.preprocessor.type.erlang punctuation.definition.keyword.erlang - keyword +%^^^^^ source.erlang meta.preprocessor.type.erlang +% ^^^ source.erlang meta.preprocessor.type.name.erlang +% ^^ source.erlang meta.preprocessor.type.parameters.erlang +% ^^^^^^^^^^^^^^^^ source.erlang meta.preprocessor.type.erlang +% ^^ meta.mapping.erlang - meta.mapping.key.erlang - meta.mapping.value.erlang +% ^^^ meta.mapping.key.erlang - meta.mapping.erlang - meta.mapping.value.erlang +% ^^ meta.mapping.erlang - meta.mapping.key.erlang - meta.mapping.value.erlang +% ^^^ meta.mapping.value.erlang - meta.mapping.erlang - meta.mapping.key.erlang +% ^ meta.mapping.erlang - meta.mapping.key.erlang - meta.mapping.value.erlang +% ^ - meta.type - meta.mapping +% ^ - meta.preprocessor +% ^^^ entity.name.type.erlang +% ^ punctuation.section.parameters.begin.erlang +% ^ punctuation.section.parameters.end.erlang +% ^^ punctuation.separator.type-head-body.erlang +% ^^ punctuation.section.mapping.begin.erlang +% ^ variable.language.anonymous.erlang +% ^^ punctuation.separator.mapping.key-value.erlang +% ^ variable.language.anonymous.erlang +% ^ punctuation.section.mapping.end.erlang +% ^ punctuation.terminator.clause.erlang + +-type foo() :: {term(. +% ^^^^^^ source.erlang meta.preprocessor.type.erlang meta.sequence.tuple.erlang +% ^ source.erlang meta.preprocessor.type.erlang punctuation.terminator.clause.erlang - meta.sequence.tuple.erlang + +-type foo() :: {term(). +% ^^^^^^^ source.erlang meta.preprocessor.type.erlang meta.sequence.tuple.erlang +% ^ source.erlang meta.preprocessor.type.erlang punctuation.terminator.clause.erlang - meta.sequence.tuple.erlang + +-type foo() :: {term(1.5). +% ^^^^^^^^^^ source.erlang meta.preprocessor.type.erlang meta.sequence.tuple.erlang +% ^ source.erlang meta.preprocessor.type.erlang punctuation.terminator.clause.erlang - meta.sequence.tuple.erlang + +-type foo() :: {term({{). +% ^^^^^^^^^ source.erlang meta.preprocessor.type.erlang meta.sequence.tuple.erlang +% ^^ punctuation.section.sequence.begin.erlang +% ^ invalid.illegal.stray.erlang +% ^ source.erlang meta.preprocessor.type.erlang punctuation.terminator.clause.erlang - meta.sequence.tuple.erlang + +-type foo() :: {term(), int( }. +% ^^^^^^^^^^^^^^^ source.erlang meta.preprocessor.type.erlang meta.sequence.tuple.erlang +% ^^^ meta.type-call.arguments.erlang +% ^ invalid.illegal.stray.erlang +% ^ source.erlang meta.preprocessor.type.erlang punctuation.terminator.clause.erlang - meta.sequence.tuple.erlang + +-type foo() :: {term(), int()}. +% ^^^^^^^^^^^^^^^ source.erlang meta.preprocessor.type.erlang meta.sequence.tuple.erlang +% ^ source.erlang meta.preprocessor.type.erlang punctuation.terminator.clause.erlang - meta.sequence.tuple.erlang + +-type m_int(ListItem, Term) :: integer() +% <- source.erlang meta.preprocessor.type.erlang punctuation.definition.keyword.erlang - keyword +%^^^^^ source.erlang meta.preprocessor.type.erlang +% ^^^^^ source.erlang meta.preprocessor.type.name.erlang +% ^^^^^^^^^^^^^^^^ source.erlang meta.preprocessor.type.parameters.erlang +% ^^^^^^^^^^^^^ source.erlang meta.preprocessor.type.erlang +%^^^^ keyword.control.directive.type.erlang +% ^^^^^ entity.name.type.erlang +% ^ punctuation.section.parameters.begin.erlang +% ^^^^^^^^ variable.parameter.erlang +% ^ punctuation.separator.parameters.erlang +% ^^^^ variable.parameter.erlang +% ^ punctuation.section.parameters.end.erlang +% ^^ punctuation.separator.type-head-body.erlang +% ^^^^^^^ support.type.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang + | 20 +% ^ punctuation.separator.sequence.erlang +% ^^ constant.numeric.integer.decimal.erlang + | 100..50 %% specifies an integer range +% ^ punctuation.separator.sequence.erlang +% ^^^ constant.numeric.integer.decimal.erlang +% ^^ punctuation.separator.range.erlang +% ^^ constant.numeric.integer.decimal.erlang + | [ ListItem | erlang:integer() | {list(any()), Term} ]. +% ^ punctuation.separator.sequence.erlang +% ^ - meta.sequence +% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.sequence.list.erlang - meta.sequence.tuple.erlang +% ^^^^^^^ source.erlang meta.preprocessor.type.erlang meta.path.erlang - meta.type-call +% ^^^^^^^ source.erlang meta.preprocessor.type.erlang meta.path.erlang meta.type-call.name.erlang - meta.type-call.arguments.erlang +% ^^ source.erlang meta.preprocessor.type.erlang meta.type-call.arguments.erlang - meta.type-call.name.erlang +% ^^^^^^^^^^^^^^^^^^^ meta.sequence.list.erlang meta.sequence.tuple.erlang +% ^^ meta.sequence.list.erlang - meta.sequence.tuple.erlang +% ^ - meta.type - meta.sequence +% ^ punctuation.section.sequence.begin.erlang +% ^^^^^^^^ variable.other.erlang +% ^ punctuation.separator.sequence.erlang +% ^^^^^^ support.namespace.erlang +% ^ punctuation.accessor.double-colon.erlang +% ^^^^^^^ support.type.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.separator.sequence.erlang +% ^ punctuation.section.sequence.begin.erlang +% ^^^^ support.type.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^^^ support.type.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^^ punctuation.section.arguments.end.erlang +% ^ punctuation.separator.sequence.erlang +% ^^^^ variable.other.erlang +% ^ punctuation.section.sequence.end.erlang +% ^ punctuation.section.sequence.end.erlang +% ^ punctuation.terminator.clause.erlang + +preprocessor_fun_type_tests() -> . + +-type fun() :: fun(). +% ^^^ entity.name.type.erlang +% ^ - meta.type-call +% ^^^ source.erlang meta.preprocessor.type.erlang meta.type-call.name.erlang - meta.type-call.arguments - meta.fun +% ^^ source.erlang meta.preprocessor.type.erlang meta.type-call.arguments.erlang - meta.type-call.name.erlang - meta.fun +% ^ - meta.type-call +% ^^^ support.type.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.terminator.clause.erlang + +-type fun() :: fun(()). +% ^ - meta.type-call +% ^^^ source.erlang meta.preprocessor.type.erlang meta.type-call.name.erlang - meta.type-call.arguments - meta.fun +% ^ source.erlang meta.preprocessor.type.erlang meta.type-call.arguments.erlang - meta.type-call.name.erlang - meta.fun +% ^^ source.erlang meta.preprocessor.type.erlang meta.type-call.arguments.erlang meta.fun.parameters.erlang +% ^ source.erlang meta.preprocessor.type.erlang meta.type-call.arguments.erlang - meta.type-call.name.erlang - meta.fun +% ^ - meta.type-call +% ^^^ support.type.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.parameters.begin.erlang +% ^ punctuation.section.parameters.end.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.terminator.clause.erlang + +-type fun() :: fun( -> () ). +% ^^^^^^^^^ source.erlang meta.preprocessor.type.erlang meta.type-call.arguments.erlang +% ^^ punctuation.separator.parameters-return-type.erlang +% ^^ meta.fun.return-type.erlang meta.group.erlang + +-type fun() :: fun( () () ). +% ^^^^^^^^^ source.erlang meta.preprocessor.type.erlang meta.type-call.arguments.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^^ meta.fun.parameters.erlang +% ^^ invalid.illegal.unexpected-group.erlang +% ^ punctuation.section.arguments.end.erlang + +-type fun() :: fun(() -> int()). +% ^^^ source.erlang meta.preprocessor.type.erlang meta.type-call.name.erlang - meta.type-call.arguments.erlang +% ^ source.erlang meta.preprocessor.type.erlang meta.type-call.arguments.erlang - meta.type-call.name.erlang - meta.fun.parameters.erlang +% ^^ source.erlang meta.preprocessor.type.erlang meta.type-call.arguments.erlang meta.fun.parameters.erlang +% ^^^ source.erlang meta.preprocessor.type.erlang meta.type-call.arguments.erlang - meta.fun.parameters.erlang - meta.fun.return-type.erlang +% ^ source.erlang meta.preprocessor.type.erlang meta.type-call.arguments.erlang meta.fun.return-type.erlang - meta.type-call.name.erlang - meta.type-call.arguments.erlang meta.type-call.arguments.erlang +% ^^^ source.erlang meta.preprocessor.type.erlang meta.type-call.arguments.erlang meta.fun.return-type.erlang - meta.type-call.arguments.erlang meta.type-call.arguments.erlang +% ^^ source.erlang meta.preprocessor.type.erlang meta.type-call.arguments.erlang meta.fun.return-type.erlang meta.type-call.arguments.erlang +% ^ source.erlang meta.preprocessor.type.erlang meta.type-call.arguments.erlang - meta.fun.parameters.erlang - meta.fun.return-type.erlang +% ^^^ support.type.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.parameters.begin.erlang +% ^ punctuation.section.parameters.end.erlang +% ^^ punctuation.separator.parameters-return-type.erlang +% ^^^ storage.type.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.terminator.clause.erlang + +-type fun() :: fun((...) -> int()). +% ^^^ source.erlang meta.preprocessor.type.erlang meta.type-call.name.erlang - meta.type-call.arguments.erlang +% ^ source.erlang meta.preprocessor.type.erlang meta.type-call.arguments.erlang - meta.type-call.name.erlang - meta.fun.parameters.erlang +% ^^^^^ source.erlang meta.preprocessor.type.erlang meta.type-call.arguments.erlang meta.fun.parameters.erlang +% ^^^ source.erlang meta.preprocessor.type.erlang meta.type-call.arguments.erlang - meta.fun.parameters.erlang - meta.fun.return-type.erlang +% ^ source.erlang meta.preprocessor.type.erlang meta.type-call.arguments.erlang meta.fun.return-type.erlang - meta.type-call.name.erlang - meta.type-call.arguments.erlang meta.type-call.arguments.erlang +% ^^^ source.erlang meta.preprocessor.type.erlang meta.type-call.arguments.erlang meta.fun.return-type.erlang meta.type-call.name.erlang - meta.type-call.arguments.erlang meta.type-call.arguments.erlang +% ^^ source.erlang meta.preprocessor.type.erlang meta.type-call.arguments.erlang meta.fun.return-type.erlang meta.type-call.arguments.erlang +% ^ source.erlang meta.preprocessor.type.erlang meta.type-call.arguments.erlang - meta.fun.parameters.erlang - meta.fun.return-type.erlang +% ^^^ support.type.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.parameters.begin.erlang +% ^^^ variable.language.any.erlang +% ^ punctuation.section.parameters.end.erlang +% ^^ punctuation.separator.parameters-return-type.erlang +% ^^^ storage.type.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.terminator.clause.erlang + +-type fun() :: fun( ( Key , int () , AccIn :: bool () ) -> AccOut :: void() ) . +% ^^^ source.erlang meta.preprocessor.type.erlang meta.type-call.name.erlang +% ^^ source.erlang meta.preprocessor.type.erlang meta.type-call.arguments.erlang - meta.type-call.name.erlang - meta.fun.parameters.erlang +% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.erlang meta.preprocessor.type.erlang meta.type-call.arguments.erlang meta.fun.parameters.erlang +% ^^^ source.erlang meta.preprocessor.type.erlang meta.type-call.arguments.erlang - meta.fun.parameters.erlang - meta.fun.return-type.erlang +% ^^^^^^^^^^^ source.erlang meta.preprocessor.type.erlang meta.type-call.arguments.erlang meta.fun.return-type.erlang +% ^^^^ source.erlang meta.preprocessor.type.erlang meta.type-call.arguments.erlang meta.fun.return-type.erlang meta.type-call.name.erlang +% ^^ source.erlang meta.preprocessor.type.erlang meta.type-call.arguments.erlang meta.fun.return-type.erlang meta.type-call.arguments.erlang +% ^ source.erlang meta.preprocessor.type.erlang meta.type-call.arguments.erlang meta.fun.return-type.erlang +% ^ source.erlang meta.preprocessor.type.erlang meta.type-call.arguments.erlang - meta.fun.parameters.erlang - meta.fun.return-type.erlang +% ^^^ support.type.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^^^ variable.parameter.erlang +% ^ punctuation.separator.parameters.erlang +% ^^^ storage.type.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.separator.parameters.erlang +% ^^^^^ variable.parameter.erlang +% ^^ punctuation.separator.variable-type.erlang +% ^^^^ storage.type.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.section.parameters.end.erlang +% ^^ punctuation.separator.parameters-return-type.erlang +% ^^^^^^ variable.other.erlang +% ^^ punctuation.separator.variable-type.erlang +% ^^^^ storage.type.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.section.arguments.end.erlang + +% Record tests + +preprocessor_record_tests() -> . + + -record +% ^^^^^^^^ meta.preprocessor.record.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.record.erlang + + -record( +% ^^^^^^^ meta.preprocessor.record.erlang +% ^^ meta.preprocessor.record.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.record.erlang + + -record) +%^^^^^^^^^^^ meta.preprocessor.record.arguments.erlang +% ^ meta.preprocessor.record.erlang - meta.preprocessor.record.arguments.erlang +% ^^^^^^^ invalid.illegal.expect-atom.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ invalid.illegal.expect-terminator.erlang + + -record() +% ^^^^^^^ meta.preprocessor.record.erlang - meta.preprocessor.record.arguments.erlang +% ^^ meta.preprocessor.record.arguments.erlang +% ^ meta.preprocessor.record.erlang - meta.preprocessor.record.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.record.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ invalid.illegal.expect-terminator.erlang + + -record () +% ^^^^^^^^ meta.preprocessor.record.erlang - meta.preprocessor.record.arguments.erlang +% ^^ meta.preprocessor.record.arguments.erlang +% ^ meta.preprocessor.record.erlang - meta.preprocessor.record.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.record.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ invalid.illegal.expect-terminator.erlang + + -record(,) +% ^^^^^^^ meta.preprocessor.record.erlang - meta.preprocessor.record.arguments.erlang +% ^^^ meta.preprocessor.record.arguments.erlang +% ^ meta.preprocessor.record.erlang - meta.preprocessor.record.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.record.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.separator.arguments.erlang +% ^ punctuation.section.arguments.end.erlang + + -record (,) +% ^^^^^^^^ meta.preprocessor.record.erlang - meta.preprocessor.record.arguments.erlang +% ^^^ meta.preprocessor.record.arguments.erlang +% ^ meta.preprocessor.record.erlang - meta.preprocessor.record.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.record.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.separator.arguments.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ invalid.illegal.expect-terminator.erlang + + -record(name) +% ^^^^^^^ meta.preprocessor.record.erlang - meta.preprocessor.record.arguments.erlang +% ^^^^^^ meta.preprocessor.record.arguments.erlang +% ^ meta.preprocessor.record.erlang - meta.preprocessor.record.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.record.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^^^^ entity.name.record.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ invalid.illegal.expect-terminator.erlang + + -record(?name) +% ^^^^^^^ meta.preprocessor.record.erlang - meta.preprocessor.record.arguments.erlang +% ^^^^^^^ meta.preprocessor.record.arguments.erlang +% ^ meta.preprocessor.record.erlang - meta.preprocessor.record.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.record.erlang +% ^ punctuation.section.arguments.begin.erlang - entity +% ^^^^^ constant.other.macro.erlang +% ^ punctuation.section.arguments.end.erlang - entity +% ^ invalid.illegal.expect-terminator.erlang + + -record(?'name') +% ^^^^^^^ meta.preprocessor.record.erlang - meta.preprocessor.record.arguments.erlang +% ^^^^^^^^^ meta.preprocessor.record.arguments.erlang +% ^ meta.preprocessor.record.erlang - meta.preprocessor.record.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.record.erlang +% ^ punctuation.section.arguments.begin.erlang - entity +% ^^^^^^^ constant.other.macro.erlang +% ^ punctuation.section.arguments.end.erlang - entity +% ^ invalid.illegal.expect-terminator.erlang + + -record('record-name') +% ^^^^^^^ meta.preprocessor.record.erlang - meta.preprocessor.record.arguments.erlang +% ^^^^^^^^^^^^^^^ meta.preprocessor.record.arguments.erlang +% ^ meta.preprocessor.record.erlang - meta.preprocessor.record.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.record.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.definition.atom.begin.erlang +% ^^^^^^^^^^^^^ entity.name.record.erlang +% ^ punctuation.definition.atom.end.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ invalid.illegal.expect-terminator.erlang + + -record(name,) +% ^^^^^^^ meta.preprocessor.record.erlang - meta.preprocessor.record.arguments.erlang +% ^^^^^^^ meta.preprocessor.record.arguments.erlang +% ^ meta.preprocessor.record.erlang - meta.preprocessor.record.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.record.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^^^^ entity.name.record.erlang +% ^ punctuation.separator.arguments.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ invalid.illegal.expect-terminator.erlang + + -record('record-name',) +% ^^^^^^^ meta.preprocessor.record.erlang - meta.preprocessor.record.arguments.erlang +% ^^^^^^^^^^^^^^^^ meta.preprocessor.record.arguments.erlang +% ^ meta.preprocessor.record.erlang - meta.preprocessor.record.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.record.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.definition.atom.begin.erlang +% ^^^^^^^^^^^^^ entity.name.record.erlang +% ^ punctuation.definition.atom.end.erlang +% ^ punctuation.separator.arguments.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ invalid.illegal.expect-terminator.erlang + + -record(Name,) +% ^^^^^^^ meta.preprocessor.record.erlang - meta.preprocessor.record.arguments.erlang +% ^^^^^^^ meta.preprocessor.record.arguments.erlang +% ^ meta.preprocessor.record.erlang - meta.preprocessor.record.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.record.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^^^^ invalid.illegal.expect-atom.erlang +% ^ punctuation.separator.arguments.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ invalid.illegal.expect-terminator.erlang + + -record(,{}) +% ^^^^^^^ meta.preprocessor.record.erlang - meta.preprocessor.record.arguments.erlang +% ^^^^^ meta.preprocessor.record.arguments.erlang +% ^ meta.preprocessor.record.erlang - meta.preprocessor.record.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.record.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.separator.arguments.erlang +% ^ punctuation.section.fields.begin.erlang +% ^ punctuation.section.fields.end.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ invalid.illegal.expect-terminator.erlang + + -record(name,{}) +% ^^^^^^^ meta.preprocessor.record.erlang - meta.preprocessor.record.arguments.erlang +% ^^^^^^^^^ meta.preprocessor.record.arguments.erlang +% ^ meta.preprocessor.record.erlang - meta.preprocessor.record.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.record.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^^^^ entity.name.record.erlang +% ^ punctuation.separator.arguments.erlang +% ^ punctuation.section.fields.begin.erlang +% ^ punctuation.section.fields.end.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ invalid.illegal.expect-terminator.erlang + + -record(name {}) +% ^^^^^^^ meta.preprocessor.record.erlang - meta.preprocessor.record.arguments.erlang +% ^^^^^^^^^ meta.preprocessor.record.arguments.erlang +% ^ meta.preprocessor.record.erlang - meta.preprocessor.record.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.record.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^^^^ entity.name.record.erlang +% ^ punctuation.section.fields.begin.erlang +% ^ punctuation.section.fields.end.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ invalid.illegal.expect-terminator.erlang + + -record(name, {field1="val1", Field2=3::integer()|Atom, field3, 'Field-4'={}, field5::tuple(), _=atom} illegal). +% ^^^^^^^ meta.preprocessor.record.erlang - meta.preprocessor.record.arguments.erlang +% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.preprocessor.record.arguments.erlang +% ^^^^^^ meta.field.name.erlang - meta.field.erlang - meta.field.value.erlang - meta.field.type.erlang +% ^ meta.field.erlang - meta.field.name.erlang - meta.field.value.erlang - meta.field.type.erlang +% ^^^^^^ meta.field.value.erlang - meta.field.erlang - meta.field.name.erlang - meta.field.type.erlang +% ^ - meta.field +% ^^^^^^^ meta.field.name.erlang - meta.field.erlang - meta.field.value.erlang - meta.field.type.erlang +% ^ meta.field.erlang - meta.field.name.erlang - meta.field.value.erlang - meta.field.type.erlang +% ^ meta.field.value.erlang - meta.field.erlang - meta.field.name.erlang - meta.field.type.erlang +% ^^ meta.field.erlang - meta.field.value - meta.field.type +% ^^^^^^^^^^^^^^ meta.field.type.erlang - meta.field.erlang - meta.field.name.erlang - meta.field.value.erlang +% ^ - meta.field +% ^^^^^^^ meta.field.name.erlang - meta.field.erlang - meta.field.value.erlang - meta.field.type.erlang +% ^ - meta.field +% ^^^^^^^^^^ meta.field.name.erlang - meta.field.erlang - meta.field.value.erlang - meta.field.type.erlang +% ^ meta.field.erlang - meta.field.name.erlang - meta.field.value.erlang - meta.field.type.erlang +% ^^ meta.field.value.erlang - meta.field.erlang - meta.field.name.erlang - meta.field.type.erlang +% ^ - meta.field +% ^^^^^^^ meta.field.name.erlang +% ^^ meta.field.erlang - meta.field.name - meta.field.type +% ^^^^^^^ meta.field.type.erlang - meta.field.erlang - meta.field.name.erlang - meta.field.value.erlang +% ^ meta.field.name.erlang - meta.field.erlang - meta.field.value.erlang - meta.field.type.erlang +% ^ meta.field.erlang - meta.field.name.erlang - meta.field.value.erlang - meta.field.type.erlang +% ^^^^ meta.field.value.erlang - meta.field.erlang - meta.field.name.erlang - meta.field.type.erlang +% ^ - meta.field +% ^ meta.preprocessor.record.erlang - meta.preprocessor.record.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.record.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^^^^ entity.name.record.erlang +% ^ punctuation.separator.arguments.erlang +% ^ punctuation.section.fields.begin.erlang +% ^^^^^^ entity.name.field.erlang +% ^ keyword.operator.assignment.erlang +% ^^^^^^ string.quoted.double.erlang +% ^ punctuation.separator.expressions.erlang +% ^^^^^^ invalid.illegal.expect-atom.erlang +% ^ keyword.operator.assignment.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^^ punctuation.separator.variable-type.erlang +% ^^^^^^^ support.type.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.separator.sequence.erlang +% ^^^^ variable.other.erlang +% ^ punctuation.separator.expressions.erlang +% ^^^^^^ entity.name.field.erlang +% ^ punctuation.separator.expressions.erlang +% ^ punctuation.definition.atom.begin.erlang +% ^^^^^^^^^ entity.name.field.erlang +% ^ punctuation.definition.atom.end.erlang +% ^ keyword.operator.assignment.erlang +% ^ meta.sequence.tuple.erlang punctuation.section.sequence.begin.erlang +% ^ meta.sequence.tuple.erlang punctuation.section.sequence.end.erlang +% ^ punctuation.separator.expressions.erlang +% ^^ punctuation.separator.variable-type.erlang +% ^^^^^ support.type.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.separator.expressions.erlang +% ^ variable.language.anonymous.erlang +% ^ keyword.operator.assignment.erlang +% ^^^^ constant.other.symbol.erlang +% ^ punctuation.section.fields.end.erlang +% ^^^^^^^ invalid.illegal.expect-arguments-end.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.terminator.clause.erlang + + -record ( +% ^^^^^^^^ meta.preprocessor.record.erlang - meta.preprocessor.record.arguments.erlang +% ^^ meta.preprocessor.record.arguments.erlang +% ^ punctuation.definition.keyword.erlang - keyword +% ^^^^^^ keyword.control.directive.record.erlang +% ^ punctuation.section.arguments.begin.erlang + name, +% ^^^^ entity.name.record.erlang +% ^ punctuation.separator.arguments.erlang + { +% ^ punctuation.section.fields.begin.erlang + field1 +% ^^^^^^ entity.name.field.erlang + = +% ^ keyword.operator.assignment.erlang + "val1" +% ^^^^^^ string.quoted.double.erlang + , +% ^ punctuation.separator.expressions.erlang + Field2 = 3 +% ^^^^^^ invalid.illegal.expect-atom.erlang +% ^ keyword.operator.assignment.erlang +% ^ constant.numeric.integer.decimal.erlang + :: integer() | Atom , +% ^^ punctuation.separator.variable-type.erlang +% ^^^^^^^ support.type.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.separator.sequence.erlang +% ^^^^ variable.other.erlang +% ^ punctuation.separator.expressions.erlang + field3, +% ^^^^^^ entity.name.field.erlang +% ^ punctuation.separator.expressions.erlang + 'Field-4' +% ^ punctuation.definition.atom.begin.erlang +% ^^^^^^^^^ entity.name.field.erlang +% ^ punctuation.definition.atom.end.erlang + = +% ^ keyword.operator.assignment.erlang + { +% ^ meta.sequence.tuple.erlang punctuation.section.sequence.begin.erlang + } +% ^ meta.sequence.tuple.erlang punctuation.section.sequence.end.erlang + , +% ^ punctuation.separator.expressions.erlang + field5 :: tuple() , +% ^^^^^^ entity.name.field.erlang +% ^^ punctuation.separator.variable-type.erlang +% ^^^^^ support.type.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.separator.expressions.erlang + _ +% ^ variable.language.anonymous.erlang + = +% ^ keyword.operator.assignment.erlang + atom +% ^^^^ constant.other.symbol.erlang + } illegal +% ^ punctuation.section.fields.end.erlang +% ^^^^^^^ invalid.illegal.expect-arguments-end.erlang + ) . +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.terminator.clause.erlang + + # +% ^^^ - meta.record - variable + + #record +% ^ - meta.record - variable +% ^ punctuation.definition.record.erlang +% ^^^^^^ meta.record.name.erlang variable.other.record.erlang + + #record. +% ^^^^^^^ meta.record.name.erlang - meta.record.erlang - meta.record.field +% ^ meta.record.erlang - meta.record.name - meta.record.field +% ^ - meta.record +% ^ punctuation.definition.record.erlang +% ^^^^^^ variable.other.record.erlang +% ^ punctuation.accessor.dot.erlang + + #record.field +% ^ - meta.record +% ^^^^^^^ meta.record.name.erlang - meta.record.erlang - meta.record.field +% ^ meta.record.erlang - meta.record.name - meta.record.field +% ^^^^^ meta.record.field.erlang - meta.record.erlang - meta.record.name +% ^ - meta.record +% ^ punctuation.definition.record.erlang +% ^^^^^^ variable.other.record.erlang +% ^ punctuation.accessor.dot.erlang +% ^^^^^ variable.other.field.erlang + + #record.Field +% ^ - meta.record +% ^^^^^^^ meta.record.name.erlang - meta.record.erlang - meta.record.field +% ^ meta.record.erlang - meta.record.name - meta.record.field +% ^^^^^ meta.record.field.erlang - meta.record.erlang - meta.record.name +% ^ - meta.record +% ^ punctuation.definition.record.erlang +% ^^^^^^ variable.other.record.erlang +% ^ punctuation.accessor.dot.erlang +% ^^^^^ invalid.illegal.expect-atom.erlang + + #record.'field-name' +% ^ - meta.record +% ^^^^^^^ meta.record.name.erlang - meta.record.erlang - meta.record.field +% ^ meta.record.erlang - meta.record.name - meta.record.field +% ^^^^^^^^^^^^ meta.record.field.erlang - meta.record.erlang - meta.record.name +% ^ - meta.record +% ^ punctuation.definition.record.erlang +% ^^^^^^ variable.other.record.erlang +% ^ punctuation.accessor.dot.erlang +% ^ punctuation.definition.atom.begin.erlang +% ^^^^^^^^^^^^ variable.other.field.erlang +% ^ punctuation.definition.atom.end.erlang + + #'atomic-record'.'field-name' +% ^ - meta.record +% ^^^^^^^^^^^^^^^^ meta.record.name.erlang - meta.record.erlang - meta.record.field +% ^ meta.record.erlang - meta.record.name - meta.record.field +% ^^^^^^^^^^^^ meta.record.field.erlang - meta.record.erlang - meta.record.name +% ^ - meta.record +% ^ punctuation.definition.record.erlang +% ^ punctuation.definition.atom.begin.erlang +% ^^^^^^^^^^^^^^^ variable.other.record.erlang +% ^ - keyword - punctuation +% ^ punctuation.definition.atom.end.erlang +% ^ punctuation.accessor.dot.erlang +% ^ punctuation.definition.atom.begin.erlang +% ^^^^^^^^^^^^ variable.other.field.erlang +% ^ punctuation.definition.atom.end.erlang + + #?MACRO.field +% ^ - meta.record +% ^^^^^^^ meta.record.name.erlang - meta.record.erlang - meta.record.field +% ^ meta.record.erlang - meta.record.name - meta.record.field +% ^^^^^ meta.record.field.erlang - meta.record.erlang - meta.record.name +% ^ - meta.record +% ^ punctuation.definition.record.erlang +% ^ punctuation.definition.macro.erlang +% ^^^^^^ constant.other.macro.erlang +% ^ punctuation.accessor.dot.erlang +% ^^^^^ variable.other.field.erlang + + #?MACRO . field +% ^ - meta.record +% ^^^^^^^^ meta.record.name.erlang - meta.record.erlang - meta.record.field +% ^ meta.record.erlang - meta.record.name - meta.record.field +% ^^^^^^ meta.record.field.erlang - meta.record.erlang - meta.record.name +% ^ - meta.record +% ^ punctuation.definition.record.erlang +% ^ punctuation.definition.macro.erlang +% ^^^^^^ constant.other.macro.erlang +% ^ - constant - punctuation - variable +% ^ punctuation.accessor.dot.erlang +% ^ - constant - punctuation - variable +% ^^^^^ variable.other.field.erlang + + #?'MACRO'.field +% ^ - meta.record +% ^^^^^^^^^ meta.record.name.erlang - meta.record.erlang - meta.record.field +% ^ meta.record.erlang - meta.record.name - meta.record.field +% ^^^^^ meta.record.field.erlang - meta.record.erlang - meta.record.name +% ^ - meta.record +% ^ punctuation.definition.record.erlang +% ^ punctuation.definition.macro.erlang +% ^^^^^^^^ constant.other.macro.erlang +% ^ punctuation.accessor.dot.erlang +% ^^^^^ variable.other.field.erlang + + #?'MACRO' . field +% ^ - meta.record +% ^^^^^^^^^^ meta.record.name.erlang - meta.record.erlang - meta.record.field +% ^ meta.record.erlang - meta.record.name - meta.record.field +% ^^^^^^ meta.record.field.erlang - meta.record.erlang - meta.record.name +% ^ - meta.record +% ^ punctuation.definition.record.erlang +% ^ punctuation.definition.macro.erlang +% ^^^^^^^^ constant.other.macro.erlang +% ^ - constant - punctuation - variable +% ^ punctuation.accessor.dot.erlang +% ^^^^^ variable.other.field.erlang + + #record.?field +% ^ - meta.record +% ^^^^^^^ meta.record.name.erlang - meta.record.erlang - meta.record.field +% ^ meta.record.erlang - meta.record.name - meta.record.field +% ^^^^^^ meta.record.field.erlang - meta.record.erlang - meta.record.name +% ^ - meta.record +% ^ punctuation.definition.record.erlang +% ^ punctuation.accessor.dot.erlang +% ^ punctuation.definition.macro.erlang +% ^^^^^^ constant.other.macro.erlang + +local_record_definition_tests() -> . + + #'atomic-record' +% ^ - meta.record - variable +% ^ punctuation.definition.record.erlang +% ^^^^^^^^^^^^^^^^ meta.record.name.erlang - meta.record.fields +% ^ punctuation.definition.atom.begin.erlang +% ^^^^^^^^^^^^^^^ variable.other.record.erlang +% ^ - keyword - punctuation +% ^ punctuation.definition.atom.end.erlang + + #record{} +% ^^^^^^^ meta.record.name.erlang - meta.record.fields.erlang +% ^^ meta.record.fields.erlang - meta.record.name +% ^ - meta.record +% ^ punctuation.definition.record.erlang +% ^^^^^^ variable.other.record.erlang +% ^ punctuation.section.fields.begin.erlang +% ^ punctuation.section.fields.end.erlang + + #record{field1="val1", Field2=3, field3, 'Field-4'={}, _=atom, ?FIELD=undefined} +% ^ - meta.record +% ^^^^^^^ meta.record.name.erlang - meta.record.fields.erlang +% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.record.fields.erlang - meta.record.name +% ^^^^^^ meta.field.name.erlang - meta.field.erlang - meta.field.value.erlang +% ^ meta.field.erlang - meta.field.name.erlang - meta.field.value.erlang +% ^^^^^^ meta.field.value.erlang - meta.field.erlang - meta.field.name.erlang +% ^ - meta.field +% ^^^^^^^ meta.field.name.erlang - meta.field.erlang - meta.field.value.erlang +% ^ meta.field.erlang - meta.field.name.erlang - meta.field.value.erlang +% ^ meta.field.value.erlang - meta.field.erlang - meta.field.name.erlang +% ^ - meta.field +% ^^^^^^^ meta.field.name.erlang - meta.field.erlang - meta.field.value.erlang +% ^ - meta.field +% ^^^^^^^^^^ meta.field.name.erlang - meta.field.erlang - meta.field.value.erlang +% ^ meta.field.erlang - meta.field.name.erlang - meta.field.value.erlang +% ^^ meta.field.value.erlang - meta.field.erlang - meta.field.name.erlang +% ^ - meta.field +% ^^ meta.field.name.erlang - meta.field.erlang - meta.field.value.erlang +% ^ meta.field.erlang - meta.field.name.erlang - meta.field.value.erlang +% ^^^^ meta.field.value.erlang - meta.field.erlang - meta.field.name.erlang +% ^ - meta.field +% ^^^^^^^ meta.field.name.erlang - meta.field.erlang - meta.field.value.erlang +% ^ meta.field.erlang - meta.field.name.erlang - meta.field.value.erlang +% ^^^^^^^^^ meta.field.value.erlang - meta.field.erlang - meta.field.name.erlang +% ^ - meta.field +% ^ - meta.record +% ^ punctuation.definition.record.erlang +% ^^^^^^ variable.other.record.erlang +% ^ punctuation.section.fields.begin.erlang +% ^^^^^^ variable.other.field.erlang +% ^ keyword.operator.assignment.erlang +% ^^^^^^ string.quoted.double.erlang +% ^ punctuation.separator.expressions.erlang +% ^^^^^^ invalid.illegal.expect-atom.erlang +% ^ keyword.operator.assignment.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^ punctuation.separator.expressions.erlang +% ^^^^^^ variable.other.field.erlang +% ^ punctuation.separator.expressions.erlang +% ^ punctuation.definition.atom.begin.erlang +% ^^^^^^^^^ variable.other.field.erlang +% ^ punctuation.definition.atom.end.erlang +% ^ keyword.operator.assignment.erlang +% ^ meta.sequence.tuple.erlang punctuation.section.sequence.begin.erlang +% ^ meta.sequence.tuple.erlang punctuation.section.sequence.end.erlang +% ^ punctuation.separator.expressions.erlang +% ^ variable.language.anonymous.erlang +% ^ keyword.operator.assignment.erlang +% ^^^^ constant.other.symbol.erlang +% ^ punctuation.separator.expressions.erlang +% ^^^^^^ constant.other.macro.erlang +% ^ keyword.operator.assignment.erlang +% ^^^^^^^^^ constant.language.undefined.erlang +% ^ punctuation.section.fields.end.erlang + + #record { +% ^ - meta.record +% ^^^^^^^^ meta.record.name.erlang - meta.record.fields.erlang +% ^^ meta.record.fields.erlang - meta.record.name +% ^ punctuation.definition.record.erlang +% ^^^^^^ variable.other.record.erlang +% ^ punctuation.section.fields.begin.erlang + field1 = "val1" , +%^^^^^^^^^^^^^^^^^^^^^^^^ meta.record.fields.erlang +% ^^^^^^ variable.other.field.erlang +% ^ keyword.operator.assignment.erlang +% ^^^^^^ string.quoted.double.erlang +% ^ punctuation.separator.expressions.erlang + Field2 = 3 , +%^^^^^^^^^^^^^^^^^^^ meta.record.fields.erlang +% ^^^^^^ invalid.illegal.expect-atom.erlang +% ^ keyword.operator.assignment.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^ punctuation.separator.expressions.erlang + field3 , +%^^^^^^^^^^^^^^^ meta.record.fields.erlang +% ^^^^^^ variable.other.field.erlang +% ^ punctuation.separator.expressions.erlang + _ = atom +%^^^^^^^^^^^^^^^^ meta.record.fields.erlang +% ^ variable.language.anonymous.erlang +% ^ keyword.operator.assignment.erlang +% ^^^^ constant.other.symbol.erlang + } +%^^^^ meta.record.fields.erlang +% ^ punctuation.section.fields.end.erlang +% ^ - meta.record + + Expr#'record-name'{'field-name'='value-name','Field-name'="string"} +% ^^^^ variable.other.erlang +% ^^^^^^^^^^^^^^ meta.record.name.erlang - meta.record.fields +% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.record.fields.erlang - meta.record.name +% ^^^^^^^^^^^^ meta.field.name.erlang - meta.field.erlang - meta.field.value.erlang +% ^ meta.field.erlang - meta.field.name.erlang - meta.field.value.erlang +% ^^^^^^^^^^^^ meta.field.value.erlang - meta.field.erlang - meta.field.name.erlang +% ^ - meta.record +% ^ punctuation.definition.record.erlang +% ^ punctuation.definition.atom.begin.erlang +% ^^^^^^^^^^^ variable.other.record.erlang +% ^ - keyword - punctuation +% ^ punctuation.definition.atom.end.erlang +% ^ punctuation.section.fields.begin.erlang +% ^ punctuation.definition.atom.begin.erlang +% ^^^^^^^^^^ variable.other.field.erlang +% ^ punctuation.definition.atom.end.erlang +% ^ keyword.operator.assignment.erlang +% ^ punctuation.definition.atom.begin.erlang +% ^^^^^^^^^^ constant.other.symbol.erlang +% ^ punctuation.definition.atom.end.erlang +% ^ punctuation.separator.expressions.erlang +% ^ punctuation.definition.atom.begin.erlang +% ^^^^^^^^^^ variable.other.field.erlang +% ^ punctuation.definition.atom.end.erlang +% ^ keyword.operator.assignment.erlang +% ^ punctuation.definition.string.begin.erlang +% ^^^^^^^^ string.quoted.double.erlang +% ^ punctuation.definition.string.end.erlang +% ^ punctuation.section.fields.end.erlang + + Expr#'record-name'{ +% ^^^^ variable.other.erlang +% ^^^^^^^^^^^^^^ meta.record.name.erlang - meta.record.fields +% ^^ meta.record.fields.erlang - meta.record.name +% ^ punctuation.definition.record.erlang +% ^ punctuation.definition.atom.begin.erlang +% ^^^^^^^^^^^^^ variable.other.record.erlang +% ^ - keyword - punctuation +% ^ punctuation.definition.atom.end.erlang +% ^ punctuation.section.fields.begin.erlang + 'field-name' +% ^^^^^^^^^^^^^^ meta.record.fields.erlang meta.field.name.erlang +% ^ punctuation.definition.atom.begin.erlang +% ^^^^^^^^^^^^ variable.other.field.erlang +% ^ punctuation.definition.atom.end.erlang + = +% ^^^ meta.record.fields.erlang +% ^ meta.field.name.erlang +% ^ meta.field.erlang +% ^ meta.field.value.erlang +% ^ keyword.operator.assignment.erlang + 'value-name' +% ^^^^^^^^^^^^^^ meta.record.fields.erlang meta.field.value.erlang +% ^ punctuation.definition.atom.begin.erlang +% ^^^^^^^^^^^^ +% ^ punctuation.definition.atom.end.erlang + , +% ^ meta.record.fields.erlang meta.field.value.erlang +% ^ meta.record.fields.erlang - meta.field +% ^ punctuation.separator.expressions.erlang + 'Field-name' +% ^^^^^^^^^^^^^^ meta.record.fields.erlang meta.field.name.erlang +% ^ punctuation.definition.atom.begin.erlang +% ^^^^^^^^^^^ variable.other.field.erlang +% ^ punctuation.definition.atom.end.erlang + = +% ^^^ meta.record.fields.erlang +% ^ meta.field.name.erlang +% ^ meta.field.erlang +% ^ meta.field.value.erlang +% ^ keyword.operator.assignment.erlang + "string" +% ^^^^^^^^^^ meta.record.fields.erlang meta.field.value.erlang +% ^ punctuation.definition.string.begin.erlang +% ^^^^^^^^ string.quoted.double.erlang +% ^ punctuation.definition.string.end.erlang + } +%^^^ meta.record.fields.erlang meta.field.value.erlang +% ^ meta.record.fields.erlang - meta.field +% ^ - meta.record +% ^ punctuation.section.fields.end.erlang + +% Nested record tests + + "nested0" = N2#nrec2.nrec1#nrec1.nrec0#nrec0.name, +% ^ - meta.record +% ^^^^^^ meta.record.name.erlang +% ^ meta.record.erlang +% ^^^^^ meta.record.field.erlang +% ^^^^^^ meta.record.name.erlang +% ^ meta.record.erlang +% ^^^^^ meta.record.field.erlang +% ^^^^^^ meta.record.name.erlang +% ^ meta.record.erlang +% ^^^^ meta.record.field.erlang +% ^^ variable.other.erlang +% ^ punctuation.definition.record.erlang +% ^^^^^ variable.other.record.erlang +% ^ punctuation.accessor.dot.erlang +% ^^^^^ variable.other.field.erlang +% ^ punctuation.definition.record.erlang +% ^^^^^ variable.other.record.erlang +% ^ punctuation.accessor.dot.erlang +% ^^^^^ variable.other.field.erlang +% ^ punctuation.definition.record.erlang +% ^^^^^ variable.other.record.erlang +% ^ punctuation.accessor.dot.erlang +% ^^^^ variable.other.field.erlang +% ^ punctuation.separator.expressions.erlang + + N0n = N2#nrec2.nrec1#nrec1.nrec0#nrec0{name = "nested0a"}, +% ^ - meta.record +% ^^^^^^ meta.record.name.erlang +% ^ meta.record.erlang +% ^^^^^ meta.record.field.erlang +% ^^^^^^ meta.record.name.erlang +% ^ meta.record.erlang +% ^^^^^ meta.record.field.erlang +% ^^^^^^ meta.record.name.erlang +% ^^^^^^^^^^^^^^^^^^^ meta.record.fields.erlang +% ^ - meta.record +% ^^ variable.other.erlang +% ^ punctuation.definition.record.erlang +% ^^^^^ variable.other.record.erlang +% ^ punctuation.accessor.dot.erlang +% ^^^^^ variable.other.field.erlang +% ^ punctuation.definition.record.erlang +% ^^^^^ variable.other.record.erlang +% ^ punctuation.accessor.dot.erlang +% ^^^^^ variable.other.field.erlang +% ^ punctuation.definition.record.erlang +% ^^^^^ variable.other.record.erlang +% ^ punctuation.section.fields.begin.erlang +% ^ punctuation.section.fields.end.erlang +% ^ punctuation.separator.expressions.erlang + +% Function tests + +func_name(.) +% <- meta.function.name.erlang entity.name.function.erlang +%^^^^^^^^ meta.function.name.erlang entity.name.function.erlang +% ^ meta.function.parameters.erlang punctuation.section.parameters.begin.erlang +% ^ meta.function.erlang punctuation.terminator.clause.erlang +% ^ invalid.illegal.stray.erlang + +func_name(;) +% <- meta.function.name.erlang entity.name.function.erlang +%^^^^^^^^ meta.function.name.erlang entity.name.function.erlang +% ^ meta.function.parameters.erlang punctuation.section.parameters.begin.erlang +% ^ meta.function.erlang punctuation.separator.clauses.erlang +% ^ invalid.illegal.stray.erlang + +func_name( -> ;) +% <- meta.function.name.erlang entity.name.function.erlang +%^^^^^^^^ meta.function.name.erlang entity.name.function.erlang +% ^ punctuation.section.parameters.begin.erlang +% ^^ meta.function.parameters.erlang +% ^^ meta.function.erlang punctuation.separator.clause-head-body.erlang +% ^ meta.function.erlang punctuation.separator.clauses.erlang +% ^ invalid.illegal.stray.erlang + +func_name( when .) +% <- meta.function.name.erlang entity.name.function.erlang +%^^^^^^^^ meta.function.name.erlang entity.name.function.erlang +% ^ punctuation.section.parameters.begin.erlang +% ^^ meta.function.parameters.erlang +% ^^^^ meta.function.erlang keyword.control.conditional.when.erlang +% ^^ meta.function.erlang +% ^ punctuation.terminator.clause.erlang +% ^ invalid.illegal.stray.erlang + +func_name({[( -> ;) +% <- meta.function.name.erlang entity.name.function.erlang +%^^^^^^^^ meta.function.name.erlang entity.name.function.erlang +% ^ punctuation.section.parameters.begin.erlang +% ^^^^^ meta.function.parameters.erlang +% ^^ meta.function.erlang punctuation.separator.clause-head-body.erlang +% ^ meta.function.erlang punctuation.separator.clauses.erlang +% ^ invalid.illegal.stray.erlang + +func_name({[( when .) +% <- meta.function.name.erlang entity.name.function.erlang +%^^^^^^^^ meta.function.name.erlang entity.name.function.erlang +% ^ punctuation.section.parameters.begin.erlang +% ^^^^^ meta.function.parameters.erlang +% ^^^^ meta.function.erlang keyword.control.conditional.when.erlang +% ^^ meta.function.erlang +% ^ punctuation.terminator.clause.erlang +% ^ invalid.illegal.stray.erlang + +func_name ( ) +% <- meta.function.name.erlang entity.name.function.erlang +%^^^^^^^^ meta.function.name.erlang entity.name.function.erlang +% ^ punctuation.section.parameters.begin.erlang +% ^^^ meta.function.parameters.erlang +% ^ punctuation.section.parameters.end.erlang +% ^ meta.function.erlang + ; +% ^ meta.function.erlang punctuation.separator.clauses.erlang +% ^ - meta.function.erlang + +func_name ( ) +% <- meta.function.name.erlang entity.name.function.erlang +%^^^^^^^^ meta.function.name.erlang entity.name.function.erlang +% ^ punctuation.section.parameters.begin.erlang +% ^^^ meta.function.parameters.erlang +% ^ punctuation.section.parameters.end.erlang +% ^ meta.function.erlang + . +% ^ meta.function.erlang punctuation.terminator.clause.erlang +% ^ - meta.function.erlang + + +func_name ( ) -> +% <- meta.function.name.erlang entity.name.function.erlang +%^^^^^^^^ meta.function.name.erlang entity.name.function.erlang +% ^ punctuation.section.parameters.begin.erlang +% ^^^ meta.function.parameters.erlang +% ^ punctuation.section.parameters.end.erlang +% ^^^ meta.function.erlang +% ^^ punctuation.separator.clause-head-body.erlang + . +% ^ meta.function.erlang punctuation.terminator.clause.erlang +% ^ - meta.function.erlang + +func_name ( ) when true -> +% <- meta.function.name.erlang entity.name.function.erlang +%^^^^^^^^ meta.function.name.erlang entity.name.function.erlang +% ^^^ meta.function.parameters.erlang +% ^^^^^^^^^^^^^^ meta.function.erlang - meta.function.parameters.erlang.erlang +% ^ punctuation.section.parameters.begin.erlang +% ^ punctuation.section.parameters.end.erlang +% ^^^^ keyword.control.conditional.when.erlang +% ^^^^ constant.language.boolean.erlang +% ^^ punctuation.separator.clause-head-body.erlang + . +% ^ meta.function.erlang punctuation.terminator.clause.erlang +% ^ - meta.function.erlang + +func_name ( ) when is_list(), is_tuple(); is_atom() -> +% <- meta.function.name.erlang entity.name.function.erlang +%^^^^^^^^ meta.function.name.erlang entity.name.function.erlang +% ^^^ meta.function.parameters.erlang +% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.erlang - meta.function.parameters +% ^ punctuation.section.parameters.begin.erlang +% ^ punctuation.section.parameters.end.erlang +% ^^^^ keyword.control.conditional.when.erlang +% ^^^^^^^ support.function.erlang +% ^ punctuation.separator.expressions.erlang +% ^^^^^^^^ support.function.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.separator.clauses.erlang +% ^^^^^^^ support.function.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^^ punctuation.separator.clause-head-body.erlang + . +% ^ meta.function.erlang punctuation.terminator.clause.erlang +% ^ - meta.function.erlang + +func_name ( ) +% <- meta.function.name.erlang entity.name.function.erlang +%^^^^^^^^ meta.function.name.erlang entity.name.function.erlang +% ^^^ meta.function.parameters.erlang +% ^ meta.function.erlang - meta.function.parameters.erlang.erlang +% ^ punctuation.section.parameters.begin.erlang +% ^ punctuation.section.parameters.end.erlang + when +% ^ meta.function.erlang - meta.function.parameters.erlang.erlang +% ^^^^ keyword.control.conditional.when.erlang + is_list(), +% ^^^^^^^ support.function.erlang + is_tuple() +% ^^^^^^^^ support.function.erlang + -> +% ^^ punctuation.separator.clause-head-body.erlang + . +% ^ meta.function.erlang punctuation.terminator.clause.erlang +% ^ - meta.function.erlang + +'2\'Bin'() -> . +% <- meta.function.name.erlang entity.name.function.erlang +%^^^^^^^ meta.function.name.erlang entity.name.function.erlang +% <- punctuation.definition.atom.begin.erlang +% ^ punctuation.definition.atom.end.erlang +% ^ meta.function.parameters.erlang punctuation.section.parameters.begin.erlang +% ^ meta.function.parameters.erlang punctuation.section.parameters.end.erlang +% ^^ meta.function.erlang punctuation.separator.clause-head-body.erlang +% ^ meta.function.erlang punctuation.terminator.clause.erlang + +?FUNC() -> . +% <- meta.function.name.erlang constant.other.macro.erlang +%^^^^ meta.function.name.erlang constant.other.macro.erlang +% ^ meta.function.parameters.erlang punctuation.section.parameters.begin.erlang +% ^ meta.function.parameters.erlang punctuation.section.parameters.end.erlang +% ^^ meta.function.erlang punctuation.separator.clause-head-body.erlang +% ^ meta.function.erlang punctuation.terminator.clause.erlang + +?'2\'Bin'() -> . +%<- meta.function.name.erlang constant.other.macro.erlang +%^^^^^^^^ meta.function.name.erlang constant.other.macro.erlang +% ^ meta.function.parameters.erlang punctuation.section.parameters.begin.erlang +% ^ meta.function.parameters.erlang punctuation.section.parameters.end.erlang +% ^^ meta.function.erlang punctuation.separator.clause-head-body.erlang +% ^ meta.function.erlang punctuation.terminator.clause.erlang + +func_name(Mod, Name, _, {Enc,Depth}, <>) -> +% <- meta.function.name.erlang entity.name.function.erlang +%^^^^^^^^ meta.function.name.erlang +% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.parameters.erlang +% ^^^^^^^^^^^ meta.sequence.tuple.erlang +% ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.sequence.binary.erlang +% ^^^^ meta.function.erlang - meta.function.parameters.erlang +%^^^^^^^^ entity.name.function.erlang +% ^ punctuation.section.parameters.begin.erlang +% ^^^ variable.parameter.erlang +% ^ punctuation.separator.parameters.erlang +% ^^^^ variable.parameter.erlang +% ^ punctuation.separator.parameters.erlang +% ^ variable.language.anonymous.erlang +% ^ punctuation.separator.parameters.erlang +% ^ punctuation.section.sequence.begin.erlang +% ^^^ variable.parameter.erlang +% ^ punctuation.separator.sequence.erlang +% ^^^^^ variable.parameter.erlang +% ^ punctuation.section.sequence.end.erlang +% ^ punctuation.separator.parameters.erlang +% ^^ punctuation.definition.sequence.begin.erlang +% ^^^^ variable.parameter.erlang +% ^ punctuation.separator.value-size.erlang +% ^^ constant.numeric.integer.decimal.erlang +% ^ punctuation.separator.value-type.erlang +% ^^^^^^ storage.modifier.endianness.erlang +% ^ punctuation.separator.type-specifiers.erlang +% ^^^^^^^^ storage.modifier.signedness.erlang +% ^^ punctuation.definition.sequence.end.erlang +% ^ punctuation.section.parameters.end.erlang +% ^^ punctuation.separator.clause-head-body.erlang Identifier = lists:flatten(io_lib:format("~s:~s()", [Mod, Name])), - % ^ meta.function keyword.operator.symbolic - % ^^^^^ entity.name.type.class.module - % ^ meta.function punctuation - % ^^^^^^^ variable.function - % ^ meta.function meta.function-call punctuation.section.parameters.begin - % ^ meta.function meta.function-call meta.function-call punctuation.separator.module-function - % ^ meta.function meta.function-call meta.function-call punctuation.section.parameters.begin - % ^ meta.function meta.function-call meta.function-call string.quoted.double punctuation.definition.string.begin - % ^ meta.function meta.function-call meta.function-call string.quoted.double punctuation.definition.string.end - % ^ meta.function meta.function-call meta.function-call punctuation.separator.parameters - % ^ meta.function meta.function-call meta.function-call meta.structure.list punctuation.section.list.begin - % ^ meta.function meta.function-call meta.function-call meta.structure.list punctuation.separator.list - % ^ meta.function meta.function-call meta.function-call meta.structure.list punctuation.section.list.end - % ^ meta.function meta.function-call meta.function-call punctuation.section.parameters.end - % ^ meta.function meta.function-call punctuation.section.parameters.end - % ^ meta.function punctuation.separator.expressions - Len = max(40, string:len(Identifier)), - % ^ keyword.operator.symbolic - % ^^^ meta.function-call variable.function - % ^ meta.function-call punctuation.section.parameters.begin - % ^^ meta.function-call constant.numeric.integer.decimal - % ^ meta.function-call punctuation.separator.parameters - % ^^^^^^ meta.function-call meta.function-call entity.name.type.class.module - % ^ meta.function-call meta.function-call punctuation.separator.module-function - % ^^^ meta.function-call meta.function-call variable.function - % ^ meta.function-call meta.function-call punctuation.section.parameters.begin - % ^^^^^^^^^^ meta.function-call meta.function-call variable.other - % ^ meta.function-call meta.function-call punctuation.section.parameters.end - % ^ meta.function-call punctuation.section.parameters.end - % ^ punctuation.separator.expressions +% ^^^^^^^ meta.function-call.name.erlang - meta.function-call.arguments.erlang +% ^ meta.function-call.arguments.erlang - meta.function-call.name.erlang +% ^^^^^^^^^^^^^ meta.function-call.arguments.erlang - meta.function-call.name.erlang meta.function-call.name.erlang +% ^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.erlang meta.function-call.arguments.erlang - meta.function-call.name.erlang meta.function-call.arguments.erlang +% ^^^^^^^^^^^ meta.sequence.list +% ^ meta.function-call.arguments.erlang - meta.function-call.name.erlang - meta.function-call.arguments.erlang meta.function-call.arguments.erlang +% ^ - meta.function-call +% ^^^^^^^^^^ variable.other.erlang +% ^ keyword.operator.assignment.erlang +% ^^^^^ variable.namespace.erlang +% ^ punctuation.accessor.double-colon.erlang +% ^^^^^^^ variable.function.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.accessor.double-colon.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ string.quoted.double punctuation.definition.string.begin.erlang +% ^ string.quoted.double punctuation.definition.string.end.erlang +% ^ punctuation.separator.arguments.erlang +% ^ punctuation.section.sequence.begin.erlang +% ^ punctuation.separator.sequence.erlang +% ^ punctuation.section.sequence.end.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.separator.expressions.erlang io:format("~-*s", [Len, Identifier]). - % <- meta.function-call entity.name.type.class.module - % ^ meta.function-call punctuation.separator.module-function - % ^^^^^^ meta.function-call variable.function - % ^ meta.function-call punctuation.section.parameters.begin - % ^ meta.function-call string.quoted.double punctuation.definition.string.begin - % ^ meta.function-call string.quoted.double constant.other.placeholder punctuation.definition.placeholder - % ^ meta.function-call string.quoted.double constant.other.placeholder - % ^ meta.function-call string.quoted.double punctuation.definition.string.end - % ^ meta.function-call punctuation.separator.parameters - % ^ meta.function-call meta.structure.list punctuation.section.list.begin - % ^^^ meta.function-call meta.structure.list variable.other - % ^ meta.function-call meta.structure.list punctuation.separator.list - % ^^^^^^^^^^ meta.function-call meta.structure.list variable.other - % ^ meta.function-call meta.structure.list punctuation.section.list.end - % ^ meta.function-call punctuation.section.parameters.end - % ^ punctuation.terminator.function - -format_report(Rep, Indent, {Enc,Depth}) -> - % <- meta.function entity.name.function.definition - % ^ meta.function meta.expression.parenthesized punctuation.section.expression.begin - % ^^^ meta.function meta.expression.parenthesized variable.other - % ^^^^^^ meta.function meta.expression.parenthesized variable.other - % ^ meta.function meta.expression.parenthesized meta.structure.tuple punctuation.section.tuple.begin - % ^^^ meta.function meta.expression.parenthesized meta.structure.tuple variable.other - % ^ meta.function meta.expression.parenthesized meta.structure.tuple punctuation.separator.tuple - % ^^^^^ meta.function meta.expression.parenthesized meta.structure.tuple variable.other - % ^ meta.function meta.expression.parenthesized meta.structure.tuple punctuation.section.tuple.end - % ^ meta.function meta.expression.parenthesized punctuation.section.expression.end - % ^^ meta.function keyword.operator.symbolic - io_lib:format("~s~"++modifier(Enc)++"P~n", [Indent, Rep, Depth]). - % ^ meta.function meta.function-call punctuation.separator.module-function - % ^ - invalid.illegal +%^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.erlang +% ^^^ meta.path.erlang - meta.function-call +% ^^^^^^ meta.path.erlang meta.function-call.name.erlang - meta.function-call.arguments.erlang +% ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.erlang - meta.function-call.name - meta.path +% ^^^^^^^^^^^^^^^^ meta.sequence.list.erlang +% ^ - meta.function-call +% ^^ variable.namespace.erlang +% ^ punctuation.accessor.double-colon.erlang +% ^^^^^^ variable.function.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ string.quoted.double.erlang punctuation.definition.string.begin.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.erlang punctuation.definition.placeholder.erlang +% ^^ string.quoted.double.erlang constant.other.placeholder.width.asterisk.erlang +% ^ string.quoted.double.erlang constant.other.placeholder.control.character.erlang +% ^ string.quoted.double.erlang punctuation.definition.string.end.erlang - constant.other.placeholder +% ^ punctuation.separator.arguments.erlang +% ^ punctuation.section.sequence.begin.erlang +% ^^^ variable.other.erlang - punctuation +% ^ punctuation.separator.sequence.erlang - variable +% ^^^^^^^^^^ variable.other.erlang - punctuation +% ^ punctuation.section.sequence.end.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.terminator.clause.erlang + + foo(F,G) -> fun(E) -> F() end. +% ^^^ meta.function.name.erlang - meta.function.parameters.erlang +% ^^^^^ meta.function.parameters.erlang +% ^^^^^^^^^^^^^^^^^^^^^^ meta.function.erlang +% ^^^ entity.name.function.erlang +% ^ punctuation.section.parameters.begin.erlang +% ^ variable.parameter.erlang +% ^ punctuation.separator.parameters.erlang +% ^ variable.parameter.erlang +% ^ punctuation.section.parameters.end.erlang +% ^^^ keyword.declaration.function.erlang +% ^^^ keyword.declaration.end.erlang +% ^ punctuation.terminator.clause.erlang + + fact(N) when N>0 -> % first clause head +% ^^^^ meta.function.name.erlang - meta.function.parameters.erlang +% ^^^ meta.function.parameters.erlang +% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.erlang - meta.function.parameters.erlang +% ^^^^ entity.name.function.erlang +% ^ punctuation.section.parameters.begin.erlang +% ^ variable.parameter.erlang +% ^ punctuation.section.parameters.end.erlang +% ^^^^ keyword.control.conditional.when.erlang +% ^ variable.other.erlang +% ^ keyword.operator.logical.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^^ punctuation.separator.clause-head-body.erlang +% ^ punctuation.definition.comment.percentage.erlang +% ^^^^^^^^^^^^^^^^^^^^ comment.line.percentage.erlang + N * fact(N-1); % first clause body +% ^^^^^^^^^^^^^^^^^^ meta.function.erlang +% ^ punctuation.separator.clauses.erlang + + fact(0) -> % second clause head +% ^^^^ meta.function.name.erlang - meta.function.parameters.erlang +% ^^^ meta.function.parameters.erlang +% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.erlang +% ^^^^ entity.name.function.erlang +% ^ punctuation.section.parameters.begin.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^ punctuation.section.parameters.end.erlang +% ^^ punctuation.separator.clause-head-body.erlang + 1. % second clause body +% ^^^^^^ meta.function.erlang +% ^ - meta.function.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^ punctuation.terminator.clause.erlang + +% case expression tests +% http://erlang.org/doc/reference_manual/expressions.html#case + +case_tests() -> + + case4you +% ^^^^^^^^ constant.other.symbol.erlang - keyword + +case_tests() -> + + case4you +% ^^^^^^^^ constant.other.symbol.erlang - keyword + + case_here +% ^^^^^^^^^ constant.other.symbol.erlang - keyword + + case@here +% ^^^^^^^^^ constant.other.symbol.erlang - keyword + + case +% ^ - meta.case +% ^^^^^ meta.case.erlang +% ^^^^ keyword.control.conditional.case.erlang + end, +% ^^^ meta.case.erlang +% ^ - meta.case +% ^^^ keyword.control.conditional.end.erlang +% ^ punctuation.separator.expressions.erlang + + case Var of +% ^ - meta.case +% ^^^^^^^^^ meta.case.erlang +% ^^^^ keyword.control.conditional.case.erlang +% ^^^ variable.other.erlang + {ok, time} when is_tuple(); Bar /= false -> +% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.case.erlang +% ^^^^^^^^^^ meta.sequence.tuple.erlang +% ^ - meta.sequence +% ^^^^^^^^ meta.function-call.name.erlang +% ^^ meta.function-call.arguments.erlang +% ^^^^ keyword.control.conditional.when.erlang +% ^^^^^^^^ support.function.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.separator.clauses.erlang +% ^^^ variable.other.erlang +% ^^ keyword.operator.logical.erlang +% ^^^^^ constant.language.boolean.erlang +% ^^ punctuation.separator.clause-head-body.erlang + print("ok"); +% ^^^^^^^^^^^^ meta.case.erlang +% ^^^^^^^^^^^ meta.function-call +% ^^ meta.case.erlang +% ^ punctuation.separator.clauses.erlang + error -> +% ^^^^^^^^^^ meta.case.erlang +% ^^ punctuation.separator.clause-head-body.erlang + print("not ok") +% ^^^^^^^^^^^^^^^^^ meta.case.erlang +% ^^^^^^^^^^^^^^^ meta.function-call + end. +% ^^^^ meta.case.erlang +% ^ - meta.case.erlang +% ^^^ keyword.control.conditional.end.erlang +% ^ punctuation.terminator.clause.erlang + +if_tests() -> + + if4you +% ^^^^^^ constant.other.symbol.erlang - keyword + + if_here +% ^^^^^^^ constant.other.symbol.erlang - keyword + + if@here +% ^^^^^^^ constant.other.symbol.erlang - keyword + + if +% ^ - meta.if +% ^^^^^ meta.if.erlang +% ^^ keyword.control.conditional.if.erlang + end, +% ^^^ meta.if.erlang +% ^ - meta.if +% ^^^ keyword.control.conditional.end.erlang +% ^ punctuation.separator.expressions.erlang + + if +% ^ - meta.if +% ^^^ meta.if.erlang +% ^^ keyword.control.conditional.if.erlang + {ok, time} when is_tuple(); Bar /= false -> +% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.if.erlang +% ^^^^^^^^^^ meta.sequence.tuple.erlang +% ^ - meta.sequence +% ^^^^^^^^ meta.function-call.name.erlang +% ^^ meta.function-call.arguments.erlang +% ^^^^ keyword.control.conditional.when.erlang +% ^^^^^^^^ support.function.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.separator.clauses.erlang +% ^^^ variable.other.erlang +% ^^ keyword.operator.logical.erlang +% ^^^^^ constant.language.boolean.erlang +% ^^ punctuation.separator.clause-head-body.erlang + print("ok"); +% ^^^^^^^^^^^^ meta.if.erlang +% ^^^^^^^^^^^ meta.function-call +% ^^ meta.if.erlang +% ^ punctuation.separator.clauses.erlang + true -> +% ^^^^^^^^^ meta.if.erlang +% ^^ punctuation.separator.clause-head-body.erlang + print("not ok") +% ^^^^^^^^^^^^^^^^^ meta.if.erlang +% ^^^^^^^^^^^^^^^ meta.function-call + end. +% ^^^^ meta.if.erlang +% ^ - meta.if.erlang +% ^^^ keyword.control.conditional.end.erlang +% ^ punctuation.terminator.clause.erlang + +function_call_tests() -> + +% erlang is a special autoimported namespace + + erlang +% ^^^^^^ meta.atom.erlang constant.other.symbol.erlang - meta.path - support.namespace + + erlang: +% ^ - meta.path +% ^^^^^^ meta.path.erlang support.namespace.erlang +% ^ meta.path.erlang punctuation.accessor.double-colon.erlang +% ^ - meta.path + + erlang:foo(X), +% ^ - meta.path +% ^^^^^^^ meta.path.erlang - meta.function-call +% ^^^ meta.path.erlang meta.function-call.name.erlang +% ^^^ meta.function-call.arguments.erlang - meta.path +% ^ - meta.path - meta.function-call +% ^^^^^^ support.namespace.erlang +% ^ punctuation.accessor.double-colon.erlang +% ^^^ variable.function.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ variable.other.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.separator.expressions.erlang + +% match builtin functions without respect of preceeded namespace + + erlang:abs(X), +% ^^^^^^^ meta.path.erlang - meta.function-call +% ^^^ meta.path.erlang meta.function-call.name.erlang +% ^^^ meta.function-call.arguments.erlang - meta.path +% ^ - meta.path - meta.function-call +% ^^^^^^ support.namespace.erlang +% ^ punctuation.accessor.double-colon.erlang +% ^^^ support.function.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ variable.other.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.separator.expressions.erlang + + erlang : abs ( X ) , +% ^^^^^^^^^ meta.path.erlang - meta.function-call +% ^^^^ meta.path.erlang meta.function-call.name.erlang +% ^^^^^ meta.function-call.arguments.erlang - meta.path +% ^^ - meta.path - meta.function-call +% ^^^^^^ support.namespace.erlang +% ^^^ - constant - support - variable +% ^ punctuation.accessor.double-colon.erlang +% ^^^ support.function.erlang +% ^ - constant - support - variable +% ^ punctuation.section.arguments.begin.erlang +% ^ variable.other.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.separator.expressions.erlang + + module:abs(X), +% ^^^^^^^ meta.path.erlang - meta.function-call +% ^^^ meta.path.erlang meta.function-call.name.erlang +% ^^^ meta.function-call.arguments.erlang - meta.path +% ^ - meta.path - meta.function-call +% ^^^^^^ variable.namespace.erlang +% ^ punctuation.accessor.double-colon.erlang +% ^^^ support.function.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ variable.other.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.separator.expressions.erlang + + '\'od%le':abs(X), +% ^^^^^^^^^^ meta.path.erlang - meta.function-call +% ^^^ meta.path.erlang meta.function-call.name.erlang +% ^^^ meta.function-call.arguments.erlang - meta.path +% ^ - meta.path - meta.function-call +% ^^^^^^^^^ variable.namespace.erlang +% ^ punctuation.accessor.double-colon.erlang +% ^^^ support.function.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ variable.other.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.separator.expressions.erlang + + 'M\'od%le ' : abs ( X ), +% ^^^^^^^^^^^^^^ meta.path.erlang - meta.function-call +% ^^^^ meta.path.erlang meta.function-call.name.erlang +% ^^^^^ meta.function-call.arguments.erlang - meta.path +% ^ - meta.path - meta.function-call +% ^^^^^^^^^^^ variable.namespace.erlang +% ^^^ - constant - support - variable +% ^ punctuation.accessor.double-colon.erlang +% ^^^ support.function.erlang +% ^ - constant - support - variable +% ^ punctuation.section.arguments.begin.erlang +% ^ variable.other.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.separator.expressions.erlang + + Module:abs(X), +% ^^^^^^^ meta.path.erlang - meta.function-call +% ^^^ meta.path.erlang meta.function-call.name.erlang +% ^^^ meta.function-call.arguments.erlang - meta.path +% ^ - meta.path - meta.function-call +% ^^^^^^ variable.other.erlang +% ^ punctuation.accessor.double-colon.erlang +% ^^^ support.function.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ variable.other.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.separator.expressions.erlang + + ?MODULE:abs(X), +% ^^^^^^^^ meta.path.erlang - meta.function-call +% ^^^ meta.path.erlang meta.function-call.name.erlang +% ^^^ meta.function-call.arguments.erlang - meta.path +% ^ - meta.path - meta.function-call +% ^ punctuation.definition.macro.erlang +% ^^^^^^^ constant.language.macro.erlang +% ^ punctuation.accessor.double-colon.erlang +% ^^^ support.function.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ variable.other.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.separator.expressions.erlang + + ?foo:abs(X), +% ^^^^^ meta.path.erlang - meta.function-call +% ^^^ meta.path.erlang meta.function-call.name.erlang +% ^^^ meta.function-call.arguments.erlang - meta.path +% ^ - meta.path - meta.function-call +% ^ punctuation.definition.macro.erlang +% ^^^^ constant.other.macro.erlang +% ^ punctuation.accessor.double-colon.erlang +% ^^^ support.function.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ variable.other.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.separator.expressions.erlang + + ?'foo\'-%b':abs(X), +% ^^^^^^^^^^^^ meta.path.erlang - meta.function-call +% ^^^ meta.path.erlang meta.function-call.name.erlang +% ^^^ meta.function-call.arguments.erlang - meta.path +% ^ - meta.path - meta.function-call +% ^ punctuation.definition.macro.erlang +% ^^^^^^^^^^^ constant.other.macro.erlang +% ^ punctuation.definition.atom.begin.erlang +% ^ punctuation.definition.escape.erlang +% ^ punctuation.definition.atom.end.erlang +% ^ punctuation.accessor.double-colon.erlang +% ^^^ support.function.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ variable.other.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.separator.expressions.erlang + +% builtins don't need the namespace preceeded + + abs(X), +% ^ - meta.function-call - meta.path +% ^^^ meta.function-call.name.erlang - meta.path +% ^^^ meta.function-call.arguments.erlang - meta.path +% ^ - meta.function-call - meta.path +% ^^^ support.function.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ variable.other.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.separator.expressions.erlang + + abs ( X ) , +% ^ - meta.function-call - meta.path +% ^^^^ meta.function-call.name.erlang - meta.path +% ^^^^^ meta.function-call.arguments.erlang - meta.path +% ^^^ - meta.function-call - meta.path +% ^^^ support.function.erlang +% ^ - constant - support - variable +% ^ punctuation.section.arguments.begin.erlang +% ^ variable.other.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.separator.expressions.erlang + + abs@(X), +% ^ - meta.function-call - meta.path +% ^^^^ meta.function-call.name.erlang - meta.path +% ^^^ meta.function-call.arguments.erlang - meta.path +% ^ - meta.function-call - meta.path +% ^^^^ variable.function.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ variable.other.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.separator.expressions.erlang + + not@abs(X), +% ^ - meta.function-call - meta.path +% ^^^^^^^ meta.function-call.name.erlang - meta.path +% ^^^ meta.function-call.arguments.erlang - meta.path +% ^ - meta.function-call - meta.path +% ^^^^^^^ variable.function.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ variable.other.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.separator.expressions.erlang + + not_abs(X), +% ^ - meta.function-call +% ^^^^^^^ meta.function-call.name.erlang +% ^^^ meta.function-call.arguments.erlang +% ^ - meta.function-call +% ^^^^^^^ variable.function.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ variable.other.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.separator.expressions.erlang + +% match as normal function if name contains escaped unbalanced quotes + + 'abs\''(X), +% ^ - meta.function-call - meta.path +% ^^^^^^^ meta.function-call.name.erlang - meta.path +% ^^^ meta.function-call.arguments.erlang - meta.path +% ^ - meta.function-call - meta.path +% ^^^^^^^ variable.function.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ variable.other.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.separator.expressions.erlang + + ' abs\' ' ( X ), +% ^ - meta.function-call - meta.path +% ^^^^^^^^^^ meta.function-call.name.erlang - meta.path +% ^^^^^ meta.function-call.arguments.erlang - meta.path +% ^ - meta.function-call - meta.path +% ^^^^^^^^^ variable.function.erlang +% ^ - constant - support - variable +% ^ punctuation.section.arguments.begin.erlang +% ^ variable.other.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.separator.expressions.erlang + +% match as normal function if name contains escaped quotes or `%` + + '\'abs%\''(X), +% ^ - meta.function-call +% ^^^^^^^^^^ meta.function-call.name.erlang +% ^^^ meta.function-call.arguments.erlang +% ^ - meta.function-call +% ^^^^^^^^^^ variable.function.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ variable.other.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.separator.expressions.erlang + + ' \'abs%\' ' ( X ), +% ^ - meta.function-call +% ^^^^^^^^^^^^^ meta.function-call.name.erlang +% ^^^^^ meta.function-call.arguments.erlang +% ^ - meta.function-call +% ^^^^^^^^^^^^ variable.function.erlang +% ^ - constant - support - variable +% ^ punctuation.section.arguments.begin.erlang +% ^ variable.other.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.separator.expressions.erlang + +% don't match macro names as builin functions + + ?FUNC(X), +% ^ - meta.function-call - meta.path +% ^^^^^ meta.function-call.name.erlang - meta.path +% ^^^ meta.function-call.arguments.erlang - meta.path +% ^ - meta.function-call - meta.path +% ^ punctuation.definition.macro.erlang +% ^^^^^ constant.other.macro.erlang - support.function +% ^ punctuation.section.arguments.begin.erlang +% ^ variable.other.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.separator.expressions.erlang + + ?ABS ( X ) , +% ^ - meta.function-call - meta.path +% ^^^^^ meta.function-call.name.erlang - meta.path +% ^^^^^ meta.function-call.arguments.erlang - meta.path +% ^ - meta.function-call - meta.path +% ^ punctuation.definition.macro.erlang +% ^^^^ constant.other.macro.erlang - support.function +% ^ - constant - support - variable +% ^ punctuation.section.arguments.begin.erlang +% ^ variable.other.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.separator.expressions.erlang + + ?'abs'(X), +% ^ - meta.function-call - meta.path +% ^^^^^^ meta.function-call.name.erlang - meta.path +% ^^^ meta.function-call.arguments.erlang - meta.path +% ^ - meta.function-call - meta.path +% ^ punctuation.definition.macro.erlang +% ^^^^^^ constant.other.macro.erlang - support.function +% ^ punctuation.definition.atom.begin.erlang +% ^ punctuation.definition.atom.end.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ variable.other.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.separator.expressions.erlang + + ?'abs' ( X ) , +% ^ - meta.function-call - meta.path +% ^^^^^^^ meta.function-call.name.erlang - meta.path +% ^^^^^ meta.function-call.arguments.erlang - meta.path +% ^ - meta.function-call - meta.path +% ^ punctuation.definition.macro.erlang +% ^^^^^^ constant.other.macro.erlang - support.function +% ^ punctuation.definition.atom.begin.erlang +% ^ punctuation.definition.atom.end.erlang +% ^ - constant - support - variable +% ^ punctuation.section.arguments.begin.erlang +% ^ variable.other.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.separator.expressions.erlang + + ?'abs\''(X), +% ^ - meta.function-call - meta.path +% ^^^^^^^^ meta.function-call.name.erlang - meta.path +% ^^^ meta.function-call.arguments.erlang - meta.path +% ^ - meta.function-call - meta.path +% ^ punctuation.definition.macro.erlang +% ^^^^^^^^ constant.other.macro.erlang - support.function +% ^ punctuation.definition.atom.begin.erlang +% ^ punctuation.definition.atom.end.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ variable.other.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.separator.expressions.erlang + + ?' abs\' ' ( X ), +% ^ - meta.function-call - meta.path +% ^^^^^^^^^^^ meta.function-call.name.erlang - meta.path +% ^^^^^ meta.function-call.arguments.erlang - meta.path +% ^ - meta.function-call - meta.path +% ^^^^^^^^^^ constant.other.macro.erlang - support.function +% ^ - constant - support - variable +% ^ punctuation.section.arguments.begin.erlang +% ^ variable.other.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.separator.expressions.erlang + + ?'\'abs%\''(X), +% ^ - meta.function-call - meta.path +% ^^^^^^^^^^^ meta.function-call.name.erlang - meta.path +% ^^^ meta.function-call.arguments.erlang - meta.path +% ^ - meta.function-call - meta.path +% ^^^^^^^^^^^ constant.other.macro.erlang - support.function +% ^ punctuation.section.arguments.begin.erlang +% ^ variable.other.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.separator.expressions.erlang + + ?' \'abs%\' ' ( X ), +% ^ - meta.function-call - meta.path +% ^^^^^^^^^^^^^^ meta.function-call.name.erlang - meta.path +% ^^^^^ meta.function-call.arguments.erlang - meta.path +% ^ - meta.function-call - meta.path +% ^^^^^^^^^^^^^ constant.other.macro.erlang - support.function +% ^ - constant - support - variable +% ^ punctuation.section.arguments.begin.erlang +% ^ variable.other.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.separator.expressions.erlang + +% a quote is an identifier break, so `?abs` is the function only + + ?'2Bin'?abs(X), +% ^ - meta.function-call - meta.path +% ^^^^ meta.function-call.name.erlang - meta.path +% ^^^ meta.function-call.arguments.erlang - meta.path +% ^ - meta.function-call - meta.path +% ^ punctuation.definition.macro.erlang +% ^^^^^^^ constant.other.macro.erlang - variable.function +% ^^^^ constant.other.macro.erlang - support.function +% ^ punctuation.definition.atom.begin.erlang +% ^ punctuation.definition.atom.end.erlang +% ^ punctuation.definition.macro.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ variable.other.erlang +% ^ punctuation.section.arguments.end.erlang +% ^ punctuation.separator.expressions.erlang + +% a function can be identified by special language macros + + ?MODULE : ?FUNCTION_NAME ( X , Y ). +% ^^^^^^^^^^ meta.path.erlang - meta.function-call +% ^^^^^^^^^^^^^^^ meta.path.erlang meta.function-call.name.erlang - meta.function-call.arguments.erlang +% ^^^^^^^^^ meta.function-call.arguments.erlang - meta.function-call.name.erlang - meta.path +% ^ - meta.path - meta.function-call +% ^ punctuation.definition.macro.erlang +% ^^^^^^^ constant.language.macro.erlang +% ^^^ - constant - support - variable +% ^ punctuation.accessor.double-colon.erlang +% ^ punctuation.definition.macro.erlang +% ^^^^^^^^^^^^^^ constant.language.macro.erlang +% ^ - constant - support - variable +% ^ punctuation.section.arguments.begin.erlang +% ^ variable.other.erlang +% ^ punctuation.separator.arguments.erlang +% ^ variable.other.erlang +% ^ punctuation.section.arguments.end.erlang + +% fun expression tests +% http://erlang.org/doc/reference_manual/expressions.html#fun-expressions + +fun_expression_tests() -> + + fun4you +% ^^^^^^^ constant.other.symbol.erlang - keyword + + fun_name +% ^^^^^^^^ constant.other.symbol.erlang - keyword + + fun@name +% ^^^^^^^^ constant.other.symbol.erlang - keyword + + end@name +% ^^^^^^^^ constant.other.symbol.erlang - keyword + + fun +% ^ - meta.fun +% ^^^ meta.function.erlang meta.fun.erlang keyword.declaration.function.erlang + end +% ^^^ meta.function.erlang meta.fun.erlang keyword.declaration.end.erlang +% ^ - meta.fun + + Abs = fun erlang:abs/1, +% ^ - meta.fun.erlang +% ^^^^ meta.function.erlang meta.fun.erlang - meta.path +% ^^^^^^^^^^^^ meta.function.erlang meta.fun.erlang meta.path.erlang +% ^ - meta.fun.erlang +% ^^^ variable.other.erlang +% ^ keyword.operator.assignment.erlang +% ^^^ keyword.declaration.function.erlang +% ^^^^^^ support.namespace.erlang +% ^ punctuation.accessor.double-colon.erlang +% ^^^ support.function.erlang +% ^ punctuation.separator.reference.erlang +% ^ constant.numeric.integer.decimal.erlang + + Abs = fun module:abs/1, +% ^ - meta.fun.erlang +% ^^^^ meta.function.erlang meta.fun.erlang - meta.path +% ^^^^^^^^^^^^ meta.function.erlang meta.fun.erlang meta.path.erlang +% ^ - meta.fun.erlang +% ^^^ variable.other.erlang +% ^ keyword.operator.assignment.erlang +% ^^^ keyword.declaration.function.erlang +% ^^^^^^ variable.namespace.erlang +% ^ punctuation.accessor.double-colon.erlang +% ^^^ support.function.erlang +% ^ punctuation.separator.reference.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^ punctuation.separator.expressions.erlang + + Abs = fun abs/1, +% ^ - meta.fun.erlang +% ^^^^^^^^^ meta.function.erlang meta.fun.erlang - meta.path +% ^ - meta.fun.erlang +% ^^^ variable.other.erlang +% ^ keyword.operator.assignment.erlang +% ^^^ keyword.declaration.function.erlang +% ^^^ support.function.erlang +% ^ punctuation.separator.reference.erlang +% ^ constant.numeric.integer.decimal.erlang + + Fun1 = fun name/10, +% ^ - meta.fun +% ^^^^^^^^^^^ meta.function.erlang meta.fun.erlang - meta.fun.name - meta.path +% ^ - meta.fun +% ^^^^ variable.other.erlang +% ^ keyword.operator.assignment.erlang +% ^^^ keyword.declaration.function.erlang +% ^^^^ variable.function.erlang +% ^ punctuation.separator.reference.erlang +% ^^ constant.numeric.integer.decimal.erlang +% ^ punctuation.separator.expressions.erlang + + Fun1 = fun ?MODULE:name/10, +% ^ - meta.fun +% ^^^^ meta.function.erlang meta.fun.erlang - meta.path +% ^^^^^^^^^^^^^^^ meta.function.erlang meta.fun.erlang meta.path.erlang +% ^ - meta.fun +% ^^^^ variable.other.erlang +% ^ keyword.operator.assignment.erlang +% ^^^ keyword.declaration.function.erlang +% ^ punctuation.definition.macro.erlang +% ^^^^^^^ constant.language.macro.erlang +% ^ punctuation.accessor.double-colon.erlang +% ^^^^ variable.function.erlang +% ^ punctuation.separator.reference.erlang +% ^^ constant.numeric.integer.decimal.erlang +% ^ punctuation.separator.expressions.erlang + + Fun1 = fun ?CUSTOM:name/?ARI, +% ^ - meta.fun +% ^^^^ meta.function.erlang meta.fun.erlang - meta.path +% ^^^^^^^^^^^^^^^^^ meta.function.erlang meta.fun.erlang meta.path.erlang +% ^ - meta.fun +% ^^^^ variable.other.erlang +% ^ keyword.operator.assignment.erlang +% ^^^ keyword.declaration.function.erlang +% ^ punctuation.definition.macro.erlang +% ^^^^^^^ constant.other.macro.erlang +% ^ punctuation.accessor.double-colon.erlang +% ^^^^ variable.function.erlang +% ^ punctuation.separator.reference.erlang +% ^ punctuation.definition.macro.erlang +% ^^^^ constant.other.macro.erlang +% ^ punctuation.separator.expressions.erlang + + Fun1 = fun module:name/Ari, +% ^ - meta.fun +% ^^^^ meta.function.erlang meta.fun.erlang - meta.path +% ^^^^^^^^^^^^^^^ meta.function.erlang meta.fun.erlang meta.path.erlang +% ^ - meta.fun +% ^^^^ variable.other.erlang +% ^ keyword.operator.assignment.erlang +% ^^^ keyword.declaration.function.erlang +% ^^^^^^ variable.namespace.erlang +% ^ punctuation.accessor.double-colon.erlang +% ^^^^ variable.function.erlang +% ^ punctuation.separator.reference.erlang +% ^^^ variable.other.erlang +% ^ punctuation.separator.expressions.erlang + + Fun1 = fun 'my-module':name/10, +% ^ - meta.fun +% ^^^^ meta.function.erlang meta.fun.erlang - meta.path +% ^^^^^^^^^^^^^^^^^^^ meta.function.erlang meta.fun.erlang meta.path.erlang +% ^ - meta.fun +% ^^^^ variable.other.erlang +% ^ keyword.operator.assignment.erlang +% ^^^ keyword.declaration.function.erlang +% ^ punctuation.definition.atom.begin.erlang +% ^^^^^^^^^ variable.namespace.erlang +% ^ punctuation.definition.atom.end.erlang +% ^ punctuation.accessor.double-colon.erlang +% ^^^^ variable.function.erlang +% ^ punctuation.separator.reference.erlang +% ^^ constant.numeric.integer.decimal.erlang +% ^ punctuation.separator.expressions.erlang + + Fun1 = fun 'my-module':?NAME/_, +% ^ - meta.fun +% ^^^^ meta.function.erlang meta.fun.erlang - meta.path +% ^^^^^^^^^^^^^^^^^^^ meta.function.erlang meta.fun.erlang meta.path.erlang +% ^ - meta.fun +% ^^^^ variable.other.erlang +% ^ keyword.operator.assignment.erlang +% ^^^ keyword.declaration.function.erlang +% ^ punctuation.definition.atom.begin.erlang +% ^^^^^^^^^ variable.namespace.erlang +% ^ punctuation.definition.atom.end.erlang +% ^ punctuation.accessor.double-colon.erlang +% ^ punctuation.definition.macro.erlang +% ^^^^^ constant.other.macro.erlang +% ^ punctuation.separator.reference.erlang +% ^ variable.language.anonymous.erlang +% ^ punctuation.separator.expressions.erlang + + Fun1 = fun 'my-\^dule':'m\1func'/10, +% ^ - meta.fun +% ^^^^ meta.function.erlang meta.fun.erlang - meta.path +% ^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.erlang meta.fun.erlang meta.path.erlang +% ^ - meta.fun +% ^^^^ variable.other.erlang +% ^ keyword.operator.assignment.erlang +% ^^^ keyword.declaration.function.erlang +% ^ punctuation.definition.atom.begin.erlang +% ^^^^^^^^^ variable.namespace.erlang +% ^ punctuation.definition.atom.end.erlang +% ^ punctuation.accessor.double-colon.erlang +% ^ punctuation.definition.atom.begin.erlang +% ^^^^^^^ variable.function.erlang +% ^ punctuation.definition.atom.end.erlang +% ^ punctuation.separator.reference.erlang +% ^^ constant.numeric.integer.decimal.erlang +% ^ punctuation.separator.expressions.erlang + +% nested anonymous function definition + + Fun1 = fun abs(X) -> F = fun(Y) -> X+1 end, F(abs(X)) end, +% ^ - meta.fun +% ^^^^ meta.function.erlang meta.fun.erlang +% ^^^ meta.function.erlang meta.fun.name.erlang +% ^^^ meta.function.erlang meta.fun.parameters.erlang +% ^^^^^^^^ meta.function.erlang meta.fun.erlang - meta.fun meta.fun +% ^^^ meta.function.erlang meta.fun.erlang meta.fun.erlang +% ^^^ meta.function.erlang meta.fun.erlang meta.fun.parameters.erlang +% ^^^^^^^^^^^ meta.function.erlang meta.fun.erlang meta.fun.erlang +% ^^^^^^^^^^^^^^^ meta.function.erlang meta.fun.erlang - meta.fun meta.fun +% ^^^^^^^^^ meta.function-call +% ^ - meta.fun +% ^^^^ variable.other.erlang +% ^ keyword.operator.assignment.erlang +% ^^^ keyword.declaration.function.erlang +% ^^^ invalid.illegal.expect-variable.erlang +% ^ punctuation.section.parameters.begin.erlang +% ^ punctuation.section.parameters.end.erlang +% ^^ punctuation.separator.clause-head-body.erlang +% ^ variable.other.erlang +% ^ keyword.operator.assignment.erlang +% ^^^ keyword.declaration.function.erlang +% ^ punctuation.section.parameters.begin.erlang +% ^ variable.parameter.erlang +% ^ punctuation.section.parameters.end.erlang +% ^^ punctuation.separator.clause-head-body.erlang +% ^ variable.other.erlang +% ^ keyword.operator.arithmetic.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^^^ keyword.declaration.end.erlang +% ^ punctuation.separator.expressions.erlang +% ^ variable.other.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^^^ support.function.erlang +% ^^^ keyword.declaration.end.erlang +% ^ punctuation.separator.expressions.erlang + +% guarded, overloaded anonymous functions + + Fun2 = fun (X) when X>=5 -> gt; (X) -> lt end, +% ^ - meta.fun +% ^^^^ meta.function.erlang meta.fun.erlang - meta.fun.name - meta.fun.parameters +% ^^^ meta.function.erlang meta.fun.parameters.erlang - meta.fun.erlang - meta.fun.name +% ^^^^^^^^^^^^^^^^^^ meta.function.erlang meta.fun.erlang - meta.fun.name - meta.fun.parameters - meta.fun.name +% ^^^ meta.function.erlang meta.fun.parameters.erlang - meta.fun.erlang - meta.fun.name +% ^^^^^^^^^^ meta.function.erlang meta.fun.erlang - meta.fun.name - meta.fun.parameters +% ^ - meta.fun +% ^^^^ variable.other.erlang +% ^ keyword.operator.assignment.erlang +% ^^^ keyword.declaration.function.erlang +% ^ punctuation.section.parameters.begin.erlang +% ^ variable.parameter.erlang +% ^ punctuation.section.parameters.end.erlang +% ^^^^ keyword.control.conditional.when.erlang +% ^ variable.other.erlang +% ^^ keyword.operator.logical.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^^ punctuation.separator.clause-head-body.erlang +% ^^ constant.other.symbol.erlang +% ^ punctuation.section.parameters.begin.erlang +% ^ variable.parameter.erlang +% ^ punctuation.section.parameters.end.erlang +% ^^ punctuation.separator.clause-head-body.erlang +% ^^ constant.other.symbol.erlang +% ^^^ keyword.declaration.end.erlang +% ^ punctuation.separator.expressions.erlang + +% recursive anonymous function calls + + Fun3 = fun Fact(1) -> 1; Fact(X) when X > 1 -> X * Fact(X - 1) end, +% ^ - meta.fun +% ^^^^ meta.function.erlang meta.fun.erlang - meta.fun.name - meta.fun.parameters +% ^^^^ meta.function.erlang meta.fun.name.erlang - meta.fun.erlang - meta.fun.parameters +% ^^^ meta.function.erlang meta.fun.parameters.erlang - meta.fun.erlang - meta.fun.name +% ^^^^^^^ meta.function.erlang meta.fun.erlang - meta.fun.name - meta.fun.parameters +% ^^^^ meta.function.erlang meta.fun.name.erlang - meta.fun.erlang - meta.fun.parameters +% ^^^ meta.function.erlang meta.fun.parameters.erlang - meta.fun.erlang - meta.fun.name +% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.erlang meta.fun.erlang - meta.fun.name - meta.fun.parameters +% ^^^^^^^^^^^ meta.function-call +% ^ - meta.fun +% ^^^^ variable.other.erlang +% ^ keyword.operator.assignment.erlang +% ^^^ keyword.declaration.function.erlang +% ^^^^ variable.other.erlang +% ^ punctuation.section.parameters.begin.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^ punctuation.section.parameters.end.erlang +% ^^ punctuation.separator.clause-head-body.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^ punctuation.separator.clauses.erlang +% ^^^^ variable.other.erlang +% ^ punctuation.section.parameters.begin.erlang +% ^ variable.parameter.erlang +% ^ punctuation.section.parameters.end.erlang +% ^^^^ keyword.control.conditional.when.erlang +% ^ variable.other.erlang +% ^ keyword.operator.logical.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^^ punctuation.separator.clause-head-body.erlang +% ^ variable.other.erlang +% ^ keyword.operator.arithmetic.erlang +% ^^^^ variable.other.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ variable.other.erlang +% ^ keyword.operator.arithmetic.erlang +% ^ constant.numeric.integer.decimal.erlang +% ^ punctuation.section.arguments.end.erlang +% ^^^ keyword.declaration.end.erlang +% ^ punctuation.separator.expressions.erlang + + Fun1 = fun +% ^ - meta.fun +% ^^^^ meta.function.erlang meta.fun.erlang +% ^^^^ variable.other.erlang +% ^ keyword.operator.assignment.erlang +% ^^^ keyword.declaration.function.erlang + (A, B) when A == true; is_tuple(B) -> +% ^^^^^^ meta.function.erlang meta.fun.parameters.erlang +% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.erlang meta.fun.erlang - meta.fun.name - meta.fun.parameters +% ^^^^^^^^^^^ meta.function-call +% ^ punctuation.section.parameters.begin.erlang +% ^ variable.parameter.erlang +% ^ punctuation.separator.parameters.erlang +% ^ variable.parameter.erlang +% ^ punctuation.section.parameters.end.erlang +% ^^^^ keyword.control.conditional.when.erlang +% ^ variable.other.erlang +% ^^ keyword.operator.logical.erlang +% ^^^^ constant.language.boolean.erlang +% ^ punctuation.separator.clauses.erlang +% ^^^^^^^^ support.function.erlang +% ^ punctuation.section.arguments.begin.erlang +% ^ variable.other.erlang +% ^ punctuation.section.arguments.end.erlang +% ^^ punctuation.separator.clause-head-body.erlang + Test = 40; +% ^^^^^^^^^ meta.function.erlang meta.fun.erlang +% ^ meta.function.erlang meta.fun.erlang +% ^^^^ variable.other.erlang +% ^ keyword.operator.assignment.erlang +% ^^ constant.numeric.integer.decimal.erlang +% ^ punctuation.separator.clauses.erlang + + (A, B) when C = #{A => B}, is_map(C); is_list(A++B) -> +% ^^^^^^ meta.function.erlang meta.fun.parameters.erlang +% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.erlang meta.fun.erlang - meta.fun.name - meta.fun.parameters +% ^^^^^^^^^ meta.mapping +% ^^^^^^^^^ meta.function-call +% ^^^^^^^^^^^^^ meta.function-call +% ^ punctuation.section.parameters.begin.erlang +% ^ variable.parameter.erlang +% ^ punctuation.separator.parameters.erlang +% ^ variable.parameter.erlang +% ^ punctuation.section.parameters.end.erlang + apply(B), +% ^^^^^^^^^^^ meta.function.erlang meta.fun.erlang +% ^^^^^ support.function.erlang + Test = 50; +% ^^^^^^^^^^ meta.function.erlang meta.fun.erlang +% ^ meta.function.erlang meta.fun.erlang +% ^^^^ variable.other.erlang +% ^ keyword.operator.assignment.erlang +% ^^ constant.numeric.integer.decimal.erlang +% ^ punctuation.separator.clauses.erlang + + (A, B) -> +% ^^^^^^ meta.function.erlang meta.fun.parameters.erlang +% ^^^^ meta.function.erlang meta.fun.erlang - meta.fun.name - meta.fun.parameters +% ^ punctuation.section.parameters.begin.erlang +% ^ variable.parameter.erlang +% ^ punctuation.separator.parameters.erlang +% ^ variable.parameter.erlang +% ^ punctuation.section.parameters.end.erlang +% ^^ punctuation.separator.clause-head-body.erlang + Fun = fun name/10, +% ^ meta.function.erlang meta.fun.erlang - meta.fun.erlang meta.fun.erlang +% ^^^^^^^^^^^ meta.function.erlang meta.fun.erlang meta.fun.erlang +% ^ meta.function.erlang meta.fun.erlang - meta.fun.erlang meta.fun.erlang +% ^^^ variable.other.erlang +% ^ keyword.operator.assignment.erlang +% ^^^ keyword.declaration.function.erlang +% ^^^^ variable.function.erlang +% ^ punctuation.separator.reference.erlang +% ^^ constant.numeric.integer.decimal.erlang +% ^ punctuation.separator.expressions.erlang + error +% ^^^^^ meta.function.erlang meta.fun.erlang constant.language.exception.type.erlang + end. +%^^^^^^ meta.function.erlang meta.fun.erlang +% ^ - meta.fun +% ^^^ keyword.declaration.end.erlang +% ^ punctuation.terminator.clause.erlang + + +try_catch_tests() -> + + _try try@me no@try +% ^^^^^^^^^^^^^^^^^^ - keyword + + try +% ^ - meta.exception +% ^^^^ meta.exception.try.erlang +% ^^^ keyword.control.exception.try.erlang + end, +% ^ meta.exception.try.erlang +% ^^^ meta.exception.try.erlang keyword.control.exception.end.erlang +% ^ - meta.exception + + try +% ^ - meta.exception +% ^^^^ meta.exception.try.erlang +% ^^^ keyword.control.exception.try.erlang + catch +% ^ meta.exception.try.erlang +% ^^^^^^ meta.exception.catch.erlang +% ^^^^^ keyword.control.exception.catch.erlang + end, +% ^ meta.exception.catch.erlang +% ^^^ meta.exception.try.erlang keyword.control.exception.end.erlang +% ^ - meta.exception + + try +% ^ - meta.exception +% ^^^^ meta.exception.try.erlang +% ^^^ keyword.control.exception.try.erlang + after +% ^ meta.exception.try.erlang +% ^^^^^^ meta.exception.after.erlang +% ^^^^^ keyword.control.exception.after.erlang + end, +% ^ meta.exception.after.erlang +% ^^^ meta.exception.try.erlang keyword.control.exception.end.erlang +% ^ - meta.exception + + try +% ^ - meta.exception +% ^^^^ meta.exception.try.erlang +% ^^^ keyword.control.exception.try.erlang + catch +% ^ meta.exception.try.erlang +% ^^^^^^ meta.exception.catch.erlang +% ^^^^^ keyword.control.exception.catch.erlang + after +% ^ meta.exception.catch.erlang +% ^^^^^^ meta.exception.after.erlang +% ^^^^^ keyword.control.exception.after.erlang + end, +% ^ meta.exception.after.erlang +% ^^^ meta.exception.try.erlang keyword.control.exception.end.erlang +% ^ - meta.exception + + try apply(arg, arg) of +% ^ - meta.exception +% ^^^^^^^^^^^^^^^^^^^^^^^ meta.exception.try.erlang +% ^^^^^^^^^^^^^^^ meta.function-call +% ^^^ keyword.control.exception.try.erlang + Expected -> +% ^^^^^^^^^^^^^ meta.exception.try.erlang +% ^^^^^^^^ variable.other.erlang +% ^^ punctuation.separator.clause-head-body.erlang + ok; +% ^^^^^ meta.exception.try.erlang +% ^^ constant.language.exception.type.erlang +% ^ meta.exception.try.erlang punctuation.separator.clauses.erlang + _ -> +% ^^^^^^ meta.exception.try.erlang +% ^ variable.language.anonymous.erlang +% ^^ punctuation.separator.clause-head-body.erlang + ct:fail() +% ^^^^^^^^^^^ meta.exception.try.erlang +% ^^^^^^ meta.function-call +% ^^ variable.namespace.erlang +% ^ punctuation.accessor.double-colon.erlang + catch +% ^ meta.exception.try.erlang +% ^^^^^^ meta.exception.catch.erlang +% ^^^^^ keyword.control.exception.catch.erlang + error:cause:trace when true -> +% ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.exception.catch.erlang +% ^^^^^ constant.language.exception.type.erlang +% ^ punctuation.separator.patterns.erlang + ct:fail(); +% ^^ meta.path.erlang variable.namespace.erlang +% ^ meta.path.erlang punctuation.accessor.double-colon.erlang +% ^^^^ meta.path.erlang variable.function.erlang + Class:Cause -> +% ^^^^^^^^^^^^^^^^^ meta.exception.catch.erlang +% ^^^^^ variable.other.erlang +% ^^^^^ variable.other.erlang + after +% ^ meta.exception.catch.erlang +% ^^^^^^ meta.exception.after.erlang +% ^^^^^ keyword.control.exception.after.erlang + print("ok") + end. +% ^ meta.exception.after.erlang +% ^^^ meta.exception.try.erlang keyword.control.exception.end.erlang +% ^ - meta.exception diff --git a/Erlang/syntax_test_erlang.yaws b/Erlang/syntax_test_erlang.yaws new file mode 100644 index 0000000000..2f6df1dff3 --- /dev/null +++ b/Erlang/syntax_test_erlang.yaws @@ -0,0 +1,86 @@ +% SYNTAX TEST "Packages/Erlang/HTML (Erlang).sublime-syntax" + + + + + +% ^ - meta.tag - source.erlang +% ^^^^^^^^^^^^^^^^^^ meta.tag.erl.begin.html - source.erlang +% ^^^^^^^^^^^^ meta.attribute-with-value.html +% ^ source.erlang.embedded.html - meta.tag +% ^^^^^^^^^^^^^^ meta.tag.erl.end.html - source.erlang +% ^ - meta.tag - source.erlang +% ^ punctuation.definition.tag.begin.html +% ^^^ entity.name.tag.erl.html +% ^^^^^^ entity.other.attribute-name.html +% ^ punctuation.separator.key-value.html +% ^^^^^ string.unquoted.html +% ^ punctuation.definition.tag.end.html +% ^^ punctuation.definition.tag.begin.html +% ^^^ entity.name.tag.erl.html +% ^^^^^^^ invalid.illegal.attributes-unexpected.html +% ^ punctuation.definition.tag.end.html + + +% ^ - meta.tag - source.erlang +% ^^^^^ meta.tag.erl.begin.html - source.erlang +% ^ punctuation.definition.tag.begin.html +% ^^^ entity.name.tag.erl.html +% ^ punctuation.definition.tag.end.html +% ^^^^^^^ source.erlang.embedded.html - meta.tag +% ^^^^^^ meta.tag.erl.end.html - source.erlang +% ^ - meta.tag - source.erlang +% ^^ punctuation.definition.tag.begin.html +% ^^^ entity.name.tag.erl.html +% ^ punctuation.definition.tag.end.html + + +% ^ - meta.tag - source.erlang +% ^^^^^ meta.tag.erl.begin.html - source.erlang +% ^ punctuation.definition.tag.begin.html +% ^^^ entity.name.tag.erl.html +% ^ punctuation.definition.tag.end.html +% ^ source.erlang.embedded.html + func_name(Arg1, Arg2) -> +% ^^^^^^^^^^^^^^^^^^^^^^^^^ source.erlang.embedded.html meta.function + ok. +% ^^ source.erlang.embedded.html constant.language.exception.type.erlang +% ^ source.erlang.embedded.html punctuation.terminator.clause.erlang + + +% ^^^^^^^ - meta.tag + + +%^^^ source.erlang.embedded.html +% ^^^^^^ meta.tag.erl.end.html - source.erlang +% ^ - meta.tag - source.erlang +% ^^ punctuation.definition.tag.begin.html +% ^^^ entity.name.tag.erl.html +% ^ punctuation.definition.tag.end.html + + +%^^^^ meta.tag.erl.begin.html - source.erlang +% ^ punctuation.definition.tag.end.html +% ^ source.erlang.embedded.html + func_name(Arg1, Arg2) -> +% ^^^^^^^^^^^^^^^^^^^^^^^^^ source.erlang.embedded.html meta.function + ok. +% ^^ source.erlang.embedded.html constant.language.exception.type.erlang +% ^ source.erlang.embedded.html punctuation.terminator.clause.erlang + +%^^^^ meta.tag.erl.end.html - source.erlang +% ^ - meta.tag - source.erlang +% ^ punctuation.definition.tag.end.html + + + diff --git a/Git Formats/Git Commit.sublime-syntax b/Git Formats/Git Commit.sublime-syntax index c2b5304332..e278b9ecff 100644 --- a/Git Formats/Git Commit.sublime-syntax +++ b/Git Formats/Git Commit.sublime-syntax @@ -75,6 +75,8 @@ contexts: pop: true - include: Git Common.sublime-syntax#references - include: signed-off + - match: '{{hash}}' + scope: constant.other.hash.git.commit signed-off: - match: ^\s*(Signed-off-by)\s*(:) @@ -112,7 +114,16 @@ contexts: 1: keyword.other.change-list.git.commit 2: punctuation.separator.mapping.pair.change-list.git.commit 3: string.unquoted.git.commit markup.inserted.file.git.commit - - match: \b({{copied}}|{{renamed}}|{{typechange}})\s*(:)\s*(.*) + - match: \b({{copied}}|{{renamed}})\s*(:)\s*((.+)\s+(->)\s+(.+)) + scope: meta.change-list.git.commit + captures: + 1: keyword.other.change-list.git.commit + 2: punctuation.separator.mapping.pair.change-list.git.commit + 3: string.unquoted.git.commit + 4: markup.changed.file.name.git.commit + 5: punctuation.separator.mapping.pair.path.git.commit + 6: markup.changed.file.name.git.commit + - match: \b({{typechange}})\s*(:)\s*(.*) scope: meta.change-list.git.commit captures: 1: keyword.other.change-list.git.commit @@ -144,7 +155,7 @@ contexts: scope: meta.command-list.git.commit captures: 1: keyword.operator.git.commit - 2: constant.numeric.hex.hash.git.commit + 2: constant.other.hash.git.commit 3: string.unquoted.subject.git.commit date-line: diff --git a/Git Formats/Git Common.sublime-syntax b/Git Formats/Git Common.sublime-syntax index 68dc7e1ec7..ffec4e6697 100644 --- a/Git Formats/Git Common.sublime-syntax +++ b/Git Formats/Git Common.sublime-syntax @@ -8,11 +8,38 @@ scope: text.git.common variables: comment_char: '[#;]' + pretty_formats_builtins: oneline|short|medium|fuller|full|email|raw + pretty_formats_empty_value_modifiers: '[-+ ]?' contexts: main: - include: references +##[ PROTOTYPES ]####################################################### + + # Trailing slashes can be used to break up long lines. '\' is only legal at + # the end of a line, or in an escape such as '\"'. Anywhere else it will cause + # a fatal parser error. Comments are not permitted after a trailing slash. + line-continuation: + - match: (\\)\s*$\n? + captures: + 1: punctuation.separator.continuation.line.git + # make sure to resume parsing at next line + push: + - match: (?=\S|^\s*$) + pop: true + + eol-pop: + - include: line-continuation + - match: $ + pop: true + + illegal-eol-pop: + - include: line-continuation + - match: $\n? + scope: invalid.illegal.unexpected.eol.git + pop: true + ##[ COMMENTS ]######################################################### comments: @@ -64,14 +91,32 @@ contexts: email: # email reference - - match: (<)(\S+(\@)\S+?(\.)\S+)(>) - scope: meta.reference.email.git - captures: - 1: punctuation.definition.reference.email.begin.git - 2: entity.name.reference.email.git - 3: punctuation.separator.email.git - 4: punctuation.separator.email.git - 5: punctuation.definition.reference.email.end.git + - match: <(?=\S+?@\S+?\.\S+?>) + scope: punctuation.definition.reference.email.begin.git + push: [email-meta, email-name] + + email-meta: + - meta_scope: meta.reference.email.git + - match: '' + pop: true + + email-name: + - meta_content_scope: entity.name.reference.email.git + - match: '@' + scope: punctuation.separator.email.git + set: email-domain + - include: email-end + + email-domain: + - meta_content_scope: entity.name.reference.email.git + - match: \. + scope: punctuation.separator.domain.git + - include: email-end + + email-end: + - match: '>' + scope: punctuation.definition.reference.email.end.git + pop: true username: # user reference @@ -159,3 +204,167 @@ contexts: scope: invalid.illegal.unexpected.char-class.fnmatch.git - match: \S scope: constant.character.char-class.fnmatch.git + +##[ PRETTY FORMATS ]################################################### + + # https://git-scm.com/docs/pretty-formats + + # Link this from contexts where command line options are highlighted + pretty-formats-as-arg: + - match: (--)(pretty|format)(=)({{pretty_formats_builtins}})?(?:(t?format)(:))? + captures: + 1: punctuation.definition.parameter.shell + 2: variable.parameter.option.shell + 3: keyword.operator.assignment.option.shell + 4: constant.language.pretty-formats.git + 5: keyword.declaration.pretty-formats.git + 6: keyword.operator.assignment.option.pretty-formats.git + push: include-pretty-formats + + # Link this from contexts where command line options are not highlighted + pretty-formats-as-arg-minimal: + - match: (--)(pretty|format)(=)({{pretty_formats_builtins}})?(?:(t?format)(:))? + captures: + # 1: punctuation.definition.parameter.shell + # 2: variable.parameter.option.shell + # 3: keyword.operator.assignment.option.shell + # 4: constant.language.pretty-formats.git + 5: keyword.declaration.pretty-formats.git + 6: keyword.operator.assignment.option.pretty-formats.git + push: include-pretty-formats + + include-pretty-formats: + - meta_content_scope: meta.pretty-formats.git + - match: (?!\S) + pop: true + - match: (\')(?:(t?format)(:))? + captures: + 1: punctuation.definition.string.begin.shell + 2: keyword.declaration.pretty-formats.git + 3: keyword.operator.assignment.option.pretty-formats.git + push: + - meta_scope: string.quoted.single.shell + - match: \' + scope: punctuation.definition.string.end.shell + pop: true + - include: illegal-eol-pop + - include: pretty-formats + - match: \"(?:(t?format)(:))? + captures: + 1: punctuation.definition.string.begin.shell + 2: keyword.declaration.pretty-formats.git + 3: keyword.operator.assignment.option.pretty-formats.git + push: + - meta_scope: string.quoted.double.shell + - match: \" + scope: punctuation.definition.string.end.shell + pop: true + - include: illegal-eol-pop + - include: pretty-formats + - include: pretty-formats + + pretty-formats: + - match: '%%' + scope: constant.character.escape.pretty-formats.git + - match: '%x\d\d' + scope: constant.character.byte.pretty-formats.git + - match: | + (?x) + %{{pretty_formats_empty_value_modifiers}} + (?: + [HhTtPpdDesSfbBNmn]| # single-char + [ac][nNeEdDrtiI]| # author and committer + G[G?DKFP]| # GPG + g[dnNeEs] # reflog + ) + + scope: constant.other.placeholder.pretty-formats.git + - include: pretty-formats-colors + - include: pretty-formats-wrap-formatting + - include: pretty-formats-string-formatting + - include: pretty-formats-trailers + + pretty-formats-wrap-formatting: + - match: '(%{{pretty_formats_empty_value_modifiers}}w)(\()' + captures: + 1: meta.function-call.pretty-formats.git variable.function.pretty-formats.git + 2: meta.function-call.arguments.pretty-formats.git punctuation.section.parens.begin.pretty-formats.git + push: + - meta_content_scope: meta.function-call.arguments.pretty-formats.git + - match: '\)' + scope: meta.function-call.arguments.pretty-formats.git punctuation.section.parens.end.pretty-formats.git + pop: true + - match: \d+ + scope: constant.numeric.integer.pretty-formats.git + - match: ',,' + scope: invalid.illegal.pretty-formats.git + - match: ',' + scope: punctuation.separator.parameters.pretty-formats.git + - match: \S + scope: invalid.illegal.pretty-formats.git + + pretty-formats-string-formatting: + - match: | + (?x) + (%{{pretty_formats_empty_value_modifiers}} + (?:<\|?|>>?\|?|><\|?) # alignment directions + ) + ((\() + (\d+) # space reserved + (?:(,)([lm]?trunc))? # truncation directions + (\))) + captures: + 1: meta.function-call.pretty-formats.git variable.function.pretty-formats.git + 2: meta.function-call.arguments.pretty-formats.git + 3: punctuation.section.parens.begin.pretty-formats.git + 4: constant.numeric.integer.pretty-formats.git + 5: punctuation.separator.parameters.pretty-formats.git + 6: support.constant.truncation.pretty-formats.git + 7: punctuation.section.parens.end.pretty-formats.git + + pretty-formats-colors: + - match: '(%{{pretty_formats_empty_value_modifiers}}C)((red|green|blue)|(reset))' + captures: + 1: meta.function-call.pretty-formats.git variable.function.pretty-formats.git + 2: meta.function-call.arguments.pretty-formats.git + 3: support.constant.color.git.config + 4: support.constant.color-reset.git.config + - match: '(%{{pretty_formats_empty_value_modifiers}}C)(\()' + captures: + 1: meta.function-call.pretty-formats.git variable.function.pretty-formats.git + 2: meta.function-call.arguments.pretty-formats.git punctuation.section.parens.begin.pretty-formats.git + push: + - meta_content_scope: meta.function-call.arguments.pretty-formats.git + - match: \) + scope: meta.function-call.arguments.pretty-formats.git punctuation.section.parens.end.pretty-formats.git + pop: true + - include: Git Config.sublime-syntax#color-value + - match: reset + scope: support.constant.color-reset.git.config + + pretty-formats-trailers: + - match: '(%\()(trailers)' + captures: + 1: punctuation.section.parens.begin.pretty-formats.git + 2: keyword.other.trailers.pretty-formats.git + push: + - meta_scope: meta.trailers.pretty-formats.git + - include: illegal-eol-pop + - match: \) + scope: punctuation.section.parens.end.pretty-formats.git + pop: true + - match: ':' + scope: keyword.operator.assignment.option.pretty-formats.git + push: + - include: eol-pop + - match: (?=\)) + pop: true + - match: ',,|:' + scope: invalid.illegal.pretty-formats.git + - match: ',' + scope: punctuation.separator.parameters.pretty-formats.git + # Unclear from https://git-scm.com/docs/git-interpret-trailers what other values are valid here + - match: \b(only|unfold)\b + scope: support.constant.trailer.git.config + - match: \b\w+\b + scope: constant.other.trailer.pretty-formats.git diff --git a/Git Formats/Git Config.sublime-syntax b/Git Formats/Git Config.sublime-syntax index 9dbc647e39..d5d1352135 100644 --- a/Git Formats/Git Config.sublime-syntax +++ b/Git Formats/Git Config.sublime-syntax @@ -180,6 +180,7 @@ contexts: - include: line-continuation - include: escape - include: illegal-line-end # newlines only permitted after trailing \ + - include: Git Common.sublime-syntax#pretty-formats-as-arg-minimal string-unquoted: - match: (?=\S) @@ -188,6 +189,7 @@ contexts: - include: line-continuation - include: escape - include: line-end + - include: Git Common.sublime-syntax#pretty-formats-as-arg-minimal ##[ PROTOTYPES ]####################################################### @@ -211,7 +213,7 @@ contexts: pop: true line-end: - - match: $\n? + - match: $ pop: true expect-line-end: diff --git a/Git Formats/Git Log.sublime-settings b/Git Formats/Git Log.sublime-settings new file mode 100644 index 0000000000..2c8d0e27db --- /dev/null +++ b/Git Formats/Git Log.sublime-settings @@ -0,0 +1,6 @@ +{ + // Ensure not to modify a git log due to the following settings + // being set `true` in the User/Preferences.sublime-settings + "ensure_newline_at_eof_on_save": false, + "trim_trailing_white_space_on_save": false, +} diff --git a/Git Formats/Git Log.sublime-syntax b/Git Formats/Git Log.sublime-syntax index 6903d3dab9..1a0ac74222 100644 --- a/Git Formats/Git Log.sublime-syntax +++ b/Git Formats/Git Log.sublime-syntax @@ -3,7 +3,7 @@ name: Git Log file_extensions: - gitlog # no real extention but why not? -first_line_match: commit\s+\h{7,} +first_line_match: ^commit\s+\h{7,} scope: text.git.log contexts: @@ -17,12 +17,9 @@ contexts: scope: meta.header.git.commit markup.raw.block.git.log captures: 1: keyword.other.commit.git.log - 2: constant.numeric.hex.hash.git.log - push: commit-header - with_prototype: - # make sure to pop off stack for next commit - - match: ^(?=commit) - pop: true + 2: constant.other.hash.git.log + embed: commit-header + escape: (?=^commit\s) commit-header: # All header attributes are mappings of `key: value` format. @@ -39,4 +36,7 @@ contexts: - match: \n pop: true - include: Git Common.sublime-syntax#email - - include: Git Commit.sublime-syntax + # using push instead of include as workaround for + # https://github.com/SublimeTextIssues/Core/issues/2395 + - match: ^ + push: Git Commit.sublime-syntax diff --git a/Git Formats/Git Mailmap - Symbol List.tmPreferences b/Git Formats/Git Mailmap - Symbol List.tmPreferences new file mode 100644 index 0000000000..9a3fb97f68 --- /dev/null +++ b/Git Formats/Git Mailmap - Symbol List.tmPreferences @@ -0,0 +1,14 @@ + + + + name + Symbol List + scope + text.git.mailmap entity.name.reference.email.git, text.git.mailmap meta.reference.user.git + settings + + showInSymbolList + 1 + + + diff --git a/Git Formats/Git Mailmap.sublime-syntax b/Git Formats/Git Mailmap.sublime-syntax new file mode 100644 index 0000000000..939df0a1e7 --- /dev/null +++ b/Git Formats/Git Mailmap.sublime-syntax @@ -0,0 +1,23 @@ +%YAML 1.2 +--- +# Syntax based on documentation here: +# https://www.git-scm.com/docs/git-check-mailmap#_mapping_authors + +name: Git Mailmap +file_extensions: + - .mailmap + - mailmap +scope: text.git.mailmap + +contexts: + main: + - include: Git Common.sublime-syntax#comments + # lazy email reference + - match: <(?=\S+?>) + scope: punctuation.definition.reference.email.begin.git + push: + - Git Common.sublime-syntax#email-meta + - Git Common.sublime-syntax#email-name + # proper name + - match: '[^ \t<#][^<#\n]+?(?=[ \t]*(<|$))' + scope: meta.reference.user.git diff --git a/Git Formats/Git Rebase.sublime-syntax b/Git Formats/Git Rebase.sublime-syntax index 4653d19285..fa3c3a4f53 100644 --- a/Git Formats/Git Rebase.sublime-syntax +++ b/Git Formats/Git Rebase.sublime-syntax @@ -103,10 +103,10 @@ contexts: - match: Rebase\s+({{hash}})(?:(..)({{hash}}))?.+({{hash}}).* scope: meta.rebase-msg.git.rebase markup.heading.git.rebase captures: - 1: constant.numeric.hex.hash.git.rebase + 1: constant.other.hash.git.rebase 2: punctuation.separator.commit-range.git.rebase - 3: constant.numeric.hex.hash.git.rebase - 4: constant.numeric.hex.hash.git.rebase + 3: constant.other.hash.git.rebase + 4: constant.other.hash.git.rebase ##[ COMMITS ]########################################################## @@ -144,7 +144,7 @@ contexts: commit-hash: - match: '{{hash}}' # e.g. d284bb2 - scope: constant.numeric.hex.hash.git.rebase + scope: constant.other.hash.git.rebase pop: true - include: line-end - match: \S+ diff --git a/Git Formats/syntax_test_git_commit b/Git Formats/syntax_test_git_commit index 05ad993a9e..354371237b 100644 --- a/Git Formats/syntax_test_git_commit +++ b/Git Formats/syntax_test_git_commit @@ -30,8 +30,11 @@ Thanks to @username . # ^ punctuation.definition.reference.email.begin.git # ^^^^^^^^^^^^^^^^^^^^^ entity.name.reference.email.git # ^ punctuation.separator.email.git -# ^ punctuation.separator.email.git +# ^ punctuation.separator.domain.git # ^ punctuation.definition.reference.email.end.git +This is a name +# ^^^^^ - meta.reference - entity +# ^^^^^^^^^^ - meta.reference - entity Issue user/repo#230 is not closed yet. # <- meta.message.git.commit #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.message.git.commit @@ -119,8 +122,11 @@ This commit applies all changes required to satisfy the JSON format unittest. # ^^^^^^^^^^^^^^^^^^^^ entity.name.reference.email.git # ^ - punctuation.separator.email.git # ^ punctuation.separator.email.git -# ^ punctuation.separator.email.git +# ^ punctuation.separator.domain.git # ^ punctuation.definition.reference.email.end.git + This commit references a hash: 21dde213 +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.message.git.commit +# ^^^^^^^^ constant.other.hash.git.commit # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Please enter the commit message for your changes. Lines starting @@ -142,17 +148,17 @@ This commit applies all changes required to satisfy the JSON format unittest. # squash 26b2cc6 Fix: JSON resource format errors #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.command-list.git.commit # ^^^^^^ keyword.operator.git.commit -# ^ - keyword.operator.git.commit - constant.numeric.hex.hash.git.commit -# ^^^^^^^ constant.numeric.hex.hash.git.commit -# ^ - constant.numeric.hex.hash.git.commit - string.unquoted.subject.git.commit +# ^ - keyword.operator.git.commit - constant.other.hash.git.commit +# ^^^^^^^ constant.other.hash.git.commit +# ^ - constant.other.hash.git.commit - string.unquoted.subject.git.commit # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.unquoted.subject.git.commit # ^ - string.unquoted.subject.git.commit # fixup 8e9e7bc fixup! Fix: JSON resource format errors #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.command-list.git.commit # ^^^^^ keyword.operator.git.commit -# ^ - keyword.operator.git.commit - constant.numeric.hex.hash.git.commit -# ^^^^^^^ constant.numeric.hex.hash.git.commit -# ^ - constant.numeric.hex.hash.git.commit - string.unquoted.subject.git.commit +# ^ - keyword.operator.git.commit - constant.other.hash.git.commit +# ^^^^^^^ constant.other.hash.git.commit +# ^ - constant.other.hash.git.commit - string.unquoted.subject.git.commit # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.unquoted.subject.git.commit # ^ - string.unquoted.subject.git.commit # No commands remaining. @@ -180,6 +186,10 @@ This commit applies all changes required to satisfy the JSON format unittest. # ^^^^^^^^ keyword.other.change-list.git.commit # ^ punctuation.separator.mapping.pair.change-list.git.commit # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.unquoted.git.commit markup.changed.file.content.git.commit +# renamed: gitconfig/old_name -> gitconfig/new_name +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.git.commit +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.change-list.git.commit +# ^^ punctuation.separator.mapping.pair.path.git.commit # deleted: gitconfig/Symbol List.tmPreferences #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.git.commit # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.change-list.git.commit @@ -202,6 +212,10 @@ This commit applies all changes required to satisfy the JSON format unittest. # ^^^^^^^^ keyword.other.change-list.git.commit # ^ punctuation.separator.mapping.pair.change-list.git.commit # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.unquoted.git.commit markup.changed.file.content.git.commit +# renommé: gitconfig/old_name -> gitconfig/new_name +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.git.commit +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.change-list.git.commit +# ^^ punctuation.separator.mapping.pair.path.git.commit # gelöscht: gitconfig/Symbol List.tmPreferences #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.git.commit # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.change-list.git.commit @@ -224,6 +238,10 @@ This commit applies all changes required to satisfy the JSON format unittest. # ^^ keyword.other.change-list.git.commit # ^ punctuation.separator.mapping.pair.change-list.git.commit # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.unquoted.git.commit markup.changed.file.content.git.commit +# 重命名: gitconfig/old_name -> gitconfig/new_name +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.git.commit +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.change-list.git.commit +# ^^ punctuation.separator.mapping.pair.path.git.commit # 删除: gitconfig/Symbol List.tmPreferences #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.git.commit # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.change-list.git.commit diff --git a/Git Formats/syntax_test_git_config b/Git Formats/syntax_test_git_config index a4a97eaf49..073cf0e525 100644 --- a/Git Formats/syntax_test_git_config +++ b/Git Formats/syntax_test_git_config @@ -305,6 +305,116 @@ stray-bracket] # ^ invalid.illegal.unexpected.eol " +[pretty-formats] + foo = log --pretty=%h +# ^^ constant.other.placeholder.pretty-formats.git + foo = log --pretty=%<(5)%h +# ^^ meta.function-call.pretty-formats.git variable.function.pretty-formats.git +# ^^^ meta.function-call.arguments.pretty-formats.git +# ^ punctuation.section.parens.begin.pretty-formats.git +# ^ constant.numeric.integer.pretty-formats.git +# ^ punctuation.section.parens.end.pretty-formats.git +# ^^ constant.other.placeholder.pretty-formats.git + foo = log --pretty=%<(5,ltrunc)%h +# ^^ meta.function-call.pretty-formats.git variable.function.pretty-formats.git +# ^^^^^^^^^^ meta.function-call.arguments.pretty-formats.git +# ^ punctuation.section.parens.begin.pretty-formats.git +# ^ constant.numeric.integer.pretty-formats.git +# ^ punctuation.separator.parameters.pretty-formats.git +# ^^^^^^ support.constant.truncation.pretty-formats.git +# ^ punctuation.section.parens.end.pretty-formats.git +# ^^ constant.other.placeholder.pretty-formats.git + foo = log --pretty=%<|(5)%h +# ^^^ meta.function-call.pretty-formats.git variable.function.pretty-formats.git +# ^^^ meta.function-call.arguments.pretty-formats.git +# ^ punctuation.section.parens.begin.pretty-formats.git +# ^ constant.numeric.integer.pretty-formats.git +# ^ punctuation.section.parens.end.pretty-formats.git +# ^^ constant.other.placeholder.pretty-formats.git + foo = log --pretty=%<<(5)%h +# ^^^^^^ - meta.function-call - variable.function + foo = log --pretty=%<<|(5)%h +# ^^^^^^^ - meta.function-call - variable.function + foo = log --pretty=%>(5)%h +# ^^ meta.function-call.pretty-formats.git variable.function.pretty-formats.git +# ^^^ meta.function-call.arguments.pretty-formats.git +# ^ punctuation.section.parens.begin.pretty-formats.git +# ^ constant.numeric.integer.pretty-formats.git +# ^ punctuation.section.parens.end.pretty-formats.git +# ^^ constant.other.placeholder.pretty-formats.git + foo = log --pretty=%>|(5)%h +# ^^^ meta.function-call.pretty-formats.git variable.function.pretty-formats.git +# ^^^ meta.function-call.arguments.pretty-formats.git +# ^ punctuation.section.parens.begin.pretty-formats.git +# ^ constant.numeric.integer.pretty-formats.git +# ^ punctuation.section.parens.end.pretty-formats.git +# ^^ constant.other.placeholder.pretty-formats.git + foo = log --pretty=%>>(5)%h +# ^^^ meta.function-call.pretty-formats.git variable.function.pretty-formats.git +# ^^^ meta.function-call.arguments.pretty-formats.git +# ^ punctuation.section.parens.begin.pretty-formats.git +# ^ constant.numeric.integer.pretty-formats.git +# ^ punctuation.section.parens.end.pretty-formats.git +# ^^ constant.other.placeholder.pretty-formats.git + foo = log --pretty=%>>|(5)%h +# ^^^^ meta.function-call.pretty-formats.git variable.function.pretty-formats.git +# ^^^ meta.function-call.arguments.pretty-formats.git +# ^ punctuation.section.parens.begin.pretty-formats.git +# ^ constant.numeric.integer.pretty-formats.git +# ^ punctuation.section.parens.end.pretty-formats.git +# ^^ constant.other.placeholder.pretty-formats.git + foo = log --pretty=%><(5)%h +# ^^^ meta.function-call.pretty-formats.git variable.function.pretty-formats.git +# ^^^ meta.function-call.arguments.pretty-formats.git +# ^ punctuation.section.parens.begin.pretty-formats.git +# ^ constant.numeric.integer.pretty-formats.git +# ^ punctuation.section.parens.end.pretty-formats.git +# ^^ constant.other.placeholder.pretty-formats.git + foo = log --pretty=%><|(5)%h +# ^^^ meta.function-call.pretty-formats.git variable.function.pretty-formats.git +# ^^^ meta.function-call.arguments.pretty-formats.git +# ^ punctuation.section.parens.begin.pretty-formats.git +# ^ constant.numeric.integer.pretty-formats.git +# ^ punctuation.section.parens.end.pretty-formats.git +# ^^ constant.other.placeholder.pretty-formats.git + foo = log --pretty=%a +# ^^ - constant + foo = log --pretty=%aD +# ^^^ constant.other.placeholder.pretty-formats.git + foo = log --pretty=%+aD +# ^^^^ constant.other.placeholder.pretty-formats.git + foo = log --pretty=%-aD +# ^^^^ constant.other.placeholder.pretty-formats.git + foo = log --pretty=% aD +# ^^^^ constant.other.placeholder.pretty-formats.git + foo = log --pretty=%C(bold yellow)%h%C(reset) %C(green)%ar%C(reset) %s +# ^^ meta.function-call.pretty-formats.git variable.function.pretty-formats.git +# ^^^^^^^^^^^^^ meta.function-call.arguments.pretty-formats.git +# ^^^^ support.constant.color-attribute.git.config +# ^ - support +# ^^^^^^ support.constant.color.git.config +# ^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.pretty-formats.git + foo = log --pretty='%C(bold yellow)%h%C(reset) %C(green)%ar%C(reset) %s' +# ^^ meta.function-call.pretty-formats.git variable.function.pretty-formats.git +# ^^^^^^^^^^^^^ meta.function-call.arguments.pretty-formats.git +# ^^^^ support.constant.color-attribute.git.config +# ^ - support +# ^^^^^^ support.constant.color.git.config +# ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.pretty-formats.git + foo = log --pretty='%C(dim white)<%aN>%C(reset) %w(0,0,9)%C(auto)%+d%C(reset)' +# ^ - constant +# ^^^ constant.other.placeholder.pretty-formats.git +# ^^ meta.function-call.pretty-formats.git variable.function.pretty-formats.git +# ^^^^^^^ meta.function-call.arguments.pretty-formats.git +# ^ punctuation.section.parens.begin.pretty-formats.git +# ^ constant.numeric.integer.pretty-formats.git +# ^ punctuation.separator.parameters.pretty-formats.git +# ^ constant.numeric.integer.pretty-formats.git +# ^ punctuation.separator.parameters.pretty-formats.git +# ^ constant.numeric.integer.pretty-formats.git +# ^ punctuation.section.parens.end.pretty-formats.git +# ^^^ constant.other.placeholder.pretty-formats.git + # REAL WORLD SAMPLE TESTS [alias] # <- meta.brackets punctuation.definition.brackets.begin @@ -357,6 +467,7 @@ stray-bracket] # ^^^^^^^^^^^^^^^^^^^^^^^ meta.mapping.value # ^^^^ string.unquoted.value # ^^^^^^^^^^^^^^^^^^ string.unquoted.value +# ^ - string sla = log --oneline --decorate --graph --all # <- meta.mapping #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.mapping @@ -370,6 +481,7 @@ stray-bracket] # ^^^^^^^^^^ string.unquoted.value # ^^^^^^^ string.unquoted.value # ^^^^^ string.unquoted.value +# ^ - string serve = !git daemon --reuseaddr --verbose --base-path=. --export-all ./.git # shell comment # <- meta.mapping #^^ meta.mapping @@ -513,3 +625,73 @@ stray-bracket] # ^ string.quoted.double punctuation.definition.string.end # ^ punctuation.definition.comment # ^^^^^^^^^^^^^^^^^^^^^^^ comment.line.git + lg1 = log --graph --format=tformat:'%C(bold yellow)%h%C(reset) %C(green)%ar%C(reset) %s %C(dim white)<%aN>%C(reset) %w(0,0,9)%C(auto)%+d%C(reset)' +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.mapping.value.git.config string.unquoted.value.git.config +# ^^^^^^^ keyword.declaration.pretty-formats.git +# ^ keyword.operator.assignment.option.pretty-formats.git +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.single.shell +# ^ punctuation.definition.string.begin.shell +# ^^ meta.function-call.pretty-formats.git variable.function.pretty-formats.git +# ^^^^^^^^^^^^^ meta.function-call.arguments.pretty-formats.git +# ^ punctuation.section.parens.begin.pretty-formats.git +# ^^^^ support.constant.color-attribute.git.config +# ^ - support +# ^^^^^^ support.constant.color.git.config +# ^ punctuation.section.parens.end.pretty-formats.git +# ^^ constant.other.placeholder.pretty-formats.git +# ^^^ constant.other.placeholder.pretty-formats.git +# ^ - constant +# ^^^ constant.other.placeholder.pretty-formats.git +# ^^ meta.function-call.pretty-formats.git variable.function.pretty-formats.git + lgs = log --graph --format=format:'%h - [%ar] %s%n%-w(80,9)%+d' +# ^^^ meta.function-call.pretty-formats.git variable.function.pretty-formats.git +# ^^^^^^ meta.function-call.arguments.pretty-formats.git +# ^^^ constant.other.placeholder.pretty-formats.git +# ^ - text.pretty-formats.git + foo = --format=tformat:'%(trailers +# ^ punctuation.section.parens.begin.pretty-formats.git +# ^^^^^^^^ keyword.other.trailers.pretty-formats.git +# ^ invalid.illegal.unexpected.eol.git + foo = --format=tformat:'%(trailers)' +# ^ punctuation.section.parens.begin.pretty-formats.git +# ^^^^^^^^ keyword.other.trailers.pretty-formats.git +# ^ punctuation.section.parens.end.pretty-formats.git + foo = --format=tformat:'%(trailers: +# ^ punctuation.section.parens.begin.pretty-formats.git +# ^^^^^^^^ keyword.other.trailers.pretty-formats.git +# ^ keyword.operator.assignment.option.pretty-formats.git +# ^ invalid.illegal.unexpected.eol.git + foo = --format=tformat:'%(trailers: only +# ^ punctuation.section.parens.begin.pretty-formats.git +# ^^^^^^^^ keyword.other.trailers.pretty-formats.git +# ^ keyword.operator.assignment.option.pretty-formats.git +# ^^^^ support.constant.trailer.git.config +# ^ invalid.illegal.unexpected.eol.git + foo = --format=tformat:'%(trailers:)' +# ^ punctuation.section.parens.begin.pretty-formats.git +# ^^^^^^^^ keyword.other.trailers.pretty-formats.git +# ^ keyword.operator.assignment.option.pretty-formats.git +# ^ punctuation.section.parens.end.pretty-formats.git + + foo = --format=tformat:'%(trailers: only) +# ^ punctuation.section.parens.begin.pretty-formats.git +# ^^^^^^^^ keyword.other.trailers.pretty-formats.git +# ^ keyword.operator.assignment.option.pretty-formats.git +# ^^^^ support.constant.trailer.git.config +# ^ punctuation.section.parens.end.pretty-formats.git + foo = --format=tformat:'%(trailers + : +# ^ - punctuation.separator + foo = --format=tformat:'%(trailers\ + : +# ^ keyword.operator.assignment.option.pretty-formats.git +# ^ invalid.illegal.unexpected.eol.git + foo = --format=tformat:'%(trailers\ + :\ + only) +# ^^^^ support.constant.trailer.git.config + foo = --format=tformat:'%(trailers\ + :\ + only\ + ) +# ^ punctuation.section.parens.end.pretty-formats.git diff --git a/Git Formats/syntax_test_git_log b/Git Formats/syntax_test_git_log index 10ae2b9f95..d2782aac8f 100644 --- a/Git Formats/syntax_test_git_log +++ b/Git Formats/syntax_test_git_log @@ -3,7 +3,7 @@ commit e2077c6e006acfd2f060aef03c4ef8f89c4db362 # <- meta.header.git.commit markup.raw.block.git.log keyword.other.commit.git.log #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.header.git.commit markup.raw.block.git.log #^^^^^ keyword.other.commit.git.log -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant.numeric.hex.hash.git.log +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant.other.hash.git.log Author: username # <- meta.header.git.commit markup.raw.block.git.log keyword.other.header.git.log #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.header.git.commit markup.raw.block.git.log @@ -15,6 +15,7 @@ Author: username # ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.reference.email.git # ^^^^^^^^^^^^^^^^^^^^^^^ entity.name.reference.email.git # ^ punctuation.separator.email.git +# ^ punctuation.separator.domain.git # ^ punctuation.definition.reference.email.end.git Date: Thu Sep 21 22:53:04 2017 +0200 # <- meta.header.git.commit markup.raw.block.git.log keyword.other.header.git.log diff --git a/Git Formats/syntax_test_git_mailmap b/Git Formats/syntax_test_git_mailmap new file mode 100644 index 0000000000..c37538473e --- /dev/null +++ b/Git Formats/syntax_test_git_mailmap @@ -0,0 +1,56 @@ +# SYNTAX TEST "Git Mailmap.sublime-syntax" +# <- comment.line.git punctuation.definition.comment.git + + # typos again! +# ^^^^^^^^^^^^^^ meta.reference.email.git +# <- punctuation.definition.reference.email.begin.git +# ^^^^^^^^^^^^^ entity.name.reference.email.git +# ^ punctuation.separator.email.git +# ^ punctuation.separator.domain.git +# ^ punctuation.definition.reference.email.end.git +# ^^^^^^^^^^^^^^^^^^^^^^^ - meta - entity +# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.reference.email.git +# ^ punctuation.definition.reference.email.begin.git +# ^^^^^^^^^^^^^^^^^^^^^^ entity.name.reference.email.git +# ^ punctuation.separator.email.git +# ^ punctuation.separator.domain.git +# ^ punctuation.separator.domain.git +# ^ punctuation.definition.reference.email.end.git +# ^^^^^^^^^^^^^^^ comment.line.git - meta - entity +# ^ punctuation.definition.comment.git +Some Dude nick1 +# ^^^^^^^ meta.reference.user.git +# ^^^^^^^^^^^^^^ meta.reference.email.git +# ^ punctuation.definition.reference.email.begin.git +# ^^^^^^^^^^^^ entity.name.reference.email.git +# ^ punctuation.separator.email.git +# ^ punctuation.separator.domain.git +# ^^^^^^^^^ - meta - entity +# ^^^^^ meta.reference.user.git +# ^ - meta - entity +Other Author nick2 +%ther %u%hor %ick2 +# <- meta.reference.user.git +# ^^^^^^^^^^ meta.reference.user.git +# ^ - meta - entity +# ^^^ - meta - entity +# ^^^^^ meta.reference.user.git +# ^ - meta - entity +Other Author sp ce +# ^^^ - meta - entity +# ^^^^^ meta.reference.user.git +# ^ - meta - entity +Other Author +Other Author +# ^^^^^^^ meta.reference.email.git +# ^ punctuation.definition.reference.email.begin.git +# ^^^^^ entity.name.reference.email.git +# ^ punctuation.definition.reference.email.end.git +Other Author +# ^^^^^^^^^^^^^^^ meta.reference.email.git +# ^ punctuation.definition.reference.email.begin.git +# ^^^^^^^^^^^^^ entity.name.reference.email.git +# ^ punctuation.separator.email.git +# ^ punctuation.definition.reference.email.end.git +Santa Claus +# ^ - meta - entity diff --git a/Git Formats/syntax_test_git_rebase b/Git Formats/syntax_test_git_rebase index b8de4bec73..e9f60e38e9 100644 --- a/Git Formats/syntax_test_git_rebase +++ b/Git Formats/syntax_test_git_rebase @@ -3,66 +3,66 @@ pick d284bb2 Initial commit # <- meta.commit #^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.commit -# ^ -meta.commit +# ^ - meta.commit # <- keyword.operator.commit.pick #^^^ keyword.operator.commit.pick -# ^ -storage.type.commit -# ^^^^^^^ constant.numeric.hex.hash -# ^ -constant.numeric.hex.hash -meta.subject.git.commit +# ^ - storage.type.commit +# ^^^^^^^ constant.other.hash +# ^ - constant.other.hash -meta.subject.git.commit # ^^^^^^^^^^^^^^ meta.subject.git.commit -# ^ -meta.subject.git.commit +# ^ - meta.subject.git.commit p 6746220 Second pick commit # no comment # <- meta.commit #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.commit -# ^ -meta.commit +# ^ - meta.commit # <- keyword.operator.commit.pick -#^ -keyword.operator.commit -# ^^^^^^^ constant.numeric.hex.hash -# ^ -constant.numeric.hex.hash -meta.subject.git.commit +#^ - keyword.operator.commit +# ^^^^^^^ constant.other.hash +# ^ - constant.other.hash -meta.subject.git.commit # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.subject.git.commit -# ^ -meta.subject.git.commit -# ^^^^ -keyword +# ^ - meta.subject.git.commit +# ^^^^ - keyword p 6746220 Third pick commit # no comment # <- meta.commit #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.commit -# ^ -meta.commit -# ^ -keyword.operator.commit +# ^ - meta.commit +# ^ - keyword.operator.commit # ^ keyword.operator.commit.pick -# ^ -keyword.operator.commit -constant.numeric.hex.hash -# ^^^^^^^ constant.numeric.hex.hash -# ^ -constant.numeric.hex.hash -meta.subject.git.commit +# ^ - keyword.operator.commit -constant.other.hash +# ^^^^^^^ constant.other.hash +# ^ - constant.other.hash -meta.subject.git.commit # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.subject.git.commit -# ^ -meta.subject.git.commit -# ^^^^ -keyword +# ^ - meta.subject.git.commit +# ^^^^ - keyword puck 6746220 Invalid command # <- meta.commit #^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.commit # <- invalid.illegal.command-expected #^^^ invalid.illegal.command-expected -# ^ -storage.type.commit -invalid.illegal.command-expected -# ^^^^^^^ constant.numeric.hex.hash -# ^ -constant.numeric.hex.hash -meta.subject.git.commit +# ^ - storage.type.commit -invalid.illegal.command-expected +# ^^^^^^^ constant.other.hash +# ^ - constant.other.hash -meta.subject.git.commit # ^^^^^^^^^^^^^^^ meta.subject.git.commit p 6746x20 Invalid hash # no comment # <- meta.commit #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.commit # <- keyword.operator.commit.pick -#^ -storage.type.commit +#^ - storage.type.commit # ^^^^^^^ invalid.illegal.hash-expected -# ^ -constant.numeric.hex.hash -meta.subject.git.commit +# ^ - constant.other.hash -meta.subject.git.commit # ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.subject.git.commit -# ^ -meta.subject.git.commit +# ^ - meta.subject.git.commit a 6746x20 Invalid command and hash # no comment (#403) # <- meta.commit #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.commit # <- invalid.illegal.command-expected -#^ -storage.type.commit +#^ - storage.type.commit # ^^^^^^^ invalid.illegal.hash-expected -# ^ -constant.numeric.hex.hash -meta.subject.git.commit +# ^ - constant.other.hash -meta.subject.git.commit # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.subject.git.commit # ^ punctuation.definition.reference.issue.git # ^^^^ meta.reference.issue.git constant.other.reference.issue.git -# ^ -meta.subject.git.commit +# ^ - meta.subject.git.commit # p 6746220 Second pick commit # no comment # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.git.rebase d d284bb2 Drop commit @@ -89,10 +89,10 @@ a 6746x20 Invalid command and hash # no comment (#403) # Rebase 9e73d21..6746220 onto 9e73d21 (2 commands) # <- comment.line punctuation.definition.comment # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line meta.rebase-msg -# ^^^^^^^ constant.numeric.hex.hash +# ^^^^^^^ constant.other.hash # ^^ punctuation.separator.commit-range -# ^^^^^^^ constant.numeric.hex.hash -# ^^^^^^^ constant.numeric.hex.hash +# ^^^^^^^ constant.other.hash +# ^^^^^^^ constant.other.hash # # Commands: #^^^^^^^^^^^ comment.line.git.rebase diff --git a/Go/Go.sublime-syntax b/Go/Go.sublime-syntax index 319352518f..7e6865b3b6 100644 --- a/Go/Go.sublime-syntax +++ b/Go/Go.sublime-syntax @@ -2,11 +2,9 @@ --- # http://www.sublimetext.com/docs/3/syntax.html - # The structure and terminology of this syntax reflects the spec: # https://golang.org/ref/spec - # The following is a simplified model of Sublime Text's syntax engine, reverse- # engineered through experience. This model uses assertive language for brevity, # but does not reflect the real implementation and should not be taken @@ -67,6 +65,12 @@ variables: # These are the only words that can't be used as identifiers. keyword: \b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go|goto|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b + # https://golang.org/ref/spec#Predeclared_identifiers + predeclared_type: \b(?:bool|byte|complex64|complex128|error|float32|float64|int|int8|int16|int32|int64|rune|string|uint|uint8|uint16|uint32|uint64|uintptr)\b + + # https://golang.org/ref/spec#Predeclared_identifiers + predeclared_func: \b(?:append|cap|close|complex|copy|delete|imag|len|make|new|panic|print|println|real|recover)\b + # Note: this matches ALL valid identifiers, including predeclared constants, # functions and types. ident: \b(?!{{keyword}})[[:alpha:]_][[:alnum:]_]*\b @@ -80,7 +84,38 @@ variables: char_escape: \\x\h{2}|\\u\h{4}|\\U\h{8}|\\[0-7]{3}|\\. - exponent: '[Ee][+-]?' + dec_exponent: (?:[eE][-+]??{{dec_digits}}) + hex_exponent: (?:[pP][-+]??{{dec_digits}}) + + # Matches a digit with any number of numeric separators, while + # not allowing a numeric separator as the last or first character. + dec_digits: (?:\d+(?:_\d+)*) + + # Hexadecimal counterpart to dec_digits. + hex_digits: (?:_?\h+(?:_\h+)*) + + # Octal counterpart to dec_digits. + oct_digits: (?:_?[0-7]+(?:_[0-7]+)*) + + # Binary counterpart to dec_digits. + bin_digits: (?:_?[01]+(?:_[01]+)*) + + # Matches a digit with any number of numeric separators, while + # not allowing a numeric separator as the last or first character. + ddigits: (?:\d+(?:_\d+)*) + + # Hexadecimal counterpart to ddigits. + hdigits: _?(?:\h+(?:_\h+)*) + + # Same as hdigits, except the leading hex character + # coefficient is optional in this case. + ohdigits: _?(?:\h*(?:_\h+)*) + + # Octal counterpart to ddigits. + odigits: _?(?:[0-7]+(?:_[0-7]+)*) + + # Binary counterpart to ddigits. + bdigits: _?(?:[01]+(?:_[01]+)*) contexts: main: @@ -129,13 +164,16 @@ contexts: - match: \*/ scope: punctuation.definition.comment.end.go pop: true + - match: ^\s*(\*)(?!/) + captures: + 1: punctuation.definition.comment.go pop-line-comment: - meta_scope: comment.line.go # Including the newline allows the scope to visually stretch to the right, # and ensures that functionality that relies on comment scoping, such as # contextual hotkeys, works properly at EOL while typing a comment. This - # should also match \r\n due to internal conversions. + # should also match \r\n due to Sublime's internal normalization. - match: $\n? pop: true @@ -177,7 +215,7 @@ contexts: # See `match-selector` for field scoping. match-identifiers: - - include: match-predefined-identifiers + - include: match-predeclared-constants - include: match-call-or-cast - include: match-short-variable-declarations - match: \b_\b @@ -186,25 +224,67 @@ contexts: scope: variable.other.go # https://golang.org/ref/spec#Predeclared_identifiers - match-predefined-identifiers: - # Note: these are NOT keywords, but rather predeclared identifiers that can - # be redefined. We treat them as regular identifiers in variable - # declarations, types, function names, etc. This rule should be used in - # places that are "left over". Detecting redefinition is beyond the scope of - # this syntax engine. + # + # In Go, the predeclared constants are not keywords, and can be redefined. In + # many places such as variable declarations, types, function names, etc, we + # allow them to be scoped the same way as other identifiers. This "constant" + # rule should be used in places that are "left over". Detecting redefinition + # would be ideal, but is beyond the scope of this syntax engine; we simply + # expect it to be very rare. + match-predeclared-constants: - match: \b(?:true|false|nil)\b scope: constant.language.go - - include: match-new - - include: match-make - # Note: calls and casts are syntactically identical. Detecting casts and - # scoping them as types is beyond the capabilities of this syntax engine. + # Note: in Go, calls and casts are syntactically identical. Detecting casts + # and scoping them as types is beyond the capabilities of this syntax engine. + # + # https://golang.org/ref/spec#Predeclared_identifiers + # + # Notes on built-in functions + # + # Most built-in functions don't need special syntactic support. We scope them + # for the benefit of the users who prefer to distinguish them from + # user-defined identifiers. Two exceptions are `make` and `new`, where the + # first argument is scoped as a type, matching the special-case support in + # the compiler. When built-ins are redefined, this leads to incorrect + # scoping; like with constants, we expect such redefinition to be very rare. # - # This is somewhat duplicated in `match-selector`, which must be included - # before this rule. + # Note that we limit this detection to plain function calls, ignoring method + # calls and other identifier occurrences. The language currently allows + # built-in functions ONLY in a function call position. This helps minimize + # false positives. + # + # Notes on built-in types + # + # Unlike casts involving a user-defined type, casts involving a built-in + # types could be scoped purely as types rather than function calls. However, + # we stick to `variable.function.go` to make the treatment of built-ins + # purely additive, allowing the user to opt out. match-call-or-cast: + - match: \b(?:make|new)\b(?=(?:{{noise}}\))*{{noise}}\() + scope: variable.function.go support.function.builtin.go + push: pop-arguments-starting-with-type + - match: '{{predeclared_type}}(?=(?:{{noise}}\))*{{noise}}\()' + scope: variable.function.go support.type.builtin.go + - match: '{{predeclared_func}}(?=(?:{{noise}}\))*{{noise}}\()' + scope: variable.function.go support.function.builtin.go + - match: '{{ident}}(?=(?:{{noise}}\))*{{noise}}\()' + scope: variable.function.go + + # See notes on `match-call-or-cast`. + pop-call-or-cast: + - match: \b(?:make|new)\b(?=(?:{{noise}}\))*{{noise}}\() + scope: variable.function.go support.function.builtin.go + set: pop-arguments-starting-with-type + - match: '{{predeclared_type}}(?=(?:{{noise}}\))*{{noise}}\()' + scope: variable.function.go support.type.builtin.go + pop: true + - match: '{{predeclared_func}}(?=(?:{{noise}}\))*{{noise}}\()' + scope: variable.function.go support.function.builtin.go + pop: true - match: '{{ident}}(?=(?:{{noise}}\))*{{noise}}\()' scope: variable.function.go + pop: true # Note: this currently doesn't work across multiple lines. match-short-variable-declarations: @@ -218,20 +298,6 @@ contexts: - include: match-comma - include: pop-before-nonblank - # Note: `new` can be redefined, invalidating this scoping, but such - # redefinition should be very uncommon. - match-new: - - match: \bnew\b(?={{noise}}\() - scope: variable.function.go - push: pop-first-argument-as-type - - # Note: `make` can be redefined, invalidating this scoping, but such - # redefinition should be very uncommon. - match-make: - - match: \bmake\b(?={{noise}}\() - scope: variable.function.go - push: pop-first-argument-as-type - # https://golang.org/ref/spec#Operators_and_punctuation match-operators: [ {match: \!= , scope: keyword.operator.go}, @@ -310,13 +376,12 @@ contexts: - include: match-comments - include: pop-type-assertion - # See `match-call-or-cast` on notes about call/cast ambiguity. + # Note: calls and casts are syntactically identical. - match: '{{ident}}(?=(?:{{noise}}\))*{{noise}}\()' scope: variable.function.go pop: true - include: pop-member - # Note: newlines between dot and assertion/field are ok - include: pop-before-nonblank @@ -327,9 +392,7 @@ contexts: - match: \) scope: punctuation.section.parens.end.go pop: true - - match: '{{ident}}(?={{noise}}\){{noise}}\()' - scope: variable.function.go - pop: true + - include: pop-call-or-cast - include: match-any - match: \) scope: punctuation.section.parens.end.go @@ -348,9 +411,7 @@ contexts: - match: \b_\b scope: variable.language.blank.go pop: true - - match: '{{ident}}' - scope: storage.type.go - pop: true + - include: pop-type-identifier - include: pop-before-nonblank match-braces: @@ -373,61 +434,83 @@ contexts: - include: match-strings match-imaginary: - # Mandatory integer, optional fraction, optional exponent, mandatory imaginary - - match: \d+(?:(\.)\d+)?(?:({{exponent}})\d+)?(i) - scope: constant.numeric.imaginary.go + # Decimal imaginary numbers + - match: '{{dec_digits}}(?:(\.){{dec_digits}}?)?{{dec_exponent}}?(i)' + scope: constant.numeric.imaginary.decimal.go captures: 1: punctuation.separator.decimal.go - 2: punctuation.separator.exponent.go - 3: storage.type.numeric.imaginary.go - # Dot without fraction - - match: \d+\.(?:{{exponent}}\d+)?i - scope: invalid.deprecated.go - # Dot without integer - - match: \.\d+(?:{{exponent}}\d+)?i - scope: invalid.deprecated.go + 2: storage.type.numeric.go + # Hexadecimal imaginary numbers + - match: (0[xX]){{hex_digits}}?(?:(\.){{hex_digits}}?)?{{hex_exponent}}?(i) + scope: constant.numeric.imaginary.hexadecimal.go + captures: + 1: punctuation.definition.numeric.base.go + 2: punctuation.separator.decimal.go + 3: storage.type.numeric.go + # Octal imaginary numbers + - match: (0[oO]){{oct_digits}}(i) + scope: constant.numeric.imaginary.octal.go + captures: + 1: punctuation.definition.numeric.base.go + 2: storage.type.numeric.go + # Binary imaginary numbers + - match: (0[bB]){{bin_digits}}(i) + scope: constant.numeric.imaginary.binary.go + captures: + 1: punctuation.definition.numeric.base.go + 2: storage.type.numeric.go match-floats: - # Integer, no fraction, exponent - - match: \d+({{exponent}})\d+ - scope: constant.numeric.float.go - captures: - 1: punctuation.separator.exponent.go - # Integer, fraction, optional exponent - - match: \d+(\.)\d+(?:({{exponent}})\d+)? - scope: constant.numeric.float.go + # Decimal float literal + - match: |- + (?x: + {{dec_digits}}(?:(\.){{dec_digits}}?{{dec_exponent}}?|{{dec_exponent}}) + | (\.){{dec_digits}}{{dec_exponent}}? + ) + scope: constant.numeric.float.decimal.go captures: 1: punctuation.separator.decimal.go - 2: punctuation.separator.exponent.go - # Dot without fraction - - match: \d+\.(?:{{exponent}}\d+)? - scope: invalid.deprecated.go - # Dot without integer - - match: \.\d+(?:{{exponent}}\d+)? - scope: invalid.deprecated.go + 2: punctuation.separator.decimal.go + # Hexadecimal float literal + - match: (0[xX]){{hex_digits}}?(?:(\.){{hex_digits}}?)?{{hex_exponent}} + scope: constant.numeric.float.hexadecimal.go + captures: + 1: punctuation.definition.numeric.base.go + 2: punctuation.separator.decimal.go match-integers: - include: match-octal-integer - include: match-hex-integer + - include: match-binary-integer - include: match-decimal-integer match-octal-integer: - - match: (0)[0-7]+(?=\D) - scope: constant.numeric.octal.go + - match: (0){{oct_digits}}(?=\D) + scope: constant.numeric.integer.octal.go captures: - 1: punctuation.definition.numeric.octal.go + 1: punctuation.definition.numeric.base.go - match: 0[0-7]*[8-9]+ scope: invalid.illegal.go + - match: (0[oO]){{oct_digits}} + scope: constant.numeric.integer.octal.go + captures: + 1: punctuation.definition.numeric.base.go match-hex-integer: - - match: (0[Xx])\h+ - scope: constant.numeric.hex.go + - match: (0[xX]){{hex_digits}} + scope: constant.numeric.integer.hexadecimal.go captures: - 1: punctuation.definition.numeric.hexadecimal.go + 1: punctuation.definition.numeric.base.go + + match-binary-integer: + - match: (0[bB]){{bin_digits}} + scope: constant.numeric.integer.binary.go + captures: + 1: punctuation.definition.numeric.base.go match-decimal-integer: - - match: \d+ - scope: constant.numeric.integer.go + - match: '{{dec_digits}}' + scope: constant.numeric.integer.decimal.go # https://golang.org/ref/spec#Rune_literals match-runes: @@ -450,6 +533,7 @@ contexts: - match: '`' scope: punctuation.definition.string.end.go pop: true + - include: match-template-string - match: \%% scope: constant.character.escape.go - include: match-fmt @@ -462,19 +546,54 @@ contexts: - match: '"' scope: punctuation.definition.string.end.go pop: true + - include: match-template-string - match: '{{char_escape}}' scope: constant.character.escape.go - match: \%% scope: constant.character.escape.go - include: match-fmt + match-template-string: + - match: '{{(?=.*}})' + scope: punctuation.section.interpolation.begin.go + push: + - meta_scope: meta.interpolation.go + - clear_scopes: 1 + - match: "}}" + scope: punctuation.section.interpolation.end.go + pop: true + - match: "\\s-" + scope: keyword.operator.template.right.trim.go + - match: "-\\s" + scope: keyword.operator.template.left.trim.go + - match: ":=|=" + scope: keyword.operator.assignment.go + - match: \| + scope: keyword.operator.template.pipe.go + - match: '(\.)([\w]+)' + captures: + 1: punctuation.accessor.dot.go + 2: variable.other.member.go + - match: '(\$)[\w]+' + scope: variable.other.template.go + captures: + 1: punctuation.definition.variable.go + - match: '[.$]' + scope: variable.other.template.go + - match: \b(if|else|range|template|with|end|nil|define|block)\b + scope: keyword.control.go + - match: \b(and|call|html|index|slice|js|len|not|or|print|printf|println|urlquery|eq|ne|lt|le|gt|ge)\b + scope: variable.function.go support.function.builtin.go + - include: match-comments + - include: match-strings + # https://godoc.org/fmt # # Tries to match known patterns without being too specific. We want to avoid # false positives in non-fmt strings that just happen to contain %, but don't # want too much coupling with the current version of fmt. match-fmt: - - match: '\%[ .\d#+-]*[A-Za-z]' + - match: '\%(?:\[\d+\])?[ .\d#+-]*[A-Za-z]' scope: constant.other.placeholder.go match-keyword-break: @@ -890,6 +1009,8 @@ contexts: scope: variable.other.go - match: \. scope: punctuation.accessor.dot.go + - match: '{{predeclared_type}}(?={{noise}}(?:"|`|//|;|\}|$))' + scope: entity.other.inherited-class.go support.type.builtin.go - match: '{{ident}}(?={{noise}}(?:"|`|//|;|\}|$))' scope: entity.other.inherited-class.go @@ -929,6 +1050,8 @@ contexts: scope: variable.other.go - match: \. scope: punctuation.accessor.dot.go + - match: '{{predeclared_type}}(?={{noise}}(?://|;|\}|$))' + scope: entity.other.inherited-class.go support.type.builtin.go - match: '{{ident}}(?={{noise}}(?://|;|\}|$))' scope: entity.other.inherited-class.go @@ -985,10 +1108,16 @@ contexts: - match: \b_\b scope: variable.language.blank.go pop: true + - include: pop-type-identifier + - include: pop-before-nonblank + + pop-type-identifier: + - match: '{{predeclared_type}}' + scope: storage.type.go support.type.builtin.go + pop: true - match: '{{ident}}' scope: storage.type.go pop: true - - include: pop-before-nonblank pop-type-alias-or-typedef: - include: pop-on-terminator @@ -1031,7 +1160,7 @@ contexts: set: - include: pop-on-terminator - match: \biota\b - scope: constant.numeric.integer.go + scope: constant.numeric.integer.decimal.go - include: match-any pop-var-type-and-or-assignment: @@ -1077,8 +1206,10 @@ contexts: scope: variable.other.member.go pop: true - pop-first-argument-as-type: + pop-arguments-starting-with-type: - include: match-comments + - match: \) + scope: punctuation.section.parens.end.go - match: \( scope: punctuation.section.parens.begin.go set: diff --git a/Go/syntax_test_go.go b/Go/syntax_test_go.go index d5ae34a85e..fe9f643e60 100644 --- a/Go/syntax_test_go.go +++ b/Go/syntax_test_go.go @@ -1,6 +1,5 @@ // SYNTAX TEST "Go.sublime-syntax" - /* NOTES @@ -49,6 +48,11 @@ You may have to disable Go-specific linters when working on this file. // ^^^^^^^ comment.block.go // ^ -comment + /** + * +// ^ comment.block.go punctuation.definition.comment.go + */ + //go // ^ -comment -punctuation // ^^ punctuation.definition.comment.go @@ -103,11 +107,15 @@ You may have to disable Go-specific linters when working on this file. ) -// # Types +// # Type Keywords and Syntax + +/* +Type keywords are tested early because they're used in many other tests. -// Types are covered early because they're involved in most tests. -// Note: Go permits an arbitrary number of parens around a type. +Note: Go permits an arbitrary number of parens around a type. +Note: built-ins are tested separately. Search for "# Built-in Types". +*/ // ## chan @@ -334,8 +342,7 @@ You may have to disable Go-specific linters when working on this file. func() // ^^^^ storage.type.keyword.function.go ident -// ^^^^^ -storage -// ^^^^^ variable.other.go +// ^^^^^ variable.other.go -storage func(true false) (nil iota) // ^^^^ storage.type.keyword.function.go @@ -415,10 +422,10 @@ You may have to disable Go-specific linters when working on this file. ) func( - param, param []byte, + param, param []typ, // ^^^^^ variable.parameter.go // ^^^^^ variable.parameter.go -// ^^^^ storage.type.go +// ^^^ storage.type.go param ...typ, // ^^^^^ variable.parameter.go // ^^^ keyword.operator.variadic.go @@ -426,10 +433,10 @@ You may have to disable Go-specific linters when working on this file. ) func( - param, param (([]byte)), + param, param (([]typ)), // ^^^^^ variable.parameter.go // ^^^^^ variable.parameter.go -// ^^^^ storage.type.go +// ^^^ storage.type.go param typ, // ^^^^^ variable.parameter.go // ^^^ storage.type.go @@ -751,8 +758,7 @@ You may have to disable Go-specific linters when working on this file. // ^^^ storage.type.go // ^ punctuation.section.brackets.end.go // ^^^ storage.type.go -// ^^^^^ -storage -// ^^^^^ variable.other.go +// ^^^^^ variable.other.go -storage map[typ] // ^^^ storage.type.keyword.map.go @@ -895,20 +901,20 @@ You may have to disable Go-specific linters when working on this file. map[[0]typ][0]typ // ^^^ storage.type.keyword.map.go -// ^ constant.numeric.integer.go +// ^ constant.numeric.integer.decimal.go // ^^^ storage.type.go -// ^ constant.numeric.integer.go +// ^ constant.numeric.integer.decimal.go // ^^^ storage.type.go map[/**/ [0] /**/ typ /**/ ] /**/ [0] /**/ typ // ^^^ storage.type.keyword.map.go // ^^^^ comment.block.go -// ^ constant.numeric.integer.go +// ^ constant.numeric.integer.decimal.go // ^^^^ comment.block.go // ^^^ storage.type.go // ^^^^ comment.block.go // ^^^^ comment.block.go -// ^ constant.numeric.integer.go +// ^ constant.numeric.integer.decimal.go // ^^^^ comment.block.go // ^^^ storage.type.go @@ -1175,7 +1181,7 @@ You may have to disable Go-specific linters when working on this file. field [0]typ // ^^^^^ meta.type.go variable.other.member.declaration.go // ^ meta.type.go punctuation.section.brackets.begin.go -// ^ meta.type.go constant.numeric.integer.go +// ^ meta.type.go constant.numeric.integer.decimal.go // ^ meta.type.go punctuation.section.brackets.end.go // ^^^ meta.type.go storage.type.go } @@ -1185,19 +1191,19 @@ You may have to disable Go-specific linters when working on this file. [0]typ // ^ punctuation.section.brackets.begin.go -// ^ constant.numeric.integer.go +// ^ constant.numeric.integer.decimal.go // ^ punctuation.section.brackets.end.go // ^^^ storage.type.go [0x10]typ // ^ punctuation.section.brackets.begin.go -// ^^^^ constant.numeric.hex.go +// ^^^^ constant.numeric.integer.hexadecimal.go // ^ punctuation.section.brackets.end.go // ^^^ storage.type.go [0]typ ident // ^ punctuation.section.brackets.begin.go -// ^ constant.numeric.integer.go +// ^ constant.numeric.integer.decimal.go // ^ punctuation.section.brackets.end.go // ^^^ storage.type.go // ^^^^^ variable.other.go @@ -1232,15 +1238,14 @@ You may have to disable Go-specific linters when working on this file. // ^^^^ comment.block.go /**/ 0 /**/ ] /**/ typ // ^^^^ comment.block.go -// ^ constant.numeric.integer.go +// ^ constant.numeric.integer.decimal.go // ^^^^ comment.block.go // ^^^^ comment.block.go // ^^^ storage.type.go [0] ident -// ^^^^^ -storage -// ^^^^^ variable.other.go +// ^^^^^ variable.other.go -storage [/**/ // ^^^^ comment.block.go @@ -1251,8 +1256,7 @@ You may have to disable Go-specific linters when working on this file. [] ident -// ^^^^^ -storage -// ^^^^^ variable.other.go +// ^^^^^ variable.other.go -storage []func( // ^^^^ storage.type.keyword.function.go @@ -1264,7 +1268,12 @@ You may have to disable Go-specific linters when working on this file. // ^^^^^ variable.other.go -// # Type Definitions +// ## type + + type _ typ +// ^^^^ storage.type.keyword.type.go +// ^ variable.language.blank.go +// ^^^ storage.type.go type Type typ // ^^^^ storage.type.keyword.type.go @@ -1432,12 +1441,11 @@ You may have to disable Go-specific linters when working on this file. // cause identifiers in those expressions to be incorrectly scoped as constants // or variables. -// Empty identifier is NOT scoped const _ = 10 // ^^^^^ storage.type.keyword.const.go // ^ variable.language.blank.go // ^ keyword.operator.assignment.go -// ^^ constant.numeric.integer.go +// ^^ constant.numeric.integer.decimal.go /**/ const // ^^^^ comment.block.go @@ -1450,7 +1458,7 @@ You may have to disable Go-specific linters when working on this file. // ^^^^ comment.block.go // ^ keyword.operator.assignment.go // ^^^^ comment.block.go -// ^^^^ constant.numeric.integer.go +// ^^^^ constant.numeric.integer.decimal.go // ^^^^ comment.block.go const ident, ident = 10, 20 @@ -1494,9 +1502,9 @@ You may have to disable Go-specific linters when working on this file. // ^^^^ comment.block.go // ^ keyword.operator.assignment.go // ^^^^ comment.block.go -// ^^^^ constant.numeric.integer.go +// ^^^^ constant.numeric.integer.decimal.go // ^ keyword.operator.go -// ^^^^ constant.numeric.integer.go +// ^^^^ constant.numeric.integer.decimal.go // ^^^^ comment.block.go /**/ ident /**/ = /**/ ident + 100 /**/ @@ -1507,7 +1515,7 @@ You may have to disable Go-specific linters when working on this file. // ^^^^ comment.block.go // ^^^^^ variable.other.go // ^ keyword.operator.go -// ^^^ constant.numeric.integer.go +// ^^^ constant.numeric.integer.decimal.go // ^^^^ comment.block.go /**/ ident /**/ @@ -1527,9 +1535,9 @@ You may have to disable Go-specific linters when working on this file. // ^^^^^ variable.other.constant.declaration.go // ^^^ storage.type.go // ^ keyword.operator.assignment.go -// ^^ constant.numeric.integer.go +// ^^ constant.numeric.integer.decimal.go // ^ punctuation.separator.go -// ^^ constant.numeric.integer.go +// ^^ constant.numeric.integer.decimal.go ident, // ^^^^^ variable.other.constant.declaration.go @@ -1566,72 +1574,71 @@ You may have to disable Go-specific linters when working on this file. // ^^^^^ variable.other.constant.declaration.go // ^ keyword.operator.assignment.go 10 -// ^^ constant.numeric.integer.go +// ^^ constant.numeric.integer.decimal.go ident = // ^^^^^ variable.other.constant.declaration.go // ^ keyword.operator.assignment.go iota + iota -// ^^^^ constant.numeric.integer.go +// ^^^^ constant.numeric.integer.decimal.go // ^ keyword.operator.go -// ^^^^ constant.numeric.integer.go +// ^^^^ constant.numeric.integer.decimal.go iota = iota // ^^^^ variable.other.constant.declaration.go // ^ keyword.operator.assignment.go -// ^^^^ constant.numeric.integer.go +// ^^^^ constant.numeric.integer.decimal.go ) -const ident typ = ident + -// ^^ storage.type.keyword.const.go -// ^^^^^ variable.other.constant.declaration.go -// ^^^ storage.type.go -// ^ keyword.operator.assignment.go -// ^^^^^ variable.other.go -// ^ keyword.operator.go - ident + -// ^^^^^ variable.other.go -// ^ keyword.operator.go - ident + -// ^^^^^ variable.other.go -// ^ keyword.operator.go - ident -// ^^^^^ variable.other.go - -const ( -// ^^ storage.type.keyword.const.go - ident typ = ident + -// ^^^^^ variable.other.constant.declaration.go -// ^^^ storage.type.go -// ^ keyword.operator.assignment.go -// ^^^^^ variable.other.go -// ^ keyword.operator.go + const ident typ = ident + +// ^^^^^ storage.type.keyword.const.go +// ^^^^^ variable.other.constant.declaration.go +// ^^^ storage.type.go +// ^ keyword.operator.assignment.go +// ^^^^^ variable.other.go +// ^ keyword.operator.go ident + -// ^^^^^ variable.other.constant.declaration.go +// ^^^^^ variable.other.go // ^ keyword.operator.go + ident + +// ^^^^^ variable.other.go +// ^ keyword.operator.go + ident +// ^^^^^ variable.other.go + + const ( +// ^^^^^ storage.type.keyword.const.go + ident typ = ident + +// ^^^^^ variable.other.constant.declaration.go +// ^^^ storage.type.go +// ^ keyword.operator.assignment.go +// ^^^^^ variable.other.go +// ^ keyword.operator.go + ident + +// ^^^^^ variable.other.constant.declaration.go +// ^ keyword.operator.go // BUG: this is incorrectly scoped as a type. TODO consider detecting multiline // expressions, or find another way of handling this properly. - ident + + ident + - ident -// ^^^^^ variable.other.constant.declaration.go -) + ident +// ^^^^^ variable.other.constant.declaration.go + ) // iota is predefined only in constant declarations. It's not a reserved word. -func _() { - var iota = 0 -// ^^^ storage.type.keyword.var.go -// ^^^^ variable.declaration.go -// ^ keyword.operator.assignment.go -// ^ constant.numeric.integer.go - var _ = iota -// ^^^ storage.type.keyword.var.go -// ^ variable.language.blank.go -// ^ keyword.operator.assignment.go -// ^^^^ variable.other.go -// ^^^^ -constant -} + func _() { + var iota = 0 +// ^^^ storage.type.keyword.var.go +// ^^^^ variable.declaration.go +// ^ keyword.operator.assignment.go +// ^ constant.numeric.integer.decimal.go + var _ = iota +// ^^^ storage.type.keyword.var.go +// ^ variable.language.blank.go +// ^ keyword.operator.assignment.go +// ^^^^ variable.other.go -constant + } var _ = log.Println // ^^^ storage.type.keyword.var.go @@ -1652,7 +1659,7 @@ func _() { // ^^^^ comment.block.go // ^ keyword.operator.assignment.go // ^^^^ comment.block.go -// ^^ constant.numeric.integer.go +// ^^ constant.numeric.integer.decimal.go // ^^^^ comment.block.go var ident, ident = 10, 20 @@ -1700,7 +1707,7 @@ func _() { // ^^^^ comment.block.go // ^ keyword.operator.go // ^^^^ comment.block.go -// ^^ constant.numeric.integer.go +// ^^ constant.numeric.integer.decimal.go // ^^^^ comment.block.go /**/ ident /**/ = /**/ ident + 20 /**/ @@ -1711,7 +1718,7 @@ func _() { // ^^^^ comment.block.go // ^^^^^ variable.other.go // ^ keyword.operator.go -// ^^ constant.numeric.integer.go +// ^^ constant.numeric.integer.decimal.go // ^^^^ comment.block.go ident, @@ -1760,157 +1767,325 @@ func _() { // ### Decimal - 0; 123456789; -0; -123456789; -// ^ constant.numeric.integer.go -// ^^^^^^^^^ constant.numeric.integer.go + 0; 123456789; -0; -123456789; 1777_000_000; +// ^ constant.numeric.integer.decimal.go +// ^^^^^^^^^ constant.numeric.integer.decimal.go // ^ keyword.operator.go -// ^ constant.numeric.integer.go +// ^ constant.numeric.integer.decimal.go // ^ keyword.operator.go -// ^^^^^^^^^ constant.numeric.integer.go +// ^^^^^^^^^ constant.numeric.integer.decimal.go +// ^^^^^^^^^^^^ constant.numeric.integer.decimal.go // ### Octal - 00; 01234567; -01234567; -// ^^ constant.numeric.octal.go -// ^^^^^^^^ constant.numeric.octal.go + 00; 01234567; -01234567; 0_0; 012_45; +// ^ constant.numeric.integer.octal.go punctuation.definition.numeric.base.go +// ^ constant.numeric.integer.octal.go +// ^ constant.numeric.integer.octal.go punctuation.definition.numeric.base.go +// ^^^^^^^ constant.numeric.integer.octal.go // ^ keyword.operator.go -// ^^^^^^^^ constant.numeric.octal.go +// ^ constant.numeric.integer.octal.go punctuation.definition.numeric.base.go +// ^^^^^^^ constant.numeric.integer.octal.go +// ^ constant.numeric.integer.octal.go punctuation.definition.numeric.base.go +// ^^ constant.numeric.integer.octal.go +// ^ constant.numeric.integer.octal.go punctuation.definition.numeric.base.go +// ^^^^^ constant.numeric.integer.octal.go 08; 09; // ^^ invalid.illegal.go // ^^ invalid.illegal.go + 0o660; 0O061; -0o02; 0o_660; 0O0_6_1; +// ^^ constant.numeric.integer.octal.go punctuation.definition.numeric.base.go +// ^^^ constant.numeric.integer.octal.go +// ^^ constant.numeric.integer.octal.go punctuation.definition.numeric.base.go +// ^^^ constant.numeric.integer.octal.go +// ^ keyword.operator.go +// ^^ constant.numeric.integer.octal.go punctuation.definition.numeric.base.go +// ^^ constant.numeric.integer.octal.go +// ^^ constant.numeric.integer.octal.go punctuation.definition.numeric.base.go +// ^^^^ constant.numeric.integer.octal.go +// ^^ constant.numeric.integer.octal.go punctuation.definition.numeric.base.go +// ^^^^^ constant.numeric.integer.octal.go + // ### Hex 0x0; 0x0123456789ABCDEFabcdef; -0x0123456789ABCDEFabcdef; -// ^^^ constant.numeric.hex.go -// ^^^^^^^^^^^^^^^^^^^^^^^^ constant.numeric.hex.go +// ^^^ constant.numeric.integer.hexadecimal.go +// ^^^^^^^^^^^^^^^^^^^^^^^^ constant.numeric.integer.hexadecimal.go // ^ keyword.operator.go -// ^^^^^^^^^^^^^^^^^^^^^^^^ constant.numeric.hex.go +// ^^^^^^^^^^^^^^^^^^^^^^^^ constant.numeric.integer.hexadecimal.go + + 0x_0; 0x012_3456_7_8_9ABCDEFabcd_ef; +// ^^ constant.numeric.integer.hexadecimal.go punctuation.definition.numeric.base.go +// ^^ constant.numeric.integer.hexadecimal.go +// ^^ constant.numeric.integer.hexadecimal.go punctuation.definition.numeric.base.go +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant.numeric.integer.hexadecimal.go + +// ### Binary + + 0b1011; 0B00001; -0b1; 0b_1; 0B1_0; +// ^^ constant.numeric.integer.binary.go punctuation.definition.numeric.base.go +// ^^^^ constant.numeric.integer.binary.go +// ^^ constant.numeric.integer.binary.go punctuation.definition.numeric.base.go +// ^^^^^ constant.numeric.integer.binary.go +// ^ keyword.operator.go +// ^^ constant.numeric.integer.binary.go punctuation.definition.numeric.base.go +// ^ constant.numeric.integer.binary.go +// ^^ constant.numeric.integer.binary.go punctuation.definition.numeric.base.go +// ^^ constant.numeric.integer.binary.go +// ^^ constant.numeric.integer.binary.go punctuation.definition.numeric.base.go +// ^^^ constant.numeric.integer.binary.go // ## Floats 000.000; 123.456; .0; 1.; -// ^^^^^^^ constant.numeric.float.go +// ^^^^^^^ constant.numeric.float.decimal.go // ^ punctuation.separator.decimal.go -// ^^^ constant.numeric.float.go +// ^^^ constant.numeric.float.decimal.go // ^ punctuation.separator.decimal.go -// ^^^ constant.numeric.float.go -// ^^ invalid.deprecated.go -// ^^ invalid.deprecated.go +// ^^^ constant.numeric.float.decimal.go +// ^^ constant.numeric.float.decimal.go +// ^ punctuation.separator.decimal.go +// ^^ constant.numeric.float.decimal.go +// ^ punctuation.separator.decimal.go + + 0_1.0_1; 1_23.4_6; +// ^^^ constant.numeric.float.decimal.go +// ^ punctuation.separator.decimal.go +// ^^^ constant.numeric.float.decimal.go +// ^^^^ constant.numeric.float.decimal.go +// ^ punctuation.separator.decimal.go +// ^^^ constant.numeric.float.decimal.go - -000.000; -123.456; -.0; -1.; + -000.000; -123.456; -.0; -1. -1.. ; // ^ keyword.operator.go -// ^^^^^^^ constant.numeric.float.go +// ^^^^^^^ constant.numeric.float.decimal.go // ^ punctuation.separator.decimal.go // ^ keyword.operator.go -// ^^^^^^^ constant.numeric.float.go +// ^^^^^^^ constant.numeric.float.decimal.go // ^ punctuation.separator.decimal.go // ^ keyword.operator.go -// ^^ invalid.deprecated.go +// ^^ constant.numeric.float.decimal.go +// ^ punctuation.separator.decimal.go // ^ keyword.operator.go -// ^^ invalid.deprecated.go +// ^^ constant.numeric.float.decimal.go +// ^ punctuation.separator.decimal.go +// ^ keyword.operator.go +// ^^ constant.numeric.float.decimal.go +// ^ punctuation.separator.decimal.go +// ^ punctuation.accessor.dot.go 0e+0; 0E+0; 0.0e+0; 0.0E+0; 123.456e+789; -// ^^^^ constant.numeric.float.go -// ^^ punctuation.separator.exponent.go -// ^^^^ constant.numeric.float.go -// ^^ punctuation.separator.exponent.go -// ^^^^^^ constant.numeric.float.go -// ^^^^^^ constant.numeric.float.go -// ^ punctuation.separator.decimal.go -// ^^ punctuation.separator.exponent.go -// ^ constant.numeric.float.go -// ^ punctuation.terminator.go -// ^^^^^^^^^^^^ constant.numeric.float.go -// ^ punctuation.separator.decimal.go -// ^^ punctuation.separator.exponent.go +// ^^^^ constant.numeric.float.decimal.go +// ^^^^ constant.numeric.float.decimal.go +// ^ constant.numeric.float.decimal.go +// ^ constant.numeric.float.decimal.go punctuation.separator.decimal.go +// ^^^^ constant.numeric.float.decimal.go +// ^ constant.numeric.float.decimal.go +// ^ constant.numeric.float.decimal.go punctuation.separator.decimal.go +// ^^^^ constant.numeric.float.decimal.go +// ^^^ constant.numeric.float.decimal.go +// ^ constant.numeric.float.decimal.go punctuation.separator.decimal.go +// ^^^^^^^^ constant.numeric.float.decimal.go + + 1_2e+0; 1E+0_1; 0.1_2e2; 1_23.4_56e+78_9; +// ^^^^^^ constant.numeric.float.decimal.go +// ^^^^^^ constant.numeric.float.decimal.go +// ^ constant.numeric.float.decimal.go +// ^ constant.numeric.float.decimal.go punctuation.separator.decimal.go +// ^^^^^ constant.numeric.float.decimal.go +// ^^^^ constant.numeric.float.decimal.go +// ^ constant.numeric.float.decimal.go punctuation.separator.decimal.go +// ^^^^^^^^^^ constant.numeric.float.decimal.go 0e-0; 0E-0; 0.0e-0; 0.0E-0; 123.456e-789; -// ^^^^ constant.numeric.float.go -// ^^ punctuation.separator.exponent.go -// ^^^^ constant.numeric.float.go -// ^^ punctuation.separator.exponent.go -// ^ constant.numeric.float.go -// ^^^^^^ constant.numeric.float.go -// ^ punctuation.separator.decimal.go -// ^^ punctuation.separator.exponent.go -// ^^^^^^ constant.numeric.float.go -// ^ punctuation.separator.decimal.go -// ^^ punctuation.separator.exponent.go -// ^^^^^^^^^^^^ constant.numeric.float.go -// ^ punctuation.separator.decimal.go -// ^^ punctuation.separator.exponent.go +// ^^^^ constant.numeric.float.decimal.go +// ^^^^ constant.numeric.float.decimal.go +// ^ constant.numeric.float.decimal.go +// ^ constant.numeric.float.decimal.go punctuation.separator.decimal.go +// ^^^^ constant.numeric.float.decimal.go +// ^ constant.numeric.float.decimal.go +// ^ constant.numeric.float.decimal.go punctuation.separator.decimal.go +// ^^^^ constant.numeric.float.decimal.go +// ^^^ constant.numeric.float.decimal.go +// ^ constant.numeric.float.decimal.go punctuation.separator.decimal.go +// ^^^^^^^^ constant.numeric.float.decimal.go 0.e+0; .0e+0; 0.e-0; .0e-0; -// ^^^^^ invalid.deprecated.go -// ^^^^^ invalid.deprecated.go -// ^^^^^ invalid.deprecated.go -// ^^^^^ invalid.deprecated.go +// ^^^^^ constant.numeric.float.decimal.go +// ^ punctuation.separator.decimal.go +// ^^^^^ constant.numeric.float.decimal.go +// ^ punctuation.separator.decimal.go +// ^^^^^ constant.numeric.float.decimal.go +// ^ punctuation.separator.decimal.go +// ^^^^^ constant.numeric.float.decimal.go +// ^ punctuation.separator.decimal.go + + 0x1p-2; 0X1P+2; 0x1p2; +// ^^ constant.numeric.float.hexadecimal.go punctuation.definition.numeric.base.go +// ^^^^ constant.numeric.float.hexadecimal.go +// ^^ constant.numeric.float.hexadecimal.go punctuation.definition.numeric.base.go +// ^^^^ constant.numeric.float.hexadecimal.go +// ^^ constant.numeric.float.hexadecimal.go punctuation.definition.numeric.base.go +// ^^^ constant.numeric.float.hexadecimal.go + + 0x_1p-2; 0X1_1P+2; 0x_1p2_1; +// ^^ constant.numeric.float.hexadecimal.go punctuation.definition.numeric.base.go +// ^^^^^ constant.numeric.float.hexadecimal.go +// ^^ constant.numeric.float.hexadecimal.go punctuation.definition.numeric.base.go +// ^^^^^^ constant.numeric.float.hexadecimal.go +// ^^ constant.numeric.float.hexadecimal.go punctuation.definition.numeric.base.go +// ^^^^^^ constant.numeric.float.hexadecimal.go + + 0x1.0P-1021; 0X1.0p-1021; +// ^^ constant.numeric.float.hexadecimal.go punctuation.definition.numeric.base.go +// ^ constant.numeric.float.hexadecimal.go +// ^ constant.numeric.float.hexadecimal.go punctuation.separator.decimal.go +// ^^^^^^^ constant.numeric.float.hexadecimal.go +// ^^ constant.numeric.float.hexadecimal.go punctuation.definition.numeric.base.go +// ^ constant.numeric.float.hexadecimal.go +// ^ constant.numeric.float.hexadecimal.go punctuation.separator.decimal.go +// ^^^^^^^ constant.numeric.float.hexadecimal.go + + 0x_1_1.0_7P-1_021; +// ^^ constant.numeric.float.hexadecimal.go punctuation.definition.numeric.base.go +// ^^^^ constant.numeric.float.hexadecimal.go +// ^ constant.numeric.float.hexadecimal.go punctuation.separator.decimal.go +// ^^^^^^^^^^ constant.numeric.float.hexadecimal.go + + 0x2.p10; 0x1.Fp+0; 0X.8p-0; +// ^^ constant.numeric.float.hexadecimal.go punctuation.definition.numeric.base.go +// ^ constant.numeric.float.hexadecimal.go +// ^ constant.numeric.float.hexadecimal.go punctuation.separator.decimal.go +// ^^^ constant.numeric.float.hexadecimal.go +// ^^ constant.numeric.float.hexadecimal.go punctuation.definition.numeric.base.go +// ^ constant.numeric.float.hexadecimal.go +// ^ constant.numeric.float.hexadecimal.go punctuation.separator.decimal.go +// ^^^^ constant.numeric.float.hexadecimal.go +// ^^ constant.numeric.float.hexadecimal.go punctuation.definition.numeric.base.go +// ^ constant.numeric.float.hexadecimal.go punctuation.separator.decimal.go +// ^^^^ constant.numeric.float.hexadecimal.go // ## Imaginary - 000i; 100i; -100i; -// ^^^^ constant.numeric.imaginary.go -// ^ storage.type.numeric.imaginary.go -// ^^^^ constant.numeric.imaginary.go -// ^ storage.type.numeric.imaginary.go + 000i; 100i; -100i; 1_1i; +// ^^^^ constant.numeric.imaginary.decimal.go +// ^ storage.type.numeric.go +// ^^^^ constant.numeric.imaginary.decimal.go +// ^ storage.type.numeric.go // ^ keyword.operator.go -// ^^^^ constant.numeric.imaginary.go -// ^ storage.type.numeric.imaginary.go +// ^^^^ constant.numeric.imaginary.decimal.go +// ^ storage.type.numeric.go +// ^^^ constant.numeric.imaginary.decimal.go +// ^ constant.numeric.imaginary.decimal.go storage.type.numeric.go - 123.456i; -123.456i; -// ^^^^^^^^ constant.numeric.imaginary.go + 123.456i; -123.456i; 1_23.45_6i; +// ^^^^^^^^ constant.numeric.imaginary.decimal.go // ^ punctuation.separator.decimal.go -// ^ storage.type.numeric.imaginary.go +// ^ storage.type.numeric.go // ^ keyword.operator.go -// ^^^^^^^^ constant.numeric.imaginary.go +// ^^^^^^^^ constant.numeric.imaginary.decimal.go // ^ punctuation.separator.decimal.go -// ^ storage.type.numeric.imaginary.go +// ^ storage.type.numeric.go +// ^^^^ constant.numeric.imaginary.decimal.go +// ^ constant.numeric.imaginary.decimal.go punctuation.separator.decimal.go +// ^^^^ constant.numeric.imaginary.decimal.go +// ^ constant.numeric.imaginary.decimal.go storage.type.numeric.go 1e+2i; 1e-2i; 1.2e+3i; 1.2e-3i; 1E+2i; 1E-2i; 1.2E+3i; 1.2E-3i; -// ^^^^^ constant.numeric.imaginary.go -// ^^ punctuation.separator.exponent.go -// ^ storage.type.numeric.imaginary.go -// ^^^^^ constant.numeric.imaginary.go -// ^^ punctuation.separator.exponent.go -// ^ storage.type.numeric.imaginary.go -// ^^^^^^^ constant.numeric.imaginary.go -// ^ punctuation.separator.decimal.go -// ^^ punctuation.separator.exponent.go -// ^ storage.type.numeric.imaginary.go -// ^^^^^^^ constant.numeric.imaginary.go -// ^ punctuation.separator.decimal.go -// ^^ punctuation.separator.exponent.go -// ^ storage.type.numeric.imaginary.go -// ^^^^^ constant.numeric.imaginary.go -// ^^ punctuation.separator.exponent.go -// ^ storage.type.numeric.imaginary.go -// ^^^^^ constant.numeric.imaginary.go -// ^^ punctuation.separator.exponent.go -// ^ storage.type.numeric.imaginary.go -// ^^^^^^^ constant.numeric.imaginary.go -// ^ punctuation.separator.decimal.go -// ^^ punctuation.separator.exponent.go -// ^ storage.type.numeric.imaginary.go -// ^^^^^^^ constant.numeric.imaginary.go -// ^ punctuation.separator.decimal.go -// ^^ punctuation.separator.exponent.go -// ^ storage.type.numeric.imaginary.go - - 0.i; .0i; -0.i; -.0i; -// ^^^ invalid.deprecated.go -// ^^^ invalid.deprecated.go -// ^ keyword.operator.go -// ^^^ invalid.deprecated.go -// ^ keyword.operator.go -// ^^^ invalid.deprecated.go - - 0.e+0i; .0e+0i; 0.e-0i; .0e-0i; -// ^^^^^^ invalid.deprecated.go -// ^^^^^^ invalid.deprecated.go -// ^^^^^^ invalid.deprecated.go -// ^^^^^^ invalid.deprecated.go +// ^^^^ constant.numeric.imaginary.decimal.go +// ^ constant.numeric.imaginary.decimal.go storage.type.numeric.go +// ^ punctuation.terminator.go +// ^^^^ constant.numeric.imaginary.decimal.go +// ^ constant.numeric.imaginary.decimal.go storage.type.numeric.go +// ^ punctuation.terminator.go +// ^ constant.numeric.imaginary.decimal.go +// ^ constant.numeric.imaginary.decimal.go punctuation.separator.decimal.go +// ^^^^ constant.numeric.imaginary.decimal.go +// ^ constant.numeric.imaginary.decimal.go storage.type.numeric.go +// ^ constant.numeric.imaginary.decimal.go +// ^ constant.numeric.imaginary.decimal.go punctuation.separator.decimal.go +// ^^^^ constant.numeric.imaginary.decimal.go +// ^ constant.numeric.imaginary.decimal.go storage.type.numeric.go +// ^^^^ constant.numeric.imaginary.decimal.go +// ^ constant.numeric.imaginary.decimal.go storage.type.numeric.go +// ^^^^ constant.numeric.imaginary.decimal.go +// ^ constant.numeric.imaginary.decimal.go storage.type.numeric.go +// ^ constant.numeric.imaginary.decimal.go +// ^ constant.numeric.imaginary.decimal.go punctuation.separator.decimal.go +// ^^^^ constant.numeric.imaginary.decimal.go +// ^ constant.numeric.imaginary.decimal.go storage.type.numeric.go +// ^ constant.numeric.imaginary.decimal.go +// ^ constant.numeric.imaginary.decimal.go punctuation.separator.decimal.go +// ^^^^ constant.numeric.imaginary.decimal.go +// ^ constant.numeric.imaginary.decimal.go storage.type.numeric.go + + 1_1e+2_1i; 1.2_1E-3_5i; +// ^^^^^^^^ constant.numeric.imaginary.decimal.go +// ^ constant.numeric.imaginary.decimal.go storage.type.numeric.go +// ^ constant.numeric.imaginary.decimal.go +// ^ constant.numeric.imaginary.decimal.go punctuation.separator.decimal.go +// ^^^^^^^^ constant.numeric.imaginary.decimal.go +// ^ constant.numeric.imaginary.decimal.go storage.type.numeric.go + + 0o6i; 0O35i; 0o_6i; 0O3_5i; +// ^^ constant.numeric.imaginary.octal.go punctuation.definition.numeric.base.go +// ^ constant.numeric.imaginary.octal.go +// ^ constant.numeric.imaginary.octal.go storage.type.numeric.go +// ^^ constant.numeric.imaginary.octal.go punctuation.definition.numeric.base.go +// ^^ constant.numeric.imaginary.octal.go +// ^ constant.numeric.imaginary.octal.go storage.type.numeric.go +// ^^ constant.numeric.imaginary.octal.go punctuation.definition.numeric.base.go +// ^^ constant.numeric.imaginary.octal.go +// ^ constant.numeric.imaginary.octal.go storage.type.numeric.go +// ^^ constant.numeric.imaginary.octal.go punctuation.definition.numeric.base.go +// ^^^ constant.numeric.imaginary.octal.go +// ^ constant.numeric.imaginary.octal.go storage.type.numeric.go + + 0x0i; 0x0123456789ABCDEFabcdefi; 0x_012_CD_Efi; +// ^^ constant.numeric.imaginary.hexadecimal.go punctuation.definition.numeric.base.go +// ^ constant.numeric.imaginary.hexadecimal.go +// ^ constant.numeric.imaginary.hexadecimal.go storage.type.numeric.go +// ^^ constant.numeric.imaginary.hexadecimal.go punctuation.definition.numeric.base.go +// ^^^^^^^^^^^^^^^^^^^^^^ constant.numeric.imaginary.hexadecimal.go +// ^ constant.numeric.imaginary.hexadecimal.go storage.type.numeric.go +// ^^ constant.numeric.imaginary.hexadecimal.go punctuation.definition.numeric.base.go +// ^^^^^^^^^^ constant.numeric.imaginary.hexadecimal.go +// ^ constant.numeric.imaginary.hexadecimal.go storage.type.numeric.go + + 0b1011i; 0B00001i; 0b_1011i; 0B000_01i; +// ^^ constant.numeric.imaginary.binary.go punctuation.definition.numeric.base.go +// ^^^^ constant.numeric.imaginary.binary.go +// ^ constant.numeric.imaginary.binary.go storage.type.numeric.go +// ^^ constant.numeric.imaginary.binary.go punctuation.definition.numeric.base.go +// ^^^^^ constant.numeric.imaginary.binary.go +// ^ constant.numeric.imaginary.binary.go storage.type.numeric.go +// ^^ constant.numeric.imaginary.binary.go punctuation.definition.numeric.base.go +// ^^^^^ constant.numeric.imaginary.binary.go +// ^ constant.numeric.imaginary.binary.go storage.type.numeric.go +// ^^ constant.numeric.imaginary.binary.go punctuation.definition.numeric.base.go +// ^^^^^^ constant.numeric.imaginary.binary.go +// ^ constant.numeric.imaginary.binary.go storage.type.numeric.go + + 0x1p-2i; 0x1.0P-1021i; 0x1.Fp+0i; +// ^^ constant.numeric.imaginary.hexadecimal.go punctuation.definition.numeric.base.go +// ^^^^ constant.numeric.imaginary.hexadecimal.go +// ^ constant.numeric.imaginary.hexadecimal.go storage.type.numeric.go +// ^^ constant.numeric.imaginary.hexadecimal.go punctuation.definition.numeric.base.go +// ^^^^^^^^^ constant.numeric.imaginary.hexadecimal.go +// ^ constant.numeric.imaginary.hexadecimal.go storage.type.numeric.go +// ^^ constant.numeric.imaginary.hexadecimal.go punctuation.definition.numeric.base.go +// ^^^^^^ constant.numeric.imaginary.hexadecimal.go +// ^ constant.numeric.imaginary.hexadecimal.go storage.type.numeric.go + + 0x_1p-2i; 0x1_4.0_5P-102_1i; +// ^^ constant.numeric.imaginary.hexadecimal.go punctuation.definition.numeric.base.go +// ^^^^^ constant.numeric.imaginary.hexadecimal.go +// ^ constant.numeric.imaginary.hexadecimal.go storage.type.numeric.go +// ^^ constant.numeric.imaginary.hexadecimal.go punctuation.definition.numeric.base.go +// ^^^^^^^^^^^^^^ constant.numeric.imaginary.hexadecimal.go +// ^ constant.numeric.imaginary.hexadecimal.go storage.type.numeric.go // ## Runes @@ -1966,13 +2141,24 @@ func _() { "one %1.2d two" // ^^^^^^^^^^^^^^^ string.quoted.double.go // ^^^^^ constant.other.placeholder.go + "one %[1] two" +// ^^^^^^^^^^^ string.quoted.double.go +// ^^^^^^ constant.other.placeholder.go + "one %[1]v two" +// ^^^^^^^^^^^^ string.quoted.double.go +// ^^^^^ constant.other.placeholder.go + "one %[1]+v two" +// ^^^^^^^^^^^^^ string.quoted.double.go +// ^^^^^^ constant.other.placeholder.go + "one %[1]1.2d two" +// ^^^^^^^^^^^^^^^ string.quoted.double.go +// ^^^^^^^^ constant.other.placeholder.go "%" // ^^^ string.quoted.double.go // ^ -constant.other.placeholder "one /* two */ three" -// ^^^^^^^^^^^^^^^^^^^^^ string.quoted.double.go -// ^^^^^^^^^^^^^^^^^^^^^ -comment +// ^^^^^^^^^^^^^^^^^^^^^ string.quoted.double.go -comment "_\n_" // ^^^^^^ string.quoted.double.go @@ -2009,8 +2195,7 @@ func _() { // ^^^^^^^^^ string.quoted.other.go // ^ punctuation.definition.string.end.go `one \\ \n two` -// ^^^^^^^^^^^^^^^ string.quoted.other.go -// ^^^^^^^^^^^^^^^ -constant.character.escape +// ^^^^^^^^^^^^^^^ string.quoted.other.go -constant.character.escape `one %% two` // ^^^^^^^^^^^^ string.quoted.other.go // ^^ constant.character.escape.go @@ -2026,6 +2211,18 @@ func _() { `one %1.2d two` // ^^^^^^^^^^^^^^^ string.quoted.other.go // ^^^^^ constant.other.placeholder.go + `one %[1] two` +// ^^^^^^^^^^^ string.quoted.other.go +// ^^^^^^ constant.other.placeholder.go + `one %[1]v two` +// ^^^^^^^^^^^^ string.quoted.other.go +// ^^^^^ constant.other.placeholder.go + `one %[1]+v two` +// ^^^^^^^^^^^^^ string.quoted.other.go +// ^^^^^^ constant.other.placeholder.go + `one %[1]1.2d two` +// ^^^^^^^^^^^^^^^ string.quoted.other.go +// ^^^^^^^^ constant.other.placeholder.go `%` // ^^^ string.quoted.other.go // ^ -constant.other.placeholder @@ -2042,8 +2239,7 @@ func _() { // ^ string.quoted.other.go punctuation.definition.string.end.go `one /* two */ three` -// ^^^^^^^^^^^^^^^^^^^^^ string.quoted.other.go -// ^^^^^^^^^^^^^^^^^^^^^ -comment +// ^^^^^^^^^^^^^^^^^^^^^ string.quoted.other.go -comment // # Operators @@ -2362,13 +2558,13 @@ func _() { // ^^^ storage.type.go // ^^^^^ variable.other.go - []byte(ident) -// ^^^^ storage.type.go -// ^^^^^ variable.other.go + []typ(ident) +// ^^^ storage.type.go +// ^^^^^ variable.other.go - ([]byte)(ident) -// ^^^^ storage.type.go -// ^^^^^ variable.other.go + ([]typ)(ident) +// ^^^ storage.type.go +// ^^^^^ variable.other.go // # Keywords @@ -2495,43 +2691,363 @@ func _() { // ^ meta.block.go punctuation.section.braces.begin.go // ^ meta.block.go punctuation.section.braces.end.go -// # Identifiers + +// # Predeclared Constants true false nil // ^^^^ constant.language.go // ^^^^^ constant.language.go // ^^^ constant.language.go - new(typ) -// ^^^ variable.function.go -// ^ punctuation.section.parens.begin.go -// ^^^ storage.type.go -// ^ punctuation.section.parens.end.go - new /**/ ( -// ^^^ variable.function.go -// ^^^^ comment.block.go - /**/ typ /**/ , -// ^^^^ comment.block.go -// ^^^ storage.type.go -// ^^^^ comment.block.go - ) +// # Built-in Types + +/* +These tests make sure that the treatment of built-ins is consistent with +non-built-ins and is purely additive. + +Due to how they're combined in the syntax definition, we don't need to test +every type individually. +*/ + + chan typ +// ^^^^ storage.type.keyword.chan.go +// ^^^ storage.type.go -support + + chan int +// ^^^^ storage.type.keyword.chan.go +// ^^^ storage.type.go support.type.builtin.go + + func(typ) +// ^^^^ storage.type.keyword.function.go +// ^^^ storage.type.go -support + + func(int) +// ^^^^ storage.type.keyword.function.go +// ^^^ storage.type.go support.type.builtin.go + + map[typ]typ +// ^^^ storage.type.keyword.map.go +// ^^^ storage.type.go -support +// ^^^ storage.type.go -support + + map[int]int +// ^^^ storage.type.keyword.map.go +// ^^^ storage.type.go support.type.builtin.go +// ^^^ storage.type.go support.type.builtin.go + + struct { ident typ; typ } +// ^^^^^^ storage.type.keyword.struct.go +// ^^^^^ meta.type.go variable.other.member.declaration.go +// ^^^ meta.type.go storage.type.go -support +// ^^^ meta.type.go entity.other.inherited-class.go -support + + struct { ident int; int } +// ^^^^^^ storage.type.keyword.struct.go +// ^^^^^ meta.type.go variable.other.member.declaration.go +// ^^^ meta.type.go storage.type.go support.type.builtin.go +// ^^^ meta.type.go entity.other.inherited-class.go support.type.builtin.go + + interface { typ } +// ^^^^^^^^^ storage.type.keyword.interface.go +// ^^^ meta.type.go entity.other.inherited-class.go -support + + interface { error } +// ^^^^^^^^^ storage.type.keyword.interface.go +// ^^^^^ meta.type.go entity.other.inherited-class.go support.type.builtin.go + + [...]typ +// ^^^ keyword.operator.variadic.go +// ^^^ storage.type.go -support + + [...]int +// ^^^ keyword.operator.variadic.go +// ^^^ storage.type.go support.type.builtin.go + + []typ +// ^^^ storage.type.go -support + + []int +// ^^^ storage.type.go support.type.builtin.go + + type _ typ +// ^^^^ storage.type.keyword.type.go +// ^ variable.language.blank.go +// ^^^ storage.type.go -support + + type _ int +// ^^^^ storage.type.keyword.type.go +// ^ variable.language.blank.go +// ^^^ storage.type.go support.type.builtin.go + + const ident typ +// ^^^^^ storage.type.keyword.const.go +// ^^^^^ variable.other.constant.declaration.go +// ^^^ storage.type.go -support + + const ident int +// ^^^^^ storage.type.keyword.const.go +// ^^^^^ variable.other.constant.declaration.go +// ^^^ storage.type.go support.type.builtin.go + + var ident typ +// ^^^ storage.type.keyword.var.go +// ^^^^^ variable.declaration.go +// ^^^ storage.type.go -support + + var ident int +// ^^^ storage.type.keyword.var.go +// ^^^^^ variable.declaration.go +// ^^^ storage.type.go support.type.builtin.go + + ident.(typ) +// ^^^^^ variable.other.go +// ^^^ storage.type.go -support + + ident.(int) +// ^^^^^ variable.other.go +// ^^^ storage.type.go support.type.builtin.go + + (typ)(ident) +// ^^^ variable.function.go -support +// ^^^^^ variable.other.go + + (int)(ident) +// ^^^ variable.function.go support.type.builtin.go +// ^^^^^ variable.other.go + + +// # Built-in Functions + +// ## Special Functions make(typ) -// ^^^^ variable.function.go -// ^ punctuation.section.parens.begin.go -// ^^^ storage.type.go -// ^ punctuation.section.parens.end.go +// ^^^^ variable.function.go support.function.builtin.go +// ^^^ storage.type.go -support + + make(int) +// ^^^^ variable.function.go support.function.builtin.go +// ^^^ storage.type.go support.type.builtin.go make /**/ ( -// ^^^^ variable.function.go +// ^^^^ variable.function.go support.function.builtin.go // ^^^^ comment.block.go /**/ typ /**/, // ^^^^ comment.block.go -// ^^^ storage.type.go +// ^^^ storage.type.go -support // ^^^^ comment.block.go ident, // ^^^^^ variable.other.go ident, // ^^^^^ variable.other.go ) + + make /**/ ( +// ^^^^ variable.function.go support.function.builtin.go +// ^^^^ comment.block.go + /**/ int /**/, +// ^^^^ comment.block.go +// ^^^ storage.type.go support.type.builtin.go +// ^^^^ comment.block.go + ident, +// ^^^^^ variable.other.go + ident, +// ^^^^^ variable.other.go + ) + + make +// ^^^^ variable.other.go -support + + var make +// ^^^ storage.type.keyword.var.go +// ^^^^ variable.declaration.go -support + + new(typ, ident) +// ^^^ variable.function.go support.function.builtin.go +// ^^^ storage.type.go -support +// ^^^^^ variable.other.go + + new(int, ident) +// ^^^ variable.function.go support.function.builtin.go +// ^^^ storage.type.go support.type.builtin.go +// ^^^^^ variable.other.go + + ((new))(typ, ident) +// ^^^ variable.function.go support.function.builtin.go +// ^^^ storage.type.go -support +// ^^^^^ variable.other.go + + ((new))(int, ident) +// ^^^ variable.function.go support.function.builtin.go +// ^^^ storage.type.go support.type.builtin.go +// ^^^^^ variable.other.go + + new /**/ ( +// ^^^ variable.function.go support.function.builtin.go +// ^^^^ comment.block.go + /**/ typ /**/ , +// ^^^^ comment.block.go +// ^^^ storage.type.go -support +// ^^^^ comment.block.go + ) + + new /**/ ( +// ^^^ variable.function.go support.function.builtin.go +// ^^^^ comment.block.go + /**/ int /**/ , +// ^^^^ comment.block.go +// ^^^ storage.type.go support.type.builtin.go +// ^^^^ comment.block.go + ) + + new +// ^^^ variable.other.go -support + + var new +// ^^^ storage.type.keyword.var.go +// ^^^ variable.declaration.go -support + +// ## Other Functions + +/* +These tests make sure that the treatment of built-ins is consistent with +non-built-ins, is purely additive, and sufficiently limited. + +Due to how they're combined in the syntax definition, we don't need to test +every function individually. +*/ + + ident(ident) +// ^^^^^ variable.function.go -support +// ^^^^^ variable.other.go + + close(ident) +// ^^^^^ variable.function.go support.function.builtin.go +// ^^^^^ variable.other.go + + ((ident))(ident) +// ^^^^^ variable.function.go -support +// ^^^^^ variable.other.go + + ((close))(ident) +// ^^^^^ variable.function.go support.function.builtin.go +// ^^^^^ variable.other.go + + close +// ^^^^^ variable.other.go -support + + var close +// ^^^ storage.type.keyword.var.go +// ^^^^^ variable.declaration.go -support + + +/* +Templates +*/ +func template() { + t := "\{{ foo }} bar }} {{baz} foo {{baz " + // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.interpolation + t := "{{.Count}} items are made of {{.Material}}" + // ^^^^^^^^^^ meta.interpolation + // ^^ punctuation.section.interpolation.begin + // ^ punctuation.accessor.dot + // ^^^^^ variable.other.member + // ^^ punctuation.section.interpolation.end + t := `{{.Count}} items are made of {{.Material}}` + // ^^^^^^^^^^ meta.interpolation + // ^^ punctuation.section.interpolation.begin + // ^ punctuation.accessor.dot + // ^^^^^ variable.other.member + // ^^ punctuation.section.interpolation.end + t = "{{23 -}} < {{- 45}}" + // ^^^^^^^^ meta.interpolation + // ^^ punctuation.section.interpolation.begin + // ^ keyword.operator.template.right.trim + // ^^ punctuation.section.interpolation.end + // ^ keyword.operator.template.left.trim + t = "{{/* a comment */}}" + // ^^ punctuation.definition.comment + // ^^ punctuation.definition.comment + // ^^^^^^^^^^^^^^^ comment.block + t = "{{if pipeline}} T1 {{else}}{{if pipeline}} T0 {{end}}{{end}}" + // ^^ keyword.control + // ^^^^ keyword.control + // ^^ keyword.control + // ^^^ keyword.control + // ^^^ keyword.control + t = "{{range pipeline}} T1 {{else}} T0 {{end}}" + // ^^^^^ keyword.control + // ^^^^ keyword.control + // ^^^ keyword.control + t = "{{template "name" pipeline}}" + // ^^^^^^^^ keyword.control + // ^ punctuation.definition.string.begin + // ^^^^^^ string.quoted.double + // ^ punctuation.definition.string.end + t = "{{block "name" pipeline}} T1 {{end}}" + // ^^^^^ keyword.control + // ^^^ keyword.control + t = "{{with pipeline}} T1 {{else}} T0 {{end}}" + // ^^^^ keyword.control + // ^^^^ keyword.control + // ^^^ keyword.control + t = "{{$piOver2}}" + // ^^^^^^^^ variable.other.template + t = "{{.Field1.Field2}}" + // ^ punctuation.accessor.dot + // ^^^^^^ variable.other.member + // ^ punctuation.accessor.dot + // ^^^^^^ variable.other.member + t = "{{$x.Field1.Field2}}" + // ^^ variable.other.template + // ^ punctuation.accessor.dot + // ^^^^^^ variable.other.member + // ^ punctuation.accessor.dot + // ^^^^^^ variable.other.member + t = "{{$variable := pipeline}}" + // ^^^^^^^^^ variable.other.template + // ^^ keyword.operator.assignment + t = "{{range $index, $element := pipeline}}" + // ^^^^^ keyword.control. + // ^^^^^^ variable.other.template + // ^^^^^^^^ variable.other.template + // ^^ keyword.operator.assignment + t = "{{`"output"`}}" + t = "{{printf "%q" "output"}}" + // ^^^^^^ support.function.builtin + t = "{{"output" | printf "%q"}}" + // ^ keyword.operator.template + // ^^^^^^ support.function.builtin + t = "{{printf "%q" (print "out" "put")}}" + // ^^^^^^ support.function.builtin + // ^^^^^ support.function.builtin + t = "{{"put" | printf "%s%s" "out" | printf "%q"}}" + // ^ keyword.operator.template + // ^^^^^^ support.function.builtin + // ^ keyword.operator.template + // ^^^^^^ support.function.builtin + t = "{{"output" | printf "%s" | printf "%q"}}" + // ^^^^^^^^ string.quoted.double + // ^ keyword.operator.template + // ^^^^^^ support.function.builtin + // ^^^^ string.quoted.double + // ^ keyword.operator.template + // ^^^^^^ support.function.builtin + // ^^^^ string.quoted.double + t = "{{with "output"}}{{printf "%q" .}}{{end}}" + // ^^^^ keyword.control + // ^ variable.other.template + t = "{{with $x := "output" | printf "%q"}}{{$x}}{{end}}" + // ^^ variable.other.template + // ^^ keyword.operator.assignment + // ^^ variable.other.template + t = "{{with $x := "output"}}{{$x | printf "%q"}}{{end}}" + // ^^ variable.other.template + // ^ keyword.operator.template.pipe + // ^^^^^^ support.function.builtin + t = "{{with $x := "output"}}{{$x = "new value"}}{{$x | printf "%q"}}{{end}}" + // ^ meta.interpolation.go variable.other.template.go punctuation.definition.variable.go + // ^ meta.interpolation.go variable.other.template.go + // ^ meta.interpolation.go keyword.operator.assignment.go + t = "{{slice x 1 2}}" + // ^^^^^ meta.interpolation.go variable.function.go support.function.builtin.go diff --git a/Graphviz/Completions/Attribute Values.sublime-completions b/Graphviz/Completions/Attribute Values.sublime-completions new file mode 100644 index 0000000000..abb5f342fd --- /dev/null +++ b/Graphviz/Completions/Attribute Values.sublime-completions @@ -0,0 +1,742 @@ +{ + "scope": "source.dot meta.attributes", + "completions": [ + // Styles + {"trigger": "filled\tstyle", "contents": "filled"}, + {"trigger": "solid\tstyle", "contents": "solid"}, + {"trigger": "invis\tstyle", "contents": "invis"}, + {"trigger": "dashed\tstyle", "contents": "dashed"}, + {"trigger": "dotted\tstyle", "contents": "dotted"}, + + // Shapes (Node) + {"trigger": "box\tnode shape", "contents": "box"}, + {"trigger": "polygon\tnode shape", "contents": "polygon"}, + {"trigger": "ellipse\tnode shape", "contents": "ellipse"}, + {"trigger": "oval\tnode shape", "contents": "oval"}, + {"trigger": "circle\tnode shape", "contents": "circle"}, + {"trigger": "point\tnode shape", "contents": "point"}, + {"trigger": "egg\tnode shape", "contents": "egg"}, + {"trigger": "triangle\tnode shape", "contents": "triangle"}, + {"trigger": "plaintext\tnode shape", "contents": "plaintext"}, + {"trigger": "plain\tnode shape", "contents": "plain"}, + {"trigger": "diamond\tnode shape", "contents": "diamond"}, + {"trigger": "trapezium\tnode shape", "contents": "trapezium"}, + {"trigger": "parallelogram\tnode shape", "contents": "parallelogram"}, + {"trigger": "house\tnode shape", "contents": "house"}, + {"trigger": "pentagon\tnode shape", "contents": "pentagon"}, + {"trigger": "hexagon\tnode shape", "contents": "hexagon"}, + {"trigger": "septagon\tnode shape", "contents": "septagon"}, + {"trigger": "octagon\tnode shape", "contents": "octagon"}, + {"trigger": "doublecircle\tnode shape", "contents": "doublecircle"}, + {"trigger": "doubleoctagon\tnode shape", "contents": "doubleoctagon"}, + {"trigger": "tripleoctagon\tnode shape", "contents": "tripleoctagon"}, + {"trigger": "invtriangle\tnode shape", "contents": "invtriangle"}, + {"trigger": "invtrapezium\tnode shape", "contents": "invtrapezium"}, + {"trigger": "invhouse\tnode shape", "contents": "invhouse"}, + {"trigger": "Mdiamond\tnode shape", "contents": "Mdiamond"}, + {"trigger": "Msquare\tnode shape", "contents": "Msquare"}, + {"trigger": "Mcircle\tnode shape", "contents": "Mcircle"}, + {"trigger": "rect\tnode shape", "contents": "rect"}, + {"trigger": "rectangle\tnode shape", "contents": "rectangle"}, + {"trigger": "square\tnode shape", "contents": "square"}, + {"trigger": "star\tnode shape", "contents": "star"}, + {"trigger": "none\tnode shape", "contents": "none"}, + {"trigger": "underline\tnode shape", "contents": "underline"}, + {"trigger": "cylinder\tnode shape", "contents": "cylinder"}, + {"trigger": "note\tnode shape", "contents": "note"}, + {"trigger": "tab\tnode shape", "contents": "tab"}, + {"trigger": "folder\tnode shape", "contents": "folder"}, + {"trigger": "box3d\tnode shape", "contents": "box3d"}, + {"trigger": "component\tnode shape", "contents": "component"}, + {"trigger": "promoter\tnode shape", "contents": "promoter"}, + {"trigger": "cds\tnode shape", "contents": "cds"}, + {"trigger": "terminator\tnode shape", "contents": "terminator"}, + {"trigger": "utr\tnode shape", "contents": "utr"}, + {"trigger": "primersite\tnode shape", "contents": "primersite"}, + {"trigger": "restrictionsite\tnode shape", "contents": "restrictionsite"}, + {"trigger": "fivepoverhang\tnode shape", "contents": "fivepoverhang"}, + {"trigger": "threepoverhang\tnode shape", "contents": "threepoverhang"}, + {"trigger": "noverhang\tnode shape", "contents": "noverhang"}, + {"trigger": "assembly\tnode shape", "contents": "assembly"}, + {"trigger": "signature\tnode shape", "contents": "signature"}, + {"trigger": "insulator\tnode shape", "contents": "insulator"}, + {"trigger": "ribosite\tnode shape", "contents": "ribosite"}, + {"trigger": "rnastab\tnode shape", "contents": "rnastab"}, + {"trigger": "proteasesite\tnode shape", "contents": "proteasesite"}, + {"trigger": "proteinstab\tnode shape", "contents": "proteinstab"}, + {"trigger": "rpromoter\tnode shape", "contents": "rpromoter"}, + {"trigger": "rarrow\tnode shape", "contents": "rarrow"}, + {"trigger": "larrow\tnode shape", "contents": "larrow"}, + {"trigger": "lpromoter\tnode shape", "contents": "lpromoter"}, + + // Shapes (Arrow) + {"trigger": "box\tarrow shape", "contents": "box"}, + {"trigger": "crow\tarrow shape", "contents": "crow"}, + {"trigger": "curve\tarrow shape", "contents": "curve"}, + {"trigger": "diamond\tarrow shape", "contents": "diamond"}, + {"trigger": "dot\tarrow shape", "contents": "dot"}, + {"trigger": "icurve\tarrow shape", "contents": "icurve"}, + {"trigger": "inv\tarrow shape", "contents": "inv"}, + {"trigger": "none\tarrow shape", "contents": "none"}, + {"trigger": "normal\tarrow shape", "contents": "normal"}, + {"trigger": "tee\tarrow shape", "contents": "tee"}, + {"trigger": "vee\tarrow shape", "contents": "vee"}, + + // Colors + {"trigger": "aliceblue\tcolor", "contents": "aliceblue"}, + {"trigger": "antiquewhite\tcolor", "contents": "antiquewhite"}, + {"trigger": "antiquewhite1\tcolor", "contents": "antiquewhite1"}, + {"trigger": "antiquewhite2\tcolor", "contents": "antiquewhite2"}, + {"trigger": "antiquewhite3\tcolor", "contents": "antiquewhite3"}, + {"trigger": "antiquewhite4\tcolor", "contents": "antiquewhite4"}, + {"trigger": "aquamarine\tcolor", "contents": "aquamarine"}, + {"trigger": "aquamarine1\tcolor", "contents": "aquamarine1"}, + {"trigger": "aquamarine2\tcolor", "contents": "aquamarine2"}, + {"trigger": "aquamarine3\tcolor", "contents": "aquamarine3"}, + {"trigger": "aquamarine4\tcolor", "contents": "aquamarine4"}, + {"trigger": "azure\tcolor", "contents": "azure"}, + {"trigger": "azure1\tcolor", "contents": "azure1"}, + {"trigger": "azure2\tcolor", "contents": "azure2"}, + {"trigger": "azure3\tcolor", "contents": "azure3"}, + {"trigger": "azure4\tcolor", "contents": "azure4"}, + {"trigger": "beige\tcolor", "contents": "beige"}, + {"trigger": "bisque\tcolor", "contents": "bisque"}, + {"trigger": "bisque1\tcolor", "contents": "bisque1"}, + {"trigger": "bisque2\tcolor", "contents": "bisque2"}, + {"trigger": "bisque3\tcolor", "contents": "bisque3"}, + {"trigger": "bisque4\tcolor", "contents": "bisque4"}, + {"trigger": "black\tcolor", "contents": "black"}, + {"trigger": "blanchedalmond\tcolor", "contents": "blanchedalmond"}, + {"trigger": "blue\tcolor", "contents": "blue"}, + {"trigger": "blue1\tcolor", "contents": "blue1"}, + {"trigger": "blue2\tcolor", "contents": "blue2"}, + {"trigger": "blue3\tcolor", "contents": "blue3"}, + {"trigger": "blue4\tcolor", "contents": "blue4"}, + {"trigger": "blueviolet\tcolor", "contents": "blueviolet"}, + {"trigger": "brown\tcolor", "contents": "brown"}, + {"trigger": "brown1\tcolor", "contents": "brown1"}, + {"trigger": "brown2\tcolor", "contents": "brown2"}, + {"trigger": "brown3\tcolor", "contents": "brown3"}, + {"trigger": "brown4\tcolor", "contents": "brown4"}, + {"trigger": "burlywood\tcolor", "contents": "burlywood"}, + {"trigger": "burlywood1\tcolor", "contents": "burlywood1"}, + {"trigger": "burlywood2\tcolor", "contents": "burlywood2"}, + {"trigger": "burlywood3\tcolor", "contents": "burlywood3"}, + {"trigger": "burlywood4\tcolor", "contents": "burlywood4"}, + {"trigger": "cadetblue\tcolor", "contents": "cadetblue"}, + {"trigger": "cadetblue1\tcolor", "contents": "cadetblue1"}, + {"trigger": "cadetblue2\tcolor", "contents": "cadetblue2"}, + {"trigger": "cadetblue3\tcolor", "contents": "cadetblue3"}, + {"trigger": "cadetblue4\tcolor", "contents": "cadetblue4"}, + {"trigger": "chartreuse\tcolor", "contents": "chartreuse"}, + {"trigger": "chartreuse1\tcolor", "contents": "chartreuse1"}, + {"trigger": "chartreuse2\tcolor", "contents": "chartreuse2"}, + {"trigger": "chartreuse3\tcolor", "contents": "chartreuse3"}, + {"trigger": "chartreuse4\tcolor", "contents": "chartreuse4"}, + {"trigger": "chocolate\tcolor", "contents": "chocolate"}, + {"trigger": "chocolate1\tcolor", "contents": "chocolate1"}, + {"trigger": "chocolate2\tcolor", "contents": "chocolate2"}, + {"trigger": "chocolate3\tcolor", "contents": "chocolate3"}, + {"trigger": "chocolate4\tcolor", "contents": "chocolate4"}, + {"trigger": "coral\tcolor", "contents": "coral"}, + {"trigger": "coral1\tcolor", "contents": "coral1"}, + {"trigger": "coral2\tcolor", "contents": "coral2"}, + {"trigger": "coral3\tcolor", "contents": "coral3"}, + {"trigger": "coral4\tcolor", "contents": "coral4"}, + {"trigger": "cornflowerblue\tcolor", "contents": "cornflowerblue"}, + {"trigger": "cornsilk\tcolor", "contents": "cornsilk"}, + {"trigger": "cornsilk1\tcolor", "contents": "cornsilk1"}, + {"trigger": "cornsilk2\tcolor", "contents": "cornsilk2"}, + {"trigger": "cornsilk3\tcolor", "contents": "cornsilk3"}, + {"trigger": "cornsilk4\tcolor", "contents": "cornsilk4"}, + {"trigger": "crimson\tcolor", "contents": "crimson"}, + {"trigger": "cyan\tcolor", "contents": "cyan"}, + {"trigger": "cyan1\tcolor", "contents": "cyan1"}, + {"trigger": "cyan2\tcolor", "contents": "cyan2"}, + {"trigger": "cyan3\tcolor", "contents": "cyan3"}, + {"trigger": "cyan4\tcolor", "contents": "cyan4"}, + {"trigger": "darkgoldenrod\tcolor", "contents": "darkgoldenrod"}, + {"trigger": "darkgoldenrod1\tcolor", "contents": "darkgoldenrod1"}, + {"trigger": "darkgoldenrod2\tcolor", "contents": "darkgoldenrod2"}, + {"trigger": "darkgoldenrod3\tcolor", "contents": "darkgoldenrod3"}, + {"trigger": "darkgoldenrod4\tcolor", "contents": "darkgoldenrod4"}, + {"trigger": "darkgreen\tcolor", "contents": "darkgreen"}, + {"trigger": "darkkhaki\tcolor", "contents": "darkkhaki"}, + {"trigger": "darkolivegreen\tcolor", "contents": "darkolivegreen"}, + {"trigger": "darkolivegreen1\tcolor", "contents": "darkolivegreen1"}, + {"trigger": "darkolivegreen2\tcolor", "contents": "darkolivegreen2"}, + {"trigger": "darkolivegreen3\tcolor", "contents": "darkolivegreen3"}, + {"trigger": "darkolivegreen4\tcolor", "contents": "darkolivegreen4"}, + {"trigger": "darkorange\tcolor", "contents": "darkorange"}, + {"trigger": "darkorange1\tcolor", "contents": "darkorange1"}, + {"trigger": "darkorange2\tcolor", "contents": "darkorange2"}, + {"trigger": "darkorange3\tcolor", "contents": "darkorange3"}, + {"trigger": "darkorange4\tcolor", "contents": "darkorange4"}, + {"trigger": "darkorchid\tcolor", "contents": "darkorchid"}, + {"trigger": "darkorchid1\tcolor", "contents": "darkorchid1"}, + {"trigger": "darkorchid2\tcolor", "contents": "darkorchid2"}, + {"trigger": "darkorchid3\tcolor", "contents": "darkorchid3"}, + {"trigger": "darkorchid4\tcolor", "contents": "darkorchid4"}, + {"trigger": "darksalmon\tcolor", "contents": "darksalmon"}, + {"trigger": "darkseagreen\tcolor", "contents": "darkseagreen"}, + {"trigger": "darkseagreen1\tcolor", "contents": "darkseagreen1"}, + {"trigger": "darkseagreen2\tcolor", "contents": "darkseagreen2"}, + {"trigger": "darkseagreen3\tcolor", "contents": "darkseagreen3"}, + {"trigger": "darkseagreen4\tcolor", "contents": "darkseagreen4"}, + {"trigger": "darkslateblue\tcolor", "contents": "darkslateblue"}, + {"trigger": "darkslategray\tcolor", "contents": "darkslategray"}, + {"trigger": "darkslategray1\tcolor", "contents": "darkslategray1"}, + {"trigger": "darkslategray2\tcolor", "contents": "darkslategray2"}, + {"trigger": "darkslategray3\tcolor", "contents": "darkslategray3"}, + {"trigger": "darkslategray4\tcolor", "contents": "darkslategray4"}, + {"trigger": "darkslategrey\tcolor", "contents": "darkslategrey"}, + {"trigger": "darkturquoise\tcolor", "contents": "darkturquoise"}, + {"trigger": "darkviolet\tcolor", "contents": "darkviolet"}, + {"trigger": "deeppink\tcolor", "contents": "deeppink"}, + {"trigger": "deeppink1\tcolor", "contents": "deeppink1"}, + {"trigger": "deeppink2\tcolor", "contents": "deeppink2"}, + {"trigger": "deeppink3\tcolor", "contents": "deeppink3"}, + {"trigger": "deeppink4\tcolor", "contents": "deeppink4"}, + {"trigger": "deepskyblue\tcolor", "contents": "deepskyblue"}, + {"trigger": "deepskyblue1\tcolor", "contents": "deepskyblue1"}, + {"trigger": "deepskyblue2\tcolor", "contents": "deepskyblue2"}, + {"trigger": "deepskyblue3\tcolor", "contents": "deepskyblue3"}, + {"trigger": "deepskyblue4\tcolor", "contents": "deepskyblue4"}, + {"trigger": "dimgray\tcolor", "contents": "dimgray"}, + {"trigger": "dimgrey\tcolor", "contents": "dimgrey"}, + {"trigger": "dodgerblue\tcolor", "contents": "dodgerblue"}, + {"trigger": "dodgerblue1\tcolor", "contents": "dodgerblue1"}, + {"trigger": "dodgerblue2\tcolor", "contents": "dodgerblue2"}, + {"trigger": "dodgerblue3\tcolor", "contents": "dodgerblue3"}, + {"trigger": "dodgerblue4\tcolor", "contents": "dodgerblue4"}, + {"trigger": "firebrick\tcolor", "contents": "firebrick"}, + {"trigger": "firebrick1\tcolor", "contents": "firebrick1"}, + {"trigger": "firebrick2\tcolor", "contents": "firebrick2"}, + {"trigger": "firebrick3\tcolor", "contents": "firebrick3"}, + {"trigger": "firebrick4\tcolor", "contents": "firebrick4"}, + {"trigger": "floralwhite\tcolor", "contents": "floralwhite"}, + {"trigger": "forestgreen\tcolor", "contents": "forestgreen"}, + {"trigger": "gainsboro\tcolor", "contents": "gainsboro"}, + {"trigger": "ghostwhite\tcolor", "contents": "ghostwhite"}, + {"trigger": "gold\tcolor", "contents": "gold"}, + {"trigger": "gold1\tcolor", "contents": "gold1"}, + {"trigger": "gold2\tcolor", "contents": "gold2"}, + {"trigger": "gold3\tcolor", "contents": "gold3"}, + {"trigger": "gold4\tcolor", "contents": "gold4"}, + {"trigger": "goldenrod\tcolor", "contents": "goldenrod"}, + {"trigger": "goldenrod1\tcolor", "contents": "goldenrod1"}, + {"trigger": "goldenrod2\tcolor", "contents": "goldenrod2"}, + {"trigger": "goldenrod3\tcolor", "contents": "goldenrod3"}, + {"trigger": "goldenrod4\tcolor", "contents": "goldenrod4"}, + {"trigger": "gray\tcolor", "contents": "gray"}, + {"trigger": "gray0\tcolor", "contents": "gray0"}, + {"trigger": "gray1\tcolor", "contents": "gray1"}, + {"trigger": "gray10\tcolor", "contents": "gray10"}, + {"trigger": "gray100\tcolor", "contents": "gray100"}, + {"trigger": "gray11\tcolor", "contents": "gray11"}, + {"trigger": "gray12\tcolor", "contents": "gray12"}, + {"trigger": "gray13\tcolor", "contents": "gray13"}, + {"trigger": "gray14\tcolor", "contents": "gray14"}, + {"trigger": "gray15\tcolor", "contents": "gray15"}, + {"trigger": "gray16\tcolor", "contents": "gray16"}, + {"trigger": "gray17\tcolor", "contents": "gray17"}, + {"trigger": "gray18\tcolor", "contents": "gray18"}, + {"trigger": "gray19\tcolor", "contents": "gray19"}, + {"trigger": "gray2\tcolor", "contents": "gray2"}, + {"trigger": "gray20\tcolor", "contents": "gray20"}, + {"trigger": "gray21\tcolor", "contents": "gray21"}, + {"trigger": "gray22\tcolor", "contents": "gray22"}, + {"trigger": "gray23\tcolor", "contents": "gray23"}, + {"trigger": "gray24\tcolor", "contents": "gray24"}, + {"trigger": "gray25\tcolor", "contents": "gray25"}, + {"trigger": "gray26\tcolor", "contents": "gray26"}, + {"trigger": "gray27\tcolor", "contents": "gray27"}, + {"trigger": "gray28\tcolor", "contents": "gray28"}, + {"trigger": "gray29\tcolor", "contents": "gray29"}, + {"trigger": "gray3\tcolor", "contents": "gray3"}, + {"trigger": "gray30\tcolor", "contents": "gray30"}, + {"trigger": "gray31\tcolor", "contents": "gray31"}, + {"trigger": "gray32\tcolor", "contents": "gray32"}, + {"trigger": "gray33\tcolor", "contents": "gray33"}, + {"trigger": "gray34\tcolor", "contents": "gray34"}, + {"trigger": "gray35\tcolor", "contents": "gray35"}, + {"trigger": "gray36\tcolor", "contents": "gray36"}, + {"trigger": "gray37\tcolor", "contents": "gray37"}, + {"trigger": "gray38\tcolor", "contents": "gray38"}, + {"trigger": "gray39\tcolor", "contents": "gray39"}, + {"trigger": "gray4\tcolor", "contents": "gray4"}, + {"trigger": "gray40\tcolor", "contents": "gray40"}, + {"trigger": "gray41\tcolor", "contents": "gray41"}, + {"trigger": "gray42\tcolor", "contents": "gray42"}, + {"trigger": "gray43\tcolor", "contents": "gray43"}, + {"trigger": "gray44\tcolor", "contents": "gray44"}, + {"trigger": "gray45\tcolor", "contents": "gray45"}, + {"trigger": "gray46\tcolor", "contents": "gray46"}, + {"trigger": "gray47\tcolor", "contents": "gray47"}, + {"trigger": "gray48\tcolor", "contents": "gray48"}, + {"trigger": "gray49\tcolor", "contents": "gray49"}, + {"trigger": "gray5\tcolor", "contents": "gray5"}, + {"trigger": "gray50\tcolor", "contents": "gray50"}, + {"trigger": "gray51\tcolor", "contents": "gray51"}, + {"trigger": "gray52\tcolor", "contents": "gray52"}, + {"trigger": "gray53\tcolor", "contents": "gray53"}, + {"trigger": "gray54\tcolor", "contents": "gray54"}, + {"trigger": "gray55\tcolor", "contents": "gray55"}, + {"trigger": "gray56\tcolor", "contents": "gray56"}, + {"trigger": "gray57\tcolor", "contents": "gray57"}, + {"trigger": "gray58\tcolor", "contents": "gray58"}, + {"trigger": "gray59\tcolor", "contents": "gray59"}, + {"trigger": "gray6\tcolor", "contents": "gray6"}, + {"trigger": "gray60\tcolor", "contents": "gray60"}, + {"trigger": "gray61\tcolor", "contents": "gray61"}, + {"trigger": "gray62\tcolor", "contents": "gray62"}, + {"trigger": "gray63\tcolor", "contents": "gray63"}, + {"trigger": "gray64\tcolor", "contents": "gray64"}, + {"trigger": "gray65\tcolor", "contents": "gray65"}, + {"trigger": "gray66\tcolor", "contents": "gray66"}, + {"trigger": "gray67\tcolor", "contents": "gray67"}, + {"trigger": "gray68\tcolor", "contents": "gray68"}, + {"trigger": "gray69\tcolor", "contents": "gray69"}, + {"trigger": "gray7\tcolor", "contents": "gray7"}, + {"trigger": "gray70\tcolor", "contents": "gray70"}, + {"trigger": "gray71\tcolor", "contents": "gray71"}, + {"trigger": "gray72\tcolor", "contents": "gray72"}, + {"trigger": "gray73\tcolor", "contents": "gray73"}, + {"trigger": "gray74\tcolor", "contents": "gray74"}, + {"trigger": "gray75\tcolor", "contents": "gray75"}, + {"trigger": "gray76\tcolor", "contents": "gray76"}, + {"trigger": "gray77\tcolor", "contents": "gray77"}, + {"trigger": "gray78\tcolor", "contents": "gray78"}, + {"trigger": "gray79\tcolor", "contents": "gray79"}, + {"trigger": "gray8\tcolor", "contents": "gray8"}, + {"trigger": "gray80\tcolor", "contents": "gray80"}, + {"trigger": "gray81\tcolor", "contents": "gray81"}, + {"trigger": "gray82\tcolor", "contents": "gray82"}, + {"trigger": "gray83\tcolor", "contents": "gray83"}, + {"trigger": "gray84\tcolor", "contents": "gray84"}, + {"trigger": "gray85\tcolor", "contents": "gray85"}, + {"trigger": "gray86\tcolor", "contents": "gray86"}, + {"trigger": "gray87\tcolor", "contents": "gray87"}, + {"trigger": "gray88\tcolor", "contents": "gray88"}, + {"trigger": "gray89\tcolor", "contents": "gray89"}, + {"trigger": "gray9\tcolor", "contents": "gray9"}, + {"trigger": "gray90\tcolor", "contents": "gray90"}, + {"trigger": "gray91\tcolor", "contents": "gray91"}, + {"trigger": "gray92\tcolor", "contents": "gray92"}, + {"trigger": "gray93\tcolor", "contents": "gray93"}, + {"trigger": "gray94\tcolor", "contents": "gray94"}, + {"trigger": "gray95\tcolor", "contents": "gray95"}, + {"trigger": "gray96\tcolor", "contents": "gray96"}, + {"trigger": "gray97\tcolor", "contents": "gray97"}, + {"trigger": "gray98\tcolor", "contents": "gray98"}, + {"trigger": "gray99\tcolor", "contents": "gray99"}, + {"trigger": "green\tcolor", "contents": "green"}, + {"trigger": "green1\tcolor", "contents": "green1"}, + {"trigger": "green2\tcolor", "contents": "green2"}, + {"trigger": "green3\tcolor", "contents": "green3"}, + {"trigger": "green4\tcolor", "contents": "green4"}, + {"trigger": "greenyellow\tcolor", "contents": "greenyellow"}, + {"trigger": "grey\tcolor", "contents": "grey"}, + {"trigger": "grey0\tcolor", "contents": "grey0"}, + {"trigger": "grey1\tcolor", "contents": "grey1"}, + {"trigger": "grey10\tcolor", "contents": "grey10"}, + {"trigger": "grey100\tcolor", "contents": "grey100"}, + {"trigger": "grey11\tcolor", "contents": "grey11"}, + {"trigger": "grey12\tcolor", "contents": "grey12"}, + {"trigger": "grey13\tcolor", "contents": "grey13"}, + {"trigger": "grey14\tcolor", "contents": "grey14"}, + {"trigger": "grey15\tcolor", "contents": "grey15"}, + {"trigger": "grey16\tcolor", "contents": "grey16"}, + {"trigger": "grey17\tcolor", "contents": "grey17"}, + {"trigger": "grey18\tcolor", "contents": "grey18"}, + {"trigger": "grey19\tcolor", "contents": "grey19"}, + {"trigger": "grey2\tcolor", "contents": "grey2"}, + {"trigger": "grey20\tcolor", "contents": "grey20"}, + {"trigger": "grey21\tcolor", "contents": "grey21"}, + {"trigger": "grey22\tcolor", "contents": "grey22"}, + {"trigger": "grey23\tcolor", "contents": "grey23"}, + {"trigger": "grey24\tcolor", "contents": "grey24"}, + {"trigger": "grey25\tcolor", "contents": "grey25"}, + {"trigger": "grey26\tcolor", "contents": "grey26"}, + {"trigger": "grey27\tcolor", "contents": "grey27"}, + {"trigger": "grey28\tcolor", "contents": "grey28"}, + {"trigger": "grey29\tcolor", "contents": "grey29"}, + {"trigger": "grey3\tcolor", "contents": "grey3"}, + {"trigger": "grey30\tcolor", "contents": "grey30"}, + {"trigger": "grey31\tcolor", "contents": "grey31"}, + {"trigger": "grey32\tcolor", "contents": "grey32"}, + {"trigger": "grey33\tcolor", "contents": "grey33"}, + {"trigger": "grey34\tcolor", "contents": "grey34"}, + {"trigger": "grey35\tcolor", "contents": "grey35"}, + {"trigger": "grey36\tcolor", "contents": "grey36"}, + {"trigger": "grey37\tcolor", "contents": "grey37"}, + {"trigger": "grey38\tcolor", "contents": "grey38"}, + {"trigger": "grey39\tcolor", "contents": "grey39"}, + {"trigger": "grey4\tcolor", "contents": "grey4"}, + {"trigger": "grey40\tcolor", "contents": "grey40"}, + {"trigger": "grey41\tcolor", "contents": "grey41"}, + {"trigger": "grey42\tcolor", "contents": "grey42"}, + {"trigger": "grey43\tcolor", "contents": "grey43"}, + {"trigger": "grey44\tcolor", "contents": "grey44"}, + {"trigger": "grey45\tcolor", "contents": "grey45"}, + {"trigger": "grey46\tcolor", "contents": "grey46"}, + {"trigger": "grey47\tcolor", "contents": "grey47"}, + {"trigger": "grey48\tcolor", "contents": "grey48"}, + {"trigger": "grey49\tcolor", "contents": "grey49"}, + {"trigger": "grey5\tcolor", "contents": "grey5"}, + {"trigger": "grey50\tcolor", "contents": "grey50"}, + {"trigger": "grey51\tcolor", "contents": "grey51"}, + {"trigger": "grey52\tcolor", "contents": "grey52"}, + {"trigger": "grey53\tcolor", "contents": "grey53"}, + {"trigger": "grey54\tcolor", "contents": "grey54"}, + {"trigger": "grey55\tcolor", "contents": "grey55"}, + {"trigger": "grey56\tcolor", "contents": "grey56"}, + {"trigger": "grey57\tcolor", "contents": "grey57"}, + {"trigger": "grey58\tcolor", "contents": "grey58"}, + {"trigger": "grey59\tcolor", "contents": "grey59"}, + {"trigger": "grey6\tcolor", "contents": "grey6"}, + {"trigger": "grey60\tcolor", "contents": "grey60"}, + {"trigger": "grey61\tcolor", "contents": "grey61"}, + {"trigger": "grey62\tcolor", "contents": "grey62"}, + {"trigger": "grey63\tcolor", "contents": "grey63"}, + {"trigger": "grey64\tcolor", "contents": "grey64"}, + {"trigger": "grey65\tcolor", "contents": "grey65"}, + {"trigger": "grey66\tcolor", "contents": "grey66"}, + {"trigger": "grey67\tcolor", "contents": "grey67"}, + {"trigger": "grey68\tcolor", "contents": "grey68"}, + {"trigger": "grey69\tcolor", "contents": "grey69"}, + {"trigger": "grey7\tcolor", "contents": "grey7"}, + {"trigger": "grey70\tcolor", "contents": "grey70"}, + {"trigger": "grey71\tcolor", "contents": "grey71"}, + {"trigger": "grey72\tcolor", "contents": "grey72"}, + {"trigger": "grey73\tcolor", "contents": "grey73"}, + {"trigger": "grey74\tcolor", "contents": "grey74"}, + {"trigger": "grey75\tcolor", "contents": "grey75"}, + {"trigger": "grey76\tcolor", "contents": "grey76"}, + {"trigger": "grey77\tcolor", "contents": "grey77"}, + {"trigger": "grey78\tcolor", "contents": "grey78"}, + {"trigger": "grey79\tcolor", "contents": "grey79"}, + {"trigger": "grey8\tcolor", "contents": "grey8"}, + {"trigger": "grey80\tcolor", "contents": "grey80"}, + {"trigger": "grey81\tcolor", "contents": "grey81"}, + {"trigger": "grey82\tcolor", "contents": "grey82"}, + {"trigger": "grey83\tcolor", "contents": "grey83"}, + {"trigger": "grey84\tcolor", "contents": "grey84"}, + {"trigger": "grey85\tcolor", "contents": "grey85"}, + {"trigger": "grey86\tcolor", "contents": "grey86"}, + {"trigger": "grey87\tcolor", "contents": "grey87"}, + {"trigger": "grey88\tcolor", "contents": "grey88"}, + {"trigger": "grey89\tcolor", "contents": "grey89"}, + {"trigger": "grey9\tcolor", "contents": "grey9"}, + {"trigger": "grey90\tcolor", "contents": "grey90"}, + {"trigger": "grey91\tcolor", "contents": "grey91"}, + {"trigger": "grey92\tcolor", "contents": "grey92"}, + {"trigger": "grey93\tcolor", "contents": "grey93"}, + {"trigger": "grey94\tcolor", "contents": "grey94"}, + {"trigger": "grey95\tcolor", "contents": "grey95"}, + {"trigger": "grey96\tcolor", "contents": "grey96"}, + {"trigger": "grey97\tcolor", "contents": "grey97"}, + {"trigger": "grey98\tcolor", "contents": "grey98"}, + {"trigger": "grey99\tcolor", "contents": "grey99"}, + {"trigger": "honeydew\tcolor", "contents": "honeydew"}, + {"trigger": "honeydew1\tcolor", "contents": "honeydew1"}, + {"trigger": "honeydew2\tcolor", "contents": "honeydew2"}, + {"trigger": "honeydew3\tcolor", "contents": "honeydew3"}, + {"trigger": "honeydew4\tcolor", "contents": "honeydew4"}, + {"trigger": "hotpink\tcolor", "contents": "hotpink"}, + {"trigger": "hotpink1\tcolor", "contents": "hotpink1"}, + {"trigger": "hotpink2\tcolor", "contents": "hotpink2"}, + {"trigger": "hotpink3\tcolor", "contents": "hotpink3"}, + {"trigger": "hotpink4\tcolor", "contents": "hotpink4"}, + {"trigger": "indianred\tcolor", "contents": "indianred"}, + {"trigger": "indianred1\tcolor", "contents": "indianred1"}, + {"trigger": "indianred2\tcolor", "contents": "indianred2"}, + {"trigger": "indianred3\tcolor", "contents": "indianred3"}, + {"trigger": "indianred4\tcolor", "contents": "indianred4"}, + {"trigger": "indigo\tcolor", "contents": "indigo"}, + {"trigger": "invis\tcolor", "contents": "invis"}, + {"trigger": "ivory\tcolor", "contents": "ivory"}, + {"trigger": "ivory1\tcolor", "contents": "ivory1"}, + {"trigger": "ivory2\tcolor", "contents": "ivory2"}, + {"trigger": "ivory3\tcolor", "contents": "ivory3"}, + {"trigger": "ivory4\tcolor", "contents": "ivory4"}, + {"trigger": "khaki\tcolor", "contents": "khaki"}, + {"trigger": "khaki1\tcolor", "contents": "khaki1"}, + {"trigger": "khaki2\tcolor", "contents": "khaki2"}, + {"trigger": "khaki3\tcolor", "contents": "khaki3"}, + {"trigger": "khaki4\tcolor", "contents": "khaki4"}, + {"trigger": "lavender\tcolor", "contents": "lavender"}, + {"trigger": "lavenderblush\tcolor", "contents": "lavenderblush"}, + {"trigger": "lavenderblush1\tcolor", "contents": "lavenderblush1"}, + {"trigger": "lavenderblush2\tcolor", "contents": "lavenderblush2"}, + {"trigger": "lavenderblush3\tcolor", "contents": "lavenderblush3"}, + {"trigger": "lavenderblush4\tcolor", "contents": "lavenderblush4"}, + {"trigger": "lawngreen\tcolor", "contents": "lawngreen"}, + {"trigger": "lemonchiffon\tcolor", "contents": "lemonchiffon"}, + {"trigger": "lemonchiffon1\tcolor", "contents": "lemonchiffon1"}, + {"trigger": "lemonchiffon2\tcolor", "contents": "lemonchiffon2"}, + {"trigger": "lemonchiffon3\tcolor", "contents": "lemonchiffon3"}, + {"trigger": "lemonchiffon4\tcolor", "contents": "lemonchiffon4"}, + {"trigger": "lightblue\tcolor", "contents": "lightblue"}, + {"trigger": "lightblue1\tcolor", "contents": "lightblue1"}, + {"trigger": "lightblue2\tcolor", "contents": "lightblue2"}, + {"trigger": "lightblue3\tcolor", "contents": "lightblue3"}, + {"trigger": "lightblue4\tcolor", "contents": "lightblue4"}, + {"trigger": "lightcoral\tcolor", "contents": "lightcoral"}, + {"trigger": "lightcyan\tcolor", "contents": "lightcyan"}, + {"trigger": "lightcyan1\tcolor", "contents": "lightcyan1"}, + {"trigger": "lightcyan2\tcolor", "contents": "lightcyan2"}, + {"trigger": "lightcyan3\tcolor", "contents": "lightcyan3"}, + {"trigger": "lightcyan4\tcolor", "contents": "lightcyan4"}, + {"trigger": "lightgoldenrod\tcolor", "contents": "lightgoldenrod"}, + {"trigger": "lightgoldenrod1\tcolor", "contents": "lightgoldenrod1"}, + {"trigger": "lightgoldenrod2\tcolor", "contents": "lightgoldenrod2"}, + {"trigger": "lightgoldenrod3\tcolor", "contents": "lightgoldenrod3"}, + {"trigger": "lightgoldenrod4\tcolor", "contents": "lightgoldenrod4"}, + {"trigger": "lightgoldenrodyellow\tcolor", "contents": "lightgoldenrodyellow"}, + {"trigger": "lightgray\tcolor", "contents": "lightgray"}, + {"trigger": "lightgrey\tcolor", "contents": "lightgrey"}, + {"trigger": "lightpink\tcolor", "contents": "lightpink"}, + {"trigger": "lightpink1\tcolor", "contents": "lightpink1"}, + {"trigger": "lightpink2\tcolor", "contents": "lightpink2"}, + {"trigger": "lightpink3\tcolor", "contents": "lightpink3"}, + {"trigger": "lightpink4\tcolor", "contents": "lightpink4"}, + {"trigger": "lightsalmon\tcolor", "contents": "lightsalmon"}, + {"trigger": "lightsalmon1\tcolor", "contents": "lightsalmon1"}, + {"trigger": "lightsalmon2\tcolor", "contents": "lightsalmon2"}, + {"trigger": "lightsalmon3\tcolor", "contents": "lightsalmon3"}, + {"trigger": "lightsalmon4\tcolor", "contents": "lightsalmon4"}, + {"trigger": "lightseagreen\tcolor", "contents": "lightseagreen"}, + {"trigger": "lightskyblue\tcolor", "contents": "lightskyblue"}, + {"trigger": "lightskyblue1\tcolor", "contents": "lightskyblue1"}, + {"trigger": "lightskyblue2\tcolor", "contents": "lightskyblue2"}, + {"trigger": "lightskyblue3\tcolor", "contents": "lightskyblue3"}, + {"trigger": "lightskyblue4\tcolor", "contents": "lightskyblue4"}, + {"trigger": "lightslateblue\tcolor", "contents": "lightslateblue"}, + {"trigger": "lightslategray\tcolor", "contents": "lightslategray"}, + {"trigger": "lightslategrey\tcolor", "contents": "lightslategrey"}, + {"trigger": "lightsteelblue\tcolor", "contents": "lightsteelblue"}, + {"trigger": "lightsteelblue1\tcolor", "contents": "lightsteelblue1"}, + {"trigger": "lightsteelblue2\tcolor", "contents": "lightsteelblue2"}, + {"trigger": "lightsteelblue3\tcolor", "contents": "lightsteelblue3"}, + {"trigger": "lightsteelblue4\tcolor", "contents": "lightsteelblue4"}, + {"trigger": "lightyellow\tcolor", "contents": "lightyellow"}, + {"trigger": "lightyellow1\tcolor", "contents": "lightyellow1"}, + {"trigger": "lightyellow2\tcolor", "contents": "lightyellow2"}, + {"trigger": "lightyellow3\tcolor", "contents": "lightyellow3"}, + {"trigger": "lightyellow4\tcolor", "contents": "lightyellow4"}, + {"trigger": "limegreen\tcolor", "contents": "limegreen"}, + {"trigger": "linen\tcolor", "contents": "linen"}, + {"trigger": "magenta\tcolor", "contents": "magenta"}, + {"trigger": "magenta1\tcolor", "contents": "magenta1"}, + {"trigger": "magenta2\tcolor", "contents": "magenta2"}, + {"trigger": "magenta3\tcolor", "contents": "magenta3"}, + {"trigger": "magenta4\tcolor", "contents": "magenta4"}, + {"trigger": "maroon\tcolor", "contents": "maroon"}, + {"trigger": "maroon1\tcolor", "contents": "maroon1"}, + {"trigger": "maroon2\tcolor", "contents": "maroon2"}, + {"trigger": "maroon3\tcolor", "contents": "maroon3"}, + {"trigger": "maroon4\tcolor", "contents": "maroon4"}, + {"trigger": "mediumaquamarine\tcolor", "contents": "mediumaquamarine"}, + {"trigger": "mediumblue\tcolor", "contents": "mediumblue"}, + {"trigger": "mediumorchid\tcolor", "contents": "mediumorchid"}, + {"trigger": "mediumorchid1\tcolor", "contents": "mediumorchid1"}, + {"trigger": "mediumorchid2\tcolor", "contents": "mediumorchid2"}, + {"trigger": "mediumorchid3\tcolor", "contents": "mediumorchid3"}, + {"trigger": "mediumorchid4\tcolor", "contents": "mediumorchid4"}, + {"trigger": "mediumpurple\tcolor", "contents": "mediumpurple"}, + {"trigger": "mediumpurple1\tcolor", "contents": "mediumpurple1"}, + {"trigger": "mediumpurple2\tcolor", "contents": "mediumpurple2"}, + {"trigger": "mediumpurple3\tcolor", "contents": "mediumpurple3"}, + {"trigger": "mediumpurple4\tcolor", "contents": "mediumpurple4"}, + {"trigger": "mediumseagreen\tcolor", "contents": "mediumseagreen"}, + {"trigger": "mediumslateblue\tcolor", "contents": "mediumslateblue"}, + {"trigger": "mediumspringgreen\tcolor", "contents": "mediumspringgreen"}, + {"trigger": "mediumturquoise\tcolor", "contents": "mediumturquoise"}, + {"trigger": "mediumvioletred\tcolor", "contents": "mediumvioletred"}, + {"trigger": "midnightblue\tcolor", "contents": "midnightblue"}, + {"trigger": "mintcream\tcolor", "contents": "mintcream"}, + {"trigger": "mistyrose\tcolor", "contents": "mistyrose"}, + {"trigger": "mistyrose1\tcolor", "contents": "mistyrose1"}, + {"trigger": "mistyrose2\tcolor", "contents": "mistyrose2"}, + {"trigger": "mistyrose3\tcolor", "contents": "mistyrose3"}, + {"trigger": "mistyrose4\tcolor", "contents": "mistyrose4"}, + {"trigger": "moccasin\tcolor", "contents": "moccasin"}, + {"trigger": "navajowhite\tcolor", "contents": "navajowhite"}, + {"trigger": "navajowhite1\tcolor", "contents": "navajowhite1"}, + {"trigger": "navajowhite2\tcolor", "contents": "navajowhite2"}, + {"trigger": "navajowhite3\tcolor", "contents": "navajowhite3"}, + {"trigger": "navajowhite4\tcolor", "contents": "navajowhite4"}, + {"trigger": "navy\tcolor", "contents": "navy"}, + {"trigger": "navyblue\tcolor", "contents": "navyblue"}, + {"trigger": "none\tcolor", "contents": "none"}, + {"trigger": "oldlace\tcolor", "contents": "oldlace"}, + {"trigger": "olivedrab\tcolor", "contents": "olivedrab"}, + {"trigger": "olivedrab1\tcolor", "contents": "olivedrab1"}, + {"trigger": "olivedrab2\tcolor", "contents": "olivedrab2"}, + {"trigger": "olivedrab3\tcolor", "contents": "olivedrab3"}, + {"trigger": "olivedrab4\tcolor", "contents": "olivedrab4"}, + {"trigger": "orange\tcolor", "contents": "orange"}, + {"trigger": "orange1\tcolor", "contents": "orange1"}, + {"trigger": "orange2\tcolor", "contents": "orange2"}, + {"trigger": "orange3\tcolor", "contents": "orange3"}, + {"trigger": "orange4\tcolor", "contents": "orange4"}, + {"trigger": "orangered\tcolor", "contents": "orangered"}, + {"trigger": "orangered1\tcolor", "contents": "orangered1"}, + {"trigger": "orangered2\tcolor", "contents": "orangered2"}, + {"trigger": "orangered3\tcolor", "contents": "orangered3"}, + {"trigger": "orangered4\tcolor", "contents": "orangered4"}, + {"trigger": "orchid\tcolor", "contents": "orchid"}, + {"trigger": "orchid1\tcolor", "contents": "orchid1"}, + {"trigger": "orchid2\tcolor", "contents": "orchid2"}, + {"trigger": "orchid3\tcolor", "contents": "orchid3"}, + {"trigger": "orchid4\tcolor", "contents": "orchid4"}, + {"trigger": "palegoldenrod\tcolor", "contents": "palegoldenrod"}, + {"trigger": "palegreen\tcolor", "contents": "palegreen"}, + {"trigger": "palegreen1\tcolor", "contents": "palegreen1"}, + {"trigger": "palegreen2\tcolor", "contents": "palegreen2"}, + {"trigger": "palegreen3\tcolor", "contents": "palegreen3"}, + {"trigger": "palegreen4\tcolor", "contents": "palegreen4"}, + {"trigger": "paleturquoise\tcolor", "contents": "paleturquoise"}, + {"trigger": "paleturquoise1\tcolor", "contents": "paleturquoise1"}, + {"trigger": "paleturquoise2\tcolor", "contents": "paleturquoise2"}, + {"trigger": "paleturquoise3\tcolor", "contents": "paleturquoise3"}, + {"trigger": "paleturquoise4\tcolor", "contents": "paleturquoise4"}, + {"trigger": "palevioletred\tcolor", "contents": "palevioletred"}, + {"trigger": "palevioletred1\tcolor", "contents": "palevioletred1"}, + {"trigger": "palevioletred2\tcolor", "contents": "palevioletred2"}, + {"trigger": "palevioletred3\tcolor", "contents": "palevioletred3"}, + {"trigger": "palevioletred4\tcolor", "contents": "palevioletred4"}, + {"trigger": "papayawhip\tcolor", "contents": "papayawhip"}, + {"trigger": "peachpuff\tcolor", "contents": "peachpuff"}, + {"trigger": "peachpuff1\tcolor", "contents": "peachpuff1"}, + {"trigger": "peachpuff2\tcolor", "contents": "peachpuff2"}, + {"trigger": "peachpuff3\tcolor", "contents": "peachpuff3"}, + {"trigger": "peachpuff4\tcolor", "contents": "peachpuff4"}, + {"trigger": "peru\tcolor", "contents": "peru"}, + {"trigger": "pink\tcolor", "contents": "pink"}, + {"trigger": "pink1\tcolor", "contents": "pink1"}, + {"trigger": "pink2\tcolor", "contents": "pink2"}, + {"trigger": "pink3\tcolor", "contents": "pink3"}, + {"trigger": "pink4\tcolor", "contents": "pink4"}, + {"trigger": "plum\tcolor", "contents": "plum"}, + {"trigger": "plum1\tcolor", "contents": "plum1"}, + {"trigger": "plum2\tcolor", "contents": "plum2"}, + {"trigger": "plum3\tcolor", "contents": "plum3"}, + {"trigger": "plum4\tcolor", "contents": "plum4"}, + {"trigger": "powderblue\tcolor", "contents": "powderblue"}, + {"trigger": "purple\tcolor", "contents": "purple"}, + {"trigger": "purple1\tcolor", "contents": "purple1"}, + {"trigger": "purple2\tcolor", "contents": "purple2"}, + {"trigger": "purple3\tcolor", "contents": "purple3"}, + {"trigger": "purple4\tcolor", "contents": "purple4"}, + {"trigger": "red\tcolor", "contents": "red"}, + {"trigger": "red1\tcolor", "contents": "red1"}, + {"trigger": "red2\tcolor", "contents": "red2"}, + {"trigger": "red3\tcolor", "contents": "red3"}, + {"trigger": "red4\tcolor", "contents": "red4"}, + {"trigger": "rosybrown\tcolor", "contents": "rosybrown"}, + {"trigger": "rosybrown1\tcolor", "contents": "rosybrown1"}, + {"trigger": "rosybrown2\tcolor", "contents": "rosybrown2"}, + {"trigger": "rosybrown3\tcolor", "contents": "rosybrown3"}, + {"trigger": "rosybrown4\tcolor", "contents": "rosybrown4"}, + {"trigger": "royalblue\tcolor", "contents": "royalblue"}, + {"trigger": "royalblue1\tcolor", "contents": "royalblue1"}, + {"trigger": "royalblue2\tcolor", "contents": "royalblue2"}, + {"trigger": "royalblue3\tcolor", "contents": "royalblue3"}, + {"trigger": "royalblue4\tcolor", "contents": "royalblue4"}, + {"trigger": "saddlebrown\tcolor", "contents": "saddlebrown"}, + {"trigger": "salmon\tcolor", "contents": "salmon"}, + {"trigger": "salmon1\tcolor", "contents": "salmon1"}, + {"trigger": "salmon2\tcolor", "contents": "salmon2"}, + {"trigger": "salmon3\tcolor", "contents": "salmon3"}, + {"trigger": "salmon4\tcolor", "contents": "salmon4"}, + {"trigger": "sandybrown\tcolor", "contents": "sandybrown"}, + {"trigger": "seagreen\tcolor", "contents": "seagreen"}, + {"trigger": "seagreen1\tcolor", "contents": "seagreen1"}, + {"trigger": "seagreen2\tcolor", "contents": "seagreen2"}, + {"trigger": "seagreen3\tcolor", "contents": "seagreen3"}, + {"trigger": "seagreen4\tcolor", "contents": "seagreen4"}, + {"trigger": "seashell\tcolor", "contents": "seashell"}, + {"trigger": "seashell1\tcolor", "contents": "seashell1"}, + {"trigger": "seashell2\tcolor", "contents": "seashell2"}, + {"trigger": "seashell3\tcolor", "contents": "seashell3"}, + {"trigger": "seashell4\tcolor", "contents": "seashell4"}, + {"trigger": "sienna\tcolor", "contents": "sienna"}, + {"trigger": "sienna1\tcolor", "contents": "sienna1"}, + {"trigger": "sienna2\tcolor", "contents": "sienna2"}, + {"trigger": "sienna3\tcolor", "contents": "sienna3"}, + {"trigger": "sienna4\tcolor", "contents": "sienna4"}, + {"trigger": "skyblue\tcolor", "contents": "skyblue"}, + {"trigger": "skyblue1\tcolor", "contents": "skyblue1"}, + {"trigger": "skyblue2\tcolor", "contents": "skyblue2"}, + {"trigger": "skyblue3\tcolor", "contents": "skyblue3"}, + {"trigger": "skyblue4\tcolor", "contents": "skyblue4"}, + {"trigger": "slateblue\tcolor", "contents": "slateblue"}, + {"trigger": "slateblue1\tcolor", "contents": "slateblue1"}, + {"trigger": "slateblue2\tcolor", "contents": "slateblue2"}, + {"trigger": "slateblue3\tcolor", "contents": "slateblue3"}, + {"trigger": "slateblue4\tcolor", "contents": "slateblue4"}, + {"trigger": "slategray\tcolor", "contents": "slategray"}, + {"trigger": "slategray1\tcolor", "contents": "slategray1"}, + {"trigger": "slategray2\tcolor", "contents": "slategray2"}, + {"trigger": "slategray3\tcolor", "contents": "slategray3"}, + {"trigger": "slategray4\tcolor", "contents": "slategray4"}, + {"trigger": "slategrey\tcolor", "contents": "slategrey"}, + {"trigger": "snow\tcolor", "contents": "snow"}, + {"trigger": "snow1\tcolor", "contents": "snow1"}, + {"trigger": "snow2\tcolor", "contents": "snow2"}, + {"trigger": "snow3\tcolor", "contents": "snow3"}, + {"trigger": "snow4\tcolor", "contents": "snow4"}, + {"trigger": "springgreen\tcolor", "contents": "springgreen"}, + {"trigger": "springgreen1\tcolor", "contents": "springgreen1"}, + {"trigger": "springgreen2\tcolor", "contents": "springgreen2"}, + {"trigger": "springgreen3\tcolor", "contents": "springgreen3"}, + {"trigger": "springgreen4\tcolor", "contents": "springgreen4"}, + {"trigger": "steelblue\tcolor", "contents": "steelblue"}, + {"trigger": "steelblue1\tcolor", "contents": "steelblue1"}, + {"trigger": "steelblue2\tcolor", "contents": "steelblue2"}, + {"trigger": "steelblue3\tcolor", "contents": "steelblue3"}, + {"trigger": "steelblue4\tcolor", "contents": "steelblue4"}, + {"trigger": "tan\tcolor", "contents": "tan"}, + {"trigger": "tan1\tcolor", "contents": "tan1"}, + {"trigger": "tan2\tcolor", "contents": "tan2"}, + {"trigger": "tan3\tcolor", "contents": "tan3"}, + {"trigger": "tan4\tcolor", "contents": "tan4"}, + {"trigger": "thistle\tcolor", "contents": "thistle"}, + {"trigger": "thistle1\tcolor", "contents": "thistle1"}, + {"trigger": "thistle2\tcolor", "contents": "thistle2"}, + {"trigger": "thistle3\tcolor", "contents": "thistle3"}, + {"trigger": "thistle4\tcolor", "contents": "thistle4"}, + {"trigger": "tomato\tcolor", "contents": "tomato"}, + {"trigger": "tomato1\tcolor", "contents": "tomato1"}, + {"trigger": "tomato2\tcolor", "contents": "tomato2"}, + {"trigger": "tomato3\tcolor", "contents": "tomato3"}, + {"trigger": "tomato4\tcolor", "contents": "tomato4"}, + {"trigger": "transparent\tcolor", "contents": "transparent"}, + {"trigger": "turquoise\tcolor", "contents": "turquoise"}, + {"trigger": "turquoise1\tcolor", "contents": "turquoise1"}, + {"trigger": "turquoise2\tcolor", "contents": "turquoise2"}, + {"trigger": "turquoise3\tcolor", "contents": "turquoise3"}, + {"trigger": "turquoise4\tcolor", "contents": "turquoise4"}, + {"trigger": "violet\tcolor", "contents": "violet"}, + {"trigger": "violetred\tcolor", "contents": "violetred"}, + {"trigger": "violetred1\tcolor", "contents": "violetred1"}, + {"trigger": "violetred2\tcolor", "contents": "violetred2"}, + {"trigger": "violetred3\tcolor", "contents": "violetred3"}, + {"trigger": "violetred4\tcolor", "contents": "violetred4"}, + {"trigger": "wheat\tcolor", "contents": "wheat"}, + {"trigger": "wheat1\tcolor", "contents": "wheat1"}, + {"trigger": "wheat2\tcolor", "contents": "wheat2"}, + {"trigger": "wheat3\tcolor", "contents": "wheat3"}, + {"trigger": "wheat4\tcolor", "contents": "wheat4"}, + {"trigger": "white\tcolor", "contents": "white"}, + {"trigger": "whitesmoke\tcolor", "contents": "whitesmoke"}, + {"trigger": "yellow\tcolor", "contents": "yellow"}, + {"trigger": "yellow1\tcolor", "contents": "yellow1"}, + {"trigger": "yellow2\tcolor", "contents": "yellow2"}, + {"trigger": "yellow3\tcolor", "contents": "yellow3"}, + {"trigger": "yellow4\tcolor", "contents": "yellow4"}, + {"trigger": "yellowgreen\tcolor", "contents": "yellowgreen"}, + ] +} diff --git a/Graphviz/Completions/Attributes.sublime-completions b/Graphviz/Completions/Attributes.sublime-completions new file mode 100644 index 0000000000..f42f28560f --- /dev/null +++ b/Graphviz/Completions/Attributes.sublime-completions @@ -0,0 +1,177 @@ +{ + "scope": "source.dot meta.attributes - string", + "completions": [ + {"trigger": "Damping\tattribute", "contents": "Damping=${1}"}, + {"trigger": "K\tattribute", "contents": "K=${1}"}, + {"trigger": "URL\tattribute", "contents": "URL=${1}"}, + {"trigger": "_background\tattribute", "contents": "_background=\"${1}\""}, + {"trigger": "area\tattribute", "contents": "area=${1}"}, + {"trigger": "arrowhead\tattribute", "contents": "arrowhead=${1}"}, + {"trigger": "arrowsize\tattribute", "contents": "arrowsize=${1}"}, + {"trigger": "arrowtail\tattribute", "contents": "arrowtail=${1}"}, + {"trigger": "bb\tattribute", "contents": "bb=${1}"}, + {"trigger": "bgcolor\tattribute", "contents": "bgcolor=${1}"}, + {"trigger": "center\tattribute", "contents": "center=${1}"}, + {"trigger": "charset\tattribute", "contents": "charset=\"${1}\""}, + {"trigger": "clusterrank\tattribute", "contents": "clusterrank=${1}"}, + {"trigger": "color\tattribute", "contents": "color=${1}"}, + {"trigger": "colorscheme\tattribute", "contents": "colorscheme=\"${1}\""}, + {"trigger": "comment\tattribute", "contents": "comment=\"${1}\""}, + {"trigger": "compound\tattribute", "contents": "compound=${1}"}, + {"trigger": "concentrate\tattribute", "contents": "concentrate=${1}"}, + {"trigger": "constraint\tattribute", "contents": "constraint=${1}"}, + {"trigger": "decorate\tattribute", "contents": "decorate=${1}"}, + {"trigger": "defaultdist\tattribute", "contents": "defaultdist=${1}"}, + {"trigger": "dim\tattribute", "contents": "dim=${1}"}, + {"trigger": "dimen\tattribute", "contents": "dimen=${1}"}, + {"trigger": "dir\tattribute", "contents": "dir=${1}"}, + {"trigger": "diredgeconstraints\tattribute", "contents": "diredgeconstraints=${1}"}, + {"trigger": "distortion\tattribute", "contents": "distortion=${1}"}, + {"trigger": "dpi\tattribute", "contents": "dpi=${1}"}, + {"trigger": "edgeURL\tattribute", "contents": "edgeURL=${1}"}, + {"trigger": "edgehref\tattribute", "contents": "edgehref=${1}"}, + {"trigger": "edgetarget\tattribute", "contents": "edgetarget=${1}"}, + {"trigger": "edgetooltip\tattribute", "contents": "edgetooltip=${1}"}, + {"trigger": "epsilon\tattribute", "contents": "epsilon=${1}"}, + {"trigger": "esep\tattribute", "contents": "esep=${1}"}, + {"trigger": "fillcolor\tattribute", "contents": "fillcolor=${1}"}, + {"trigger": "fixedsize\tattribute", "contents": "fixedsize=${1}"}, + {"trigger": "fontcolor\tattribute", "contents": "fontcolor=${1}"}, + {"trigger": "fontname\tattribute", "contents": "fontname=\"${1}\""}, + {"trigger": "fontnames\tattribute", "contents": "fontnames=\"${1}\""}, + {"trigger": "fontpath\tattribute", "contents": "fontpath=\"${1}\""}, + {"trigger": "fontsize\tattribute", "contents": "fontsize=${1}"}, + {"trigger": "forcelabels\tattribute", "contents": "forcelabels=${1}"}, + {"trigger": "gradientangle\tattribute", "contents": "gradientangle=${1}"}, + {"trigger": "group\tattribute", "contents": "group=\"${1}\""}, + {"trigger": "headURL\tattribute", "contents": "headURL=${1}"}, + {"trigger": "head_lp\tattribute", "contents": "head_lp=${1}"}, + {"trigger": "headclip\tattribute", "contents": "headclip=${1}"}, + {"trigger": "headhref\tattribute", "contents": "headhref=${1}"}, + {"trigger": "headlabel\tattribute", "contents": "headlabel=${1}"}, + {"trigger": "headport\tattribute", "contents": "headport=${1}"}, + {"trigger": "headtarget\tattribute", "contents": "headtarget=${1}"}, + {"trigger": "headtooltip\tattribute", "contents": "headtooltip=${1}"}, + {"trigger": "height\tattribute", "contents": "height=${1}"}, + {"trigger": "href\tattribute", "contents": "href=${1}"}, + {"trigger": "id\tattribute", "contents": "id=${1}"}, + {"trigger": "image\tattribute", "contents": "image=\"${1}\""}, + {"trigger": "imagepath\tattribute", "contents": "imagepath=\"${1}\""}, + {"trigger": "imagepos\tattribute", "contents": "imagepos=\"${1}\""}, + {"trigger": "imagescale\tattribute", "contents": "imagescale=${1}"}, + {"trigger": "inputscale\tattribute", "contents": "inputscale=${1}"}, + {"trigger": "label\tattribute", "contents": "label=${1}"}, + {"trigger": "labelURL\tattribute", "contents": "labelURL=${1}"}, + {"trigger": "label_scheme\tattribute", "contents": "label_scheme=${1}"}, + {"trigger": "labelangle\tattribute", "contents": "labelangle=${1}"}, + {"trigger": "labeldistance\tattribute", "contents": "labeldistance=${1}"}, + {"trigger": "labelfloat\tattribute", "contents": "labelfloat=${1}"}, + {"trigger": "labelfontcolor\tattribute", "contents": "labelfontcolor=${1}"}, + {"trigger": "labelfontname\tattribute", "contents": "labelfontname=\"${1}\""}, + {"trigger": "labelfontsize\tattribute", "contents": "labelfontsize=${1}"}, + {"trigger": "labelhref\tattribute", "contents": "labelhref=${1}"}, + {"trigger": "labeljust\tattribute", "contents": "labeljust=\"${1}\""}, + {"trigger": "labelloc\tattribute", "contents": "labelloc=\"${1}\""}, + {"trigger": "labeltarget\tattribute", "contents": "labeltarget=${1}"}, + {"trigger": "labeltooltip\tattribute", "contents": "labeltooltip=${1}"}, + {"trigger": "landscape\tattribute", "contents": "landscape=${1}"}, + {"trigger": "layer\tattribute", "contents": "layer=${1}"}, + {"trigger": "layerlistsep\tattribute", "contents": "layerlistsep=\"${1}\""}, + {"trigger": "layers\tattribute", "contents": "layers=${1}"}, + {"trigger": "layerselect\tattribute", "contents": "layerselect=${1}"}, + {"trigger": "layersep\tattribute", "contents": "layersep=\"${1}\""}, + {"trigger": "layout\tattribute", "contents": "layout=\"${1}\""}, + {"trigger": "len\tattribute", "contents": "len=${1}"}, + {"trigger": "levels\tattribute", "contents": "levels=${1}"}, + {"trigger": "levelsgap\tattribute", "contents": "levelsgap=${1}"}, + {"trigger": "lhead\tattribute", "contents": "lhead=\"${1}\""}, + {"trigger": "lheight\tattribute", "contents": "lheight=${1}"}, + {"trigger": "lp\tattribute", "contents": "lp=${1}"}, + {"trigger": "ltail\tattribute", "contents": "ltail=\"${1}\""}, + {"trigger": "lwidth\tattribute", "contents": "lwidth=${1}"}, + {"trigger": "margin\tattribute", "contents": "margin=${1}"}, + {"trigger": "maxiter\tattribute", "contents": "maxiter=${1}"}, + {"trigger": "mclimit\tattribute", "contents": "mclimit=${1}"}, + {"trigger": "mindist\tattribute", "contents": "mindist=${1}"}, + {"trigger": "minlen\tattribute", "contents": "minlen=${1}"}, + {"trigger": "mode\tattribute", "contents": "mode=\"${1}\""}, + {"trigger": "model\tattribute", "contents": "model=\"${1}\""}, + {"trigger": "mosek\tattribute", "contents": "mosek=${1}"}, + {"trigger": "newrank\tattribute", "contents": "newrank=${1}"}, + {"trigger": "nodesep\tattribute", "contents": "nodesep=${1}"}, + {"trigger": "nojustify\tattribute", "contents": "nojustify=${1}"}, + {"trigger": "normalize\tattribute", "contents": "normalize=${1}"}, + {"trigger": "notranslate\tattribute", "contents": "notranslate=${1}"}, + {"trigger": "nslimit\tattribute", "contents": "nslimit=${1}"}, + {"trigger": "nslimit1\tattribute", "contents": "nslimit1=${1}"}, + {"trigger": "ordering\tattribute", "contents": "ordering=\"${1}\""}, + {"trigger": "orientation\tattribute", "contents": "orientation=${1}"}, + {"trigger": "orientation\tattribute", "contents": "orientation=\"${1}\""}, + {"trigger": "outputorder\tattribute", "contents": "outputorder=${1}"}, + {"trigger": "overlap\tattribute", "contents": "overlap=${1}"}, + {"trigger": "overlap_scaling\tattribute", "contents": "overlap_scaling=${1}"}, + {"trigger": "overlap_shrink\tattribute", "contents": "overlap_shrink=${1}"}, + {"trigger": "pack\tattribute", "contents": "pack=${1}"}, + {"trigger": "packmode\tattribute", "contents": "packmode=${1}"}, + {"trigger": "pad\tattribute", "contents": "pad=${1}"}, + {"trigger": "page\tattribute", "contents": "page=${1}"}, + {"trigger": "pagedir\tattribute", "contents": "pagedir=${1}"}, + {"trigger": "pencolor\tattribute", "contents": "pencolor=${1}"}, + {"trigger": "penwidth\tattribute", "contents": "penwidth=${1}"}, + {"trigger": "peripheries\tattribute", "contents": "peripheries=${1}"}, + {"trigger": "pin\tattribute", "contents": "pin=${1}"}, + {"trigger": "pos\tattribute", "contents": "pos=${1}"}, + {"trigger": "quadtree\tattribute", "contents": "quadtree=${1}"}, + {"trigger": "quantum\tattribute", "contents": "quantum=${1}"}, + {"trigger": "rank\tattribute", "contents": "rank=${1}"}, + {"trigger": "rankdir\tattribute", "contents": "rankdir=${1}"}, + {"trigger": "ranksep\tattribute", "contents": "ranksep=${1}"}, + {"trigger": "ratio\tattribute", "contents": "ratio=${1}"}, + {"trigger": "rects\tattribute", "contents": "rects=${1}"}, + {"trigger": "regular\tattribute", "contents": "regular=${1}"}, + {"trigger": "remincross\tattribute", "contents": "remincross=${1}"}, + {"trigger": "repulsiveforce\tattribute", "contents": "repulsiveforce=${1}"}, + {"trigger": "resolution\tattribute", "contents": "resolution=${1}"}, + {"trigger": "root\tattribute", "contents": "root=${1}"}, + {"trigger": "rotate\tattribute", "contents": "rotate=${1}"}, + {"trigger": "rotation\tattribute", "contents": "rotation=${1}"}, + {"trigger": "samehead\tattribute", "contents": "samehead=\"${1}\""}, + {"trigger": "sametail\tattribute", "contents": "sametail=\"${1}\""}, + {"trigger": "samplepoints\tattribute", "contents": "samplepoints=${1}"}, + {"trigger": "scale\tattribute", "contents": "scale=${1}"}, + {"trigger": "searchsize\tattribute", "contents": "searchsize=${1}"}, + {"trigger": "sep\tattribute", "contents": "sep=${1}"}, + {"trigger": "shape\tattribute", "contents": "shape=${1}"}, + {"trigger": "shapefile\tattribute", "contents": "shapefile=\"${1}\""}, + {"trigger": "showboxes\tattribute", "contents": "showboxes=${1}"}, + {"trigger": "sides\tattribute", "contents": "sides=${1}"}, + {"trigger": "size\tattribute", "contents": "size=${1}"}, + {"trigger": "skew\tattribute", "contents": "skew=${1}"}, + {"trigger": "smoothing\tattribute", "contents": "smoothing=${1}"}, + {"trigger": "sortv\tattribute", "contents": "sortv=${1}"}, + {"trigger": "splines\tattribute", "contents": "splines=${1}"}, + {"trigger": "start\tattribute", "contents": "start=${1}"}, + {"trigger": "style\tattribute", "contents": "style=${1}"}, + {"trigger": "stylesheet\tattribute", "contents": "stylesheet=\"${1}\""}, + {"trigger": "tailURL\tattribute", "contents": "tailURL=${1}"}, + {"trigger": "tail_lp\tattribute", "contents": "tail_lp=${1}"}, + {"trigger": "tailclip\tattribute", "contents": "tailclip=${1}"}, + {"trigger": "tailhref\tattribute", "contents": "tailhref=${1}"}, + {"trigger": "taillabel\tattribute", "contents": "taillabel=${1}"}, + {"trigger": "tailport\tattribute", "contents": "tailport=${1}"}, + {"trigger": "tailtarget\tattribute", "contents": "tailtarget=${1}"}, + {"trigger": "tailtooltip\tattribute", "contents": "tailtooltip=${1}"}, + {"trigger": "target\tattribute", "contents": "target=${1}"}, + {"trigger": "tooltip\tattribute", "contents": "tooltip=${1}"}, + {"trigger": "truecolor\tattribute", "contents": "truecolor=${1}"}, + {"trigger": "vertices\tattribute", "contents": "vertices=${1}"}, + {"trigger": "viewport\tattribute", "contents": "viewport=${1}"}, + {"trigger": "voro_margin\tattribute", "contents": "voro_margin=${1}"}, + {"trigger": "weight\tattribute", "contents": "weight=${1}"}, + {"trigger": "width\tattribute", "contents": "width=${1}"}, + {"trigger": "xdotversion\tattribute", "contents": "xdotversion=\"${1}\""}, + {"trigger": "xlabel\tattribute", "contents": "xlabel=${1}"}, + {"trigger": "xlp\tattribute", "contents": "xlp=${1}"}, + {"trigger": "z\tattribute", "contents": "z=${1}"}, + ] +} diff --git a/Graphviz/Completions/Graphs.sublime-completions b/Graphviz/Completions/Graphs.sublime-completions new file mode 100644 index 0000000000..8d47bcbe58 --- /dev/null +++ b/Graphviz/Completions/Graphs.sublime-completions @@ -0,0 +1,7 @@ +{ + "scope": "source.dot - meta", + "completions": [ + {"trigger": "graph\tobject", "contents": "graph ${1:name} {\n\t${2}\n}"}, + {"trigger": "digraph\tobject", "contents": "digraph ${1:name} {\n\t${2}\n}"}, + ] +} diff --git a/Graphviz/Completions/Objects.sublime-completions b/Graphviz/Completions/Objects.sublime-completions new file mode 100644 index 0000000000..ef0702e16f --- /dev/null +++ b/Graphviz/Completions/Objects.sublime-completions @@ -0,0 +1,9 @@ +{ + "scope": "source.dot meta.group - meta.attributes", + "completions": [ + {"trigger": "subgraph\tobject", "contents": "subgraph ${1:cluster_}${2:name} {\n\t${3}\n}"}, + {"trigger": "edge defaults\tobject", "contents": "edge [${1}];"}, + {"trigger": "node defaults\tobject", "contents": "node [${1}];"}, + {"trigger": "node\tobject", "contents": "${1:name} [${2}];"}, + ] +} diff --git a/Graphviz/DOT.sublime-syntax b/Graphviz/DOT.sublime-syntax index 7b1005d093..6cfc6fde95 100644 --- a/Graphviz/DOT.sublime-syntax +++ b/Graphviz/DOT.sublime-syntax @@ -12,7 +12,7 @@ contexts: - include: expressions expressions: - - match: \b((sub|di)?graph)\b\s+((cluster)?\w+)\b + - match: \b((sub|di)?graph)\b\s+((cluster_)?\w+)\b captures: 1: storage.type.dot 3: entity.name.graph.dot @@ -107,3 +107,6 @@ contexts: - match: \*/ scope: punctuation.definition.comment.dot pop: true + - match: ^\s*(\*)(?!/) + captures: + 1: punctuation.definition.comment.dot diff --git a/Graphviz/Graphviz.sublime-build b/Graphviz/Graphviz.sublime-build new file mode 100644 index 0000000000..7c6e827a87 --- /dev/null +++ b/Graphviz/Graphviz.sublime-build @@ -0,0 +1,42 @@ +{ + "shell_cmd": "dot \"${file}\" -O -Tpng", + "file_regex": "^Error: (..[^:]*):.*line (\\d+).*$", + "working_dir": "${file_path}", + "selector": "source.dot", + + "variants": + [ + { + "name": "dot SVG", + "shell_cmd": "dot \"${file}\" -O -Tsvg" + }, + { + "name": "neato", + "shell_cmd": "neato \"${file}\" -O -Tpng" + }, + { + "name": "twopi", + "shell_cmd": "twopi \"${file}\" -O -Tpng" + }, + { + "name": "circo", + "shell_cmd": "circo \"${file}\" -O -Tpng" + }, + { + "name": "fdp", + "shell_cmd": "fdp \"${file}\" -O -Tpng" + }, + { + "name": "sfdp", + "shell_cmd": "sfdp \"${file}\" -O -Tpng" + }, + { + "name": "patchwork", + "shell_cmd": "patchwork \"${file}\" -O -Tpng" + }, + { + "name": "osage", + "shell_cmd": "osage \"${file}\" -O -Tpng" + }, + ] +} diff --git a/Graphviz/syntax_test_dot.dot b/Graphviz/syntax_test_dot.dot index b5c53ada6c..821deaff7f 100644 --- a/Graphviz/syntax_test_dot.dot +++ b/Graphviz/syntax_test_dot.dot @@ -9,6 +9,14 @@ // ^^^^^^^^^^ comment.block.dot // ^^ punctuation.definition.comment.dot +/** +// <- punctuation.definition.comment.dot +//^^ comment.block.dot + * Me as well! +// ^ punctuation.definition.comment.dot +*/ +// <- punctuation.definition.comment.dot + # Me also! // <- punctuation.definition.comment.dot // ^^^^^^^ comment.line.number-sign.dot @@ -39,7 +47,8 @@ graph n { page="" } graph cluster_n { // ^^^^^^^^^ entity.name.graph.dot -// ^^^^^^^ meta.annotation.dot variable.annotation.cluster.dot +// ^^^^^^^^ meta.annotation.dot variable.annotation.cluster.dot +// ^ - meta.annotation.dot variable.annotation.cluster.dot t -> n; // ^^ punctuation.operator.relationship.dot } diff --git a/Groovy/Groovy.sublime-syntax b/Groovy/Groovy.sublime-syntax index be95e88db4..505b56f412 100644 --- a/Groovy/Groovy.sublime-syntax +++ b/Groovy/Groovy.sublime-syntax @@ -421,6 +421,9 @@ contexts: escaped-end-of-line: - match: \\\n scope: constant.character.escape.groovy + push: + - match: ^ + pop: true string-escape-sequences: - include: unicode-escape-sequence - include: escaped-end-of-line diff --git a/Groovy/syntax_test_groovy.groovy b/Groovy/syntax_test_groovy.groovy index f718d5bdc5..3ce1552c20 100644 --- a/Groovy/syntax_test_groovy.groovy +++ b/Groovy/syntax_test_groovy.groovy @@ -70,3 +70,16 @@ def greeting = "Hello ${true ? 'World' : 'Home'}" // ^ punctuation.section.embedded // ^ punctuation.definition.string.end // ^ - string.quoted - invalid + +def str = " +// ^ string.quoted.double.groovy punctuation.definition.string.begin.groovy +// ^ string.quoted.double.groovy invalid.illegal.unclosed-string.groovy + " +//^ string.quoted.double.groovy punctuation.definition.string.begin.groovy +// ^ string.quoted.double.groovy invalid.illegal.unclosed-string.groovy +def str = "\ +// ^ string.quoted.double.groovy punctuation.definition.string.begin.groovy +// ^^ string.quoted.double.groovy constant.character.escape.groovy +def str = "\ + " +//^ string.quoted.double.groovy punctuation.definition.string.end.groovy diff --git a/HTML/.python-version b/HTML/.python-version new file mode 100644 index 0000000000..98fccd6d02 --- /dev/null +++ b/HTML/.python-version @@ -0,0 +1 @@ +3.8 \ No newline at end of file diff --git a/HTML/HTML.sublime-syntax b/HTML/HTML.sublime-syntax index 51844cc070..817931a6dc 100644 --- a/HTML/HTML.sublime-syntax +++ b/HTML/HTML.sublime-syntax @@ -381,8 +381,9 @@ contexts: scope: punctuation.definition.tag.end.html set: - meta_content_scope: text.html.embedded.html - - include: main + - include: comment - include: script-close-tag + - include: main script-other: - meta_content_scope: meta.tag.script.begin.html @@ -403,7 +404,7 @@ contexts: captures: 1: punctuation.definition.tag.begin.html 2: entity.name.tag.script.html - set: + set: - meta_scope: meta.tag.script.end.html - include: tag-end - include: tag-attributes @@ -520,6 +521,7 @@ contexts: pop: true - match: '["''`<]' scope: invalid.illegal.attribute-value.html + - include: entities - include: else-pop tag-class-attribute: @@ -548,6 +550,7 @@ contexts: - match: '"' scope: punctuation.definition.string.end.html pop: true + - include: tag-attribute-value-separator - include: entities - match: "'" scope: punctuation.definition.string.begin.html @@ -557,6 +560,7 @@ contexts: - match: "'" scope: punctuation.definition.string.end.html pop: true + - include: tag-attribute-value-separator - include: entities - match: '{{unquoted_attribute_start}}' set: @@ -565,6 +569,7 @@ contexts: pop: true - match: '["''`<]' scope: invalid.illegal.attribute-value.html + - include: entities - include: else-pop tag-id-attribute: @@ -593,6 +598,7 @@ contexts: - match: '"' scope: punctuation.definition.string.end.html pop: true + - include: tag-attribute-value-separator - include: entities - match: "'" scope: punctuation.definition.string.begin.html @@ -602,6 +608,7 @@ contexts: - match: "'" scope: punctuation.definition.string.end.html pop: true + - include: tag-attribute-value-separator - include: entities - match: '{{unquoted_attribute_start}}' set: @@ -610,6 +617,7 @@ contexts: pop: true - match: '["''`<]' scope: invalid.illegal.attribute-value.html + - include: entities - include: else-pop tag-style-attribute: @@ -702,6 +710,12 @@ contexts: - include: tag-event-attribute - include: tag-generic-attribute + tag-attribute-value-separator: + - match: (?=[{{ascii_space}}]) + push: + - clear_scopes: 1 # clear `meta.class-name` or `meta.toc-list.id` + - include: else-pop + tag-end: - match: '>' scope: punctuation.definition.tag.end.html diff --git a/HTML/Indentation Rules.tmPreferences b/HTML/Indentation Rules.tmPreferences new file mode 100644 index 0000000000..4445dc6d6a --- /dev/null +++ b/HTML/Indentation Rules.tmPreferences @@ -0,0 +1,54 @@ + + + + scope + text.html + settings + + decreaseIndentPattern + ]*+ ])[^\t\n\f /<>]+ [^>]* > + | ^[\t\n\f ]*+ + ( + # closing comment punctuation, optionally preceded by an end "comment selector" + ( + # closing directive/section punctuation + | [?%]> + # closing curly brace + | \} + ) + ]]> + increaseIndentPattern + ] + )(?: + # tag name + (?[^\t\n\f /<>]+) + # not self closing + (?:(?!/>)[^>])* > + # not closing in the same line + (?! .* ) + ) + # comments that don't close themselves on the same line + | ) + # directives that don't close themselves on the same line + | <\?(?!.*?\?>) + # sections that don't close themselves on the same line + | <\%(?!.*?\%>) + # open curly braces that don't have close braces or string punctuation after them + | \{(?![}"']) + ) + ]]> + bracketIndentNextLinePattern + )]]> + + + diff --git a/HTML/Miscellaneous.tmPreferences b/HTML/Miscellaneous.tmPreferences deleted file mode 100644 index 12219f5981..0000000000 --- a/HTML/Miscellaneous.tmPreferences +++ /dev/null @@ -1,33 +0,0 @@ - - - - name - Miscellaneous - scope - text.html - settings - - decreaseIndentPattern - ]*+]*> # optionally, anything that's not an angle bracket, followed by any valid HTML close tag except "html" - | ( # closing comment punctuation, optionally preceded by an end "comment selector" - | \} # a closing curly brace - ) - ]]> - increaseIndentPattern - ) # comments that don't close themselves on the same line - | .*<(?!\?|(?i:area|base|br|col|frame|hr|html|img|input|link|meta|param)\b|[^>]*/>) # skip self closing tags (tags that end with />, as well as known self closing tags) - (?[A-Za-z0-9-]+)(?=\s|>)\b[^>]*>(?!.*\s*>) # a valid non-self-closing HTML tag that doesn't close itself on the same line - ) - ]]> - bracketIndentNextLinePattern - )]]> - - - diff --git a/HTML/syntax_test_html.html b/HTML/syntax_test_html.html index 6e5a3ab583..a69ea9702b 100644 --- a/HTML/syntax_test_html.html +++ b/HTML/syntax_test_html.html @@ -83,6 +83,7 @@ ## ^ text.html.basic text.html.embedded.html ## ^^^^^^^^^ text.html.basic - text.html.embedded.html meta.tag.script.end +## ^ text.html.basic - text.html.embedded.html ## ^^^^^^^^ meta.tag.script.begin @@ -297,6 +298,13 @@ ## ^^^^^^^ meta.attribute-with-value.id ## ^^^^ string.unquoted meta.toc-list.id +
+ ## ^ - meta.attribute-with-value.id + ## ^^ entity.other.attribute-name.id + ## ^^^^^^^^^^^^ meta.attribute-with-value.id + ## ^^^^^^^^^ string.unquoted meta.toc-list.id + ## ^^^^^^ constant.character.entity.hexadecimal +
## ^ - meta.attribute-with-value.id ## ^^^^^^^^^^ meta.attribute-with-value.id @@ -315,12 +323,55 @@ ## ^^^^^^^^^ meta.toc-list.id ## ^ punctuation.definition.string.end - meta.toc-list.id +
+ ## ^ - meta.attribute-with-value.id + ## ^^ entity.other.attribute-name.id + ## ^^^^^^^^^^^^ meta.attribute-with-value.id + ## ^^^^^^^^^ string.unquoted meta.toc-list.id + ## ^^^^^ constant.character.entity.named + ## ^ invalid.illegal.attribute-value.html + ## ^ - meta.attribute-with-value - entity - constant - string - punctuation + ## ^^^^^^^^ meta.attribute-with-value entity.other.attribute-name + +
+ ## ^ - meta.attribute-with-value.id + ## ^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute-with-value.id + ## ^^ entity.other.attribute-name.id + ## ^^^^^^^^^^^^^^^^^^^^ string.quoted.single + ## ^ punctuation.definition.string.begin - meta.toc-list.id + ## ^^^^^^^^^ meta.toc-list.id + ## ^^^^^ constant.character.entity + ## ^ - meta.toc-list.id + ## ^^^^^^^^ meta.toc-list.id + ## ^^^^^ constant.character.entity + ## ^ punctuation.definition.string.end - meta.toc-list.id + +
+ ## ^ - meta.attribute-with-value.id + ## ^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute-with-value.id + ## ^^ entity.other.attribute-name.id + ## ^^^^^^^^^^^^^^^^^^^^ string.quoted.double + ## ^ punctuation.definition.string.begin - meta.toc-list.id + ## ^^^^^^^^^ meta.toc-list.id + ## ^^^^^ constant.character.entity + ## ^ - meta.toc-list.id + ## ^^^^^^^^ meta.toc-list.id + ## ^^^^^ constant.character.entity + ## ^ punctuation.definition.string.end - meta.toc-list.id +
## ^ - meta.attribute-with-value.class ## ^^^^^ entity.other.attribute-name.class ## ^^^^^^^^^^^^^^^^^^^ meta.attribute-with-value.class ## ^^^^^^^^^^^^^ string.unquoted meta.class-name +
+ ## ^ - meta.attribute-with-value.class + ## ^^^^^ entity.other.attribute-name.class + ## ^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute-with-value.class + ## ^^^^^^^^^^^^^^^^^^ string.unquoted meta.class-name + ## ^^^^^^ constant.character.entity.hexadecimal +
## ^ - meta.attribute-with-value.class ## ^^^^^^^^^^^^^^^^^^^^^ meta.attribute-with-value.class @@ -339,6 +390,42 @@ ## ^^^^^^^^^^^^^ meta.class-name ## ^ punctuation.definition.string.end - meta.class-name +
+ ## ^ - meta.attribute-with-value.class + ## ^^^^^ entity.other.attribute-name.class + ## ^^^^^^^^^^^^^^^ meta.attribute-with-value.class + ## ^^^^^^^^^ string.unquoted meta.class-name + ## ^^^^^ constant.character.entity.named + ## ^ invalid.illegal.attribute-value.html + ## ^ - meta.attribute-with-value - entity - constant - string - punctuation + ## ^^^^^^^^ meta.attribute-with-value entity.other.attribute-name + +
+ ## ^ - meta.attribute-with-value.class + ## ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute-with-value.class + ## ^^^^^ entity.other.attribute-name.class + ## ^^^^^^^^^^^^^^^^^^^^ string.quoted.single + ## ^ punctuation.definition.string.begin - meta.class-name + ## ^^^^^^^^^ meta.class-name + ## ^^^^^ constant.character.entity + ## ^ - meta.class-name + ## ^^^^^^^^ meta.class-name + ## ^^^^^ constant.character.entity + ## ^ punctuation.definition.string.end - meta.class-name + +
+ ## ^ - meta.attribute-with-value.class + ## ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute-with-value.class + ## ^^^^^ entity.other.attribute-name.class + ## ^^^^^^^^^^^^^^^^^^^^ string.quoted.double + ## ^ punctuation.definition.string.begin - meta.class-name + ## ^^^^^^^^^ meta.class-name + ## ^^^^^ constant.character.entity + ## ^ - meta.class-name + ## ^^^^^^^^ meta.class-name + ## ^^^^^ constant.character.entity + ## ^ punctuation.definition.string.end - meta.class-name +
## ^ - meta.attribute-with-value.style ## ^^^^^^^^^^^^^^^^^^^ meta.attribute-with-value.style @@ -347,7 +434,7 @@ ## ^^^^^^^^^^^ source.css ## ^ punctuation.definition.string.end.html - source.css ## ^^^^^ meta.property-name.css support.type.property-name.css - ## ^^^ meta.property-value.css constant.numeric.css + ## ^^^^ meta.property-value.css constant.numeric.integer.decimal.css
## ^ - meta.attribute-with-value.style @@ -357,7 +444,7 @@ ## ^ punctuation.definition.string.end.html - source.css ## ^^^^^^^^^^^^ source.css ## ^^^^^ meta.property-name.css support.type.property-name.css - ## ^^^ meta.property-value.css constant.numeric.css + ## ^^^^ meta.property-value.css constant.numeric.integer.decimal.css ## ^ entity.other.attribute-name.html diff --git a/Haskell/Haskell.sublime-syntax b/Haskell/Haskell.sublime-syntax index 7fa5816bd1..e45d67341d 100644 --- a/Haskell/Haskell.sublime-syntax +++ b/Haskell/Haskell.sublime-syntax @@ -82,11 +82,20 @@ contexts: scope: keyword.operator.haskell - match: \b(do|if|then|else)\b scope: keyword.control.haskell - - match: '\b([0-9]+\.[0-9]+([eE][+-]?[0-9]+)?|[0-9]+[eE][+-]?[0-9]+)\b' - comment: Floats are always decimal - scope: constant.numeric.float.haskell - - match: '\b([0-9]+|0([xX][0-9a-fA-F]+|[oO][0-7]+))\b' - scope: constant.numeric.haskell + - match: \b\d+(?:(\.)\d+(?:[eE][-+]?\d+)?|(?:[eE][-+]?\d+))\b + scope: constant.numeric.float.decimal.haskell + captures: + 1: punctuation.separator.decimal.haskell + - match: \b(0[oO])[0-7]+\b + scope: constant.numeric.integer.octal.haskell + captures: + 1: punctuation.definition.numeric.base.haskell + - match: \b(0[xX])\h+\b + scope: constant.numeric.integer.hexadecimal.haskell + captures: + 1: punctuation.definition.numeric.base.haskell + - match: \b\d+\b + scope: constant.numeric.integer.decimal.haskell - match: ^\s*(#)\s*\w+ comment: In addition to Haskell's "native" syntax, GHC permits the C preprocessor to be run on a source file. scope: meta.preprocessor.c @@ -157,19 +166,13 @@ contexts: 4: constant.character.escape.hexadecimal.haskell 5: constant.character.escape.control.haskell 6: punctuation.definition.string.end.haskell - - match: '^\s*([a-z_][a-zA-Z0-9_'']*|\([|!%$+\-.,=]+\))\s*(::|∷)' + - match: '^(\s*)([a-z_][a-zA-Z0-9_'']*|\([|!%$+\-.,=]+\))\s*(::|∷)' captures: - 1: entity.name.function.haskell - 2: keyword.other.double-colon.haskell + 2: entity.name.function.haskell + 3: keyword.other.double-colon.haskell push: - meta_scope: meta.function.type-declaration.haskell - - match: |- - (?x) - ^(data|newtype|type|class|deriving)\s # When a top level declaration starts - | ^[^=]*(=)[\sa-zA-Z0-9_\(] # A function declaration - captures: - 1: keyword.other.haskell - 2: keyword.operator.haskell + - match: ^(?!\s*(?:--|{-|$)|\1\s) pop: true - include: type_signature - match: '\b[A-Z]\w*\b' diff --git a/Haskell/syntax_test_haskell.hs b/Haskell/syntax_test_haskell.hs index 836ea62c76..8758f9a3b9 100644 --- a/Haskell/syntax_test_haskell.hs +++ b/Haskell/syntax_test_haskell.hs @@ -72,7 +72,6 @@ -- ^^^^^^^^^^^^ meta.function.type-declaration.haskell -- ^^ keyword.other.arrow.haskell traverse f = sequenceA . fmap f --- ^^^^^^^^^^^^^ meta.function.type-declaration.haskell -- ^ keyword.operator.haskell -- ^ keyword.operator.haskell @@ -95,16 +94,95 @@ a a = (+) a 2 -- ^ keyword.operator.haskell -- ^^^ entity.name.function.infix.haskell --- ^ constant.numeric.haskell +-- ^ constant.numeric.integer.decimal.haskell a a = (-) a 2 -- ^ keyword.operator.haskell -- ^^^ entity.name.function.infix.haskell --- ^ constant.numeric.haskell +-- ^ constant.numeric.integer.decimal.haskell a a = (*) a 2 -- ^ keyword.operator.haskell -- ^^^ entity.name.function.infix.haskell --- ^ constant.numeric.haskell +-- ^ constant.numeric.integer.decimal.haskell a a = (/) a 2 -- ^ keyword.operator.haskell -- ^^^ entity.name.function.infix.haskell --- ^ constant.numeric.haskell +-- ^ constant.numeric.integer.decimal.haskell + +-- Tests for #1320, #1880. + + class TooMany a where + tooMany :: a -> Bool +-- ^^^^^^^^^^^^^^^^^^^^^^ meta.function.type-declaration.haskell + tooManyToo :: +-- ^^^^^^^^^^^^^^^ meta.function.type-declaration.haskell + a -> Bool +-- ^^^^^^^^^^^^^ meta.function.type-declaration.haskell + + instance TooMany Int where +-- ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.declaration.instance.haskell + tooMany n = n > 42 + + foldBoolGuard :: a -> a -> Bool -> a +-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.type-declaration.haskell + foldBoolGuard x y z +-- ^^^^^^^^^^^^^^^^^^^ source.haskell + | z = y +-- ^ keyword.operator.haskell + | otherwise = x + + countTheBeforeVowel :: String + -- This comment should not interrupt the type signature. + + -- The blank line above should not interrupt the type signature. + + {- + This multiline comment should + not interrupt the type signature. + -} + + -> Integer +-- ^^^^^^^^^^^^ meta.function.type-declaration.haskell + countTheBeforeVowel = undefined + + +--NUMBERS + + 0 +-- ^ constant.numeric.integer.decimal + + 1234567890 +-- ^^^^^^^^^^ constant.numeric.integer.decimal + + 0o1234567 +-- ^^^^^^^^^ constant.numeric.integer.octal +-- ^^ punctuation.definition.numeric.base.haskell + + 1. +-- ^ constant.numeric.integer.decimal +-- ^ keyword.operator.haskell + + .2 +-- ^ keyword.operator.haskell +-- ^ constant.numeric.integer.decimal + + 12.345 +-- ^^^^^^ constant.numeric.float.decimal +-- ^ punctuation.separator.decimal + + 1e10 +-- ^^^^ constant.numeric.float.decimal + + 0.5e+0 +-- ^^^^^^ constant.numeric.float.decimal +-- ^ punctuation.separator.decimal + + 9e-1 +-- ^^^^ constant.numeric.float.decimal + + 0x0 +-- ^^^ constant.numeric.integer.hexadecimal +-- ^^ punctuation.definition.numeric.base + + 0XdeafBEEF42 +-- ^^^^^^^^^^^^ constant.numeric.integer.hexadecimal +-- ^^ punctuation.definition.numeric.base diff --git a/JSON/Comments.tmPreferences b/JSON/Comments.tmPreferences new file mode 100644 index 0000000000..dd46f14e7a --- /dev/null +++ b/JSON/Comments.tmPreferences @@ -0,0 +1,33 @@ + + + + name + Comments + scope + source.json + settings + + shellVariables + + + name + TM_COMMENT_START + value + // + + + name + TM_COMMENT_START_2 + value + /* + + + name + TM_COMMENT_END_2 + value + */ + + + + + diff --git a/JavaScript/JSON Indent.tmPreferences b/JSON/Indentation Rules.tmPreferences similarity index 100% rename from JavaScript/JSON Indent.tmPreferences rename to JSON/Indentation Rules.tmPreferences diff --git a/JSON/JSON Indent.tmPreferences b/JSON/JSON Indent.tmPreferences new file mode 100644 index 0000000000..8944a9e837 --- /dev/null +++ b/JSON/JSON Indent.tmPreferences @@ -0,0 +1,67 @@ + + + + name + JavaScript Indent + scope + source.json + settings + + decreaseIndentPattern + (?x) + # When an object is closed, but not opened + ( + ^ + ( + # Consume strings + "(?:[^"\\]|\\.)*" + | + # Consume all chars that don't start a string, comment or + # open an object on this line + [^"/{\n] + )* + \}.*$ + ) + | + # When an array is closed by itself on a line (interacts with indentSquareBrackets) + ( + ^(.*\*/)?\s*\].*$ + ) + + increaseIndentPattern + (?x) + # When an object is opened, but not closed + ( + ^.*\{ + ( + # Consume strings + "(?:[^"\\]|\\.)*" + | + # Consume all chars that don't start a string, comment or + # end the object that was opened on this line + [^"/}] + )* + # Stop matching at the end of the line, or once we hit a comment + ($|/[/*]) + ) + | + # When an array is opened, but not closed + ( + ^.*\[ + ( + # Consume strings + "(?:[^"\\]|\\.)*" + | + # Consume all chars that don't start a string, comment or + # end the array that was opened on this line + [^"/\]] + )* + # Stop matching at the end of the line, or once we hit a comment + ($|/[/*]) + ) + + indentSquareBrackets + + + + diff --git a/JavaScript/JSON.sublime-syntax b/JSON/JSON.sublime-syntax similarity index 56% rename from JavaScript/JSON.sublime-syntax rename to JSON/JSON.sublime-syntax index a3d6a8b228..ae2504510b 100644 --- a/JavaScript/JSON.sublime-syntax +++ b/JSON/JSON.sublime-syntax @@ -18,32 +18,45 @@ file_extensions: - Pipfile.lock scope: source.json contexts: + prototype: + - include: comments main: - include: value + value: + - include: constant + - include: number + - include: string + - include: array + - include: object array: - match: '\[' - scope: punctuation.section.array.begin.json + scope: punctuation.section.sequence.begin.json push: - - meta_scope: meta.structure.array.json + - meta_scope: meta.sequence.json - match: '\]' - scope: punctuation.section.array.end.json + scope: punctuation.section.sequence.end.json pop: true - include: value - match: "," - scope: punctuation.separator.array.json + scope: punctuation.separator.sequence.json - match: '[^\s\]]' - scope: invalid.illegal.expected-array-separator.json + scope: invalid.illegal.expected-sequence-separator.json comments: - match: /\*\*(?!/) scope: punctuation.definition.comment.json push: - meta_scope: comment.block.documentation.json + - meta_include_prototype: false - match: \*/ pop: true + - match: ^\s*(\*)(?!/) + captures: + 1: punctuation.definition.comment.json - match: /\* scope: punctuation.definition.comment.json push: - meta_scope: comment.block.json + - meta_include_prototype: false - match: \*/ pop: true - match: (//).*$\n? @@ -55,62 +68,58 @@ contexts: scope: constant.language.json number: # handles integer and decimal numbers - - match: |- - (?x: # turn on extended mode - -? # an optional minus - (?: - 0 # a zero - | # ...or... - [1-9] # a 1-9 character - \d* # followed by zero or more digits - ) - (?: - (?: - \. # a period - \d+ # followed by one or more digits - )? - (?: - [eE] # an e character - [+-]? # followed by an option +/- - \d+ # followed by one or more digits - )? # make exponent optional - )? # make decimal portion optional - ) - scope: constant.numeric.json + - match: -?(?:0|[1-9]\d*)(?:(?:(\.)\d+)(?:[eE][-+]?\d+)?|(?:[eE][-+]?\d+)) + scope: constant.numeric.float.decimal.json + captures: + 1: punctuation.separator.decimal.json + - match: -?(?:0|[1-9]\d*) + scope: constant.numeric.integer.decimal.json object: # a JSON object - match: '\{' - scope: punctuation.section.dictionary.begin.json + scope: punctuation.section.mapping.begin.json push: - - meta_scope: meta.structure.dictionary.json + - meta_scope: meta.mapping.json - match: '\}' - scope: punctuation.section.dictionary.end.json + scope: punctuation.section.mapping.end.json pop: true - match: '"' scope: punctuation.definition.string.begin.json push: - - meta_scope: meta.structure.dictionary.key.json string.quoted.double.json + - clear_scopes: 1 + - meta_scope: meta.mapping.key.json string.quoted.double.json + - meta_include_prototype: false - include: inside-string - - include: comments - match: ":" - scope: punctuation.separator.dictionary.key-value.json + scope: punctuation.separator.mapping.key-value.json push: - - meta_scope: meta.structure.dictionary.value.json - - match: '(,)|(?=\})' - captures: - 1: punctuation.separator.dictionary.pair.json + - match: ',|\s?(?=\})' + scope: invalid.illegal.expected-mapping-value.json pop: true - - include: value - - match: '[^\s,]' - scope: invalid.illegal.expected-dictionary-separator.json + - match: (?=\S) + set: + - clear_scopes: 1 + - meta_scope: meta.mapping.value.json + - include: value + - match: '' + set: + - match: ',' + scope: punctuation.separator.mapping.pair.json + pop: true + - match: \s*(?=\}) + pop: true + - match: \s(?!/[/*])(?=[^\s,])|[^\s,] + scope: invalid.illegal.expected-mapping-separator.json + pop: true - match: '[^\s\}]' - scope: invalid.illegal.expected-dictionary-separator.json + scope: invalid.illegal.expected-mapping-key.json string: - match: '"' scope: punctuation.definition.string.begin.json push: inside-string inside-string: - meta_scope: string.quoted.double.json + - meta_include_prototype: false - match: '"' scope: punctuation.definition.string.end.json pop: true @@ -132,10 +141,3 @@ contexts: scope: constant.character.escape.json - match: \\. scope: invalid.illegal.unrecognized-string-escape.json - value: - - include: constant - - include: number - - include: string - - include: array - - include: object - - include: comments diff --git a/JSON/syntax_test_json.json b/JSON/syntax_test_json.json new file mode 100644 index 0000000000..60a3e645e7 --- /dev/null +++ b/JSON/syntax_test_json.json @@ -0,0 +1,115 @@ +// SYNTAX TEST "Packages/JSON/JSON.sublime-syntax" + +{ +// <- meta.mapping.json punctuation.section.mapping.begin.json + "bool": false, +//^^^^^^ meta.mapping.key.json +//^^^^^^^^^^^^^^ - meta.mapping meta.mapping +// ^^^^^ constant.language.json + + "dict": { "key": "value" } +// ^^^^^^^^^^^^^^^^^^ meta.mapping.value.json meta.mapping - meta.mapping meta.mapping meta.mapping +// ^ punctuation.section.mapping.begin.json +// ^ punctuation.section.mapping.end.json +// ^^ meta.mapping.value.json meta.mapping.json +// ^^^^^ meta.mapping.key.json string.quoted.double.json +// ^^ meta.mapping.value.json meta.mapping.json +// ^^^^^^^ meta.mapping.value.json meta.mapping.value.json string.quoted.double.json +// ^^ meta.mapping.value.json meta.mapping.json + +, , +// <- punctuation.separator.mapping.pair.json +//^ invalid.illegal.expected-mapping-key.json + + "sep": {}, +// ^ punctuation.separator.mapping.key-value.json + + "array": [ /**/ ], +// ^^^^^^^^ meta.mapping.value.json meta.sequence.json +// ^ punctuation.section.sequence.begin.json +// ^^^^ comment.block.json +// ^ punctuation.section.sequence.end.json + + "dict": {"foo": }, +// ^ invalid.illegal.expected-mapping-value.json +// ^ punctuation.section.mapping.end.json + "dict": {"foo": + }, +//^ invalid.illegal.expected-mapping-value.json +// ^ punctuation.section.mapping.end.json + + "dict": {"foo"/*comment*/:/*comment*/"bar"/*comment*/}, +// ^^^^^^^^^^^ comment.block.json +// ^^^^^^^^^^^ comment.block.json +// ^^^^^^^^^^^ comment.block.json + + "dict": { + "foo": "bar" + // comment +// ^ - invalid +// ^^^^^^^^^^ comment.line.double-slash.js + , +// ^ punctuation.separator.mapping.pair.json + "foo": "bar" + /* comment */ +// ^ - invalid +// ^^^^^^^^^^^^^ comment.block.json + }, +//^ punctuation.section.mapping.end.json +// ^ punctuation.separator.mapping.pair.json + + "string": "string", +// ^ punctuation.definition.string.begin.json +// ^^^^^^^^ meta.mapping.value.json string.quoted.double.json +// ^ punctuation.definition.string.end.json + + "num": 20.09, +// ^^^^^ constant.numeric.float.decimal.json + + "neg": -9, +// ^^ constant.numeric.integer.decimal.json + + "E": 20e10, +// ^^^^^ constant.numeric.float.decimal.json +//^^^ meta.mapping.key.json string.quoted.double.json +// ^ punctuation.separator.mapping.key-value.json - meta.mapping.key + + "escape": "\n", +// ^^ constant.character.escape.json +// ^^^^ meta.mapping.value.json string.quoted.double.json - meta.mapping.key + + "illegal": "\.", +// ^^ invalid.illegal.unrecognized-string-escape.json + + "unterminated string +//^^^^^^^^^^^^^^^^^^^^ string.quoted.double.json +// ^ string.quoted.double.json invalid.illegal.unclosed-string.json + +// <- - string + +/**/: "test", +// ^ meta.mapping.json comment.block.json +// ^ punctuation.separator.mapping.key-value.json - comment +// ^^^^^^ meta.mapping.value.json string.quoted.double.json + + "array2": + [ + "foobar", +// ^^^^^^^^ meta.mapping.value meta.sequence.json string.quoted.double.json - meta.mapping.key + ] + + [], +//^ invalid.illegal.expected-mapping-separator.json +// ^^^ invalid.illegal.expected-mapping-key.json + + "typing json": {} + ,,,, "another key": false, + + "ke//y": "value" +//^^^^^^^ meta.mapping.key.json string.quoted.double.json - comment + +/** + * +// ^ meta.mapping.json comment.block.documentation.json punctuation.definition.comment.json +*/ +} diff --git a/Java/Java.sublime-syntax b/Java/Java.sublime-syntax index fc445a3a95..89c6667f92 100644 --- a/Java/Java.sublime-syntax +++ b/Java/Java.sublime-syntax @@ -20,17 +20,25 @@ variables: before_fqn: (?={{lowercase_id}}\s*\.) # utility lookaround - lambda_lookahead: '(?:\(.*\)|{{id}})\s*->' + lambda_lookahead: (?:\(.*\)|{{id}})\s*-> + + # digits + ddigits0: '\d[\d_]*?(_*)' + ddigits: (?:(_*){{ddigits0}}) + hdigits: (?:(_*)\h[\h_]*?(_*)) + exponent: '[-+]?{{ddigits}}' + eexponent: (?:[eE]{{exponent}}) + pexponent: (?:[pP]{{exponent}}) contexts: prototype: - - match: '(?=%>)' + - match: (?=%>) pop: true - include: comments - include: illegal-keywords any_POP: - - match: '(?=\S)' + - match: (?=\S) pop: true immediate_POP: @@ -74,9 +82,8 @@ contexts: - include: immediate_POP - - match: '{{id}}' set: - - - meta_scope: entity.name.namespace.java - - include: immediate_POP - - dot-separated-identifier + - meta_scope: meta.path.java entity.name.namespace.java + - include: dot-separated-identifier - include: any_POP import-statement: @@ -106,10 +113,8 @@ contexts: set: - include: before-next-import - include: punctuation-accessor-dot - - match: ({{classcase_id}})|(\*) - captures: - 1: support.class.import.java - 2: keyword.operator.wildcard.asterisk.java + - include: import-class + - include: import-wildcard - include: any_POP - include: any_POP - include: any_POP @@ -127,12 +132,10 @@ contexts: set: - include: before-next-import - include: punctuation-accessor-dot - - match: ({{uppercase_id}})|({{classcase_id}})|({{id}})|(\*) - captures: - 1: constant.other.import.java - 2: support.class.import.java - 3: support.function.import.java - 4: keyword.operator.wildcard.asterisk.java + - include: import-constant + - include: import-class + - include: import-function + - include: import-wildcard - include: any_POP - include: any_POP - include: any_POP @@ -154,8 +157,24 @@ contexts: - include: primitive-types - include: object-types + import-constant: + - match: '{{uppercase_id}}' + scope: constant.other.import.java + + import-class: + - match: '{{classcase_id}}' + scope: support.class.import.java + + import-function: + - match: '{{id}}' + scope: support.function.import.java + + import-wildcard: + - match: \* + scope: keyword.operator.wildcard.asterisk.java + annotations: - - match: '@' + - match: \@ scope: punctuation.definition.annotation.java push: - - meta_scope: meta.annotation.java @@ -207,7 +226,6 @@ contexts: - include: annotation-array-initialization - include: annotations - include: code - - include: punctuation-separator-comma - include: any_POP annotation-array-initialization: @@ -220,7 +238,7 @@ contexts: anonymous-classes-and-new: - match: \bnew\b - scope: keyword.control.new.java + scope: keyword.other.storage.new.java push: - - meta_scope: meta.instantiation.java - include: immediate_POP @@ -310,68 +328,120 @@ contexts: scope: punctuation.section.braces.begin.java push: array-initialization - include: code - - include: punctuation-separator-comma - - assertions: - - match: \b(assert)\b - scope: keyword.control.assert.java - push: - - meta_scope: meta.declaration.assertion.java - - match: $ - pop: true - - match: ":" - scope: keyword.operator.assert.expression-separator.java - - include: code class: - - match: '(?=\w?[\w\s]*(?:class|(?:@)?interface|enum)\s+\w+)' + - match: (?=({{storage_modifiers}}\s+)*(?:class|(?:@)?interface|enum)\b) + push: [class-meta, class-type] + + class-meta: + - meta_scope: meta.class.java + - include: immediate_POP + + class-type: + - include: storage-modifiers + - match: (?:class|(\@?)interface)\b + scope: storage.type.java + captures: + 1: punctuation.definition.type.java + set: + - class-block + - class-extends + - generic-type-declaration + - class-name + - match: enum\b + scope: storage.type.java + set: + - enum-block + - class-extends + - generic-type-declaration + - class-name + - include: any_POP + + class-name: + - meta_scope: meta.class.identifier.java + - match: (?!extends|implements){{id}}\b + scope: entity.name.class.java + pop: true + - include: any_POP + + class-extends: + - match: extends\b + scope: keyword.declaration.extends.java push: - - meta_scope: meta.class.java - # Needed because the modifers are part of the meta scope - - include: storage-modifiers - - match: (\bclass|(?:@)?\binterface|\benum)\s+(\w+) - scope: meta.class.identifier.java - captures: - 1: storage.type.java - 2: entity.name.class.java - push: generic-type-declaration - - match: \bextends\b - scope: keyword.declaration.extends.java - push: - - - meta_scope: meta.class.extends.java - - include: immediate_POP - - inherited-object-type-reference - - match: \b(implements)\b - scope: keyword.declaration.implements.java - push: - - - meta_scope: meta.class.implements.java - - match: \, - scope: punctuation.separator.comma.java - push: inherited-object-type-reference - - include: any_POP - - inherited-object-type-reference - - match: "{" - scope: punctuation.section.block.begin.java - push: - - meta_scope: meta.class.body.java - - match: "}" - scope: punctuation.section.block.end.java - pop: true - - include: class-body - - include: any_POP + - - meta_scope: meta.class.extends.java + - match: \, + scope: punctuation.separator.comma.java + push: inherited-object-type-reference + - include: any_POP + - inherited-object-type-reference + - match: implements\b + scope: keyword.declaration.implements.java + push: + - - meta_scope: meta.class.implements.java + - match: \, + scope: punctuation.separator.comma.java + push: inherited-object-type-reference + - include: any_POP + - inherited-object-type-reference + - include: any_POP + + class-block: + - match: \{ + scope: punctuation.section.block.begin.java + set: + - meta_scope: meta.class.body.java meta.block.java + - match: \} + scope: punctuation.section.block.end.java + pop: true + - include: class-body + - include: any_POP class-body: - - include: storage-modifiers - include: class - include: annotations - - include: enums - include: fields-and-methods - include: constants-and-special-vars + - include: storage-modifiers - include: all-types - include: static-code-block + - include: punctuation-separator-comma + - include: punctuation-terminator-semicolon - match: (?=<) push: generic-type-declaration + enum-block: + - match: \{ + scope: punctuation.section.block.begin.java + set: + - meta_scope: meta.class.body.java meta.block.java + - match: \} + scope: punctuation.section.block.end.java + pop: true + - include: enum-body + - include: any_POP + + enum-body: + - match: ^(?=\s*([[:upper:]_][[:upper:][:digit:]_]*|(?!{{primitives}}|{{storage_modifiers}})[[:lower:]_][[:alnum:]_]*)\s*[,;{(]) + push: + - match: (?=[;}]) + pop: true + - match: \w+ + scope: constant.other.enum.java + push: + - meta_scope: meta.enum.java + - match: \{ + scope: punctuation.section.block.begin.java + push: + - meta_scope: meta.enum.body.java meta.block.java + - match: \} + scope: punctuation.section.block.end.java + pop: true + - include: enum-body + - include: parens + - include: any_POP + - include: punctuation-separator-comma + - include: class-body + code: - include: constants-and-special-vars - include: assignment @@ -382,24 +452,21 @@ contexts: - include: method-invocations - include: uppercase-identifiers - include: all-types - - include: assertions - include: keywords - include: code-block-include - include: parens code-block-include: - - match: "{" + - match: \{ scope: punctuation.section.block.begin.java push: - meta_scope: meta.block.java - - match: "}" + - match: \} scope: punctuation.section.block.end.java pop: true - include: code-block code-block: - include: storage-modifiers - include: var-type - - include: keywords-control - - include: catch-block - include: code - include: annotations - include: code-block-include @@ -421,102 +488,107 @@ contexts: scope: punctuation.definition.comment.java push: - meta_scope: comment.line.double-slash.java - - match: $\n? + - match: \n pop: true - - match: '(?=%>)' + - match: (?=%>) pop: true + constants-and-special-vars: - match: \b(true|false|null)\b scope: constant.language.java - match: \b(this|super)\b scope: variable.language.java - # Trailing underscores are allowed to prevent numbers from flickering while typing + # hexadecimal floats + - match: |- + \b(0[xX])(?x: + # 0x1., 0x1.1, 0x1.1p1, 0x1.1p-1, 0x1.p1, 0x1.p-1 | 0x1p1 + {{hdigits}} (?: (\.) (?: {{hdigits}}? {{pexponent}}? \b )? | {{pexponent}} \b ) + # 0x.1, 0x.1p1, 0x.1p-1 + | (\.) {{hdigits}} {{pexponent}}? \b + ) + scope: constant.numeric.float.hexadecimal.java + captures: + 1: punctuation.definition.numeric.hexadecimal.java + 2: invalid.illegal.numeric.java + 3: invalid.illegal.numeric.java + 4: punctuation.separator.decimal.java + 5: invalid.illegal.numeric.java + 6: invalid.illegal.numeric.java + 7: invalid.illegal.numeric.java + 8: invalid.illegal.numeric.java + 9: invalid.illegal.numeric.java + 10: invalid.illegal.numeric.java + 11: punctuation.separator.decimal.java + 12: invalid.illegal.numeric.java + 13: invalid.illegal.numeric.java + 14: invalid.illegal.numeric.java + 15: invalid.illegal.numeric.java + # decimal floats - match: |- - (?x) - \b(0[bB]) - (?!_)[01_]*[01] - (?:_*|([Ll])?)\b + (?x: + \b{{ddigits0}} + (?: + # 1., 1.1, 1.1e1, 1.1e-1, 1.e1, 1.e-1, 1.d, 1.1d, 1.1e1d, 1.1e-1d, 1.e1d, 1.e-1d + (\.) (?: {{ddigits}}? {{eexponent}}? ([dDfF])? \b )? + # 1e1 1e1d + | {{eexponent}} ([dDfF])? \b + # 1d + | ([dDfF]) \b + ) + # .1, .1e1, .1e-1 + | (\.) {{ddigits}} {{eexponent}}? ([dDfF])? \b + ) + scope: constant.numeric.float.decimal.java + captures: + 1: invalid.illegal.numeric.java + 2: punctuation.separator.decimal.java + 3: invalid.illegal.numeric.java + 4: invalid.illegal.numeric.java + 5: invalid.illegal.numeric.java + 6: invalid.illegal.numeric.java + 7: storage.type.numeric.java + 8: invalid.illegal.numeric.java + 9: invalid.illegal.numeric.java + 10: storage.type.numeric.java + 11: storage.type.numeric.java + 12: punctuation.separator.decimal.java + 13: invalid.illegal.numeric.java + 14: invalid.illegal.numeric.java + 15: invalid.illegal.numeric.java + 16: invalid.illegal.numeric.java + 17: storage.type.numeric.java + # binary integers + - match: \b(0[bB])(_*)[01][01_]*?(_*)([lL])?\b scope: constant.numeric.integer.binary.java captures: 1: punctuation.definition.numeric.binary.java - 2: storage.type.numeric.long.java - - match: |- - (?x) - \b(0[xX]) - (?!_)[[:xdigit:]_]*[[:xdigit:]] - (?:_*|([Ll])?)\b + 2: invalid.illegal.numeric.java + 3: invalid.illegal.numeric.java + 4: storage.type.numeric.java + # hexadecimal integers + - match: \b(0[xX]){{hdigits}}([lL])?\b scope: constant.numeric.integer.hexadecimal.java captures: 1: punctuation.definition.numeric.hexadecimal.java - 2: storage.type.numeric.long.java - - match: |- - (?x) - \b(0) - [0-7_]*[0-7]+ - (?:_*|([Ll])?)\b + 2: invalid.illegal.numeric.java + 3: invalid.illegal.numeric.java + 4: storage.type.numeric.java + # octal integers + - match: \b(0)(?:(_+)|[0-7_]+?(_*)|([\d_]+))([lL])?\b scope: constant.numeric.integer.octal.java captures: 1: punctuation.definition.numeric.octal.java - 2: storage.type.numeric.long.java - - match: |- - (?x) - \b[1-9](?:[\d_]*\d)? - (?: - \.(?!_)[\d_]*\d(?:[eE][+-]?(?!_)[\d_]*\d)?(?:_*|([FfDd])?) - | - [eE][+-]?(?!_)[\d_]*\d(?:_*|([FfDd])?) - )\b - scope: constant.numeric.float.java - captures: - 1: storage.type.numeric.java - 2: storage.type.numeric.java - - match: |- - (?x) - \.(?!_)[\d_]*\d(?:[eE][+-]?(?!_)[\d_]*\d)?(?:_*|([FfDd])?)\b - scope: constant.numeric.float.java - captures: - 1: storage.type.numeric.java - - match: |- - (?x) - \b(?:0|[1-9](?:[\d_]*\d)?) - (?: - ([FfDd]) - )\b - scope: constant.numeric.float.java - captures: - 1: storage.type.numeric.java - - match: |- - (?x) - \b(?:0|[1-9](?:[\d_]*\d)?) - (?: - _* - | - ([Ll]) - )?\b + 2: invalid.illegal.numeric.java + 3: invalid.illegal.numeric.java + 4: invalid.illegal.numeric.java + 5: storage.type.numeric.java + # decimal integers + - match: \b{{ddigits0}}([lL])?\b scope: constant.numeric.integer.decimal.java captures: - 1: storage.type.numeric.long.java + 1: invalid.illegal.numeric.java + 2: storage.type.numeric.java - enums: - - match: '^(?=\s*[A-Z0-9_]+\s*({|\(|,|;))' - push: - - match: "(?=;|})" - pop: true - - match: \w+ - scope: constant.other.enum.java - push: - - meta_scope: meta.enum.java - - match: "(?=,|;|})" - pop: true - - include: parens - - match: "{" - scope: punctuation.section.braces.begin.java - push: - - meta_scope: meta.enum.body.java - - match: "}" - scope: punctuation.section.braces.end.java - pop: true - - include: class-body keywords: - match: '::' scope: punctuation.accessor.double-colon.java @@ -524,11 +596,10 @@ contexts: - match: '{{id}}' scope: variable.function.reference.java pop: true - - match: (?=\S) - pop: true + - include: any_POP - match: '\?|:' scope: keyword.operator.ternary.java - - match: \b(instanceof)\b + - match: \binstanceof\b scope: keyword.operator.word.instanceof.java - match: (<<|>>>?) scope: keyword.operator.bitshift.java @@ -546,47 +617,90 @@ contexts: captures: 1: punctuation.accessor.dot.java 2: variable.language.java + - include: punctuation-separator-comma - include: punctuation-terminator-semicolon - illegal-keywords: - - match: \b(goto|const)\b - scope: invalid.illegal.java - catch-block: - - match: \b(catch)\s*(\() - scope: meta.catch.java - captures: - 1: keyword.control.catch-exception.java - 2: punctuation.section.parens.begin.java - push: - - meta_content_scope: meta.catch.parameters.java - - match: \) - scope: meta.catch.java punctuation.section.parens.end.java - pop: true - - match: \| - scope: punctuation.separator.bar.java - - include: parameters + keywords-control: + # exceptions + - match: \bcatch\b + scope: keyword.control.exception.catch.java + push: + - meta_scope: meta.catch.java + - match: (?=\() + set: + - match: \( + scope: punctuation.section.parens.begin.java + set: + - meta_scope: meta.catch.parameters.java meta.parens.java + - match: \) + scope: punctuation.section.parens.end.java + pop: true + - match: \| + scope: punctuation.separator.bar.java + - include: parameters + - include: any_POP + - match: \bfinally\b + scope: keyword.control.exception.finally.java - match: \btry\b - scope: keyword.control.catch-exception.java + scope: keyword.control.exception.try.java push: declaration-statement-parens - - match: \b(finally|throw)\b - scope: keyword.control.catch-exception.java - - match: \b(return|break|case|continue|default|do|while|switch|if|else)\b - scope: keyword.control.java + # flow + - match: \bassert\b + scope: keyword.control.flow.assert.java + push: + - meta_scope: meta.assertion.java + - match: (?=;) + pop: true + - match: ':' + scope: punctuation.separator.expressions.java + - include: code + - match: \bbreak\b + scope: keyword.control.flow.break.java + - match: \bcontinue\b + scope: keyword.control.flow.continue.java + - match: \breturn\b + scope: keyword.control.flow.return.java + - match: \bthrow\b + scope: keyword.control.flow.throw.java + # conditional + - match: \bif\b + scope: keyword.control.conditional.if.java + - match: \belse\b + scope: keyword.control.conditional.else.java + - match: \bswitch\b + scope: keyword.control.conditional.switch.java + - match: \bcase\b + scope: keyword.control.conditional.case.java + - match: \bdefault\b + scope: keyword.control.conditional.default.java + # loop + - match: \bdo\b + scope: keyword.control.loop.do-while.java - match: \bfor\b - scope: keyword.control.java + scope: keyword.control.loop.for.java push: declaration-statement-parens + - match: \bwhile\b + scope: keyword.control.loop.while.java + + illegal-keywords: + - match: \b(goto|const)\b + scope: invalid.illegal.keyword.java + illegal-open-block: - match: \s?(?={) scope: invalid.illegal.stray-terminator-end pop: true + illegal-semicolon: - match: ; scope: invalid.illegal.stray-terminator-end pop: true + illegal-parens-terminators: # Pops the stack if anything matches - include: illegal-semicolon - include: illegal-open-block + method-invocations: - match: (\.)\s*(?=<) captures: @@ -603,7 +717,6 @@ contexts: pop: true - include: illegal-parens-terminators - include: code - - include: punctuation-separator-comma fields-and-methods: - match: \bvoid\b @@ -632,14 +745,11 @@ contexts: 2: meta.field.java push: [static-assignment, array-brackets] - include: punctuation-separator-comma - - match: ';' - scope: punctuation.terminator.java - pop: true - include: any_POP before-next-field: # Prevent style from being removed from whole file when making a new expression - - match: '(?=\b(?:{{storage_modifiers}}|{{primitives}}|void)\b)' + - match: (?=\b(?:{{storage_modifiers}}|{{primitives}}|void)\b) pop: true method: @@ -663,11 +773,11 @@ contexts: pop: true - include: throws - include: annotation-default - - match: "{" + - match: \{ scope: punctuation.section.block.begin.java set: - meta_scope: meta.method.java meta.method.body.java - - match: "}" + - match: \} scope: punctuation.section.block.end.java pop: true - include: code-block @@ -800,7 +910,7 @@ contexts: - include: inherited-object-type-reference-no-fqn inherited-object-type-reference-no-fqn: - - match: '{{classcase_id}}' + - match: (?!class|extends|implements|interface){{id}} scope: entity.other.inherited-class.java set: after-inherited-object-type-reference - include: any_POP @@ -892,7 +1002,7 @@ contexts: - include: punctuation-separator-comma lambdas: - - match: '(?={{lambda_lookahead}})' + - match: (?={{lambda_lookahead}}) push: lambda-params lambda-params: @@ -928,6 +1038,7 @@ contexts: pop: true - include: illegal-parens-terminators - include: code + declaration-statement-parens: - match: \( scope: punctuation.section.parens.begin.java @@ -971,15 +1082,15 @@ contexts: scope: keyword.operator.assignment.java push: - meta_scope: meta.assignment.rhs.java - - match: '(?=;|\)|\}|,)' + - match: (?=;|\)|\}|,) pop: true - include: code static-code-block: - - match: "{" + - match: \{ scope: punctuation.section.block.begin.java push: - meta_scope: meta.static.body.java - - match: "}" + - match: \} scope: punctuation.section.block.end.java pop: true - include: code-block @@ -987,36 +1098,38 @@ contexts: - match: \b{{storage_modifiers}}\b scope: storage.modifier.java stray-braces: - - match: '\}' + - match: \} scope: invalid.illegal.stray-brace-end stray-parens: - match: \) scope: invalid.illegal.stray-parens-end + strings: - - match: '"' + - match: \" scope: punctuation.definition.string.begin.java push: - meta_include_prototype: false - meta_scope: string.quoted.double.java - - match: (")|(\n) - captures: - 1: punctuation.definition.string.end.java - 2: invalid.illegal.newline.java + - match: \" + scope: punctuation.definition.string.end.java pop: true - - match: \\. - scope: constant.character.escape.java - - match: "'" + - include: strings-common + - match: \' scope: punctuation.definition.string.begin.java push: - meta_include_prototype: false - meta_scope: string.quoted.single.java - - match: (')|(\n) - captures: - 1: punctuation.definition.string.end.java - 2: invalid.illegal.newline.java + - match: \' + scope: punctuation.definition.string.end.java pop: true - - match: \\. - scope: constant.character.escape.java + - include: strings-common + + strings-common: + - match: \n + scope: invalid.illegal.newline.java + pop: true + - match: \\. + scope: constant.character.escape.java module: - match: (?=\b(?:open\s+)?module\b) diff --git a/Java/Symbol List%3A Classes.tmPreferences b/Java/Symbol List - Classes.tmPreferences similarity index 100% rename from Java/Symbol List%3A Classes.tmPreferences rename to Java/Symbol List - Classes.tmPreferences diff --git a/Java/Symbol List%3A Constants.tmPreferences b/Java/Symbol List - Constants.tmPreferences similarity index 100% rename from Java/Symbol List%3A Constants.tmPreferences rename to Java/Symbol List - Constants.tmPreferences diff --git a/Java/Symbol List%3A Inner Class Methods.tmPreferences b/Java/Symbol List - Inner Class Methods.tmPreferences similarity index 100% rename from Java/Symbol List%3A Inner Class Methods.tmPreferences rename to Java/Symbol List - Inner Class Methods.tmPreferences diff --git a/Java/Symbol List%3A Inner Classes.tmPreferences b/Java/Symbol List - Inner Classes.tmPreferences similarity index 100% rename from Java/Symbol List%3A Inner Classes.tmPreferences rename to Java/Symbol List - Inner Classes.tmPreferences diff --git a/Java/Symbol List%3A Inner Inner Class Methods.tmPreferences b/Java/Symbol List - Inner Inner Class Methods.tmPreferences similarity index 100% rename from Java/Symbol List%3A Inner Inner Class Methods.tmPreferences rename to Java/Symbol List - Inner Inner Class Methods.tmPreferences diff --git a/Java/Symbol List%3A Inner Inner Classes.tmPreferences b/Java/Symbol List - Inner Inner Classes.tmPreferences similarity index 100% rename from Java/Symbol List%3A Inner Inner Classes.tmPreferences rename to Java/Symbol List - Inner Inner Classes.tmPreferences diff --git a/Java/Symbol List%3A Method.tmPreferences b/Java/Symbol List - Method.tmPreferences similarity index 100% rename from Java/Symbol List%3A Method.tmPreferences rename to Java/Symbol List - Method.tmPreferences diff --git a/Java/syntax_test_java.java b/Java/syntax_test_java.java index 88a891e5b5..b1ad0ae2b0 100644 --- a/Java/syntax_test_java.java +++ b/Java/syntax_test_java.java @@ -145,16 +145,16 @@ public static void main(String... args) { // ^ meta.method.body.java punctuation.section.block.begin.java String[] strings = new String[5]; // ^^^^^^^^^^^^^^ meta.assignment.rhs.java -// ^^^ keyword.control.new.java +// ^^^ keyword.other.storage.new.java // ^ constant.numeric.integer.decimal printList(Arrays.stream(args) .collect(Collectors.toCollection(ArrayList::new))); -// ^^^ meta.method.body.java - keyword.control.new.java +// ^^^ meta.method.body.java - keyword.other.storage.new.java // ^^^ variable.function.reference.java // ^^ punctuation.accessor.double-colon.java anotherMethod(); try (Stream lines = Files.lines(path)) { -// ^^^ keyword.control.catch-exception.java +// ^^^ keyword.control.exception.try.java // ^^^^^^^^^^^^^^^^^^ meta.assignment.rhs.java // ^ - meta.parens.java // ^ meta.method.body.java - meta.assignment.rhs.java @@ -162,11 +162,17 @@ public static void main(String... args) { // ^^^^^^^ variable.function.reference.java } catch (IOException ignore) { -// ^^^^^ keyword.control.catch-exception.java +// ^^^^^^ meta.catch.java +// ^^^^^^^^^^^^^^^^^^^^ meta.catch.parameters.java meta.parens.java +// ^^^^^ keyword.control.exception.catch.java +// ^ punctuation.section.parens.begin.java // ^^^^^^^^^^^ support.class.java // ^^^^^^ variable.parameter +// ^ punctuation.section.parens.end.java } catch (final MyException | com.net.org.Foo.Bar | -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.catch +// ^^^^^^ meta.catch.java +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.catch.parameters.java meta.parens.java +// ^^^^^ keyword.control.exception.catch.java // ^ punctuation.section.parens.begin // ^ meta.catch.parameters storage.modifier.java // ^^^^^^^^^^^ support.class @@ -186,7 +192,7 @@ public static void main(String... args) { // ^ support.class // ^ variable.parameter // ^ meta.catch.parameters -// ^ punctuation.section.parens.end - meta.catch.parameters +// ^ punctuation.section.parens.end try (final InputStream is = new FileInputStream(args[0]); // ^^^^^ storage.modifier @@ -198,13 +204,13 @@ public static void main(String... args) { } try { -// ^^^ keyword.control.catch-exception.java +// ^^^ keyword.control.exception.try.java Class.forName(args[2]); } catch (Exception e) { -// ^^^^^ keyword.control.catch-exception.java +// ^^^^^ keyword.control.exception.catch.java log.error(e); } finally { -// ^^^^^^^ keyword.control.catch-exception.java +// ^^^^^^^ keyword.control.exception.finally.java } for (final int x = 10;;) { System.out.println(x); break; } @@ -301,6 +307,22 @@ class ExtendsAndImplementsTest extends Foo implements Bar, OtherBar {} // ^^^^^^^^ entity.other.inherited-class.java // ^ - meta.class.implements.java +class ExtendsAndImplementsTest extends Foo, Bar implements Bar, OtherBar {} +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class +// ^^^^^^^^^^^^^^^^^ meta.class.extends +// ^^^^^^^ keyword.declaration.extends.java +// ^^^ entity.other.inherited-class.java +// ^ punctuation.separator.comma.java +// ^^^ entity.other.inherited-class.java +// ^ - meta.class.extends +// ^^^^^^^^^^^^^^ meta.class.implements.java +// ^^^^^^^^^^ keyword.declaration.implements.java +// ^^^ entity.other.inherited-class.java +// ^^^^^ meta.generic.java +// ^ punctuation.separator.comma.java +// ^^^^^^^^ entity.other.inherited-class.java +// ^ - meta.class.implements.java + class AnyClass { // ^^^^^^^^ entity.name.class.java int bar; // this comment() is recognized as code @@ -327,6 +349,19 @@ public void test2(Type) abc } // <- punctuation.section.block.end.java +interface T extends A, BB {} +//^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.java +// ^^ meta.class.identifier.java +// ^^^^^^^^^^^^^^ meta.class.extends.java +// ^^ meta.class.body.java +// ^ entity.name.class.java +// ^^^^^^^ keyword.declaration.extends.java +// ^ entity.other.inherited-class.java +// ^ punctuation.separator.comma.java +// ^^ entity.other.inherited-class.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + public enum FooBaz { // ^^^^ storage.type.java //^^^^^^^^^^^^^^^^^^ meta.class @@ -357,6 +392,133 @@ enum MyEnum { // ^^^^^^^^^^^ comment } +public enum TokenKind extends MyEnum, FooBaz implements Foo, Bar { +//<- meta.class.java storage.modifier.java +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.java +//^^^^ storage.modifier.java +// ^^^^ storage.type.java +// ^^^^^^^^^ entity.name.class.java +// ^^^^^^^ keyword.declaration.extends.java +// ^^^^^^ entity.other.inherited-class.java +// ^ punctuation.separator.comma.java +// ^^^^^^ entity.other.inherited-class.java +// ^^^^^^^^^^ keyword.declaration.implements.java +// ^^^ entity.other.inherited-class.java +// ^ punctuation.separator.comma.java +// ^^^ entity.other.inherited-class.java +// ^ punctuation.section.block.begin.java + a, +// ^ constant.other.enum.java +// ^ punctuation.separator.comma.java + a(1, 2, 3), +// ^ constant.other.enum.java +// ^^^^^^^^^ meta.parens.java +// ^ punctuation.section.parens.begin.java +// ^ constant.numeric.integer.decimal.java +// ^ punctuation.separator.comma.java +// ^ constant.numeric.integer.decimal.java +// ^ punctuation.separator.comma.java +// ^ constant.numeric.integer.decimal.java +// ^ punctuation.section.parens.end.java +// ^ punctuation.separator.comma.java + a {}, +// ^ constant.other.enum.java +// ^ meta.block.java punctuation.section.block.begin.java +// ^ meta.block.java punctuation.section.block.end.java +// ^ punctuation.separator.comma.java + A, +// ^ constant.other.enum.java +// ^ punctuation.separator.comma.java + A(1), +// ^ constant.other.enum.java +// ^^^ meta.parens.java +// ^ punctuation.section.parens.begin.java +// ^ constant.numeric.integer.decimal.java +// ^ punctuation.section.parens.end.java +// ^ punctuation.separator.comma.java + A {}, +// ^ constant.other.enum.java +// ^ meta.block.java punctuation.section.block.begin.java +// ^ meta.block.java punctuation.section.block.end.java +// ^ punctuation.separator.comma.java + integerToken, +// ^^^^^^^^^^^^ constant.other.enum.java +// ^ punctuation.separator.comma.java + integerToken("integer literal"), +// ^^^^^^^^^^^^^^^^^^^ meta.parens.java +// ^^^^^^^^^^^^ constant.other.enum.java +// ^ punctuation.section.parens.begin.java +// ^^^^^^^^^^^^^^^^^ string.quoted.double.java +// ^ punctuation.section.parens.end.java +// ^ punctuation.separator.comma.java + integerToken {}; +// ^^^^^^^^^^^^ constant.other.enum.java +// ^ meta.block.java punctuation.section.block.begin.java +// ^ meta.block.java punctuation.section.block.end.java +// ^ punctuation.terminator.java + int {} +// ^^^ storage.type.primitive.java + static {} +// ^^^^^^ storage.modifier.java + String image = ""; +// ^^^^^^ support.class.java +// ^^^^^ meta.field.java +// ^ keyword.operator.assignment.java +// ^^ string.quoted.double.java +// ^ punctuation.terminator.java + TokenKind(String s) {} +// ^^^^^^^^^^^^^^^^^^^^^^ meta.method.java +// ^^^^^^^^^ meta.method.identifier.java entity.name.function.constructor.java +// ^^^^^^^^^^ meta.method.parameters.java meta.parens.java +// ^^ meta.method.body.java +// ^ punctuation.section.parens.begin.java +// ^^^^^^ support.class.java +// ^ variable.parameter.java +// ^ punctuation.section.parens.end.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java + public static void main(String[]a){} +// ^^^^^^^^^^^^^^ meta.class.java meta.class.body.java meta.block.java +// ^^^^^^^^^^^^^^^^^^^^^^ meta.class.java meta.class.body.java meta.block.java meta.method.java +// ^^^^ meta.method.identifier.java +// ^^^^^^^^^^^ meta.method.parameters.java meta.parens.java +// ^^ meta.method.body.java +// ^^^^^^ storage.modifier.java +// ^^^^^^ storage.modifier.java +// ^^^^ storage.type.void.java +// ^^^^ entity.name.function.java +// ^ punctuation.section.parens.begin.java +// ^^^^^^ support.class.java +// ^^ storage.modifier.array.java +// ^ variable.parameter.java +// ^ punctuation.section.parens.end.java +// ^ punctuation.section.block.begin.java +// ^ punctuation.section.block.end.java +} + +public // comment +//<- storage.modifier.java +enum // comment +//<- meta.class.java meta.class.identifier.java storage.type.java +TokenKind // comment +//<- meta.class.java meta.class.identifier.java entity.name.class.java +extends // comment +//<- meta.class.java meta.class.extends.java keyword.declaration.extends.java +MyEnum, // comment +//<- meta.class.java meta.class.extends.java entity.other.inherited-class.java +FooBaz // comment +//<- meta.class.java meta.class.extends.java entity.other.inherited-class.java +implements // comment +//<- meta.class.java meta.class.implements.java keyword.declaration.implements.java +Foo, // comment +//<- meta.class.java meta.class.implements.java entity.other.inherited-class.java +Bar // comment +//<- meta.class.java meta.class.implements.java entity.other.inherited-class.java +{ +//<- meta.class.java meta.class.body.java meta.block.java punctuation.section.block.begin.java +} +//<- meta.class.java meta.class.body.java meta.block.java punctuation.section.block.end.java + class InvalidStuff { goto @@ -718,11 +880,11 @@ public enum AbstractEnum { // ^^^^ storage.type.java FOO { //^^^ constant.other.enum -// ^ meta.enum.java meta.enum.body.java punctuation.section.braces.begin.java +// ^ meta.enum.java meta.enum.body.java meta.block.java punctuation.section.block.begin.java public void doSomething() { return; } // ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.method.java }, -//^ meta.enum.java meta.enum.body.java punctuation.section.braces.end.java +//^ meta.enum.java meta.enum.body.java meta.block.java punctuation.section.block.end.java BAR { //^^^ constant.other.enum public void doSomething() { return; } @@ -903,7 +1065,7 @@ public Foo( // ^ support.class.java // ^ variable.parameter.java return; -// ^ keyword.control.java +// ^^^^^^ keyword.control.flow.return.java } void bar$() {} @@ -1047,7 +1209,7 @@ class SubClass extends fully.qualified // ^ storage.type.function.anonymous.java // ^ meta.block punctuation.section.block.begin return 1; -// ^ keyword.control.java +// ^^^^^^ keyword.control.flow.return.java }; //^ meta.block punctuation.section.block.end // ^ punctuation.terminator @@ -1075,8 +1237,14 @@ class SubClass extends fully.qualified //^ meta.static.body.java punctuation.section.block.end.java int operators() { + + assert scale > -100 : foo == true; +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.assertion.java +// ^^^^^^ keyword.control.flow.assert.java +// ^ punctuation.separator.expressions.java +// if (this.scale<0) { -// ^^ keyword.control.java +// ^^ keyword.control.conditional.if.java // ^^^^^^^^^^^^^^ meta.parens.java // ^ punctuation.section.parens.begin // ^ punctuation.accessor.dot.java @@ -1084,7 +1252,7 @@ int operators() { // ^ constant.numeric.integer.decimal // ^ - meta.parens.java return foo<<32; -// ^^^^^^ keyword.control.java +// ^^^^^^ keyword.control.flow.return.java // ^^ keyword.operator.bitshift.java // ^^ constant.numeric.integer.decimal // ^ punctuation.terminator.java @@ -1100,6 +1268,7 @@ int operators() { // ^ punctuation.terminator.java return foo implements fully.qualified.Other { } // <- punctuation.section.block.end.java +public class Generic extends iNtf implements iNterface { +// ^^^^ entity.other.inherited-class.java +// ^^^^^^^^^ entity.other.inherited-class.java +// ^^^ meta.generic.java +// ^ punctuation.definition.generic.begin.java +// ^ support.class.java +// ^ punctuation.definition.generic.end.java +} +// <- punctuation.section.block.end.java + public class Bar { public void missingSemiColon() { boolean foo = foo diff --git a/Java/syntax_test_jsp.jsp b/Java/syntax_test_jsp.jsp index c55a06b43b..04c029daae 100644 --- a/Java/syntax_test_jsp.jsp +++ b/Java/syntax_test_jsp.jsp @@ -21,7 +21,7 @@ // ^^ punctuation.section.embedded.begin.jsp - source.java.embedded.html // ^ source.java.embedded.html if (!foo && !bar) { -// ^^ keyword.control.java +// ^^ keyword.control.conditional.if.java // ^ keyword.operator.logical.java // ^^ keyword.operator.logical.java %>
<% @@ -29,7 +29,7 @@ // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag // ^^ punctuation.section.embedded.begin.jsp - source.java.embedded.html if (foot.shouldBe()) { -// ^^ keyword.control.java +// ^^ keyword.control.conditional.if.java boolean test = false; // ^^^^^^^ storage.type // ^^^^^ constant diff --git a/JavaScript/Comments.tmPreferences b/JavaScript/Comments.tmPreferences index f16fa66e31..d24c0f708c 100644 --- a/JavaScript/Comments.tmPreferences +++ b/JavaScript/Comments.tmPreferences @@ -4,7 +4,7 @@ name Comments scope - source.js, source.json + source.js settings shellVariables diff --git a/JavaScript/JavaScript.sublime-syntax b/JavaScript/JavaScript.sublime-syntax index 17b4731449..05a4fed605 100644 --- a/JavaScript/JavaScript.sublime-syntax +++ b/JavaScript/JavaScript.sublime-syntax @@ -8,6 +8,13 @@ file_extensions: first_line_match: ^#!\s*/.*\b(node|js)\b scope: source.js variables: + bin_digit: '[01_]' + oct_digit: '[0-7_]' + dec_digit: '[0-9_]' + hex_digit: '[\h_]' + dec_integer: (?:0|[1-9]{{dec_digit}}*) + dec_exponent: (?:[Ee](?:[-+]|(?![-+])){{dec_digit}}*) + identifier_escape: (?:\\u(?:\h{4}|\{\h+\})) identifier_start: (?:[_$\p{L}\p{Nl}]|{{identifier_escape}}) identifier_part: (?:[_$\p{L}\p{Nl}\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{200C}\x{200D}]|{{identifier_escape}}) @@ -18,6 +25,11 @@ variables: dollar_only_identifier: (?:\${{identifier_break}}) dollar_identifier: '(?:(\$){{identifier_part}}*{{identifier_break}})' + block_comment_contents: (?:(?:[^*]|\*(?!/))*) + block_comment: (?:/\*{{block_comment_contents}}\*/) + nothing: (?x:(?:\s+|{{block_comment}})*) + line_ending_ahead: (?={{nothing}}(?:/\*{{block_comment_contents}})?$) + # https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar reserved_word: |- (?x: @@ -52,7 +64,7 @@ variables: func_lookahead: |- (?x: \s* - (?:async\s+)? + (?:async{{identifier_break}}{{nothing}})? function{{identifier_break}} ) @@ -70,7 +82,7 @@ variables: method_lookahead: |- (?x:(?= - (?: get|set|async ){{identifier_break}} + (?: get|set|async ){{identifier_break}}(?!\s*:) | \* | {{property_name}} \s* \( )) @@ -86,17 +98,22 @@ variables: ) )) + dot_accessor: |- + (?x: # Match . and .?, but not .?( or .?[ + \. + (?! \? [\[(] ) + \?? + ) + contexts: main: - - include: comments - include: comments-top-level - match: '\)|\}|\]' scope: invalid.illegal.stray-bracket-end.js # Don't pop or embedding could break. - - match: (?=\S) - push: statement + - include: statements prototype: - include: comments @@ -110,6 +127,9 @@ contexts: - match: \*/ scope: punctuation.definition.comment.end.js pop: true + - match: ^\s*(\*)(?!/) + captures: + 1: punctuation.definition.comment.js - match: /\* scope: punctuation.definition.comment.begin.js push: @@ -145,14 +165,14 @@ contexts: scope: punctuation.separator.comma.js import-export: - - match: import{{identifier_break}}(?!\s*\.) + - match: import{{identifier_break}}(?!{{nothing}}[.(]) scope: keyword.control.import-export.js set: - meta_scope: meta.import.js - - match: (?=\.) # Recovery for import.meta + - match: (?=[.(]) # Recovery for import expressions set: - expression-statement-end - - import-meta-expression-dot + - import-expression-end - match: (?=\S) set: - import-meta @@ -166,6 +186,7 @@ contexts: - export-extended import-meta: + - meta_include_prototype: false - meta_scope: meta.import.js - include: immediately-pop @@ -232,6 +253,7 @@ contexts: - include: else-pop export-meta: + - meta_include_prototype: false - meta_scope: meta.export.js - include: immediately-pop @@ -307,30 +329,35 @@ contexts: - include: label - include: variable-declaration - - match: throw{{identifier_break}} - scope: keyword.control.trycatch.js - set: restricted-production + - match: break{{identifier_break}} + scope: keyword.control.flow.break.js + set: + - expect-semicolon + - expect-label - - match: (?:break|continue){{identifier_break}} - scope: keyword.control.loop.js + - match: continue{{identifier_break}} + scope: keyword.control.flow.continue.js set: - expect-semicolon - expect-label + - match: debugger{{identifier_break}} + scope: keyword.control.flow.debugger.js + set: expect-semicolon + - match: return{{identifier_break}} - scope: keyword.control.flow.js + scope: keyword.control.flow.return.js set: restricted-production - - match: debugger{{identifier_break}} - scope: keyword.other.debugger.js - set: expect-semicolon + - match: throw{{identifier_break}} + scope: keyword.control.flow.throw.js + set: restricted-production - include: function-or-class-declaration - include: decorator - - match: (?=\S) - set: expression-statement + - include: expression-statement expect-semicolon: - match: \; @@ -339,15 +366,17 @@ contexts: - include: else-pop expect-label: - - match: '{{non_reserved_identifier}}' - scope: variable.label.js - pop: true - - match: '{{identifier}}' - scope: invalid.illegal.identifier.js variable.label.js - pop: true - - match: $ - pop: true - - include: else-pop + - meta_include_prototype: false + - match: '(?={{nothing}}{{identifier}})' + set: + - match: '{{non_reserved_identifier}}' + scope: variable.label.js + pop: true + - match: '{{identifier}}' + scope: invalid.illegal.identifier.js variable.label.js + pop: true + - include: else-pop + - include: immediately-pop block: - match: '\{' @@ -435,7 +464,7 @@ contexts: - include: else-pop variable-binding-list-top: - - match: \n + - match: '{{line_ending_ahead}}' set: - match: '{{line_continuation_lookahead}}' set: variable-binding-top @@ -553,7 +582,7 @@ contexts: - expression-begin expression-statement-end: - - match: \n + - match: '{{line_ending_ahead}}' set: - match: '{{line_continuation_lookahead}}' set: expression-statement-end @@ -561,9 +590,10 @@ contexts: - include: expression-end restricted-production: - - match: \n + - meta_include_prototype: false + - match: '{{line_ending_ahead}}' pop: true - - match: (?=\S) + - match: '' set: expression-statement expect-case-colon: @@ -574,21 +604,21 @@ contexts: conditional: - match: switch{{identifier_break}} - scope: keyword.control.switch.js + scope: keyword.control.conditional.switch.js set: - switch-meta - switch-block - expect-parenthesized-expression - match: do{{identifier_break}} - scope: keyword.control.loop.js + scope: keyword.control.loop.do-while.js set: - do-while-meta - do-while-condition - block-scope - match: for{{identifier_break}} - scope: keyword.control.loop.js + scope: keyword.control.loop.for.js set: - for-meta - block-scope @@ -596,46 +626,53 @@ contexts: - for-await - match: while{{identifier_break}} - scope: keyword.control.loop.js + scope: keyword.control.loop.while.js set: - while-meta - block-scope - expect-parenthesized-expression - match: with{{identifier_break}} - scope: keyword.control.with.js + scope: keyword.control.import.with.js set: - with-meta - block-scope - expect-parenthesized-expression - - match: (?:else\s+if|if){{identifier_break}} - scope: keyword.control.conditional.js + - match: if{{identifier_break}} + scope: keyword.control.conditional.if.js + set: + - conditional-meta + - block-scope + - expect-parenthesized-expression + + - match: else\s+if{{identifier_break}} + scope: keyword.control.conditional.elseif.js set: - conditional-meta - block-scope - expect-parenthesized-expression - match: else{{identifier_break}} - scope: keyword.control.conditional.js + scope: keyword.control.conditional.else.js set: - conditional-meta - block-scope - match: try{{identifier_break}} - scope: keyword.control.trycatch.js + scope: keyword.control.exception.try.js set: - try-meta - block-scope - match: finally{{identifier_break}} - scope: keyword.control.trycatch.js + scope: keyword.control.exception.finally.js set: - finally-meta - block-scope - match: catch{{identifier_break}} - scope: keyword.control.trycatch.js + scope: keyword.control.exception.catch.js set: - catch-meta - block-scope @@ -646,44 +683,53 @@ contexts: - include: else-pop switch-meta: + - meta_include_prototype: false - meta_scope: meta.switch.js - include: immediately-pop do-while-meta: + - meta_include_prototype: false - meta_scope: meta.do-while.js - include: immediately-pop for-meta: + - meta_include_prototype: false - meta_scope: meta.for.js - include: immediately-pop while-meta: + - meta_include_prototype: false - meta_scope: meta.while.js - include: immediately-pop with-meta: + - meta_include_prototype: false - meta_scope: meta.with.js - include: immediately-pop conditional-meta: + - meta_include_prototype: false - meta_scope: meta.conditional.js - include: immediately-pop try-meta: + - meta_include_prototype: false - meta_scope: meta.try.js - include: immediately-pop finally-meta: + - meta_include_prototype: false - meta_scope: meta.finally.js - include: immediately-pop catch-meta: + - meta_include_prototype: false - meta_scope: meta.catch.js - include: immediately-pop for-await: - match: await{{identifier_break}} - scope: keyword.control.loop.js + scope: keyword.control.flow.await.js pop: true - include: else-pop @@ -741,6 +787,7 @@ contexts: - include: else-pop block-meta: + - meta_include_prototype: false - meta_scope: meta.block.js - include: immediately-pop @@ -758,13 +805,13 @@ contexts: pop: true - match: case{{identifier_break}} - scope: keyword.control.switch.js + scope: keyword.control.conditional.case.js push: - expect-case-colon - expression - match: default{{identifier_break}} - scope: keyword.control.switch.js + scope: keyword.control.conditional.default.js push: - expect-case-colon @@ -772,7 +819,7 @@ contexts: do-while-condition: - match: while{{identifier_break}} - scope: keyword.control.loop.js + scope: keyword.control.loop.while.js set: parenthesized-expression - include: else-pop @@ -785,6 +832,7 @@ contexts: - decorator-expression-begin decorator-meta: + - meta_include_prototype: false - meta_scope: meta.annotation.js - include: immediately-pop @@ -794,7 +842,7 @@ contexts: pop: true decorator-expression-end: - - match: \. + - match: '{{dot_accessor}}' scope: punctuation.accessor.js push: - include: decorator-name @@ -811,11 +859,13 @@ contexts: pop: true expression: - - match: (?=\S) + - meta_include_prototype: false + - match: '' set: [ expression-end, expression-begin ] expression-no-comma: - - match: (?=\S) + - meta_include_prototype: false + - match: '' set: [ expression-end-no-comma, expression-begin ] expression-list: @@ -827,15 +877,13 @@ contexts: left-expression-end: - include: expression-break - - include: property-access - - match: (?=`) push: literal-string-template - - match: (?=\() + - match: (?=(?:\.\?)?\() push: function-call-arguments - - include: fallthrough + - include: property-access - include: else-pop @@ -877,7 +925,11 @@ contexts: - include: either-function-declaration - include: object-literal - - include: parenthesized-expression + - match: (?=\() + branch_point: parens + branch: + - parens1 + - parens2 - include: array-literal - include: literal-call @@ -885,20 +937,44 @@ contexts: - include: else-pop - fallthrough: - # If an arrow function has the ( and ) on different lines, we won't have matched - - match: => - scope: storage.type.function.arrow.js + parens1: + - match: \( + scope: punctuation.section.group.begin.js push: - - function-meta + - meta_scope: meta.group.js + - match: \) + scope: punctuation.section.group.end.js + set: + - match: (?==>) + fail: parens + - include: comments + - match: (?=\S) + pop: 3 + - match: (?=\S) + push: expression + + parens2: + - match: '' + push: + - function-meta-parens - arrow-function-expect-body + - function-declaration-meta + - arrow-function-expect-arrow + - arrow-function-expect-parameters + - function-declaration-expect-async + + function-meta-parens: + - meta_include_prototype: false + - meta_scope: meta.function.js + - match: '' + pop: 3 literal-string: - match: "'" scope: punctuation.definition.string.begin.js set: - meta_include_prototype: false - - meta_scope: string.quoted.single.js + - meta_scope: meta.string.js string.quoted.single.js - match: \' scope: punctuation.definition.string.end.js pop: true @@ -910,7 +986,7 @@ contexts: scope: punctuation.definition.string.begin.js set: - meta_include_prototype: false - - meta_scope: string.quoted.double.js + - meta_scope: meta.string.js string.quoted.double.js - match: \" scope: punctuation.definition.string.end.js pop: true @@ -929,18 +1005,18 @@ contexts: scope: punctuation.definition.string.begin.js set: - meta_include_prototype: false - - meta_scope: string.template.js + - meta_scope: meta.string.js string.quoted.other.js - match: "`" scope: punctuation.definition.string.end.js pop: true - match: '\$\{' - scope: punctuation.definition.template-expression.begin.js + scope: punctuation.section.interpolation.begin.js push: - clear_scopes: 1 - - meta_scope: meta.template.expression.js - - meta_content_scope: source.js.embedded.expression + - meta_scope: meta.interpolation.js + - meta_content_scope: source.js.embedded - match: '\}' - scope: punctuation.definition.template-expression.end.js + scope: punctuation.section.interpolation.end.js pop: true - match: (?=\S) push: expression @@ -959,12 +1035,12 @@ contexts: regexp: - meta_include_prototype: false - - meta_scope: string.regexp.js + - meta_scope: meta.string.js string.regexp.js - match: "/" scope: punctuation.definition.string.end.js set: - meta_include_prototype: false - - meta_content_scope: string.regexp.js + - meta_content_scope: meta.string.js string.regexp.js - match: '[gimyus]' scope: keyword.other.js - match: '[A-Za-z0-9]' # Ignore unknown flags for future-compatibility @@ -990,6 +1066,7 @@ contexts: - constructor-body-expect-class-begin constructor-meta: + - meta_include_prototype: false - meta_scope: meta.function-call.constructor.js - include: immediately-pop @@ -1054,7 +1131,7 @@ contexts: - match: in{{identifier_break}} scope: keyword.operator.js push: expression-begin - - match: '&&|\|\|' + - match: '&&|\|\||\?\?' scope: keyword.operator.logical.js push: expression-begin - match: '=(?![=>])' @@ -1135,7 +1212,7 @@ contexts: yield-expression: - match: yield{{identifier_break}} - scope: keyword.control.flow.js + scope: keyword.control.flow.yield.js set: - match: $ pop: true @@ -1147,7 +1224,7 @@ contexts: await-expression: - match: await{{identifier_break}} - scope: keyword.control.flow.js + scope: keyword.control.flow.await.js class: - match: class{{identifier_break}} @@ -1159,6 +1236,7 @@ contexts: - class-name class-meta: + - meta_include_prototype: false - meta_scope: meta.class.js - include: immediately-pop @@ -1210,7 +1288,7 @@ contexts: pop: true inherited-class-expression-end: - - match: \. + - match: '{{dot_accessor}}' scope: punctuation.accessor.js push: - include: inherited-class-name @@ -1307,7 +1385,7 @@ contexts: - literal-variable-base expect-dot-accessor: - - match: '\.' + - match: '{{dot_accessor}}' scope: punctuation.accessor.js pop: true - include: else-pop @@ -1331,6 +1409,7 @@ contexts: - include: else-pop function-name-meta: + - meta_include_prototype: false - meta_scope: entity.name.function.js - include: immediately-pop @@ -1341,6 +1420,7 @@ contexts: set: arrow-function-declaration function-declaration: + - meta_include_prototype: false - match: '' set: - function-meta @@ -1401,6 +1481,7 @@ contexts: - include: else-pop arrow-function-declaration: + - meta_include_prototype: false - match: '' set: - function-meta @@ -1461,7 +1542,7 @@ contexts: set: object-literal-contents object-literal-contents: - - meta_scope: meta.object-literal.js + - meta_scope: meta.mapping.js - match: '\}' scope: punctuation.section.block.end.js @@ -1488,17 +1569,27 @@ contexts: - match: '{{identifier}}(?=\s*(?:[},]|$|//|/\*))' scope: variable.other.readwrite.js + - match: (?=\[) - push: computed-property-name + push: + - object-literal-meta-key + - computed-property-name + - match: (?=\"|') push: - object-literal-meta-key - literal-string - - include: bare-property-name + - match: (?=[-+]?(?:\.[0-9]|0[bxo]|\d)) push: - - meta_scope: meta.object-literal.key.js - - include: literal-number + - object-literal-meta-key + - literal-number + + # - include: bare-property-name + - match: (?={{identifier}}) + push: + - object-literal-meta-key + - bare-property-name - include: comma-separator - match: ':' @@ -1512,14 +1603,8 @@ contexts: push: expression-no-comma bare-property-name: - - match: '{{dollar_only_identifier}}' - scope: meta.object-literal.key.dollar.only.js punctuation.dollar.js - - match: '{{dollar_identifier}}' - scope: meta.object-literal.key.dollar.js - captures: - 1: punctuation.dollar.js - match: '{{identifier}}' - scope: meta.object-literal.key.js + pop: true computed-property-name: - match: \[ @@ -1532,7 +1617,7 @@ contexts: push: expression object-literal-meta-key: - - meta_scope: meta.object-literal.key.js + - meta_scope: meta.mapping.key.js - include: else-pop object-literal-expect-colon: @@ -1542,7 +1627,7 @@ contexts: method-name: - match: '{{dollar_identifier}}' - scope: meta.object-literal.key.dollar.js entity.name.function.js + scope: meta.mapping.key.dollar.js entity.name.function.js captures: 1: punctuation.dollar.js pop: true @@ -1553,7 +1638,7 @@ contexts: scope: punctuation.definition.string.begin.js set: - meta_include_prototype: false - - meta_scope: string.quoted.single.js + - meta_scope: meta.string.js string.quoted.single.js - meta_content_scope: entity.name.function.js - match: \' scope: punctuation.definition.string.end.js @@ -1566,7 +1651,7 @@ contexts: scope: punctuation.definition.string.begin.js set: - meta_include_prototype: false - - meta_scope: string.quoted.double.js + - meta_scope: meta.string.js string.quoted.double.js - meta_content_scope: entity.name.function.js - match: \" scope: punctuation.definition.string.end.js @@ -1583,7 +1668,7 @@ contexts: field-name: - match: '{{dollar_identifier}}' - scope: meta.object-literal.key.dollar.js variable.other.readwrite.js + scope: meta.mapping.key.dollar.js variable.other.readwrite.js captures: 1: punctuation.dollar.js pop: true @@ -1594,7 +1679,7 @@ contexts: scope: punctuation.definition.string.begin.js set: - meta_include_prototype: false - - meta_scope: string.quoted.single.js + - meta_scope: meta.string.js string.quoted.single.js - meta_content_scope: variable.other.readwrite.js - match: \' scope: punctuation.definition.string.end.js @@ -1607,7 +1692,7 @@ contexts: scope: punctuation.definition.string.begin.js set: - meta_include_prototype: false - - meta_scope: string.quoted.double.js + - meta_scope: meta.string.js string.quoted.double.js - meta_content_scope: variable.other.readwrite.js - match: \" scope: punctuation.definition.string.end.js @@ -1627,6 +1712,7 @@ contexts: - include: else-pop method-declaration: + - meta_include_prototype: false - match: '' set: - function-meta @@ -1656,8 +1742,10 @@ contexts: push: expression function-call-arguments: - - match: \( - scope: punctuation.section.group.begin.js + - match: (\.\?)?(\() + captures: + 1: punctuation.accessor.js + 2: punctuation.section.group.begin.js set: - meta_scope: meta.group.js - match: \) @@ -1676,8 +1764,10 @@ contexts: - include: expression-list property-access: - - match: '\[' - scope: punctuation.section.brackets.begin.js + - match: (\.\?)?(\[) + captures: + 1: punctuation.accessor.js + 2: punctuation.section.brackets.begin.js push: - meta_scope: meta.brackets.js - match: '\]' @@ -1686,10 +1776,10 @@ contexts: - match: (?=\S) push: expression - - match: \. + - match: \.(?:\?)? scope: punctuation.accessor.js push: - - match: '(?={{identifier}}\s*\()' + - match: '(?={{identifier}}\s*(?:\.\?)?\()' set: - call-method-meta - function-call-arguments @@ -1698,79 +1788,77 @@ contexts: - include: object-property literal-number: - - match: '[+-]?0[0-9]+{{identifier_break}}' - scope: constant.numeric.octal.js invalid.deprecated.numeric.octal.js + # floats + - match: |- + (?x: + # 1., 1.1, 1.1e1, 1.1e-1, 1.e1, 1.e-1 | 1e1, 1e-1 + {{dec_integer}} (?: (\.) {{dec_digit}}* {{dec_exponent}}? | {{dec_exponent}} ) + # .1, .1e1, .1e-1 + | (\.) {{dec_digit}}+ {{dec_exponent}}? + ){{identifier_break}} + scope: constant.numeric.float.decimal.js + captures: + 1: punctuation.separator.decimal.js + 2: punctuation.separator.decimal.js pop: true - - match: '[+-]?(0[Xx])[0-9a-fA-F_]*(n)?{{identifier_break}}' - scope: constant.numeric.hexadecimal.js - captures: - 1: punctuation.definition.numeric.hexadecimal.js - 2: storage.type.numeric.bigint.js + # integers + - match: 0{{dec_digit}}+{{identifier_break}} + scope: constant.numeric.integer.octal.js invalid.deprecated.numeric.octal.js pop: true - - match: '[+-]?(0[Oo])[0-7_]*(n)?{{identifier_break}}' - scope: constant.numeric.octal.js + - match: (0[Xx]){{hex_digit}}*(n)?{{identifier_break}} + scope: constant.numeric.integer.hexadecimal.js captures: - 1: punctuation.definition.numeric.octal.js - 2: storage.type.numeric.bigint.js + 1: punctuation.definition.numeric.base.js + 2: storage.type.numeric.js pop: true - - match: '[+-]?(0[Bb])[0-1_]*(n)?{{identifier_break}}' - scope: constant.numeric.binary.js + - match: (0[Oo]){{oct_digit}}*(n)?{{identifier_break}} + scope: constant.numeric.integer.octal.js captures: - 1: punctuation.definition.numeric.binary.js - 2: storage.type.numeric.bigint.js + 1: punctuation.definition.numeric.base.js + 2: storage.type.numeric.js pop: true - - match: '[+-]?(?:0|[1-9][0-9_]*)(n){{identifier_break}}' - scope: constant.numeric.decimal.js + - match: (0[Bb]){{bin_digit}}*(n)?{{identifier_break}} + scope: constant.numeric.integer.binary.js captures: - 1: storage.type.numeric.bigint.js + 1: punctuation.definition.numeric.base.js + 2: storage.type.numeric.js pop: true - - match: |- - (?x) - [-+]? - ( - (?:0|[1-9][0-9_]*) - (?:\.[0-9_]*|(?!\.)) - | - \.[0-9_]+ - ) - (?:[Ee](?:[+-]|(?![-+]))[0-9_]*)? - {{identifier_break}} - scope: constant.numeric.decimal.js + - match: '{{dec_integer}}(n|(?!\.)){{identifier_break}}' + scope: constant.numeric.integer.decimal.js + captures: + 1: storage.type.numeric.js pop: true - - match: '[+-]?0[Xx]{{identifier_part}}+{{identifier_break}}' + # illegal numbers + - match: 0[Xx]{{identifier_part}}+ scope: invalid.illegal.numeric.hexadecimal.js pop: true - - match: '[+-]?0[Oo]{{identifier_part}}+{{identifier_break}}' - scope: invalid.illegal.numeric.octal.js - pop: true - - - match: '[+-]?0[Bb]{{identifier_part}}+{{identifier_break}}' + - match: 0[Bb]{{identifier_part}}+ scope: invalid.illegal.numeric.binary.js pop: true - - match: '[+-]?0{{identifier_part}}+{{identifier_break}}' + - match: 0{{identifier_part}}+ scope: invalid.illegal.numeric.octal.js pop: true - - match: '[+-]?[1-9]{{identifier_part}}+{{identifier_break}}(?:\.{{identifier_part}}*{{identifier_break}})?' + - match: '[1-9]{{identifier_part}}+(?:\.{{identifier_part}}*)?' scope: invalid.illegal.numeric.decimal.js pop: true literal-call: - - match: (?={{identifier}}\s*\() + - match: (?={{identifier}}\s*(?:\.\?)?\() set: - call-function-meta - function-call-arguments - literal-variable - - match: (?={{identifier}}\s*(?:\.\s*{{identifier}}\s*)+\() + - match: (?={{identifier}}\s*(?:\.\s*{{identifier}}\s*)+(?:\.\?)?\() set: - call-method-meta - function-call-arguments @@ -1778,16 +1866,18 @@ contexts: - literal-variable call-path: - - match: \. + - match: '{{dot_accessor}}' scope: punctuation.accessor.js push: object-property - include: else-pop call-function-meta: + - meta_include_prototype: false - meta_scope: meta.function-call.js - include: else-pop call-method-meta: + - meta_include_prototype: false - meta_scope: meta.function-call.method.js - include: else-pop @@ -1815,7 +1905,7 @@ contexts: scope: support.class.js pop: true - - match: (?={{identifier}}\s*\() + - match: (?={{identifier}}\s*(?:\.\?)?\() set: call-function-name - include: literal-variable-base @@ -1876,7 +1966,7 @@ contexts: - match: Array{{identifier_break}} scope: support.class.builtin.js set: - - match: \. + - match: '{{dot_accessor}}' scope: punctuation.accessor.js set: - include: support-property-ecma-array @@ -1887,7 +1977,7 @@ contexts: - match: ArrayBuffer{{identifier_break}} scope: support.class.builtin.js set: - - match: \. + - match: '{{dot_accessor}}' scope: punctuation.accessor.js set: - include: support-property-ecma-arraybuffer @@ -1898,7 +1988,7 @@ contexts: - match: Atomics{{identifier_break}} scope: support.constant.builtin.js set: - - match: \. + - match: '{{dot_accessor}}' scope: punctuation.accessor.js set: - include: support-property-ecma-atomics @@ -1909,7 +1999,7 @@ contexts: - match: BigInt{{identifier_break}} scope: support.class.builtin.js set: - - match: \. + - match: '{{dot_accessor}}' scope: punctuation.accessor.js set: - include: support-property-ecma-bigint @@ -1920,7 +2010,7 @@ contexts: - match: Date{{identifier_break}} scope: support.class.builtin.js set: - - match: \. + - match: '{{dot_accessor}}' scope: punctuation.accessor.js set: - include: support-property-ecma-date @@ -1931,7 +2021,7 @@ contexts: - match: JSON{{identifier_break}} scope: support.constant.builtin.js set: - - match: \. + - match: '{{dot_accessor}}' scope: punctuation.accessor.js set: - include: support-property-ecma-json @@ -1942,7 +2032,7 @@ contexts: - match: Math{{identifier_break}} scope: support.constant.builtin.js set: - - match: \. + - match: '{{dot_accessor}}' scope: punctuation.accessor.js set: - include: support-property-ecma-math @@ -1953,7 +2043,7 @@ contexts: - match: Number{{identifier_break}} scope: support.class.builtin.js set: - - match: \. + - match: '{{dot_accessor}}' scope: punctuation.accessor.js set: - include: support-property-ecma-number @@ -1964,7 +2054,7 @@ contexts: - match: Object{{identifier_break}} scope: support.class.builtin.js set: - - match: \. + - match: '{{dot_accessor}}' scope: punctuation.accessor.js set: - include: support-property-ecma-object @@ -1975,7 +2065,7 @@ contexts: - match: Promise{{identifier_break}} scope: support.class.builtin.js set: - - match: \. + - match: '{{dot_accessor}}' scope: punctuation.accessor.js set: - include: support-property-ecma-promise @@ -1986,7 +2076,7 @@ contexts: - match: Proxy{{identifier_break}} scope: support.class.builtin.js set: - - match: \. + - match: '{{dot_accessor}}' scope: punctuation.accessor.js set: - include: support-property-ecma-proxy @@ -1997,7 +2087,7 @@ contexts: - match: Reflect{{identifier_break}} scope: support.constant.builtin.js set: - - match: \. + - match: '{{dot_accessor}}' scope: punctuation.accessor.js set: - include: support-property-ecma-reflect @@ -2008,7 +2098,7 @@ contexts: - match: String{{identifier_break}} scope: support.class.builtin.js set: - - match: \. + - match: '{{dot_accessor}}' scope: punctuation.accessor.js set: - include: support-property-ecma-string @@ -2019,7 +2109,7 @@ contexts: - match: Symbol{{identifier_break}} scope: support.class.builtin.js set: - - match: \. + - match: '{{dot_accessor}}' scope: punctuation.accessor.js set: - include: support-property-ecma-symbol @@ -2040,7 +2130,7 @@ contexts: ) scope: support.class.builtin.js set: - - match: \. + - match: '{{dot_accessor}}' scope: punctuation.accessor.js set: - include: support-property-ecma-typedarray @@ -2053,18 +2143,13 @@ contexts: scope: support.class.builtin.js pop: true - match: (?:Eval|Range|Reference|Syntax|Type|URI)?Error{{identifier_break}} - scope: support.class.error.js + scope: support.class.builtin.js pop: true - match: (?:eval|isFinite|isNaN|parseFloat|parseInt|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent){{identifier_break}} scope: support.function.js pop: true - # Annex B - - match: (?:escape|unescape){{identifier_break}} - scope: invalid.deprecated.js support.function.js - pop: true - support-property-ecma-array: - match: (?:from|isArray|of){{identifier_break}} scope: support.function.builtin.js @@ -2117,7 +2202,7 @@ contexts: pop: true support-property-ecma-promise: - - match: (?:all|race|reject|resolve){{identifier_break}} + - match: (?:all|race|reject|resolve|allSettled|any){{identifier_break}} scope: support.function.builtin.js pop: true @@ -2154,7 +2239,7 @@ contexts: - match: console{{identifier_break}} scope: support.type.object.console.js set: - - match: \. + - match: '{{dot_accessor}}' scope: punctuation.accessor.js set: builtin-console-properties - include: else-pop @@ -2182,7 +2267,7 @@ contexts: - match: process{{identifier_break}} scope: support.constant.node.js set: - - match: \. + - match: '{{dot_accessor}}' scope: punctuation.accessor.js set: - include: support-property-node-process @@ -2193,10 +2278,11 @@ contexts: # Module-level variables - match: (?:__dirname|__filename|exports){{identifier_break}} scope: support.constant.node.js + pop: true - match: module{{identifier_break}} scope: support.constant.node.js set: - - match: \. + - match: '{{dot_accessor}}' scope: punctuation.accessor.js set: - include: support-property-node-module @@ -2243,7 +2329,7 @@ contexts: - include: support-property - - match: '(?={{identifier}}\s*\()' + - match: '(?={{identifier}}\s*(?:\.\?)?\()' set: call-method-name - include: object-property-base @@ -2264,6 +2350,11 @@ contexts: - match: '{{identifier_part}}+{{identifier_break}}' scope: invalid.illegal.illegal-identifier.js pop: true + - match: (#)({{identifier}}) + captures: + 1: punctuation.definition.variable.js + 2: meta.property.object.js + pop: true support-property: - include: support-property-ecma @@ -2286,13 +2377,16 @@ contexts: pop: true - match: (?:__defineGetter__|__defineSetter__|__lookupGetter__){{identifier_break}} scope: invalid.deprecated.js support.function.js + pop: true import-meta-expression: - match: import{{identifier_break}} - scope: variable.language.import.js - set: import-meta-expression-dot + scope: keyword.import.js + set: import-expression-end - import-meta-expression-dot: + import-expression-end: + - match: (?=\() + set: function-call-arguments - match: \. scope: punctuation.accessor.js set: diff --git a/JavaScript/tests/syntax_test_js.js b/JavaScript/tests/syntax_test_js.js index a3563e8ff1..30a3ae25dd 100644 --- a/JavaScript/tests/syntax_test_js.js +++ b/JavaScript/tests/syntax_test_js.js @@ -32,6 +32,9 @@ import import; // <- keyword.control.import-export +import;/**/ +// ^ - meta.import + export { name1, name2 as name3 }; //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.export //^ keyword.control.import-export @@ -157,6 +160,9 @@ export export; // <- keyword.control.import-export +export;/**/ +// ^ - meta.export + import * as alias from "module"; // ^^^^^^^^^^^^^^^^^^^^^ meta.import.js @@ -198,13 +204,13 @@ export default$ let x = import.meta; // ^^^^^^^^^^^ - meta.import -// ^^^^^^ variable.language.import +// ^^^^^^ keyword.import // ^ punctuation.accessor // ^^^^ variable.language.import import.meta; // ^^^^^^^^^^^ - meta.import -// ^^^^^^ variable.language.import +// ^^^^^^ keyword.import // ^ punctuation.accessor // ^^^^ variable.language.import @@ -214,14 +220,22 @@ let x = import.meta; // ^ punctuation.accessor // ^^^^ variable.language.import + import('foo'); +// ^^^^^^ keyword.import +// ^^^^^^^ meta.group + + import + ('foo'); +// ^^^^^^^ meta.group + // This object literal is technically broken since foo() does not have a // method body, but we include it here to ensure that highlighting is not // broken as the user is typing let a = { otherIdentifier, foo(), baz: 1 } -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.object-literal +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.mapping // ^^^^^^^^^^^^^^^ variable.other.readwrite // ^^^ entity.name.function -// ^^^ meta.object-literal.key +// ^^^ meta.mapping.key someFunction({ prop1, prop2, prop3 @@ -256,13 +270,19 @@ someFunction({ } + async /**//**//**/ function foo() {} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function + // Better highlighting when typing function function() {} // <- storage.type.function - entity.name.function +function foo(){}/**/ +// ^ - meta.function + if (true) -// <- keyword.control.conditional +// <- keyword.control.conditional.if { bar() } @@ -276,6 +296,11 @@ if (true) */ // <- comment.block.documentation punctuation.definition.comment.end +/** + * +// ^ comment.block.documentation.js punctuation.definition.comment.js +*/ + /* // <- comment.block punctuation.definition.comment */ @@ -380,20 +405,27 @@ var str2 = NaN; // ^^^ constant.language.nan tag`Hello ${ a + b } world\nanother ${expression}.`; -// <- variable.function.tagged-template.js -// ^ punctuation.definition.string.begin.js -// ^ string.template.js -// ^ punctuation.definition.template-expression.begin.js -// ^ variable.other.readwrite.js -// ^ keyword.operator.arithmetic.js -// ^ meta.template.expression.js source.js.embedded.expression -// ^ punctuation.definition.template-expression.end.js -// ^ constant.character.escape.js -// ^ punctuation.definition.string.end.js +// <- variable.function.tagged-template +// ^ punctuation.definition.string.begin +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string +// ^^^^^^^ string.quoted.other +// ^^^^^^^^^^ meta.interpolation - string +// ^ punctuation.section.interpolation.begin +// ^ variable.other.readwrite +// ^ keyword.operator.arithmetic +// ^ source.js.embedded +// ^ punctuation.section.interpolation.end +// ^^^^^^^^^^^^^^^^ string.quoted.other +// ^ constant.character.escape +// ^^^^^^^^^^^^^ meta.interpolation - string +// ^^ punctuation.section.interpolation.begin +// ^ punctuation.section.interpolation.end +// ^^ string.quoted.other +// ^ punctuation.definition.string.end tag `template`; // <- variable.function.tagged-template -// ^^^^^^^^^^ string.template +// ^^^^^^^^^^ meta.string string.quoted.other x ? y // y is a template tag! `template` : z; @@ -421,27 +453,22 @@ a = test ? a + b : c; // ^ meta.block meta.block variable.other.readwrite var obj = { -// ^ meta.object-literal punctuation.section.block.begin - meta.block +// ^ meta.mapping punctuation.section.block.begin - meta.block key: bar, - // <- meta.object-literal.key + // <- meta.mapping.key $key2: "string value", - // ^ meta.object-literal.key + // ^ meta.mapping.key // ^ - constant.other - // ^ string.quoted.double - $key3: 0, - // <- meta.object-literal.key.dollar punctuation.dollar - // <- meta.object-literal.key.dollar - punctuation.dollar - - $: 0, -// ^ meta.object-literal.key.dollar.only punctuation.dollar + // ^^^^^^^^^^^^^^ meta.string string.quoted.double $keyFunc: function() { // ^^^^^^^^^^^^^^^^^^^^ meta.function.declaration - // <- meta.object-literal.key.dollar entity.name.function punctuation.dollar - // <- meta.object-literal.key.dollar entity.name.function - punctuation.dollar + // <- meta.mapping.key.dollar entity.name.function punctuation.dollar + // <- meta.mapping.key.dollar entity.name.function - punctuation.dollar }, [true==false ? 'one' : 'two']: false, +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.mapping.key // ^ punctuation.section.brackets.begin // ^^^^ constant.language // ^^^^ constant.language @@ -451,13 +478,13 @@ var obj = { // ^ punctuation.separator.key-value "": true, - // <- meta.object-literal.key + // <- meta.mapping.key "key4": true, -// ^^^^^^ meta.object-literal.key string.quoted.double +// ^^^^^^ meta.mapping.key meta.string string.quoted.double // ^ punctuation.separator.key-value - string 'key5': false, -// ^^^^^^meta.object-literal.key string.quoted.single +// ^^^^^^meta.mapping.key meta.string string.quoted.single // ^ punctuation.separator.key-value - string // ^^^^^ constant.language.boolean.false @@ -478,38 +505,42 @@ var obj = { funcKey: function() { // ^^^^^^^^^^^^^^^^^^^ meta.function.declaration - // ^ meta.object-literal.key entity.name.function +// ^^^^^^^ meta.mapping.key entity.name.function }, func2Key: function func2Key() { // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.declaration - // ^ meta.object-literal.key entity.name.function +// ^^^^^^^^ meta.mapping.key entity.name.function }, funcKeyArrow: () => { // ^^^^^^^^^^^^^^^^^^^ meta.function.declaration - // ^ meta.object-literal.key entity.name.function +// ^^^^^^^^^^^^ meta.mapping.key entity.name.function }, "funcStringKey": function funcStringKey() // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.declaration - // ^ meta.object-literal.key string.quoted.double entity.name.function +// ^^^^^^^^^^^^^^^ meta.mapping.key meta.string string.quoted.double +// ^^^^^^^^^^^^^ entity.name.function { }, 'funcStringKey': function() { // ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.declaration - // ^ meta.object-literal.key string.quoted.single entity.name.function +// ^^^^^^^^^^^^^^^ meta.mapping.key meta.string string.quoted.single +// ^^^^^^^^^^^^^ entity.name.function }, 'funcStringKeyArrow': () => { // ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.declaration - // ^ meta.object-literal.key string.quoted.single entity.name.function +// ^^^^^^^^^^^^^^^^^^^^ meta.mapping.key meta.string string.quoted.single +// ^^^^^^^^^^^^^^^^^^ entity.name.function }, "func\\String2KeyArrow": (foo) => { // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.declaration - // ^ meta.object-literal.key string.quoted.double entity.name.function - // ^ constant.character.escape +// ^^^^^^^^^^^^^^^^^^^^^^^ meta.mapping.key meta.string string.quoted.double +// ^^^^^^^^^^^^^^^^^^^^^ entity.name.function +// ^^ constant.character.escape }, key: 'str' + (true ? 'true' : 'false'), @@ -517,34 +548,34 @@ var obj = { qux() // ^^^^^ meta.function.declaration - // <- entity.name.function +// ^^^ entity.name.function {}, 'funcStringMethod'() { // ^^^^^^^^^^^^^^^^^^^^ meta.function.declaration - // ^ entity.name.function +// ^^^^^^^^^^^^^^^^ entity.name.function }, 'funcStringMethodWithSameLineColon'() { var foo = { name: 'jeff' }; }, // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.declaration - // ^ entity.name.function +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ entity.name.function "key (": true, - // <- meta.object-literal.key +// ^^^^^^^ meta.mapping.key "key \"(": true, - // <- meta.object-literal.key +// ^^^^^^^^^ meta.mapping.key "key '(": true, - // <- meta.object-literal.key +// ^^^^^^^^ meta.mapping.key static, // ^^^^^^ variable.other.readwrite *baz(){ // ^^^^^^ meta.function.declaration - // <- keyword.generator.asterisk - // ^ entity.name.function +// ^ keyword.generator.asterisk +// ^^^ entity.name.function } ...foo, @@ -557,27 +588,39 @@ var obj = { // ^^^^^^^^ meta.function-call // ^^^ variable.function // ^ punctuation.separator.comma + + get foo() {}, +// ^^^^^^^^^^^^ meta.function +// ^^^ storage.type.accessor +// ^^^ entity.name.function + + get() {}, +// ^^^^^^^^ meta.function +// ^^^ entity.name.function + + get: 42, +// ^^^ meta.mapping.key } -// <- meta.object-literal - meta.block +// <- meta.mapping - meta.block +{ // <- keyword.operator '': +{1:} / undefined -//^^ string.quoted +//^^ meta.string string.quoted // ^ punctuation.separator.key-value // ^ keyword.operator // ^ constant.numeric // ^ keyword.operator // ^ constant.language }; -// <- meta.object-literal punctuation.section.block.end +// <- meta.mapping punctuation.section.block.end ({ - // <- meta.object-literal + // <- meta.mapping 0.: {0.e+0: 0} -//^^ meta.object-literal.key constant.numeric +//^^ meta.mapping.key constant.numeric // ^ punctuation.separator.key-value -// ^^^^^ meta.object-literal.key constant.numeric +// ^^^^^ meta.mapping.key constant.numeric // ^ constant.numeric }); @@ -611,14 +654,18 @@ $foo = null; baz = ""; // <- variable.other.readwrite -// ^ string.quoted.double +// ^^ meta.string string.quoted.double var qux = 100; // <- storage.type // ^ variable.other.readwrite // ^ constant.numeric +{}/**/ +//^ - meta.block + if (Infinity > qux) { +// <- meta.conditional.js keyword.control.conditional.if // ^^^^^^^^^^^^^^^ meta.conditional // ^^^^^^^^ constant.language.infinity a; @@ -629,21 +676,30 @@ if (Infinity > qux) { if (foo bar) baz = "test" +if(false){}/**/ +// ^ - meta.conditional + do { -// <- meta.do-while +// <- meta.do-while keyword.control.loop.do-while // ^ meta.block qux += 1 // ^^^^^^^^ meta.do-while meta.block } while(qux < 20); // <- meta.block // ^^^^^^^^^^^^^^ meta.do-while - meta.block -// ^^^^ keyword.control.loop +// ^^^^ keyword.control.loop.while // ^^^^^^^^ meta.group do // Incomplete statement 42; // ^^ constant.numeric - meta.do-while +do {} while (false)/**/ +// <- meta.do-while keyword.control.loop.do-while +//^^^^^^^^^^^^^^^^^ meta.do-while.js +// ^^ - meta.do-while +// ^^^^^ keyword.control.loop.while.js + for (var i = 0; i < 10; i++) { // ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.for // ^^^^^^^^^^^^^^^^^^^^^^ meta.group @@ -656,7 +712,7 @@ for (var i = 0; i < 10; i++) { for (; x in list;) {} // ^^^^^^^^^^^^^^^^^^^^^ meta.for -// ^^^ keyword.control.loop +// ^^^ keyword.control.loop.for // ^^^^^^^^^^^^^^ meta.group // ^ punctuation.separator.expression // ^^ keyword.operator @@ -664,7 +720,7 @@ for (var i = 0; i < 10; i++) { for (a[x in list];;) {} // ^^^^^^^^^^^^^^^^^^^^^^^ meta.for -// ^^^ keyword.control.loop +// ^^^ keyword.control.loop.for // ^^^^^^^^^^^^^^^^ meta.group // ^^^^^^^^^^^ meta.brackets // ^^ keyword.operator @@ -676,48 +732,51 @@ for (var i = 0; i < 10; i++) { for (const x in list) {} // ^^^^^^^^^^^^^^^^^^^^^^^^ meta.for -// ^^^ keyword.control.loop +// ^^^ keyword.control.loop.for // ^^^^^^^^^^^^^^^^^ meta.group // ^^^^^ storage.type // ^^ keyword.operator.word for (const x of list) {} // ^^^^^^^^^^^^^^^^^^^^^^^^ meta.for -// ^^^ keyword.control.loop +// ^^^ keyword.control.loop.for // ^^^^^^^^^^^^^^^^^ meta.group // ^^^^^ storage.type // ^^ keyword.operator.word for (x in list) {} // ^^^^^^^^^^^^^^^^^^ meta.for -// ^^^ keyword.control.loop +// ^^^ keyword.control.loop.for // ^^^^^^^^^^^ meta.group // ^^ keyword.operator.word for (x of list) {} // ^^^^^^^^^^^^^^^^^^ meta.for -// ^^^ keyword.control.loop +// ^^^ keyword.control.loop.for // ^^^^^^^^^^^ meta.group // ^^ keyword.operator.word for await (const x of list) {} -// ^^^ keyword.control.loop -// ^^^^^ keyword.control.loop +// ^^^ keyword.control.loop.for +// ^^^^^ keyword.control.flow.await for 42; // ^^ constant.numeric - meta.for +for(;;){}/**/ +// ^ - meta.for + while (true) // ^^^^^^^^^ meta.while // ^^^^ meta.group { // <- meta.block x = yield; -// ^^^^^ keyword.control.flow +// ^^^^^ keyword.control.flow.yield x = yield * 42; -// ^^^^^ keyword.control.flow +// ^^^^^ keyword.control.flow.yield // ^ keyword.generator.asterisk x = yield @@ -732,43 +791,57 @@ while (true) // ^^ meta.brackets - meta.sequence y = await 42; -// ^^^^^ keyword.control.flow +// ^^^^^ keyword.control.flow.await y = yield await 42; -// ^^^^^ keyword.control.flow -// ^^^^^ keyword.control.flow +// ^^^^^ keyword.control.flow.yield +// ^^^^^ keyword.control.flow.await yield (parenthesized_expression); -// ^^^^^ keyword.control.flow +// ^^^^^ keyword.control.flow.yield yield `template`; -// ^^^^^ keyword.control.flow +// ^^^^^ keyword.control.flow.yield break; -// ^^^^^ keyword.control.loop +// ^^^^^ keyword.control.flow.break break foo; -// ^^^^^ keyword.control.loop +// ^^^^^ keyword.control.flow.break // ^^^ variable.label break foo; // ^^^ variable.other.readwrite - variable.label + break/**/foo; +// ^^^ variable.label - variable.other.readwrite + + break/* + */foo; +// ^^^ variable.other.readwrite - variable.label + break function; // ^^^^^^^^ invalid.illegal.identifier variable.label continue; -// ^^^^^^^^ keyword.control.loop +// ^^^^^^^^ keyword.control.flow.continue continue foo; -// ^^^^^^^^ keyword.control.loop +// ^^^^^^^^ keyword.control.flow.continue // ^^^ variable.label continue foo; // ^^^ variable.other.readwrite - variable.label + continue/**/foo; +// ^^^ variable.label - variable.other.readwrite + + continue/* + */ foo; +// ^^^ variable.other.readwrite - variable.label + goto; // ^^^^ variable.other.readwrite - keyword } @@ -778,35 +851,44 @@ while // Incomplete statement 42; // ^^ constant.numeric - meta.while +while(false){}/**/ +// ^ - meta.while + with (undefined) { -// <- keyword.control.with +// <- keyword.control.import.with //^^^^^^^^^^ meta.with // ^^^^^^^^^ constant.language.undefined return; +// ^^^^^^ meta.with.js meta.block.js keyword.control.flow.return } with // Incomplete statement 42; // ^^ constant.numeric - meta.while +with(false){}/**/ +// ^ - meta.with + switch ($foo) { +// <- meta.switch.js keyword.control.conditional.switch // ^^^^^^^^^^^^ meta.switch +//^^^^ keyword.control.conditional.switch // ^^^^ meta.group // ^ meta.block punctuation.section.block.begin case foo: - // ^ meta.switch meta.block keyword.control.switch + // ^ meta.switch meta.block keyword.control.conditional.case // ^ - punctuation.separator.key-value qux = 1; break; - // ^ keyword.control.loop + // ^ keyword.control.flow.break case "baz": - // ^ keyword.control.switch + // ^ keyword.control.conditional.case // ^ - punctuation.separator.key-value string qux = 2; break; - // ^ keyword.control.loop + // ^ keyword.control.flow.break default: - // ^ meta.switch meta.block keyword.control.switch + // ^ meta.switch meta.block keyword.control.conditional.default // ^ - punctuation.separator.key-value qux = 3; @@ -820,26 +902,28 @@ switch ($foo) { case 0: {} case 1: -// ^^^^ keyword.control.switch +// ^^^^ keyword.control.conditional.case } // <- meta.block punctuation.section.block.end try { -// <- meta.try keyword.control.trycatch +// <- meta.try keyword.control.exception.try // ^^ meta.try // ^ meta.block foobar = qux.bar(); // ^^^^^^^^^^^^^^^^^^^ meta.try meta.block } catch (e) { // <- meta.block -// ^^^^^^^ meta.catch +//^^^^^^^^^^^^ meta.catch +//^^^^^ keyword.control.exception.catch // ^ meta.group // ^ meta.block foobar = 0 // ^^^^^^^^^^ meta.catch meta.block } finally { // <- meta.block -// ^^^^^^^^ meta.finally +//^^^^^^^^^^ meta.finally +//^^^^^^^ keyword.control.exception.finally // ^ meta.block foobar += 1 // ^^^^^^^^^^^ meta.finally meta.block @@ -850,6 +934,16 @@ switch // Incomplete statement 42; // ^^ constant.numeric - meta.switch +switch(x){}/**/ +// ^^ - meta.switch + +try{}/**/ +// ^ - meta.try +catch{}/**/ +// ^ - meta.catch +finally{}/**/ +// ^ - meta.finally + class MyClass extends TheirClass { // <- storage.type.class // ^^^^^^^ entity.name.class @@ -863,13 +957,13 @@ class MyClass extends TheirClass { // ^^ constant.numeric 'y' = 42; -// ^^^ string.quoted.single +// ^^^ meta.string string.quoted.single // ^ variable.other.readwrite // ^ keyword.operator.assignment // ^^ constant.numeric "z" = 42; -// ^^^ string.quoted.double +// ^^^ meta.string string.quoted.double // ^ variable.other.readwrite // ^ keyword.operator.assignment // ^^ constant.numeric @@ -909,14 +1003,14 @@ class MyClass extends TheirClass { static 'y' = 42; // ^^^^^^ storage.modifier.js -// ^^^ string.quoted.single +// ^^^ meta.string string.quoted.single // ^ variable.other.readwrite // ^ keyword.operator.assignment // ^^ constant.numeric static "z" = 42; // ^^^^^^ storage.modifier.js -// ^^^ string.quoted.double +// ^^^ meta.string string.quoted.double // ^ variable.other.readwrite // ^ keyword.operator.assignment // ^^ constant.numeric @@ -968,6 +1062,10 @@ class MyClass extends TheirClass { // ^ punctuation.definition.variable // ^ variable.other.readwrite // ^ keyword.operator.arithmetic + + for (const param of this.#data.get('value')) {} +// ^ punctuation.definition.variable +// ^^^^ meta.property.object } constructor(el) @@ -1117,6 +1215,9 @@ class class // <- storage.type.class - entity.name.class +class{}/**/ +// ^ - meta.class + () => {} // ^^^^^^^^ meta.function - meta.function meta.function // ^^^^^ meta.function.declaration @@ -1180,7 +1281,7 @@ const test = ({a, b, c=()=>({active:false}) }) => {}; () => { return; } // ^^ storage.type.function.arrow -// ^^^^^^^^^^^ meta.block - meta.object-literal +// ^^^^^^^^^^^ meta.block - meta.mapping // ^^^^^^ keyword.control.flow ); @@ -1188,9 +1289,9 @@ const test = ({a, b, c=()=>({active:false}) }) => {}; a = {}, // ^ keyword.operator.assignment // ^^ punctuation.section.block -// ^ punctuation.separator.comma - keyword.operator.comma +// ^ punctuation.separator.parameter - keyword.operator.comma b, -// ^ punctuation.separator.comma - keyword.operator.comma +// ^ punctuation.separator.parameter - keyword.operator.comma }) => null; // ^^ storage.type.function.arrow @@ -1279,7 +1380,7 @@ var foo = ~{a:function(){}.a()} // ^ keyword.operator.assignment // ^ keyword.operator.bitwise // ^ punctuation.section.block.begin -// ^^^^^^^^^^^^^^^^^^^^ meta.object-literal +// ^^^^^^^^^^^^^^^^^^^^ meta.mapping // ^^^^^^^^^^^^ meta.function.declaration // ^ entity.name.function // ^ punctuation.separator.key-value @@ -1288,7 +1389,7 @@ var foo = ~{a:function(){}.a()} // ^ punctuation.section.group.end // ^ meta.block punctuation.section.block.begin // ^ meta.block punctuation.section.block.end -// ^ meta.object-literal +// ^ meta.mapping // ^^^ meta.function.declaration // ^ entity.name.function // ^ punctuation.section.group.begin @@ -1362,6 +1463,9 @@ var abc = new ABC( }) ); +new foo()/**/; +// ^ - meta.function-call.constructor + function f() { new.target; // ^^^ keyword.operator.word.new @@ -1393,17 +1497,17 @@ void { // ^ meta.brackets 'test3': "asdf" } -// <- meta.object-literal punctuation.section.block.end +// <- meta.mapping punctuation.section.block.end // This tests parsing semi-broken object literals, which should help while a // user is in the middle of typing code void { key1: true -// ^^^^ meta.object-literal.key.js +// ^^^^ meta.mapping.key.js key2: 0 -// ^^^^ meta.object-literal.key.js +// ^^^^ meta.mapping.key.js key3: function() -// ^^^^ meta.object-literal.key.js entity.name.function +// ^^^^ meta.mapping.key.js entity.name.function { } @@ -1423,23 +1527,23 @@ width/2 + lineStart * Math.sin(i * 30 * π/180) // ^^^^^^^^^^^^^^^^^^^ meta.function-call.method var reg = /a+/gimy.exec('aabb') -// ^^^^^^^^ string.regexp +// ^^^^^^^^ meta.string string.regexp // ^^^^ keyword.other // ^ punctuation.accessor 'aabbcc'.replace(/b+/, 'd'); -// ^^^^ string.regexp +// ^^^^ meta.string string.regexp // ^ keyword.operator.quantifier.regexp /a+(?:bc)/; -// <- string.regexp +// <- meta.string string.regexp // ^^ punctuation.definition.group.no-capture.regexp 'str'.match(/[" ]+/g); -// ^^^^^^^^ string.regexp.js +// ^^^^^^^^ meta.string string.regexp.js myvar = myvar.replace(/RTP\/SAVPF .*/, 'RTP/SAVPF ' + suffix); -// ^^^^^^^^^^^^^^^ string.regexp.js +// ^^^^^^^^^^^^^^^ meta.string string.regexp.js 'foo'.bar() / baz // ^ variable.other.readwrite @@ -1470,18 +1574,17 @@ var result = 200 / 400 + 500 / var re = / [a-z] /g -// <- string.regexp.js punctuation.definition.string.end +// <- meta.string string.regexp.js punctuation.definition.string.end // <- keyword.other const a = 1 / /This is regex./ / 'This should be a string, not a regex.'; // ^ keyword.operator -// ^ string.regexp -// ^ string.regexp +// ^^^^^^^^^^^^^^^^ meta.string string.regexp // ^ keyword.operator -// ^ string.quoted +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string string.quoted a = /\//u + 0; -// ^^^^ string.regexp +// ^^^^ meta.string string.regexp // ^ keyword.other // ^ keyword.operator // ^ constant.numeric @@ -1525,7 +1628,7 @@ undefined / (8 * 5) / "1" // ^ keyword.operator.arithmetic a = /foo\/bar/g // Ensure handling of escape / in regex detection -// ^ string.regexp +// ^^^^^^^^^^^ meta.string string.regexp // ^ constant.character.escape var re = /^\/[^/]+/; @@ -1588,7 +1691,7 @@ new FooBar(function(){ var test = {a: 1} -// <- meta.object-literal punctuation.section.block.begin +// <- meta.mapping punctuation.section.block.begin var arrowFuncBraceNextLine = () => /* comments! */ // ^ entity.name.function @@ -1619,14 +1722,14 @@ var o = { a: i => i * 2, b: i => i * 3 } function test() { return {a: 1}; -// ^^^^^^ meta.object-literal -// ^ meta.object-literal.key +// ^^^^^^ meta.mapping +// ^ meta.mapping.key // ^ constant.numeric } $.each({}) // <- variable.other.dollar.only punctuation.dollar -// ^ meta.object-literal +// ^ meta.mapping $varname.method() // <- variable.other.dollar punctuation.dollar - variable.object.dollar.only @@ -1682,11 +1785,18 @@ var CONST; return; {a: 1}; -// ^ meta.block - meta.object-literal +// ^ meta.block - meta.mapping + +return/**/{a: 1} +// ^^^^^^ meta.mapping - meta.block return {a: 1}; -// ^ meta.block - meta.object-literal +// ^ meta.block - meta.mapping + +return/* +*/{a: 1} +//^^^^^^ meta.block - meta.mapping const abc = new Set if (true) {}; @@ -1702,24 +1812,25 @@ var o = { var query = { type: type==undefined ? null : {$in: type.split(',')} -//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.object-literal +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.mapping // ^^^^^^^^^ constant.language.undefined // ^ keyword.operator.ternary // ^^^^ constant.language.null // ^ keyword.operator.ternary // ^ punctuation.section.block.begin -// ^^ meta.object-literal.key.dollar.js +// ^^ meta.mapping.key.js // ^ punctuation.separator.key-value.js // ^ punctuation.section.block.end }; var str = `Hello, ${name}!`; -// ^^^^^^^^ string.template -// ^^^^^^^ meta.template.expression - string -// ^^ string.template -// ^^ punctuation.definition.template-expression.begin -// ^^^^ source.js.embedded.expression variable.other.readwrite -// ^ punctuation.definition.template-expression.end +// ^^^^^^^^^^^^^^^^^ meta.string +// ^^^^^^^^ string.quoted.other +// ^^^^^^^ meta.interpolation - string +// ^^ string.quoted.other +// ^^ punctuation.section.interpolation.begin +// ^^^^ source.js.embedded variable.other.readwrite +// ^ punctuation.section.interpolation.end function yy (a, b) { // ^^^^^^^^^^^^^^^^^ meta.function @@ -1737,22 +1848,24 @@ function yy (a, b) { // Integers 123_456_789_0n; -// ^^^^^^^^^^^^^^ constant.numeric.decimal -// ^ storage.type.numeric.bigint +// ^^^^^^^^^^^^^^ constant.numeric.integer.decimal +// ^ storage.type.numeric 0; -// ^ constant.numeric.decimal +// ^ constant.numeric.integer.decimal 123 .foo; -// ^^^ constant.numeric.decimal +// ^^^ constant.numeric.integer.decimal // ^ punctuation.accessor // ^^^ meta.property.object +123; -// ^^^^ constant.numeric.decimal - keyword +// ^ keyword.operator.arithmetic +// ^^^ constant.numeric.integer.decimal - keyword -123; -// ^^^^ constant.numeric.decimal - keyword +// ^ keyword.operator.arithmetic +// ^^^ constant.numeric.integer.decimal - keyword + 123; // ^ keyword.operator.arithmetic @@ -1761,7 +1874,7 @@ function yy (a, b) { // ^^^^^^ invalid.illegal.numeric.decimal 0123456789; -// ^^^^^^^^^^ constant.numeric.octal invalid.deprecated.numeric.octal +// ^^^^^^^^^^ constant.numeric.integer.octal invalid.deprecated.numeric.octal 0123456789xyz; // ^^^^^^^^^^^^^ invalid.illegal.numeric.octal @@ -1777,33 +1890,38 @@ function yy (a, b) { // ^^^ invalid.illegal.illegal-identifier 0b0110_1001_1001_0110n; -// ^^^^^^^^^^^^^^^^^^^^^^ constant.numeric.binary -// ^^ punctuation.definition.numeric.binary -// ^ storage.type.numeric.bigint +// ^^^^^^^^^^^^^^^^^^^^^^ constant.numeric.integer.binary +// ^^ punctuation.definition.numeric.base +// ^ storage.type.numeric 0o0123_4567n; -// ^^^^^^^^^^^^ constant.numeric.octal -// ^^ punctuation.definition.numeric.octal -// ^ storage.type.numeric.bigint +// ^^^^^^^^^^^^ constant.numeric.integer.octal +// ^^ punctuation.definition.numeric.base +// ^ storage.type.numeric 0x01_23_45_67_89_ab_CD_efn; -// ^^^^^^^^^^^^^^^^^^^^^^^^^^ constant.numeric.hexadecimal -// ^^ punctuation.definition.numeric.hexadecimal -// ^ storage.type.numeric.bigint +// ^^^^^^^^^^^^^^^^^^^^^^^^^^ constant.numeric.integer.hexadecimal +// ^^ punctuation.definition.numeric.base +// ^ storage.type.numeric 0B0; 0O0; 0X0; -// ^^^ constant.numeric.binary -// ^^^ constant.numeric.octal -// ^^^ constant.numeric.hexadecimal +// ^^^ constant.numeric.integer.binary +// ^^ punctuation.definition.numeric.base +// ^^^ constant.numeric.integer.octal +// ^^ punctuation.definition.numeric.base +// ^^^ constant.numeric.integer.hexadecimal +// ^^ punctuation.definition.numeric.base 0b1.foo; // ^^^^^^^ - invalid -// ^^^ constant.numeric.binary +// ^^^ constant.numeric.integer.binary +// ^^ punctuation.definition.numeric.base // ^ punctuation.accessor // ^^^ meta.property.object 0b1.0; -// ^^^ constant.numeric.binary +// ^^^ constant.numeric.integer.binary +// ^^ punctuation.definition.numeric.base // ^ punctuation.accessor // ^ invalid.illegal.illegal-identifier @@ -1814,21 +1932,26 @@ function yy (a, b) { // Floats 1_234_567_890.123_456_789_0; -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant.numeric.decimal +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant.numeric.float.decimal .123_456_789_0; -// ^^^^^^^^^^^^^^ constant.numeric.decimal +// ^^^^^^^^^^^^^^ constant.numeric.float.decimal +// ^ punctuation.separator.decimal 12345e6_7_8; -// ^^^^^^^^^^^ constant.numeric.decimal - +// ^^^^^^^^^^^ constant.numeric.float.decimal + 123.456e+789; -// ^^^^^^^^^^^^ constant.numeric.decimal +// ^^^^^^^^^^^^ constant.numeric.float.decimal +// ^ punctuation.separator.decimal .123E-7_8_9; -// ^^^^^^^^^^^ constant.numeric.decimal +// ^^^^^^^^^^^ constant.numeric.float.decimal +// ^ punctuation.separator.decimal 0123.45; +// ^^^^ constant.numeric.integer.octal invalid.deprecated.numeric.octal +// ^ punctuation.accessor // ^^ invalid.illegal - constant.numeric 123.4foo; @@ -1838,13 +1961,39 @@ function yy (a, b) { // ^^^^^^ invalid.illegal.numeric.decimal 123..foo; -// ^^^^ constant.numeric.decimal +// ^^^^ constant.numeric.float.decimal // ^ punctuation.accessor // ^^^ meta.property.object debugger; -// <- keyword.other.debugger +// <- keyword.control.flow.debugger.js debugger [] // <- meta.sequence + + a ?? b; +// ^^ keyword.operator.logical + + a.?b.?c; +// ^^ punctuation.accessor +// ^ meta.property.object +// ^^ punctuation.accessor +// ^ meta.property.object + + a.?[propName]; +// ^^^^^^^^^^^^ meta.brackets +// ^^ punctuation.accessor +// ^ punctuation.section.brackets.begin + + a.?(); +// ^^^^^ meta.function-call +// ^ variable.function +// ^^^^ meta.group +// ^^ punctuation.accessor +// ^ punctuation.section.group.begin + + a.b.?(); +// ^^^^^^^ meta.function-call.method +// ^ variable.function +// diff --git a/JavaScript/tests/syntax_test_js_bindings.js b/JavaScript/tests/syntax_test_js_bindings.js index 65f5be14b1..3e14de8bd9 100644 --- a/JavaScript/tests/syntax_test_js_bindings.js +++ b/JavaScript/tests/syntax_test_js_bindings.js @@ -26,29 +26,29 @@ const [ x, [a, b], z] = value; const [ x = 42, y = [a, b, c] ] = value; // ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.binding.destructuring.sequence // ^ keyword.operator.assignment -// ^^ meta.binding.destructuring.sequence.js constant.numeric.decimal.js +// ^^ meta.binding.destructuring.sequence.js constant.numeric.integer.decimal.js // ^ keyword.operator.assignment // ^^^^^^^^^ meta.sequence // ^ variable.other.readwrite - meta.binding.name const { a, b: c, ...d } = value; // ^^^^^^^^^^^^^^^^^ meta.binding.destructuring.mapping -// ^ meta.object-literal.key meta.binding.name variable.other.readwrite +// ^ meta.mapping.key meta.binding.name variable.other.readwrite // ^ punctuation.separator.comma -// ^ meta.object-literal.key - variable +// ^ meta.mapping.key - variable // ^ punctuation.separator.key-value // ^^^ keyword.operator.spread // ^ meta.binding.name variable.other.readwrite const { 'a': x, "b": y, [c]: z } = value; // ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.binding.destructuring.mapping -// ^^^ meta.object-literal.key string.quoted.single +// ^^^ meta.mapping.key string.quoted.single // ^ punctuation.separator.key-value // ^ meta.binding.name variable.other.readwrite -// ^^^ meta.object-literal.key string.quoted.double +// ^^^ meta.mapping.key string.quoted.double // ^ punctuation.separator.key-value // ^ meta.binding.name variable.other.readwrite -// ^^^ meta.object-literal.key +// ^^^ meta.mapping.key // ^ variable.other.readwrite // ^ punctuation.separator.key-value // ^ meta.binding.name variable.other.readwrite @@ -105,29 +105,29 @@ function f ([ x, [a, b], z]) {} function f ([ x = 42, y = [a, b, c] ]) {} // ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.binding.destructuring.sequence // ^ keyword.operator.assignment -// ^^ meta.binding.destructuring.sequence.js constant.numeric.decimal.js +// ^^ meta.binding.destructuring.sequence.js constant.numeric.integer.decimal.js // ^ keyword.operator.assignment // ^^^^^^^^^ meta.sequence // ^ variable.other.readwrite - meta.binding.name function f ({ a, b: c, ...d }) {} // ^^^^^^^^^^^^^^^^^ meta.binding.destructuring.mapping -// ^ meta.object-literal.key meta.binding.name variable.parameter.function +// ^ meta.mapping.key meta.binding.name variable.parameter.function // ^ punctuation.separator.parameter -// ^ meta.object-literal.key - variable +// ^ meta.mapping.key - variable // ^ punctuation.separator.key-value // ^^^ keyword.operator.spread // ^ meta.binding.name variable.parameter.function function f ({ 'a': x, "b": y, [c]: z }) = value; // ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.binding.destructuring.mapping -// ^^^ meta.object-literal.key string.quoted.single +// ^^^ meta.mapping.key string.quoted.single // ^ punctuation.separator.key-value // ^ meta.binding.name variable.parameter.function -// ^^^ meta.object-literal.key string.quoted.double +// ^^^ meta.mapping.key string.quoted.double // ^ punctuation.separator.key-value // ^ meta.binding.name variable.parameter.function -// ^^^ meta.object-literal.key +// ^^^ meta.mapping.key // ^ variable.other.readwrite // ^ punctuation.separator.key-value // ^ meta.binding.name variable.parameter.function @@ -165,7 +165,7 @@ let f = ([ x = 42, y = [a, b, c] ]) => {}; // ^ entity.name.function variable.other.readwrite // ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.binding.destructuring.sequence // ^ keyword.operator.assignment -// ^^ meta.binding.destructuring.sequence.js constant.numeric.decimal.js +// ^^ meta.binding.destructuring.sequence.js constant.numeric.integer.decimal.js // ^ keyword.operator.assignment // ^^^^^^^^^ meta.sequence // ^ variable.other.readwrite - meta.binding.name @@ -174,22 +174,22 @@ let f = ({ a, b: c, ...d }) => {}; // ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.declaration // ^ entity.name.function variable.other.readwrite // ^^^^^^^^^^^^^^^^^ meta.binding.destructuring.mapping -// ^ meta.object-literal.key meta.binding.name variable.parameter.function +// ^ meta.mapping.key meta.binding.name variable.parameter.function // ^ punctuation.separator.parameter -// ^ meta.object-literal.key - variable +// ^ meta.mapping.key - variable // ^ punctuation.separator.key-value // ^^^ keyword.operator.spread // ^ meta.binding.name variable.parameter.function let f = ({ 'a': x, "b": y, [c]: z }) => {}; // ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.binding.destructuring.mapping -// ^^^ meta.object-literal.key string.quoted.single +// ^^^ meta.mapping.key string.quoted.single // ^ punctuation.separator.key-value // ^ meta.binding.name variable.parameter.function -// ^^^ meta.object-literal.key string.quoted.double +// ^^^ meta.mapping.key string.quoted.double // ^ punctuation.separator.key-value // ^ meta.binding.name variable.parameter.function -// ^^^ meta.object-literal.key +// ^^^ meta.mapping.key // ^ variable.other.readwrite // ^ punctuation.separator.key-value // ^ meta.binding.name variable.parameter.function diff --git a/JavaScript/tests/syntax_test_js_support_builtin.js b/JavaScript/tests/syntax_test_js_support_builtin.js index 35507f8a9e..3c013c962f 100644 --- a/JavaScript/tests/syntax_test_js_support_builtin.js +++ b/JavaScript/tests/syntax_test_js_support_builtin.js @@ -13,7 +13,7 @@ // ^^^^^ support.function new Error(); -// ^^^^^ support.class.error +// ^^^^^ support.class.builtin Array; // ^^^^^ support.class.builtin @@ -75,19 +75,19 @@ // ^^^^^^^ support.class.builtin Error; -// ^^^^^ support.class.error +// ^^^^^ support.class.builtin EvalError; -// ^^^^^^^^^ support.class.error +// ^^^^^^^^^ support.class.builtin RangeError; -// ^^^^^^^^^^ support.class.error +// ^^^^^^^^^^ support.class.builtin ReferenceError; -// ^^^^^^^^^^^^^^ support.class.error +// ^^^^^^^^^^^^^^ support.class.builtin SyntaxError; -// ^^^^^^^^^^^ support.class.error +// ^^^^^^^^^^^ support.class.builtin TypeError; -// ^^^^^^^^^ support.class.error +// ^^^^^^^^^ support.class.builtin URIError; -// ^^^^^^^^ support.class.error +// ^^^^^^^^ support.class.builtin Atomics; // ^^^^^^^ support.constant.builtin @@ -117,11 +117,6 @@ encodeURIComponent; // ^^^^^^^^^^^^^^^^^^ support.function - escape; -// ^^^^^^ invalid.deprecated support.function - unescape; -// ^^^^^^^^ invalid.deprecated support.function - foo.constructor; // ^^^^^^^^^^^ variable.language.constructor @@ -366,6 +361,10 @@ Promise.reject; // ^^^^^^ support.function.builtin Promise.resolve; // ^^^^^^^ support.function.builtin +Promise.allSettled; +// ^^^^^^^^^^ support.function.builtin +Promise.any; +// ^^^ support.function.builtin Reflect.apply; // ^^^^^ support.function.builtin diff --git a/JavaScript/tests/syntax_test_json.json b/JavaScript/tests/syntax_test_json.json deleted file mode 100644 index 129b44d039..0000000000 --- a/JavaScript/tests/syntax_test_json.json +++ /dev/null @@ -1,66 +0,0 @@ -// SYNTAX TEST "Packages/JavaScript/JSON.sublime-syntax" - -{ - "dict": { } -// ^^^ meta.structure.dictionary.json -// ^ punctuation.section.dictionary.begin.json -// ^ punctuation.section.dictionary.end.json - -, -// <- punctuation.separator.dictionary.pair.json - - "sep": {}, -// ^ punctuation.separator.dictionary.key-value.json - - "array": [ ], -// ^^^ meta.structure.array.json -// ^ punctuation.section.array.begin.json -// ^ punctuation.section.array.end.json - - "string": "string", -// ^ punctuation.definition.string.begin.json -// ^^^^^^^^ meta.structure.dictionary.value.json string.quoted.double.json -// ^ punctuation.definition.string.end.json - - "bool": false, -// ^^^^^ constant.language.json - - "num": 20.09, -// ^^^^^ constant.numeric.json - - "neg": -9, -// ^^ constant.numeric.json - - "E": 20e10, -// ^^^^^ constant.numeric.json -//^^^ meta.structure.dictionary.key.json string.quoted.double.json -// ^ punctuation.separator.dictionary.key-value.json - meta.structure.dictionary.key.json - - "escape": "\n", -// ^^ constant.character.escape.json -// ^^^^ meta.structure.dictionary.value.json string.quoted.double.json - meta.structure.dictionary.key.json - - "illegal": "\.", -// ^^ invalid.illegal.unrecognized-string-escape.json - - "unterminated string -//^^^^^^^^^^^^^^^^^^^^ string.quoted.double.json -// ^ string.quoted.double.json invalid.illegal.unclosed-string.json - -// <- - string - -/**/: "test", -// ^ meta.structure.dictionary.json comment.block.json -// ^ punctuation.separator.dictionary.key-value.json - comment -// ^^^^^^ meta.structure.dictionary.value.json string.quoted.double.json - - "array2": - [ - "foobar", -// ^^^^^^^^ meta.structure.array.json string.quoted.double.json - meta.structure.dictionary.key.json - ], - - [] -//^^ invalid.illegal.expected-dictionary-separator.json - -} diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index 060a8473aa..860a8e42a6 100644 --- a/LaTeX/LaTeX.sublime-syntax +++ b/LaTeX/LaTeX.sublime-syntax @@ -165,7 +165,7 @@ contexts: - include: macro-braces general-constants: - - match: '(\\\\)(?:(\[)\s*-?([[:digit:]]*)\s*(\w*)\s*(\]))?' + - match: '(\\\\)(?:(\[)\s*-?((?:[[:digit:]]|\.)*)\s*(\w*)\s*(\]))?' captures: 1: constant.character.newline.latex 2: punctuation.definition.group.bracket.begin.newline.latex @@ -659,24 +659,41 @@ contexts: references: - match: |- (?x) - ( - (\\) - (?: - [cC]ite(?:author|title|year|date|url|t|p|alt|alp|text|yearpar)? - | (?:[pP]aren|foot|[tT]ext|[sS]mart|super|[aA]|no|full|footfull)cite|footcitetext - ) - \*? + (\\) + (?: + # biblatex commands + # http://mirrors.ibiblio.org/CTAN/macros/latex/exptl/biblatex/doc/biblatex.pdf section 3.8 + # commands with multicite variant + (?:[aA]uto|foot|[pP]aren|[sS]mart|super|[tT]ext)cites? + | [Cc]ites? + | footcitetexts? + # text commands + | [cC]ite(?:author) + | cite(?:title|year|date) + | citeurl + # special + | (?:[aA]|no|full|footfull)cites? + | [vV]olcites? + | (?:[pPfFsStTaA]|ft)volcites? + | (?:[pPf]?n|N)otecite + # non-biblatex + | [aA]cite + | [cC]ite(?:t|p|alt|alp|text|yearpar) )\b + # For simplicity with using \b, we match a star for all variants + \*? + scope: support.function.cite.latex keyword.other.cite.latex captures: - 1: support.function.cite.latex keyword.other.cite.latex - 2: punctuation.definition.backslash.latex + 1: punctuation.definition.backslash.latex push: - meta_scope: meta.function.citation.latex - include: general-optional-arguments - match: '\{' scope: punctuation.definition.group.brace.begin.latex - set: - - meta_scope: meta.function.citation.latex meta.group.brace.latex + # Some commands, e.g. \parencites, allow multiple [][]{} argument sequences, + # so we `push` instead of `set`. + push: + - meta_scope: meta.group.brace.latex - match: '[a-zA-Z0-9\.:/*!^_-]+' scope: constant.other.citation.latex - match: '\}' @@ -820,6 +837,12 @@ contexts: embed: scope:source.java embed_scope: meta.environment.embedded.java.latex source.java.embedded escape: '(?=\\end\{lstlisting\})' + - match: '.*(%\s*(?i:html))$' + captures: + 1: comment.line.percentage.latex + embed: scope:text.html.basic + embed_scope: meta.environment.embedded.html.latex source.html.embedded + escape: '(?=\\end\{lstlisting\})' - match: '.*(%\s*(?i:tex|latex))$' captures: 1: comment.line.percentage.latex @@ -880,6 +903,12 @@ contexts: embed: scope:source.sql embed_scope: meta.environment.embedded.sql.latex source.sql.embedded escape: '(?=\\end\{lstlisting\})' + - match: '.*(%\s*(?i:xml))$' + captures: + 1: comment.line.percentage.latex + embed: scope:text.xml + embed_scope: meta.environment.embedded.xml.latex source.xml.embedded + escape: '(?=\\end\{lstlisting\})' - match: '.*(%\s*(?i:yaml))$' captures: 1: comment.line.percentage.latex @@ -956,6 +985,14 @@ contexts: embed: scope:source.haskell embed_scope: meta.environment.embedded.haskell.latex source.haskell.embedded escape: '(?=\\end\{minted\})' + - match: '(\{)(html)(\})' + captures: + 1: punctuation.definition.group.brace.begin.latex + 2: variable.parameter.function.latex + 3: punctuation.definition.group.brace.end.latex + embed: scope:text.html.basic + embed_scope: meta.environment.embedded.html.latex text.html.embedded + escape: '(?=\\end\{minted\})' - match: '(\{)(java)(\})' captures: 1: punctuation.definition.group.brace.begin.latex @@ -1076,6 +1113,14 @@ contexts: embed: scope:source.sql embed_scope: meta.environment.embedded.sql.latex source.sql.embedded escape: '(?=\\end\{minted\})' + - match: '(\{)(xml)(\})' + captures: + 1: punctuation.definition.group.brace.begin.latex + 2: variable.parameter.function.latex + 3: punctuation.definition.group.brace.end.latex + embed: scope:text.xml + embed_scope: meta.environment.embedded.xml.latex text.xml.embedded + escape: '(?=\\end\{minted\})' - match: '(\{)(yaml)(\})' captures: 1: punctuation.definition.group.brace.begin.latex @@ -1170,6 +1215,20 @@ contexts: escape_captures: 1: punctuation.definition.group.brace.begin.latex 2: punctuation.definition.verb.latex + - match: '(\{)(html)(\})((\{)|(\W))' + scope: meta.environment.verbatim.minted.latex + captures: + 1: punctuation.definition.group.brace.begin.latex + 2: variable.parameter.function.latex + 3: punctuation.definition.group.brace.end.latex + 5: punctuation.definition.group.brace.begin.latex + 6: punctuation.definition.verb.latex + embed: scope:text.html.basic + embed_scope: meta.environment.verbatim.minted.latex meta.environment.embedded.html.latex text.html.embedded + escape: '(\})|(\4)' + escape_captures: + 1: punctuation.definition.group.brace.begin.latex + 2: punctuation.definition.verb.latex - match: '(\{)(java)(\})((\{)|(\W))' scope: meta.environment.verbatim.minted.latex captures: @@ -1380,6 +1439,20 @@ contexts: escape_captures: 1: punctuation.definition.group.brace.begin.latex 2: punctuation.definition.verb.latex + - match: '(\{)(xml)(\})((\{)|(\W))' + scope: meta.environment.verbatim.minted.latex + captures: + 1: punctuation.definition.group.brace.begin.latex + 2: variable.parameter.function.latex + 3: punctuation.definition.group.brace.end.latex + 5: punctuation.definition.group.brace.begin.latex + 6: punctuation.definition.verb.latex + embed: scope:text.xml + embed_scope: meta.environment.verbatim.minted.latex meta.environment.embedded.xml.latex text.xml.embedded + escape: '(\})|(\4)' + escape_captures: + 1: punctuation.definition.group.brace.begin.latex + 2: punctuation.definition.verb.latex - match: '(\{)(yaml)(\})((\{)|(\W))' scope: meta.environment.verbatim.minted.latex captures: diff --git a/LaTeX/syntax_test_latex.tex b/LaTeX/syntax_test_latex.tex index 862207377f..5df4f10eef 100644 --- a/LaTeX/syntax_test_latex.tex +++ b/LaTeX/syntax_test_latex.tex @@ -55,6 +55,19 @@ % ^ support.function.begin.latex keyword.control.flow.begin.latex % ^ variable.parameter.function.latex + +% TEX INTERNAL COMMANDS +\\ +% <- constant.character.newline.latex + +\\[1.5ex] +% <- constant.character.newline.latex +% ^ punctuation.definition.group.bracket.begin.newline.latex +% ^^^ constant.numeric.newline.latex +% ^^ keyword.other.newline.latex +% ^ punctuation.definition.group.bracket.begin.newline.latex + + % SECTION COMMANDS \part{name} @@ -111,6 +124,27 @@ \subsubsection{name} % ^ support.function % +\parencite[Propositon~1]{Ref} +% ^ meta.function.citation.latex +% ^ support.function.cite.latex +% ^ meta.group.bracket.latex +% ^ constant.other.citation.latex + +\parencites[Proposition~1]{Firstref}[p.~2]{SecondRef} +% ^ meta.function.citation.latex +% ^ support.function.cite.latex +% ^ meta.group.bracket.latex +% ^ constant.other.citation.latex +% ^ meta.group.bracket.latex +% ^ constant.other.citation.latex + +\Citeauthor*[]{ref} +% ^ meta.function.citation.latex +% ^ support.function.cite.latex +% ^ support.function.cite.latex +% ^ meta.group.bracket.latex +% ^ constant.other.citation.latex + % URL COMMAND diff --git a/Lisp/Lisp.sublime-syntax b/Lisp/Lisp.sublime-syntax index f853e90a32..50e5dad34d 100644 --- a/Lisp/Lisp.sublime-syntax +++ b/Lisp/Lisp.sublime-syntax @@ -50,11 +50,11 @@ contexts: scope: keyword.control.lisp functions: - - match: (\b(?i:(defun|defmethod|defmacro))\b)(\s+)((\w|\-|\!|\?)*) + - match: \b(?i:(defun|defmethod|defmacro))\b\s+([\w\-!?<>]*) scope: meta.function.lisp captures: - 2: storage.type.function-type.lisp - 4: entity.name.function.lisp + 1: storage.type.function-type.lisp + 2: entity.name.function.lisp - match: \b(?i:zerop|yes-or-no-p|y-or-n-p|write-to-string|write-string|write-char|write-byte|write|with-standard-io-syntax|with-slots|with-simple-restart|with-package-iterator|with-output-to-string|with-open-stream|with-open-file|with-input-from-string|with-hash-table-iterator|with-condition-restarts|with-compilation-unit|with-accessors|wild-pathname-p|warn|vectorp|vector-push-extend|vector-push|vector-pop|vector|variable-information|values-list|values|user-homedir-pathname|use-value|use-package|upper-case-p|upgraded-complex-part-type|upgraded-array-element-type|update-instance-for-redefined-class|update-instance-for-different-class|unuse-package|untrace|until-if|until|unread-char|union|unintern|unexport|typep|type-of|type-error-expected-type|type-error-datum|two-way-stream-output-stream|two-way-stream-input-stream|truncate|truename|tree-equal|translate-pathname|translate-logical-pathname|trace|to-alter|time|third|terpri|terminate-producing|tenth|tanh|tan|tailp|synonym-stream-symbol|symbolp|symbol-value|symbol-plist|symbol-package|symbol-name|symbol-function|sxhash|svref|summing|sum|subtypep|substitute-if-not|substitute-if|substitute|subst-if-not|subst-if|subst|subsetp|subseries|subseq|sublis|stringp|string>=|string>|string=|string<=|string<|string/=|string-upcase|string-trim|string-right-trim|string-not-lessp|string-not-greaterp|string-not-equal|string-lessp|string-left-trim|string-greaterp|string-equal|string-downcase|string-char-p|string-capitalize|string|streamp|stream-external-format|stream-error-stream|stream-element-type|store-value|step|standard-char-p|stable-sort|sqrt|split-if|split|special-form-p|sort|some|software-version|software-type|slot-value|slot-unbound|slot-missing|slot-makunbound|slot-exists-p|slot-boundp|sleep|sixth|sinh|sin|simple-vector-p|simple-string-p|simple-condition-format-string|simple-condition-format-arguments|simple-bit-vector-p|signum|signal|short-site-name|shiftf|shared-initialize|shadowing-import|shadow|seventh|setq|setf|set-syntax-from-char|set-pprint-dispatch|set-macro-character|set-exclusive-or|set-dispatch-macro-character|set-difference|set-char-bit|set|series|second|search|schar|scan-symbols|scan-sublists|scan-range|scan-plist|scan-multiple|scan-lists-of-lists-fringe|scan-lists-of-lists|scan-hash|scan-fn-inclusive|scan-fn|scan-file|scan-alist|scan|scale-float|sbit|rplacd|rplaca|row-major-aref|round|rotatef|room|reverse|revappend|result-of|restart-name|restart-case|restart-bind|rest|require|replace|rename-package|rename-file|remprop|remove-method|remove-duplicates|remove|remhash|remf|reinitialize-instance|reduce|realpart|realp|readtablep|readtable-case|read-preserving-whitespace|read-line|read-from-string|read-delimited-list|read-char-no-hang|read-char|read-byte|read|rationalp|rationalize|rational|rassoc-if-not|rassoc-if|rassoc|random-state-p|random|quote|pushnew|push|psetq|psetf|provide|progn|prog2|prog1|producing|proclaim|probe-file|print-unreadable-object|print-object|print|prin1|previous|pprint-tabular|pprint-tab|pprint-pop|pprint-newline|pprint-logical-block|pprint-linear|pprint-indent|pprint-fill|pprint-exit-if-list-exhausted|pprint-dispatch|positions|position-if-not|position-if|position|pop|plusp|phase|peek-char|pathnamep|pathname-version|pathname-type|pathname-name|pathname-match-p|pathname-host|pathname-directory|pathname-device|pathname|parse-namestring|parse-macro|parse-integer|pairlis|packagep|package-used-by-list|package-use-list|package-shadowing-symbols|package-nicknames|package-name|package-error-package|output-stream-p|open-stream-p|open|oddp|nunion|numerator|numberp|nthcdr|nth-value|nth|nsubstitute-if-not|nsubstitute-if|nsubstitute|nsubst-if-not|nsubst-if|nsubst|nsublis|nstring-upcase|nstring-downcase|nstring-capitalize|nset-exclusive-or|nset-difference|nreverse|nreconc|notevery|notany|no-next-method|no-applicable-method|ninth|nintersection|next-out|next-method-p|next-in|nconcing|nconc|nbutlast|namestring|name-char|multiple-value-setq|multiple-value-list|multiple-value-bind|muffle-warning|mismatch|minusp|minimizing|minimize|mingle|method-qualifiers|method-combination-error|merge-pathnames|merge|memberp|member-if-not|member-if|member|maximizing|maximize|mask-field|mask|mapping|maphash|map-into|map-fn|map|makunbound|make-two-way-stream|make-synonym-stream|make-symbol|make-string-output-stream|make-string-input-stream|make-string|make-sequence|make-random-state|make-pathname|make-package|make-load-form-saving-slots|make-load-form|make-list|make-instances-obsolete|make-instance|make-hash-table|make-echo-stream|make-dispatch-macro-character|make-condition|make-concatenated-stream|make-char|make-broadcast-stream|make-array|macroexpand-1|macroexpand|macro-function|machine-version|machine-type|machine-instance|lower-case-p|loop-finish|long-site-name|logtest|logorc2|logorc1|lognot|lognand|logical-pathname-translations|logical-pathname|logcount|logbitp|logandc2|logandc1|log|locally|load-logical-pathname-translations|load|listp|listen|list-length|list-all-packages|list*|list|lisp-implementation-version|lisp-implementation-type|length|ldiff|ldb-test|ldb|lcm|latch|last|lambda|keywordp|iterate|isqrt|invoke-restart|invoke-debugger|invalid-method-error|intersection|intern|interactive-stream-p|integerp|integer-length|integer-decode-float|int-char|inspect|input-stream-p|initialize-instance|in-package|import|imagpart|ignore-errors|identity|host-namestring|hash-table-test|hash-table-size|hash-table-rehash-threshold|hash-table-rehash-size|hash-table-p|hash-table-count|handler-case|handler-bind|graphic-char-p|gethash|getf|get-universal-time|get-setf-method-multiple-value|get-setf-method|get-properties|get-output-stream-string|get-internal-run-time|get-internal-real-time|get-decoded-time|get|gentemp|gensym|generic-function|generator|gcd|gathering|gatherer|functionp|function-lambda-expression|function-keywords|function-information|funcall|fourth|formatter|format|floor|floatp|float-sign|float-radix|float-precision|float-digits|float|first|finish-output|find-symbol|find-restart|find-package|find-method|find-if-not|find-if|find-class|find-all-symbols|find|fill-pointer|fill|file-write-date|file-string-length|file-position|file-namestring|file-length|file-error-pathname|file-author|fifth|ffloor|fdefinition|fboundp|f|expt|export|expand|exp|every|evenp|evalhook|eval|error|ensure-generic-function|enough-namestring|endp|encode-universal-time|enclose|encapsulated|elt|eighth|ed|echo-stream-output-stream|echo-stream-input-stream|ecase|dribble|dpb|documentation|do-symbols|do-external-symbols|do-all-symbols|disassemble|directory-namestring|directory|digit-char-p|digit-char|destructuring-bind|describe-object|describe|deposit-field|denominator|delete-package|delete-if-not|delete-if|delete-file|delete-duplicates|delete|defvar|deftype|defstruct|defpackage|define-setf-method|define-modify-macro|define-method-combination|define-declaration|define-condition|define-compiler-macro|defgeneric|defclass|decode-universal-time|decode-float|declaration-information|declaim|counting|count-if-not|count-if|count|cotruncate|cosh|cos|copy-tree|copy-symbol|copy-seq|copy-readtable|copy-pprint-dispatch|copy-list|copy-alist|continue|constantp|consp|cons|conjugate|concatenated-stream-streams|concatenate|compute-restarts|compute-applicable-methods|complexp|complex|complement|compiler-macroexpand-1|compiler-macroexpand|compiler-macro-function|compiler-let|compiled-function-p|compile-file-pathname|compile-file|compile|commonp|collecting-fn|collecting|collect-sum|collect-plist|collect-or|collect-nth|collect-nconc|collect-min|collect-max|collect-length|collect-last|collect-hash|collect-fn|collect-first|collect-file|collect-append|collect-and|collect-alist|collect|coerce|code-char|clrhash|close|clear-input|class-of|class-name|cis|chunk|choose-if|choose|check-type|characterp|character|char>=|char>|char=|char<=|char<|char/=|char-upcase|char-not-lessp|char-not-greaterp|char-not-equal|char-name|char-lessp|char-int|char-greaterp|char-font|char-equal|char-downcase|char-code|char-bits|char-bit|char|change-class|cerror|cell-error-name|ceiling|cdr|cddr|cdddr|cddddr|cdddar|cddar|cddadr|cddaar|cdar|cdadr|cdaddr|cdadar|cdaar|cdaadr|cdaaar|ccase|catenate|car|call-next-method|call-method|cadr|caddr|cadddr|caddar|cadar|cadadr|cadaar|caar|caadr|caaddr|caadar|caaar|caaadr|caaaar|byte-size|byte-position|byte|butlast|broadcast-stream-streams|break|boundp|both-case-p|boole|bit-xor|bit-vector-p|bit-orc2|bit-orc1|bit-not|bit-nor|bit-nand|bit-ior|bit-eqv|bit-andc2|bit-andc1|bit-and|bit|augment-environment|atom|atanh|atan|assoc-if-not|assoc-if|assoc|assert|asinh|asin|ash|arrayp|array-total-size|array-row-major-index|array-rank|array-in-bounds-p|array-has-fill-pointer-p|array-element-type|array-dimensions|array-dimension|arithmetic-error-operation|arithmetic-error-operands|aref|apropos-list|apropos|applyhook|apply|appending|append|alter|alphanumericp|alpha-char-p|adjustable-array-p|adjust-array|adjoin|add-method|acosh|acos|acons|abs|abort)\b scope: support.function.lisp diff --git a/Lisp/syntax_test_lisp.lisp b/Lisp/syntax_test_lisp.lisp index d4f9c93c3e..fc9ad0e5ab 100644 --- a/Lisp/syntax_test_lisp.lisp +++ b/Lisp/syntax_test_lisp.lisp @@ -203,3 +203,26 @@ ;^^^^ keyword.control ; ^^^^^ keyword.control ; ^^ keyword.control + +;############ +; FUNCTIONS # +;############ + +(defun averagenum (n1 n2 n3 n4) +;^ storage.type.function-type +; ^ entity.name.function + (/ ( + n1 n2 n3 n4) 4) +; ^ keyword.operator +; ^ keyword.operator +; ^ constant.numeric +) + +(defun what? (n1 n2 n3 n4) +;^ storage.type.function-type +; ^^^^^ entity.name.function +) + +(defun is>?! (n1 n2 n3 n4) +;^ storage.type.function-type +; ^^^^^ entity.name.function +) diff --git a/Lua/Indent.tmPreferences b/Lua/Indent.tmPreferences index 06a2348018..3de763c1f9 100644 --- a/Lua/Indent.tmPreferences +++ b/Lua/Indent.tmPreferences @@ -1,16 +1,16 @@ - - name - Indent - scope - source.lua - settings - decreaseIndentPattern - ^\s*(elseif|else|end|\})\s*$ - increaseIndentPattern - ^\s*(else|elseif|for|(local\s+)?function|if|repeat|until|while)\b((?!end).)*$|\{\s*$ + name + Indent + scope + source.lua + settings + + decreaseIndentPattern + (^\s*\b(elsei|elseif|else|end|until)\b.*$|^((?!\{).)*\}\;?.*$) + increaseIndentPattern + (^\s*\b(((local)?[\s\w=]+)?function|repeat|else|elseif|if|while)\b((?!\bend\b).)*$|^.*\b(do|then)\b((?!\bend\b).)*$|^.*\{((?!\}).)*$) + - diff --git a/Lua/Lua.sublime-syntax b/Lua/Lua.sublime-syntax index f62b661d68..a72b90424d 100644 --- a/Lua/Lua.sublime-syntax +++ b/Lua/Lua.sublime-syntax @@ -1,87 +1,782 @@ %YAML 1.2 --- -# http://www.sublimetext.com/docs/3/syntax.html -name: Lua -comment: "Lua Syntax: version 0.8" file_extensions: - lua scope: source.lua +variables: + reserved_word: |- + (?x:(?: + and|break|do|elseif|else|end|false|for|function|goto|if|in| + local|nil|not|or|repeat|return|then|true|until|while + ){{identifier_break}}) + reserved_word_statement: |- # excludes 'not', 'true', 'nil', 'false', 'function' + (?x:(?: + and|break|do|elseif|else|end|for|goto|if|in| + local|or|repeat|return|then|until|while + ){{identifier_break}}) + metamethod: |- # http://lua-users.org/wiki/MetatableEvents + (?x:__(?: + # special + index|newindex|call|tostring|len|i?pairs|gc + # math operators + |unm|add|sub|mul|i?div|mod|pow|concat + # bitwise operators + |band|bor|bxor|bnot|shl|shr + # comparison + |eq|lt|le + ){{identifier_break}}) + # __metatable and __mode don't use functions + metaproperty: (?:__(?:metatable|mode){{identifier_break}}) + + identifier_start: (?:[A-Za-z_]) + identifier_char: (?:[A-Za-z0-9_]) + identifier_break: (?!{{identifier_char}}) + identifier_raw: (?:{{identifier_start}}{{identifier_char}}*) + identifier: (?:(?!{{reserved_word}}){{identifier_raw}}) + + function_args_begin: (?:\(|"|'|\[=*\[|\{) + function_call_ahead: (?=\s*{{function_args_begin}}) + function_assignment_ahead: (?=\s*=\s*function{{identifier_break}}) + + dec_exponent: (?:[Ee][-+]?\d*) + hex_exponent: (?:[Pp][-+]?\d*) + contexts: main: - - match: '\b(function)\s+([a-zA-Z_.:]+[.:])?([a-zA-Z_]\w*)\s*(\()([^)]*)(\))' - scope: meta.function.lua - captures: - 1: keyword.control.lua - 2: entity.name.function.scope.lua - 3: entity.name.function.lua - 4: punctuation.definition.parameters.begin.lua - 5: variable.parameter.function.lua - 6: punctuation.definition.parameters.end.lua - - match: '(?~]=) + scope: keyword.operator.comparison.lua + push: expression-begin + - match: (?://|[-+*/%^]) + scope: keyword.operator.arithmetic.lua + push: expression-begin + - match: (?:>>|<<|[&|~]) + scope: keyword.operator.bitwise.lua + push: expression-begin + - match: (?:[<>]) + scope: keyword.operator.comparison.lua + push: expression-begin + - match: \.\. + scope: keyword.operator.concatenation.lua + push: expression-begin + - match: = + scope: keyword.operator.assignment.lua + push: expression-begin + - match: (?:and|or){{identifier_break}} + scope: keyword.operator.logical.lua + push: expression-begin + + accessor: + - match: '[.:]' + scope: punctuation.accessor.lua + push: property + + - match: \[ + scope: punctuation.section.brackets.begin.lua + push: + - meta_scope: meta.brackets.lua + - match: \] + scope: punctuation.section.brackets.end.lua + pop: true + - include: reserved-word-expression-pop + - match: (?=\S) + push: expression + + property: + - match: '{{metamethod}}{{function_assignment_ahead}}' + scope: meta.property.lua entity.name.function.lua support.function.metamethod.lua + pop: true + - match: '{{identifier}}{{function_assignment_ahead}}' + scope: meta.property.lua entity.name.function.lua + pop: true + - match: '{{identifier}}{{function_call_ahead}}' + scope: meta.property.lua variable.function.lua + pop: true + - match: '{{metaproperty}}' + scope: meta.property.lua support.other.metaproperty.lua + pop: true + - match: '{{identifier}}' + scope: meta.property.lua + pop: true + - include: reserved-word-pop + - include: else-pop + + function-arguments-meta: + - meta_scope: meta.function-call.arguments.lua + - include: immediately-pop + + function-arguments: + - include: string + - include: table-constructor + + - match: \( + scope: punctuation.section.group.begin.lua + set: + - meta_scope: meta.group.lua + - match: \) + scope: punctuation.section.group.end.lua + pop: true + - include: reserved-word-expression-pop + - match: (?=\S) + push: expression-list + + prefix-operator: + - match: '#' + scope: keyword.operator.length.lua + - match: \- + scope: keyword.operator.arithmetic.lua + - match: \~ + scope: keyword.operator.bitwise.lua + - match: not{{identifier_break}} + scope: keyword.operator.logical.lua + + reserved-word-pop: + - match: '{{reserved_word}}' + scope: invalid.unexpected-keyword.lua + pop: true + + reserved-word-expression-pop: + - match: '{{reserved_word_statement}}' + scope: invalid.unexpected-keyword.lua + pop: true + + builtin: + - match: true{{identifier_break}} + scope: constant.language.boolean.true.lua + pop: true + - match: false{{identifier_break}} + scope: constant.language.boolean.true.lua + pop: true + - match: nil{{identifier_break}} + scope: constant.language.null.lua + pop: true + - match: \.\.\. scope: constant.language.lua - - match: '(?=?|(? + + + name + Symbol List Function + scope + source.lua meta.name.function + settings + + showInSymbolList + 1 + symbolTransformation + s/\s+/ /g; + + + diff --git a/Lua/tests/syntax_test_lua.lua b/Lua/tests/syntax_test_lua.lua new file mode 100644 index 0000000000..8bf288a2c6 --- /dev/null +++ b/Lua/tests/syntax_test_lua.lua @@ -0,0 +1,597 @@ +-- SYNTAX TEST "Packages/Lua/Lua.sublime-syntax" + +--COMMENTS + + -- Foo! +-- ^ - comment +-- ^^^^^^^^ comment.line +-- ^^ punctuation.definition.comment + + + --[[ Foo! ]] +-- ^ - comment +-- ^^^^^^^^^^^^ comment.block +-- ^^^^ punctuation.definition.comment.begin +-- ^^ punctuation.definition.comment.end +-- ^ - comment + + --[=[ Foo! ]] ]=] +-- ^ - comment +-- ^^^^^^^^^^^^^^^^^ comment.block +-- ^^^^^ punctuation.definition.comment.begin +-- ^^ - punctuation +-- ^^^ punctuation.definition.comment.end +-- ^ - comment + + --[=[ +-- ^ - comment +-- ^^^^^ comment.block punctuation.definition.comment.begin + ]] +-- ^^^ comment.block - punctuation + ]==] +-- ^^^^ comment.block - punctuation + -- +-- ^^ - punctuation + [[ +-- ^^ - punctuation + ]=] +-- ^^^ comment.block punctuation.definition.comment.end +-- ^ - comment + +--VARIABLES + + foo; +-- ^^^ variable.other + + true_ish; +-- ^^^^^^^^ variable.other - constant + +--CONSTANTS + + true; +-- ^^^^ constant.language.boolean.true + + false; +-- ^^^^^ constant.language.boolean.true + + nil; +-- ^^^ constant.language.null + + ...; +-- ^^^ constant.language + + self; +-- ^^^^ variable.language.this + +--NUMBERS + + 0; +-- ^ constant.numeric.integer.decimal + + 1234567890; +-- ^^^^^^^^^^ constant.numeric.integer.decimal + + 12.345; +-- ^^^^^^ constant.numeric.float.decimal +-- ^ punctuation.separator.decimal + + 1.; +-- ^^ constant.numeric.float.decimal +-- ^ punctuation.separator.decimal + + .2; +-- ^^ constant.numeric.float.decimal +-- ^ punctuation.separator.decimal + + 1e10; +-- ^^^^ constant.numeric.float.decimal + + 0.5e+0; +-- ^^^^^^ constant.numeric.float.decimal +-- ^ punctuation.separator.decimal + + 9e-1; +-- ^^^^ constant.numeric.float.decimal + + 0x0; +-- ^^^ constant.numeric.integer.hexadecimal +-- ^^ punctuation.definition.numeric.base + + 0XdeafBEEF42; +-- ^^^^^^^^^^^^ constant.numeric.integer.hexadecimal +-- ^^ punctuation.definition.numeric.base + + 0xa.bc + 0xa. + 0x.b; +-- ^^^^^^ constant.numeric.float.hexadecimal +-- ^^ punctuation.definition.numeric.base +-- ^ punctuation.separator.decimal +-- ^^^^ constant.numeric.float.hexadecimal +-- ^^ punctuation.definition.numeric.base +-- ^ punctuation.separator.decimal +-- ^^^^ constant.numeric.float.hexadecimal +-- ^^ punctuation.definition.numeric.base +-- ^ punctuation.separator.decimal + + 0x1p10 + 0x1.p10 + 0x.1p10; +-- ^^^^^^ constant.numeric.float.hexadecimal +-- ^^ punctuation.definition.numeric.base +-- ^^^^^^^ constant.numeric.float.hexadecimal +-- ^^ punctuation.definition.numeric.base +-- ^ punctuation.separator.decimal +-- ^^^^^^^ constant.numeric.float.hexadecimal +-- ^^ punctuation.definition.numeric.base +-- ^ punctuation.separator.decimal + + 'foo'; +-- ^^^^^ string.quoted.single +-- ^ punctuation.definition.string.begin +-- ^ punctuation.definition.string.end + +--STRINGS + + 'foo'; +-- ^^^^^ string.quoted.single +-- ^ punctuation.definition.string.begin +-- ^ punctuation.definition.string.end + + '-- [['; +-- ^^^^^^^ string.quoted.single - comment + + "foo"; +-- ^^^^^ string.quoted.double +-- ^ punctuation.definition.string.begin +-- ^ punctuation.definition.string.end + + "-- [["; +-- ^^^^^^^ string.quoted.double - comment + + '\a\b\f\n\r\t\v\\\'\"\[\]'; +-- ^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.single +-- ^^^^^^^^^^^^^^^^^^^^^^^^ constant.character.escape + + '\x1ff'; +-- ^^^^ constant.character.escape.hexadecimal +-- ^ - constant + + '\0 \123 \1234'; +-- ^^ constant.character.escape.decimal +-- ^^^^ constant.character.escape.decimal +-- ^^^^ constant.character.escape.decimal +-- ^ - constant + + '\u{0} \u{f00d}'; +-- ^^^^^ constant.character.escape.unicode +-- ^^^^^^^^ constant.character.escape.unicode + + '\z +-- ^^^^^ constant.character.escape - invalid + '; + + '\z + +-- <- constant.character.escape + '; + + '\z done'; +-- ^^^^ constant.character.escape +-- ^^^^ - constant + + '\ +-- ^^ constant.character.escape + +-- <- - invalid + + 'foo\q'; +-- ^^ invalid.illegal.invalid-escape + + ' +-- ^ invalid.illegal.unclosed-string + + "foo\"\'"; +-- ^^^^^^^^^ string.quoted.double +-- ^ punctuation.definition.string.begin +-- ^^^^ constant.character.escape +-- ^ punctuation.definition.string.end + + [[ Foo! ]]; +-- ^^^^^^^^^^ string.quoted.multiline +-- ^^ punctuation.definition.string.begin +-- ^^ punctuation.definition.string.end + + [[ -- [[ ]]; +-- ^^^^^^^^^^^ string.quoted.multiline - comment + + [[ Foo! \a \]]; +-- ^^^^^^^^^^^^^^ string.quoted.multiline +-- ^^ punctuation.definition.string.begin +-- ^^^^ - constant +-- ^^ punctuation.definition.string.end + + [=[ Foo! ]] ]=]; +-- ^^^^^^^^^^^^^^^ string.quoted.multiline +-- ^^^ punctuation.definition.string.begin +-- ^^ - punctuation +-- ^^^ punctuation.definition.string.end + + [=[ +-- ^^^ string.quoted.multiline punctuation.definition.string.begin + ]] +-- ^^^ string.quoted.multiline - punctuation + ]==] +-- ^^^^ string.quoted.multiline - punctuation + ]=]; +-- ^^^ string.quoted.multiline punctuation.definition.string.end + +--OPERATORS + + #'foo'; +-- ^ keyword.operator.length + + -1; +-- ^ keyword.operator.arithmetic +-- ^ constant.numeric.integer.decimal + + ~1; +-- ^ keyword.operator.bitwise +-- ^ constant.numeric.integer.decimal + + not true; +-- ^^^ keyword.operator.logical +-- ^^^^ constant.language.boolean.true + + 2 + 2 - 2 * 2 / 2 // 2 % 2 ^ 2; +-- ^ keyword.operator.arithmetic +-- ^ keyword.operator.arithmetic +-- ^ keyword.operator.arithmetic +-- ^ keyword.operator.arithmetic +-- ^^ keyword.operator.arithmetic +-- ^ keyword.operator.arithmetic +-- ^ keyword.operator.arithmetic + + 2 >> 2 << 2 & 2 | 2 ~ 2; +-- ^^ keyword.operator.bitwise +-- ^^ keyword.operator.bitwise +-- ^ keyword.operator.bitwise +-- ^ keyword.operator.bitwise +-- ^ keyword.operator.bitwise + + 2 > 2; 2 < 2; 2 == 2; 2 >= 2; 2 <= 2; 2 ~= 2; +-- ^ keyword.operator.comparison +-- ^ keyword.operator.comparison +-- ^^ keyword.operator.comparison +-- ^^ keyword.operator.comparison +-- ^^ keyword.operator.comparison +-- ^^ keyword.operator.comparison + + true and false or nil; +-- ^^^ keyword.operator.logical +-- ^^ keyword.operator.logical + + 'foo' .. 'bar'; +-- ^^ keyword.operator.concatenation + + x = 42; +-- ^ keyword.operator.assignment + +--TABLES + + {}; +-- ^^ meta.mapping +-- ^ punctuation.section.block.begin +-- ^ punctuation.section.block.end + + {a, b + c; c}; +-- ^^^^^^^^^^^^^ meta.mapping +-- ^ punctuation.section.block.begin +-- ^ variable.other +-- ^ punctuation.separator.field +-- ^ variable.other +-- ^ variable.other +-- ^ punctuation.separator.field +-- ^ variable.other +-- ^ punctuation.section.block.end + + {[a] = x, b = y}; +-- ^^^^^^^^^^^^^^^^ meta.mapping - meta.mapping meta.mapping +-- ^^^ meta.mapping.key meta.brackets +-- ^ punctuation.section.brackets.begin +-- ^ variable.other +-- ^ punctuation.section.brackets.end +-- ^ punctuation.separator.key-value +-- ^ meta.mapping.value variable.other +-- ^ meta.mapping.lua punctuation.separator.field +-- ^ meta.mapping.key string.unquoted.key +-- ^ punctuation.separator.key-value +-- ^ meta.mapping variable.other + + {[[actually a string]], [=[this too]=]} +-- ^^ meta.mapping.lua string.quoted.multiline.lua punctuation.definition.string.begin.lua +-- ^^^ meta.mapping.lua string.quoted.multiline.lua punctuation.definition.string.begin.lua + + {some = 2}, {some == 2} +-- ^^^^ meta.mapping.key string.unquoted.key.lua +-- ^ punctuation.separator.key-value.lua +-- ^ meta.mapping.value constant.numeric.integer.decimal +-- ^^^^ variable.other.lua - meta.mapping.key +-- ^^ keyword.operator.comparison + + {__index = function(i) end, +-- ^^^^^^^ meta.mapping.key entity.name.function support.function.metamethod.lua + method = function () +-- ^^^^^^ meta.mapping.key.lua entity.name.function.lua - support + end, + __call = some_func, +-- ^^^^^^ meta.mapping.key.lua entity.name.function.lua support.function.metamethod.lua + not_method = some_var, +-- ^^^^^^^^^^ meta.mapping.key.lua string.unquoted.key.lua - entity - support + __metatable = nil, +-- ^^^^^^^^^^^ meta.mapping.key.lua string.unquoted.key.lua support.other.metaproperty.lua + } + +--PARENS + + (foo + bar); +-- ^^^^^^^^^^^ meta.group +-- ^ punctuation.section.group.begin +-- ^ punctuation.section.group.end + + foo.bar; +-- ^ punctuation.accessor +-- ^^^ meta.property + + foo.__mode = "kv"; +-- ^^^^^^ meta.property.lua support.other.metaproperty.lua + + foo:bar; +-- ^ punctuation.accessor +-- ^^^ meta.property + + foo.baz(); +-- ^ punctuation.accessor +-- ^^^ meta.property variable.function + + foo.baz ""; +-- ^ punctuation.accessor +-- ^^^ meta.property variable.function + + foo.baz ''; +-- ^ punctuation.accessor +-- ^^^ meta.property variable.function + + foo.baz [=[ a string ]=]; +-- ^ punctuation.accessor +-- ^^^ meta.property variable.function + + foo.baz {}; +-- ^ punctuation.accessor +-- ^^^ meta.property variable.function +-- ^^ meta.function-call.arguments meta.mapping + + foo[bar + baz]; +-- ^^^^^^^^^^^ meta.brackets +-- ^ punctuation.section.brackets.begin +-- ^ punctuation.section.brackets.end + + (not nil) +-- ^^^ keyword.operator.logical.lua +-- ^^^ constant.language.null.lua + + (function () return; end) +-- ^^^^^^^^^^^^^^^^^^^^^^^ - illegal + + (return) +-- ^^^^^^ meta.group.lua invalid.unexpected-keyword.lua + + foo[return] foo[false] +-- ^^^^^^ invalid.unexpected-keyword.lua +-- ^ - meta.brackets +-- ^^^^^ constant.language.boolean.true.lua + + some.return +-- ^^^^^^ invalid.unexpected-keyword.lua + +--FUNCTION CALLS + + f(42); +-- ^ variable.function +-- ^ meta.function-call.arguments meta.group +-- ^ punctuation.section.group.begin +-- ^ punctuation.section.group.end + + f "argument"; +-- ^ variable.function +-- ^^^^^^^^^^ meta.function-call.arguments string.quoted.double + + f + 'argument'; +-- ^^^^^^^^^^ meta.function-call.arguments string.quoted.single + + f [[ foo ]]; +-- ^ variable.function +-- ^^^^^^^^^ meta.function-call.arguments string.quoted.multiline + + f {}; +-- ^ variable.function +-- ^^ meta.function-call.arguments meta.mapping + + f( 'unclosed) + return x +-- ^^^^^^ meta.function-call.arguments.lua meta.group.lua invalid.unexpected-keyword.lua +-- ^ - meta.function-call + +--FUNCTIONS + + function function_name( a, b, ... ) +-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function +-- ^^^^^^^^ storage.type.function +-- ^^^^^^^^^^^^^ entity.name.function +-- ^^^^^^^^^^^^^ meta.group +-- ^ punctuation.section.group.begin +-- ^ variable.parameter.function +-- ^ punctuation.separator.comma +-- ^ variable.parameter.function +-- ^ punctuation.separator.comma +-- ^^^ constant.language +-- ^ punctuation.section.group.end + end +-- ^^^ meta.function meta.block keyword.control.end + + function foo.bar:baz (...) end +-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function +-- ^^^ variable.other - entity +-- ^ punctuation.accessor +-- ^^^ meta.property - entity +-- ^ punctuation.accessor +-- ^^^ meta.property entity.name.function +-- ^^^^^ meta.group +-- ^^^ keyword.control.end + + function foo.bar:__index (...) end +-- ^^^^^^^ meta.name.function meta.property.lua entity.name.function.lua support.function.metamethod.lua + + function foo + .bar () end +-- ^^^^^^^^^^^ meta.function +-- ^ punctuation.accessor +-- ^^^ entity.name.function + + local function foo () end +-- ^^^^^ storage.modifier +-- ^^^^^^^^^^^^^^^^^^^ meta.function +-- ^^^ entity.name.function + + ~function( a, b, ... ) end; +-- ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function +-- ^^^^^^^^ storage.type +-- ^^^^^^^^^^^^^ meta.group +-- ^^^ keyword.control.end + + ~function foo () end; +-- ^^^^^^^^^^^^^^^^^^^ meta.function +-- ^^^ entity.name.function + + foo = function() end; +-- ^^^ entity.name.function + + foo.bar = function() end; +-- ^^^ meta.property entity.name.function + + foo.__call = function() end; +-- ^^^^^^ meta.property.lua entity.name.function.lua support.function.metamethod.lua + + function (return) end; +-- ^^^^^^ invalid.unexpected-keyword.lua + +--STATEMENTS + + end; +-- ^^^ invalid.illegal.unexpected-end + + do +-- ^^^ meta.block +-- ^^ keyword.control + 2 + 2 + end +-- ^^^^ meta.block +-- ^^^ keyword.control.end + + do 2 + 2 end +-- ^^^^^^^^^^^^ meta.block +-- ^^ keyword.control +-- ^^^ keyword.control.end + + if true then +-- ^^ keyword.control.conditional +-- ^^^^ keyword.control.conditional + 2 + 2 + elseif false then +-- ^^^^^^ keyword.control.conditional +-- ^^^^ keyword.control.conditional + else +-- ^^^^ keyword.control.conditional + end + + if true end +-- ^^^^^^^^^^^ - meta.block +-- ^^^ invalid.illegal.unexpected-end + + while true do +-- ^^^^^ keyword.control.loop +-- ^^ keyword.control + 2 + 2 + end +-- ^^^ keyword.control.end + + while true end +-- ^^^^^^^^^^^^^^ - meta.block +-- ^^^ invalid.illegal.unexpected-end + + repeat +-- ^^^^^^ keyword.control.loop + 2 + 2; + + end; +-- ^^^ invalid.illegal.unexpected-end + until true; +-- ^^^^^ keyword.control.loop +-- ^^^^ constant.language.boolean.true + + for x = 1, y, z do end +-- ^^^ keyword.control.loop +-- ^ variable.other +-- ^ keyword.operator.assignment +-- ^ punctuation.separator.comma +-- ^ variable.other +-- ^ punctuation.separator.comma +-- ^ variable.other +-- ^^^^^^ meta.block +-- ^^ keyword.control +-- ^^^ keyword.control.end + + for x, y in a, b do end +-- ^^^ keyword.control.loop +-- ^ variable.other +-- ^ punctuation.separator.comma +-- ^ variable.other +-- ^^ keyword.control.loop +-- ^ variable.other +-- ^ punctuation.separator.comma +-- ^ variable.other +-- ^^^^^^ meta.block +-- ^^ keyword.control +-- ^^^ keyword.control.end + + for x in a end +-- ^^^^^^^^^^^^^^ - meta.block +-- ^^^ invalid.illegal.unexpected-end + + + :: foo ::; +-- ^^ punctuation.definition.label.begin +-- ^^^ entity.name.label +-- ^^ punctuation.definition.label.end + + goto foo; +-- ^^^^ keyword.control.goto +-- ^^^ variable.label + + break; +-- ^^^^^ keyword.control.break + + return; +-- ^^^^^^ keyword.control.return + + return foo; +-- ^^^^^^ keyword.control.return +-- ^^^ variable.other + + local x = 1, y = 2; +-- ^^^^^ storage.modifier +-- ^ variable.other +-- ^ keyword.operator.assignment +-- ^ constant.numeric.integer.decimal +-- ^ punctuation.separator.comma +-- ^ variable.other +-- ^ keyword.operator.assignment +-- ^ constant.numeric.integer.decimal +-- ^ punctuation.terminator.statement diff --git a/Lua/tests/syntax_test_lua_support.lua b/Lua/tests/syntax_test_lua_support.lua new file mode 100644 index 0000000000..62296c5867 --- /dev/null +++ b/Lua/tests/syntax_test_lua_support.lua @@ -0,0 +1,808 @@ +-- SYNTAX TEST "Packages/Lua/Lua.sublime-syntax" + + _G; +-- ^^ support.constant.builtin + + _VERSION; +-- ^^^^^^^^ support.constant.builtin + + assert(); +-- ^^^^^^ support.function.builtin + + collectgarbage(); +-- ^^^^^^^^^^^^^^ support.function.builtin + + dofile(); +-- ^^^^^^ support.function.builtin + + error(); +-- ^^^^^ support.function.builtin + + getfenv(); +-- ^^^^^^^ support.function.builtin + + getmetatable(); +-- ^^^^^^^^^^^^ support.function.builtin + + ipairs(); +-- ^^^^^^ support.function.builtin + + load(); +-- ^^^^ support.function.builtin + + loadfile(); +-- ^^^^^^^^ support.function.builtin + + module(); +-- ^^^^^^ support.function.builtin + + next(); +-- ^^^^ support.function.builtin + + pairs(); +-- ^^^^^ support.function.builtin + + pcall(); +-- ^^^^^ support.function.builtin + + print(); +-- ^^^^^ support.function.builtin + + rawequal(); +-- ^^^^^^^^ support.function.builtin + + rawget(); +-- ^^^^^^ support.function.builtin + + rawlen(); +-- ^^^^^^ support.function.builtin + + rawset(); +-- ^^^^^^ support.function.builtin + + select(); +-- ^^^^^^ support.function.builtin + + setfenv(); +-- ^^^^^^^ support.function.builtin + + setmetatable(); +-- ^^^^^^^^^^^^ support.function.builtin + + tonumber(); +-- ^^^^^^^^ support.function.builtin + + tostring(); +-- ^^^^^^^^ support.function.builtin + + type(); +-- ^^^^ support.function.builtin + + unpack(); +-- ^^^^^^ support.function.builtin + + xpcall(); +-- ^^^^^^ support.function.builtin + + require(); +-- ^^^^^^^ support.function.builtin + + coroutine; +-- ^^^^^^^^^ support.constant.builtin + + coroutine.create(); +-- ^^^^^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^ meta.property support.function.builtin + + coroutine.isyieldable(); +-- ^^^^^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^^^^^^ meta.property support.function.builtin + + coroutine.resume(); +-- ^^^^^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^ meta.property support.function.builtin + + coroutine.running(); +-- ^^^^^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^^ meta.property support.function.builtin + + coroutine.status(); +-- ^^^^^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^ meta.property support.function.builtin + + coroutine.wrap(); +-- ^^^^^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^ meta.property support.function.builtin + + coroutine.yield(); +-- ^^^^^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^ meta.property support.function.builtin + + package; +-- ^^^^^^^ support.constant.builtin + + package.config; +-- ^^^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^ meta.property support.constant.builtin + + package.cpath; +-- ^^^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^ meta.property support.constant.builtin + + package.loaded; +-- ^^^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^ meta.property support.constant.builtin + + package.loaders; +-- ^^^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^^ meta.property support.constant.builtin + + package.path; +-- ^^^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^ meta.property support.constant.builtin + + package.preload; +-- ^^^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^^ meta.property support.constant.builtin + + package.searchers; +-- ^^^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^^^^ meta.property support.constant.builtin + + package.loadlib(); +-- ^^^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^^ meta.property support.function.builtin + + package.searchpath(); +-- ^^^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^^^^^ meta.property support.function.builtin + + package.seeall(); +-- ^^^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^ meta.property support.function.builtin + + string; +-- ^^^^^^ support.constant.builtin + + string.byte(); +-- ^^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^ meta.property support.function.builtin + + string.char(); +-- ^^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^ meta.property support.function.builtin + + string.dump(); +-- ^^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^ meta.property support.function.builtin + + string.find(); +-- ^^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^ meta.property support.function.builtin + + string.format(); +-- ^^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^ meta.property support.function.builtin + + string.gmatch(); +-- ^^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^ meta.property support.function.builtin + + string.gsub(); +-- ^^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^ meta.property support.function.builtin + + string.len(); +-- ^^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^ meta.property support.function.builtin + + string.lower(); +-- ^^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^ meta.property support.function.builtin + + string.match(); +-- ^^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^ meta.property support.function.builtin + + string.pack(); +-- ^^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^ meta.property support.function.builtin + + string.packsize(); +-- ^^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^^^ meta.property support.function.builtin + + string.rep(); +-- ^^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^ meta.property support.function.builtin + + string.reverse(); +-- ^^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^^ meta.property support.function.builtin + + string.sub(); +-- ^^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^ meta.property support.function.builtin + + string.unpack(); +-- ^^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^ meta.property support.function.builtin + + string.upper(); +-- ^^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^ meta.property support.function.builtin + + utf8; +-- ^^^^ support.constant.builtin + + utf8.charpattern; +-- ^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^^^^^^ meta.property support.constant.builtin + + utf8.char(); +-- ^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^ meta.property support.function.builtin + + utf8.codes(); +-- ^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^ meta.property support.function.builtin + + utf8.codepoint(); +-- ^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^^^^ meta.property support.function.builtin + + utf8.len(); +-- ^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^ meta.property support.function.builtin + + utf8.offset(); +-- ^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^ meta.property support.function.builtin + + table; +-- ^^^^^ support.constant.builtin + + table.concat(); +-- ^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^ meta.property support.function.builtin + + table.insert(); +-- ^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^ meta.property support.function.builtin + + table.maxn(); +-- ^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^ meta.property support.function.builtin + + table.move(); +-- ^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^ meta.property support.function.builtin + + table.pack(); +-- ^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^ meta.property support.function.builtin + + table.remove(); +-- ^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^ meta.property support.function.builtin + + table.sort(); +-- ^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^ meta.property support.function.builtin + + table.unpack(); +-- ^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^ meta.property support.function.builtin + + math; +-- ^^^^ support.constant.builtin + + math.huge; +-- ^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^ meta.property support.constant.builtin + + math.maxinteger; +-- ^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^^^^^ meta.property support.constant.builtin + + math.mininteger; +-- ^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^^^^^ meta.property support.constant.builtin + + math.pi; +-- ^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^ meta.property support.constant.builtin + + math.abs(); +-- ^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^ meta.property support.function.builtin + + math.acos(); +-- ^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^ meta.property support.function.builtin + + math.asin(); +-- ^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^ meta.property support.function.builtin + + math.atan(); +-- ^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^ meta.property support.function.builtin + + math.atan2(); +-- ^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^ meta.property support.function.builtin + + math.ceil(); +-- ^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^ meta.property support.function.builtin + + math.cos(); +-- ^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^ meta.property support.function.builtin + + math.cosh(); +-- ^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^ meta.property support.function.builtin + + math.deg(); +-- ^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^ meta.property support.function.builtin + + math.exp(); +-- ^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^ meta.property support.function.builtin + + math.floor(); +-- ^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^ meta.property support.function.builtin + + math.fmod(); +-- ^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^ meta.property support.function.builtin + + math.frexp(); +-- ^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^ meta.property support.function.builtin + + math.ldexp(); +-- ^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^ meta.property support.function.builtin + + math.log(); +-- ^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^ meta.property support.function.builtin + + math.log10(); +-- ^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^ meta.property support.function.builtin + + math.max(); +-- ^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^ meta.property support.function.builtin + + math.min(); +-- ^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^ meta.property support.function.builtin + + math.modf(); +-- ^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^ meta.property support.function.builtin + + math.pow(); +-- ^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^ meta.property support.function.builtin + + math.rad(); +-- ^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^ meta.property support.function.builtin + + math.random(); +-- ^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^ meta.property support.function.builtin + + math.randomseed(); +-- ^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^^^^^ meta.property support.function.builtin + + math.sin(); +-- ^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^ meta.property support.function.builtin + + math.sinh(); +-- ^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^ meta.property support.function.builtin + + math.sqrt(); +-- ^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^ meta.property support.function.builtin + + math.tan(); +-- ^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^ meta.property support.function.builtin + + math.tanh(); +-- ^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^ meta.property support.function.builtin + + math.tointeger(); +-- ^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^^^^ meta.property support.function.builtin + + math.type(); +-- ^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^ meta.property support.function.builtin + + math.ult(); +-- ^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^ meta.property support.function.builtin + + io; +-- ^^ support.constant.builtin + + io.stderr; +-- ^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^ meta.property support.constant.builtin + + io.stdin; +-- ^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^ meta.property support.constant.builtin + + io.stdout; +-- ^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^ meta.property support.constant.builtin + + io.close(); +-- ^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^ meta.property support.function.builtin + + io.flush(); +-- ^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^ meta.property support.function.builtin + + io.input(); +-- ^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^ meta.property support.function.builtin + + io.lines(); +-- ^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^ meta.property support.function.builtin + + io.open(); +-- ^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^ meta.property support.function.builtin + + io.output(); +-- ^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^ meta.property support.function.builtin + + io.popen(); +-- ^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^ meta.property support.function.builtin + + io.read(); +-- ^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^ meta.property support.function.builtin + + io.tmpfile(); +-- ^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^^ meta.property support.function.builtin + + io.type(); +-- ^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^ meta.property support.function.builtin + + io.write(); +-- ^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^ meta.property support.function.builtin + + os; +-- ^^ support.constant.builtin + + os.clock(); +-- ^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^ meta.property support.function.builtin + + os.date(); +-- ^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^ meta.property support.function.builtin + + os.difftime(); +-- ^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^^^ meta.property support.function.builtin + + os.execute(); +-- ^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^^ meta.property support.function.builtin + + os.exit(); +-- ^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^ meta.property support.function.builtin + + os.getenv(); +-- ^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^ meta.property support.function.builtin + + os.remove(); +-- ^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^ meta.property support.function.builtin + + os.rename(); +-- ^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^ meta.property support.function.builtin + + os.setlocale(); +-- ^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^^^^ meta.property support.function.builtin + + os.time(); +-- ^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^ meta.property support.function.builtin + + os.tmpname(); +-- ^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^^ meta.property support.function.builtin + + debug; +-- ^^^^^ support.constant.builtin + + debug.debug(); +-- ^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^ meta.property support.function.builtin + + debug.getfenv(); +-- ^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^ meta.property support.function.builtin + + debug.gethook(); +-- ^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^^ meta.property support.function.builtin + + debug.getinfo(); +-- ^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^^ meta.property support.function.builtin + + debug.getlocal(); +-- ^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^^^ meta.property support.function.builtin + + debug.getmetatable(); +-- ^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^^^^^^^ meta.property support.function.builtin + + debug.getregistry(); +-- ^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^^^^^^ meta.property support.function.builtin + + debug.getupvalue(); +-- ^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^^^^^ meta.property support.function.builtin + + debug.getuservalue(); +-- ^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^^^^^^^ meta.property support.function.builtin + + debug.setfenv(); +-- ^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^^ meta.property support.function.builtin + + debug.sethook(); +-- ^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^^ meta.property support.function.builtin + + debug.setlocal(); +-- ^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^^^ meta.property support.function.builtin + + debug.setmetatable(); +-- ^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^^^^^^^ meta.property support.function.builtin + + debug.setupvalue(); +-- ^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^^^^^ meta.property support.function.builtin + + debug.setuservalue(); +-- ^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^^^^^^^ meta.property support.function.builtin + + debug.traceback(); +-- ^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^^^^ meta.property support.function.builtin + + debug.upvalueid(); +-- ^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^^^^ meta.property support.function.builtin + + debug.upvaluejoin(); +-- ^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^^^^^^ meta.property support.function.builtin + + bit32; +-- ^^^^^ support.constant.builtin + + bit32.arshift(); +-- ^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^^ meta.property support.function.builtin + + bit32.band(); +-- ^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^ meta.property support.function.builtin + + bit32.bnot(); +-- ^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^ meta.property support.function.builtin + + bit32.bor(); +-- ^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^ meta.property support.function.builtin + + bit32.btest(); +-- ^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^ meta.property support.function.builtin + + bit32.bxor(); +-- ^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^ meta.property support.function.builtin + + bit32.extract(); +-- ^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^^ meta.property support.function.builtin + + bit32.lrotate(); +-- ^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^^ meta.property support.function.builtin + + bit32.lshift(); +-- ^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^ meta.property support.function.builtin + + bit32.replace(); +-- ^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^^ meta.property support.function.builtin + + bit32.rrotate(); +-- ^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^^ meta.property support.function.builtin + + bit32.rshift(); +-- ^^^^^ support.constant.builtin +-- ^ punctuation.accessor +-- ^^^^^^ meta.property support.function.builtin diff --git a/Makefile/Makefile.sublime-settings b/Makefile/Makefile.sublime-settings index 9086df0140..224d4c27e7 100644 --- a/Makefile/Makefile.sublime-settings +++ b/Makefile/Makefile.sublime-settings @@ -1,4 +1,3 @@ { - "translate_tabs_to_spaces": false, - "detect_indentation": true + "translate_tabs_to_spaces": false } diff --git a/Makefile/Makefile.sublime-syntax b/Makefile/Makefile.sublime-syntax index 7c18de160e..3cc3a97ef6 100644 --- a/Makefile/Makefile.sublime-syntax +++ b/Makefile/Makefile.sublime-syntax @@ -21,7 +21,11 @@ file_extensions: - OCamlMakefile - mak - mk -first_line_match: ^#!\s*/usr/bin/make\b +first_line_match: |- + (?xi: + ^\#! .* \bmake\b | # shebang + ^\# \s* -\*- [^*]* makefile [^*]* -\*- # editorconfig + ) scope: source.makefile #------------------------------------------------------------------------------- variables: @@ -136,7 +140,7 @@ contexts: - match: "'" scope: punctuation.definition.string.begin.makefile push: - - meta_scope: string.quoted.single.makefile + - meta_scope: meta.string.makefile string.quoted.single.makefile - match: "'" scope: punctuation.definition.string.end.makefile pop: true @@ -146,7 +150,7 @@ contexts: - match: '"' scope: punctuation.definition.string.begin.makefile push: - - meta_scope: string.quoted.double.makefile + - meta_scope: meta.string.makefile string.quoted.double.makefile - match: '"' scope: punctuation.definition.string.end.makefile pop: true @@ -174,7 +178,7 @@ contexts: - include: highlight-wildcard-sign - match: \s set: - - meta_content_scope: string.unquoted.makefile + - meta_content_scope: meta.string.makefile string.unquoted.makefile - include: pop-on-line-end - include: pop-on-line-end - match: ^\s*(vpath)$ @@ -183,7 +187,7 @@ contexts: captures: 1: keyword.control.import.makefile push: - - meta_content_scope: string.unquoted.makefile + - meta_content_scope: meta.string.makefile string.unquoted.makefile - include: continuation-or-pop-on-line-end - include: variable-substitutions - include: comments @@ -310,7 +314,7 @@ contexts: recipe-common: - include: control-flow - match: ^\n - + shell: # Due to how the shell syntax handles comments, we must account for the case # where a recipe-line is a single comment in combination with an "@" or "-" @@ -353,7 +357,7 @@ contexts: - match: "'" scope: punctuation.definition.string.begin.makefile push: - - meta_scope: string.quoted.single.makefile + - meta_scope: meta.string.makefile string.quoted.single.makefile - match: "'" scope: punctuation.definition.string.end.makefile pop: true @@ -363,7 +367,7 @@ contexts: - match: '"' scope: punctuation.definition.string.begin.makefile push: - - meta_scope: string.quoted.double.makefile + - meta_scope: meta.string.makefile string.quoted.double.makefile - match: '"' scope: punctuation.definition.string.end.makefile pop: true @@ -376,7 +380,8 @@ contexts: scope: constant.character.escape.makefile comments-pop-on-line-end: - - match: \n + - include: line-continuation + - match: $\n? pop: true comments: @@ -411,6 +416,9 @@ contexts: push: textual-parenthesis-balancer - match: \, scope: punctuation.separator.makefile + # eat escaped or unbalanced quotation marks in front of the `,` separator + # to highlight them as ordinary part of the surrounding unquoted string + - match: '\\[''""]|[''""](?=\s*,)' - include: variable-substitutions - include: quoted-string @@ -564,7 +572,7 @@ contexts: set: - match: (!|\?|\+|::?)?= scope: keyword.operator.assignment.makefile - set: [value-to-be-defined, eat-whitespace-then-pop] + set: [value-maybe-shellscript, eat-whitespace-then-pop] - include: variable-substitutions - include: continuation-or-pop-on-line-end - include: variable-substitutions @@ -579,8 +587,21 @@ contexts: - match: \s* pop: true + value-maybe-shellscript: + - match: ((?:bash|sh|zsh)\s+-c\s+)(['"`]) + captures: + 1: meta.string.makefile string.unquoted.makefile + 2: meta.string.makefile meta.interpolation.makefile punctuation.section.interpolation.begin.makefile + embed: scope:source.shell + embed_scope: meta.string.makefile meta.interpolation.makefile + escape: (?!<\\)\2 + escape_captures: + 0: meta.string.makefile meta.interpolation.makefile punctuation.section.interpolation.end.makefile + - match: '' + set: value-to-be-defined + value-to-be-defined: - - meta_content_scope: string.unquoted.makefile + - meta_content_scope: meta.string.makefile string.unquoted.makefile - include: escape-literals - match: (?=#) set: @@ -588,34 +609,38 @@ contexts: scope: punctuation.definition.comment.makefile set: - meta_scope: comment.line.number-sign.makefile - - include: pop-on-line-end + - include: comments-pop-on-line-end - include: variable-substitutions - include: continuation-or-pop-on-line-end inside-define-directive-context: - meta_content_scope: variable.other.makefile - - match: \s*(?=(!|\?|\+|::?)?=\s*$\n) + - match: (?=(!|\?|\+|::?)?=\s*\n) set: - - match: ((!|\?|\+|::?)?=)\s*$\n + - match: ((!|\?|\+|::?)?=)\s*\n captures: 1: keyword.operator.assignment.makefile - set: - - meta_content_scope: string.unquoted.makefile - - match: ^\s*(endef) - captures: - 1: keyword.control.makefile - pop: true + set: inside-define-directive-value + # Need to eat the actual newline character in order to start the # string.unquoted scope on the next line. - - match: $\n - set: - - meta_content_scope: string.unquoted.makefile - - match: ^\s*(endef) - captures: - 1: keyword.control.makefile - pop: true + - match: \n + set: inside-define-directive-value - include: variable-substitutions + inside-define-directive-value: + - meta_content_scope: meta.string.makefile string.unquoted.makefile + - match: ^\s*(endef)\b + captures: + 1: keyword.control.makefile + pop: true + # keep in balance with nested define statements + # see: https://github.com/sublimehq/Packages/issues/1998 + - match: ^\s*define\b + push: + - match: ^\s*endef\b + pop: true + variable-sub-common: - match: ':' scope: punctuation.definition.substitution.makefile diff --git a/Makefile/syntax_test_makefile.mak b/Makefile/syntax_test_makefile.mak index e0933ad380..9510459591 100644 --- a/Makefile/syntax_test_makefile.mak +++ b/Makefile/syntax_test_makefile.mak @@ -62,6 +62,10 @@ foo = bar # a comment # ^ string.unquoted # ^ comment.line punctuation - string.unquoted +foo = bar # a multiline \ + comment +# ^ comment.line + ################################# # 6.3.2 computed variable names # ################################# @@ -89,6 +93,18 @@ define $(dir)_print = lpr $($(dir)_sources) endef +define FOO + BAR := 1 + define BAZ +# ^^^^^^ string.unquoted.makefile - keyword + X := 1 + endef +# ^^^^^^ string.unquoted.makefile - keyword +Y := 3 +endef # comment +#^^^^ keyword.control.makefile +# ^^^ comment.line.number-sign.makefile + ######################### # 6.5 setting variables # ######################### @@ -335,6 +351,15 @@ FOO = some \ here # ^ string.unquoted +# echo I am a comment \ + echo I am a comment, too! +# ^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line + +# echo I am a comment \ + echo I am a comment, too! + echo I am no comment... +# ^^^^^^^^^^^^^^^^^^^^^^^ - comment.line + reverse = $(2) $(1) # <- variable.other # ^ keyword.operator.assignment @@ -840,6 +865,28 @@ LIBRARIES := $(filter $(notdir $(wildcard $(HOME)/energia_sketchbook/libraries/* # ^ string.quoted.double.makefile punctuation.definition.string.begin.makefile # ^ string.quoted.double.makefile punctuation.definition.string.end.makefile +# FIX: https://github.com/sublimehq/Packages/issues/1941 +escape_shellstring = $(subst `,\`,$(subst ",\",$(subst $$,\$$,$(subst \,\\,$1)))) +# ^^^^^^^^ meta.function-call.makefile +# ^^^^^ meta.function-call.arguments.makefile - meta.function-call.makefile +# ^^^^^^^^ meta.function-call.arguments.makefile meta.function-call.makefile +# ^^^^^ meta.function-call.arguments.makefile meta.function-call.arguments.makefile - meta.function-call.makefile +# ^^^^^^^^ meta.function-call.arguments.makefile meta.function-call.arguments.makefile meta.function-call.makefile +# ^^^^^^^ meta.function-call.arguments.makefile meta.function-call.arguments.makefile meta.function-call.arguments.makefile - meta.function-call.makefile +# ^^^^^^^^ meta.function-call.arguments.makefile meta.function-call.arguments.makefile meta.function-call.arguments.makefile meta.function-call.makefile +# ^^^^^^^ meta.function-call.arguments.makefile meta.function-call.arguments.makefile meta.function-call.arguments.makefile meta.function-call.arguments.makefile - meta.function-call.makefile +# ^ meta.function-call.arguments.makefile meta.function-call.arguments.makefile meta.function-call.arguments.makefile keyword.other.block.end.makefile +# ^ meta.function-call.arguments.makefile meta.function-call.arguments.makefile keyword.other.block.end.makefile +# ^ meta.function-call.arguments.makefile keyword.other.block.end.makefile +# ^ keyword.other.block.end.makefile +# ^ - meta +# ^ - punctuation +# ^ punctuation.separator.makefile +# ^^ - punctuation +# ^ - punctuation +# ^ punctuation.separator.makefile +# ^^ - punctuation + .SECONDEXPANSION: # <- meta.function entity.name.function # ^ keyword.operator.assignment - entity.name.function @@ -870,3 +917,18 @@ target2: @# # Regular Message #^ comment - variable @FeedProcessorSIAC -origin CTS -decodeData "binData" + +TESTTOOL = sh -c '\ +# ^ keyword.operator.assignment.makefile +# ^^^^^^ meta.string.makefile - meta.interpolation +# ^^^ meta.string.makefile meta.interpolation.makefile +# ^^^^^^ string.unquoted.makefile +# ^ punctuation.section.interpolation.begin.makefile +# ^ source.shell punctuation.separator.continuation.line.shell + if something; then + build_thisway $$1 $$2; + fi' TESTTOOL +# ^^^ meta.string.makefile meta.interpolation.makefile +# ^^^^^^^^^ meta.string.makefile string.unquoted.makefile - meta.interpolation +# ^^ source.shell keyword.control.conditional.end.shell +# ^ punctuation.section.interpolation.end.makefile diff --git a/Markdown/Markdown.sublime-syntax b/Markdown/Markdown.sublime-syntax index d706bdf525..19dc685db7 100644 --- a/Markdown/Markdown.sublime-syntax +++ b/Markdown/Markdown.sublime-syntax @@ -24,6 +24,7 @@ variables: ) [ \t]*$ # followed by any number of tabs or spaces, followed by the end of the line ) + setext_escape: ^(?=\s{0,3}(?:---+|===+)\s*$) block_quote: (?:[ ]{,3}>(?:.|$)) # between 0 and 3 spaces, followed by a greater than sign, followed by any character or the end of the line atx_heading: (?:[#]{1,6}\s*) # between 1 and 6 hashes, followed by any amount of whitespace indented_code_block: (?:[ ]{4}|\t) # 4 spaces or a tab @@ -95,8 +96,7 @@ variables: ) fenced_code_block_start: |- (?x: - [ ]* - ([ ]{0,3}) # up to 3 spaces + ([ \t]*) ( (`){3,} # 3 or more backticks (?![^`]*`) # not followed by any more backticks on the same line @@ -118,7 +118,7 @@ variables: code_fence_escape: |- (?x: ^ # the beginning of the line - [ ]* + [ \t]* ( \2 # the backtick/tilde combination that opened the code fence (?:\3|\4)* # plus optional additional closing characters @@ -167,6 +167,11 @@ variables: (?i:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul) (?:\s|$|/?>) ) + ascii_space: '\t\n\f ' + tag_attribute_name_start: (?=[^{{ascii_space}}=/>}]) + tag_attribute_name_break: (?=[{{ascii_space}}=/>}]) + tag_unquoted_attribute_start: (?=[^{{ascii_space}}=/>}]) + tag_unquoted_attribute_break: (?=[{{ascii_space}}}]|/?>) # code_fence_escape: |- # (?x: # ^ # the beginning of the line @@ -190,6 +195,7 @@ contexts: pattern will only match stuff matched by the sub-patterns. push: - meta_scope: meta.block-level.markdown + - include: ligatures - include: block-quote - include: indented-code-block - include: atx-heading @@ -271,40 +277,69 @@ contexts: 8: markup.underline.link.markdown push: [link-ref-def, after-link-title, link-title] - match: '^(?=\S)(?![=-]{3,}\s*$)' - push: - - meta_scope: meta.paragraph.markdown - - match: |- - (?x) # pop out of this context when one of the following conditions are met: - ^(?: - \s*$ # the line is blank (or only contains whitespace) - | (?= - {{block_quote}} # a block quote begins the line - | [ ]{,3}[*+-][ ] # an unordered list item begins the line - | [ ]{,3}1[.][ ] # an ordered list item with number "1" begins the line - | \# # an ATX heading begins the line - | [ ]{,3}<( # all types of HTML blocks except type 7 may interrupt a paragraph - {{html_tag_block_end_at_close_tag}} # 1 - | !-- # 2 - | \? # 3 - | ![A-Z] # 4 - | !\[CDATA\[ # 5 - | {{html_tag_block_end_at_blank_line}} # 6 - ) + branch_point: heading2-branch + branch: + - not-heading2 + - heading2 + + not-paragraph: + - match: |- + (?x) # pop out of this context when one of the following conditions are met: + ^(?: + \s*$ # the line is blank (or only contains whitespace) + | (?= + {{block_quote}} # a block quote begins the line + | [ ]{,3}[*+-][ ] # an unordered list item begins the line + | [ ]{,3}1[.][ ] # an ordered list item with number "1" begins the line + | \# # an ATX heading begins the line + | [ ]{,3}<( # all types of HTML blocks except type 7 may interrupt a paragraph + {{html_tag_block_end_at_close_tag}} # 1 + | !-- # 2 + | \? # 3 + | ![A-Z] # 4 + | !\[CDATA\[ # 5 + | {{html_tag_block_end_at_blank_line}} # 6 ) ) - pop: true - - include: inline-bold-italic-linebreak - - include: scope:text.html.basic - - match: '^(={3,})(?=[ \t]*$)' - scope: markup.heading.1.setext.markdown - captures: - 1: punctuation.definition.heading.setext.markdown - pop: true - - match: '^(-{3,})(?=[ \t]*$)' - scope: markup.heading.2.setext.markdown - captures: - 1: punctuation.definition.heading.setext.markdown - pop: true + ) + pop: true + + not-heading2: + - include: not-paragraph + - match: (?=\S) + branch_point: heading1-branch + branch: + - paragraph + - heading1 + - match: '' + pop: true + + paragraph: + - meta_scope: meta.paragraph.markdown + - match: ^\s{0,3}===+\s*$ + fail: heading1-branch + - match: ^\s{0,3}---+\s*$ + fail: heading2-branch + - include: not-paragraph + - include: inline-bold-italic-linebreak + - include: scope:text.html.basic + + heading1: + - meta_scope: markup.heading.1.markdown + - include: inline-bold-italic-linebreak + - match: '^[ \t]{0,3}(={3,})(?=[ \t]*$)' + captures: + 1: markup.heading.1.setext.markdown punctuation.definition.heading.setext.markdown + pop: true + + heading2: + - meta_scope: markup.heading.2.markdown + - include: inline-bold-italic-linebreak + - match: '^[ \t]{0,3}(-{3,})(?=[ \t]*$)' + captures: + 1: markup.heading.2.setext.markdown punctuation.definition.heading.setext.markdown + pop: true + link-ref-def: - meta_scope: meta.link.reference.def.markdown - match: '' @@ -315,6 +350,9 @@ contexts: Markdown will convert this for us. We match it so that the HTML grammar will not mark it up as invalid. scope: meta.other.valid-ampersand.markdown + ligatures: + - match: '<=>' # <=> + - match: '<[-=<]' # <- <= << block-quote: - match: '[ ]{,3}(>)[ ]?' comment: | @@ -384,6 +422,7 @@ contexts: - match: '{{indented_code_block}}.*$\n?' scope: markup.raw.block.markdown bold: + - include: ligatures - match: '(\*\*)(\*)(?=\S)(?!\*)' captures: 1: punctuation.definition.bold.begin.markdown @@ -391,6 +430,8 @@ contexts: push: - meta_scope: markup.bold.markdown - meta_content_scope: markup.italic.markdown + - match: '{{setext_escape}}' + pop: true - match: |- (?x) [ \t]*\*{4,} # if there are more than 3 its not applicable to be bold or italic @@ -405,6 +446,8 @@ contexts: scope: punctuation.definition.bold.end.markdown set: - meta_content_scope: markup.italic.markdown + - match: '{{setext_escape}}' + pop: true - match: |- (?x) [ \t]*\*{3,} # if there are more than 3 its not applicable to be bold or italic @@ -420,6 +463,8 @@ contexts: scope: punctuation.definition.italic.end.markdown set: - meta_content_scope: markup.bold.markdown + - match: '{{setext_escape}}' + pop: true - match: |- (?x) [ \t]*\*{3,} # if there are more than 3 its not applicable to be bold or italic @@ -519,7 +564,7 @@ contexts: - include: italic - include: bold-italic-trailing bracket: - - match: '<(?![a-z/?\$!])' + - match: '<(?![A-Za-z/?!$])' comment: | Markdown will convert this for us. We match it so that the HTML grammar will not mark it up as invalid. @@ -570,7 +615,7 @@ contexts: ) captures: 1: meta.image.inline.markdown punctuation.definition.image.begin.markdown - push: [image-inline-after-text, image-link-text] + push: [image-inline-attr, image-inline-after-text, image-link-text] image-link-text: - meta_content_scope: meta.image.inline.description.markdown - include: link-text @@ -608,6 +653,15 @@ contexts: scope: invalid.illegal.unexpected-whitespace.markdown - match: (?=\s*(?!\))) push: link-title + image-inline-attr: + - match: '([ ]*)(\{)(?=[^}]*\})' + captures: + 1: invalid.illegal.whitespace.markdown + 2: punctuation.definition.attributes.begin.markdown + set: + - meta_scope: meta.image.inline.markdown + - include: tag-attributes + - include: immediately-pop image-ref: - match: |- (?x: @@ -622,7 +676,7 @@ contexts: ) captures: 1: meta.image.reference.markdown punctuation.definition.image.begin.markdown - push: [image-ref-after-text, image-ref-text] + push: [image-ref-attr, image-ref-after-text, image-ref-text] image-ref-text: - meta_content_scope: meta.image.reference.description.markdown - include: link-text @@ -637,9 +691,19 @@ contexts: 3: punctuation.definition.constant.end.markdown scope: meta.image.reference.markdown pop: true + image-ref-attr: + - match: '([ ]*)(\{)(?=[^}]*\})' + captures: + 1: invalid.illegal.whitespace.markdown + 2: punctuation.definition.attributes.begin.markdown + set: + - meta_scope: meta.image.reference.markdown + - include: tag-attributes + - include: immediately-pop inline: - include: escape - include: ampersand + - include: ligatures - include: bracket - include: raw - include: image-inline @@ -663,6 +727,8 @@ contexts: scope: punctuation.definition.italic.begin.markdown push: - meta_scope: markup.italic.markdown + - match: '{{setext_escape}}' + pop: true - match: |- (?x) [ \t]*\*{4,} # if there are more than 3 its not applicable to be bold or italic @@ -679,6 +745,8 @@ contexts: scope: punctuation.definition.italic.begin.markdown push: - meta_scope: markup.italic.markdown + - match: '{{setext_escape}}' + pop: true - match: |- (?x) [ \t]*_{4,} # if there are more than 3 its not applicable to be bold or italic @@ -705,6 +773,8 @@ contexts: - include: bold-italic-trailing bold-italic-trailing: - include: scope:text.html.basic + - match: '{{setext_escape}}' + pop: true - match: ^\s*$\n? scope: invalid.illegal.non-terminated.bold-italic.markdown pop: true @@ -764,7 +834,7 @@ contexts: ) captures: 1: meta.link.inline.markdown punctuation.definition.link.begin.markdown - push: [link-inline-after-text, link-inline-link-text] + push: [link-inline-attr, link-inline-after-text, link-inline-link-text] link-inline-after-text: - match: '([ ]*)(\()' # spaces not allowed before the open paren, but we check for it anyway to mark it as invalid captures: @@ -795,6 +865,15 @@ contexts: scope: invalid.illegal.unexpected-whitespace.markdown - match: (?=\s*(?!\))) push: link-title + link-inline-attr: + - match: '([ ]*)(\{)(?=[^}]*\})' + captures: + 1: invalid.illegal.whitespace.markdown + 2: punctuation.definition.attributes.begin.markdown + set: + - meta_scope: meta.link.inline.markdown + - include: tag-attributes + - include: immediately-pop link-inline-link-text: - meta_content_scope: meta.link.inline.description.markdown - include: link-text-allow-image @@ -815,7 +894,7 @@ contexts: ) captures: 1: meta.link.reference.markdown punctuation.definition.link.begin.markdown - push: [link-ref-after-text, link-ref-link-text] + push: [link-ref-attr, link-ref-after-text, link-ref-link-text] link-ref-link-text: - meta_content_scope: meta.link.reference.description.markdown - include: link-text-allow-image @@ -830,6 +909,15 @@ contexts: 3: punctuation.definition.constant.end.markdown scope: meta.link.reference.markdown pop: true + link-ref-attr: + - match: '([ ]*)(\{)(?=[^}]*\})' + captures: + 1: invalid.illegal.whitespace.markdown + 2: punctuation.definition.attributes.begin.markdown + set: + - meta_scope: meta.link.reference.markdown + - include: tag-attributes + - include: immediately-pop link-ref-literal: - match: |- (?x: @@ -844,7 +932,7 @@ contexts: ) captures: 1: meta.link.reference.literal.markdown punctuation.definition.link.begin.markdown - push: [link-ref-literal-after-text, link-ref-literal-link-text] + push: [link-ref-literal-attr, link-ref-literal-after-text, link-ref-literal-link-text] link-ref-literal-link-text: - meta_content_scope: meta.link.reference.literal.description.markdown - include: link-text-allow-image @@ -858,6 +946,15 @@ contexts: 1: punctuation.definition.constant.begin.markdown 2: punctuation.definition.constant.end.markdown pop: true + link-ref-literal-attr: + - match: '([ ]*)(\{)(?=[^}]*\})' + captures: + 1: invalid.illegal.whitespace.markdown + 2: punctuation.definition.attributes.begin.markdown + set: + - meta_scope: meta.link.reference.literal.markdown + - include: tag-attributes + - include: immediately-pop link-ref-footnote: - match: |- (?x: @@ -1369,6 +1466,64 @@ contexts: captures: 1: invalid.illegal.expected-eol.markdown pop: true + +###[ LINK/IMAGE/REFERENCE ATTRIBUTES ]######################################## + + tag-attributes: + # https://kramdown.gettalong.org/syntax.html#span-ials + # https://michelf.ca/projects/php-markdown/extra/ + # https://pandoc.org/MANUAL.html#extension-link_attributes + - match: \} + scope: punctuation.definition.attributes.end.markdown + pop: true + - match: \, + scope: punctuation.separator.mapping.pair.markdown + - match: '{{tag_attribute_name_start}}' + push: [tag-attr-meta, tag-attr-equals, tag-attr-name] + + tag-attr-name: + - meta_scope: entity.other.attribute-name.markdown + - match: '{{tag_attribute_name_break}}' + pop: true + - match: '["''`<]' + scope: invalid.illegal.attribute-name.markdown + + tag-attr-meta: + - meta_scope: meta.attribute-with-value.markdown + - include: immediately-pop + + tag-attr-equals: + - match: = + scope: punctuation.separator.key-value.markdown + set: tag-attr-value + - include: else-pop + + tag-attr-value: + - match: \" + scope: punctuation.definition.string.begin.markdown + set: + - meta_scope: string.quoted.double.markdown + - match: \" + scope: punctuation.definition.string.end.markdown + pop: true + - match: \' + scope: punctuation.definition.string.begin.markdown + set: + - meta_scope: string.quoted.single.markdown + - match: \' + scope: punctuation.definition.string.end.markdown + pop: true + - match: '{{tag_unquoted_attribute_start}}' + set: + - meta_scope: string.unquoted.markdown + - match: '{{tag_unquoted_attribute_break}}' + pop: true + - match: '["''`<]' + scope: invalid.illegal.attribute-value.markdown + - include: else-pop + +###[ TABLE ]################################################################## + table: - match: ^(?={{table_first_row}}) push: @@ -1414,3 +1569,13 @@ contexts: scope: invalid.deprecated.unescaped-backticks.markdown - include: inline - include: scope:text.html.basic + +###[ PROTOTYPES ]############################################################# + + else-pop: + - match: (?=\S) + pop: true + + immediately-pop: + - match: '' + pop: true diff --git a/Markdown/syntax_test_markdown.md b/Markdown/syntax_test_markdown.md index 0097449e0e..63796ab010 100644 --- a/Markdown/syntax_test_markdown.md +++ b/Markdown/syntax_test_markdown.md @@ -21,10 +21,12 @@ http://spec.commonmark.org/0.28/#example-44 | ^ - punctuation.definition.heading.end.markdown Alternate Heading +| <- markup.heading.1 ================= |^^^^^^^^^^^^^^^^ markup.heading.1 punctuation.definition heading underlined with dashes +| <- markup.heading.2 ------------------------------ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.heading.2 punctuation.definition.heading @@ -40,19 +42,25 @@ underlined heading followed by another one that should be treated as a normal pa Paragraph of text that should be scoped as meta.paragraph. |^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.paragraph -A [link](https://example.com), *italic text* and **bold**. -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.inline +A [link](https://example.com){ :_attr = value }, *italic text* and **bold**. +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.inline | ^ punctuation.definition.link.begin | ^ punctuation.definition.link.end | ^ punctuation.definition.metadata | ^^^^^^^^^^^^^^^^^^^ markup.underline.link | ^ punctuation.definition.metadata -| ^^^^^^^^^^^^^ markup.italic -| ^ punctuation.definition.italic -| ^ punctuation.definition.italic -| ^^ punctuation.definition.bold -| ^^^^^^^^ markup.bold -| ^^ punctuation.definition.bold +| ^ punctuation.definition.attributes.begin.markdown +| ^^^^^^^^^^^^^^ meta.attribute-with-value.markdown +| ^^^^^^ entity.other.attribute-name.markdown +| ^ punctuation.separator.key-value.markdown +| ^^^^^ string.unquoted.markdown +| ^ punctuation.definition.attributes.end.markdown +| ^^^^^^^^^^^^^ markup.italic +| ^ punctuation.definition.italic +| ^ punctuation.definition.italic +| ^^ punctuation.definition.bold +| ^^^^^^^^ markup.bold +| ^^ punctuation.definition.bold Inline `code sample`. | ^^^^^^^^^^^^^ markup.raw.inline @@ -67,16 +75,44 @@ Here is a [](https://example.com). | ^^^^^^^^^^^^^^^^^^^ markup.underline.link | ^ punctuation.definition.metadata +Here is a [](https://example.com){_attr="value"}. +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.inline +| ^ punctuation.definition.link.begin +| ^ punctuation.definition.link.end +| ^ punctuation.definition.metadata +| ^^^^^^^^^^^^^^^^^^^ markup.underline.link +| ^ punctuation.definition.metadata +| ^ punctuation.definition.attributes.begin.markdown +| ^^^^^^^^^^^^^ meta.attribute-with-value.markdown +| ^^^^^ entity.other.attribute-name.markdown +| ^ punctuation.separator.key-value.markdown +| ^^^^^^^ string.quoted.double.markdown +| ^ punctuation.definition.attributes.end.markdown + Here is a [reference link][name]. | ^^^^^^^^^^^^^^^^^^^^^^ meta.link.reference | ^ punctuation.definition.constant.begin | ^^^^ constant.other.reference.link | ^ punctuation.definition.constant.end -Here is a [blank reference link][]. -| ^^^^^^^^^^^^^^^^^^^^^^ meta.link.reference +Here is a [reference link][name]{_attr='value' :att2}. +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.reference +| ^ punctuation.definition.constant.begin +| ^^^^ constant.other.reference.link +| ^ punctuation.definition.constant.end +| ^ punctuation.definition.attributes.begin.markdown +| ^^^^^ entity.other.attribute-name.markdown +| ^ punctuation.separator.key-value.markdown +| ^^^^^^^ string.quoted.single.markdown +| ^^^^^ entity.other.attribute-name.markdown +| ^ punctuation.definition.attributes.end.markdown + +Here is a [blank reference link][]{}. +| ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.reference | ^ punctuation.definition.constant.begin | ^ punctuation.definition.constant.end +| ^ punctuation.definition.attributes.begin.markdown +| ^ punctuation.definition.attributes.end.markdown Here is a ![](https://example.com/cat.gif). | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.image.inline @@ -86,6 +122,21 @@ Here is a ![](https://example.com/cat.gif). | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.image | ^ punctuation.definition.metadata +Here is a ![](https://example.com/cat.gif){_at"r=value :att2}. +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.image.inline +| ^ punctuation.definition.image.begin +| ^ punctuation.definition.image.end - string +| ^ punctuation.definition.metadata +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.image +| ^ punctuation.definition.metadata +| ^ punctuation.definition.attributes.begin.markdown +| ^^^^^ entity.other.attribute-name.markdown +| ^ invalid.illegal.attribute-name.markdown +| ^ punctuation.separator.key-value.markdown +| ^^^^^ string.unquoted.markdown +| ^^^^^ entity.other.attribute-name.markdown +| ^ punctuation.definition.attributes.end.markdown + Here is a ![Image Alt Text](https://example.com/cat.gif). | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.image.inline | ^ punctuation.definition.image.begin @@ -220,6 +271,15 @@ Paragraph break. | ^ markup.list.unnumbered.bullet punctuation.definition.list_item | ^ - punctuation.definition.list_item + * Unsorted list item + ```xml +|^^^ markup.list.unnumbered.markdown meta.paragraph.list.markdown meta.code-fence.definition.begin.xml.markdown-gfm punctuation.definition.raw.code-fence.begin.markdown +| ^^ markup.list.unnumbered.markdown meta.paragraph.list.markdown meta.code-fence.definition.begin.xml.markdown-gfm constant.other.language-name.markdown + +|^^^^^ markup.list.unnumbered.markdown meta.paragraph.list.markdown markup.raw.code-fence.xml.markdown-gfm text.xml meta.tag.xml + ``` +|^^^ markup.list.unnumbered.markdown meta.paragraph.list.markdown meta.code-fence.definition.end.xml.markdown-gfm punctuation.definition.raw.code-fence.end.markdown + Paragraph break. > This is a block quote. It contains markup. @@ -332,6 +392,13 @@ paragraph | <- punctuation.definition.blockquote | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.raw.block - markup.quote markup.quote +>= +| <- punctuation.definition.blockquote.markdown + >= +| ^ punctuation.definition.blockquote.markdown + >= +| ^^ - punctuation.definition.blockquote.markdown + Code block below: this is code! @@ -430,6 +497,12 @@ a.b-c_d@a.b. this is a raw ampersand & does not require HTML escaping | ^ meta.other.valid-ampersand +this is a raw bracket < <= <- << does not require HTML escaping +| ^ meta.other.valid-bracket +| ^^ - meta.other-valid-bracket - meta.tag +| ^^ - meta.other-valid-bracket - meta.tag +| ^^ - meta.other-valid-bracket - meta.tag + [2]: https://github.com/sublimehq/Packages "Packages Repo" | <- meta.link.reference.def |^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.reference.def @@ -571,7 +644,7 @@ because it doesn't begin with the number one: | ^^^^^^ meta.tag.inline.any.html | ^^^^^^^ meta.tag.inline.any.html -_italic text HTML element end of italic text_ +_italic text HTML element end of italic text_ | <- punctuation.definition.italic | ^ punctuation.definition.italic | ^^^^^^ meta.tag.inline.any.html @@ -1173,7 +1246,7 @@ __test!*test__ Issue 1163 | <- punctuation.definition.raw.code-fence.begin | ^^ constant.other.language-name for (var i = 0; i < 10; i++) { -| ^ keyword.control.loop.js +| ^ source.js keyword.control.loop console.log(i); } ``` @@ -1962,3 +2035,16 @@ end \~/.bashrc |^ constant.character.escape + + -= += /= %= -- ++ ** !~ =~ ~~ <= >= => <=> // && == != +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta - constant - keyword - variable - punctuation + + -= += /= %= -- ++ ** !~ =~ ~~ <= >= => <=> // && == != +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block-level markup.raw - constant - keyword - variable - punctuation + +> -= += /= %= -- ++ ** !~ =~ ~~ <= >= => <=> // && == != +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block-level - constant - keyword - variable + +> > -= += /= %= -- ++ ** !~ =~ ~~ <= >= => <=> // && == != +| ^ meta.block-level.markdown markup.quote.markdown markup.quote.markdown punctuation.definition.blockquote.markdown +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block-level - constant - keyword - variable diff --git a/Matlab/Matlab.sublime-syntax b/Matlab/Matlab.sublime-syntax index 0d6357c7fb..8707480326 100644 --- a/Matlab/Matlab.sublime-syntax +++ b/Matlab/Matlab.sublime-syntax @@ -29,6 +29,7 @@ contexts: - match: ({{id}})(\.)({{id}}) captures: 2: punctuation.accessor.dot.matlab + push: transpose_post_parens all_matlab_comments: - match: (%%).*$\n? scope: comment.double.percentage.matlab @@ -109,8 +110,8 @@ contexts: - include: all_matlab_keywords - include: all_matlab_comments - include: variable - - include: variable_invalid - include: number + - include: variable_invalid - include: operators - match: \.\.\. scope: punctuation.separator.continuation.matlab @@ -193,7 +194,7 @@ contexts: comment: Data Analysis scope: keyword.analysis.matlab matlab_keyword_control: - - match: \b(break|case|catch|continue|else|elseif|end|for|if|otherwise|pause|rethrow|return|start|startat|stop|switch|try|wait|while)\b + - match: \b(break|case|catch|continue|else|elseif|end|for|parfor|if|otherwise|pause|rethrow|return|start|startat|stop|switch|try|wait|while)\b comment: Control keywords scope: keyword.control.matlab matlab_keyword_desktop: @@ -490,7 +491,7 @@ contexts: scope: invalid.illegal.unescaped-quote.matlab variable: - match: '\b{{id}}\b' - comment: Valid variable. Added meta to disable hilightinh + comment: Valid variable. Added meta to disable highlighting scope: meta.variable.other.valid.matlab variable_assignment: - match: '=\s*\.{0,2}\s*;?\s*$\n?' diff --git a/Matlab/Snippets/Octave-function.sublime-snippet b/Matlab/Snippets/Octave-function.sublime-snippet index ab95e3ca34..b66e23a0c3 100644 --- a/Matlab/Snippets/Octave-function.sublime-snippet +++ b/Matlab/Snippets/Octave-function.sublime-snippet @@ -29,6 +29,6 @@ $0 endfunction]]>
octfun - source.matlab + source.matlab, source.octave Octave function
diff --git a/Matlab/Snippets/unwind_protect-cleanup-end.sublime-snippet b/Matlab/Snippets/unwind_protect-cleanup-end.sublime-snippet index 57926c666c..5ad4d89a4a 100644 --- a/Matlab/Snippets/unwind_protect-cleanup-end.sublime-snippet +++ b/Matlab/Snippets/unwind_protect-cleanup-end.sublime-snippet @@ -1,10 +1,10 @@ unwind - source.matlab + source.matlab, source.octave unwind_protect … cleanup … end diff --git a/Matlab/syntax_test_matlab.m b/Matlab/syntax_test_matlab.m index fe94b80ee0..589202e35a 100644 --- a/Matlab/syntax_test_matlab.m +++ b/Matlab/syntax_test_matlab.m @@ -157,8 +157,9 @@ function foo(bar) % <- constant.numeric.matlab 1e1 % <- constant.numeric.matlab -1i +1i - (4i) % <- constant.numeric.matlab +% ^^ constant.numeric.matlab 1j % <- constant.numeric.matlab 1e2j @@ -173,6 +174,12 @@ function foo(bar) a = a.' % is the transpose % ^ -keyword.operator.transpose.matlab % ^^ keyword.operator.transpose.matlab +c = a.b' % is the conjugate and transpose of the field b of structure a +% ^ punctuation.accessor.dot.matlab +% ^ keyword.operator.transpose.matlab +c = a.b.' % is the transpose of the field b of structure a +% ^ punctuation.accessor.dot.matlab +% ^^ keyword.operator.transpose.matlab x = a[3]' + b(4)' % is the conjugate and transpose % ^ keyword.operator.transpose.matlab % ^ keyword.operator.transpose.matlab @@ -203,3 +210,7 @@ function foo(bar) % ^^^^^^^^ string.quoted.double.matlab % ^ punctuation.definition.string.end.matlab +%--------------------------------------------- +parfor x = 1:10 +%^ keyword.control.matlab +end diff --git a/OCaml/OCaml.sublime-syntax b/OCaml/OCaml.sublime-syntax index 3732f20de3..73ceb3939c 100644 --- a/OCaml/OCaml.sublime-syntax +++ b/OCaml/OCaml.sublime-syntax @@ -7,8 +7,23 @@ file_extensions: - mli scope: source.ocaml variables: + sign: (?:-|\b) + suffix: (?:[lLn]|(?!\.))\b + bin_digit: '[01_]' + oct_digit: '[0-7_]' + dec_digit: '[0-9_]' + hex_digit: '[\h_]' + bin_integer: (?:[01]{{bin_digit}}*) + oct_integer: (?:[0-7]{{oct_digit}}*) + dec_integer: (?:[0-9]{{dec_digit}}*) + hex_integer: (?:\h{{hex_digit}}*) + exponent: '[-+]??(_?){{dec_integer}}' + dec_exponent: (?:[Ee]{{exponent}}) + hex_exponent: (?:[Pp]{{exponent}}) + identifier: '[a-z][a-zA-Z0-9''_]*' capIdentifier: '[A-Z][a-zA-Z0-9''_]*' + contexts: main: - match: '\b(let)\s+(module)\s+({{capIdentifier}})\s*(=)' @@ -394,18 +409,62 @@ contexts: 3: meta.empty-typing-pair.ocaml - match: \b(true|false)\b scope: constant.language.boolean.ocaml - - match: '\b-?[0-9][0-9_]*((\.([0-9][0-9_]*([eE][+-]??[0-9][0-9_]*)?)?)|([eE][+-]??[0-9][0-9_]*))' - scope: constant.numeric.floating-point.ocaml - - match: '\b(-?((0(x|X)[0-9a-fA-F][0-9a-fA-F_]*)|(0(o|O)[0-7][0-7_]*)|(0(b|B)[01][01_]*)|([0-9][0-9_]*)))n' - scope: constant.numeric.integer.nativeint.ocaml - - match: '\b(-?((0(x|X)[0-9a-fA-F][0-9a-fA-F_]*)|(0(o|O)[0-7][0-7_]*)|(0(b|B)[01][01_]*)|([0-9][0-9_]*)))L' - scope: constant.numeric.integer.int64.ocaml - - match: '\b(-?((0(x|X)[0-9a-fA-F][0-9a-fA-F_]*)|(0(o|O)[0-7][0-7_]*)|(0(b|B)[01][01_]*)|([0-9][0-9_]*)))l' - scope: constant.numeric.integer.int32.ocaml - - match: '\b(-?((0(x|X)[0-9a-fA-F][0-9a-fA-F_]*)|(0(o|O)[0-7][0-7_]*)|(0(b|B)[01][01_]*)|([0-9][0-9_]*)))' - scope: constant.numeric.integer.ocaml - match: '''(.|\\(x[a-fA-F0-9][a-fA-F0-9]|[0-2]\d\d|[bnrt''"\\]))''' scope: constant.character.ocaml + + # http://caml.inria.fr/pub/docs/manual-ocaml/lex.html + # hexadecimal floats + - match: ({{sign}})(0[xX])(_*){{hex_integer}}(?:(\.){{hex_digit}}*{{hex_exponent}}?|{{hex_exponent}}) + scope: constant.numeric.float.hexadecimal.ocaml + captures: + 1: punctuation.definition.numeric.sign.ocaml + 2: punctuation.definition.numeric.base.ocaml + 3: invalid.illegal.numeric.ocaml + 4: punctuation.separator.decimal.ocaml + 5: invalid.illegal.numeric.ocaml + 6: invalid.illegal.numeric.ocaml + # decimal floats + - match: ({{sign}}){{dec_integer}}(?:(\.){{dec_digit}}*{{dec_exponent}}?|{{dec_exponent}}) + scope: constant.numeric.float.decimal.ocaml + captures: + 1: punctuation.definition.numeric.sign.ocaml + 2: punctuation.separator.decimal.ocaml + 3: invalid.illegal.numeric.ocaml + 4: invalid.illegal.numeric.ocaml + # hexadecimal integers + - match: ({{sign}})(0[xX])(_*){{hex_integer}}*({{suffix}}) + scope: constant.numeric.integer.hexadecimal.ocaml + captures: + 1: punctuation.definition.numeric.sign.ocaml + 2: punctuation.definition.numeric.base.ocaml + 3: invalid.illegal.numeric.ocaml + 4: storage.type.numeric.ocaml + # octal integers + - match: ({{sign}})(0[oO])(_*){{oct_integer}}*({{suffix}}) + scope: constant.numeric.integer.octal.ocaml + captures: + 1: punctuation.definition.numeric.sign.ocaml + 2: punctuation.definition.numeric.base.ocaml + 3: invalid.illegal.numeric.ocaml + 4: storage.type.numeric.ocaml + # binary integers + - match: ({{sign}})(0[bB])(_*){{bin_integer}}*({{suffix}}) + scope: constant.numeric.integer.binary.ocaml + captures: + 1: punctuation.definition.numeric.sign.ocaml + 2: punctuation.definition.numeric.base.ocaml + 3: invalid.illegal.numeric.ocaml + 4: storage.type.numeric.ocaml + # decimal integers + - match: ({{sign}}){{dec_integer}}({{suffix}}) + scope: constant.numeric.integer.decimal.ocaml + captures: + 1: punctuation.definition.numeric.sign.ocaml + 2: storage.type.numeric.ocaml + # invalid numbers + - match: '{{sign}}\d+.*\b' + scope: invalid.illegal.numeric.ocaml + definite_storagetypes: - include: storagetypes - match: '\b[a-zA-Z0-9''_]+\b' diff --git a/OCaml/syntax_test_ml.ml b/OCaml/syntax_test_ml.ml index 1438f96a07..a763d28cc3 100644 --- a/OCaml/syntax_test_ml.ml +++ b/OCaml/syntax_test_ml.ml @@ -24,3 +24,103 @@ and open = 5 (*^^^ keyword.other.ocaml *) (* ^^^^ variable.other.constant.ocaml *) + + +(* Integers *) + + 123_456_789_0n +(* ^^^^^^^^^^^^^^ constant.numeric.integer.decimal *) +(* ^ storage.type.numeric *) + + 0 +(* ^ constant.numeric.integer.decimal *) + + 123 .foo +(* ^^^ constant.numeric.integer.decimal *) +(* ^^^^^^ - constant *) + + +123 + 123 +(* ^ keyword.operator *) +(* ^^^ constant.numeric.integer.decimal - keyword *) +(* ^ keyword.operator *) +(* ^^^ constant.numeric.integer.decimal - keyword *) + + -123 +(* ^^^^ constant.numeric.integer.decimal - keyword *) +(* ^ punctuation.definition.numeric.sign *) + + 0123456789 +(* ^^^^^^^^^^ constant.numeric.integer.decimal *) + + 123xyz +(* ^^^^^^ invalid.illegal.numeric *) + + 0b0110_1001_1001_0110n 0b_10_01 +(* ^^^^^^^^^^^^^^^^^^^^^^ constant.numeric.integer.binary *) +(* ^^ punctuation.definition.numeric.base *) +(* ^ storage.type.numeric *) +(* ^^^^^^^^ constant.numeric.integer.binary *) +(* ^^ punctuation.definition.numeric.base *) +(* ^ invalid.illegal.numeric *) + + 0o0123_4567n 0O_127 +(* ^^^^^^^^^^^^ constant.numeric.integer.octal *) +(* ^^ punctuation.definition.numeric *) +(* ^ storage.type.numeric *) +(* ^^^^^^ constant.numeric.integer.octal *) +(* ^^ punctuation.definition.numeric *) +(* ^ invalid.illegal.numeric *) + + 0x01_23_45_67_89_ab_CD_efn 0X_01l +(* ^^^^^^^^^^^^^^^^^^^^^^^^^^ constant.numeric.integer.hexadecimal *) +(* ^^ punctuation.definition.numeric.base *) +(* ^ storage.type.numeric *) +(* ^^^^^^ constant.numeric.integer.hexadecimal *) +(* ^^ punctuation.definition.numeric.base *) +(* ^ invalid.illegal.numeric *) +(* ^ storage.type.numeric *) + + 0b +(* ^^ constant.numeric.integer.binary punctuation.definition.numeric.base *) + + 0B0 0O0 0X0 +(* ^^^ constant.numeric.integer.binary *) +(* ^^^ constant.numeric.integer.octal *) +(* ^^^ constant.numeric.integer.hexadecimal *) + + 0xa. 0xa.b 0xa.ep1 0xa.ep-_1 +(* ^^^^ constant.numeric.float.hexadecimal *) +(* ^^ punctuation.definition.numeric.base *) +(* ^ punctuation.separator.decimal *) +(* ^^^^^ constant.numeric.float.hexadecimal *) +(* ^^ punctuation.definition.numeric.base *) +(* ^ punctuation.separator.decimal *) +(* ^^^^^^^ constant.numeric.float.hexadecimal *) +(* ^^ punctuation.definition.numeric.base *) +(* ^ punctuation.separator.decimal *) +(* ^^^^^^^^^ constant.numeric.float.hexadecimal *) +(* ^^ punctuation.definition.numeric.base *) +(* ^ punctuation.separator.decimal *) +(* ^ invalid.illegal.numeric *) + + 0b1.foo +(* ^^^^^^^ invalid.illegal.numeric *) + + 0b1.0 +(* ^^^^^ invalid.illegal.numeric *) + + 0b123 +(* ^^^^^ invalid.illegal.numeric *) + + +(* Floats *) + + 1_234_567_890.123_456_789_0 +(* ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant.numeric.float.decimal *) + + 12345e6_7_8 +(* ^^^^^^^^^^^ constant.numeric.float.decimal *) + + 123.456e+789 +(* ^^^^^^^^^^^^ constant.numeric.float.decimal *) +(* ^ punctuation.separator.decimal *) diff --git a/Objective-C/Objective-C++.sublime-syntax b/Objective-C/Objective-C++.sublime-syntax index 8a4c402a1d..26b5cf4d3b 100644 --- a/Objective-C/Objective-C++.sublime-syntax +++ b/Objective-C/Objective-C++.sublime-syntax @@ -28,12 +28,13 @@ variables: non_angle_brackets: '(?=<<|<=)' regular: '[^(){}&;*^%=<>-]*' + regular_plus: '[^(){}&;*^%=<>-]+' paren_open: (?:\( paren_close: '\))?' - generic_open: (?:< - generic_close: '>)?' + generic_open: (?:{{regular_plus}}(?:< + generic_close: '>)?)?' balance_parentheses: '{{regular}}{{paren_open}}{{regular}}{{paren_close}}{{regular}}' - generic_lookahead: <{{regular}}{{generic_open}}{{regular}}{{generic_open}}{{regular}}{{generic_close}}\s*{{generic_close}}{{balance_parentheses}}> + generic_lookahead: <{{generic_open}}{{generic_open}}{{regular}}{{generic_close}}\s*{{generic_close}}{{balance_parentheses}}> data_structures_forward_decl_lookahead: '(\s+{{macro_identifier}})*\s*(:\s*({{path_lookahead}}|{{visibility_modifiers}}|,|\s|<[^;]*>)+)?;' non_func_keywords: 'if|for|switch|while|decltype|sizeof|__declspec|__attribute__|typeid|alignof|alignas|static_assert' @@ -52,6 +53,7 @@ contexts: - include: template - match: (?=\S) set: global-modifier + - include: using-namespace - include: namespace - include: keywords-angle-brackets - match: '(?={{path_lookahead}}\s*<)' @@ -118,7 +120,9 @@ contexts: early-expressions-before-generic-type: - include: comments - include: case-default + - include: using-namespace - include: typedef + - include: using-alias - include: keywords-angle-brackets - include: keywords-parens - include: keywords @@ -221,8 +225,7 @@ contexts: - include: scope:source.c#strings numbers: - - include: scope:source.c++#unique-numbers - - include: scope:source.c#numbers + - include: scope:source.c++#numbers ########################################## # Directly from Objective-C.sublime-syntax @@ -375,7 +378,7 @@ contexts: captures: 1: meta.preprocessor.objc++ 2: keyword.control.import.objc++ - 3: constant.numeric.preprocessor.objc++ + 3: constant.numeric.integer.decimal.objc++ push: - match: ^\s*(#\s*endif)\b captures: @@ -401,7 +404,7 @@ contexts: captures: 1: meta.preprocessor.objc++ 2: keyword.control.import.objc++ - 3: constant.numeric.preprocessor.objc++ + 3: constant.numeric.integer.decimal.objc++ push: - match: ^\s*(#\s*endif)\b captures: @@ -527,8 +530,8 @@ contexts: pop: true - include: expressions - namespace: - - match: '\b(using)\s+(namespace)\s+(?={{path_lookahead}})' + using-namespace: + - match: '\b(using)\s+(namespace)\b' captures: 1: keyword.control.objc++ 2: keyword.control.objc++ @@ -536,6 +539,8 @@ contexts: - include: scope:source.c++#identifiers - match: '' pop: true + + namespace: - match: '\b(namespace)\s+(?=({{path_lookahead}})?(?!\s*[;,]))' scope: meta.namespace.objc++ captures: @@ -601,15 +606,11 @@ contexts: - include: template-common generic-type: - - match: '(?=(?!template){{path_lookahead}}\s*{{generic_lookahead}}\s*\()' + - match: '(?=(?!template){{path_lookahead}}\s*{{generic_lookahead}}\s*(\(|\{))' push: - meta_scope: meta.function-call.objc++ - match: \btemplate\b scope: storage.type.template.objc++ - - match: '(?:(::)\s*)?{{identifier}}\s*(::)\s*' - captures: - 1: punctuation.accessor.double-colon.objc++ - 2: punctuation.accessor.double-colon.objc++ - match: (?:(::)\s*)?({{identifier}})\s*(<) captures: 1: punctuation.accessor.double-colon.objc++ @@ -632,6 +633,19 @@ contexts: scope: meta.group.objc++ punctuation.section.group.end.objc++ pop: true - include: expressions + - match: (?:(::)\s*)?({{identifier}})\s*(\{) + captures: + 1: punctuation.accessor.double-colon.objc++ + 2: variable.function.objc++ + 3: punctuation.section.group.begin.objc++ + set: + - meta_scope: meta.function-call.objc++ + - meta_content_scope: meta.group.objc++ + - match: '\}' + scope: meta.group.objc++ punctuation.section.group.end.objc++ + pop: true + - include: expressions + - include: scope:source.c++#identifiers - include: angle-brackets - match: '\(' scope: meta.group.objc++ punctuation.section.group.begin.objc++ @@ -642,6 +656,15 @@ contexts: scope: meta.group.objc++ punctuation.section.group.end.objc++ pop: true - include: expressions + - match: '\{' + scope: meta.group.objc++ punctuation.section.group.begin.objc++ + set: + - meta_scope: meta.function-call.objc++ + - meta_content_scope: meta.group.objc++ + - match: '\}' + scope: meta.group.objc++ punctuation.section.group.end.objc++ + pop: true + - include: expressions - match: '(?=(?!template){{path_lookahead}}\s*{{generic_lookahead}})' push: - include: scope:source.c++#identifiers @@ -675,19 +698,18 @@ contexts: - include: statements function-call: - - match: (?={{path_lookahead}}\s*\() + - match: (?={{path_lookahead}}\s*(\(|\{)) push: - meta_scope: meta.function-call.objc++ - include: scope:source.c#c99 - match: '(?:(::)\s*)?{{identifier}}\s*(::)\s*' - scope: variable.function.objc++ captures: - 1: punctuation.accessor.objc++ - 2: punctuation.accessor.objc++ - - match: '(?:(::)\s*)?{{identifier}}' - scope: variable.function.objc++ + 1: punctuation.accessor.double-colon.objc++ + 2: punctuation.accessor.double-colon.objc++ + - match: '(?:(::)\s*)?({{identifier}})' captures: - 1: punctuation.accessor.objc++ + 1: punctuation.accessor.double-colon.objc++ + 2: variable.function.objc++ - match: '\(' scope: meta.group.objc++ punctuation.section.group.begin.objc++ set: @@ -697,6 +719,14 @@ contexts: scope: meta.group.objc++ punctuation.section.group.end.objc++ pop: true - include: expressions + - match: '\{' + scope: meta.group.objc++ punctuation.section.group.begin.objc++ + set: + - meta_content_scope: meta.function-call.objc++ meta.group.objc++ + - match: '\}' + scope: meta.function-call.objc++ meta.group.objc++ punctuation.section.group.end.objc++ + pop: true + - include: expressions members-inside-function-call: - meta_content_scope: meta.method-call.objc++ meta.group.objc++ @@ -784,6 +814,16 @@ contexts: scope: punctuation.accessor.arrow.objc++ push: members-after-accessor-junction + using-alias: + # consume keyword if followed by typename + - match: '\b(using)\b(?=\s+typename\b)' + captures: + 1: keyword.control.objc++ + - match: '\b(using)\b\s+({{identifier}})(?!\s*(<|::))' + captures: + 1: keyword.control.objc++ + 2: entity.name.type.using.objc++ + typedef: - match: \btypedef\b scope: storage.type.objc++ @@ -848,28 +888,41 @@ contexts: - include: modifiers-parens - include: modifiers # Constructors and destructors don't have a type - - match: '(?={{path_lookahead}}\s*::\s*{{identifier}}\s*(\(|$))' + - match: '(?={{path_lookahead}}\s*(?:{{generic_lookahead}})?\s*::\s*{{identifier}}\s*\()' set: - - meta_content_scope: meta.function.objc++ entity.name.function.constructor.objc++ - - include: scope:source.c++#identifiers + - meta_content_scope: meta.function.objc++ meta.toc-list.full-identifier.objc++ + - include: scope:source.c++#identifier-path-generic + - match: '(?:(::)\s*)?({{identifier}})' + captures: + 1: punctuation.accessor.double-colon.objc++ + 2: entity.name.function.constructor.objc++ - match: '(?=[^\w\s])' set: function-definition-params - - match: '(?={{path_lookahead}}\s*::\s*~{{identifier}}\s*(\(|$))' + - match: '(?={{path_lookahead}}\s*(?:{{generic_lookahead}})?\s*::\s*~{{identifier}}\s*(\(|$))' set: - - meta_content_scope: meta.function.objc++ entity.name.function.destructor.objc++ - - include: scope:source.c++#identifiers - - match: '~{{identifier}}' + - meta_content_scope: meta.function.objc++ meta.toc-list.full-identifier.objc++ + - include: scope:source.c++#identifier-path-generic + - match: '(?:(::)\s*)?(~{{identifier}})' + captures: + 1: punctuation.accessor.double-colon.objc++ + 2: entity.name.function.destructor.objc++ - match: '(?=[^\w\s])' set: function-definition-params # If we see a path ending in :: before a newline, we don't know if it is # a constructor or destructor, or a long return type, so we are just going # to treat it like a regular function. Most likely it is a constructor, # since it doesn't seem most developers would create such a long typename. - - match: '(?={{path_lookahead}}\s*::\s*$)' + - match: '(?={{path_lookahead}}\s*(?:{{generic_lookahead}})?::\s*$)' set: - - meta_content_scope: meta.function.objc++ entity.name.function.objc++ - - include: scope:source.c++#identifiers - - match: '~{{identifier}}' + - meta_content_scope: meta.function.objc++ meta.toc-list.full-identifier.objc++ + - include: scope:source.c++#identifier-path-generic + - match: '(::)\s*$' + captures: + 1: punctuation.accessor.double-colon.objc++ + - match: '(?:(::)\s*)?(~?{{identifier}})(?=\s*\()' + captures: + 1: punctuation.accessor.double-colon.objc++ + 2: entity.name.function.objc++ - match: '(?=[^\w\s])' set: function-definition-params - include: scope:source.c++#unique-strings @@ -955,8 +1008,12 @@ contexts: # Operator overloading - match: '(?=({{path_lookahead}}\s*(?:{{generic_lookahead}})?::\s*)?{{operator_method_name}}\s*(\(|$))' set: - - meta_content_scope: meta.function.objc++ entity.name.function.objc++ - - include: scope:source.c++#identifiers + - meta_content_scope: meta.function.objc++ meta.toc-list.full-identifier.objc++ + - include: scope:source.c++#identifier-path-generic + - match: '(?:(::)\s*)?({{operator_method_name}})(?=\s*\()' + captures: + 1: punctuation.accessor.double-colon.objc++ + 2: entity.name.function.objc++ - match: '(?=\s*(\(|$))' set: function-definition-params # Identifier that is not the function name - likely a macro or type @@ -976,26 +1033,21 @@ contexts: pop: true global-function-identifier-generic: - - include: angle-brackets - - match: '::' - scope: punctuation.accessor.objc++ - - match: '(?={{identifier}}<.*>\s*\()' - push: - - meta_content_scope: entity.name.function.objc++ - - include: scope:source.c++#identifiers - - match: '(?=<)' - pop: true - - match: '(?={{identifier}}\s*\()' - push: - - meta_content_scope: entity.name.function.objc++ - - include: scope:source.c++#identifiers - - match: '' - pop: true + - meta_content_scope: meta.toc-list.full-identifier.objc++ + - include: scope:source.c++#identifier-path-generic + - match: '(?:(::)\s*)?({{identifier}})(?=\s*(<.*>)?\s*\()' + captures: + 1: punctuation.accessor.double-colon.objc++ + 2: entity.name.function.objc++ - match: '(?=\()' pop: true global-function-identifier: - - meta_content_scope: entity.name.function.objc++ + - meta_content_scope: meta.toc-list.full-identifier.objc++ + - match: '(?:(::)\s*)?({{identifier}})(?!\s*(::))' + captures: + 1: punctuation.accessor.double-colon.c++ + 2: entity.name.function.c++ - include: scope:source.c++#identifiers - match: '(?=\S)' pop: true @@ -1042,7 +1094,7 @@ contexts: - match: '&' scope: keyword.operator.objc++ - match: \b0\b - scope: constant.numeric.objc++ + scope: constant.numeric.integer.decimal.objc++ - match: \b(default|delete)\b scope: storage.modifier.objc++ - match: '(?=\{)' @@ -1107,9 +1159,16 @@ contexts: - match: '{{identifier}}(?={{data_structures_forward_decl_lookahead}})' scope: entity.name.class.forward-decl.objc++ set: data-structures-class-definition-after-identifier - - match: '{{identifier}}' - scope: entity.name.class.objc++ - set: data-structures-class-definition-after-identifier + - match: '(?={{path_lookahead}})' + set: + - meta_scope: meta.class.objc++ + - match: '{{identifier}}(?!\s*::)' + scope: entity.name.class.objc++ + set: data-structures-class-definition-after-identifier + - include: scope:source.c++#identifiers + - match: data-structures-class-definition-after-identifier + - match: '(?=[^\w\s])' + set: data-structures-class-definition-after-identifier - match: '(?=[:{])' set: data-structures-class-definition-after-identifier - match: '(?=;)' @@ -1135,9 +1194,16 @@ contexts: - match: '{{identifier}}(?={{data_structures_forward_decl_lookahead}})' scope: entity.name.struct.forward-decl.objc++ set: data-structures-struct-definition-after-identifier - - match: '{{identifier}}' - scope: entity.name.struct.objc++ - set: data-structures-struct-definition-after-identifier + - match: '(?={{path_lookahead}})' + set: + - meta_scope: meta.struct.objc++ + - match: '{{identifier}}(?!\s*::)' + scope: entity.name.struct.objc++ + set: data-structures-struct-definition-after-identifier + - include: scope:source.c++#identifiers + - match: data-structures-struct-definition-after-identifier + - match: '(?=[^\w\s])' + set: data-structures-struct-definition-after-identifier - match: '(?=[:{])' set: data-structures-struct-definition-after-identifier - match: '(?=;)' @@ -1163,9 +1229,16 @@ contexts: - match: '{{identifier}}(?={{data_structures_forward_decl_lookahead}})' scope: entity.name.enum.forward-decl.objc++ set: data-structures-enum-definition-after-identifier - - match: '{{identifier}}' - scope: entity.name.enum.objc++ - set: data-structures-enum-definition-after-identifier + - match: '(?={{path_lookahead}})' + set: + - meta_scope: meta.enum.objc++ + - match: '{{identifier}}(?!\s*::)' + scope: entity.name.enum.objc++ + set: data-structures-enum-definition-after-identifier + - include: scope:source.c++#identifiers + - match: data-structures-enum-definition-after-identifier + - match: '(?=[^\w\s])' + set: data-structures-enum-definition-after-identifier - match: '(?=[:{])' set: data-structures-enum-definition-after-identifier - match: '(?=;)' @@ -1192,9 +1265,16 @@ contexts: - match: '{{identifier}}(?={{data_structures_forward_decl_lookahead}})' scope: entity.name.union.forward-decl.objc++ set: data-structures-union-definition-after-identifier - - match: '{{identifier}}' - scope: entity.name.union.objc++ - set: data-structures-union-definition-after-identifier + - match: '(?={{path_lookahead}})' + set: + - meta_scope: meta.union.objc++ + - match: '{{identifier}}(?!\s*::)' + scope: entity.name.union.objc++ + set: data-structures-union-definition-after-identifier + - include: scope:source.c++#identifiers + - match: data-structures-union-definition-after-identifier + - match: '(?=[^\w\s])' + set: data-structures-union-definition-after-identifier - match: '(?=[{])' set: data-structures-union-definition-after-identifier - match: '(?=;)' @@ -1270,23 +1350,31 @@ contexts: - include: preprocessor-expressions - include: expressions-minus-generic-type + data-structures-modifier-friend: + - match: (?=;) + pop: true + - match: '\{' + scope: punctuation.section.block.begin.objc++ + set: + - meta_scope: meta.block.objc++ + - match: '\}' + scope: punctuation.section.block.end.objc++ + pop: true + - include: statements + - include: expressions-minus-function-call + data-structures-modifier: - match: '\bfriend\b' scope: storage.modifier.objc++ push: - - match: (?=;) - pop: true - - match: '\{' - scope: punctuation.section.block.begin.objc++ - set: - - meta_scope: meta.block.objc++ - - match: '\}' - scope: punctuation.section.block.end.objc++ - pop: true - - include: statements + - include: comments - match: '\b({{before_tag}})\b' scope: storage.type.objc++ - - include: expressions-minus-function-call + set: data-structures-modifier-friend + - match: '(?=\S)(?=[^;]+;)' + set: data-structures-modifier-friend + - match: '(?=\S)' + pop: true - include: comments - include: modifiers-parens - include: modifiers @@ -1475,7 +1563,7 @@ contexts: - match: '&' scope: keyword.operator.objc++ - match: \b0\b - scope: constant.numeric.objc++ + scope: constant.numeric.integer.decimal.objc++ - match: \b(default|delete)\b scope: storage.modifier.objc++ - match: '(?=:)' @@ -1548,7 +1636,7 @@ contexts: captures: 1: meta.preprocessor.objc++ 2: keyword.control.import.objc++ - 3: constant.numeric.preprocessor.objc++ + 3: constant.numeric.integer.decimal.objc++ push: - match: ^\s*(#\s*endif)\b captures: @@ -1574,7 +1662,7 @@ contexts: captures: 1: meta.preprocessor.objc++ 2: keyword.control.import.objc++ - 3: constant.numeric.preprocessor.objc++ + 3: constant.numeric.integer.decimal.objc++ push: - match: ^\s*(#\s*endif)\b captures: @@ -1618,7 +1706,7 @@ contexts: captures: 1: meta.preprocessor.objc++ 2: keyword.control.import.objc++ - 3: constant.numeric.preprocessor.objc++ + 3: constant.numeric.integer.decimal.objc++ push: - match: ^\s*(#\s*endif)\b captures: @@ -1645,7 +1733,7 @@ contexts: captures: 1: meta.preprocessor.objc++ 2: keyword.control.import.objc++ - 3: constant.numeric.preprocessor.objc++ + 3: constant.numeric.integer.decimal.objc++ push: - match: ^\s*(#\s*endif)\b captures: @@ -1750,7 +1838,7 @@ contexts: captures: 1: meta.preprocessor.objc++ 2: keyword.control.import.objc++ - 3: constant.numeric.preprocessor.objc++ + 3: constant.numeric.integer.decimal.objc++ push: - match: ^\s*(#\s*endif)\b captures: @@ -1776,7 +1864,7 @@ contexts: captures: 1: meta.preprocessor.objc++ 2: keyword.control.import.objc++ - 3: constant.numeric.preprocessor.objc++ + 3: constant.numeric.integer.decimal.objc++ push: - match: ^\s*(#\s*endif)\b captures: @@ -1991,6 +2079,16 @@ contexts: scope: punctuation.section.block.begin.objc++ - match: '\}' scope: punctuation.section.block.end.objc++ + # Captures the namespace macro idiom + - match: '\b(namespace)\s+(?={{path_lookahead}}\s*\{)' + scope: meta.namespace.objc++ + captures: + 1: keyword.control.objc++ + push: + - meta_content_scope: meta.namespace.objc++ entity.name.namespace.objc++ + - include: scope:source.c++#identifiers + - match: '(?=\S)' + pop: true - include: expressions preprocessor-other: diff --git a/Objective-C/Objective-C.sublime-syntax b/Objective-C/Objective-C.sublime-syntax index 7154afaf0e..ca8829b1ab 100644 --- a/Objective-C/Objective-C.sublime-syntax +++ b/Objective-C/Objective-C.sublime-syntax @@ -43,8 +43,10 @@ contexts: - match: '\)' scope: punctuation.section.scope.end.objc pop: true - - match: \b(getter|setter|readonly|readwrite|assign|retain|copy|nonatomic|strong|weak)\b + - match: \b(getter|setter|readonly|readwrite|assign|retain|copy|nonatomic|strong|weak|class|nonnull|nullable|null_unspecified|null_resettable)\b scope: keyword.other.property.attribute.objc + - match: ',' + scope: punctuation.separator.objc - match: ((@)property)\b scope: meta.property.objc captures: @@ -260,7 +262,6 @@ contexts: - include: preprocessor-expressions - include: comments - include: case-default - - include: access - include: typedef - include: keywords-parens - include: keywords @@ -271,6 +272,7 @@ contexts: - include: block - include: variables - include: constants + - include: access - match: ',' scope: punctuation.separator.objc - match: '\)|\}' @@ -475,7 +477,7 @@ contexts: captures: 1: meta.preprocessor.objc 2: keyword.control.import.objc - 3: constant.numeric.preprocessor.objc + 3: constant.numeric.integer.decimal.objc push: - match: ^\s*(#\s*endif)\b captures: @@ -501,7 +503,7 @@ contexts: captures: 1: meta.preprocessor.objc 2: keyword.control.import.objc - 3: constant.numeric.preprocessor.objc + 3: constant.numeric.integer.decimal.objc push: - match: ^\s*(#\s*endif)\b captures: @@ -537,14 +539,11 @@ contexts: - include: comments - match: \* scope: keyword.operator.objc - # If a struct/union/enum followed by a name that is not a macro or declspec - # then this is likely a return type of a function. This is uncommon. - match: |- (?x: ({{before_tag}}) \s+ (?= - (?![[:upper:][:digit:]_]+\b|__declspec) {{identifier}} (\s+{{identifier}}(?!\s*[{=;])|\s*\*+) ) @@ -668,12 +667,24 @@ contexts: data-structures-struct-definition: - meta_scope: meta.struct.objc - include: data-structures-definition-common-begin + - include: data-structures-definition-common-macro - match: '{{identifier}}(?=\s*;)' scope: entity.name.struct.forward-decl.objc - match: '{{identifier}}' scope: entity.name.struct.objc + set: data-structures-struct-definition-after-name + - include: data-structures-struct-definition-block-start - match: '(?=;)' pop: true + + data-structures-struct-definition-after-name: + - meta_scope: meta.struct.objc + - include: data-structures-definition-common-begin + - match: '(?=;)' + pop: true + - include: data-structures-struct-definition-block-start + + data-structures-struct-definition-block-start: - match: '\{' scope: meta.block.objc punctuation.section.block.begin.objc set: @@ -686,12 +697,24 @@ contexts: data-structures-enum-definition: - meta_scope: meta.enum.objc - include: data-structures-definition-common-begin + - include: data-structures-definition-common-macro - match: '{{identifier}}(?=\s*;)' scope: entity.name.enum.forward-decl.objc - match: '{{identifier}}' scope: entity.name.enum.objc + set: data-structures-enum-definition-after-name + - include: data-structures-enum-definition-block-start + - match: '(?=;)' + pop: true + + data-structures-enum-definition-after-name: + - meta_scope: meta.enum.objc + - include: data-structures-definition-common-begin - match: '(?=;)' pop: true + - include: data-structures-enum-definition-block-start + + data-structures-enum-definition-block-start: - match: '\{' scope: meta.block.objc punctuation.section.block.begin.objc set: @@ -705,12 +728,24 @@ contexts: data-structures-union-definition: - meta_scope: meta.union.objc - include: data-structures-definition-common-begin + - include: data-structures-definition-common-macro - match: '{{identifier}}(?=\s*;)' scope: entity.name.union.forward-decl.objc - match: '{{identifier}}' scope: entity.name.union.objc + set: data-structures-union-definition-after-name + - include: data-structures-union-definition-block-start - match: '(?=;)' pop: true + + data-structures-union-definition-after-name: + - meta_scope: meta.union.objc + - include: data-structures-definition-common-begin + - match: '(?=;)' + pop: true + - include: data-structures-union-definition-block-start + + data-structures-union-definition-block-start: - match: '\{' scope: meta.block.objc punctuation.section.block.begin.objc set: @@ -726,8 +761,10 @@ contexts: pop: true - include: modifiers-parens - include: modifiers + + data-structures-definition-common-macro: # Handle macros so they aren't matched as the class name - - match: '\b[[:upper:][:digit:]_]+\b' + - match: '\b[[:upper:][:digit:]_]+\b(?!\s*($|\{))' data-structures-definition-common-end: - match: '(?=;)' @@ -874,7 +911,7 @@ contexts: captures: 1: meta.preprocessor.objc 2: keyword.control.import.objc - 3: constant.numeric.preprocessor.objc + 3: constant.numeric.integer.decimal.objc push: - match: ^\s*(#\s*endif)\b captures: @@ -900,7 +937,7 @@ contexts: captures: 1: meta.preprocessor.objc 2: keyword.control.import.objc - 3: constant.numeric.preprocessor.objc + 3: constant.numeric.integer.decimal.objc push: - match: ^\s*(#\s*endif)\b captures: @@ -944,7 +981,7 @@ contexts: captures: 1: meta.preprocessor.objc 2: keyword.control.import.objc - 3: constant.numeric.preprocessor.objc + 3: constant.numeric.integer.decimal.objc push: - match: ^\s*(#\s*endif)\b captures: @@ -971,7 +1008,7 @@ contexts: captures: 1: meta.preprocessor.objc 2: keyword.control.import.objc - 3: constant.numeric.preprocessor.objc + 3: constant.numeric.integer.decimal.objc push: - match: ^\s*(#\s*endif)\b captures: @@ -1076,7 +1113,7 @@ contexts: captures: 1: meta.preprocessor.objc 2: keyword.control.import.objc - 3: constant.numeric.preprocessor.objc + 3: constant.numeric.integer.decimal.objc push: - match: ^\s*(#\s*endif)\b captures: @@ -1102,7 +1139,7 @@ contexts: captures: 1: meta.preprocessor.objc 2: keyword.control.import.objc - 3: constant.numeric.preprocessor.objc + 3: constant.numeric.integer.decimal.objc push: - match: ^\s*(#\s*endif)\b captures: diff --git a/Objective-C/syntax_test_objc++.mm b/Objective-C/syntax_test_objc++.mm index e95184cf28..946c322271 100644 --- a/Objective-C/syntax_test_objc++.mm +++ b/Objective-C/syntax_test_objc++.mm @@ -106,7 +106,8 @@ int main() { // constructor. FOOLIB_RESULT some_namespace::some_function(int a_parameter, double another_parameter) { - /* <- meta.function entity.name.function - entity.name.function.constructor */ + /* <- meta.function meta.toc-list.full-identifier */ + /* ^ entity.name.function - entity.name.function.constructor */ return FOOLIB_SUCCESS; } @@ -392,6 +393,51 @@ bool foo (bool run=true) {} /* ^ - entity.name.type.struct */ /* ^ entity.name.type.typedef */ +using Alias = Foo; +/* <- keyword.control */ +/* ^^^^^ entity.name.type.using */ + +using Alias + = NewLineFoo; +/*^ - entity.name */ + +template +using TemplateAlias = Foo; +/* ^^^^^^^^^^^^^ entity.name.type.using */ + +using std::cout; +/* <- keyword.control */ +/* ^ - entity.name */ + +using std:: + cout; +/*^ - entity.name */ + +class MyClass : public SuperClass +{ + using This = MyClass; +/* ^ keyword.control */ +/* ^^^^ entity.name.type.using */ + + using MyInt +/* ^ keyword.control */ + = int32_t; + + using SuperClass::SuperClass; +/* ^ keyword.control */ +/* ^ - entity.name */ +}; + +class MyClass : public CrtpClass +{ + using typename CrtpClass::PointerType; +/* ^ keyword.control */ +/* ^ storage.modifier */ + using CrtpClass< +/* ^ keyword.control */ + MyClass>::method; +}; + template class MyStack; /* <- storage.type.template */ /* ^ punctuation.section.generic */ @@ -445,19 +491,37 @@ bool foo (bool run=true) {} } bool A::operator<(const A& a) { return false; } /* ^ storage.type */ -/* ^^^^^^^^^^^^ meta.function entity.name.function */ +/* ^^^^^^^^^ meta.function meta.toc-list.full-identifier */ +/* ^^^^^^^^^ entity.name.function */ /* ^ meta.function.parameters punctuation.section.group.begin */ template bool A::operator<(const A& a) { return false; } /* ^ storage.type.template */ /* ^ punctuation.section.generic.begin */ /* ^ punctuation.section.generic.end */ -/* ^^^^^^^^^^^^^^^ meta.function entity.name.function */ +/* ^^^^^^^^^^^^^^^ meta.function meta.toc-list.full-identifier */ +/* ^^^^^^^^^ entity.name.function */ /* ^ meta.function.parameters meta.group punctuation.section.group.begin */ template SomeType A::foobar(YetAnotherType&& asRValue) {} -/* ^^^^^^ meta.function entity.name.function */ +/* ^^^^^^^^^^^^^^ meta.function meta.toc-list.full-identifier */ +/* ^^^^^^ entity.name.function */ + template SomeType A::foobar(YetAnotherType&& asRValue) {} -/* ^^^^^^ meta.function entity.name.function */ +/* ^^^^^^^^^^^^^^ meta.function meta.toc-list.full-identifier */ +/* ^^^^^^ entity.name.function */ + +template A::A(YetAnotherType&& asRValue) {} +/* ^^^^^^^^^ meta.function meta.toc-list.full-identifier */ +/* ^ entity.name.function */ + +template A::A(YetAnotherType&& asRValue) {} +/* ^^^^^^^^^ meta.function meta.toc-list.full-identifier */ +/* ^ entity.name.function.constructor */ + +template A::~A(YetAnotherType&& asRValue) {} +/* ^^^^^^^^^ meta.function meta.toc-list.full-identifier */ +/* ^ entity.name.function.destructor */ + template bool A::operator > (const A& other) { return false; } /* ^^^^^^^^^^^^ meta.function entity.name.function */ @@ -614,7 +678,7 @@ int main() { // Example from section 14.2/4 of // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3690.pdf -struct X +struct X { template X* alloc(); @@ -622,12 +686,12 @@ int main() { template static X* adjust(); }; -template -void f(T* p) +template +void f(T* p) { // Be optimistic: scope it as a template member function call anyway. T* p1 = p->alloc<200>(); // ill-formed: < means less than - + T* p2 = p->template alloc<200>(); // OK: < starts template argument list /* ^ punctuation.accessor */ /* ^ storage.type - variable.other */ @@ -635,7 +699,7 @@ void f(T* p) // Be optimistic: scope it as a template member function call anyway. T::adjust<100>(); // ill-formed: < means less than - + T::template adjust<100>(); // OK: < starts template argument list /* <- - variable.function */ /*^ punctuation.accessor */ @@ -673,15 +737,15 @@ void f() template C f(T t) { return C { g>(t) }; - /* ^ - variable.function */ - /* ^ punctuation.section.block.begin */ + /* ^ variable.function */ + /* ^ punctuation.section.group.begin */ } template C> f(T t) { return C> { g>(t) }; - /* ^ - variable.function */ - /* ^ punctuation.section.block.begin */ + /* ^ variable.function */ + /* ^ punctuation.section.group.begin */ } struct A { int foo; }; @@ -776,7 +840,7 @@ int main() { { throw std :: string("xyz"); /* <- keyword.control.flow.throw */ - /* ^^^^^^^^^^^^^ variable.function */ + /* ^^^^^^ variable.function */ /* ^^ punctuation.accessor */ } catch (...) @@ -870,135 +934,266 @@ int main() { ///////////////////////////////////////////// dec1 = 1234567890; -/* ^ constant.numeric */ -/* ^ constant.numeric */ +/* ^^^^^^^^^^ constant.numeric.integer.decimal */ +/* ^ punctuation.terminator - constant */ dec2 = 1'924'013; -/* ^ constant.numeric */ -/* ^ constant.numeric */ +/* ^^^^^^^^^ constant.numeric.integer.decimal */ +/* ^ punctuation.terminator - constant */ dec3 = 124ul; -/* ^ constant.numeric */ -/* ^ constant.numeric */ +/* ^^^^^ constant.numeric.integer.decimal */ +/* ^^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ dec4 = 9'204lu; -/* ^ constant.numeric */ -/* ^ constant.numeric */ +/* ^^^^^^^ constant.numeric.integer.decimal */ +/* ^^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ dec5 = 2'354'202'076LL; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -int oct1 = 01234567; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -int oct2 = 014'70; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -int hex1 = 0x1234567890ABCDEF; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -int hex2 = 0X1234567890ABCDEF; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -int hex3 = 0x1234567890abcdef; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -int hex4 = 0xA7'45'8C'38; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -int bin1 = 0b010110; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -int bin2 = 0B010010; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -int bin3 = 0b1001'1101'0010'1100; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -units1 = 134h; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -units2 = 147min; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -units3 = 357s; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -units4 = 234_custom; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -fixed1 = 123.456; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -fixed2 = 12.; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -fixed3 = .35; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -fixed4 = 1'843'290.245'123; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -fixed5 = 0.3f; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -fixed6 = 0.82L; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -float sci1 = 1.23e10; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -float sci2 = 13e5; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -float sci3 = 14.23e+14; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -float sci4 = 14e+14; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -float sci5 = 18.84e-12; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -float sci6 = 46e-14; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -float sci7 = 2'837e1'000; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -float sci8 = 23e-1'000; -/* ^ constant.numeric */ -/* ^ constant.numeric */ - -double sci_hex = 0xc1.01AbFp-1; -/* ^^^^^^^^^^^^^ constant.numeric */ +/* ^^^^^^^^^^^^^^^ constant.numeric.integer.decimal */ +/* ^^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +oct1 = 0123_567; +/* ^^^^^^^^ constant.numeric.integer.octal */ +/* ^ punctuation.definition.numeric.base */ +/* ^^^^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +oct2 = 014'70; +/* ^^^^^^ constant.numeric.integer.octal */ +/* ^ punctuation.definition.numeric.base */ +/* ^ punctuation.terminator - constant */ + +hex1 = 0x1234567890ABCDEF; +/* ^^^^^^^^^^^^^^^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ punctuation.terminator - constant */ + +hex2 = 0X1234567890ABCDEF; +/* ^^^^^^^^^^^^^^^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ punctuation.terminator - constant */ + +hex3 = 0x1234567890abcdef; +/* ^^^^^^^^^^^^^^^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ punctuation.terminator - constant */ + +hex4 = 0xA7'45'8C'38; +/* ^^^^^^^^^^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ punctuation.terminator - constant */ + +hex5 = 0x0+0xFL+0xaull+0xallu+0xfu+0xf'12_4_uz; +/* ^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ storage.type.numeric */ +/* ^^^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^^^ storage.type.numeric */ +/* ^^^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^^^ storage.type.numeric */ +/* ^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ storage.type.numeric */ +/* ^^^^^^^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^^^^^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +hex2 = 0xc1.01AbFp-1; +/* ^^^^^^^^^^^^^ constant.numeric.float.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ punctuation.separator.decimal */ +/* ^ punctuation.terminator - constant */ + +bin1 = 0b010110; +/* ^^^^^^^^ constant.numeric.integer.binary */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ punctuation.terminator - constant */ + +bin2 = 0B010010; +/* ^^^^^^^^ constant.numeric.integer.binary */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ punctuation.terminator - constant */ + +bin3 = 0b1001'1101'0010'1100; +/* ^^^^^^^^^^^^^^^^^^^^^ constant.numeric.integer.binary */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ punctuation.terminator - constant */ + +f = 1.1+1.1e1+1.1e-1+1.1f+1.1e1f+1.1e-1f+1.1L+1.1e1L+1.1e-1L; +/* ^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +f = 1.e1+1.e-1+1.e1f+1.e-1f+1.e1L+1.e-1L; +/* ^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +f = 1.+1.f+1.L+1..; +/* ^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^ constant.numeric.integer.decimal */ +/* ^^ invalid.illegal.syntax */ +/* ^ punctuation.terminator - constant */ + +f = 1e1+1e1f+1e1L; +/* ^^^ constant.numeric.float.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^ constant.numeric.float.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^ constant.numeric.float.decimal */ +/* ^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +f = .1+.1e1+.1e-1+.1f+.1e1f+.1e-1f+.1L+.1e1L+.1e-1L; +/* ^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +f = 1'843'290.245'123; +/* ^^^^^^^^^^^^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ punctuation.terminator - constant */ + +f = 2'837e1'000; +/* ^^^^^^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.terminator - constant */ + +f = 23e-1'000; +/* ^^^^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.terminator - constant */ + +units1 = 134h + 123.45h; +/* ^^^^ constant.numeric.integer.decimal */ +/* ^ storage.type.numeric */ +/* ^^^ - constant */ +/* ^^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +units2 = 147min + 147.min; +/* ^^^^^^ constant.numeric.integer.decimal */ +/* ^^^ storage.type.numeric */ +/* ^^^ - constant */ +/* ^^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^^^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +units3 = 357s + 34.7s; +/* ^^^^ constant.numeric.integer.decimal */ +/* ^ storage.type.numeric */ +/* ^^^ - constant */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ + +units4 = 234_custom + 10e-1_custom; +/* ^^^^^^^^^^ constant.numeric.integer.decimal */ +/* ^^^^^^^ storage.type.numeric */ +/* ^^^ - constant */ +/* ^^^^^^^^^^^^ constant.numeric.float.decimal */ +/* ^^^^^^^ storage.type.numeric */ +/* ^ punctuation.terminator - constant */ ///////////////////////////////////////////// // Functions @@ -1124,7 +1319,8 @@ void abcdWXYZ1234() void FooBar :: baz(int a) /* ^^^^^^^^^^^^^^^^^^^^ meta.function */ -/* ^^^^^^^^^^^^^ entity.name.function */ +/* ^^^^^^^^^^^^^ meta.toc-list.full-identifier */ +/* ^^^ entity.name.function */ /* ^^ punctuation.accessor */ /* ^^^^^^^ meta.function.parameters meta.group */ /* ^ punctuation.section.group.begin */ @@ -1134,7 +1330,8 @@ void abcdWXYZ1234() } /* A comment. */ void FooBar :: baz(int a) /* ^^^^^^^^^^^^^^^^^^^^ meta.function */ -/* ^^^^^^^^^^^^^ entity.name.function */ +/* ^^^^^^^^^^^^^ meta.toc-list.full-identifier */ +/* ^^^ entity.name.function */ /* ^^ punctuation.accessor */ /* ^^^^^^^ meta.function.parameters meta.group */ /* ^ punctuation.section.group.begin */ @@ -1144,13 +1341,15 @@ void abcdWXYZ1234() } // prevent leading comment from function recognition /**/ HRESULT A::b() -/* ^ meta.function entity.name.function */ +/* ^ meta.function */ +/* ^ entity.name.function */ { return S_OK; } FooBar::FooBar(int a) /*^^^^^^^^^^^^^^^^^^^ meta.function */ -/*^^^^^^^^^^^^ entity.name.function */ +/*^^^^^^^^^^^^ meta.toc-list.full-identifier */ +/* ^^^^^^ entity.name.function */ /* ^^^^^^^ meta.function.parameters meta.group */ /* ^ punctuation.section.group.begin */ /* ^^^ storage.type */ @@ -1160,7 +1359,8 @@ void abcdWXYZ1234() FooBar :: FooBar(int a) & = /*^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function */ -/*^^^^^^^^^^^^^^ entity.name.function */ +/*^^^^^^^^^^^^^^ meta.toc-list.full-identifier */ +/* ^^^^^^ entity.name.function */ /* ^^^^^^^ meta.function.parameters meta.group */ /* ^ punctuation.section.group.begin */ /* ^^^ storage.type */ @@ -1172,7 +1372,8 @@ void abcdWXYZ1234() /*^^^^^ meta.function storage.modifier */ FooBar::~FooBar -/*^^^^^^^^^^^^^ meta.function entity.name.function */ +/*^^^^^^^^^^^^^ meta.function meta.toc-list.full-identifier */ +/* ^^^^^^^ entity.name.function */ () { } /* <- meta.function.parameters meta.group punctuation.section.group.begin */ /* <- meta.function.parameters meta.group punctuation.section.group.end */ @@ -1180,13 +1381,14 @@ void abcdWXYZ1234() ThisIsAReallyReallyLongClassNameThatRequiresWrappingCodeInTheMiddleOfAPath:: ThisIsAReallyReallyLongClassNameThatRequiresWrappingCodeInTheMiddleOfAPath() -/* <- entity.name.function */ +/* <- meta.function meta.toc-list.full-identifier */ : var_name(nullptr) { } bool FooBar::operator==() {} /* ^^^^^^^^^^^^^^^^^^^^^^^ meta.function */ -/* ^^^^^^^^^^^^^^^^^^ entity.name.function */ +/* ^^^^^^^^^^^^^^^^^^ meta.toc-list.full-identifier */ +/* ^^^^^^^^^^ entity.name.function */ /* ^^ meta.function.parameters meta.group */ /* ^ punctuation.section.group.begin */ /* ^ punctuation.section.group.end */ @@ -1203,7 +1405,8 @@ void abcdWXYZ1234() /* ^^^ meta.block */ /* ^ punctuation.section.block.begin */ /* ^ punctuation.section.block.end */ -/*^^^^^^^^^^^^^^^^^^^ entity.name.function */ +/*^^^^^^^^^^^^^^^^^^^ meta.toc-list.full-identifier */ +/* ^^^^^^^ entity.name.function */ extern "C" void test_in_extern_c_block() /* ^^^^^^^^^^^^^^^^^^^^^^^^ meta.function */ @@ -1296,10 +1499,22 @@ void f() /* ^ storage.modifier */ /* ^ string */ +using namespace +/* <- keyword.control */ +/* ^ keyword.control */ + using namespace myNameSpace; /* <- keyword.control */ /* ^ keyword.control */ +void func() { + using namespace NAME __attribute__((visibility ("hidden"))); +/* ^ keyword.control */ +/* ^ keyword.control */ +/* ^ storage.modifier */ +/* ^ string */ +} + namespace ns :: abc /* Neither this comment... */ /*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.namespace */ /* ^^^^^^^^^ entity.name.namespace */ @@ -1644,9 +1859,9 @@ auto g() -> std::vector override final { friend int func(int a, int b) { /* ^ storage.modifier */ /* ^ storage.type */ -/* ^ - entity.name.function */ +/* ^ entity.name.function */ /* ^ - meta.function-call */ -/* ^ meta.class meta.block meta.block punctuation.section.block.begin */ +/* ^ meta.class meta.block meta.method meta.block punctuation.section.block.begin */ int a = 1; } /* ^ meta.class meta.block meta.block punctuation.section.block.end */ @@ -1658,6 +1873,13 @@ friend int func(int a, int b) { /* ^^ punctuation.accessor */ /* ^ - entity */ + friend bool operator != (const X& lhs, const X& rhs) { + /* ^^^^^^^^^^^ entity.name.function */ + int a = 1; + } +/* ^ meta.class meta.block meta.block punctuation.section.block.end */ +/* ^ - meta.class meta.block meta.block */ + #if 0 /* ^ constant.numeric */ int disabled_func() { @@ -1950,6 +2172,59 @@ T operator()(int a) { } }; +class Namespace::MyClass MACRO1 MACRO2 : public SuperClass +/* ^^^^^^^ entity.name.class */ +/* ^^ punctuation.accessor */ +/* ^ - entity.name */ +{ +}; + +struct Namespace::MyStruct +/* ^^^^^^^^ entity.name.struct */ +/* ^^ punctuation.accessor */ +{ +}; + +union Namespace::MyUnion +/* ^^^^^^^ entity.name.union */ +/* ^^ punctuation.accessor */ +{ +}; + +enum class Namespace::MyEnum +/* ^^^^^^ entity.name.enum */ +/* ^^ punctuation.accessor */ +{ +}; + +class Namespace:: +MyClass MACRO1 +/* <- entity.name.class */ +/* ^ - entity.name */ +{ +}; + +struct Namespace:: +MyStruct MACRO1 +/* <- entity.name.struct */ +/* ^ - entity.name */ +{ +}; + +union Namespace:: +MyUnion MACRO1 +/* <- entity.name.union */ +/* ^ - entity.name */ +{ +}; + +enum class Namespace:: +MyEnum MACRO1 +/* <- entity.name.enum */ +/* ^ - entity.name */ +{ +}; + ///////////////////////////////////////////// // Test preprocessor branching and C blocks ///////////////////////////////////////////// @@ -2240,7 +2515,7 @@ void sayHi() ); if (::std::foo()) {} -/* ^^^^^^^^^^ variable.function */ +/* ^^^ variable.function */ /* ^^ punctuation.accessor */ /* ^^ punctuation.accessor */ @@ -2266,10 +2541,32 @@ void sayHi() /* ^ punctuation.section.generic.end */ /* ^^ meta.group */ + ::myns::foo(); +/* ^^ punctuation.accessor.double-colon */ +/* ^^ punctuation.accessor.double-colon */ +/* ^^^^^^^^^^^^^^^^^^ meta.function-call */ +/* ^^^ variable.function */ +/* ^^^ storage.type */ + + myns::FooClass{42}; +/* ^^ punctuation.accessor.double-colon */ +/* ^^^^^^^^^^^^^^^^^^ meta.function-call */ +/* ^^^^^^^^ variable.function */ + + ::myns::BarClass{}; +/* ^^ punctuation.accessor.double-colon */ +/* ^^ punctuation.accessor.double-colon */ +/* ^^^^^^^^^^^^^^^^^^^^^ meta.function-call */ +/* ^^^^^^^^ variable.function */ +/* ^^^ storage.type */ + int a[5]; /* ^^^ meta.brackets */ /* ^ punctuation.section.brackets.begin */ /* ^ punctuation.section.brackets.end */ + + std::cout << ">> Hi!\n"; +/* ^^ keyword.operator.arithmetic.c */ } ///////////////////////////////////////////// @@ -2282,7 +2579,14 @@ @interface Person : NSObject @property (readonly) NSString *firstName; /* <- keyword.other punctuation.definition.keyword */ /*^ keyword.other */ -@property (readonly) NSString *lastName; +@property (readonly, nullable, class) NSString *lastName; +/* <- keyword.other punctuation.definition.keyword */ +/* ^ keyword.other.property.attribute */ +/* ^ punctuation.separator.objc */ +/* ^ keyword.other.property.attribute */ +/* ^ punctuation.separator.objc */ +/* ^ keyword.other.property.attribute. */ +/* ^ punctuation.section.scope.end */ @end /* <- storage.type punctuation.definition.storage.type */ /*^ storage.type */ diff --git a/Objective-C/syntax_test_objc.m b/Objective-C/syntax_test_objc.m index 1ea954c28d..1a99946b57 100644 --- a/Objective-C/syntax_test_objc.m +++ b/Objective-C/syntax_test_objc.m @@ -9,6 +9,40 @@ int main(){ /* ^^ keyword.operator.arithmetic */ } +enum Foo { kFoo, kBar }; +#define FOO Foo +enum FOO do_the_foo(void); +/* ^ entity.name.function */ +/* ^ storage.type */ + +#define APIC_CAPABILITY TheEnum +enum TheEnum { kFoo, kBar }; +static enum APIC_CAPABILITY apic_capabilities(void) { return kFoo; }; +/* ^ entity.name.function */ +/* ^ storage.type */ + +struct __declspec(dllimport) X {}; +/* ^ storage.modifier */ +/* ^ entity.name.struct */ + +struct __declspec(dllimport) baz X {}; +/* ^ storage.modifier */ +/* ^ entity.name.struct */ + +struct foo { +/* ^ entity.name.struct */ + union { +/* ^ storage.type */ + struct { +/* ^ storage.type */ + int a; +/* ^ storage.type */ + int b; +/* ^ storage.type */ + } + } +} + #define EXTTS_BUFSIZE (PTP_BUF_TIMESTAMPS /* comment block */ * sizeof(struct ptp_extts_event)) // comment line /*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.preprocessor.macro */ /* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.group */ @@ -580,7 +614,14 @@ @interface Person : NSObject @property (readonly) NSString *firstName; /* <- keyword.other punctuation.definition.keyword */ /*^ keyword.other */ -@property (readonly) NSString *lastName; +@property (readonly, nullable, class) NSString *lastName; +/* <- keyword.other punctuation.definition.keyword */ +/* ^ keyword.other.property.attribute */ +/* ^ punctuation.separator.objc */ +/* ^ keyword.other.property.attribute */ +/* ^ punctuation.separator.objc */ +/* ^ keyword.other.property.attribute. */ +/* ^ punctuation.section.scope.end */ @end /* <- storage.type punctuation.definition.storage.type */ /*^ storage.type */ @@ -639,6 +680,219 @@ - (void)debugOutput:(NSString *)format, ... NS_FORMAT_FUNCTION(1,2) /* ^^^^^^^^ string.quoted.other.lt-gt.include */ /* ^ punctuation.definition.string.end */ +///////////////////////////////////////////// +// Numeric Constants +///////////////////////////////////////////// + +dec0 = 0; +/* ^ constant.numeric.integer.decimal */ + +dec1 = 1234567890; +/* ^^^^^^^^^^ constant.numeric.integer.decimal */ + +dec2 = 1234567890f; +/* ^^^^^^^^^^^ constant.numeric.float.decimal */ +/* ^ storage.type.numeric */ + +dec3 = 1234567890L; +/* ^^^^^^^^^^^ constant.numeric.integer.decimal */ +/* ^ storage.type.numeric */ + +dec4 = 1234567890ul; +/* ^^^^^^^^^^^^ constant.numeric.integer.decimal */ +/* ^^ storage.type.numeric */ + +dec5 = 1234567890Lu; +/* ^^^^^^^^^^^^ constant.numeric.integer.decimal */ +/* ^^ storage.type.numeric */ + +dec6 = 1234567890LLU; +/* ^^^^^^^^^^^^^ constant.numeric.integer.decimal */ +/* ^^^ storage.type.numeric */ + +dec7 = 1234567890uLL; +/* ^^^^^^^^^^^^^ constant.numeric.integer.decimal */ +/* ^^^ storage.type.numeric */ + +dec8 = 1'234_567'890s0f; +/* ^ constant.numeric.integer.decimal */ +/* ^^^^^^^^^ string.quoted.single */ +/* ^^^^^^ constant.numeric.integer.decimal */ +/* ^^^ invalid.illegal.numeric.suffix */ +/* ^ punctuation.terminator - constant */ + +oct1 = 01234567; +/* ^^^^^^^^ constant.numeric.integer.octal */ +/* ^ punctuation.definition.numeric.base */ + +oct2 = 01234567L; +/* ^^^^^^^^ constant.numeric.integer.octal */ +/* ^ punctuation.definition.numeric.base */ +/* ^ storage.type.numeric */ + +oct3 = 01234567LL; +/* ^^^^^^^^^^ constant.numeric.integer.octal */ +/* ^ punctuation.definition.numeric.base */ +/* ^^ storage.type.numeric */ + +oct4 = 01234567ulL; +/* ^^^^^^^^^^^ constant.numeric.integer.octal */ +/* ^ punctuation.definition.numeric.base */ +/* ^^^ storage.type.numeric */ + +oct2 = 01284967Z0L; +/* ^^^^^^^^^^^ constant.numeric.integer.octal */ +/* ^ punctuation.definition.numeric.base */ +/* ^ invalid.illegal.numeric.digit */ +/* ^ invalid.illegal.numeric.digit */ +/* ^^^ invalid.illegal.numeric.suffix */ + +hex1 = 0x0+0xFL+0xaull+0xallu+0xfu+0x'f'12_4uz; +/* ^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ storage.type.numeric */ +/* ^^^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^^^ storage.type.numeric */ +/* ^^^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^^^ storage.type.numeric */ +/* ^^^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ storage.type.numeric */ +/* ^^ constant.numeric.integer.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^^^ string.quoted.single */ +/* ^^^^^^ constant.numeric.integer.decimal */ +/* ^^^^ invalid.illegal.numeric.suffix */ +/* ^ punctuation.terminator - constant */ + +hex2 = 0xc1.01AbFp-1; +/* ^^^^^^^^^^^^^ constant.numeric.float.hexadecimal */ +/* ^^ punctuation.definition.numeric.base */ +/* ^ punctuation.separator.decimal */ +/* ^ punctuation.terminator - constant */ + +f = 1.1+1.1e1+1.1e-1+1.1f+1.1e1f+1.1e-1f+1.1L+1.1e1L+1.1e-1L; +/* ^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ punctuation.terminator.objc */ + +f = 1.e1+1.e-1+1.e1f+1.e-1f+1.e1L+1.e-1L; +/* ^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ punctuation.terminator.objc */ + +f = 1.+1.f+1.L+1..; +/* ^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^ constant.numeric.integer.decimal */ +/* ^^ invalid.illegal.syntax */ +/* ^ punctuation.terminator.objc */ + +f = 1e1+1e1f+1e1L; +/* ^^^ constant.numeric.float.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^ constant.numeric.float.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^ constant.numeric.float.decimal */ +/* ^ storage.type.numeric */ +/* ^ punctuation.terminator.objc */ + +f = .1+.1e1+.1e-1+.1f+.1e1f+.1e-1f+.1L+.1e1L+.1e-1L; +/* ^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ keyword.operator.arithmetic */ +/* ^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ constant.numeric.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ storage.type.numeric */ +/* ^ punctuation.terminator.objc */ ///////////////////////////////////////////// // Objective-C specific format specifiers diff --git a/PHP/Indentation Rules.tmPreferences b/PHP/Indentation Rules.tmPreferences index 252571c971..c107d37781 100644 --- a/PHP/Indentation Rules.tmPreferences +++ b/PHP/Indentation Rules.tmPreferences @@ -18,7 +18,7 @@ \s* [}\])] # optionally followed by whitespace, followed by a closing: curly brace, square bracket or paren | # OR \s* (<\?(php)?\s+)? # an optional PHP open tag - (else(if)?\b.*:\s*($|//|/\*)|(end(if|for(each)?|switch|while))\b) # followed by an keyword that ends a control flow block + (else(\s*if)?\b.*:\s*($|//|/\*|\?>)|(end(if|for(each)?|switch|while))\b) # followed by an keyword that ends a control flow block ) ]]> diff --git a/PHP/PHP Source.sublime-syntax b/PHP/PHP Source.sublime-syntax index 102c469d5b..346a420597 100644 --- a/PHP/PHP Source.sublime-syntax +++ b/PHP/PHP Source.sublime-syntax @@ -128,7 +128,12 @@ contexts: pop: true - match: (?=\S) pop: true - - match: \b(break|c(ase|ontinue)|d(e(clare|fault)|ie|o)|e(lse(if)?|nd(declare|for(each)?|if|switch|while)|xit)|for(each)?|if|return|switch|use|while)\b + - match: |- + \b(?xi: + break | case | continue | declare | default | die | do | else | + elseif | enddeclare | endfor | endforeach | endif | endswitch | endwhile | exit | + for | foreach | if | return | switch | use | while + )\b scope: keyword.control.php - match: \b(catch)\b\s*\(\s* captures: @@ -150,6 +155,7 @@ contexts: pop: true - match: \b(catch|try|throw|finally)\b scope: keyword.control.exception.php + - include: arrow-function - include: closure - include: invoke-call - match: |- @@ -210,18 +216,26 @@ contexts: - match: (?i)\s*\(\s*(array|real|double|float|int(eger)?|bool(ean)?|string|object|binary|unset)\s*\) captures: 1: storage.type.php - - match: (?i)\b(array|real|double|float|int(eger)?|bool(ean)?|string|class|clone|var|function|interface|object)\b + - match: |- + \b(?xi: + array | bool | boolean | class | clone | double | float | function | + int | integer | interface | object | real | string + )\b scope: storage.type.php - match: (?i)\b(parent|self)\b scope: variable.language.php - - match: (?i)\b(global|abstract|const|extends|implements|final|p(r(ivate|otected)|ublic)|static)\b + - match: |- + \b(?xi: + abstract | const | extends | final | global | implements | private | protected | + public | static + )\b scope: storage.modifier.php - include: object - match: ; scope: punctuation.terminator.expression.php - include: heredoc - include: numbers - - match: (\+|-|\*|/|%|&|\||\^|>>|<<|\.)= + - match: (\+|-|\*|/|%|&|\||\^|>>|<<|\.|\?\?)= scope: keyword.operator.assignment.augmented.php - match: "=>" scope: keyword.operator.key.php @@ -236,13 +250,17 @@ contexts: scope: keyword.operator.increment-decrement.php - match: (\-|\+|\*|/|%) scope: keyword.operator.arithmetic.php + - match: '&&|\|\|' + scope: keyword.operator.logical.php - match: '<<|>>|~|\^|&|\|' scope: keyword.operator.bitwise.php - - match: (===|==|!==|!=|<=>|<=|>=|<>|<|>) + - match: (===|!==|<=>|==|!=|<=|>=|<>|<|>) scope: keyword.operator.comparison.php - - match: (?i)(!|&&|\|\|)|\b(and|or|xor|as)\b + - match: (?i)(!)|\b(and|or|xor|as)\b scope: keyword.operator.logical.php - include: function-call + - match: \.\.\. + scope: keyword.operator.spread.php - match: \. scope: keyword.operator.string.php - match: "=" @@ -305,7 +323,39 @@ contexts: - include: expressions class-builtin: - - match: (?i)(\\)?\b(st(dClass|reamWrapper)|R(RD(Graph|Creator|Updater)|untimeException|e(sourceBundle|cursive(RegexIterator|CachingIterator|TreeIterator|Iterator(Iterator)?|DirectoryIterator|FilterIterator|ArrayIterator)|flect(ion(Method|Class|Object|P(arameter|roperty)|Extension|Function(Abstract)?)?|or)|gexIterator)|angeException)|G(lobIterator|magick(Draw|Pixel)?)|X(ML(Reader|Writer)|SLTProcessor)|M(ongo(Regex|Grid(fsFile|FS(Cursor|File)?)|BinData|C(o(de|llection)|ursor)|Timestamp|I(nt(32|64)|d)|D(B(Ref)?|ate))?|ultipleIterator|e(ssageFormatter|mcache(d)?))|Bad(MethodCallException|FunctionCallException)|tidy(Node)?|S(impleXML(Iterator|Element)|oap(Server|Header|Client|Param|Var|Fault)|NMP|CA(_(SoapProxy|LocalProxy))?|p(hinxClient|l(M(inHeap|axHeap)|Bool|S(t(ack|ring)|ubject)|Heap|TempFileObject|Int|Ob(server|jectStorage)|DoublyLinkedList|PriorityQueue|Enum|Queue|F(i(le(Info|Object)|xedArray)|loat)))|e(ekableIterator|rializable)|DO_(Model_(ReflectionDataObject|Type|Property)|Sequence|D(ata(Object|Factory)|AS_(Relational|XML(_Document)?|Setting|ChangeSummary|Data(Object|Factory)))|Exception|List)|wish(Result(s)?|Search)?|VM(Model)?|QLite(Result|3(Result|Stmt)?|Database|Unbuffered)|AM(Message|Connection))|H(ttp(Re(sponse|quest(Pool)?)|Message|InflateStream|DeflateStream|QueryString)|aru(Image|Outline|D(oc|estination)|Page|Encoder|Font|Annotation))|N(o(RewindIterator|rmalizer)|umberFormatter)|C(o(untable|llator)|achingIterator)|T(okyoTyrant(Table|Query)?|ra(nsliterator|versable))|I(n(tlDateFormatter|validArgumentException|finiteIterator)|terator(Iterator|Aggregate)?|magick(Draw|Pixel(Iterator)?)?)|ZipArchive|O(CI-(Collection|Lob)|ut(erIterator|Of(RangeException|BoundsException))|verflowException)|D(irectoryIterator|om(XsltStylesheet|Node|Document(Type)?|ProcessingInstruction|Element|ainException|Attribute)|OM(XPath|N(ode(list)?|amedNodeMap)|C(haracterData|omment)|Text|Implementation|Document(Fragment)?|ProcessingInstruction|E(ntityReference|lement)|Attr)|ate(Time(Zone)?|Interval|Period))|Un(derflowException|expectedValueException)|finfo|P(har(Data|FileInfo)?|DO(Statement)?|arentIterator)|E(rrorException|xception|mptyIterator)|V8Js(Exception)?|KTaglib_(MPEG_(File|AudioProperties)|Tag|ID3v2_(Tag|Frame|AttachedPictureFrame))|Fil(terIterator|esystemIterator)|mysqli(_(stmt|driver|warning|result))?|L(imitIterator|o(cale|gicException)|engthException)|A(MQP(Connection|Exchange|Queue)|ppendIterator|PCIterator|rray(Iterator|Object|Access))|Json(Exception|Serializable))\b + - match: |- + (?xi)(\\)?\b( + AMQPConnection | AMQPExchange | AMQPQueue | APCIterator | AppendIterator | ArrayAccess | ArrayIterator | ArrayObject | + BadFunctionCallException | BadMethodCallException | CachingIterator | Collator | Countable | DOMAttr | DOMCharacterData | DOMComment | + DOMDocument | DOMDocumentFragment | DOMElement | DOMEntityReference | DOMImplementation | DOMNamedNodeMap | DOMNode | DOMNodelist | + DOMProcessingInstruction | DOMText | DOMXPath | DateInterval | DatePeriod | DateTime | DateTimeZone | DirectoryIterator | + DomAttribute | DomDocument | DomDocumentType | DomElement | DomNode | DomProcessingInstruction | DomXsltStylesheet | DomainException | + EmptyIterator | ErrorException | Exception | FilesystemIterator | FilterIterator | GlobIterator | Gmagick | GmagickDraw | + GmagickPixel | HaruAnnotation | HaruDestination | HaruDoc | HaruEncoder | HaruFont | HaruImage | HaruOutline | + HaruPage | HttpDeflateStream | HttpInflateStream | HttpMessage | HttpQueryString | HttpRequest | HttpRequestPool | HttpResponse | + Imagick | ImagickDraw | ImagickPixel | ImagickPixelIterator | InfiniteIterator | IntlDateFormatter | InvalidArgumentException | Iterator | + IteratorAggregate | IteratorIterator | JsonException | JsonSerializable | KTaglib_ID3v2_AttachedPictureFrame | KTaglib_ID3v2_Frame | KTaglib_ID3v2_Tag | KTaglib_MPEG_AudioProperties | + KTaglib_MPEG_File | KTaglib_Tag | LengthException | LimitIterator | Locale | LogicException | Memcache | Memcached | + MessageFormatter | Mongo | MongoBinData | MongoCode | MongoCollection | MongoCursor | MongoDB | MongoDBRef | + MongoDate | MongoGridFS | MongoGridFSCursor | MongoGridFSFile | MongoGridfsFile | MongoId | MongoInt32 | MongoInt64 | + MongoRegex | MongoTimestamp | MultipleIterator | NoRewindIterator | Normalizer | NumberFormatter | OCI-Collection | OCI-Lob | + OutOfBoundsException | OutOfRangeException | OuterIterator | OverflowException | PDO | PDOStatement | ParentIterator | Phar | + PharData | PharFileInfo | RRDCreator | RRDGraph | RRDUpdater | RangeException | RecursiveArrayIterator | RecursiveCachingIterator | + RecursiveDirectoryIterator | RecursiveFilterIterator | RecursiveIterator | RecursiveIteratorIterator | RecursiveRegexIterator | RecursiveTreeIterator | Reflection | ReflectionClass | + ReflectionExtension | ReflectionFunction | ReflectionFunctionAbstract | ReflectionMethod | ReflectionObject | ReflectionParameter | ReflectionProperty | Reflector | + RegexIterator | ResourceBundle | RuntimeException | SAMConnection | SAMMessage | SCA | SCA_LocalProxy | SCA_SoapProxy | + SDO_DAS_ChangeSummary | SDO_DAS_DataFactory | SDO_DAS_DataObject | SDO_DAS_Relational | SDO_DAS_Setting | SDO_DAS_XML | SDO_DAS_XML_Document | SDO_DataFactory | + SDO_DataObject | SDO_Exception | SDO_List | SDO_Model_Property | SDO_Model_ReflectionDataObject | SDO_Model_Type | SDO_Sequence | SNMP | + SQLite3 | SQLite3Result | SQLite3Stmt | SQLiteDatabase | SQLiteResult | SQLiteUnbuffered | SVM | SVMModel | + SeekableIterator | Serializable | SimpleXMLElement | SimpleXMLIterator | SoapClient | SoapFault | SoapHeader | SoapParam | + SoapServer | SoapVar | SphinxClient | SplBool | SplDoublyLinkedList | SplEnum | SplFileInfo | SplFileObject | + SplFixedArray | SplFloat | SplHeap | SplInt | SplMaxHeap | SplMinHeap | SplObjectStorage | SplObserver | + SplPriorityQueue | SplQueue | SplStack | SplString | SplSubject | SplTempFileObject | Swish | SwishResult | + SwishResults | SwishSearch | TokyoTyrant | TokyoTyrantQuery | TokyoTyrantTable | Transliterator | Traversable | UnderflowException | + UnexpectedValueException | V8Js | V8JsException | XMLReader | XMLWriter | XSLTProcessor | ZipArchive | finfo | + mysqli | mysqli_driver | mysqli_result | mysqli_stmt | mysqli_warning | stdClass | streamWrapper | tidy | + tidyNode + )\b captures: 1: punctuation.separator.namespace.php 2: support.class.builtin.php @@ -541,14 +591,29 @@ contexts: pop: true - match: ',' scope: punctuation.separator.php + # https://wiki.php.net/rfc/typed_properties_v2 + - match: (?=\b(?:var|public|private|protected|static)\b) + push: + - match: (?=\b(?:const|function)\b) + pop: true + - match: \b(?:var|public|private|protected|static)\b + scope: storage.modifier.php + - match: '(?:(\?)\s*)?({{identifier}})' + captures: + 1: storage.type.nullable.php + 2: support.class.php + pop: true + # Exit on unexpected content + - match: (?=\S) + pop: true - include: statements function: - - match: (?i)(?=(?:\b(?:final|abstract|public|private|protected|static)\s+)*\bfunction\b\s*(&\s*)?{{identifier_start}}) + - match: (?i)(?=(?:\b(?:final|abstract|var|public|private|protected|static)\s+)*\bfunction\b\s*(&\s*)?{{identifier_start}}) push: - meta_content_scope: meta.function.php - include: comments - - match: '(?i)\b(final|abstract|public|private|protected|static)\b' + - match: '(?i)\b(final|abstract|var|public|private|protected|static)\b' scope: storage.modifier.php - match: (?i)\bfunction\b scope: storage.type.function.php @@ -568,6 +633,43 @@ contexts: - match: (?=\S) pop: true + # https://wiki.php.net/rfc/arrow_functions_v2 + arrow-function: + # "fn" can be a function name before PHP 7.4 + # Since PHP 7.4, "fn" is a reserved word + - match: (?i)(?=\bfn\b\s*&?\s*\() + branch_point: arrow-function-branch + branch: + # Anonymous function definition: fn($a) => $a * 2; + - is-arrow-function + # Function call, where "fn" is the function name: fn($a); + - fn-function-call + + is-arrow-function: + - match: (?i)\b(fn)\b\s*(&)?\s*(?=\() + scope: meta.function.arrow-function.php + captures: + 1: storage.type.function.php + 2: storage.modifier.reference.php + push: + - match: \( + scope: meta.function.parameters.php meta.group.php punctuation.section.group.begin.php + push: function-parameters + - match: '=>' + scope: punctuation.definition.arrow-function.php + set: + - match: '(?=;|,|\)|\s*\?>)' + pop: 2 + - include: expressions + - include: comments + - match: (?=\S) + fail: arrow-function-branch + + fn-function-call: + - include: function-call + - match: '' + pop: true + closure: - match: (?i)\b(function)\s*(&)?\s*(?=\() scope: meta.function.closure.php @@ -605,6 +707,8 @@ contexts: # Class name type hint - match: '{{identifier}}' scope: meta.path.php support.class.php + - match: '\.\.\.' + scope: keyword.operator.spread.php - match: '\?' scope: storage.type.nullable.php - match: '&' @@ -623,28 +727,28 @@ contexts: - include: expressions function-use: - - meta_content_scope: meta.function.closure.use.php - - include: comments - - match: '\)' - scope: punctuation.section.group.end.php - set: - - meta_content_scope: meta.function.php - - match: '(?=:)' - set: function-return-type - - match: \{ - scope: meta.block.php punctuation.section.block.begin.php - set: function-body - # Exit on unexpected content - - match: (?=\S) - pop: true - - match: '&' - scope: storage.modifier.reference.php - - match: '(\$+){{identifier}}' - scope: variable.parameter.php - captures: - 1: punctuation.definition.variable.php - - match: ',' - scope: punctuation.separator.php + - meta_content_scope: meta.function.closure.use.php + - include: comments + - match: '\)' + scope: punctuation.section.group.end.php + set: + - meta_content_scope: meta.function.php + - match: '(?=:)' + set: function-return-type + - match: \{ + scope: meta.block.php punctuation.section.block.begin.php + set: function-body + # Exit on unexpected content + - match: (?=\S) + pop: true + - match: '&' + scope: storage.modifier.reference.php + - match: '(\$+){{identifier}}' + scope: variable.parameter.php + captures: + 1: punctuation.definition.variable.php + - match: ',' + scope: punctuation.separator.php function-return-type: - meta_content_scope: meta.function.return-type.php @@ -698,14 +802,19 @@ contexts: # This only highlights a docblock if the first line contains only /** or # /**#@+ (which is used for docblock templates). Otherwise block-level # comment would be highlighted as invalid for constructs such as /**** ****/ - - match: /\*\*(?:#@\+)?\s*$ + - match: |- + (?x)/\*\*(?: + (?:\#@\+)?\s*$ (?# multi-line doc ) + | + (?=\s+@.*\s\*/\s*$) (?# inline doc ) + ) scope: punctuation.definition.comment.begin.php push: - meta_scope: comment.block.documentation.phpdoc.php - match: \*/ scope: punctuation.definition.comment.end.php pop: true - - include: php_doc + - include: php-doc - match: /\* scope: punctuation.definition.comment.begin.php push: @@ -732,7 +841,11 @@ contexts: - match: \n pop: true constants: - - match: (?i)\b(TRUE|FALSE|NULL|__(FILE|DIR|FUNCTION|CLASS|METHOD|LINE|NAMESPACE)__|ON|OFF|YES|NO|NL|BR|TAB)\b + - match: |- + \b(?xi: + TRUE | FALSE | NULL | + __CLASS__ | __DIR__ | __FILE__ | __FUNCTION__ | __LINE__ | __METHOD__ | __NAMESPACE__ + )\b scope: constant.language.php - match: (?=\\?{{identifier}}\\{{path}}) push: @@ -747,19 +860,185 @@ contexts: push: - match: '(?=[^\\_[:alnum:]])' pop: true - - match: (\\)?\b(STD(IN|OUT|ERR)|ZEND_(THREAD_SAFE|DEBUG_BUILD)|DEFAULT_INCLUDE_PATH|P(HP_(R(OUND_HALF_(ODD|DOWN|UP|EVEN)|ELEASE_VERSION)|M(INOR_VERSION|A(XPATHLEN|JOR_VERSION))|BINDIR|S(HLIB_SUFFIX|YSCONFDIR|API)|CONFIG_FILE_(SCAN_DIR|PATH)|INT_(MIN|MAX|SIZE)|FLOAT_(DIG|EPSILON|MAX|MIN)|ZTS|O(S(_FAMILY)?|UTPUT_HANDLER_(START|CONT|END))|D(EBUG|ATADIR)|URL_(SCHEME|HOST|USER|P(ORT|A(SS|TH))|QUERY|FRAGMENT)|PREFIX|E(XT(RA_VERSION|ENSION_DIR)|OL)|VERSION(_ID)?|WINDOWS_(NT_(SERVER|DOMAIN_CONTROLLER|WORKSTATION)|VERSION_(M(INOR|AJOR)|BUILD|S(UITEMASK|P_M(INOR|AJOR))|P(RODUCTTYPE|LATFORM)))|L(IBDIR|OCALSTATEDIR)|FD_SETSIZE)|EAR_(INSTALL_DIR|EXTENSION_DIR))|E_(RECOVERABLE_ERROR|STRICT|NOTICE|CO(RE_(ERROR|WARNING)|MPILE_(ERROR|WARNING))|DEPRECATED|USER_(NOTICE|DEPRECATED|ERROR|WARNING)|PARSE|ERROR|WARNING|ALL)|MT_RAND_PHP)\b + - match: |- + (\\)?\b(?x: + DEFAULT_INCLUDE_PATH | E_ALL | E_COMPILE_ERROR | E_COMPILE_WARNING | E_CORE_ERROR | E_CORE_WARNING | E_DEPRECATED | E_ERROR | + E_NOTICE | E_PARSE | E_RECOVERABLE_ERROR | E_STRICT | E_USER_DEPRECATED | E_USER_ERROR | E_USER_NOTICE | E_USER_WARNING | + E_WARNING | MT_RAND_PHP | PEAR_EXTENSION_DIR | PEAR_INSTALL_DIR | PHP_BINDIR | PHP_CONFIG_FILE_PATH | PHP_CONFIG_FILE_SCAN_DIR | PHP_DATADIR | + PHP_DEBUG | PHP_EOL | PHP_EXTENSION_DIR | PHP_EXTRA_VERSION | PHP_FD_SETSIZE | PHP_FLOAT_DIG | PHP_FLOAT_EPSILON | PHP_FLOAT_MAX | + PHP_FLOAT_MIN | PHP_INT_MAX | PHP_INT_MIN | PHP_INT_SIZE | PHP_LIBDIR | PHP_LOCALSTATEDIR | PHP_MAJOR_VERSION | PHP_MAXPATHLEN | + PHP_MINOR_VERSION | PHP_OS | PHP_OS_FAMILY | PHP_OUTPUT_HANDLER_CONT | PHP_OUTPUT_HANDLER_END | PHP_OUTPUT_HANDLER_START | PHP_PREFIX | PHP_RELEASE_VERSION | + PHP_ROUND_HALF_DOWN | PHP_ROUND_HALF_EVEN | PHP_ROUND_HALF_ODD | PHP_ROUND_HALF_UP | PHP_SAPI | PHP_SHLIB_SUFFIX | PHP_SYSCONFDIR | PHP_URL_FRAGMENT | + PHP_URL_HOST | PHP_URL_PASS | PHP_URL_PATH | PHP_URL_PORT | PHP_URL_QUERY | PHP_URL_SCHEME | PHP_URL_USER | PHP_VERSION | + PHP_VERSION_ID | PHP_WINDOWS_NT_DOMAIN_CONTROLLER | PHP_WINDOWS_NT_SERVER | PHP_WINDOWS_NT_WORKSTATION | PHP_WINDOWS_VERSION_BUILD | PHP_WINDOWS_VERSION_MAJOR | PHP_WINDOWS_VERSION_MINOR | PHP_WINDOWS_VERSION_PLATFORM | + PHP_WINDOWS_VERSION_PRODUCTTYPE | PHP_WINDOWS_VERSION_SP_MAJOR | PHP_WINDOWS_VERSION_SP_MINOR | PHP_WINDOWS_VERSION_SUITEMASK | PHP_ZTS | STDERR | STDIN | STDOUT | + ZEND_DEBUG_BUILD | ZEND_THREAD_SAFE + )\b scope: support.constant.core.php captures: 1: punctuation.separator.namespace.php - - match: (\\)?\b(RADIXCHAR|GROUPING|M(_(1_PI|SQRT(1_2|2|3|PI)|2_(SQRTPI|PI)|PI(_(2|4))?|E(ULER)?|L(N(10|2|PI)|OG(10E|2E)))|ON_(GROUPING|1(1|2|0)?|7|2|8|THOUSANDS_SEP|3|DECIMAL_POINT|9|4|5|6))|S(TR_PAD_(RIGHT|BOTH|LEFT)|ORT_(REGULAR|STRING|NUMERIC|DESC|LOCALE_STRING|ASC)|EEK_(SET|CUR|END))|H(TML_(SPECIALCHARS|ENTITIES)|ASH_HMAC)|YES(STR|EXPR)|N(_(S(IGN_POSN|EP_BY_SPACE)|CS_PRECEDES)|O(STR|EXPR)|EGATIVE_SIGN|AN)|C(R(YPT_(MD5|BLOWFISH|S(HA(256|512)|TD_DES|ALT_LENGTH)|EXT_DES)|NCYSTR|EDITS_(G(ROUP|ENERAL)|MODULES|SAPI|DOCS|QA|FULLPAGE|ALL))|HAR_MAX|O(NNECTION_(NORMAL|TIMEOUT|ABORTED)|DESET|UNT_(RECURSIVE|NORMAL))|URRENCY_SYMBOL|ASE_(UPPER|LOWER))|__COMPILER_HALT_OFFSET__|T(HOUS(EP|ANDS_SEP)|_FMT(_AMPM)?)|IN(T_(CURR_SYMBOL|FRAC_DIGITS)|I_(S(YSTEM|CANNER_(RAW|NORMAL))|USER|PERDIR|ALL)|F(O_(GENERAL|MODULES|C(REDITS|ONFIGURATION)|ENVIRONMENT|VARIABLES|LICENSE|ALL))?)|D(_(T_FMT|FMT)|IRECTORY_SEPARATOR|ECIMAL_POINT|A(Y_(1|7|2|3|4|5|6)|TE_(R(SS|FC(1(123|036)|2822|8(22|50)|3339))|COOKIE|ISO8601|W3C|ATOM)))|UPLOAD_ERR_(NO_(TMP_DIR|FILE)|CANT_WRITE|INI_SIZE|OK|PARTIAL|EXTENSION|FORM_SIZE)|P(M_STR|_(S(IGN_POSN|EP_BY_SPACE)|CS_PRECEDES)|OSITIVE_SIGN|ATH(_SEPARATOR|INFO_(BASENAME|DIRNAME|EXTENSION|FILENAME)))|E(RA(_(YEAR|T_FMT|D_(T_FMT|FMT)))?|XTR_(REFS|SKIP|IF_EXISTS|OVERWRITE|PREFIX_(SAME|I(NVALID|F_EXISTS)|ALL))|NT_(NOQUOTES|COMPAT|IGNORE|QUOTES))|FRAC_DIGITS|L(C_(M(ONETARY|ESSAGES)|NUMERIC|C(TYPE|OLLATE)|TIME|ALL)|O(G_(MAIL|SYSLOG|N(O(TICE|WAIT)|DELAY|EWS)|C(R(IT|ON)|ONS)|INFO|ODELAY|D(EBUG|AEMON)|U(SER|UCP)|P(ID|ERROR)|E(RR|MERG)|KERN|WARNING|L(OCAL(1|7|2|3|4|5|0|6)|PR)|A(UTH(PRIV)?|LERT))|CK_(SH|NB|UN|EX)))|A(M_STR|B(MON_(1(1|2|0)?|7|2|8|3|9|4|5|6)|DAY_(1|7|2|3|4|5|6))|SSERT_(BAIL|CALLBACK|QUIET_EVAL|WARNING|ACTIVE)|LT_DIGITS))\b + - match: |- + (\\)?\b(?x: + ABDAY_[1-7] | ABMON_(?:[1-9]|1[0-2]) | ALT_DIGITS | AM_STR | ASSERT_ACTIVE | ASSERT_BAIL | ASSERT_CALLBACK | + ASSERT_QUIET_EVAL | ASSERT_WARNING | CASE_LOWER | CASE_UPPER | CHAR_MAX | CODESET | CONNECTION_ABORTED | CONNECTION_NORMAL | + CONNECTION_TIMEOUT | COUNT_NORMAL | COUNT_RECURSIVE | CREDITS_ALL | CREDITS_DOCS | CREDITS_FULLPAGE | CREDITS_GENERAL | CREDITS_GROUP | + CREDITS_MODULES | CREDITS_QA | CREDITS_SAPI | CRNCYSTR | CRYPT_BLOWFISH | CRYPT_EXT_DES | CRYPT_MD5 | CRYPT_SALT_LENGTH | + CRYPT_SHA256 | CRYPT_SHA512 | CRYPT_STD_DES | CURRENCY_SYMBOL | DATE_ATOM | DATE_COOKIE | DATE_ISO8601 | DATE_RFC1036 | + DATE_RFC1123 | DATE_RFC2822 | DATE_RFC3339 | DATE_RFC822 | DATE_RFC850 | DATE_RSS | DATE_W3C | DAY_([1-7]) | DECIMAL_POINT | DIRECTORY_SEPARATOR | + D_FMT | D_T_FMT | ENT_COMPAT | ENT_IGNORE | ENT_NOQUOTES | ENT_QUOTES | ERA | ERA_D_FMT | + ERA_D_T_FMT | ERA_T_FMT | ERA_YEAR | EXTR_IF_EXISTS | EXTR_OVERWRITE | EXTR_PREFIX_ALL | EXTR_PREFIX_IF_EXISTS | EXTR_PREFIX_INVALID | + EXTR_PREFIX_SAME | EXTR_REFS | EXTR_SKIP | FRAC_DIGITS | GROUPING | HASH_HMAC | HTML_ENTITIES | HTML_SPECIALCHARS | + INF | INFO_ALL | INFO_CONFIGURATION | INFO_CREDITS | INFO_ENVIRONMENT | INFO_GENERAL | INFO_LICENSE | INFO_MODULES | + INFO_VARIABLES | INI_ALL | INI_PERDIR | INI_SCANNER_NORMAL | INI_SCANNER_RAW | INI_SYSTEM | INI_USER | INT_CURR_SYMBOL | + INT_FRAC_DIGITS | LC_ALL | LC_COLLATE | LC_CTYPE | LC_MESSAGES | LC_MONETARY | LC_NUMERIC | LC_TIME | + LOCK_EX | LOCK_NB | LOCK_SH | LOCK_UN | LOG_ALERT | LOG_AUTH | LOG_AUTHPRIV | LOG_CONS | + LOG_CRIT | LOG_CRON | LOG_DAEMON | LOG_DEBUG | LOG_EMERG | LOG_ERR | LOG_INFO | LOG_KERN | + LOG_LOCAL0 | LOG_LOCAL1 | LOG_LOCAL2 | LOG_LOCAL3 | LOG_LOCAL4 | LOG_LOCAL5 | LOG_LOCAL6 | LOG_LOCAL7 | + LOG_LPR | LOG_MAIL | LOG_NDELAY | LOG_NEWS | LOG_NOTICE | LOG_NOWAIT | LOG_ODELAY | LOG_PERROR | + LOG_PID | LOG_SYSLOG | LOG_USER | LOG_UUCP | LOG_WARNING | MON_(?:[1-9]|1[0-2]) | MON_DECIMAL_POINT | MON_GROUPING | MON_THOUSANDS_SEP | M_1_PI | M_2_PI | M_2_SQRTPI | M_E | + M_EULER | M_LN10 | M_LN2 | M_LNPI | M_LOG10E | M_LOG2E | M_PI | M_PI_2 | + M_PI_4 | M_SQRT1_2 | M_SQRT2 | M_SQRT3 | M_SQRTPI | NAN | NEGATIVE_SIGN | NOEXPR | + NOSTR | N_CS_PRECEDES | N_SEP_BY_SPACE | N_SIGN_POSN | PATHINFO_BASENAME | PATHINFO_DIRNAME | PATHINFO_EXTENSION | PATHINFO_FILENAME | + PATH_SEPARATOR | PM_STR | POSITIVE_SIGN | P_CS_PRECEDES | P_SEP_BY_SPACE | P_SIGN_POSN | RADIXCHAR | SEEK_CUR | + SEEK_END | SEEK_SET | SORT_ASC | SORT_DESC | SORT_LOCALE_STRING | SORT_NUMERIC | SORT_REGULAR | SORT_STRING | + STR_PAD_BOTH | STR_PAD_LEFT | STR_PAD_RIGHT | THOUSANDS_SEP | THOUSEP | T_FMT | T_FMT_AMPM | UPLOAD_ERR_CANT_WRITE | + UPLOAD_ERR_EXTENSION | UPLOAD_ERR_FORM_SIZE | UPLOAD_ERR_INI_SIZE | UPLOAD_ERR_NO_FILE | UPLOAD_ERR_NO_TMP_DIR | UPLOAD_ERR_OK | UPLOAD_ERR_PARTIAL | YESEXPR | + YESSTR | __COMPILER_HALT_OFFSET__ + )\b scope: support.constant.std.php captures: 1: punctuation.separator.namespace.php - - match: (\\)?\b(GLOB_(MARK|BRACE|NO(SORT|CHECK|ESCAPE)|ONLYDIR|ERR|AVAILABLE_FLAGS)|XML_(SAX_IMPL|HTML_DOCUMENT_NODE|N(OTATION_NODE|AMESPACE_DECL_NODE)|C(OMMENT_NODE|DATA_SECTION_NODE)|TEXT_NODE|OPTION_(SKIP_(TAGSTART|WHITE)|CASE_FOLDING|TARGET_ENCODING)|D(TD_NODE|OCUMENT_(NODE|TYPE_NODE|FRAG_NODE))|PI_NODE|E(RROR_(RECURSIVE_ENTITY_REF|MISPLACED_XML_PI|B(INARY_ENTITY_REF|AD_CHAR_REF)|SYNTAX|NO(NE|_(MEMORY|ELEMENTS))|TAG_MISMATCH|IN(CORRECT_ENCODING|VALID_TOKEN)|DUPLICATE_ATTRIBUTE|UN(CLOSED_(CDATA_SECTION|TOKEN)|DEFINED_ENTITY|KNOWN_ENCODING)|JUNK_AFTER_DOC_ELEMENT|PAR(TIAL_CHAR|AM_ENTITY_REF)|EXTERNAL_ENTITY_HANDLING|A(SYNC_ENTITY|TTRIBUTE_EXTERNAL_ENTITY_REF))|NTITY_(REF_NODE|NODE|DECL_NODE)|LEMENT_(NODE|DECL_NODE))|LOCAL_NAMESPACE|ATTRIBUTE_(N(MTOKEN(S)?|O(TATION|DE))|CDATA|ID(REF(S)?)?|DECL_NODE|EN(TITY|UMERATION)))|M(HASH_(RIPEMD(1(28|60)|256|320)|GOST|MD(2|4|5)|S(HA(1|2(24|56)|384|512)|NEFRU256)|HAVAL(1(28|92|60)|2(24|56))|CRC32(B)?|TIGER(1(28|60))?|WHIRLPOOL|ADLER32)|YSQL(_(BOTH|NUM|CLIENT_(SSL|COMPRESS|I(GNORE_SPACE|NTERACTIVE))|ASSOC)|I_(RE(PORT_(STRICT|INDEX|OFF|ERROR|ALL)|FRESH_(GRANT|MASTER|BACKUP_LOG|S(TATUS|LAVE)|HOSTS|T(HREADS|ABLES)|LOG)|AD_DEFAULT_(GROUP|FILE))|GROUP_FLAG|MULTIPLE_KEY_FLAG|B(INARY_FLAG|OTH|LOB_FLAG)|S(T(MT_ATTR_(CURSOR_TYPE|UPDATE_MAX_LENGTH|PREFETCH_ROWS)|ORE_RESULT)|E(RVER_QUERY_(NO_(GOOD_INDEX_USED|INDEX_USED)|WAS_SLOW)|T_(CHARSET_NAME|FLAG)))|N(O(_D(EFAULT_VALUE_FLAG|ATA)|T_NULL_FLAG)|UM(_FLAG)?)|C(URSOR_TYPE_(READ_ONLY|SCROLLABLE|NO_CURSOR|FOR_UPDATE)|LIENT_(SSL|NO_SCHEMA|COMPRESS|I(GNORE_SPACE|NTERACTIVE)|FOUND_ROWS))|T(YPE_(GEOMETRY|MEDIUM_BLOB|B(IT|LOB)|S(HORT|TRING|ET)|YEAR|N(ULL|EWD(ECIMAL|ATE))|CHAR|TI(ME(STAMP)?|NY(_BLOB)?)|INT(24|ERVAL)|D(OUBLE|ECIMAL|ATE(TIME)?)|ENUM|VAR_STRING|FLOAT|LONG(_BLOB|LONG)?)|IMESTAMP_FLAG)|INIT_COMMAND|ZEROFILL_FLAG|O(N_UPDATE_NOW_FLAG|PT_(NET_(READ_BUFFER_SIZE|CMD_BUFFER_SIZE)|CONNECT_TIMEOUT|INT_AND_FLOAT_NATIVE|LOCAL_INFILE))|D(EBUG_TRACE_ENABLED|ATA_TRUNCATED)|U(SE_RESULT|N(SIGNED_FLAG|IQUE_KEY_FLAG))|P(RI_KEY_FLAG|ART_KEY_FLAG)|ENUM_FLAG|A(S(SOC|YNC)|UTO_INCREMENT_FLAG)))|CRYPT_(R(C(2|6)|IJNDAEL_(1(28|92)|256)|AND)|GOST|XTEA|M(ODE_(STREAM|NOFB|C(BC|FB)|OFB|ECB)|ARS)|BLOWFISH(_COMPAT)?|S(ERPENT|KIPJACK|AFER(128|PLUS|64))|C(RYPT|AST_(128|256))|T(RIPLEDES|HREEWAY|WOFISH)|IDEA|3DES|DE(S|CRYPT|V_(RANDOM|URANDOM))|PANAMA|EN(CRYPT|IGNA)|WAKE|LOKI97|ARCFOUR(_IV)?))|S(TREAM_(REPORT_ERRORS|M(UST_SEEK|KDIR_RECURSIVE)|BUFFER_(NONE|FULL|LINE)|S(HUT_(RD(WR)?|WR)|OCK_(R(DM|AW)|S(TREAM|EQPACKET)|DGRAM)|ERVER_(BIND|LISTEN))|NOTIFY_(RE(SOLVE|DIRECTED)|MIME_TYPE_IS|SEVERITY_(INFO|ERR|WARN)|CO(MPLETED|NNECT)|PROGRESS|F(ILE_SIZE_IS|AILURE)|AUTH_RE(SULT|QUIRED))|C(RYPTO_METHOD_(SSLv(2(_(SERVER|CLIENT)|3_(SERVER|CLIENT))|3_(SERVER|CLIENT))|TLS_(SERVER|CLIENT))|LIENT_(CONNECT|PERSISTENT|ASYNC_CONNECT)|AST_(FOR_SELECT|AS_STREAM))|I(GNORE_URL|S_URL|PPROTO_(RAW|TCP|I(CMP|P)|UDP))|O(OB|PTION_(READ_(BUFFER|TIMEOUT)|BLOCKING|WRITE_BUFFER))|U(RL_STAT_(QUIET|LINK)|SE_PATH)|P(EEK|F_(INET(6)?|UNIX))|ENFORCE_SAFE_MODE|FILTER_(READ|WRITE|ALL))|UNFUNCS_RET_(STRING|TIMESTAMP|DOUBLE)|QLITE(_(R(OW|EADONLY)|MIS(MATCH|USE)|B(OTH|USY)|SCHEMA|N(O(MEM|T(FOUND|ADB)|LFS)|UM)|C(O(RRUPT|NSTRAINT)|ANTOPEN)|TOOBIG|I(NTER(RUPT|NAL)|OERR)|OK|DONE|P(ROTOCOL|ERM)|E(RROR|MPTY)|F(ORMAT|ULL)|LOCKED|A(BORT|SSOC|UTH))|3_(B(OTH|LOB)|NU(M|LL)|TEXT|INTEGER|OPEN_(READ(ONLY|WRITE)|CREATE)|FLOAT|ASSOC)))|CURL(M(SG_DONE|_(BAD_(HANDLE|EASY_HANDLE)|CALL_MULTI_PERFORM|INTERNAL_ERROR|O(UT_OF_MEMORY|K))|OPT_PUSHFUNCTION)|SSH_AUTH_(HOST|NONE|DEFAULT|P(UBLICKEY|ASSWORD)|KEYBOARD)|CLOSEPOLICY_(SLOWEST|CALLBACK|OLDEST|LEAST_(RECENTLY_USED|TRAFFIC))|_(HTTP_VERSION_(1_(1|0)|NONE)|NETRC_(REQUIRED|IGNORED|OPTIONAL)|TIMECOND_(IF(MODSINCE|UNMODSINCE)|LASTMOD)|IPRESOLVE_(V(4|6)|WHATEVER)|VERSION_(SSL|IPV6|KERBEROS4|LIBZ)|PUSH_(OK|DENY))|INFO_(RE(DIRECT_(COUNT|TIME)|QUEST_SIZE)|S(SL_VERIFYRESULT|TARTTRANSFER_TIME|IZE_(DOWNLOAD|UPLOAD)|PEED_(DOWNLOAD|UPLOAD))|H(TTP_CODE|EADER_(SIZE|OUT))|NAMELOOKUP_TIME|C(ON(NECT_TIME|TENT_(TYPE|LENGTH_(DOWNLOAD|UPLOAD)))|ERTINFO)|TOTAL_TIME|PR(IVATE|ETRANSFER_TIME)|EFFECTIVE_URL|FILETIME)|OPT_(R(E(SUME_FROM|TURNTRANSFER|DIR_PROTOCOLS|FERER|AD(DATA|FUNCTION))|AN(GE|DOM_FILE))|MAX(REDIRS|CONNECTS)|B(INARYTRANSFER|UFFERSIZE)|S(S(H_(HOST_PUBLIC_KEY_MD5|P(RIVATE_KEYFILE|UBLIC_KEYFILE)|AUTH_TYPES)|L(CERT(TYPE|PASSWD)?|_(CIPHER_LIST|VERIFY(HOST|PEER))|ENGINE(_DEFAULT)?|VERSION|KEY(TYPE|PASSWD)?))|TDERR)|H(TTP(GET|HEADER|200ALIASES|_VERSION|PROXYTUNNEL|AUTH)|EADER(FUNCTION)?)|N(O(BODY|SIGNAL|PROGRESS)|ETRC)|C(RLF|O(NNECTTIMEOUT(_MS)?|OKIE(SESSION|JAR|FILE)?)|USTOMREQUEST|ERTINFO|LOSEPOLICY|A(INFO|PATH))|T(RANSFERTEXT|CP_NODELAY|IME(CONDITION|OUT(_MS)?|VALUE))|I(N(TERFACE|FILE(SIZE)?)|PRESOLVE)|DNS_(CACHE_TIMEOUT|USE_GLOBAL_CACHE)|U(RL|SER(PWD|AGENT)|NRESTRICTED_AUTH|PLOAD)|P(R(IVATE|O(GRESSFUNCTION|XY(TYPE|USERPWD|PORT|AUTH)?|TOCOLS))|O(RT|ST(REDIR|QUOTE|FIELDS)?)|UT)|E(GDSOCKET|NCODING)|VERBOSE|K(RB4LEVEL|EYPASSWD)|QUOTE|F(RESH_CONNECT|TP(SSLAUTH|_(S(SL|KIP_PASV_IP)|CREATE_MISSING_DIRS|USE_EP(RT|SV)|FILEMETHOD)|PORT|LISTONLY|APPEND)|ILE(TIME)?|O(RBID_REUSE|LLOWLOCATION)|AILONERROR)|WRITE(HEADER|FUNCTION)|LOW_SPEED_(TIME|LIMIT)|AUTOREFERER)|PRO(XY_(SOCKS(4|5)|HTTP)|TO_(S(CP|FTP)|HTTP(S)?|T(ELNET|FTP)|DICT|F(TP(S)?|ILE)|LDAP(S)?|ALL))|E_(RE(CV_ERROR|AD_ERROR)|GOT_NOTHING|MALFORMAT_USER|BAD_(C(ONTENT_ENCODING|ALLING_ORDER)|PASSWORD_ENTERED|FUNCTION_ARGUMENT)|S(S(H|L_(C(IPHER|ONNECT_ERROR|ERTPROBLEM|ACERT)|PEER_CERTIFICATE|ENGINE_(SETFAILED|NOTFOUND)))|HARE_IN_USE|END_ERROR)|HTTP_(RANGE_ERROR|NOT_FOUND|PO(RT_FAILED|ST_ERROR))|COULDNT_(RESOLVE_(HOST|PROXY)|CONNECT)|T(OO_MANY_REDIRECTS|ELNET_OPTION_SYNTAX)|O(BSOLETE|UT_OF_MEMORY|PERATION_TIMEOUTED|K)|U(RL_MALFORMAT(_USER)?|N(SUPPORTED_PROTOCOL|KNOWN_TELNET_OPTION))|PARTIAL_FILE|F(TP_(BAD_DOWNLOAD_RESUME|SSL_FAILED|C(OULDNT_(RETR_FILE|GET_SIZE|S(TOR_FILE|ET_(BINARY|ASCII))|USE_REST)|ANT_(RECONNECT|GET_HOST))|USER_PASSWORD_INCORRECT|PORT_FAILED|QUOTE_ERROR|W(RITE_ERROR|EIRD_(SERVER_REPLY|227_FORMAT|USER_REPLY|PAS(S_REPLY|V_REPLY)))|ACCESS_DENIED)|ILE(SIZE_EXCEEDED|_COULDNT_READ_FILE)|UNCTION_NOT_FOUND|AILED_INIT)|WRITE_ERROR|L(IBRARY_NOT_FOUND|DAP_(SEARCH_FAILED|CANNOT_BIND|INVALID_URL))|ABORTED_BY_CALLBACK)|VERSION_NOW|FTP(METHOD_(MULTICWD|SINGLECWD|NOCWD)|SSL_(NONE|CONTROL|TRY|ALL)|AUTH_(SSL|TLS|DEFAULT))|AUTH_(GSSNEGOTIATE|BASIC|NTLM|DIGEST|ANY(SAFE)?))|I(MAGETYPE_(GIF|XBM|BMP|SW(C|F)|COUNT|TIFF_(MM|II)|I(CO|FF)|UNKNOWN|J(B2|P(X|2|C|EG(2000)?))|P(SD|NG)|WBMP|WEBP)|NPUT_(REQUEST|GET|SE(RVER|SSION)|COOKIE|POST|ENV)|CONV_(MIME_DECODE_(STRICT|CONTINUE_ON_ERROR)|IMPL|VERSION))|D(NS_(MX|S(RV|OA)|HINFO|N(S|APTR)|CNAME|TXT|PTR|A(NY|LL|AAA|6)?)|OM(STRING_SIZE_ERR|_(SYNTAX_ERR|HIERARCHY_REQUEST_ERR|N(O(_(MODIFICATION_ALLOWED_ERR|DATA_ALLOWED_ERR)|T_(SUPPORTED_ERR|FOUND_ERR))|AMESPACE_ERR)|IN(DEX_SIZE_ERR|USE_ATTRIBUTE_ERR|VALID_(MODIFICATION_ERR|STATE_ERR|CHARACTER_ERR|ACCESS_ERR))|PHP_ERR|VALIDATION_ERR|WRONG_DOCUMENT_ERR)))|JSON_(BIGINT_AS_STRING|HEX_(TAG|QUOT|A(MP|POS))|NUMERIC_CHECK|ERROR_(S(YNTAX|TATE_MISMATCH)|NONE|CTRL_CHAR|DEPTH|RECURSION|INF_OR_NAN|UNSUPPORTED_TYPE|INVALID_PROPERTY_NAME|UTF(8|16))|FORCE_OBJECT|UNESCAPED_(LINE_TERMINATORS|SLASHES|UNICODE)|OBJECT_AS_ARRAY|PARTIAL_OUTPUT_ON_ERROR|PRESERVE_ZERO_FRACTION|PRETTY_PRINT|INVALID_UTF8_(IGNORE|SUBSTITUTE)|THROW_ON_ERROR)|P(REG_(RECURSION_LIMIT_ERROR|GREP_INVERT|BA(CKTRACK_LIMIT_ERROR|D_UTF8_(OFFSET_ERROR|ERROR))|S(PLIT_(NO_EMPTY|OFFSET_CAPTURE|DELIM_CAPTURE)|ET_ORDER)|NO_ERROR|INTERNAL_ERROR|JIT_STACKLIMIT_ERROR|OFFSET_CAPTURE|PATTERN_ORDER|UNMATCHED_AS_NULL)|SFS_(PASS_ON|ERR_FATAL|F(EED_ME|LAG_(NORMAL|FLUSH_(CLOSE|INC))))|CRE_VERSION|OSIX_(R_OK|X_OK|S_IF(REG|BLK|SOCK|CHR|IFO)|F_OK|W_OK|RLIMIT_(AS|C(ORE|PU)|DATA|FSIZE|LOCKS|M(EMLOCK|SGQUEUE)|N(ICE|OFILE|PROC)|R(SS|T(PRIO|TIME))|S(IGPENDING|TACK)|INFINITY)))|F(NM_(NOESCAPE|CASEFOLD|P(ERIOD|ATHNAME))|IL(TER_(REQUIRE_(SCALAR|ARRAY)|SANITIZE_(MAGIC_QUOTES|S(TRI(NG|PPED)|PECIAL_CHARS)|NUMBER_(INT|FLOAT)|URL|E(MAIL|NCODED)|FULL_SPECIAL_CHARS)|NULL_ON_FAILURE|CALLBACK|DEFAULT|UNSAFE_RAW|VALIDATE_(REGEXP|BOOLEAN|I(NT|P)|URL|EMAIL|FLOAT)|F(ORCE_ARRAY|LAG_(S(CHEME_REQUIRED|TRIP_(BACKTICK|HIGH|LOW))|HOST_REQUIRED|NO(NE|_(RES_RANGE|PRIV_RANGE|ENCODE_QUOTES))|IPV(4|6)|PATH_REQUIRED|E(MPTY_STRING_NULL|MAIL_UNICODE|NCODE_(HIGH|LOW|AMP))|QUERY_REQUIRED|ALLOW_(SCIENTIFIC|HEX|THOUSAND|OCTAL|FRACTION))))|E(_(BINARY|SKIP_EMPTY_LINES|NO_DEFAULT_CONTEXT|TEXT|IGNORE_NEW_LINES|USE_INCLUDE_PATH|APPEND)|INFO_(RAW|MIME(_(TYPE|ENCODING))?|SYMLINK|NONE|CONTINUE|DEVICES|PRESERVE_ATIME)))|ORCE_(GZIP|DEFLATE))|LIBXML_(XINCLUDE|N(SCLEAN|O(XMLDECL|BLANKS|NET|CDATA|E(RROR|MPTYTAG|NT)|WARNING))|COMPACT|D(TD(VALID|LOAD|ATTR)|OTTED_VERSION)|PARSEHUGE|ERR_(NONE|ERROR|FATAL|WARNING)|VERSION|LOADED_VERSION|BIGLINES))\b + - match: |- + (\\)?\b(?x: + CURLAUTH_ANY | CURLAUTH_ANYSAFE | CURLAUTH_BASIC | CURLAUTH_DIGEST | CURLAUTH_GSSNEGOTIATE | CURLAUTH_NTLM | CURLCLOSEPOLICY_CALLBACK | CURLCLOSEPOLICY_LEAST_RECENTLY_USED | + CURLCLOSEPOLICY_LEAST_TRAFFIC | CURLCLOSEPOLICY_OLDEST | CURLCLOSEPOLICY_SLOWEST | CURLE_ABORTED_BY_CALLBACK | CURLE_BAD_CALLING_ORDER | CURLE_BAD_CONTENT_ENCODING | CURLE_BAD_FUNCTION_ARGUMENT | CURLE_BAD_PASSWORD_ENTERED | + CURLE_COULDNT_CONNECT | CURLE_COULDNT_RESOLVE_HOST | CURLE_COULDNT_RESOLVE_PROXY | CURLE_FAILED_INIT | CURLE_FILESIZE_EXCEEDED | CURLE_FILE_COULDNT_READ_FILE | CURLE_FTP_ACCESS_DENIED | CURLE_FTP_BAD_DOWNLOAD_RESUME | + CURLE_FTP_CANT_GET_HOST | CURLE_FTP_CANT_RECONNECT | CURLE_FTP_COULDNT_GET_SIZE | CURLE_FTP_COULDNT_RETR_FILE | CURLE_FTP_COULDNT_SET_ASCII | CURLE_FTP_COULDNT_SET_BINARY | CURLE_FTP_COULDNT_STOR_FILE | CURLE_FTP_COULDNT_USE_REST | + CURLE_FTP_PORT_FAILED | CURLE_FTP_QUOTE_ERROR | CURLE_FTP_SSL_FAILED | CURLE_FTP_USER_PASSWORD_INCORRECT | CURLE_FTP_WEIRD_227_FORMAT | CURLE_FTP_WEIRD_PASS_REPLY | CURLE_FTP_WEIRD_PASV_REPLY | CURLE_FTP_WEIRD_SERVER_REPLY | + CURLE_FTP_WEIRD_USER_REPLY | CURLE_FTP_WRITE_ERROR | CURLE_FUNCTION_NOT_FOUND | CURLE_GOT_NOTHING | CURLE_HTTP_NOT_FOUND | CURLE_HTTP_PORT_FAILED | CURLE_HTTP_POST_ERROR | CURLE_HTTP_RANGE_ERROR | + CURLE_LDAP_CANNOT_BIND | CURLE_LDAP_INVALID_URL | CURLE_LDAP_SEARCH_FAILED | CURLE_LIBRARY_NOT_FOUND | CURLE_MALFORMAT_USER | CURLE_OBSOLETE | CURLE_OK | CURLE_OPERATION_TIMEOUTED | + CURLE_OUT_OF_MEMORY | CURLE_PARTIAL_FILE | CURLE_READ_ERROR | CURLE_RECV_ERROR | CURLE_SEND_ERROR | CURLE_SHARE_IN_USE | CURLE_SSH | CURLE_SSL_CACERT | + CURLE_SSL_CERTPROBLEM | CURLE_SSL_CIPHER | CURLE_SSL_CONNECT_ERROR | CURLE_SSL_ENGINE_NOTFOUND | CURLE_SSL_ENGINE_SETFAILED | CURLE_SSL_PEER_CERTIFICATE | CURLE_TELNET_OPTION_SYNTAX | CURLE_TOO_MANY_REDIRECTS | + CURLE_UNKNOWN_TELNET_OPTION | CURLE_UNSUPPORTED_PROTOCOL | CURLE_URL_MALFORMAT | CURLE_URL_MALFORMAT_USER | CURLE_WRITE_ERROR | CURLFTPAUTH_DEFAULT | CURLFTPAUTH_SSL | CURLFTPAUTH_TLS | + CURLFTPMETHOD_MULTICWD | CURLFTPMETHOD_NOCWD | CURLFTPMETHOD_SINGLECWD | CURLFTPSSL_ALL | CURLFTPSSL_CONTROL | CURLFTPSSL_NONE | CURLFTPSSL_TRY | CURLINFO_CERTINFO | + CURLINFO_CONNECT_TIME | CURLINFO_CONTENT_LENGTH_DOWNLOAD | CURLINFO_CONTENT_LENGTH_UPLOAD | CURLINFO_CONTENT_TYPE | CURLINFO_EFFECTIVE_URL | CURLINFO_FILETIME | CURLINFO_HEADER_OUT | CURLINFO_HEADER_SIZE | + CURLINFO_HTTP_CODE | CURLINFO_NAMELOOKUP_TIME | CURLINFO_PRETRANSFER_TIME | CURLINFO_PRIVATE | CURLINFO_REDIRECT_COUNT | CURLINFO_REDIRECT_TIME | CURLINFO_REQUEST_SIZE | CURLINFO_SIZE_DOWNLOAD | + CURLINFO_SIZE_UPLOAD | CURLINFO_SPEED_DOWNLOAD | CURLINFO_SPEED_UPLOAD | CURLINFO_SSL_VERIFYRESULT | CURLINFO_STARTTRANSFER_TIME | CURLINFO_TOTAL_TIME | CURLMOPT_PUSHFUNCTION | CURLMSG_DONE | + CURLM_BAD_EASY_HANDLE | CURLM_BAD_HANDLE | CURLM_CALL_MULTI_PERFORM | CURLM_INTERNAL_ERROR | CURLM_OK | CURLM_OUT_OF_MEMORY | CURLOPT_AUTOREFERER | CURLOPT_BINARYTRANSFER | + CURLOPT_BUFFERSIZE | CURLOPT_CAINFO | CURLOPT_CAPATH | CURLOPT_CERTINFO | CURLOPT_CLOSEPOLICY | CURLOPT_CONNECTTIMEOUT | CURLOPT_CONNECTTIMEOUT_MS | CURLOPT_COOKIE | + CURLOPT_COOKIEFILE | CURLOPT_COOKIEJAR | CURLOPT_COOKIESESSION | CURLOPT_CRLF | CURLOPT_CUSTOMREQUEST | CURLOPT_DNS_CACHE_TIMEOUT | CURLOPT_DNS_USE_GLOBAL_CACHE | CURLOPT_EGDSOCKET | + CURLOPT_ENCODING | CURLOPT_FAILONERROR | CURLOPT_FILE | CURLOPT_FILETIME | CURLOPT_FOLLOWLOCATION | CURLOPT_FORBID_REUSE | CURLOPT_FRESH_CONNECT | CURLOPT_FTPAPPEND | + CURLOPT_FTPLISTONLY | CURLOPT_FTPPORT | CURLOPT_FTPSSLAUTH | CURLOPT_FTP_CREATE_MISSING_DIRS | CURLOPT_FTP_FILEMETHOD | CURLOPT_FTP_SKIP_PASV_IP | CURLOPT_FTP_SSL | CURLOPT_FTP_USE_EPRT | + CURLOPT_FTP_USE_EPSV | CURLOPT_HEADER | CURLOPT_HEADERFUNCTION | CURLOPT_HTTP200ALIASES | CURLOPT_HTTPAUTH | CURLOPT_HTTPGET | CURLOPT_HTTPHEADER | CURLOPT_HTTPPROXYTUNNEL | + CURLOPT_HTTP_VERSION | CURLOPT_INFILE | CURLOPT_INFILESIZE | CURLOPT_INTERFACE | CURLOPT_IPRESOLVE | CURLOPT_KEYPASSWD | CURLOPT_KRB4LEVEL | CURLOPT_LOW_SPEED_LIMIT | + CURLOPT_LOW_SPEED_TIME | CURLOPT_MAXCONNECTS | CURLOPT_MAXREDIRS | CURLOPT_NETRC | CURLOPT_NOBODY | CURLOPT_NOPROGRESS | CURLOPT_NOSIGNAL | CURLOPT_PORT | + CURLOPT_POST | CURLOPT_POSTFIELDS | CURLOPT_POSTQUOTE | CURLOPT_POSTREDIR | CURLOPT_PRIVATE | CURLOPT_PROGRESSFUNCTION | CURLOPT_PROTOCOLS | CURLOPT_PROXY | + CURLOPT_PROXYAUTH | CURLOPT_PROXYPORT | CURLOPT_PROXYTYPE | CURLOPT_PROXYUSERPWD | CURLOPT_PUT | CURLOPT_QUOTE | CURLOPT_RANDOM_FILE | CURLOPT_RANGE | + CURLOPT_READDATA | CURLOPT_READFUNCTION | CURLOPT_REDIR_PROTOCOLS | CURLOPT_REFERER | CURLOPT_RESUME_FROM | CURLOPT_RETURNTRANSFER | CURLOPT_SSH_AUTH_TYPES | CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 | + CURLOPT_SSH_PRIVATE_KEYFILE | CURLOPT_SSH_PUBLIC_KEYFILE | CURLOPT_SSLCERT | CURLOPT_SSLCERTPASSWD | CURLOPT_SSLCERTTYPE | CURLOPT_SSLENGINE | CURLOPT_SSLENGINE_DEFAULT | CURLOPT_SSLKEY | + CURLOPT_SSLKEYPASSWD | CURLOPT_SSLKEYTYPE | CURLOPT_SSLVERSION | CURLOPT_SSL_CIPHER_LIST | CURLOPT_SSL_VERIFYHOST | CURLOPT_SSL_VERIFYPEER | CURLOPT_STDERR | CURLOPT_TCP_NODELAY | + CURLOPT_TIMECONDITION | CURLOPT_TIMEOUT | CURLOPT_TIMEOUT_MS | CURLOPT_TIMEVALUE | CURLOPT_TRANSFERTEXT | CURLOPT_UNRESTRICTED_AUTH | CURLOPT_UPLOAD | CURLOPT_URL | + CURLOPT_USERAGENT | CURLOPT_USERPWD | CURLOPT_VERBOSE | CURLOPT_WRITEFUNCTION | CURLOPT_WRITEHEADER | CURLPROTO_ALL | CURLPROTO_DICT | CURLPROTO_FILE | + CURLPROTO_FTP | CURLPROTO_FTPS | CURLPROTO_HTTP | CURLPROTO_HTTPS | CURLPROTO_LDAP | CURLPROTO_LDAPS | CURLPROTO_SCP | CURLPROTO_SFTP | + CURLPROTO_TELNET | CURLPROTO_TFTP | CURLPROXY_HTTP | CURLPROXY_SOCKS4 | CURLPROXY_SOCKS5 | CURLSSH_AUTH_DEFAULT | CURLSSH_AUTH_HOST | CURLSSH_AUTH_KEYBOARD | + CURLSSH_AUTH_NONE | CURLSSH_AUTH_PASSWORD | CURLSSH_AUTH_PUBLICKEY | CURLVERSION_NOW | CURL_HTTP_VERSION_1_0 | CURL_HTTP_VERSION_1_1 | CURL_HTTP_VERSION_NONE | CURL_IPRESOLVE_V4 | + CURL_IPRESOLVE_V6 | CURL_IPRESOLVE_WHATEVER | CURL_NETRC_IGNORED | CURL_NETRC_OPTIONAL | CURL_NETRC_REQUIRED | CURL_PUSH_DENY | CURL_PUSH_OK | CURL_TIMECOND_IFMODSINCE | + CURL_TIMECOND_IFUNMODSINCE | CURL_TIMECOND_LASTMOD | CURL_VERSION_IPV6 | CURL_VERSION_KERBEROS4 | CURL_VERSION_LIBZ | CURL_VERSION_SSL | DNS_A | DNS_A6 | + DNS_AAAA | DNS_ALL | DNS_ANY | DNS_CNAME | DNS_HINFO | DNS_MX | DNS_NAPTR | DNS_NS | + DNS_PTR | DNS_SOA | DNS_SRV | DNS_TXT | DOMSTRING_SIZE_ERR | DOM_HIERARCHY_REQUEST_ERR | DOM_INDEX_SIZE_ERR | DOM_INUSE_ATTRIBUTE_ERR | + DOM_INVALID_ACCESS_ERR | DOM_INVALID_CHARACTER_ERR | DOM_INVALID_MODIFICATION_ERR | DOM_INVALID_STATE_ERR | DOM_NAMESPACE_ERR | DOM_NOT_FOUND_ERR | DOM_NOT_SUPPORTED_ERR | DOM_NO_DATA_ALLOWED_ERR | + DOM_NO_MODIFICATION_ALLOWED_ERR | DOM_PHP_ERR | DOM_SYNTAX_ERR | DOM_VALIDATION_ERR | DOM_WRONG_DOCUMENT_ERR | FILEINFO_CONTINUE | FILEINFO_DEVICES | FILEINFO_MIME | + FILEINFO_MIME_ENCODING | FILEINFO_MIME_TYPE | FILEINFO_NONE | FILEINFO_PRESERVE_ATIME | FILEINFO_RAW | FILEINFO_SYMLINK | FILE_APPEND | FILE_BINARY | + FILE_IGNORE_NEW_LINES | FILE_NO_DEFAULT_CONTEXT | FILE_SKIP_EMPTY_LINES | FILE_TEXT | FILE_USE_INCLUDE_PATH | FILTER_CALLBACK | FILTER_DEFAULT | FILTER_FLAG_ALLOW_FRACTION | + FILTER_FLAG_ALLOW_HEX | FILTER_FLAG_ALLOW_OCTAL | FILTER_FLAG_ALLOW_SCIENTIFIC | FILTER_FLAG_ALLOW_THOUSAND | FILTER_FLAG_EMAIL_UNICODE | FILTER_FLAG_EMPTY_STRING_NULL | FILTER_FLAG_ENCODE_AMP | FILTER_FLAG_ENCODE_HIGH | + FILTER_FLAG_ENCODE_LOW | FILTER_FLAG_HOST_REQUIRED | FILTER_FLAG_IPV4 | FILTER_FLAG_IPV6 | FILTER_FLAG_NONE | FILTER_FLAG_NO_ENCODE_QUOTES | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE | + FILTER_FLAG_PATH_REQUIRED | FILTER_FLAG_QUERY_REQUIRED | FILTER_FLAG_SCHEME_REQUIRED | FILTER_FLAG_STRIP_BACKTICK | FILTER_FLAG_STRIP_HIGH | FILTER_FLAG_STRIP_LOW | FILTER_FORCE_ARRAY | FILTER_NULL_ON_FAILURE | + FILTER_REQUIRE_ARRAY | FILTER_REQUIRE_SCALAR | FILTER_SANITIZE_EMAIL | FILTER_SANITIZE_ENCODED | FILTER_SANITIZE_FULL_SPECIAL_CHARS | FILTER_SANITIZE_MAGIC_QUOTES | FILTER_SANITIZE_NUMBER_FLOAT | FILTER_SANITIZE_NUMBER_INT | + FILTER_SANITIZE_SPECIAL_CHARS | FILTER_SANITIZE_STRING | FILTER_SANITIZE_STRIPPED | FILTER_SANITIZE_URL | FILTER_UNSAFE_RAW | FILTER_VALIDATE_BOOLEAN | FILTER_VALIDATE_EMAIL | FILTER_VALIDATE_FLOAT | + FILTER_VALIDATE_INT | FILTER_VALIDATE_IP | FILTER_VALIDATE_REGEXP | FILTER_VALIDATE_URL | FNM_CASEFOLD | FNM_NOESCAPE | FNM_PATHNAME | FNM_PERIOD | + FORCE_DEFLATE | FORCE_GZIP | GLOB_AVAILABLE_FLAGS | GLOB_BRACE | GLOB_ERR | GLOB_MARK | GLOB_NOCHECK | GLOB_NOESCAPE | + GLOB_NOSORT | GLOB_ONLYDIR | ICONV_IMPL | ICONV_MIME_DECODE_CONTINUE_ON_ERROR | ICONV_MIME_DECODE_STRICT | ICONV_VERSION | IMAGETYPE_BMP | IMAGETYPE_COUNT | + IMAGETYPE_GIF | IMAGETYPE_ICO | IMAGETYPE_IFF | IMAGETYPE_JB2 | IMAGETYPE_JP2 | IMAGETYPE_JPC | IMAGETYPE_JPEG | IMAGETYPE_JPEG2000 | + IMAGETYPE_JPX | IMAGETYPE_PNG | IMAGETYPE_PSD | IMAGETYPE_SWC | IMAGETYPE_SWF | IMAGETYPE_TIFF_II | IMAGETYPE_TIFF_MM | IMAGETYPE_UNKNOWN | + IMAGETYPE_WBMP | IMAGETYPE_WEBP | IMAGETYPE_XBM | INPUT_COOKIE | INPUT_ENV | INPUT_GET | INPUT_POST | INPUT_REQUEST | + INPUT_SERVER | INPUT_SESSION | JSON_BIGINT_AS_STRING | JSON_ERROR_CTRL_CHAR | JSON_ERROR_DEPTH | JSON_ERROR_INF_OR_NAN | JSON_ERROR_INVALID_PROPERTY_NAME | JSON_ERROR_NONE | + JSON_ERROR_RECURSION | JSON_ERROR_STATE_MISMATCH | JSON_ERROR_SYNTAX | JSON_ERROR_UNSUPPORTED_TYPE | JSON_ERROR_UTF16 | JSON_ERROR_UTF8 | JSON_FORCE_OBJECT | JSON_HEX_AMP | + JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_TAG | JSON_INVALID_UTF8_IGNORE | JSON_INVALID_UTF8_SUBSTITUTE | JSON_NUMERIC_CHECK | JSON_OBJECT_AS_ARRAY | JSON_PARTIAL_OUTPUT_ON_ERROR | + JSON_PRESERVE_ZERO_FRACTION | JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR | JSON_UNESCAPED_LINE_TERMINATORS | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | LIBXML_BIGLINES | LIBXML_COMPACT | + LIBXML_DOTTED_VERSION | LIBXML_DTDATTR | LIBXML_DTDLOAD | LIBXML_DTDVALID | LIBXML_ERR_ERROR | LIBXML_ERR_FATAL | LIBXML_ERR_NONE | LIBXML_ERR_WARNING | + LIBXML_LOADED_VERSION | LIBXML_NOBLANKS | LIBXML_NOCDATA | LIBXML_NOEMPTYTAG | LIBXML_NOENT | LIBXML_NOERROR | LIBXML_NONET | LIBXML_NOWARNING | + LIBXML_NOXMLDECL | LIBXML_NSCLEAN | LIBXML_PARSEHUGE | LIBXML_VERSION | LIBXML_XINCLUDE | MCRYPT_3DES | MCRYPT_ARCFOUR | MCRYPT_ARCFOUR_IV | + MCRYPT_BLOWFISH | MCRYPT_BLOWFISH_COMPAT | MCRYPT_CAST_128 | MCRYPT_CAST_256 | MCRYPT_CRYPT | MCRYPT_DECRYPT | MCRYPT_DES | MCRYPT_DEV_RANDOM | + MCRYPT_DEV_URANDOM | MCRYPT_ENCRYPT | MCRYPT_ENIGNA | MCRYPT_GOST | MCRYPT_IDEA | MCRYPT_LOKI97 | MCRYPT_MARS | MCRYPT_MODE_CBC | + MCRYPT_MODE_CFB | MCRYPT_MODE_ECB | MCRYPT_MODE_NOFB | MCRYPT_MODE_OFB | MCRYPT_MODE_STREAM | MCRYPT_PANAMA | MCRYPT_RAND | MCRYPT_RC2 | + MCRYPT_RC6 | MCRYPT_RIJNDAEL_128 | MCRYPT_RIJNDAEL_192 | MCRYPT_RIJNDAEL_256 | MCRYPT_SAFER128 | MCRYPT_SAFER64 | MCRYPT_SAFERPLUS | MCRYPT_SERPENT | + MCRYPT_SKIPJACK | MCRYPT_THREEWAY | MCRYPT_TRIPLEDES | MCRYPT_TWOFISH | MCRYPT_WAKE | MCRYPT_XTEA | MHASH_ADLER32 | MHASH_CRC32 | + MHASH_CRC32B | MHASH_GOST | MHASH_HAVAL128 | MHASH_HAVAL160 | MHASH_HAVAL192 | MHASH_HAVAL224 | MHASH_HAVAL256 | MHASH_MD2 | + MHASH_MD4 | MHASH_MD5 | MHASH_RIPEMD128 | MHASH_RIPEMD160 | MHASH_RIPEMD256 | MHASH_RIPEMD320 | MHASH_SHA1 | MHASH_SHA224 | + MHASH_SHA256 | MHASH_SHA384 | MHASH_SHA512 | MHASH_SNEFRU256 | MHASH_TIGER | MHASH_TIGER128 | MHASH_TIGER160 | MHASH_WHIRLPOOL | + MYSQLI_ASSOC | MYSQLI_ASYNC | MYSQLI_AUTO_INCREMENT_FLAG | MYSQLI_BINARY_FLAG | MYSQLI_BLOB_FLAG | MYSQLI_BOTH | MYSQLI_CLIENT_COMPRESS | MYSQLI_CLIENT_FOUND_ROWS | + MYSQLI_CLIENT_IGNORE_SPACE | MYSQLI_CLIENT_INTERACTIVE | MYSQLI_CLIENT_NO_SCHEMA | MYSQLI_CLIENT_SSL | MYSQLI_CURSOR_TYPE_FOR_UPDATE | MYSQLI_CURSOR_TYPE_NO_CURSOR | MYSQLI_CURSOR_TYPE_READ_ONLY | MYSQLI_CURSOR_TYPE_SCROLLABLE | + MYSQLI_DATA_TRUNCATED | MYSQLI_DEBUG_TRACE_ENABLED | MYSQLI_ENUM_FLAG | MYSQLI_GROUP_FLAG | MYSQLI_INIT_COMMAND | MYSQLI_MULTIPLE_KEY_FLAG | MYSQLI_NOT_NULL_FLAG | MYSQLI_NO_DATA | + MYSQLI_NO_DEFAULT_VALUE_FLAG | MYSQLI_NUM | MYSQLI_NUM_FLAG | MYSQLI_ON_UPDATE_NOW_FLAG | MYSQLI_OPT_CONNECT_TIMEOUT | MYSQLI_OPT_INT_AND_FLOAT_NATIVE | MYSQLI_OPT_LOCAL_INFILE | MYSQLI_OPT_NET_CMD_BUFFER_SIZE | + MYSQLI_OPT_NET_READ_BUFFER_SIZE | MYSQLI_PART_KEY_FLAG | MYSQLI_PRI_KEY_FLAG | MYSQLI_READ_DEFAULT_FILE | MYSQLI_READ_DEFAULT_GROUP | MYSQLI_REFRESH_BACKUP_LOG | MYSQLI_REFRESH_GRANT | MYSQLI_REFRESH_HOSTS | + MYSQLI_REFRESH_LOG | MYSQLI_REFRESH_MASTER | MYSQLI_REFRESH_SLAVE | MYSQLI_REFRESH_STATUS | MYSQLI_REFRESH_TABLES | MYSQLI_REFRESH_THREADS | MYSQLI_REPORT_ALL | MYSQLI_REPORT_ERROR | + MYSQLI_REPORT_INDEX | MYSQLI_REPORT_OFF | MYSQLI_REPORT_STRICT | MYSQLI_SERVER_QUERY_NO_GOOD_INDEX_USED | MYSQLI_SERVER_QUERY_NO_INDEX_USED | MYSQLI_SERVER_QUERY_WAS_SLOW | MYSQLI_SET_CHARSET_NAME | MYSQLI_SET_FLAG | + MYSQLI_STMT_ATTR_CURSOR_TYPE | MYSQLI_STMT_ATTR_PREFETCH_ROWS | MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH | MYSQLI_STORE_RESULT | MYSQLI_TIMESTAMP_FLAG | MYSQLI_TYPE_BIT | MYSQLI_TYPE_BLOB | MYSQLI_TYPE_CHAR | + MYSQLI_TYPE_DATE | MYSQLI_TYPE_DATETIME | MYSQLI_TYPE_DECIMAL | MYSQLI_TYPE_DOUBLE | MYSQLI_TYPE_ENUM | MYSQLI_TYPE_FLOAT | MYSQLI_TYPE_GEOMETRY | MYSQLI_TYPE_INT24 | + MYSQLI_TYPE_INTERVAL | MYSQLI_TYPE_LONG | MYSQLI_TYPE_LONGLONG | MYSQLI_TYPE_LONG_BLOB | MYSQLI_TYPE_MEDIUM_BLOB | MYSQLI_TYPE_NEWDATE | MYSQLI_TYPE_NEWDECIMAL | MYSQLI_TYPE_NULL | + MYSQLI_TYPE_SET | MYSQLI_TYPE_SHORT | MYSQLI_TYPE_STRING | MYSQLI_TYPE_TIME | MYSQLI_TYPE_TIMESTAMP | MYSQLI_TYPE_TINY | MYSQLI_TYPE_TINY_BLOB | MYSQLI_TYPE_VAR_STRING | + MYSQLI_TYPE_YEAR | MYSQLI_UNIQUE_KEY_FLAG | MYSQLI_UNSIGNED_FLAG | MYSQLI_USE_RESULT | MYSQLI_ZEROFILL_FLAG | MYSQL_ASSOC | MYSQL_BOTH | MYSQL_CLIENT_COMPRESS | + MYSQL_CLIENT_IGNORE_SPACE | MYSQL_CLIENT_INTERACTIVE | MYSQL_CLIENT_SSL | MYSQL_NUM | PCRE_VERSION | POSIX_F_OK | POSIX_RLIMIT_AS | POSIX_RLIMIT_CORE | + POSIX_RLIMIT_CPU | POSIX_RLIMIT_DATA | POSIX_RLIMIT_FSIZE | POSIX_RLIMIT_INFINITY | POSIX_RLIMIT_LOCKS | POSIX_RLIMIT_MEMLOCK | POSIX_RLIMIT_MSGQUEUE | POSIX_RLIMIT_NICE | + POSIX_RLIMIT_NOFILE | POSIX_RLIMIT_NPROC | POSIX_RLIMIT_RSS | POSIX_RLIMIT_RTPRIO | POSIX_RLIMIT_RTTIME | POSIX_RLIMIT_SIGPENDING | POSIX_RLIMIT_STACK | POSIX_R_OK | + POSIX_S_IFBLK | POSIX_S_IFCHR | POSIX_S_IFIFO | POSIX_S_IFREG | POSIX_S_IFSOCK | POSIX_W_OK | POSIX_X_OK | PREG_BACKTRACK_LIMIT_ERROR | + PREG_BAD_UTF8_ERROR | PREG_BAD_UTF8_OFFSET_ERROR | PREG_GREP_INVERT | PREG_INTERNAL_ERROR | PREG_JIT_STACKLIMIT_ERROR | PREG_NO_ERROR | PREG_OFFSET_CAPTURE | PREG_PATTERN_ORDER | + PREG_RECURSION_LIMIT_ERROR | PREG_SET_ORDER | PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY | PREG_SPLIT_OFFSET_CAPTURE | PREG_UNMATCHED_AS_NULL | PSFS_ERR_FATAL | PSFS_FEED_ME | + PSFS_FLAG_FLUSH_CLOSE | PSFS_FLAG_FLUSH_INC | PSFS_FLAG_NORMAL | PSFS_PASS_ON | SQLITE3_ASSOC | SQLITE3_BLOB | SQLITE3_BOTH | SQLITE3_FLOAT | + SQLITE3_INTEGER | SQLITE3_NULL | SQLITE3_NUM | SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READONLY | SQLITE3_OPEN_READWRITE | SQLITE3_TEXT | SQLITE_ABORT | + SQLITE_ASSOC | SQLITE_AUTH | SQLITE_BOTH | SQLITE_BUSY | SQLITE_CANTOPEN | SQLITE_CONSTRAINT | SQLITE_CORRUPT | SQLITE_DONE | + SQLITE_EMPTY | SQLITE_ERROR | SQLITE_FORMAT | SQLITE_FULL | SQLITE_INTERNAL | SQLITE_INTERRUPT | SQLITE_IOERR | SQLITE_LOCKED | + SQLITE_MISMATCH | SQLITE_MISUSE | SQLITE_NOLFS | SQLITE_NOMEM | SQLITE_NOTADB | SQLITE_NOTFOUND | SQLITE_NUM | SQLITE_OK | + SQLITE_PERM | SQLITE_PROTOCOL | SQLITE_READONLY | SQLITE_ROW | SQLITE_SCHEMA | SQLITE_TOOBIG | STREAM_BUFFER_FULL | STREAM_BUFFER_LINE | + STREAM_BUFFER_NONE | STREAM_CAST_AS_STREAM | STREAM_CAST_FOR_SELECT | STREAM_CLIENT_ASYNC_CONNECT | STREAM_CLIENT_CONNECT | STREAM_CLIENT_PERSISTENT | STREAM_CRYPTO_METHOD_SSLv23_CLIENT | STREAM_CRYPTO_METHOD_SSLv23_SERVER | + STREAM_CRYPTO_METHOD_SSLv2_CLIENT | STREAM_CRYPTO_METHOD_SSLv2_SERVER | STREAM_CRYPTO_METHOD_SSLv3_CLIENT | STREAM_CRYPTO_METHOD_SSLv3_SERVER | STREAM_CRYPTO_METHOD_TLS_CLIENT | STREAM_CRYPTO_METHOD_TLS_SERVER | STREAM_ENFORCE_SAFE_MODE | STREAM_FILTER_ALL | + STREAM_FILTER_READ | STREAM_FILTER_WRITE | STREAM_IGNORE_URL | STREAM_IPPROTO_ICMP | STREAM_IPPROTO_IP | STREAM_IPPROTO_RAW | STREAM_IPPROTO_TCP | STREAM_IPPROTO_UDP | + STREAM_IS_URL | STREAM_MKDIR_RECURSIVE | STREAM_MUST_SEEK | STREAM_NOTIFY_AUTH_REQUIRED | STREAM_NOTIFY_AUTH_RESULT | STREAM_NOTIFY_COMPLETED | STREAM_NOTIFY_CONNECT | STREAM_NOTIFY_FAILURE | + STREAM_NOTIFY_FILE_SIZE_IS | STREAM_NOTIFY_MIME_TYPE_IS | STREAM_NOTIFY_PROGRESS | STREAM_NOTIFY_REDIRECTED | STREAM_NOTIFY_RESOLVE | STREAM_NOTIFY_SEVERITY_ERR | STREAM_NOTIFY_SEVERITY_INFO | STREAM_NOTIFY_SEVERITY_WARN | + STREAM_OOB | STREAM_OPTION_BLOCKING | STREAM_OPTION_READ_BUFFER | STREAM_OPTION_READ_TIMEOUT | STREAM_OPTION_WRITE_BUFFER | STREAM_PEEK | STREAM_PF_INET | STREAM_PF_INET6 | + STREAM_PF_UNIX | STREAM_REPORT_ERRORS | STREAM_SERVER_BIND | STREAM_SERVER_LISTEN | STREAM_SHUT_RD | STREAM_SHUT_RDWR | STREAM_SHUT_WR | STREAM_SOCK_DGRAM | + STREAM_SOCK_RAW | STREAM_SOCK_RDM | STREAM_SOCK_SEQPACKET | STREAM_SOCK_STREAM | STREAM_URL_STAT_LINK | STREAM_URL_STAT_QUIET | STREAM_USE_PATH | SUNFUNCS_RET_DOUBLE | + SUNFUNCS_RET_STRING | SUNFUNCS_RET_TIMESTAMP | XML_ATTRIBUTE_CDATA | XML_ATTRIBUTE_DECL_NODE | XML_ATTRIBUTE_ENTITY | XML_ATTRIBUTE_ENUMERATION | XML_ATTRIBUTE_ID | XML_ATTRIBUTE_IDREF | + XML_ATTRIBUTE_IDREFS | XML_ATTRIBUTE_NMTOKEN | XML_ATTRIBUTE_NMTOKENS | XML_ATTRIBUTE_NODE | XML_ATTRIBUTE_NOTATION | XML_CDATA_SECTION_NODE | XML_COMMENT_NODE | XML_DOCUMENT_FRAG_NODE | + XML_DOCUMENT_NODE | XML_DOCUMENT_TYPE_NODE | XML_DTD_NODE | XML_ELEMENT_DECL_NODE | XML_ELEMENT_NODE | XML_ENTITY_DECL_NODE | XML_ENTITY_NODE | XML_ENTITY_REF_NODE | + XML_ERROR_ASYNC_ENTITY | XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF | XML_ERROR_BAD_CHAR_REF | XML_ERROR_BINARY_ENTITY_REF | XML_ERROR_DUPLICATE_ATTRIBUTE | XML_ERROR_EXTERNAL_ENTITY_HANDLING | XML_ERROR_INCORRECT_ENCODING | XML_ERROR_INVALID_TOKEN | + XML_ERROR_JUNK_AFTER_DOC_ELEMENT | XML_ERROR_MISPLACED_XML_PI | XML_ERROR_NONE | XML_ERROR_NO_ELEMENTS | XML_ERROR_NO_MEMORY | XML_ERROR_PARAM_ENTITY_REF | XML_ERROR_PARTIAL_CHAR | XML_ERROR_RECURSIVE_ENTITY_REF | + XML_ERROR_SYNTAX | XML_ERROR_TAG_MISMATCH | XML_ERROR_UNCLOSED_CDATA_SECTION | XML_ERROR_UNCLOSED_TOKEN | XML_ERROR_UNDEFINED_ENTITY | XML_ERROR_UNKNOWN_ENCODING | XML_HTML_DOCUMENT_NODE | XML_LOCAL_NAMESPACE | + XML_NAMESPACE_DECL_NODE | XML_NOTATION_NODE | XML_OPTION_CASE_FOLDING | XML_OPTION_SKIP_TAGSTART | XML_OPTION_SKIP_WHITE | XML_OPTION_TARGET_ENCODING | XML_PI_NODE | XML_SAX_IMPL | + XML_TEXT_NODE + )\b scope: support.constant.ext.php captures: 1: punctuation.separator.namespace.php - - match: (\\)?\bT_(RE(TURN|QUIRE(_ONCE)?)|G(OTO|LOBAL)|XOR_EQUAL|M(INUS_EQUAL|OD_EQUAL|UL_EQUAL|ETHOD_C|L_COMMENT)|B(REAK|OOL(_CAST|EAN_(OR|AND))|AD_CHARACTER)|S(R(_EQUAL)?|T(RING(_(CAST|VARNAME))?|A(RT_HEREDOC|TIC))|WITCH|L(_EQUAL)?)|HALT_COMPILER|N(S_(SEPARATOR|C)|UM_STRING|EW|AMESPACE)|C(HARACTER|O(MMENT|N(ST(ANT_ENCAPSED_STRING)?|CAT_EQUAL|TINUE))|URLY_OPEN|L(O(SE_TAG|NE)|ASS(_C)?)|A(SE|TCH))|T(RY|HROW)|I(MPLEMENTS|S(SET|_(GREATER_OR_EQUAL|SMALLER_OR_EQUAL|NOT_(IDENTICAL|EQUAL)|IDENTICAL|EQUAL))|N(STANCEOF|C(LUDE(_ONCE)?)?|T(_CAST|ERFACE)|LINE_HTML)|F)|O(R_EQUAL|BJECT_(CAST|OPERATOR)|PEN_TAG(_WITH_ECHO)?|LD_FUNCTION)|D(NUMBER|I(R|V_EQUAL)|O(C_COMMENT|UBLE_(C(OLON|AST)|ARROW)|LLAR_OPEN_CURLY_BRACES)?|E(C(LARE)?|FAULT))|U(SE|NSET(_CAST)?)|P(R(I(NT|VATE)|OTECTED)|UBLIC|LUS_EQUAL|AAMAYIM_NEKUDOTAYIM)|E(X(TENDS|IT)|MPTY|N(CAPSED_AND_WHITESPACE|D(SWITCH|_HEREDOC|IF|DECLARE|FOR(EACH)?|WHILE))|CHO|VAL|LSE(IF)?)|VAR(IABLE)?|F(I(NAL|LE)|OR(EACH)?|UNC(_C|TION))|WHI(TESPACE|LE)|L(NUMBER|I(ST|NE)|OGICAL_(XOR|OR|AND))|A(RRAY(_CAST)?|BSTRACT|S|ND_EQUAL))\b + - match: |- + (\\)?\b(?x: + T_ABSTRACT | T_AND_EQUAL | T_ARRAY | T_ARRAY_CAST | T_AS | T_BAD_CHARACTER | T_BOOLEAN_AND | T_BOOLEAN_OR | + T_BOOL_CAST | T_BREAK | T_CASE | T_CATCH | T_CHARACTER | T_CLASS | T_CLASS_C | T_CLONE | + T_CLOSE_TAG | T_COMMENT | T_CONCAT_EQUAL | T_CONST | T_CONSTANT_ENCAPSED_STRING | T_CONTINUE | T_CURLY_OPEN | T_DEC | + T_DECLARE | T_DEFAULT | T_DIR | T_DIV_EQUAL | T_DNUMBER | T_DO | T_DOC_COMMENT | T_DOLLAR_OPEN_CURLY_BRACES | + T_DOUBLE_ARROW | T_DOUBLE_CAST | T_DOUBLE_COLON | T_ECHO | T_ELSE | T_ELSEIF | T_EMPTY | T_ENCAPSED_AND_WHITESPACE | + T_ENDDECLARE | T_ENDFOR | T_ENDFOREACH | T_ENDIF | T_ENDSWITCH | T_ENDWHILE | T_END_HEREDOC | T_EVAL | + T_EXIT | T_EXTENDS | T_FILE | T_FINAL | T_FOR | T_FOREACH | T_FUNCTION | T_FUNC_C | + T_GLOBAL | T_GOTO | T_HALT_COMPILER | T_IF | T_IMPLEMENTS | T_INC | T_INCLUDE | T_INCLUDE_ONCE | + T_INLINE_HTML | T_INSTANCEOF | T_INTERFACE | T_INT_CAST | T_ISSET | T_IS_EQUAL | T_IS_GREATER_OR_EQUAL | T_IS_IDENTICAL | + T_IS_NOT_EQUAL | T_IS_NOT_IDENTICAL | T_IS_SMALLER_OR_EQUAL | T_LINE | T_LIST | T_LNUMBER | T_LOGICAL_AND | T_LOGICAL_OR | + T_LOGICAL_XOR | T_METHOD_C | T_MINUS_EQUAL | T_ML_COMMENT | T_MOD_EQUAL | T_MUL_EQUAL | T_NAMESPACE | T_NEW | + T_NS_C | T_NS_SEPARATOR | T_NUM_STRING | T_OBJECT_CAST | T_OBJECT_OPERATOR | T_OLD_FUNCTION | T_OPEN_TAG | T_OPEN_TAG_WITH_ECHO | + T_OR_EQUAL | T_PAAMAYIM_NEKUDOTAYIM | T_PLUS_EQUAL | T_PRINT | T_PRIVATE | T_PROTECTED | T_PUBLIC | T_REQUIRE | + T_REQUIRE_ONCE | T_RETURN | T_SL | T_SL_EQUAL | T_SR | T_SR_EQUAL | T_START_HEREDOC | T_STATIC | + T_STRING | T_STRING_CAST | T_STRING_VARNAME | T_SWITCH | T_THROW | T_TRY | T_UNSET | T_UNSET_CAST | + T_USE | T_VAR | T_VARIABLE | T_WHILE | T_WHITESPACE | T_XOR_EQUAL + )\b scope: support.constant.parser-token.php captures: 1: punctuation.separator.namespace.php @@ -818,7 +1097,7 @@ contexts: scope: punctuation.separator.php - include: expressions heredoc: - - match: '(?=<<<\s*''?({{identifier}})''?\s*$)' + - match: (?=<<<\s*'?({{identifier}})'?\s*$) push: - match: ^\s*(\1)\b(?:(;)(\s*$\n?))? captures: @@ -830,13 +1109,9 @@ contexts: scope: punctuation.section.embedded.begin.php punctuation.definition.string.php captures: 1: keyword.operator.heredoc.php - push: - - meta_scope: meta.embedded.html - - meta_content_scope: text.html - - match: (?=^\s*HTML\b) - pop: true - - include: interpolation - - include: scope:text.html.basic + embed: heredoc-html + embed_scope: meta.embedded.html text.html + escape: (?=^\s*HTML\b) - match: <<<\s*('HTML')\s*$\n? scope: meta.embedded.html punctuation.section.embedded.begin.php punctuation.definition.string.php captures: @@ -848,13 +1123,9 @@ contexts: scope: punctuation.section.embedded.begin.php punctuation.definition.string.php captures: 1: keyword.operator.heredoc.php - push: - - meta_scope: meta.embedded.xml - - meta_content_scope: text.xml - - match: (?=^\s*XML\b) - pop: true - - include: interpolation - - include: scope:text.xml + embed: heredoc-xml + embed_scope: meta.embedded.xml text.xml + escape: (?=^\s*XML\b) - match: <<<\s*('XML')\s*$\n? scope: meta.embedded.xml punctuation.section.embedded.begin.php punctuation.definition.string.php captures: @@ -866,13 +1137,9 @@ contexts: scope: punctuation.section.embedded.begin.php punctuation.definition.string.php captures: 1: keyword.operator.heredoc.php - push: - - meta_scope: meta.embedded.sql - - meta_content_scope: source.sql - - match: (?=^\s*SQL\b) - pop: true - - include: interpolation - - include: scope:source.sql + embed: heredoc-sql + embed_scope: meta.embedded.sql source.sql + escape: (?=^\s*SQL\b) - match: <<<\s*('SQL')\s*$\n? scope: meta.embedded.sql punctuation.section.embedded.begin.php punctuation.definition.string.php captures: @@ -884,13 +1151,9 @@ contexts: scope: punctuation.section.embedded.begin.php punctuation.definition.string.php captures: 1: keyword.operator.heredoc.php - push: - - meta_scope: meta.embedded.js - - meta_content_scope: source.js - - match: (?=^\s*JAVASCRIPT\b) - pop: true - - include: interpolation - - include: scope:source.js + embed: heredoc-javascript + embed_scope: meta.embedded.js source.js + escape: (?=^\s*JAVASCRIPT\b) - match: <<<\s*('JAVASCRIPT')\s*$\n? scope: meta.embedded.js punctuation.section.embedded.begin.php punctuation.definition.string.php captures: @@ -902,13 +1165,9 @@ contexts: scope: punctuation.section.embedded.begin.php punctuation.definition.string.php captures: 1: keyword.operator.heredoc.php - push: - - meta_scope: meta.embedded.json - - meta_content_scope: source.json - - match: (?=^\s*JSON\b) - pop: true - - include: interpolation - - include: scope:source.json + embed: heredoc-json + embed_scope: meta.embedded.json source.json + escape: (?=^\s*JSON\b) - match: (<<<)\s*('JSON')\s*$\n? scope: meta.embedded.json punctuation.section.embedded.begin.php punctuation.definition.string.php captures: @@ -920,13 +1179,9 @@ contexts: scope: punctuation.section.embedded.begin.php punctuation.definition.string.php captures: 1: keyword.operator.heredoc.php - push: - - meta_scope: meta.embedded.css - - meta_content_scope: source.css - - match: (?=^\s*CSS\b) - pop: true - - include: interpolation - - include: scope:source.css + embed: heredoc-css + embed_scope: meta.embedded.css source.css + escape: (?=^\s*CSS\b) - match: <<<\s*('CSS')\s*$\n? scope: meta.embedded.css punctuation.section.embedded.begin.php punctuation.definition.string.php captures: @@ -943,16 +1198,50 @@ contexts: - match: (?=^\s*\1\b) pop: true - include: interpolation - - match: '<<<\s*('')({{identifier}})('')' + - match: <<<\s*('({{identifier}})') scope: punctuation.definition.string.php captures: 1: keyword.operator.nowdoc.php - 2: keyword.operator.nowdoc.php - 3: keyword.operator.nowdoc.php push: - meta_scope: string.unquoted.nowdoc.php - match: (?=^\s*\2\b) pop: true + heredoc-html: + - meta_include_prototype: false + - match: '' + push: scope:text.html.basic + with_prototype: + - include: interpolation + heredoc-xml: + - meta_include_prototype: false + - match: '' + push: scope:text.xml + with_prototype: + - include: interpolation + heredoc-sql: + - meta_include_prototype: false + - match: '' + push: scope:source.sql + with_prototype: + - include: interpolation + heredoc-javascript: + - meta_include_prototype: false + - match: '' + push: scope:source.js + with_prototype: + - include: interpolation + heredoc-json: + - meta_include_prototype: false + - match: '' + push: scope:source.json + with_prototype: + - include: interpolation + heredoc-css: + - meta_include_prototype: false + - match: '' + push: scope:source.css + with_prototype: + - include: interpolation instantiation: # anonymous class ( http://php.net/manual/en/language.oop5.anonymous.php ) - match: '(?i)(new)\s+(class)\b\s*' @@ -1045,23 +1334,32 @@ contexts: 1: punctuation.definition.variable.php 2: variable.other.php push: function-call-parameters + # Trailing underscores are allowed to prevent numbers from flickering while typing + # The underscore is for PHP 7.4: https://wiki.php.net/rfc/numeric_literal_separator numbers: - - match: '\b(0[bB])[01]*\b' + - match: '\b(0[bB])(?!_)([01]|_(?!_))*\b' scope: constant.numeric.integer.binary.php captures: 1: punctuation.definition.numeric.binary.php - - match: '\b(0[xX])\h*\b' + - match: '\b(0[xX])(?!_)(\h|_(?!_))*\b' scope: constant.numeric.integer.hexadecimal.php captures: 1: punctuation.definition.numeric.hexadecimal.php - match: |- (?x: - (?:(\b\d+|\B)\.\d+|\b\d+\.\d*)(?:[eE][+-]?\d+)?\b + (?: + (?# such as 123.4 or .123) + (?:\b(?!_)(?:\d|_(?!_))+|\B)\.(?!_)(?:\d|_(?!_))+ + | + (?# such as 123.) + \b(?!_)(?:\d|_(?!_))+\. + )(?:[eE][+-]?(?!_)(?:\d|_(?!_))+)?\b | - \b\d+(?:[eE][+-]?\d+)\b + (?# such as 123e-4) + \b(?!_)(?:\d|_(?!_))+(?:[eE][+-]?(?!_)(?:\d|_(?!_))+)\b ) scope: constant.numeric.float.decimal.php - - match: '\b\d+\b' + - match: '\b(?!_)(?:\d|_(?!_))+\b' scope: constant.numeric.integer.decimal.php object: - match: '(->)(\$?\{)' @@ -1123,7 +1421,7 @@ contexts: pop: true - include: class-name - include: constants - php_doc: + php-doc: # If the next line doesn't start with whitespace then an asterisk, the use # is either writing an invalid phpdoc comment, or not using phpdoc. Instead # of marking the comment as invalid, we just switch to a normal block-level @@ -1134,11 +1432,15 @@ contexts: - match: \*/ scope: punctuation.definition.comment.end.php pop: true - - match: ^\s*\*\s*(@access)\s+((public|private|protected)|(.+))\s*$ + - match: ^\s*(\*)\s*(@access)\s+((var|public|private|protected)|(.+))\s*$ captures: - 1: keyword.other.phpdoc.php - 3: storage.modifier.php - 4: invalid.illegal.wrong-access-type.phpdoc.php + 1: punctuation.definition.comment.php + 2: keyword.other.phpdoc.php + 4: storage.modifier.php + 5: invalid.illegal.wrong-access-type.phpdoc.php + - match: ^\s*(\*)(?!/) + captures: + 1: punctuation.definition.comment.php - match: "((https?|s?ftp|ftps|file|smb|afp|nfs|(x-)?man|gopher|txmt)://|mailto:)[-:@a-zA-Z0-9_.~%+/?=&#]*[-@a-zA-Z0-9_~%+/=&#]" scope: markup.underline.link.php - match: (@xlink)\s+(.+)\s*$ @@ -1147,6 +1449,9 @@ contexts: 2: markup.underline.link.php - match: \@(a(bstract|pi|uthor)|c(ategory|opyright)|example|global|i(nternal|gnore)|li(cense|nk)|pa(ckage|ram)|return|s(ee|ince|tatic|ubpackage)|t(hrows|odo)|v(ar|ersion)|uses|deprecated|fi(nal|lesource)|property(-(read|write))?|method|source)\b scope: keyword.other.phpdoc.php + - match: \{(@inheritdoc)\} + captures: + 1: keyword.other.phpdoc.php # Annotations from PHPUnit - match: \@(author|after(?:Class)?|backup(?:Globals|StaticAttributes)|before(?:Class)?|codeCoverageIgnore*|covers(?:DefaultClass|Nothing)?|dataProvider|depends|doesNotPerformAssertions|expectedException(?:Code|Message(?:RegExp)?)?|group|large|medium|preserveGlobalState|requires|run(TestsInSeparateProcesses|InSeparateProcess)|small|test(dox|With)?|ticket|uses)\b scope: keyword.other.phpunit.php @@ -1265,201 +1570,767 @@ contexts: - include: regex-single-quoted - include: string-single-quoted support: - - match: (?i)\bapc_(s(tore|ma_info)|c(ompile_file|lear_cache|a(s|che_info))|inc|de(c|fine_constants|lete(_file)?)|exists|fetch|load_constants|add|bin_(dump(file)?|load(file)?))\b + - match: |- + \b(?xi: + apc_add | apc_bin_dump | apc_bin_dumpfile | apc_bin_load | apc_bin_loadfile | apc_cache_info | apc_cas | apc_clear_cache | + apc_compile_file | apc_dec | apc_define_constants | apc_delete | apc_delete_file | apc_exists | apc_fetch | apc_inc | + apc_load_constants | apc_sma_info | apc_store + )\b scope: support.function.apc.php - - match: (?i)\b(s(huffle|izeof|ort)|n(ext|at(sort|casesort))|c(o(unt|mpact)|urrent)|in_array|u(sort|ksort|asort)|p(os|rev)|e(nd|ach|xtract)|k(sort|ey|rsort)|list|a(sort|r(sort|ray(_(s(hift|um|plice|earch|lice)|c(h(unk|ange_key_case)|o(unt_values|mbine))|intersect(_(u(key|assoc)|key|assoc))?|diff(_(u(key|assoc)|key|assoc))?|u(n(shift|ique)|intersect(_(uassoc|assoc))?|diff(_(uassoc|assoc))?)|p(op|ush|ad|roduct)|values|key(s|_exists)|f(il(ter|l(_keys)?)|lip)|walk(_recursive)?|r(e(duce|place(_recursive)?|verse)|and)|m(ultisort|erge(_recursive)?|ap)))?))|r(sort|eset|ange))\b + - match: |- + \b(?xi: + array | array_change_key_case | array_chunk | array_column | array_combine | array_count_values | array_diff | array_diff_assoc | + array_diff_key | array_diff_uassoc | array_diff_ukey | array_fill | array_fill_keys | array_filter | array_flip | array_intersect | + array_intersect_assoc | array_intersect_key | array_intersect_uassoc | array_intersect_ukey | array_key_exists | array_keys | array_map | array_merge | + array_merge_recursive | array_multisort | array_pad | array_pop | array_product | array_push | array_rand | array_reduce | + array_replace | array_replace_recursive | array_reverse | array_search | array_shift | array_slice | array_splice | array_sum | + array_udiff | array_udiff_assoc | array_udiff_uassoc | array_uintersect | array_uintersect_assoc | array_uintersect_uassoc | array_unique | array_unshift | + array_values | array_walk | array_walk_recursive | arsort | asort | compact | count | current | + each | end | extract | in_array | key | krsort | ksort | list | + natcasesort | natsort | next | pos | prev | range | reset | rsort | + shuffle | sizeof | sort | uasort | uksort | usort + )\b scope: support.function.array.php - - match: (?i)\b(s(how_source|ys_getloadavg|leep)|highlight_(string|file)|con(stant|nection_(status|timeout|aborted))|time_(sleep_until|nanosleep)|ignore_user_abort|d(ie|efine(d)?)|u(sleep|n(iqid|pack))|__halt_compiler|p(hp_(strip_whitespace|check_syntax)|ack)|e(val|xit)|get_browser)\b + - match: |- + \b(?xi: + __halt_compiler | connection_aborted | connection_status | connection_timeout | constant | define | defined | die | + eval | exit | get_browser | highlight_file | highlight_string | ignore_user_abort | pack | php_check_syntax | + php_strip_whitespace | show_source | sleep | sys_getloadavg | time_nanosleep | time_sleep_until | uniqid | unpack | + usleep + )\b scope: support.function.basic_functions.php - - match: (?i)\bbc(s(cale|ub|qrt)|comp|div|pow(mod)?|add|m(od|ul))\b + - match: |- + \b(?xi: + bcadd | bccomp | bcdiv | bcmod | bcmul | bcpow | bcpowmod | bcscale | + bcsqrt | bcsub + )\b scope: support.function.bcmath.php - - match: (?i)\bbz(c(ompress|lose)|open|decompress|err(str|no|or)|flush|write|read)\b + - match: |- + \b(?xi: + bzclose | bzcompress | bzdecompress | bzerrno | bzerror | bzerrstr | bzflush | bzopen | + bzread | bzwrite + )\b scope: support.function.bz2.php - - match: (?i)\b(GregorianToJD|cal_(to_jd|info|days_in_month|from_jd)|unixtojd|jdto(unix|jewish)|easter_da(ys|te)|J(ulianToJD|ewishToJD|D(MonthName|To(Gregorian|Julian|French)|DayOfWeek))|FrenchToJD)\b + - match: |- + \b(?xi: + FrenchToJD | GregorianToJD | JDDayOfWeek | JDMonthName | JDToFrench | JDToGregorian | JDToJulian | JewishToJD | + JulianToJD | cal_days_in_month | cal_from_jd | cal_info | cal_to_jd | easter_date | easter_days | jdtojewish | + jdtounix | unixtojd + )\b scope: support.function.calendar.php - - match: (?i)\b(c(lass_(exists|alias)|all_user_method(_array)?)|i(s_(subclass_of|a)|nterface_exists)|property_exists|get_(c(lass(_(vars|methods))?|alled_class)|object_vars|declared_(classes|interfaces)|parent_class)|method_exists)\b + - match: |- + \b(?xi: + call_user_method | call_user_method_array | class_alias | class_exists | get_called_class | get_class | get_class_methods | get_class_vars | + get_declared_classes | get_declared_interfaces | get_object_vars | get_parent_class | interface_exists | is_a | is_subclass_of | method_exists | + property_exists + )\b scope: support.function.classobj.php - - match: (?i)\b(com_(set|create_guid|i(senum|nvoke)|pr(int_typeinfo|op(set|put|get))|event_sink|load(_typelib)?|addref|release|get(_active_object)?|message_pump)|variant_(s(ub|et(_type)?)|n(ot|eg)|c(a(st|t)|mp)|i(nt|div|mp)|or|d(iv|ate_(to_timestamp|from_timestamp))|pow|eqv|fix|a(nd|dd|bs)|round|get_type|xor|m(od|ul)))\b + - match: |- + \b(?xi: + com_addref | com_create_guid | com_event_sink | com_get | com_get_active_object | com_invoke | com_isenum | com_load | + com_load_typelib | com_message_pump | com_print_typeinfo | com_propget | com_propput | com_propset | com_release | com_set | + variant_abs | variant_add | variant_and | variant_cast | variant_cat | variant_cmp | variant_date_from_timestamp | variant_date_to_timestamp | + variant_div | variant_eqv | variant_fix | variant_get_type | variant_idiv | variant_imp | variant_int | variant_mod | + variant_mul | variant_neg | variant_not | variant_or | variant_pow | variant_round | variant_set | variant_set_type | + variant_sub | variant_xor + )\b scope: support.function.com.php - - match: (?i)\brandom_(bytes|int)\b + - match: |- + \b(?xi: + random_bytes | random_int + )\b scope: support.function.csprng.php - - match: (?i)\bctype_(space|cntrl|digit|upper|p(unct|rint)|lower|al(num|pha)|graph|xdigit)\b + - match: |- + \b(?xi: + ctype_alnum | ctype_alpha | ctype_cntrl | ctype_digit | ctype_graph | ctype_lower | ctype_print | ctype_punct | + ctype_space | ctype_upper | ctype_xdigit + )\b scope: support.function.ctype.php - - match: (?i)\bcurl_(setopt(_array)?|c(opy_handle|lose)|init|e(rr(no|or)|xec)|version|getinfo|multi_(select|close|in(it|fo_read)|exec|add_handle|remove_handle|getcontent))\b + - match: |- + \b(?xi: + curl_close | curl_copy_handle | curl_errno | curl_error | curl_exec | curl_getinfo | curl_init | curl_multi_add_handle | + curl_multi_close | curl_multi_exec | curl_multi_getcontent | curl_multi_info_read | curl_multi_init | curl_multi_remove_handle | curl_multi_select | curl_setopt | + curl_setopt_array | curl_version + )\b scope: support.function.curl.php - - match: (?i)\b(str(totime|ptime|ftime)|checkdate|time(zone_(name_(from_abbr|get)|transitions_get|identifiers_list|o(pen|ffset_get)|version_get|location_get|abbreviations_list))?|idate|date(_(su(n(set|_info|rise)|b)|create(_from_format)?|time(stamp_(set|get)|zone_(set|get)|_set)|i(sodate_set|nterval_(create_from_date_string|format))|offset_get|d(iff|efault_timezone_(set|get)|ate_set)|parse(_from_format)?|format|add|get_last_errors|modify))?|localtime|g(et(timeofday|date)|m(strftime|date|mktime))|m(icrotime|ktime))\b + - match: |- + \b(?xi: + checkdate | date | date_add | date_create | date_create_from_format | date_date_set | date_default_timezone_get | date_default_timezone_set | + date_diff | date_format | date_get_last_errors | date_interval_create_from_date_string | date_interval_format | date_isodate_set | date_modify | date_offset_get | + date_parse | date_parse_from_format | date_sub | date_sun_info | date_sunrise | date_sunset | date_time_set | date_timestamp_get | + date_timestamp_set | date_timezone_get | date_timezone_set | getdate | gettimeofday | gmdate | gmmktime | gmstrftime | + hrtime | idate | localtime | microtime | mktime | strftime | strptime | strtotime | + time | timezone_abbreviations_list | timezone_identifiers_list | timezone_location_get | timezone_name_from_abbr | timezone_name_get | timezone_offset_get | timezone_open | + timezone_transitions_get | timezone_version_get + )\b scope: support.function.datetime.php - - match: (?i)\bdba_(sync|handlers|nextkey|close|insert|op(timize|en)|delete|popen|exists|key_split|f(irstkey|etch)|list|replace)\b + - match: |- + \b(?xi: + dba_close | dba_delete | dba_exists | dba_fetch | dba_firstkey | dba_handlers | dba_insert | dba_key_split | + dba_list | dba_nextkey | dba_open | dba_optimize | dba_popen | dba_replace | dba_sync + )\b scope: support.function.dba.php - - match: (?i)\bdbx_(sort|c(o(nnect|mpare)|lose)|e(scape_string|rror)|query|fetch_row)\b + - match: |- + \b(?xi: + dbx_close | dbx_compare | dbx_connect | dbx_error | dbx_escape_string | dbx_fetch_row | dbx_query | dbx_sort + )\b scope: support.function.dbx.php - - match: (?i)\b(scandir|c(h(dir|root)|losedir)|opendir|dir|re(winddir|addir)|getcwd)\b + - match: |- + \b(?xi: + chdir | chroot | closedir | dir | getcwd | opendir | readdir | rewinddir | + scandir + )\b scope: support.function.dir.php - - match: (?i)\b(domxml_(new_doc|open_(file|mem)|version|x(slt_(stylesheet(_(doc|file))?|version)|mltree))|xp(tr_(new_context|eval)|ath_(new_context|eval(_expression)?|register_ns(_auto)?)))\b + - match: |- + \b(?xi: + domxml_new_doc | domxml_open_file | domxml_open_mem | domxml_version | domxml_xmltree | domxml_xslt_stylesheet | domxml_xslt_stylesheet_doc | domxml_xslt_stylesheet_file | + domxml_xslt_version | xpath_eval | xpath_eval_expression | xpath_new_context | xpath_register_ns | xpath_register_ns_auto | xptr_eval | xptr_new_context + )\b scope: support.function.domxml.php - - match: (?i)\bdotnet_load\b + - match: |- + \b(?xi: + dotnet_load + )\b scope: support.function.dotnet.php - - match: (?i)\benchant_(dict_(s(tore_replacement|uggest)|check|is_in_session|describe|quick_check|add_to_(session|personal)|get_error)|broker_(set_ordering|init|d(ict_exists|escribe)|free(_dict)?|list_dicts|request_(dict|pwl_dict)|get_error))\b + - match: |- + \b(?xi: + enchant_broker_describe | enchant_broker_dict_exists | enchant_broker_free | enchant_broker_free_dict | enchant_broker_get_error | enchant_broker_init | enchant_broker_list_dicts | enchant_broker_request_dict | + enchant_broker_request_pwl_dict | enchant_broker_set_ordering | enchant_dict_add_to_personal | enchant_dict_add_to_session | enchant_dict_check | enchant_dict_describe | enchant_dict_get_error | enchant_dict_is_in_session | + enchant_dict_quick_check | enchant_dict_store_replacement | enchant_dict_suggest + )\b scope: support.function.enchant.php - - match: (?i)\b(s(plit(i)?|ql_regcase)|ereg(i(_replace)?|_replace)?)\b + - match: |- + \b(?xi: + ereg | ereg_replace | eregi | eregi_replace | split | spliti | sql_regcase + )\b scope: support.function.ereg.php - - match: (?i)\b(set_e(rror_handler|xception_handler)|trigger_error|debug_(print_backtrace|backtrace)|user_error|error_(log|reporting|get_last)|restore_e(rror_handler|xception_handler))\b + - match: |- + \b(?xi: + debug_backtrace | debug_print_backtrace | error_clear_last | error_get_last | error_log | error_reporting | restore_error_handler | restore_exception_handler | + set_error_handler | set_exception_handler | trigger_error | user_error + )\b scope: support.function.errorfunc.php - - match: (?i)\b(s(hell_exec|ystem)|p(assthru|roc_(nice|close|terminate|open|get_status))|e(scapeshell(cmd|arg)|xec))\b + - match: |- + \b(?xi: + escapeshellarg | escapeshellcmd | exec | passthru | proc_close | proc_get_status | proc_nice | proc_open | + proc_terminate | shell_exec | system + )\b scope: support.function.exec.php - - match: (?i)\b(exif_(t(humbnail|agname)|imagetype|read_data)|read_exif_data)\b + - match: |- + \b(?xi: + exif_imagetype | exif_read_data | exif_tagname | exif_thumbnail | read_exif_data + )\b scope: support.function.exif.php - - match: (?i)\b(s(ymlink|tat|et_file_buffer)|c(h(own|grp|mod)|opy|learstatcache)|t(ouch|empnam|mpfile)|is_(dir|uploaded_file|executable|file|writ(eable|able)|link|readable)|d(i(sk(_(total_space|free_space)|freespace)|rname)|elete)|u(nlink|mask)|p(close|open|a(thinfo|rse_ini_(string|file)))|f(s(canf|tat|eek)|nmatch|close|t(ell|runcate)|ile(size|ctime|type|inode|owner|_(put_contents|exists|get_contents)|perms|atime|group|mtime)?|open|p(ut(s|csv)|assthru)|eof|flush|write|lock|read|get(s(s)?|c(sv)?))|l(stat|ch(own|grp)|ink(info)?)|r(e(name|wind|a(d(file|link)|lpath(_cache_(size|get))?))|mdir)|glob|m(ove_uploaded_file|kdir)|basename)\b + - match: |- + \b(?xi: + basename | chgrp | chmod | chown | clearstatcache | copy | delete | dirname | + disk_free_space | disk_total_space | diskfreespace | fclose | feof | fflush | fgetc | fgetcsv | + fgets | fgetss | file | file_exists | file_get_contents | file_put_contents | fileatime | filectime | + filegroup | fileinode | filemtime | fileowner | fileperms | filesize | filetype | flock | + fnmatch | fopen | fpassthru | fputcsv | fputs | fread | fscanf | fseek | + fstat | ftell | ftruncate | fwrite | glob | is_dir | is_executable | is_file | + is_link | is_readable | is_uploaded_file | is_writable | is_writeable | lchgrp | lchown | link | + linkinfo | lstat | mkdir | move_uploaded_file | parse_ini_file | parse_ini_string | pathinfo | pclose | + popen | readfile | readlink | realpath | realpath_cache_get | realpath_cache_size | rename | rewind | + rmdir | set_file_buffer | stat | symlink | tempnam | tmpfile | touch | umask | + unlink + )\b scope: support.function.file.php - - match: (?i)\b(finfo_(set_flags|close|open|file|buffer)|mime_content_type)\b + - match: |- + \b(?xi: + finfo_buffer | finfo_close | finfo_file | finfo_open | finfo_set_flags | mime_content_type + )\b scope: support.function.fileinfo.php - - match: (?i)\bfilter_(has_var|i(nput(_array)?|d)|var(_array)?|list)\b + - match: |- + \b(?xi: + filter_has_var | filter_id | filter_input | filter_input_array | filter_list | filter_var | filter_var_array + )\b scope: support.function.filter.php - - match: (?i)\b(c(all_user_func(_array)?|reate_function)|unregister_tick_function|f(orward_static_call(_array)?|unc(tion_exists|_(num_args|get_arg(s)?)))|register_(shutdown_function|tick_function)|get_defined_functions)\b + - match: |- + \b(?xi: + call_user_func | call_user_func_array | create_function | forward_static_call | forward_static_call_array | func_get_arg | func_get_args | func_num_args | + function_exists | get_defined_functions | register_shutdown_function | register_tick_function | unregister_tick_function + )\b scope: support.function.funchand.php - - match: (?i)\b(ngettext|textdomain|d(ngettext|c(ngettext|gettext)|gettext)|gettext|bind(textdomain|_textdomain_codeset))\b + - match: |- + \b(?xi: + bind_textdomain_codeset | bindtextdomain | dcgettext | dcngettext | dgettext | dngettext | gettext | ngettext | + textdomain + )\b scope: support.function.gettext.php - - match: (?i)\bgmp_(s(can(1|0)|trval|ign|ub|etbit|qrt(rem)?)|hamdist|ne(g|xtprime)|c(om|lrbit|mp)|testbit|in(tval|it|vert)|or|div(_(q(r)?|r)|exact)?|jacobi|p(o(pcount|w(m)?)|erfect_square|rob_prime)|fact|legendre|a(nd|dd|bs)|random|gcd(ext)?|xor|m(od|ul))\b + - match: |- + \b(?xi: + gmp_abs | gmp_add | gmp_and | gmp_binomial | gmp_clrbit | gmp_cmp | gmp_com | gmp_div | + gmp_fact | gmp_gcd | gmp_gcdext | gmp_hamdist | gmp_init | gmp_intval | gmp_invert | gmp_jacobi | + gmp_kronecker | gmp_kronecker_q | gmp_kronecker_qr | gmp_kronecker_r | gmp_kroneckerexact | gmp_lcm | gmp_legendre | gmp_mod | + gmp_mul | gmp_neg | gmp_nextprime | gmp_or | gmp_perfect_power | gmp_perfect_square | gmp_popcount | gmp_pow | + gmp_powm | gmp_prob_prime | gmp_random | gmp_scan0 | gmp_scan1 | gmp_setbit | gmp_sign | gmp_sqrt | + gmp_sqrtrem | gmp_strval | gmp_sub | gmp_testbit | gmp_xor + )\b scope: support.function.gmp.php - - match: (?i)\bhash(_(hmac(_file)?|copy|init|update(_(stream|file))?|fi(nal|le)|algos))?\b + - match: |- + \b(?xi: + hash | hash_algos | hash_copy | hash_file | hash_final | hash_hkdf | hash_hmac | hash_hmac_file | + hash_init | hash_update | hash_update_file | hash_update_stream + )\b scope: support.function.hash.php - - match: (?i)\b(http_(s(upport|end_(st(atus|ream)|content_(type|disposition)|data|file|last_modified))|head|negotiate_(c(harset|ontent_type)|language)|c(hunked_decode|ache_(etag|last_modified))|throttle|inflate|d(eflate|ate)|p(ost_(data|fields)|ut_(stream|data|file)|ersistent_handles_(c(ount|lean)|ident)|arse_(headers|cookie|params|message))|re(direct|quest(_(method_(name|unregister|exists|register)|body_encode))?)|get(_request_(headers|body(_stream)?))?|match_(etag|request_header|modified)|build_(str|cookie|url))|ob_(inflatehandler|deflatehandler|etaghandler))\b + - match: |- + \b(?xi: + http_build_cookie | http_build_str | http_build_url | http_cache_etag | http_cache_last_modified | http_chunked_decode | http_date | http_deflate | + http_get | http_get_request_body | http_get_request_body_stream | http_get_request_headers | http_head | http_inflate | http_match_etag | http_match_modified | + http_match_request_header | http_negotiate_charset | http_negotiate_content_type | http_negotiate_language | http_parse_cookie | http_parse_headers | http_parse_message | http_parse_params | + http_persistent_handles_clean | http_persistent_handles_count | http_persistent_handles_ident | http_post_data | http_post_fields | http_put_data | http_put_file | http_put_stream | + http_redirect | http_request | http_request_body_encode | http_request_method_exists | http_request_method_name | http_request_method_register | http_request_method_unregister | http_response_code | + http_send_content_disposition | http_send_content_type | http_send_data | http_send_file | http_send_last_modified | http_send_status | http_send_stream | http_support | + http_throttle | ob_deflatehandler | ob_etaghandler | ob_inflatehandler + )\b scope: support.function.http.php - - match: (?i)\b(iconv(_(s(tr(pos|len|rpos)|ubstr|et_encoding)|get_encoding|mime_(decode(_headers)?|encode)))?|ob_iconv_handler)\b + - match: |- + \b(?xi: + iconv | iconv_get_encoding | iconv_mime_decode | iconv_mime_decode_headers | iconv_mime_encode | iconv_set_encoding | iconv_strlen | iconv_strpos | + iconv_strrpos | iconv_substr | ob_iconv_handler + )\b scope: support.function.iconv.php - - match: (?i)\biis_(s(t(op_serv(ice|er)|art_serv(ice|er))|et_(s(cript_map|erver_rights)|dir_security|app_settings))|add_server|remove_server|get_(s(cript_map|erv(ice_state|er_(rights|by_(comment|path))))|dir_security))\b + - match: |- + \b(?xi: + iis_add_server | iis_get_dir_security | iis_get_script_map | iis_get_server_by_comment | iis_get_server_by_path | iis_get_server_rights | iis_get_service_state | iis_remove_server | + iis_set_app_settings | iis_set_dir_security | iis_set_script_map | iis_set_server_rights | iis_start_server | iis_start_service | iis_stop_server | iis_stop_service + )\b scope: support.function.iisfunc.php - - match: (?i)\b(i(ptc(parse|embed)|mage(s(y|tring(up)?|et(style|t(hickness|ile)|pixel|brush)|avealpha|x)|c(har(up)?|o(nvolution|py(res(ized|ampled)|merge(gray)?)?|lor(s(total|et|forindex)|closest(hwb|alpha)?|transparent|deallocate|exact(alpha)?|a(t|llocate(alpha)?)|resolve(alpha)?|match))|reate(truecolor|from(string|jpeg|png|wbmp|g(if|d(2(part)?)?)|x(pm|bm)))?)|t(ypes|tf(text|bbox)|ruecolortopalette)|i(struecolor|nterlace)|2wbmp|d(estroy|ashedline)|jpeg|_type_to_(extension|mime_type)|p(s(slantfont|text|e(ncodefont|xtendfont)|freefont|loadfont|bbox)|ng|olygon|alettecopy)|ellipse|f(t(text|bbox)|il(ter|l(toborder|ed(polygon|ellipse|arc|rectangle))?)|ont(height|width))|wbmp|l(ine|oadfont|ayereffect)|a(ntialias|lphablending|rc)|r(otate|ectangle)|g(if|d(2)?|ammacorrect|rab(screen|window))|xbm))|jpeg2wbmp|png2wbmp|g(d_info|etimagesize))\b + - match: |- + \b(?xi: + gd_info | getimagesize | image2wbmp | image_type_to_extension | image_type_to_mime_type | imagealphablending | imageantialias | imagearc | + imagechar | imagecharup | imagecolorallocate | imagecolorallocatealpha | imagecolorat | imagecolorclosest | imagecolorclosestalpha | imagecolorclosesthwb | + imagecolordeallocate | imagecolorexact | imagecolorexactalpha | imagecolormatch | imagecolorresolve | imagecolorresolvealpha | imagecolorset | imagecolorsforindex | + imagecolorstotal | imagecolortransparent | imageconvolution | imagecopy | imagecopymerge | imagecopymergegray | imagecopyresampled | imagecopyresized | + imagecreate | imagecreatefromgd | imagecreatefromgd2 | imagecreatefromgd2part | imagecreatefromgif | imagecreatefromjpeg | imagecreatefrompng | imagecreatefromstring | + imagecreatefromwbmp | imagecreatefromxbm | imagecreatefromxpm | imagecreatetruecolor | imagedashedline | imagedestroy | imageellipse | imagefill | + imagefilledarc | imagefilledellipse | imagefilledpolygon | imagefilledrectangle | imagefilltoborder | imagefilter | imagefontheight | imagefontwidth | + imageftbbox | imagefttext | imagegammacorrect | imagegd | imagegd2 | imagegif | imagegrabscreen | imagegrabwindow | + imageinterlace | imageistruecolor | imagejpeg | imagelayereffect | imageline | imageloadfont | imagepalettecopy | imagepng | + imagepolygon | imagepsbbox | imagepsencodefont | imagepsextendfont | imagepsfreefont | imagepsloadfont | imagepsslantfont | imagepstext | + imagerectangle | imagerotate | imagesavealpha | imagesetbrush | imagesetpixel | imagesetstyle | imagesetthickness | imagesettile | + imagestring | imagestringup | imagesx | imagesy | imagetruecolortopalette | imagettfbbox | imagettftext | imagetypes | + imagewbmp | imagexbm | iptcembed | iptcparse | jpeg2wbmp | png2wbmp + )\b scope: support.function.image.php - - match: (?i)\b(s(ys_get_temp_dir|et_(time_limit|include_path|magic_quotes_runtime))|ini_(set|alter|restore|get(_all)?)|zend_(thread_id|version|logo_guid)|dl|p(hp(credits|info|_(sapi_name|ini_(scanned_files|loaded_file)|uname|logo_guid)|version)|utenv)|extension_loaded|version_compare|assert(_options)?|restore_include_path|g(c_(collect_cycles|disable|enable(d)?)|et(opt|_(c(urrent_user|fg_var)|include(d_files|_path)|defined_constants|extension_funcs|loaded_extensions|required_files|magic_quotes_(runtime|gpc))|env|lastmod|rusage|my(inode|uid|pid|gid)))|m(emory_get_(usage|peak_usage)|a(in|gic_quotes_runtime)))\b + - match: |- + \b(?xi: + assert | assert_options | dl | extension_loaded | gc_collect_cycles | gc_disable | gc_enable | gc_enabled | + get_cfg_var | get_current_user | get_defined_constants | get_extension_funcs | get_include_path | get_included_files | get_loaded_extensions | get_magic_quotes_gpc | + get_magic_quotes_runtime | get_required_files | getenv | getlastmod | getmygid | getmyinode | getmypid | getmyuid | + getopt | getrusage | ini_alter | ini_get | ini_get_all | ini_restore | ini_set | magic_quotes_runtime | + main | memory_get_peak_usage | memory_get_usage | php_ini_loaded_file | php_ini_scanned_files | php_logo_guid | php_sapi_name | php_uname | + phpcredits | phpinfo | phpversion | putenv | restore_include_path | set_include_path | set_magic_quotes_runtime | set_time_limit | + sys_get_temp_dir | version_compare | zend_logo_guid | zend_thread_id | zend_version + )\b scope: support.function.info.php - - match: (?i)\bibase_(se(t_event_handler|rv(ice_(detach|attach)|er_info))|n(um_(params|fields)|ame_result)|c(o(nnect|mmit(_ret)?)|lose)|t(imefmt|rans)|d(elete_user|rop_db|b_info)|p(connect|aram_info|repare)|e(rr(code|msg)|xecute)|query|f(ield_info|etch_(object|assoc|row)|ree_(event_handler|query|result))|wait_event|a(dd_user|ffected_rows)|r(ollback(_ret)?|estore)|gen_id|m(odify_user|aintain_db)|b(lob_(c(lose|ancel|reate)|i(nfo|mport)|open|echo|add|get)|ackup))\b + - match: |- + \b(?xi: + ibase_add_user | ibase_affected_rows | ibase_backup | ibase_blob_add | ibase_blob_cancel | ibase_blob_close | ibase_blob_create | ibase_blob_echo | + ibase_blob_get | ibase_blob_import | ibase_blob_info | ibase_blob_open | ibase_close | ibase_commit | ibase_commit_ret | ibase_connect | + ibase_db_info | ibase_delete_user | ibase_drop_db | ibase_errcode | ibase_errmsg | ibase_execute | ibase_fetch_assoc | ibase_fetch_object | + ibase_fetch_row | ibase_field_info | ibase_free_event_handler | ibase_free_query | ibase_free_result | ibase_gen_id | ibase_maintain_db | ibase_modify_user | + ibase_name_result | ibase_num_fields | ibase_num_params | ibase_param_info | ibase_pconnect | ibase_prepare | ibase_query | ibase_restore | + ibase_rollback | ibase_rollback_ret | ibase_server_info | ibase_service_attach | ibase_service_detach | ibase_set_event_handler | ibase_timefmt | ibase_trans | + ibase_wait_event + )\b scope: support.function.interbase.php - - match: (?i)\b(n(ormalizer_(normalize|is_normalized)|umfmt_(set_(symbol|text_attribute|pattern|attribute)|create|parse(_currency)?|format(_currency)?|get_(symbol|text_attribute|pattern|error_(code|message)|locale|attribute)))|collator_(s(ort(_with_sort_keys)?|et_(strength|attribute))|c(ompare|reate)|asort|get_(s(trength|ort_key)|error_(code|message)|locale|attribute))|transliterator_(create(_(inverse|from_rules))?|transliterate|list_ids|get_error_(code|message))|i(ntl_(is_failure|error_name|get_error_(code|message))|dn_to_(u(nicode|tf8)|ascii))|datefmt_(set_(calendar|timezone_id|pattern|lenient)|create|is_lenient|parse|format|localtime|get_(calendar|time(type|zone_id)|datetype|pattern|error_(code|message)|locale))|locale_(set_default|compose|parse|filter_matches|lookup|accept_from_http|get_(script|d(isplay_(script|name|variant|language|region)|efault)|primary_language|keywords|all_variants|region))|resourcebundle_(c(ount|reate)|locales|get(_error_(code|message))?)|grapheme_(s(tr(str|i(str|pos)|pos|len|r(ipos|pos))|ubstr)|extract)|msgfmt_(set_pattern|create|parse(_message)?|format(_message)?|get_(pattern|error_(code|message)|locale)))\b + - match: |- + \b(?xi: + collator_asort | collator_compare | collator_create | collator_get_attribute | collator_get_error_code | collator_get_error_message | collator_get_locale | collator_get_sort_key | + collator_get_strength | collator_set_attribute | collator_set_strength | collator_sort | collator_sort_with_sort_keys | datefmt_create | datefmt_format | datefmt_get_calendar | + datefmt_get_datetype | datefmt_get_error_code | datefmt_get_error_message | datefmt_get_locale | datefmt_get_pattern | datefmt_get_timetype | datefmt_get_timezone_id | datefmt_is_lenient | + datefmt_localtime | datefmt_parse | datefmt_set_calendar | datefmt_set_lenient | datefmt_set_pattern | datefmt_set_timezone_id | grapheme_extract | grapheme_stripos | + grapheme_stristr | grapheme_strlen | grapheme_strpos | grapheme_strripos | grapheme_strrpos | grapheme_strstr | grapheme_substr | idn_to_ascii | + idn_to_unicode | idn_to_utf8 | intl_error_name | intl_get_error_code | intl_get_error_message | intl_is_failure | locale_accept_from_http | locale_compose | + locale_filter_matches | locale_get_all_variants | locale_get_default | locale_get_display_language | locale_get_display_name | locale_get_display_region | locale_get_display_script | locale_get_display_variant | + locale_get_keywords | locale_get_primary_language | locale_get_region | locale_get_script | locale_lookup | locale_parse | locale_set_default | msgfmt_create | + msgfmt_format | msgfmt_format_message | msgfmt_get_error_code | msgfmt_get_error_message | msgfmt_get_locale | msgfmt_get_pattern | msgfmt_parse | msgfmt_parse_message | + msgfmt_set_pattern | normalizer_is_normalized | normalizer_normalize | numfmt_create | numfmt_format | numfmt_format_currency | numfmt_get_attribute | numfmt_get_error_code | + numfmt_get_error_message | numfmt_get_locale | numfmt_get_pattern | numfmt_get_symbol | numfmt_get_text_attribute | numfmt_parse | numfmt_parse_currency | numfmt_set_attribute | + numfmt_set_pattern | numfmt_set_symbol | numfmt_set_text_attribute | resourcebundle_count | resourcebundle_create | resourcebundle_get | resourcebundle_get_error_code | resourcebundle_get_error_message | + resourcebundle_locales | transliterator_create | transliterator_create_from_rules | transliterator_create_inverse | transliterator_get_error_code | transliterator_get_error_message | transliterator_list_ids | transliterator_transliterate + )\b scope: support.function.intl.php - - match: (?i)\bjson_(decode|encode|last_error)\b + - match: |- + \b(?xi: + json_decode | json_encode | json_last_error + )\b scope: support.function.json.php - - match: (?i)\bldap_(s(tart_tls|ort|e(t_(option|rebind_proc)|arch)|asl_bind)|next_(entry|attribute|reference)|c(o(nnect|unt_entries|mpare)|lose)|t61_to_8859|d(n2ufn|elete)|8859_to_t61|unbind|parse_re(sult|ference)|e(rr(no|2str|or)|xplode_dn)|f(irst_(entry|attribute|reference)|ree_result)|list|add|re(name|ad)|get_(option|dn|entries|values(_len)?|attributes)|mod(ify|_(del|add|replace))|bind)\b + - match: |- + \b(?xi: + ldap_8859_to_t61 | ldap_add | ldap_bind | ldap_close | ldap_compare | ldap_connect | ldap_count_entries | ldap_delete | + ldap_dn2ufn | ldap_err2str | ldap_errno | ldap_error | ldap_explode_dn | ldap_first_attribute | ldap_first_entry | ldap_first_reference | + ldap_free_result | ldap_get_attributes | ldap_get_dn | ldap_get_entries | ldap_get_option | ldap_get_values | ldap_get_values_len | ldap_list | + ldap_mod_add | ldap_mod_del | ldap_mod_replace | ldap_modify | ldap_next_attribute | ldap_next_entry | ldap_next_reference | ldap_parse_reference | + ldap_parse_result | ldap_read | ldap_rename | ldap_sasl_bind | ldap_search | ldap_set_option | ldap_set_rebind_proc | ldap_sort | + ldap_start_tls | ldap_t61_to_8859 | ldap_unbind + )\b scope: support.function.ldap.php - - match: (?i)\blibxml_(set_streams_context|clear_errors|disable_entity_loader|use_internal_errors|get_(errors|last_error))\b + - match: |- + \b(?xi: + libxml_clear_errors | libxml_disable_entity_loader | libxml_get_errors | libxml_get_last_error | libxml_set_streams_context | libxml_use_internal_errors + )\b scope: support.function.libxml.php - - match: (?i)\b(ezmlm_hash|mail)\b + - match: |- + \b(?xi: + ezmlm_hash | mail + )\b scope: support.function.mail.php - - match: (?i)\b(s(in(h)?|qrt|rand)|h(ypot|exdec)|c(os(h)?|eil)|tan(h)?|intdiv|is_(nan|infinite|finite)|octdec|de(c(hex|oct|bin)|g2rad)|p(i|ow)|exp(m1)?|f(loor|mod)|l(cg_value|og(1(p|0))?)|a(sin(h)?|cos(h)?|tan(h|2)?|bs)|r(ound|a(nd|d2deg))|getrandmax|m(t_(srand|rand|getrandmax)|in|ax)|b(indec|ase_convert))\b + - match: |- + \b(?xi: + abs | acos | acosh | asin | asinh | atan | atan2 | atanh | + base_convert | bindec | ceil | cos | cosh | decbin | dechex | decoct | + deg2rad | exp | expm1 | floor | fmod | getrandmax | hexdec | hypot | + intdiv | is_finite | is_infinite | is_nan | lcg_value | log | log10 | log1p | + max | min | mt_getrandmax | mt_rand | mt_srand | octdec | pi | pow | + rad2deg | rand | round | sin | sinh | sqrt | srand | tan | + tanh + )\b scope: support.function.math.php - - match: (?i)\bmb_(s(tr(str|cut|to(upper|lower)|i(str|pos|mwidth)|pos|width|len|r(chr|i(chr|pos)|pos))|ubst(itute_character|r(_count)?)|plit|end_mail)|http_(input|output)|c(heck_encoding|onvert_(case|encoding|variables|kana))|internal_encoding|output_handler|de(code_(numericentity|mimeheader)|tect_(order|encoding))|p(arse_str|referred_mime_name)|e(ncod(ing_aliases|e_(numericentity|mimeheader))|reg(i(_replace)?|_(search(_(setpos|init|pos|regs|get(pos|regs)))?|replace|match))?)|l(ist_encodings|anguage)|regex_(set_options|encoding)|get_info)\b + - match: |- + \b(?xi: + mb_check_encoding | mb_convert_case | mb_convert_encoding | mb_convert_kana | mb_convert_variables | mb_decode_mimeheader | mb_decode_numericentity | mb_detect_encoding | + mb_detect_order | mb_encode_mimeheader | mb_encode_numericentity | mb_encoding_aliases | mb_ereg | mb_ereg_match | mb_ereg_replace | mb_ereg_search | + mb_ereg_search_getpos | mb_ereg_search_getregs | mb_ereg_search_init | mb_ereg_search_pos | mb_ereg_search_regs | mb_ereg_search_setpos | mb_eregi | mb_eregi_replace | + mb_get_info | mb_http_input | mb_http_output | mb_internal_encoding | mb_language | mb_list_encodings | mb_output_handler | mb_parse_str | + mb_preferred_mime_name | mb_regex_encoding | mb_regex_set_options | mb_send_mail | mb_split | mb_strcut | mb_strimwidth | mb_stripos | + mb_stristr | mb_strlen | mb_strpos | mb_strrchr | mb_strrichr | mb_strripos | mb_strrpos | mb_strstr | + mb_strtolower | mb_strtoupper | mb_strwidth | mb_substitute_character | mb_substr | mb_substr_count + )\b scope: support.function.mbstring.php - - match: (?i)\bm(crypt_(c(fb|reate_iv|bc)|ofb|decrypt|e(nc(_(self_test|is_block_(algorithm(_mode)?|mode)|get_(supported_key_sizes|iv_size|key_size|algorithms_name|modes_name|block_size))|rypt)|cb)|list_(algorithms|modes)|ge(neric(_(init|deinit|end))?|t_(cipher_name|iv_size|key_size|block_size))|module_(self_test|close|is_block_(algorithm(_mode)?|mode)|open|get_(supported_key_sizes|algo_(key_size|block_size))))|decrypt_generic)\b + - match: |- + \b(?xi: + mcrypt_cbc | mcrypt_cfb | mcrypt_create_iv | mcrypt_decrypt | mcrypt_ecb | mcrypt_enc_get_algorithms_name | mcrypt_enc_get_block_size | mcrypt_enc_get_iv_size | + mcrypt_enc_get_key_size | mcrypt_enc_get_modes_name | mcrypt_enc_get_supported_key_sizes | mcrypt_enc_is_block_algorithm | mcrypt_enc_is_block_algorithm_mode | mcrypt_enc_is_block_mode | mcrypt_enc_self_test | mcrypt_encrypt | + mcrypt_generic | mcrypt_generic_deinit | mcrypt_generic_end | mcrypt_generic_init | mcrypt_get_block_size | mcrypt_get_cipher_name | mcrypt_get_iv_size | mcrypt_get_key_size | + mcrypt_list_algorithms | mcrypt_list_modes | mcrypt_module_close | mcrypt_module_get_algo_block_size | mcrypt_module_get_algo_key_size | mcrypt_module_get_supported_key_sizes | mcrypt_module_is_block_algorithm | mcrypt_module_is_block_algorithm_mode | + mcrypt_module_is_block_mode | mcrypt_module_open | mcrypt_module_self_test | mcrypt_ofb | mdecrypt_generic + )\b scope: support.function.mcrypt.php - - match: (?i)\bmemcache_debug\b + - match: |- + \b(?xi: + memcache_debug + )\b scope: support.function.memcache.php - - match: (?i)\bmhash(_(count|keygen_s2k|get_(hash_name|block_size)))?\b + - match: |- + \b(?xi: + mhash | mhash_count | mhash_get_block_size | mhash_get_hash_name | mhash_keygen_s2k + )\b scope: support.function.mhash.php - - match: (?i)\bbson_(decode|encode)\b + - match: |- + \b(?xi: + bson_decode | bson_encode + )\b scope: support.function.mongo.php - - match: (?i)\bmysql_(s(tat|e(t_charset|lect_db))|num_(fields|rows)|c(onnect|l(ient_encoding|ose)|reate_db)|t(hread_id|ablename)|in(sert_id|fo)|d(ata_seek|rop_db|b_(name|query))|unbuffered_query|p(connect|ing)|e(scape_string|rr(no|or))|query|f(ield_(seek|name|t(ype|able)|flags|len)|etch_(object|field|lengths|a(ssoc|rray)|row)|ree_result)|list_(tables|dbs|processes|fields)|affected_rows|re(sult|al_escape_string)|get_(server_info|host_info|client_info|proto_info))\b + - match: |- + \b(?xi: + mysql_affected_rows | mysql_client_encoding | mysql_close | mysql_connect | mysql_create_db | mysql_data_seek | mysql_db_name | mysql_db_query | + mysql_drop_db | mysql_errno | mysql_error | mysql_escape_string | mysql_fetch_array | mysql_fetch_assoc | mysql_fetch_field | mysql_fetch_lengths | + mysql_fetch_object | mysql_fetch_row | mysql_field_flags | mysql_field_len | mysql_field_name | mysql_field_seek | mysql_field_table | mysql_field_type | + mysql_free_result | mysql_get_client_info | mysql_get_host_info | mysql_get_proto_info | mysql_get_server_info | mysql_info | mysql_insert_id | mysql_list_dbs | + mysql_list_fields | mysql_list_processes | mysql_list_tables | mysql_num_fields | mysql_num_rows | mysql_pconnect | mysql_ping | mysql_query | + mysql_real_escape_string | mysql_result | mysql_select_db | mysql_set_charset | mysql_stat | mysql_tablename | mysql_thread_id | mysql_unbuffered_query + )\b scope: support.function.mysql.php - - match: (?i)\bmysqli_(s(sl_set|t(ore_result|at|mt_(s(tore_result|end_long_data|qlstate)|num_rows|close|in(sert_id|it)|data_seek|p(aram_count|repare)|e(rr(no|or)|xecute)|f(ield_count|etch|ree_result)|a(ttr_(set|get)|ffected_rows)|res(ult_metadata|et)|get_(warnings|result)|bind_(param|result)))|e(nd_(query|long_data)|t_(charset|opt|local_infile_(handler|default))|lect_db)|qlstate|lave_query)|n(um_(fields|rows)|ext_result)|c(ha(nge_user|racter_set_name)|o(nnect(_err(no|or))?|mmit)|l(ient_encoding|ose))|thread_(safe|id)|in(sert_id|it|fo)|options|d(isable_r(pl_parse|eads_from_master)|ump_debug_info|ebug|ata_seek)|use_result|p(ing|oll|aram_count|repare)|e(scape_string|nable_r(pl_parse|eads_from_master)|rr(no|or)|xecute|mbedded_server_(start|end))|kill|query|f(ield_(seek|count|tell)|etch(_(object|field(s|_direct)?|lengths|a(ssoc|ll|rray)|row))?|ree_result)|warning_count|a(utocommit|ffected_rows)|r(ollback|pl_(p(arse_enabled|robe)|query_type)|e(port|a(p_async_query|l_(connect|escape_string|query))))|get_(server_(info|version)|host_info|c(harset|onnection_stats|lient_(stats|info|version)|ache_stats)|proto_info|warnings|metadata)|m(ore_results|ulti_query|aster_query)|bind_(param|result))\b + - match: |- + \b(?xi: + mysqli_affected_rows | mysqli_autocommit | mysqli_bind_param | mysqli_bind_result | mysqli_change_user | mysqli_character_set_name | mysqli_client_encoding | mysqli_close | + mysqli_commit | mysqli_connect | mysqli_connect_errno | mysqli_connect_error | mysqli_data_seek | mysqli_debug | mysqli_disable_reads_from_master | mysqli_disable_rpl_parse | + mysqli_dump_debug_info | mysqli_embedded_server_end | mysqli_embedded_server_start | mysqli_enable_reads_from_master | mysqli_enable_rpl_parse | mysqli_errno | mysqli_error | mysqli_escape_string | + mysqli_execute | mysqli_fetch | mysqli_fetch_all | mysqli_fetch_array | mysqli_fetch_assoc | mysqli_fetch_field | mysqli_fetch_field_direct | mysqli_fetch_fields | + mysqli_fetch_lengths | mysqli_fetch_object | mysqli_fetch_row | mysqli_field_count | mysqli_field_seek | mysqli_field_tell | mysqli_free_result | mysqli_get_cache_stats | + mysqli_get_charset | mysqli_get_client_info | mysqli_get_client_stats | mysqli_get_client_version | mysqli_get_connection_stats | mysqli_get_host_info | mysqli_get_metadata | mysqli_get_proto_info | + mysqli_get_server_info | mysqli_get_server_version | mysqli_get_warnings | mysqli_info | mysqli_init | mysqli_insert_id | mysqli_kill | mysqli_master_query | + mysqli_more_results | mysqli_multi_query | mysqli_next_result | mysqli_num_fields | mysqli_num_rows | mysqli_options | mysqli_param_count | mysqli_ping | + mysqli_poll | mysqli_prepare | mysqli_query | mysqli_real_connect | mysqli_real_escape_string | mysqli_real_query | mysqli_reap_async_query | mysqli_report | + mysqli_rollback | mysqli_rpl_parse_enabled | mysqli_rpl_probe | mysqli_rpl_query_type | mysqli_select_db | mysqli_send_long_data | mysqli_send_query | mysqli_set_charset | + mysqli_set_local_infile_default | mysqli_set_local_infile_handler | mysqli_set_opt | mysqli_slave_query | mysqli_sqlstate | mysqli_ssl_set | mysqli_stat | mysqli_stmt_affected_rows | + mysqli_stmt_attr_get | mysqli_stmt_attr_set | mysqli_stmt_bind_param | mysqli_stmt_bind_result | mysqli_stmt_close | mysqli_stmt_data_seek | mysqli_stmt_errno | mysqli_stmt_error | + mysqli_stmt_execute | mysqli_stmt_fetch | mysqli_stmt_field_count | mysqli_stmt_free_result | mysqli_stmt_get_result | mysqli_stmt_get_warnings | mysqli_stmt_init | mysqli_stmt_insert_id | + mysqli_stmt_num_rows | mysqli_stmt_param_count | mysqli_stmt_prepare | mysqli_stmt_reset | mysqli_stmt_result_metadata | mysqli_stmt_send_long_data | mysqli_stmt_sqlstate | mysqli_stmt_store_result | + mysqli_store_result | mysqli_thread_id | mysqli_thread_safe | mysqli_use_result | mysqli_warning_count + )\b scope: support.function.mysqli.php - - match: (?i)\bmysqlnd_ms_(set_user_pick_server|query_is_select|get_stats)\b + - match: |- + \b(?xi: + mysqlnd_ms_get_stats | mysqlnd_ms_query_is_select | mysqlnd_ms_set_user_pick_server + )\b scope: support.function.mysqlnd-ms.php - - match: (?i)\bmysqlnd_qc_(set_user_handlers|c(hange_handler|lear_cache)|get_(handler|c(ore_stats|ache_info)|query_trace_log))\b + - match: |- + \b(?xi: + mysqlnd_qc_change_handler | mysqlnd_qc_clear_cache | mysqlnd_qc_get_cache_info | mysqlnd_qc_get_core_stats | mysqlnd_qc_get_handler | mysqlnd_qc_get_query_trace_log | mysqlnd_qc_set_user_handlers + )\b scope: support.function.mysqlnd-qc.php - - match: (?i)\b(s(yslog|ocket_(set_(timeout|blocking)|get_status)|et(cookie|rawcookie))|header(s_(sent|list)|_remove)?|c(heckdnsrr|loselog)|i(net_(ntop|pton)|p2long)|openlog|d(ns_(check_record|get_(record|mx))|efine_syslog_variables)|pfsockopen|fsockopen|long2ip|get(servby(name|port)|host(name|by(name(l)?|addr))|protobyn(umber|ame)|mxrr))\b + - match: |- + \b(?xi: + checkdnsrr | closelog | define_syslog_variables | dns_check_record | dns_get_mx | dns_get_record | fsockopen | gethostbyaddr | + gethostbyname | gethostbynamel | gethostname | getmxrr | getprotobyname | getprotobynumber | getservbyname | getservbyport | + header | header_remove | headers_list | headers_sent | inet_ntop | inet_pton | ip2long | long2ip | + openlog | pfsockopen | setcookie | setrawcookie | socket_get_status | socket_set_blocking | socket_set_timeout | syslog + )\b scope: support.function.network.php - - match: (?i)\bnsapi_(virtual|re(sponse_headers|quest_headers))\b + - match: |- + \b(?xi: + nsapi_request_headers | nsapi_response_headers | nsapi_virtual + )\b scope: support.function.nsapi.php - - match: (?i)\b(deaggregate|aggregat(ion_info|e(_(info|properties(_by_(list|regexp))?|methods(_by_(list|regexp))?))?))\b + - match: |- + \b(?xi: + aggregate | aggregate_info | aggregate_methods | aggregate_methods_by_list | aggregate_methods_by_regexp | aggregate_properties | aggregate_properties_by_list | aggregate_properties_by_regexp | + aggregation_info | deaggregate + )\b scope: support.function.objaggregation.php - - match: (?i)\boci(s(tatementtype|e(tprefetch|rverversion)|avelob(file)?)|n(umcols|ew(c(ollection|ursor)|descriptor)|logon)|c(o(l(umn(s(cale|ize)|name|type(raw)?|isnull|precision)|l(size|trim|a(ssign(elem)?|ppend)|getelem|max))|mmit)|loselob|ancel)|internaldebug|definebyname|_(s(tatement_type|e(t_(client_i(nfo|dentifier)|prefetch|edition|action|module_name)|rver_version))|n(um_(fields|rows)|ew_(c(o(nnect|llection)|ursor)|descriptor))|c(o(nnect|mmit)|l(ient_version|ose)|ancel)|internal_debug|define_by_name|p(connect|a(ssword_change|rse))|e(rror|xecute)|f(ield_(s(cale|ize)|name|type(_raw)?|is_null|precision)|etch(_(object|a(ssoc|ll|rray)|row))?|ree_statement)|lob_(copy|is_equal)|r(ollback|esult)|bind_(array_by_name|by_name))|p(logon|arse)|e(rror|xecute)|f(etch(statement|into)?|ree(statement|c(ollection|ursor)|desc))|write(temporarylob|lobtofile)|lo(adlob|go(n|ff))|r(o(wcount|llback)|esult)|bindbyname)\b + - match: |- + \b(?xi: + oci_bind_array_by_name | oci_bind_by_name | oci_cancel | oci_client_version | oci_close | oci_commit | oci_connect | oci_define_by_name | + oci_error | oci_execute | oci_fetch | oci_fetch_all | oci_fetch_array | oci_fetch_assoc | oci_fetch_object | oci_fetch_row | + oci_field_is_null | oci_field_name | oci_field_precision | oci_field_scale | oci_field_size | oci_field_type | oci_field_type_raw | oci_free_statement | + oci_internal_debug | oci_lob_copy | oci_lob_is_equal | oci_new_collection | oci_new_connect | oci_new_cursor | oci_new_descriptor | oci_num_fields | + oci_num_rows | oci_parse | oci_password_change | oci_pconnect | oci_result | oci_rollback | oci_server_version | oci_set_action | + oci_set_call_timeout | oci_set_client_identifier | oci_set_client_info | oci_set_db_operation | oci_set_edition | oci_set_module_name | oci_set_prefetch | oci_statement_type | + ocibindbyname | ocicancel | ocicloselob | ocicollappend | ocicollassign | ocicollassignelem | ocicollgetelem | ocicollmax | + ocicollsize | ocicolltrim | ocicolumnisnull | ocicolumnname | ocicolumnprecision | ocicolumnscale | ocicolumnsize | ocicolumntype | + ocicolumntyperaw | ocicommit | ocidefinebyname | ocierror | ociexecute | ocifetch | ocifetchinto | ocifetchstatement | + ocifreecollection | ocifreecursor | ocifreedesc | ocifreestatement | ociinternaldebug | ociloadlob | ocilogoff | ocilogon | + ocinewcollection | ocinewcursor | ocinewdescriptor | ocinlogon | ocinumcols | ociparse | ociplogon | ociresult | + ocirollback | ocirowcount | ocisavelob | ocisavelobfile | ociserverversion | ocisetprefetch | ocistatementtype | ociwritelobtofile | + ociwritetemporarylob + )\b scope: support.function.oci8.php - - match: (?i)\bopenssl_(s(ign|eal)|c(sr_(sign|new|export(_to_file)?|get_(subject|public_key))|ipher_iv_length)|open|d(h_compute_key|igest|ecrypt)|p(ublic_(decrypt|encrypt)|k(cs(12_(export(_to_file)?|read)|7_(sign|decrypt|encrypt|verify))|ey_(new|export(_to_file)?|free|get_(details|p(ublic|rivate))))|rivate_(decrypt|encrypt))|e(ncrypt|rror_string)|verify|free_key|random_pseudo_bytes|get_(cipher_methods|p(ublickey|rivatekey)|md_methods)|x509_(check(_private_key|purpose)|parse|export(_to_file)?|free|read))\b + - match: |- + \b(?xi: + openssl_cipher_iv_length | openssl_csr_export | openssl_csr_export_to_file | openssl_csr_get_public_key | openssl_csr_get_subject | openssl_csr_new | openssl_csr_sign | openssl_decrypt | + openssl_dh_compute_key | openssl_digest | openssl_encrypt | openssl_error_string | openssl_free_key | openssl_get_cipher_methods | openssl_get_md_methods | openssl_get_privatekey | + openssl_get_publickey | openssl_open | openssl_pkcs12_export | openssl_pkcs12_export_to_file | openssl_pkcs12_read | openssl_pkcs7_decrypt | openssl_pkcs7_encrypt | openssl_pkcs7_sign | + openssl_pkcs7_verify | openssl_pkey_derive | openssl_pkey_export | openssl_pkey_export_to_file | openssl_pkey_free | openssl_pkey_get_details | openssl_pkey_get_private | openssl_pkey_get_public | + openssl_pkey_new | openssl_private_decrypt | openssl_private_encrypt | openssl_public_decrypt | openssl_public_encrypt | openssl_random_pseudo_bytes | openssl_seal | openssl_sign | + openssl_verify | openssl_x509_check_private_key | openssl_x509_checkpurpose | openssl_x509_export | openssl_x509_export_to_file | openssl_x509_free | openssl_x509_parse | openssl_x509_read + )\b scope: support.function.openssl.php - - match: (?i)\b(o(utput_(add_rewrite_var|reset_rewrite_vars)|b_(start|clean|implicit_flush|end_(clean|flush)|flush|list_handlers|g(zhandler|et_(status|c(ontents|lean)|flush|le(ngth|vel)))))|flush)\b + - match: |- + \b(?xi: + flush | ob_clean | ob_end_clean | ob_end_flush | ob_flush | ob_get_clean | ob_get_contents | ob_get_flush | + ob_get_length | ob_get_level | ob_get_status | ob_gzhandler | ob_implicit_flush | ob_list_handlers | ob_start | output_add_rewrite_var | + output_reset_rewrite_vars + )\b scope: support.function.output.php - - match: (?i)\boverload\b + - match: |- + \b(?xi: + overload + )\b scope: support.function.overload.php - - match: (?i)\bpcntl_(s(ig(nal(_dispatch)?|timedwait|procmask|waitinfo)|etpriority)|exec|fork|w(stopsig|termsig|if(s(topped|ignaled)|exited)|exitstatus|ait(pid)?)|alarm|getpriority)\b + - match: |- + \b(?xi: + pcntl_alarm | pcntl_exec | pcntl_fork | pcntl_getpriority | pcntl_setpriority | pcntl_signal | pcntl_signal_dispatch | pcntl_sigprocmask | + pcntl_sigtimedwait | pcntl_sigwaitinfo | pcntl_wait | pcntl_waitpid | pcntl_wexitstatus | pcntl_wifexited | pcntl_wifsignaled | pcntl_wifstopped | + pcntl_wstopsig | pcntl_wtermsig + )\b scope: support.function.pcntl.php - - match: (?i)\bpg_(se(nd_(prepare|execute|query(_params)?)|t_(client_encoding|error_verbosity)|lect)|host|num_(fields|rows)|c(o(n(nect(ion_(status|reset|busy))?|vert)|py_(to|from))|l(ient_encoding|ose)|ancel_query)|t(ty|ra(nsaction_status|ce))|insert|options|d(elete|bname)|u(n(trace|escape_bytea)|pdate)|p(connect|ing|ort|ut_line|arameter_status|repare)|e(scape_(string|bytea)|nd_copy|xecute)|version|query(_params)?|f(ield_(size|n(um|ame)|t(ype(_oid)?|able)|is_null|prtlen)|etch_(object|a(ssoc|ll(_columns)?|rray)|r(ow|esult))|ree_result)|l(o_(seek|c(lose|reate)|tell|import|open|unlink|export|write|read(_all)?)|ast_(notice|oid|error))|affected_rows|result_(s(tatus|eek)|error(_field)?)|get_(notify|pid|result)|meta_data)\b + - match: |- + \b(?xi: + pg_affected_rows | pg_cancel_query | pg_client_encoding | pg_close | pg_connect | pg_connection_busy | pg_connection_reset | pg_connection_status | + pg_convert | pg_copy_from | pg_copy_to | pg_dbname | pg_delete | pg_end_copy | pg_escape_bytea | pg_escape_string | + pg_execute | pg_fetch_all | pg_fetch_all_columns | pg_fetch_array | pg_fetch_assoc | pg_fetch_object | pg_fetch_result | pg_fetch_row | + pg_field_is_null | pg_field_name | pg_field_num | pg_field_prtlen | pg_field_size | pg_field_table | pg_field_type | pg_field_type_oid | + pg_free_result | pg_get_notify | pg_get_pid | pg_get_result | pg_host | pg_insert | pg_last_error | pg_last_notice | + pg_last_oid | pg_lo_close | pg_lo_create | pg_lo_export | pg_lo_import | pg_lo_open | pg_lo_read | pg_lo_read_all | + pg_lo_seek | pg_lo_tell | pg_lo_unlink | pg_lo_write | pg_meta_data | pg_num_fields | pg_num_rows | pg_options | + pg_parameter_status | pg_pconnect | pg_ping | pg_port | pg_prepare | pg_put_line | pg_query | pg_query_params | + pg_result_error | pg_result_error_field | pg_result_seek | pg_result_status | pg_select | pg_send_execute | pg_send_prepare | pg_send_query | + pg_send_query_params | pg_set_client_encoding | pg_set_error_verbosity | pg_trace | pg_transaction_status | pg_tty | pg_unescape_bytea | pg_untrace | + pg_update | pg_version + )\b scope: support.function.pgsql.php - - match: (?i)\b(virtual|apache_(setenv|note|child_terminate|lookup_uri|re(s(ponse_headers|et_timeout)|quest_headers)|get(_(version|modules)|env))|getallheaders)\b + - match: |- + \b(?xi: + apache_child_terminate | apache_get_modules | apache_get_version | apache_getenv | apache_lookup_uri | apache_note | apache_request_headers | apache_reset_timeout | + apache_response_headers | apache_setenv | getallheaders | virtual + )\b scope: support.function.php_apache.php - - match: (?i)\bdom_import_simplexml\b + - match: |- + \b(?xi: + dom_import_simplexml + )\b scope: support.function.php_dom.php - - match: (?i)\bftp_(s(sl_connect|ystype|i(te|ze)|et_option)|n(list|b_(continue|put|f(put|get)|get))|c(h(dir|mod)|onnect|dup|lose)|delete|p(ut|wd|asv)|exec|quit|f(put|get)|login|alloc|r(ename|aw(list)?|mdir)|get(_option)?|m(dtm|kdir))\b + - match: |- + \b(?xi: + ftp_alloc | ftp_cdup | ftp_chdir | ftp_chmod | ftp_close | ftp_connect | ftp_delete | ftp_exec | + ftp_fget | ftp_fput | ftp_get | ftp_get_option | ftp_login | ftp_mdtm | ftp_mkdir | ftp_nb_continue | + ftp_nb_fget | ftp_nb_fput | ftp_nb_get | ftp_nb_put | ftp_nlist | ftp_pasv | ftp_put | ftp_pwd | + ftp_quit | ftp_raw | ftp_rawlist | ftp_rename | ftp_rmdir | ftp_set_option | ftp_site | ftp_size | + ftp_ssl_connect | ftp_systype + )\b scope: support.function.php_ftp.php - - match: (?i)\bimap_(s(can(mailbox)?|tatus|ort|ubscribe|e(t(_quota|flag_full|acl)|arch)|avebody)|header(s|info)?|num_(recent|msg)|c(heck|l(ose|earflag_full)|reate(mailbox)?)|t(hread|imeout)|open|delete(mailbox)?|8bit|u(n(subscribe|delete)|tf(7_(decode|encode)|8)|id)|ping|e(rrors|xpunge)|qprint|fetch(structure|header|text|_overview|mime|body)|l(sub|ist(s(can|ubscribed)|mailbox)?|ast_error)|a(ppend|lerts)|r(e(name(mailbox)?|open)|fc822_(parse_(headers|adrlist)|write_address))|g(c|et(subscribed|_quota(root)?|acl|mailboxes))|m(sgno|ime_header_decode|ail(_(co(py|mpose)|move)|boxmsginfo)?)|b(inary|ody(struct)?|ase64))\b + - match: |- + \b(?xi: + imap_8bit | imap_alerts | imap_append | imap_base64 | imap_binary | imap_body | imap_bodystruct | imap_check | + imap_clearflag_full | imap_close | imap_create | imap_createmailbox | imap_delete | imap_deletemailbox | imap_errors | imap_expunge | + imap_fetch_overview | imap_fetchbody | imap_fetchheader | imap_fetchmime | imap_fetchstructure | imap_fetchtext | imap_gc | imap_get_quota | + imap_get_quotaroot | imap_getacl | imap_getmailboxes | imap_getsubscribed | imap_header | imap_headerinfo | imap_headers | imap_last_error | + imap_list | imap_listmailbox | imap_listscan | imap_listsubscribed | imap_lsub | imap_mail | imap_mail_compose | imap_mail_copy | + imap_mail_move | imap_mailboxmsginfo | imap_mime_header_decode | imap_msgno | imap_num_msg | imap_num_recent | imap_open | imap_ping | + imap_qprint | imap_rename | imap_renamemailbox | imap_reopen | imap_rfc822_parse_adrlist | imap_rfc822_parse_headers | imap_rfc822_write_address | imap_savebody | + imap_scan | imap_scanmailbox | imap_search | imap_set_quota | imap_setacl | imap_setflag_full | imap_sort | imap_status | + imap_subscribe | imap_thread | imap_timeout | imap_uid | imap_undelete | imap_unsubscribe | imap_utf7_decode | imap_utf7_encode | + imap_utf8 + )\b scope: support.function.php_imap.php - - match: (?i)\bmssql_(select_db|n(um_(fields|rows)|ext_result)|c(onnect|lose)|init|data_seek|pconnect|execute|query|f(ield_(seek|name|type|length)|etch_(object|field|a(ssoc|rray)|row|batch)|ree_(statement|result))|r(ows_affected|esult)|g(uid_string|et_last_message)|min_(error_severity|message_severity)|bind)\b + - match: |- + \b(?xi: + mssql_bind | mssql_close | mssql_connect | mssql_data_seek | mssql_execute | mssql_fetch_array | mssql_fetch_assoc | mssql_fetch_batch | + mssql_fetch_field | mssql_fetch_object | mssql_fetch_row | mssql_field_length | mssql_field_name | mssql_field_seek | mssql_field_type | mssql_free_result | + mssql_free_statement | mssql_get_last_message | mssql_guid_string | mssql_init | mssql_min_error_severity | mssql_min_message_severity | mssql_next_result | mssql_num_fields | + mssql_num_rows | mssql_pconnect | mssql_query | mssql_result | mssql_rows_affected | mssql_select_db + )\b scope: support.function.php_mssql.php - - match: (?i)\bodbc_(s(tatistics|pecialcolumns|etoption)|n(um_(fields|rows)|ext_result)|c(o(nnect|lumn(s|privileges)|mmit)|ursor|lose(_all)?)|table(s|privileges)|d(o|ata_source)|p(connect|r(imarykeys|ocedure(s|columns)|epare))|e(rror(msg)?|xec(ute)?)|f(ield_(scale|n(um|ame)|type|precision|len)|oreignkeys|etch_(into|object|array|row)|ree_result)|longreadlen|autocommit|r(ollback|esult(_all)?)|gettypeinfo|binmode)\b + - match: |- + \b(?xi: + odbc_autocommit | odbc_binmode | odbc_close | odbc_close_all | odbc_columnprivileges | odbc_columns | odbc_commit | odbc_connect | + odbc_cursor | odbc_data_source | odbc_do | odbc_error | odbc_errormsg | odbc_exec | odbc_execute | odbc_fetch_array | + odbc_fetch_into | odbc_fetch_object | odbc_fetch_row | odbc_field_len | odbc_field_name | odbc_field_num | odbc_field_precision | odbc_field_scale | + odbc_field_type | odbc_foreignkeys | odbc_free_result | odbc_gettypeinfo | odbc_longreadlen | odbc_next_result | odbc_num_fields | odbc_num_rows | + odbc_pconnect | odbc_prepare | odbc_primarykeys | odbc_procedurecolumns | odbc_procedures | odbc_result | odbc_result_all | odbc_rollback | + odbc_setoption | odbc_specialcolumns | odbc_statistics | odbc_tableprivileges | odbc_tables + )\b scope: support.function.php_odbc.php - - match: (?i)\bpreg_(split|quote|filter|last_error|replace(_callback(_array)?)?|grep|match(_all)?)\b + - match: |- + \b(?xi: + preg_filter | preg_grep | preg_last_error | preg_match | preg_match_all | preg_quote | preg_replace | preg_replace_callback | + preg_replace_callback_array | preg_split + )\b scope: support.function.php_pcre.php - - match: (?i)\b(spl_(classes|object_hash|autoload(_(call|unregister|extensions|functions|register))?)|class_(implements|parents)|iterator_(count|to_array|apply))\b + - match: |- + \b(?xi: + class_implements | class_parents | iterator_apply | iterator_count | iterator_to_array | spl_autoload | spl_autoload_call | spl_autoload_extensions | + spl_autoload_functions | spl_autoload_register | spl_autoload_unregister | spl_classes | spl_object_hash | spl_object_id + )\b scope: support.function.php_spl.php - - match: (?i)\bzip_(close|open|entry_(name|c(ompress(ionmethod|edsize)|lose)|open|filesize|read)|read)\b + - match: |- + \b(?xi: + zip_close | zip_entry_close | zip_entry_compressedsize | zip_entry_compressionmethod | zip_entry_filesize | zip_entry_name | zip_entry_open | zip_entry_read | + zip_open | zip_read + )\b scope: support.function.php_zip.php - - match: (?i)\bposix_(s(trerror|et(sid|uid|pgid|e(uid|gid)|gid))|ctermid|t(tyname|imes)|i(satty|nitgroups)|uname|errno|kill|access|get(sid|cwd|uid|_last_error|p(id|pid|w(nam|uid)|g(id|rp))|e(uid|gid)|login|rlimit|g(id|r(nam|oups|gid)))|mk(nod|fifo))\b + - match: |- + \b(?xi: + posix_access | posix_ctermid | posix_errno | posix_get_last_error | posix_getcwd | posix_getegid | posix_geteuid | posix_getgid | + posix_getgrgid | posix_getgrnam | posix_getgroups | posix_getlogin | posix_getpgid | posix_getpgrp | posix_getpid | posix_getppid | + posix_getpwnam | posix_getpwuid | posix_getrlimit | posix_getsid | posix_getuid | posix_initgroups | posix_isatty | posix_kill | + posix_mkfifo | posix_mknod | posix_setegid | posix_seteuid | posix_setgid | posix_setpgid | posix_setsid | posix_setuid | + posix_strerror | posix_times | posix_ttyname | posix_uname + )\b scope: support.function.posix.php - - match: (?i)\bset(threadtitle|proctitle)\b + - match: |- + \b(?xi: + setproctitle | setthreadtitle + )\b scope: support.function.proctitle.php - - match: (?i)\bpspell_(s(tore_replacement|uggest|ave_wordlist)|new(_(config|personal))?|c(heck|onfig_(save_repl|create|ignore|d(ict_dir|ata_dir)|personal|r(untogether|epl)|mode)|lear_session)|add_to_(session|personal))\b + - match: |- + \b(?xi: + pspell_add_to_personal | pspell_add_to_session | pspell_check | pspell_clear_session | pspell_config_create | pspell_config_data_dir | pspell_config_dict_dir | pspell_config_ignore | + pspell_config_mode | pspell_config_personal | pspell_config_repl | pspell_config_runtogether | pspell_config_save_repl | pspell_new | pspell_new_config | pspell_new_personal | + pspell_save_wordlist | pspell_store_replacement | pspell_suggest + )\b scope: support.function.pspell.php - - match: (?i)\breadline(_(c(ompletion_function|lear_history|allback_(handler_(install|remove)|read_char))|info|on_new_line|write_history|list_history|add_history|re(display|ad_history)))?\b + - match: |- + \b(?xi: + readline | readline_add_history | readline_callback_handler_install | readline_callback_handler_remove | readline_callback_read_char | readline_clear_history | readline_completion_function | readline_info | + readline_list_history | readline_on_new_line | readline_read_history | readline_redisplay | readline_write_history + )\b scope: support.function.readline.php - - match: (?i)\brecode(_(string|file))?\b + - match: |- + \b(?xi: + recode | recode_file | recode_string + )\b scope: support.function.recode.php - - match: (?i)\brrd_(create|tune|info|update|error|f(irst|etch)|last(update)?|restore|graph|xport)\b + - match: |- + \b(?xi: + rrd_create | rrd_error | rrd_fetch | rrd_first | rrd_graph | rrd_info | rrd_last | rrd_lastupdate | + rrd_restore | rrd_tune | rrd_update | rrd_xport + )\b scope: support.function.rrd.php - - match: (?i)\b(s(hm_(has_var|detach|put_var|attach|remove(_var)?|get_var)|em_(acquire|re(lease|move)|get))|ftok|msg_(s(tat_queue|e(nd|t_queue))|queue_exists|re(ceive|move_queue)|get_queue))\b + - match: |- + \b(?xi: + ftok | msg_get_queue | msg_queue_exists | msg_receive | msg_remove_queue | msg_send | msg_set_queue | msg_stat_queue | + sem_acquire | sem_get | sem_release | sem_remove | shm_attach | shm_detach | shm_get_var | shm_has_var | + shm_put_var | shm_remove | shm_remove_var + )\b scope: support.function.sem.php - - match: (?i)\bsession_(s(tart|et_(save_handler|cookie_params)|ave_path)|name|c(ommit|ache_(expire|limiter))|i(s_registered|d)|de(stroy|code)|un(set|register)|encode|write_close|reg(ister|enerate_id)|get_cookie_params|module_name)\b + - match: |- + \b(?xi: + session_cache_expire | session_cache_limiter | session_commit | session_decode | session_destroy | session_encode | session_get_cookie_params | session_id | + session_is_registered | session_module_name | session_name | session_regenerate_id | session_register | session_save_path | session_set_cookie_params | session_set_save_handler | + session_start | session_unregister | session_unset | session_write_close + )\b scope: support.function.session.php - - match: (?i)\bshmop_(size|close|open|delete|write|read)\b + - match: |- + \b(?xi: + shmop_close | shmop_delete | shmop_open | shmop_read | shmop_size | shmop_write + )\b scope: support.function.shmop.php - - match: (?i)\bsimplexml_(import_dom|load_(string|file))\b + - match: |- + \b(?xi: + simplexml_import_dom | simplexml_load_file | simplexml_load_string + )\b scope: support.function.simplexml.php - - match: (?i)\bsnmp(set|2_(set|walk|real_walk|get(next)?)|_(set_(oid_(numeric_print|output_format)|enum_print|valueretrieval|quick_print)|read_mib|get_(valueretrieval|quick_print))|3_(set|walk|real_walk|get(next)?)|walk(oid)?|realwalk|get(next)?)\b + - match: |- + \b(?xi: + snmp2_get | snmp2_getnext | snmp2_real_walk | snmp2_set | snmp2_walk | snmp3_get | snmp3_getnext | snmp3_real_walk | + snmp3_set | snmp3_walk | snmp_get_quick_print | snmp_get_valueretrieval | snmp_read_mib | snmp_set_enum_print | snmp_set_oid_numeric_print | snmp_set_oid_output_format | + snmp_set_quick_print | snmp_set_valueretrieval | snmpget | snmpgetnext | snmprealwalk | snmpset | snmpwalk | snmpwalkoid + )\b scope: support.function.snmp.php - - match: (?i)\b(is_soap_fault|use_soap_error_handler)\b + - match: |- + \b(?xi: + is_soap_fault | use_soap_error_handler + )\b scope: support.function.soap.php - - match: (?i)\bsocket_(s(hutdown|trerror|e(nd(to)?|t_(nonblock|option|block)|lect))|c(onnect|l(ose|ear_error)|reate(_(pair|listen))?)|write|l(isten|ast_error)|accept|re(cv(from)?|ad)|get(sockname|_option|peername)|bind)\b + - match: |- + \b(?xi: + socket_accept | socket_bind | socket_clear_error | socket_close | socket_connect | socket_create | socket_create_listen | socket_create_pair | + socket_export_stream | socket_get_option | socket_getpeername | socket_getsockname | socket_last_error | socket_listen | socket_read | socket_recv | + socket_recvfrom | socket_select | socket_send | socket_sendto | socket_set_block | socket_set_nonblock | socket_set_option | socket_shutdown | + socket_strerror | socket_write + )\b scope: support.function.sockets.php - - match: (?i)\bsqlite_(s(ingle_query|eek)|has_(prev|more)|n(um_(fields|rows)|ext)|c(hanges|olumn|urrent|lose|reate_(function|aggregate))|open|u(nbuffered_query|df_(decode_binary|encode_binary))|p(open|rev)|e(scape_string|rror_string|xec)|valid|key|query|f(ield_name|etch_(s(tring|ingle)|column_types|object|a(ll|rray))|actory)|l(ib(encoding|version)|ast_(insert_rowid|error))|array_query|rewind|busy_timeout)\b + - match: |- + \b(?xi: + sqlite_array_query | sqlite_busy_timeout | sqlite_changes | sqlite_close | sqlite_column | sqlite_create_aggregate | sqlite_create_function | sqlite_current | + sqlite_error_string | sqlite_escape_string | sqlite_exec | sqlite_factory | sqlite_fetch_all | sqlite_fetch_array | sqlite_fetch_column_types | sqlite_fetch_object | + sqlite_fetch_single | sqlite_fetch_string | sqlite_field_name | sqlite_has_more | sqlite_has_prev | sqlite_key | sqlite_last_error | sqlite_last_insert_rowid | + sqlite_libencoding | sqlite_libversion | sqlite_next | sqlite_num_fields | sqlite_num_rows | sqlite_open | sqlite_popen | sqlite_prev | + sqlite_query | sqlite_rewind | sqlite_seek | sqlite_single_query | sqlite_udf_decode_binary | sqlite_udf_encode_binary | sqlite_unbuffered_query | sqlite_valid + )\b scope: support.function.sqlite.php - - match: (?i)\bstats_(s(ta(ndard_deviation|t_(noncentral_t|correlation|in(nerproduct|dependent_t)|p(owersum|ercentile|aired_t)|gennch|binomial_coef))|kew)|harmonic_mean|c(ovariance|df_(n(oncentral_(chisquare|f)|egative_binomial)|c(hisquare|auchy)|t|uniform|poisson|exponential|f|weibull|l(ogistic|aplace)|gamma|b(inomial|eta)))|den(s_(n(ormal|egative_binomial)|c(hisquare|auchy)|t|pmf_(hypergeometric|poisson|binomial)|exponential|f|weibull|l(ogistic|aplace)|gamma|beta)|_uniform)|variance|kurtosis|absolute_deviation|rand_(setall|phrase_to_seeds|ranf|ge(n_(no(ncen(tral_(t|f)|ral_chisquare)|rmal)|chisquare|t|i(nt|uniform|poisson|binomial(_negative)?)|exponential|f(uniform)?|gamma|beta)|t_seeds)))\b + - match: |- + \b(?xi: + stats_absolute_deviation | stats_cdf_beta | stats_cdf_binomial | stats_cdf_cauchy | stats_cdf_chisquare | stats_cdf_exponential | stats_cdf_f | stats_cdf_gamma | + stats_cdf_laplace | stats_cdf_logistic | stats_cdf_negative_binomial | stats_cdf_noncentral_chisquare | stats_cdf_noncentral_f | stats_cdf_poisson | stats_cdf_t | stats_cdf_uniform | + stats_cdf_weibull | stats_covariance | stats_den_uniform | stats_dens_beta | stats_dens_cauchy | stats_dens_chisquare | stats_dens_exponential | stats_dens_f | + stats_dens_gamma | stats_dens_laplace | stats_dens_logistic | stats_dens_negative_binomial | stats_dens_normal | stats_dens_pmf_binomial | stats_dens_pmf_hypergeometric | stats_dens_pmf_poisson | + stats_dens_t | stats_dens_weibull | stats_harmonic_mean | stats_kurtosis | stats_rand_gen_beta | stats_rand_gen_chisquare | stats_rand_gen_exponential | stats_rand_gen_f | + stats_rand_gen_funiform | stats_rand_gen_gamma | stats_rand_gen_ibinomial | stats_rand_gen_ibinomial_negative | stats_rand_gen_int | stats_rand_gen_ipoisson | stats_rand_gen_iuniform | stats_rand_gen_noncenral_chisquare | + stats_rand_gen_noncentral_f | stats_rand_gen_noncentral_t | stats_rand_gen_normal | stats_rand_gen_t | stats_rand_get_seeds | stats_rand_phrase_to_seeds | stats_rand_ranf | stats_rand_setall | + stats_skew | stats_standard_deviation | stats_stat_binomial_coef | stats_stat_correlation | stats_stat_gennch | stats_stat_independent_t | stats_stat_innerproduct | stats_stat_noncentral_t | + stats_stat_paired_t | stats_stat_percentile | stats_stat_powersum | stats_variance + )\b scope: support.function.stats.php - - match: (?i)\bs(tream_(s(ocket_(s(hutdown|e(ndto|rver))|client|pair|enable_crypto|accept|recvfrom|get_name)|upports_lock|e(t_(timeout|write_buffer|read_buffer|blocking)|lect))|notification_callback|co(ntext_(set_(option|default|params)|create|get_(options|default|params))|py_to_stream)|is_local|encoding|filter_(prepend|append|re(gister|move))|wrapper_(unregister|re(store|gister))|re(solve_include_path|gister_wrapper)|get_(contents|transports|filters|wrappers|line|meta_data)|bucket_(new|prepend|append|make_writeable))|et_socket_blocking)\b + - match: |- + \b(?xi: + set_socket_blocking | stream_bucket_append | stream_bucket_make_writeable | stream_bucket_new | stream_bucket_prepend | stream_context_create | stream_context_get_default | stream_context_get_options | + stream_context_get_params | stream_context_set_default | stream_context_set_option | stream_context_set_params | stream_copy_to_stream | stream_encoding | stream_filter_append | stream_filter_prepend | + stream_filter_register | stream_filter_remove | stream_get_contents | stream_get_filters | stream_get_line | stream_get_meta_data | stream_get_transports | stream_get_wrappers | + stream_is_local | stream_notification_callback | stream_register_wrapper | stream_resolve_include_path | stream_select | stream_set_blocking | stream_set_read_buffer | stream_set_timeout | + stream_set_write_buffer | stream_socket_accept | stream_socket_client | stream_socket_enable_crypto | stream_socket_get_name | stream_socket_pair | stream_socket_recvfrom | stream_socket_sendto | + stream_socket_server | stream_socket_shutdown | stream_supports_lock | stream_wrapper_register | stream_wrapper_restore | stream_wrapper_unregister + )\b scope: support.function.streamsfuncs.php - - match: (?i)\b(s(scanf|ha1(_file)?|tr(s(tr|pn)|n(c(asecmp|mp)|atc(asecmp|mp))|c(spn|hr|oll|asecmp|mp)|t(o(upper|k|lower)|r)|i(str|p(slashes|cslashes|os|_tags))|_(s(huffle|plit)|ireplace|pad|word_count|r(ot13|ep(eat|lace))|getcsv)|p(os|brk)|len|r(chr|ipos|pos|ev))|imilar_text|oundex|ubstr(_(co(unt|mpare)|replace))?|printf|etlocale)|h(tml(specialchars(_decode)?|_entity_decode|entities)|ebrev(c)?)|n(umber_format|l(2br|_langinfo))|c(h(op|unk_split|r)|o(nvert_(cyr_string|uu(decode|encode))|unt_chars)|r(ypt|c32))|trim|implode|ord|uc(first|words)|join|p(arse_str|rint(f)?)|e(cho|xplode)|v(sprintf|printf|fprintf)|quote(d_printable_(decode|encode)|meta)|fprintf|wordwrap|l(cfirst|trim|ocaleconv|evenshtein)|add(slashes|cslashes)|rtrim|get_html_translation_table|m(oney_format|d5(_file)?|etaphone)|bin2hex)\b + - match: |- + \b(?xi: + addcslashes | addslashes | bin2hex | chop | chr | chunk_split | convert_cyr_string | convert_uudecode | + convert_uuencode | count_chars | crc32 | crypt | echo | explode | fprintf | get_html_translation_table | + hebrev | hebrevc | html_entity_decode | htmlentities | htmlspecialchars | htmlspecialchars_decode | implode | join | + lcfirst | levenshtein | localeconv | ltrim | md5 | md5_file | metaphone | money_format | + nl2br | nl_langinfo | number_format | ord | parse_str | print | printf | quoted_printable_decode | + quoted_printable_encode | quotemeta | rtrim | setlocale | sha1 | sha1_file | similar_text | soundex | + sprintf | sscanf | str_getcsv | str_ireplace | str_pad | str_repeat | str_replace | str_rot13 | + str_shuffle | str_split | str_word_count | strcasecmp | strchr | strcmp | strcoll | strcspn | + strip_tags | stripcslashes | stripos | stripslashes | stristr | strlen | strnatcasecmp | strnatcmp | + strncasecmp | strncmp | strpbrk | strpos | strrchr | strrev | strripos | strrpos | + strspn | strstr | strtok | strtolower | strtoupper | strtr | substr | substr_compare | + substr_count | substr_replace | trim | ucfirst | ucwords | vfprintf | vprintf | vsprintf | + wordwrap + )\b scope: support.function.string.php - - match: (?i)\bsybase_(se(t_message_handler|lect_db)|num_(fields|rows)|c(onnect|lose)|d(eadlock_retry_count|ata_seek)|unbuffered_query|pconnect|query|f(ield_seek|etch_(object|field|a(ssoc|rray)|row)|ree_result)|affected_rows|result|get_last_message|min_(server_severity|client_severity|error_severity|message_severity))\b + - match: |- + \b(?xi: + sybase_affected_rows | sybase_close | sybase_connect | sybase_data_seek | sybase_deadlock_retry_count | sybase_fetch_array | sybase_fetch_assoc | sybase_fetch_field | + sybase_fetch_object | sybase_fetch_row | sybase_field_seek | sybase_free_result | sybase_get_last_message | sybase_min_client_severity | sybase_min_error_severity | sybase_min_message_severity | + sybase_min_server_severity | sybase_num_fields | sybase_num_rows | sybase_pconnect | sybase_query | sybase_result | sybase_select_db | sybase_set_message_handler | + sybase_unbuffered_query + )\b scope: support.function.sybase.php - - match: (?i)\b(tidy_(s(et(opt|_encoding)|ave_config)|c(onfig_count|lean_repair)|is_x(html|ml)|diagnose|parse_(string|file)|error_count|warning_count|load_config|access_count|re(set_config|pair_(string|file))|get(opt|_(status|h(tml(_ver)?|ead)|config|o(utput|pt_doc)|error_buffer|r(oot|elease)|body)))|ob_tidyhandler)\b + - match: |- + \b(?xi: + ob_tidyhandler | tidy_access_count | tidy_clean_repair | tidy_config_count | tidy_diagnose | tidy_error_count | tidy_get_body | tidy_get_config | + tidy_get_error_buffer | tidy_get_head | tidy_get_html | tidy_get_html_ver | tidy_get_opt_doc | tidy_get_output | tidy_get_release | tidy_get_root | + tidy_get_status | tidy_getopt | tidy_is_xhtml | tidy_is_xml | tidy_load_config | tidy_parse_file | tidy_parse_string | tidy_repair_file | + tidy_repair_string | tidy_reset_config | tidy_save_config | tidy_set_encoding | tidy_setopt | tidy_warning_count + )\b scope: support.function.tidy.php - - match: (?i)\btoken_(name|get_all)\b + - match: |- + \b(?xi: + token_get_all | token_name + )\b scope: support.function.tokenizer.php - - match: (?i)\b(http_build_query|url(decode|encode)|parse_url|rawurl(decode|encode)|get_(headers|meta_tags)|base64_(decode|encode))\b + - match: |- + \b(?xi: + base64_decode | base64_encode | get_headers | get_meta_tags | http_build_query | parse_url | rawurldecode | rawurlencode | + urldecode | urlencode + )\b scope: support.function.url.php - - match: (?i)\b(s(trval|e(ttype|rialize))|i(s(set|_(s(calar|tring)|nu(ll|meric)|callable|int(eger)?|object|double|float|long|array|re(source|al)|bool))|ntval|mport_request_variables)|d(oubleval|ebug_zval_dump)|unse(t|rialize)|print_r|empty|var_(dump|export)|boolval|floatval|get(type|_(defined_vars|resource_type)))\b + - match: |- + \b(?xi: + boolval | debug_zval_dump | doubleval | empty | floatval | get_defined_vars | get_resource_type | gettype | + import_request_variables | intval | is_array | is_bool | is_callable | is_countable | is_double | is_float | + is_int | is_integer | is_iterable | is_long | is_null | is_numeric | is_object | is_real | + is_resource | is_scalar | is_string | isset | print_r | serialize | settype | strval | + unserialize | unset | var_dump | var_export + )\b scope: support.function.var.php - - match: (?i)\bwddx_(serialize_va(lue|rs)|deserialize|packet_(start|end)|add_vars)\b + - match: |- + \b(?xi: + wddx_add_vars | wddx_deserialize | wddx_packet_end | wddx_packet_start | wddx_serialize_value | wddx_serialize_vars + )\b scope: support.function.wddx.php - - match: (?i)\bxhprof_(sample_(disable|enable)|disable|enable)\b + - match: |- + \b(?xi: + xhprof_disable | xhprof_enable | xhprof_sample_disable | xhprof_sample_enable + )\b scope: support.function.xhprof.php - - match: (?i)\b(utf8_(decode|encode)|xml_(set_(start_namespace_decl_handler|notation_decl_handler|character_data_handler|object|default_handler|unparsed_entity_decl_handler|processing_instruction_handler|e(nd_namespace_decl_handler|lement_handler|xternal_entity_ref_handler))|parse(_into_struct|r_(set_option|create(_ns)?|free|get_option))?|error_string|get_(current_(column_number|line_number|byte_index)|error_code)))\b + - match: |- + \b(?xi: + utf8_decode | utf8_encode | xml_error_string | xml_get_current_byte_index | xml_get_current_column_number | xml_get_current_line_number | xml_get_error_code | xml_parse | + xml_parse_into_struct | xml_parser_create | xml_parser_create_ns | xml_parser_free | xml_parser_get_option | xml_parser_set_option | xml_set_character_data_handler | xml_set_default_handler | + xml_set_element_handler | xml_set_end_namespace_decl_handler | xml_set_external_entity_ref_handler | xml_set_notation_decl_handler | xml_set_object | xml_set_processing_instruction_handler | xml_set_start_namespace_decl_handler | xml_set_unparsed_entity_decl_handler + )\b scope: support.function.xml.php - - match: (?i)\bxmlrpc_(se(t_type|rver_(c(all_method|reate)|destroy|add_introspection_data|register_(introspection_callback|method)))|is_fault|decode(_request)?|parse_method_descriptions|encode(_request)?|get_type)\b + - match: |- + \b(?xi: + xmlrpc_decode | xmlrpc_decode_request | xmlrpc_encode | xmlrpc_encode_request | xmlrpc_get_type | xmlrpc_is_fault | xmlrpc_parse_method_descriptions | xmlrpc_server_add_introspection_data | + xmlrpc_server_call_method | xmlrpc_server_create | xmlrpc_server_destroy | xmlrpc_server_register_introspection_callback | xmlrpc_server_register_method | xmlrpc_set_type + )\b scope: support.function.xmlrpc.php - - match: (?i)\bxmlwriter_(s(tart_(c(omment|data)|d(td(_(e(ntity|lement)|attlist))?|ocument)|pi|element(_ns)?|attribute(_ns)?)|et_indent(_string)?)|text|o(utput_memory|pen_(uri|memory))|end_(c(omment|data)|d(td(_(e(ntity|lement)|attlist))?|ocument)|pi|element|attribute)|f(ull_end_element|lush)|write_(c(omment|data)|dtd(_(e(ntity|lement)|attlist))?|pi|element(_ns)?|attribute(_ns)?|raw))\b + - match: |- + \b(?xi: + xmlwriter_end_attribute | xmlwriter_end_cdata | xmlwriter_end_comment | xmlwriter_end_document | xmlwriter_end_dtd | xmlwriter_end_dtd_attlist | xmlwriter_end_dtd_element | xmlwriter_end_dtd_entity | + xmlwriter_end_element | xmlwriter_end_pi | xmlwriter_flush | xmlwriter_full_end_element | xmlwriter_open_memory | xmlwriter_open_uri | xmlwriter_output_memory | xmlwriter_set_indent | + xmlwriter_set_indent_string | xmlwriter_start_attribute | xmlwriter_start_attribute_ns | xmlwriter_start_cdata | xmlwriter_start_comment | xmlwriter_start_document | xmlwriter_start_dtd | xmlwriter_start_dtd_attlist | + xmlwriter_start_dtd_element | xmlwriter_start_dtd_entity | xmlwriter_start_element | xmlwriter_start_element_ns | xmlwriter_start_pi | xmlwriter_text | xmlwriter_write_attribute | xmlwriter_write_attribute_ns | + xmlwriter_write_cdata | xmlwriter_write_comment | xmlwriter_write_dtd | xmlwriter_write_dtd_attlist | xmlwriter_write_dtd_element | xmlwriter_write_dtd_entity | xmlwriter_write_element | xmlwriter_write_element_ns | + xmlwriter_write_pi | xmlwriter_write_raw + )\b scope: support.function.xmlwriter.php - - match: (?i)\bxslt_(set(opt|_(s(cheme_handler(s)?|ax_handler(s)?)|object|e(ncoding|rror_handler)|log|base))|create|process|err(no|or)|free|getopt|backend_(name|info|version))\b + - match: |- + \b(?xi: + xslt_backend_info | xslt_backend_name | xslt_backend_version | xslt_create | xslt_errno | xslt_error | xslt_free | xslt_getopt | + xslt_process | xslt_set_base | xslt_set_encoding | xslt_set_error_handler | xslt_set_log | xslt_set_object | xslt_set_sax_handler | xslt_set_sax_handlers | + xslt_set_scheme_handler | xslt_set_scheme_handlers | xslt_setopt + )\b scope: support.function.xslt.php - - match: (?i)\b(zlib_get_coding_type|readgzfile|gz(seek|c(ompress|lose)|tell|inflate|open|de(code|flate)|uncompress|p(uts|assthru)|e(ncode|of)|file|write|re(wind|ad)|get(s(s)?|c)))\b + - match: |- + \b(?xi: + gzclose | gzcompress | gzdecode | gzdeflate | gzencode | gzeof | gzfile | gzgetc | + gzgets | gzgetss | gzinflate | gzopen | gzpassthru | gzputs | gzread | gzrewind | + gzseek | gztell | gzuncompress | gzwrite | readgzfile | zlib_get_coding_type + )\b scope: support.function.zlib.php - - match: (?i)\bis_int(eger)?\b + - match: |- + \b(?xi: + is_int | is_integer + )\b scope: support.function.alias.php variables: diff --git a/PHP/Snippets/$_COOKIE[''].sublime-snippet b/PHP/Snippets/$_COOKIE[''].sublime-snippet index b7aeb22c2e..4d1cad5488 100644 --- a/PHP/Snippets/$_COOKIE[''].sublime-snippet +++ b/PHP/Snippets/$_COOKIE[''].sublime-snippet @@ -1,6 +1,6 @@ - $_ + $_COOKIE source.php - string.quoted.single - comment COOKIE['…'] diff --git a/PHP/Snippets/$_ENV[''].sublime-snippet b/PHP/Snippets/$_ENV[''].sublime-snippet index a88fab80a0..0b4c8a6d79 100644 --- a/PHP/Snippets/$_ENV[''].sublime-snippet +++ b/PHP/Snippets/$_ENV[''].sublime-snippet @@ -1,6 +1,6 @@ - $_ + $_ENV source.php - string.quoted.single - comment ENV['…'] diff --git a/PHP/Snippets/$_FILES[''].sublime-snippet b/PHP/Snippets/$_FILES[''].sublime-snippet index be30dbcffa..edf446a365 100644 --- a/PHP/Snippets/$_FILES[''].sublime-snippet +++ b/PHP/Snippets/$_FILES[''].sublime-snippet @@ -1,6 +1,6 @@ - $_ + $_FILES source.php - string.quoted.single - comment FILES['…'] diff --git a/PHP/Snippets/$_GET[''].sublime-snippet b/PHP/Snippets/$_GET[''].sublime-snippet index 3312757fb3..7bdda8eba0 100644 --- a/PHP/Snippets/$_GET[''].sublime-snippet +++ b/PHP/Snippets/$_GET[''].sublime-snippet @@ -1,6 +1,6 @@ - $_ + $_GET source.php - string.quoted.single - comment GET['…'] diff --git a/PHP/Snippets/$_POST[''].sublime-snippet b/PHP/Snippets/$_POST[''].sublime-snippet index f143bca41f..45c4e9623d 100644 --- a/PHP/Snippets/$_POST[''].sublime-snippet +++ b/PHP/Snippets/$_POST[''].sublime-snippet @@ -1,6 +1,6 @@ - $_ + $_POST source.php - string.quoted.single - comment POST['…'] diff --git a/PHP/Snippets/$_REQUEST[''].sublime-snippet b/PHP/Snippets/$_REQUEST[''].sublime-snippet index 25d59ea9c1..4b01c0b31d 100644 --- a/PHP/Snippets/$_REQUEST[''].sublime-snippet +++ b/PHP/Snippets/$_REQUEST[''].sublime-snippet @@ -1,6 +1,6 @@ - $_ + $_REQUEST source.php - string.quoted.single - comment REQUEST['…'] diff --git a/PHP/Snippets/$_SERVER[''].sublime-snippet b/PHP/Snippets/$_SERVER[''].sublime-snippet index b7ce38f48b..1e8b00a2c1 100644 --- a/PHP/Snippets/$_SERVER[''].sublime-snippet +++ b/PHP/Snippets/$_SERVER[''].sublime-snippet @@ -1,6 +1,6 @@ - $_ + $_SERVER source.php - string.quoted.single - comment SERVER['…'] diff --git a/PHP/Snippets/$_SESSION[''].sublime-snippet b/PHP/Snippets/$_SESSION[''].sublime-snippet index e5ed6b23a8..a34a0785a5 100644 --- a/PHP/Snippets/$_SESSION[''].sublime-snippet +++ b/PHP/Snippets/$_SESSION[''].sublime-snippet @@ -1,6 +1,6 @@ - $_ + $_SESSION source.php - string.quoted.single - comment SESSION['…'] diff --git a/PHP/syntax_test_php.php b/PHP/syntax_test_php.php index 7864e866dc..82413f4353 100644 --- a/PHP/syntax_test_php.php +++ b/PHP/syntax_test_php.php @@ -181,6 +181,36 @@ function i( ) {}; +function array_values_from_keys($arr, $keys) { + return array_map(fn($x) => $arr[$x], $keys, fn($x) => $arr[$x]); +// ^^ meta.function.arrow-function storage.type.function +// ^ punctuation.section.group.begin +// ^^ variable.parameter +// ^ punctuation.section.group.end +// ^^ punctuation.definition.arrow-function.php +} + +$fn = fn($x) => fn($y) => $x * $y + $z; +// ^^ meta.function.arrow-function storage.type.function +// ^ punctuation.section.group.begin +// ^^ variable.parameter +// ^ punctuation.section.group.end +// ^^ punctuation.definition.arrow-function.php +// ^^ meta.function.arrow-function storage.type.function +// ^ punctuation.section.group.begin +// ^^ variable.parameter +// ^ punctuation.section.group.end +// ^^ punctuation.definition.arrow-function.php + +$var = fn($x) +// ^^ meta.function.arrow-function.php - meta.function-call + => $x * 2; +// ^^ punctuation.definition.arrow-function + +$var = fn($x) +// ^^ meta.function-call - meta.function.arrow-function.php +; + $var = function(array $ar=array(), ClassName $cls) use ($var1, $var2) { // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function // ^^^^^^^^ meta.function.closure @@ -201,6 +231,17 @@ function i( }; // <- meta.function meta.block punctuation.section.block.end +function foo(?stinrg ...$args) {} +// ^ storage.type.nullable +// ^^^^^^ support.class +// ^^^ keyword.operator.spread +// ^^^^^ variable.parameter + +$arr4 = ['a', ...$arr1, 'b', ...$arr2, 'c']; +// ^^^ keyword.operator.spread +// ^^^^^ variable.other +// ^^^ keyword.operator.spread + $array = [ ]; // ^ meta.array.empty.php punctuation.section.array.begin.php // ^ meta.array.empty.php punctuation.section.array.end.php @@ -237,9 +278,12 @@ function i( // ^ source - comment.block /** - * @return + * +// ^ text.html.basic meta.embedded.block.php source.php comment.block.documentation.phpdoc.php punctuation.definition.comment.php +*/ + +/** @var Properties: class properties. */ // ^ keyword.other.phpdoc - */ /* No phpdoc highlight since there are not two * after the opening / * @return @@ -880,6 +924,26 @@ class B // ^ - meta.use // ^ storage.modifier + public static ?Foo $str = ''; +// ^^^^^^ storage.modifier +// ^^^^^^ storage.modifier +// ^ storage.type.nullable +// ^^^ support.class +// ^ punctuation.definition.variable +// ^^^ variable.other +// ^ keyword.operator.assignment + + public const STR_1 = ''; +// ^^^^^^ storage.modifier +// ^^^^^ storage.modifier +// ^^^^^ constant +// ^ keyword.operator.assignment + + const STR_2 = ''; +// ^^^^^ storage.modifier +// ^^^^^ constant +// ^ keyword.operator.assignment + public function abc(callable $var, int $var2, string $var3) // ^^^ entity.name.function // ^ storage.type @@ -1006,23 +1070,65 @@ function generate2() $var2 = -123.456e10; // ^^^^^^^^^^ constant.numeric.float.decimal +$var2 = -12_3.45_6e1_0; +// ^^^^^^^^^^^^^ constant.numeric.float.decimal + $var2 = -123.e10; // ^^^^^^^ constant.numeric.float.decimal +$var2 = -12_3.e1_0; +// ^^^^^^^^^ constant.numeric.float.decimal + $var2 = -.123e10; // ^^^^^^^ constant.numeric.float.decimal +$var2 = -.12_3e1_0; +// ^^^^^^^^^ constant.numeric.float.decimal + $var2 = -123e10; // ^^^^^^ constant.numeric.float.decimal +$var2 = -12_3e1_0; +// ^^^^^^^^ constant.numeric.float.decimal + $var3 = 0x0f; // ^^^^ constant.numeric.integer.hexadecimal // ^^ punctuation.definition.numeric.hexadecimal +$var3 = 0x0_f; +// ^^^^ constant.numeric.integer.hexadecimal +// ^^ punctuation.definition.numeric.hexadecimal + $var4 = 0b0111; // ^^^^^^ constant.numeric.integer.binary // ^^ punctuation.definition.numeric.binary +$var4 = 0b0_1_1_1; +// ^^^^^^^^^ constant.numeric.integer.binary +// ^^ punctuation.definition.numeric.binary + +// class name should be case-insensitive +$object = new ArRaYoBjEcT(); +// ^^^^^^^^^^^ support.class.builtin + +// constant name should be case-sensitive +$const = E_aLL; +// ^^^^^ - support.constant.core + +// function name should be case-sensitive +$random = ArRaY_RaNd($array); +// ^^^^^^^^^^ support.function.array + +// test for constants for each group in the syntax definition +$const = E_ALL; +// ^^^^^ support.constant.core +$const = CASE_LOWER; +// ^^^^^^^^^^ support.constant.std +$const = CURLAUTH_BASIC; +// ^^^^^^^^^^^^^^ support.constant.ext +$const = T_ABSTRACT; +// ^^^^^^^^^^ support.constant.parser-token + foo_bar: //^^^^^^^ entity.name.label.php - keyword.control.php @@ -1045,8 +1151,17 @@ function generate2() $a .= 1; // ^^ keyword.operator.assignment.augmented.php -if ($a !== $b); -// ^^^ keyword.operator.comparison.php +$a ??= 1; +// ^^^ keyword.operator.assignment.augmented.php + +if ($a && $b || !$c); +// ^^ keyword.operator.logical +// ^^ keyword.operator.logical +// ^ keyword.operator.logical + +if ($a !== $b || $a == $b); +// ^^^ keyword.operator.comparison +// ^^ keyword.operator.comparison if (): else: @@ -1244,6 +1359,8 @@ function generate2() $var // <- variable.other.php //^^ variable.other.php + ($var) +// ^^^^ variable.other.php JAVASCRIPT; // <- punctuation.section.embedded.end keyword.operator.heredoc @@ -1255,18 +1372,20 @@ function generate2() // <- entity.name.tag // ^ punctuation.section.property-list // ^^^^^^^ string.quoted.single -h3 {} +h3 {font-size: "$h3_size";} +// ^^^^^^^^ variable.other.php CSS; // <- punctuation.section.embedded.end keyword.operator.heredoc echo <<]' regexp_flags: '[msixpodualngcer]+\b' + # no odd number of backslashes behind (`\` or `\\\`) + # note: + # 1. For use in `escape` commands only !! + # 2. ST's Regex Compatibility Check marks it as incompatible + # as the real usage of the variable is not checked. + # It's a false positive as long as (1.) is respected. + no_escape_behind: '(? - match: (L)(<) @@ -204,182 +312,429 @@ contexts: scope: punctuation.definition.tag.end.perl pop: true - include: comment-pod-formatting - - include: literal-ltgt-nested + - include: literal-angle-nested -### [ DECLARATIONS ]########################################################## +###[ PACKAGE DEFINITION ]##################################################### - declarations: - # KEYWORD package + package: + # https://perldoc.perl.org/functions/package.html + # package NAMESPACE + # package NAMESPACE VERSION + # package NAMESPACE BLOCK + # package NAMESPACE VERSION BLOCK - match: \bpackage{{break}} - scope: keyword.declaration.package.perl - # KEYWORD 'my' and its friends - - match: \b(?:local|my|our|state){{break}} - scope: keyword.declaration.variable.perl - # KEYWORD no - - match: \bno{{break}} - scope: keyword.declaration.no.perl - push: - - meta_scope: meta.no.perl - - include: eol-pop - - include: pragma - - include: expressions - # KEYWORD use + scope: storage.type.namespace.perl keyword.declaration.namespace.perl + push: [package-end, package-version, package-namespace] + + package-namespace: + - include: qualified-namespace + - include: unqualified-namespace + - include: comment-line + - include: else-pop + + package-version: + - match: (")((v?)[\d_](\.)[\d_]+(?:(\.)[\d_]+)?)(") + scope: meta.string.perl string.quoted.double.perl + captures: + 1: punctuation.definition.string.begin.perl + 2: constant.numeric.version.perl + 3: punctuation.definition.version.perl + 4: punctuation.separator.decimal.perl + 5: punctuation.separator.decimal.perl + 6: punctuation.definition.string.end.perl + pop: true + - match: (')((v?)[\d_](\.)[\d_]+(?:(\.)[\d_]+)?)(') + scope: meta.string.perl string.quoted.single.perl + captures: + 1: punctuation.definition.string.begin.perl + 2: constant.numeric.version.perl + 3: punctuation.definition.version.perl + 4: punctuation.separator.decimal.perl + 5: punctuation.separator.decimal.perl + 6: punctuation.definition.string.end.perl + pop: true + - match: (v?)[\d_](\.)[\d_]+(?:(\.)[\d_]+)?\b + scope: constant.numeric.version.perl + captures: + 1: punctuation.definition.version.perl + 2: punctuation.separator.decimal.perl + 3: punctuation.separator.decimal.perl + pop: true + - include: comment-line + - include: else-pop + + package-end: + - meta_scope: meta.namespace.perl + - include: comment-line + - include: else-pop + + qualified-namespace: + - match: ({{identifier}})?(::) + captures: + 1: entity.name.namespace.perl + 2: punctuation.accessor.double-colon.perl + set: + - meta_scope: meta.path.perl + - match: ({{identifier}})(::) + captures: + 1: entity.name.namespace.perl + 2: punctuation.accessor.double-colon.perl + - include: unqualified-namespace + - include: immediately-pop + + unqualified-namespace: + - match: '{{identifier}}' + scope: entity.name.namespace.perl + pop: true + +###[ IMPORT STATEMENTS ]###################################################### + + imports: + # https://perldoc.perl.org/functions/require.html + # require MODULE + # require EXPR + - match: \brequire{{break}} + scope: keyword.control.import.require.perl + push: [require-end, require-body] + # https://perldoc.perl.org/functions/use.html + # use MODULE VERSION LIST + # use MODULE VERSION + # use MODULE LIST + # use MODULE + # use VERSION - match: \buse{{break}} scope: keyword.control.import.use.perl push: - - meta_scope: meta.use.perl - - include: eol-pop - - include: pragma - - include: expressions - # KEYWORD require - - match: \brequire{{break}} - scope: keyword.control.import.require.perl + - - meta_scope: meta.preprocessor.use.perl + - include: require-expression + - expressions-begin + - package-version + - package-namespace + # https://perldoc.perl.org/functions/no.html + # no MODULE VERSION LIST + # no MODULE VERSION + # no MODULE LIST + # no MODULE + # no VERSION + - match: \bno{{break}} + scope: keyword.control.import.no.perl push: - - meta_scope: meta.import.require.perl - - include: eol-pop - - include: expressions + - - meta_scope: meta.preprocessor.no.perl + - include: require-expression + - expressions-begin + - package-version + - package-namespace + + require-body: + - include: require-namespace + - include: comment-line + - match: (?=\S) + set: [require-expression, expressions-begin] - pragma: - # SEE: http://perldoc.perl.org/index-pragmas.html - # http://perldoc.perl.org/perlmodlib.html#Pragmatic-Modules - - match: |- - \b(?x: - attributes|autodie(?:\s*::\s*(?:exception(?:\s*::\s*system)|hints|skip))?|autouse - |base|bigint|bignum|bigrat|blib|bytes - |charnames|constant - |diagnostics - |encoding - |feature|fields|filetest - |if|integer - |less|lib|locale - |mro - |ok|open|ops|overload|overloading - |parent - |re - |sigtrap|sort|strict|subs - |threads|threads::shared - |utf8 - |vars|vmsish - |warnings|warnings\s*::\s*register){{break}} - scope: storage.modifier.perl - -### [ EXPRESSIONS ]########################################################### + require-namespace: + - include: qualified-namespace + - match: '{{identifier}}(?=\s*(?:[;)}#]|$))' + scope: entity.name.namespace.perl + pop: true - expressions: - - include: blocks - - include: groups - - include: constants - - include: class - - include: operators - - include: quoted-like - - include: control - - include: sub - - include: variables - - include: functions + require-expression: + - match: (?=[;)}]) + pop: true + - include: expressions + - match: \S + scope: meta.string.perl string.unquoted.perl + + require-end: + - meta_scope: meta.preprocessor.require.perl - include: comment-line - # // statement at line start - - match: ^ *(?=/.*[^\\]/) - push: regexp-pop + - include: else-pop + +###[ SUB STATEMENTS ]######################################################### -### [ BLOCKS AND GROUPS ]##################################################### + sub: + - match: \bsub{{break}} + scope: storage.type.function.perl keyword.declaration.function.perl + push: [sub-end, sub-parameters, sub-path] + # special functions which are executed at compile time + # SEE: https://perldoc.perl.org/perlmod.html#BEGIN%2c-UNITCHECK%2c-CHECK%2c-INIT-and-END + # NOTE: may not start with double colon when used without `sub` keyword + - match: (::)?(BEGIN|CHECK|END|INIT|UNITCHECK)(?=\s*(?:[;#{]|$)) + captures: + 1: invalid.illegal.accessor.perl + 2: entity.name.function.prepocessor.perl + push: [sub-end, sub-parameters] + + sub-path: + - match: ({{identifier}})?(::) + captures: + 1: variable.namespace.perl + 2: punctuation.accessor.double-colon.perl + set: + - meta_scope: meta.path.perl + - include: qualifier + - include: sub-name + - include: immediately-pop + - include: sub-name + - include: sub-common + + sub-name: + # callback hook to auto load or destroy objects/functions + - match: \b(AUTOLOAD|DESTROY){{break}} + scope: entity.name.function.callback.perl + pop: true + # special functions which are executed at compile time + - match: \b(BEGIN|CHECK|END|INIT|UNITCHECK){{break}} + scope: entity.name.function.prepocessor.perl + pop: true + # ordinary function identifier + - match: (?!{{reserved_words}}){{identifier}} + scope: entity.name.function.perl + pop: true + + sub-parameters: + - match: (?=\() + set: + - - clear_scopes: 1 + - meta_scope: meta.function.parameters.perl + - include: parameters-end + - match: '[$@%*&\\]+' + scope: variable.parameter.perl + - match: ; + scope: punctuation.separator.sequence.perl + - match: \S + scope: invalid.illegal.parameter.perl + - parameters-begin + - include: sub-attributes + - include: sub-common + + sub-attributes: + - match: '::' + scope: invalid.illegal.identifier.perl + - match: ':' + scope: punctuation.definition.annotation.perl + push: sub-attributes-name + + sub-attributes-name: + - meta_scope: meta.annotation.perl + - match: '{{identifier}}' + scope: variable.annotation.attribute.perl + set: + - meta_content_scope: meta.annotation.perl + - include: sub-attributes-parameters + - include: sub-attributes-parameters + + sub-attributes-parameters: + # NOTE: doesn't look like prototype parameters + - match: (?=\((?!\s*[$@%*&]+\s*[;)])) + set: + - - meta_scope: meta.annotation.parameters.perl + - include: parameters-end + - include: expressions-nested + - expressions-begin + - parameters-begin + - include: sub-common + + sub-common: + - match: (?=[:;({]|{{qualified_reserved_words}}) + pop: true + - include: comment-line + - match: \S + scope: invalid.illegal.identifier.perl + + sub-end: + - meta_scope: meta.function.perl + - include: sub-attributes + - include: sub-common + + parameters-begin: + - match: \( + scope: punctuation.section.parameters.begin.perl + pop: true + + parameters-end: + - match: \) + scope: punctuation.section.parameters.end.perl + pop: true + +###[ BLOCKS AND GROUPS ]###################################################### blocks: # can't push into scope due to HEREDOCs! - match: \{ scope: punctuation.section.block.begin.perl - push: regexp-pop + push: expressions-begin - match: \} scope: punctuation.section.block.end.perl blocks-nested: - match: \{ scope: punctuation.section.block.begin.perl - push: [blocks-nested-body, regexp-pop] + push: [blocks-nested-body, expressions-begin] blocks-nested-body: - match: \} scope: punctuation.section.block.end.perl pop: true + - include: main + + brackets: + # can't push into scope due to HEREDOCs! + - match: \[ + scope: punctuation.section.brackets.begin.perl + push: expressions-begin + - match: \] + scope: punctuation.section.brackets.end.perl + + brackets-nested: + - match: \[ + scope: punctuation.section.brackets.begin.perl + push: [brackets-nested-body, expressions-begin] + + brackets-nested-body: + - match: \] + scope: punctuation.section.brackets.end.perl + pop: true + - include: blocks-nested + - include: brackets-nested - include: expressions groups: # can't push into scope due to HEREDOCs! - match: \( scope: punctuation.section.group.begin.perl - push: regexp-pop + push: expressions-begin - match: \) scope: punctuation.section.group.end.perl groups-nested: - - match: \{ + - match: \( scope: punctuation.section.group.begin.perl - push: [groups-nested-body, regexp-pop] + push: [groups-nested-body, expressions-begin] groups-nested-body: - - match: \} + - match: \) scope: punctuation.section.group.end.perl pop: true - - include: expressions + - include: expressions-nested -### [ CONSTANTS ]############################################################# +###[ CONSTANTS ]############################################################## constants: + - include: constants-version - include: constants-numbers - include: constants-language + - include: constants-other - include: string - - match: \b\w+\s*(?==>) - scope: constant.other.key.perl constants-numbers: - # SEE: http://perldoc.perl.org/perlnumber.html - - match: 0b[01]+(?![\.\w+]) - scope: constant.numeric.binary.perl - - match: 0x[\h_]+(?![\.\w+]) - scope: constant.numeric.hex.perl - - include: constants-numbers-float - - include: constants-numbers-integer - - constants-numbers-float: - - match: (")([-+]?\d+\.\d+(?:e[-+]?\d+)?)(") - scope: string.quoted.double.perl + # SEE: https://perldoc.perl.org/perlnumber.html + # decimal floats + - match: |- + (?ix: + (") ( [-+]? (?: + (\.)[\d_]+ (?: e[-+]?[\d_]+ )? | # .1 .1e1 .1e-1 .1e+1 + [\d_]+ (?: (\.) (?: + [\d_]+ (?: e[-+]?[\d_]+ )? | # 1.1 1.1e1 1.1e-1 1.1e+1 + e[-+]?[\d_]+ )? | # 1. 1.e1 1.e-1 1.e+1 + e[-+]?[\d_]+ ) # 1e1 1e-1 1e+1 + ) ) (") + ) + scope: meta.string.perl string.quoted.double.perl captures: 1: punctuation.definition.string.begin.perl - 2: constant.numeric.float.perl - 3: punctuation.definition.string.end.perl - - match: (')([-+]?\d+\.\d+(?:e[-+]?\d+)?)(') - scope: string.quoted.single.perl + 2: constant.numeric.float.decimal.perl + 3: punctuation.separator.decimal.perl + 4: punctuation.separator.decimal.perl + 5: punctuation.definition.string.end.perl + - match: |- + (?ix: + (') ( [-+]? (?: + (\.)[\d_]+ (?: e[-+]?[\d_]+ )? | # .1 .1e1 .1e-1 .1e+1 + [\d_]+ (?: (\.) (?: + [\d_]+ (?: e[-+]?[\d_]+ )? | # 1.1 1.1e1 1.1e-1 1.1e+1 + e[-+]?[\d_]+ )? | # 1. 1.e1 1.e-1 1.e+1 + e[-+]?[\d_]+ ) # 1e1 1e-1 1e+1 + ) ) (') + ) + scope: meta.string.perl string.quoted.single.perl captures: 1: punctuation.definition.string.begin.perl - 2: constant.numeric.float.perl - 3: punctuation.definition.string.end.perl - - match: (?:[-+]|\b)\d+\.\d+(?:e[-+]?\d+)?(?![\.\w+]) - scope: constant.numeric.float.perl - - constants-numbers-integer: - - match: (")([-+]?\d+)(") - scope: string.quoted.double.perl + 2: constant.numeric.float.decimal.perl + 3: punctuation.separator.decimal.perl + 4: punctuation.separator.decimal.perl + 5: punctuation.definition.string.end.perl + - match: |- + (?ix: + (\.)[\d_]+ (?: e[-+]?[\d_]+ )? \b | # .1 .1e1 .1e-1 .1e+1 + \b[\d_]+ (?: (\.) (?: (?: + [\d_]+ (?: e[-+]?[\d_]+ )? \b | # 1.1 1.1e1 1.1e-1 1.1e+1 + e[-+]?[\d_]+\b ) | # 1.e1 1.e-1 1.e+1 + (?=[^.])) | # 1. (protect the .. operator) + e[-+]?[\d_]+\b ) # 1e1 1e-1 1e+1 + ) + scope: constant.numeric.float.decimal.perl + captures: + 1: punctuation.separator.decimal.perl + 2: punctuation.separator.decimal.perl + # decimal integers + - match: (")([-+]?[\d_]+)(") + scope: meta.string.perl string.quoted.double.perl captures: 1: punctuation.definition.string.begin.perl - 2: constant.numeric.integer.perl + 2: constant.numeric.integer.decimal.perl 3: punctuation.definition.string.end.perl - - match: (')([-+]?\d+)(') - scope: string.quoted.single.perl + - match: (')([-+]?[\d_]+)(') + scope: meta.string.perl string.quoted.single.perl captures: 1: punctuation.definition.string.begin.perl - 2: constant.numeric.integer.perl + 2: constant.numeric.integer.decimal.perl 3: punctuation.definition.string.end.perl - - match: (?:[-+]|\b)\d+(?![\.\w+]) - scope: constant.numeric.integer.perl + # binary integers + - match: \b(0[bB])[01_]+\b + scope: constant.numeric.integer.binary.perl + captures: + 1: punctuation.definition.numeric.binary.perl + # hexadecimal integers + - match: \b(0[xX])[\h_]+\b + scope: constant.numeric.integer.hexadecimal.perl + captures: + 1: punctuation.definition.numeric.hexadecimal.perl + # octal integers + - match: \b(0)[0-7_]+\b + scope: constant.numeric.integer.octal.perl + captures: + 1: punctuation.definition.numeric.octal.perl + # decimal integers + - match: \b[\d_]+\b + scope: constant.numeric.integer.decimal.perl constants-language: - match: \b__(?:END|DATA|FILE|LINE|PACKAGE|SUB)__\b scope: constant.language.perl - - match: \b(?:ARGV|ARGVOUT|STDERR|STDIN|STDOUT|DATA|IN|OUT){{break}} + - match: \b(?:ARGV|ARGVOUT|STDERR|STDIN|STDOUT|DATA|IN|OUT)\b scope: constant.language.filehandle.perl - - match: \b[A-Z0-9_]+{{break}} + + constants-other: + - match: '{{identifier}}(?=\s*=>)' + scope: constant.other.key.perl + # Not looking like a namespace, class, object or function? + - match: \b[A-Z_][A-Z0-9_]+\b(?!::|\s*(?:\(|->)) scope: constant.other.perl -### [ STRINGS ]############################################################### + constants-identifier: + - match: '{{identifier}}' + scope: constant.other.perl + + constants-version: + # SEE: https://perldoc.perl.org/functions/require.html + - match: (v?)[\d_](\.)[\d_]+(\.)[\d_]+\b + scope: constant.numeric.version.perl + captures: + 1: punctuation.definition.version.perl + 2: punctuation.separator.decimal.perl + 3: punctuation.separator.decimal.perl + +###[ STRINGS ]################################################################ string: - include: string-quoted-backtick @@ -388,140 +743,190 @@ contexts: - include: string-format - include: string-heredoc + string-quoted-angle-pop: + # NOTE: match only if... + # - doesn't look like an operator (`<=>`, `<<`) + # - closing punctuation `>` found on the same line + - match: \<(?!<|=>)(?=.*?>) + scope: punctuation.definition.string.begin.perl + set: + - meta_scope: meta.string.perl string.quoted.angle.perl + # prevent variable interpolation to break string termination + - match: (?:[$@%&*]#?)?(\>) + captures: + 1: punctuation.definition.string.end.perl + pop: true + - include: interpolated-angle-nested + - include: interpolated-common + string-quoted-backtick: - match: \` scope: punctuation.definition.string.begin.perl push: - - meta_scope: string.quoted.backtick.perl - - match: \` - scope: punctuation.definition.string.end.perl + - meta_scope: meta.string.perl string.quoted.backtick.perl + # prevent variable interpolation to break string termination + - match: (?:[$@%&*]#?)?(\`) + captures: + 1: punctuation.definition.string.end.perl pop: true - - include: character-escape + - include: interpolated-common string-quoted-double: - match: \" scope: punctuation.definition.string.begin.perl push: - - meta_scope: string.quoted.double.perl - - match: \" - scope: punctuation.definition.string.end.perl + - meta_scope: meta.string.perl string.quoted.double.perl + # prevent variable interpolation to break string termination + - match: (?:[$@%&*]#?)?(\") + captures: + 1: punctuation.definition.string.end.perl pop: true - - include: character-escape + - include: interpolated-common string-quoted-single: - match: \' scope: punctuation.definition.string.begin.perl push: - - meta_scope: string.quoted.single.perl + - meta_scope: meta.string.perl string.quoted.single.perl - match: \' scope: punctuation.definition.string.end.perl pop: true - - include: character-escape + - include: literal-common string-format: - # SEE: http://perldoc.perl.org/perlform.html - - match: ^\s*(format)\s+(\w+)\s*(=)\s*$ + # SEE: https://perldoc.perl.org/perlform.html + - match: \bformat{{break}} + scope: storage.type.format.perl + push: [string-format-meta, string-format-body, string-format-variable] + + string-format-meta: + - meta_scope: meta.format.perl + - include: immediately-pop + + string-format-variable: + - match: ({{identifier}})?(::) captures: - 1: storage.type.format.perl - 2: variable.other.perl - 3: keyword.operator.assignment.perl + 1: variable.namespace.perl + 2: punctuation.accessor.double-colon.perl push: - - meta_scope: meta.block.format.perl - - meta_content_scope: string.unquoted.format.perl + - meta_scope: meta.path.perl + - include: qualifier + - include: variable-identifier + - include: immediately-pop + - include: variable-identifier + - include: comment-line + - include: else-pop + + string-format-body: + - match: '=(?!=)' + scope: keyword.operator.assignment.perl + set: + - meta_content_scope: meta.string.perl string.unquoted.perl - match: ^\.(?=\s*$) scope: punctuation.terminator.format.perl pop: true + - match: \.{4,} # consume any dot sequence longer than 3 chars - match: \.{3} - scope: constant.character.escape.perl - - match: ~{1,2}(?!~) - scope: constant.character.escape.perl - - match: '[@\^]\*' - scope: variable.parameter.multiline-width.perl - - match: (\@)[0#\.|<>]+ - scope: variable.parameter.regular-field.perl + scope: constant.other.placeholder.text.perl + - match: ~{3,} # consume any tild sequence longer than 2 chars + - match: ~{1,2} + scope: constant.other.placeholder.text.perl + - match: ([@^])[<|>*]+ + scope: constant.other.placeholder.text.perl captures: 1: punctuation.definition.placeholder.begin.perl - - match: (\^)[0#\.|<>]+ - scope: variable.parameter.special-field.perl + - match: ([@^])0?[.#]+(?![_\d]) + scope: constant.other.placeholder.numeric.perl captures: 1: punctuation.definition.placeholder.begin.perl - - include: variables + - include: variables-interpolation + - include: comment-line + - match: \S+ + scope: invalid.illegal.identifier.perl + pop: true string-heredoc: # SEE: http://www.perlmeme.org/howtos/syntax/here_document.html - - match: (<<) *(?=['"]? *{{identifier}}) - captures: - 1: keyword.operator.heredoc.perl + - match: <<(?=(\s*['"]\s*)?{{identifier}}) + scope: keyword.operator.heredoc.perl push: [string-heredoc-meta, string-heredoc-body] string-heredoc-meta: - - meta_scope: meta.heredoc.perl + - meta_scope: meta.string.heredoc.perl - include: immediately-pop string-heredoc-body: # embedded css - - match: ((['"]?)( *CSS)(\2)) + - match: \s*((['"]?)(\s*CSS)(\2)) captures: - 1: string.other.heredoc.perl - 2: punctuation.definition.string.begin.perl - 3: constant.language.heredoc.css.perl - 4: punctuation.definition.string.end.perl + 1: meta.tag.heredoc.perl + 2: punctuation.definition.tag.begin.perl + 3: entity.name.tag.heredoc.css.perl + 4: punctuation.definition.tag.end.perl set: [string-heredoc-css, string-heredoc-expr] # embedded html - - match: ((['"]?)( *HTML)(\2)) + - match: \s*((['"]?)(\s*HTML)(\2)) captures: - 1: string.other.heredoc.perl - 2: punctuation.definition.string.begin.perl - 3: constant.language.heredoc.html.perl - 4: punctuation.definition.string.end.perl + 1: meta.tag.heredoc.perl + 2: punctuation.definition.tag.begin.perl + 3: entity.name.tag.heredoc.html.perl + 4: punctuation.definition.tag.end.perl set: [string-heredoc-html, string-heredoc-expr] # embedded javascript - - match: ((['"]?)( *JAVASCRIPT)(\2)) + - match: \s*((['"]?)(\s*JAVASCRIPT)(\2)) captures: - 1: string.other.heredoc.perl - 2: punctuation.definition.string.begin.perl - 3: constant.language.heredoc.js.perl - 4: punctuation.definition.string.end.perl + 1: meta.tag.heredoc.perl + 2: punctuation.definition.tag.begin.perl + 3: entity.name.tag.heredoc.js.perl + 4: punctuation.definition.tag.end.perl set: [string-heredoc-javascript, string-heredoc-expr] # embedded json - - match: ((['"]?)( *JSON)(\2)) + - match: \s*((['"]?)(\s*JSON)(\2)) captures: - 1: string.other.heredoc.perl - 2: punctuation.definition.string.begin.perl - 3: constant.language.heredoc.json.perl - 4: punctuation.definition.string.end.perl + 1: meta.tag.heredoc.perl + 2: punctuation.definition.tag.begin.perl + 3: entity.name.tag.heredoc.json.perl + 4: punctuation.definition.tag.end.perl set: [string-heredoc-json, string-heredoc-expr] # embedded sql - - match: ((['"]?)( *SQL)(\2)) + - match: \s*((['"]?)(\s*SQL)(\2)) captures: - 1: string.other.heredoc.perl - 2: punctuation.definition.string.begin.perl - 3: constant.language.heredoc.sql.perl - 4: punctuation.definition.string.end.perl + 1: meta.tag.heredoc.perl + 2: punctuation.definition.tag.begin.perl + 3: entity.name.tag.heredoc.sql.perl + 4: punctuation.definition.tag.end.perl set: [string-heredoc-sql, string-heredoc-expr] # embedded xml - - match: ((['"]?)( *XML)(\2)) + - match: \s*((['"]?)(\s*XML)(\2)) captures: - 1: string.other.heredoc.perl - 2: punctuation.definition.string.begin.perl - 3: constant.language.heredoc.xml.perl - 4: punctuation.definition.string.end.perl + 1: meta.tag.heredoc.perl + 2: punctuation.definition.tag.begin.perl + 3: entity.name.tag.heredoc.xml.perl + 4: punctuation.definition.tag.end.perl set: [string-heredoc-xml, string-heredoc-expr] - # any other tag like (EOD, EOT, FOO, ...) is handled as string - - match: ((['"]?)( *{{identifier}})(\2)) + # single quoted heredoc string without interpolation + - match: \s*((')(\s*{{identifier}})(')) captures: - 1: string.other.heredoc.perl - 2: punctuation.definition.string.begin.perl - 3: constant.language.heredoc.plain.perl - 4: punctuation.definition.string.end.perl - set: [string-heredoc-other, string-heredoc-expr] - - include: else-pop + 1: meta.tag.heredoc.perl + 2: punctuation.definition.tag.begin.perl + 3: entity.name.tag.heredoc.plain.perl + 4: punctuation.definition.tag.end.perl + set: [string-heredoc-plain, string-heredoc-expr] + # unquoted or double quoted heredoc string with interpolation + - match: \s*(("?)(\s*{{identifier}})(\2)) + captures: + 1: meta.tag.heredoc.perl + 2: punctuation.definition.tag.begin.perl + 3: entity.name.tag.heredoc.plain.perl + 4: punctuation.definition.tag.end.perl + set: [string-heredoc-interpolated, string-heredoc-expr] + - include: immediately-pop string-heredoc-expr: # The rest of the line right after the heredoc tag needs to be handled # as ordinary perl. The embedded syntax starts at the next line. - - clear_scopes: 1 # remove 'string.quoted' - - match: $ + - clear_scopes: 1 # remove 'source' + - match: ^ pop: true - include: expressions @@ -529,7 +934,7 @@ contexts: - meta_content_scope: source.css.embedded.perl # pop off only, if keyword is indented correctly - match: ^\3$ - scope: constant.language.heredoc.css.perl + scope: meta.tag.heredoc.perl entity.name.tag.heredoc.css.perl pop: true - match: '' embed: scope:source.css @@ -538,7 +943,7 @@ contexts: string-heredoc-html: - meta_content_scope: text.html.embedded.perl - match: ^\3$ - scope: constant.language.heredoc.html.perl + scope: meta.tag.heredoc.perl entity.name.tag.heredoc.html.perl pop: true - match: '' embed: scope:text.html.basic @@ -547,7 +952,7 @@ contexts: string-heredoc-javascript: - meta_content_scope: source.js.embedded.perl - match: ^\3$ - scope: constant.language.heredoc.js.perl + scope: meta.tag.heredoc.perl entity.name.tag.heredoc.js.perl pop: true - match: '' embed: scope:source.js @@ -556,7 +961,7 @@ contexts: string-heredoc-json: - meta_content_scope: source.json.embedded.perl - match: ^\3$ - scope: constant.language.heredoc.json.perl + scope: meta.tag.heredoc.perl entity.name.tag.heredoc.json.perl pop: true - match: '' embed: scope:source.json @@ -565,7 +970,7 @@ contexts: string-heredoc-sql: - meta_content_scope: source.sql.embedded.perl - match: ^\3$ - scope: constant.language.heredoc.sql.perl + scope: meta.tag.heredoc.perl entity.name.tag.heredoc.sql.perl pop: true - match: '' embed: scope:source.sql @@ -574,178 +979,285 @@ contexts: string-heredoc-xml: - meta_content_scope: text.xml.embedded.perl - match: ^\3$ - scope: constant.language.heredoc.xml.perl + scope: meta.tag.heredoc.perl entity.name.tag.heredoc.xml.perl pop: true - match: '' embed: scope:text.xml escape: (?=^ *XML$) - string-heredoc-other: - - meta_content_scope: string.quoted.other.perl + string-heredoc-plain: + - meta_content_scope: string.unquoted.heredoc.perl - match: ^\3$ - scope: constant.language.heredoc.plain.perl + scope: meta.tag.heredoc.perl entity.name.tag.heredoc.plain.perl pop: true -### [ CLASSES ]################################################################ + string-heredoc-interpolated: + - meta_content_scope: string.unquoted.heredoc.perl + - match: ^\3$ + scope: meta.tag.heredoc.perl entity.name.tag.heredoc.plain.perl + pop: true + - include: interpolated-common - class: - - match: '{{module}}(?=\s*(?:::|[#;]|$))' - scope: support.class.perl - push: members-pop +###[ KEYWORDS ]############################################################### - members-pop: - - match: \s*(::)\s*({{module}}) - captures: - 1: punctuation.accessor.double-colon.perl - 2: support.class.perl - - match: \s*(::)\s*({{identifier}}) + keywords: + # All keywords can be prefixed with the case sensitive `CORE` namespace. + # This context makes sure not to highlight the keywords as functions. + # The `meta.path` is not applied for simplicity reasons. + - match: \b(CORE)(::)(?={{reserved_words}}) captures: - 1: punctuation.accessor.double-colon.perl - 2: variable.other.member.perl - - include: else-pop - -### [ CONTROL KEYWORDS ]####################################################### - - control: - - match: \b(?:default|else|elsif|given|if|unless|when){{break}} - scope: keyword.control.conditional.perl - push: regexp-pop - - match: \b(?:break|caller|continue|die|dump|exit|goto|last|next|redo|return|wait){{break}} - scope: keyword.other.flow.perl - push: regexp-pop - - match: \b(?:do|for|foreach|until|while){{break}} - scope: keyword.control.flow.perl - push: regexp-pop - - include: label + 1: variable.namespace.perl + 2: punctuation.accessor.double-colon.perl + # declaration + - match: \b(?:{{storage_keywords}}){{break}} + scope: storage.type.variable.perl + # conditional + - match: \bdefault{{break}} + scope: keyword.control.conditional.default.perl + push: expressions-begin + - match: \belse{{break}} + scope: keyword.control.conditional.else.perl + push: expressions-begin + - match: \belsif{{break}} + scope: keyword.control.conditional.elseif.perl + push: expressions-begin + - match: \bgiven{{break}} + scope: keyword.control.conditional.given.perl + push: expressions-begin + - match: \bif{{break}} + scope: keyword.control.conditional.if.perl + push: expressions-begin + - match: \bunless{{break}} + scope: keyword.control.conditional.unless.perl + push: expressions-begin + - match: \bwhen{{break}} + scope: keyword.control.conditional.when.perl + push: expressions-begin + # flow + - match: \bbreak{{break}} + scope: keyword.control.flow.break.perl + push: expressions-begin + - match: \bcaller{{break}} + scope: keyword.control.flow.caller.perl + push: expressions-begin + - match: \bcontinue{{break}} + scope: keyword.control.flow.continue.perl + push: expressions-begin + - match: \bdie{{break}} + scope: keyword.control.flow.die.perl + push: expressions-begin + - match: \bdo{{break}} + scope: keyword.control.flow.do.perl + push: expressions-begin + - match: \bdump{{break}} + scope: keyword.control.flow.dump.perl + push: expressions-begin + - match: \bexit{{break}} + scope: keyword.control.flow.exit.perl + push: expressions-begin + - match: \bgoto{{break}} + scope: keyword.control.flow.goto.perl + push: expressions-begin + - match: \blast{{break}} + scope: keyword.control.flow.last.perl + push: label-usage + - match: \bnext{{break}} + scope: keyword.control.flow.next.perl + push: label-usage + - match: \bredo{{break}} + scope: keyword.control.flow.redo.perl + push: label-usage + - match: \breturn{{break}} + scope: keyword.control.flow.return.perl + push: expressions-begin + - match: \bwait{{break}} + scope: keyword.control.flow.wait.perl + push: expressions-begin + # loop + - match: \bfor{{break}} + scope: keyword.control.loop.for.perl + push: expressions-begin + - match: \bforeach{{break}} + scope: keyword.control.loop.foreach.perl + push: expressions-begin + - match: \buntil{{break}} + scope: keyword.control.loop.until.perl + push: expressions-begin + - match: \bwhile{{break}} + scope: keyword.control.loop.while.perl + push: expressions-begin + + label-usage: + # reserved words indicate an expression like label + - match: (?={{reserved_words}}|{{builtin_functions}}) + pop: true + - match: '{{identifier}}' + scope: variable.label.perl + pop: true + - include: expressions-begin label: - match: ({{identifier}})(:)(?!:) captures: 1: entity.name.label.perl 2: punctuation.separator.perl - push: regexp-pop + push: expressions-begin -### [ OPERATORS ]############################################################# +###[ OPERATORS ]############################################################## operators: # SEE: https://www.tutorialspoint.com/perl/perl_operators.htm + - match: => + scope: punctuation.separator.key-value.perl + push: expressions-begin - match: ',' scope: punctuation.separator.sequence.perl - push: regexp-pop + push: expressions-begin - match: ; scope: punctuation.terminator.statement.perl - push: regexp-pop + push: expressions-begin - match: -[rwx0RWXOezsfdlpSbctugkTBMAC]\b scope: keyword.operator.filetest.perl - push: regexp-pop - - match: '->' - scope: keyword.operator.arrow.perl - push: regexp-pop + push: expressions-begin - match: '[!~=]~' scope: keyword.operator.binary.perl - push: regexp-pop - - match: <=>|//|\&\&|\|\||==|!=|>=|<=|[<>:!?] + push: expressions-begin + - match: <<|>> + scope: keyword.operator.bitwise.perl + push: expressions-begin + - match: <=>|==|!=|>=|<=|[<>] + scope: keyword.operator.comparison.perl + push: expressions-begin + - match: \&\&|\|\||//|[:!?] scope: keyword.operator.logical.perl - push: regexp-pop - - match: '\*\*=|[-+*/%]=' + push: expressions-begin + - match: \*\*=|[-+*/%]=|= scope: keyword.operator.assignment.perl - push: regexp-pop - - match: '[-+*]{1,2}|/' + push: expressions-begin + - match: --|\+\+ + scope: keyword.operator.arithmetic.perl + push: maybe-regexp-match + - match: \*{1,2}|[-+/%] scope: keyword.operator.arithmetic.perl - push: regexp-pop + push: expressions-begin - match: '[&|^~]' scope: keyword.operator.bitwise.perl - push: regexp-pop - - match: =>? - scope: keyword.operator.assignment.perl - push: regexp-pop + push: expressions-begin - match: \.\. scope: keyword.operator.range.perl - push: regexp-pop + push: expressions-begin + # SEE: https://perldoc.perl.org/perlref.html#Making-References + - match: \\+ + scope: keyword.operator.reference.perl + push: expressions-begin # string concat - match: \.=? scope: keyword.operator.concat.perl - push: regexp-pop + push: expressions-begin # string concation # "string" x 10 - - match: \bx\b + - match: \bx{{break}} scope: keyword.operator.arithmetic.perl - push: regexp-pop - - match: \b(and|or|xor|as|cmp|eq|gt|ge|lg|le|ne|not){{break}} + push: expressions-begin + - match: \b(?:{{operator_keywords}}){{break}} scope: keyword.operator.logical.perl - push: regexp-pop + push: expressions-begin -### [ QUOTED LIKE ]########################################################### +###[ QUOTED LIKE ]############################################################ quoted-like: - # SEE: http://perldoc.perl.org/perlop.html#Regexp-Quote-Like-Operators + # SEE: https://perldoc.perl.org/perlop.html#Regexp-Quote-Like-Operators - include: quoted-like-match - - include: quoted-like-replace + - include: quoted-like-substitution + # fallback + - match: \b(?:{{quoted_like_keywords}}){{break}} + scope: support.function.perl quoted-like-match: - - match: \bq[qwx]?\b + # qq// and qx// with interpolation + - match: \bq[qx]{{break}} + scope: support.function.perl + push: + - quoted-like-meta + - quoted-like-args-interpolated + # q// and qw// without interpolation + - match: \bqw?{{break}} scope: support.function.perl push: - quoted-like-meta - - quoted-like-args-find-literal + - quoted-like-args-literal - match: \b(m|qr)(?=\s*[\(\[\{<]) scope: support.function.perl push: - quoted-like-meta - - quoted-like-flags - - quoted-like-args-find-rexexp + - quoted-like-args-flags + - quoted-like-args-pattern - match: \b(m|qr)({{regexp_delim}}) captures: 0: meta.function-call.perl 1: support.function.perl 2: punctuation.section.generic.begin.perl - embed_scope: meta.function-call.perl string.regexp.perl + embed_scope: meta.function-call.perl meta.string.perl string.regexp.perl embed: scope:source.regexp - escape: (? scope: punctuation.section.generic.end.perl pop: true @@ -772,39 +1284,154 @@ contexts: scope: punctuation.section.parens.begin.perl set: - meta_scope: meta.parens.perl - - meta_content_scope: string.regexp.perl + - meta_content_scope: meta.string.perl string.regexp.perl - match: \) scope: punctuation.section.parens.end.perl pop: true - include: scope:source.regexp#base-literal-extended - include: else-pop - quoted-like-args-find-literal: - - include: literal-braces-pop - - include: literal-brackets-pop - - include: literal-ltgt-pop - - include: literal-parens-pop - - include: literal-generic-pop + quoted-like-args-interpolated: + - include: interpolated-braces-pop + - include: interpolated-brackets-pop + - include: interpolated-angle-pop + - include: interpolated-parens-pop + - include: interpolated-generic-pop - include: else-pop - quoted-like-args-replace: + quoted-like-args-literal: - include: literal-braces-pop - include: literal-brackets-pop - - include: literal-ltgt-pop + - include: literal-angle-pop - include: literal-parens-pop + - include: literal-generic-pop - include: else-pop + interpolated-braces-pop: + - match: \{ + scope: punctuation.section.braces.begin.perl + set: + - meta_scope: meta.braces.perl + - meta_content_scope: meta.string.perl string.unquoted.perl + # prevent variable interpolation to break string termination + - match: ([$@%&*]#?)?(\}) + captures: + 1: meta.string.perl string.unquoted.perl + 2: punctuation.section.braces.end.perl + pop: true + - include: interpolated-braces-nested + - include: interpolated-common + + interpolated-braces-nested: + - match: \{ + push: + # prevent variable interpolation to break string termination + - match: (?:[$@%&*]#?)?\} + pop: true + - include: interpolated-braces-nested + - include: interpolated-common + + interpolated-brackets-pop: + - match: \[ + scope: punctuation.section.brackets.begin.perl + set: + - meta_scope: meta.brackets.perl + - meta_content_scope: meta.string.perl string.unquoted.perl + # prevent variable interpolation to break string termination + - match: ([$@%&*]#?)?(\]) + captures: + 1: meta.string.perl string.unquoted.perl + 2: punctuation.section.brackets.end.perl + pop: true + - include: interpolated-brackets-nested + - include: interpolated-common + + interpolated-brackets-nested: + - match: \[ + push: + # prevent variable interpolation to break string termination + - match: (?:[$@%&*]#?)?\] + pop: true + - include: interpolated-brackets-nested + - include: interpolated-common + + interpolated-angle-pop: + - match: \< + scope: punctuation.section.generic.begin.perl + set: + - meta_scope: meta.generic.perl + - meta_content_scope: meta.string.perl string.unquoted.perl + # prevent variable interpolation to break string termination + - match: ([$@%&*]#?)?(\>) + captures: + 1: meta.string.perl string.unquoted.perl + 2: punctuation.section.generic.end.perl + pop: true + - include: interpolated-angle-nested + - include: interpolated-common + + interpolated-angle-nested: + - match: \< + push: + # prevent variable interpolation to break string termination + - match: (?:[$@%&*]#?)?\> + pop: true + - include: interpolated-angle-nested + - include: interpolated-common + + interpolated-parens-pop: + - match: \( + scope: punctuation.section.parens.begin.perl + set: + - meta_scope: meta.parens.perl + - meta_content_scope: meta.string.perl string.unquoted.perl + # prevent variable interpolation to break string termination + - match: ([$@%&*]#?)?(\)) + captures: + 1: meta.string.perl string.unquoted.perl + 2: punctuation.section.parens.end.perl + pop: true + - include: interpolated-parens-nested + - include: interpolated-common + + interpolated-parens-nested: + - match: \( + push: + # prevent variable interpolation to break string termination + - match: (?:[$@%&*]#?)?\) + pop: true + - include: interpolated-parens-nested + - include: interpolated-common + + interpolated-generic-pop: + - match: ({{regexp_delim}}) + scope: punctuation.section.generic.begin.perl + set: + - meta_scope: meta.generic.perl + - meta_content_scope: meta.string.perl string.unquoted.perl + # prevent variable interpolation to break string termination + - match: ([$@%&*]#?)?(\1) + captures: + 1: meta.string.perl string.unquoted.perl + 2: punctuation.section.generic.end.perl + pop: true + - include: interpolated-common + + interpolated-common: + - include: literal-common + - include: variables-interpolation + literal-braces-pop: - match: \{ scope: punctuation.section.braces.begin.perl set: - meta_scope: meta.braces.perl - - meta_content_scope: string.unquoted.perl + - meta_content_scope: meta.string.perl string.unquoted.perl - match: \} scope: punctuation.section.braces.end.perl pop: true - include: literal-braces-nested - - include: character-escape + - include: literal-common literal-braces-nested: - match: \{ @@ -812,19 +1439,19 @@ contexts: - match: \} pop: true - include: literal-braces-nested - - include: character-escape + - include: literal-common literal-brackets-pop: - match: \[ scope: punctuation.section.brackets.begin.perl set: - meta_scope: meta.brackets.perl - - meta_content_scope: string.unquoted.perl + - meta_content_scope: meta.string.perl string.unquoted.perl - match: \] scope: punctuation.section.brackets.end.perl pop: true - include: literal-brackets-nested - - include: character-escape + - include: literal-common literal-brackets-nested: - match: \[ @@ -832,39 +1459,39 @@ contexts: - match: \] pop: true - include: literal-brackets-nested - - include: character-escape + - include: literal-common - literal-ltgt-pop: + literal-angle-pop: - match: \< scope: punctuation.section.generic.begin.perl set: - meta_scope: meta.generic.perl - - meta_content_scope: string.unquoted.perl + - meta_content_scope: meta.string.perl string.unquoted.perl - match: \> scope: punctuation.section.generic.end.perl pop: true - - include: literal-ltgt-nested - - include: character-escape + - include: literal-angle-nested + - include: literal-common - literal-ltgt-nested: + literal-angle-nested: - match: \< push: - match: \> pop: true - - include: literal-ltgt-nested - - include: character-escape + - include: literal-angle-nested + - include: literal-common literal-parens-pop: - match: \( scope: punctuation.section.parens.begin.perl set: - meta_scope: meta.parens.perl - - meta_content_scope: string.unquoted.perl + - meta_content_scope: meta.string.perl string.unquoted.perl - match: \) scope: punctuation.section.parens.end.perl pop: true - include: literal-parens-nested - - include: character-escape + - include: literal-common literal-parens-nested: - match: \( @@ -872,184 +1499,353 @@ contexts: - match: \) pop: true - include: literal-parens-nested - - include: character-escape + - include: literal-common literal-generic-pop: - match: ({{regexp_delim}}) scope: punctuation.section.generic.begin.perl set: - meta_scope: meta.generic.perl - - meta_content_scope: string.unquoted.perl + - meta_content_scope: meta.string.perl string.unquoted.perl - match: \1 scope: punctuation.section.generic.end.perl pop: true - - include: character-escape + - include: literal-common - character-escape: - - match: \\. + literal-common: + # SEE: https://perldoc.perl.org/functions/sprintf.html + - match: '%%|\\.' scope: constant.character.escape.perl + - match: |- + (?x: + (%) # punctuation + (?: \d+\$ )? # index + (?: \s*[-+]\s* | [ #0] )? # flags + (?: \* (?: \d+\$ )? | \d+ )? # width + (?: + v\d* | # vector flag + (\.) (?: \* (?: \d+\$ )? | \d+ )? # precision + )? + (?: hh|ll|[hjlLqtz])? # size + [aAbBcdDeEfFgGinoOpsuUxX] # control sequence + ) + scope: constant.other.placeholder.perl + captures: + 1: punctuation.definition.placeholder.perl + 2: punctuation.separator.decimal.perl -### [ REGEXP ] ############################################################### +###[ REGEXP ]################################################################# - regexp-pop: + maybe-regexp-match: # // - match: / scope: punctuation.section.generic.begin.perl - embed_scope: string.regexp.perl + embed_scope: meta.string.perl string.regexp.perl embed: scope:source.regexp - escape: (? + scope: punctuation.accessor.arrow.perl + push: + # member function + - match: '{{identifier}}(?!::)' + scope: meta.function-call.perl variable.function.member.perl + pop: true + # item access like $array->[0] + - match: (?=[{\[]) + set: maybe-item-access + - include: comment-line + - include: else-pop + # Class->member + - match: '{{identifier}}(?=\s*->)' + scope: variable.namespace.perl + # Module::SubModule::function + # ::SubModule::function + - match: ({{identifier}})?(::) captures: - 1: entity.name.function.perl - - match: \b{{member}}{{break}} - scope: variable.function.perl - push: regexp-pop + 1: variable.namespace.perl + 2: punctuation.accessor.double-colon.perl + push: + - meta_scope: meta.path.perl + - match: '{{identifier}}(?=\s*->)' + scope: variable.namespace.perl + pop: true + - include: qualifier + - include: unqualified-variables + - include: function-identifier + + function-identifier: + # builtin function calls + - match: '{{builtin_functions}}' + scope: meta.function-call.perl support.function.perl + set: expressions-begin + # user defined function calls + - match: '{{identifier}}{{break}}' + scope: meta.function-call.perl variable.function.perl + set: expressions-begin + - include: immediately-pop -### [ SUB ]################################################################### + unqualified-function-call: + # builtin function calls + - match: '{{builtin_functions}}' + scope: meta.function-call.perl support.function.perl + push: expressions-begin + # user defined function calls + - match: '{{identifier}}(?=\s*(?:$|[;#/(''"`$@%]|<<|(?!(?:{{operator_keywords}}){{break}})\w))' + scope: meta.function-call.perl variable.function.perl + push: expressions-begin + +###[ VARIABLES INTERPOLATION ]################################################ + + variables-interpolation: + # note: coderefs `&` are not interpolated + - match: (?=[@$%]) + push: + - - clear_scopes: 1 # remove 'string' + - meta_scope: meta.interpolation.perl + - include: maybe-item-access + - variables-interpolation-body + + variables-interpolation-body: + ########################################################################### + # 1) This context is a merge of + # `qualified-variables` and `unqualified-variables` + # + # a) The `push: maybe-item-access` is replaced by `pop: true` as the + # item access is matched globally. + # b) The `&` coderef parts are removed as they are not supported within + # string interpolations. + # + # 2) The interpolation needs to be poped off from after each variable + # to ensure to correctly pop off from the owning context if needed. + # Otherwise the variable `$/` could break the statement `s//$repl$/g`. + ########################################################################### + + # qualified variable + - match: ([$@%*]#?)({{identifier}})?(::) + captures: + 1: punctuation.definition.variable.perl + 2: variable.namespace.perl + 3: punctuation.accessor.double-colon.perl + set: qualified-variables-path - sub: - - match: \bsub\b - scope: keyword.control.sub.perl - push: sub-name + # regexp match + - match: ([$@%*]#?)[`&'] + scope: variable.language.regexp.match.perl + captures: + 1: punctuation.definition.variable.perl + pop: true + # note: `*` may look like an operator + - match: ([$@%]#?)(?:[-+]|[1-9]+) + scope: variable.language.regexp.match-group.perl + captures: + 1: punctuation.definition.variable.perl + pop: true + # builtin + - match: ([$@%*]#?){{builtin_variables}} + scope: variable.language.perl + captures: + 1: punctuation.definition.variable.perl + pop: true + - match: |- + (?x: + ([$@%*]\#?) + (?: + \^[A-Z]? | + [".:,;\]~?!/\\|()<>] | + [$@%](?![-+]) # no regexp match + )(?![$@%\w]) + ) + scope: variable.language.perl + captures: + 1: punctuation.definition.variable.perl + pop: true + # builtin variable, which may look like an operator + - match: ([$@]\#?)= + scope: variable.language.perl + captures: + 1: punctuation.definition.variable.perl + pop: true + # user defined variables + - match: ([$@%*]#?){{identifier}} + scope: variable.other.readwrite.perl + captures: + 1: punctuation.definition.variable.perl + pop: true + # deprecated/legacy variables + # - $# and $* were variables up to Perl v5.10.0 + - match: (\$)[#*\[](?=[^\w{$@%*]) + scope: variable.language.deprecated.perl + captures: + 1: punctuation.definition.variable.perl + pop: true + # dereferenced variables (without `&`) + - match: ([$@%*]#?)(\{)\s*({{identifier}})\s*(\}) + scope: meta.variable.perl + captures: + 1: keyword.operator.dereference.perl + 2: punctuation.definition.variable.begin.perl + 3: meta.string.perl string.unquoted.perl + 4: punctuation.definition.variable.end.perl + pop: true + - match: ([$@%*]#?)(\{) + captures: + 1: keyword.operator.dereference.perl + 2: punctuation.definition.variable.begin.perl + set: [variable-body, expressions-begin] + # nothing matches, give up + - include: immediately-pop - sub-name: - - meta_scope: meta.function.perl - - match: '{{identifier}}' - scope: entity.name.function.perl - set: sub-expect-parameters - - include: sub-expect-block +###[ VARIABLES ]############################################################## - sub-expect-parameters: - - meta_content_scope: meta.function.perl - - match: (?=\() - set: sub-parameters - - include: sub-expect-block - - match: \S - scope: invalid.illegal.function-name.perl + qualified-variables: + - match: ([$@%*]#?)({{identifier}})?(::) + captures: + 1: punctuation.definition.variable.perl + 2: variable.namespace.perl + 3: punctuation.accessor.double-colon.perl + push: [maybe-item-access, qualified-variables-path] + + qualified-variables-path: + - meta_scope: meta.path.perl + - include: qualifier + - include: variable-identifier + - include: unqualified-variables + - include: immediately-pop - sub-parameters: - - match: \( - scope: punctuation.section.group.begin.perl - set: - - meta_scope: meta.function.parameters.perl - - match: \) - scope: punctuation.section.group.end.perl - set: sub-expect-block - - match: '[\$\@\*;][^\s,\)]*' - scope: variable.parameter.perl - - include: expressions - - sub-expect-block: - - meta_content_scope: meta.function.perl - - include: term-pop - - match: $|(?=\{) - set: - - match: \{ - scope: punctuation.section.block.begin.perl - set: [sub-block-body, regexp-pop] - - include: comment-line - - include: comment-pod - - match: (?=\S) - pop: true + qualifier: + - match: ({{identifier}})?(::) + captures: + 1: variable.namespace.perl + 2: punctuation.accessor.double-colon.perl - sub-block-body: - - meta_scope: meta.function.perl meta.block.perl - - match: \} - scope: punctuation.section.block.end.perl + variable-identifier: + - match: '{{identifier}}' + scope: variable.other.readwrite.perl pop: true - - include: main - -### [ VARIABLES ]############################################################# - variables: - # SEE: http://perldoc.perl.org/perlvar.html - - match: (\$)&(?!\w) - scope: variable.other.regexp.match.perl + unqualified-variables: + # SEE: https://perldoc.perl.org/perlvar.html + # regexp match + - match: ([$@%*]#?)[`&'] + scope: variable.language.regexp.match.perl captures: 1: punctuation.definition.variable.perl - - match: (\$)`(?!\w) - scope: variable.other.regexp.pre-match.perl + push: maybe-item-access + # note: `*` may look like an operator + - match: ([$@%]#?)(?:[-+]|[1-9]+) + scope: variable.language.regexp.match-group.perl captures: 1: punctuation.definition.variable.perl - - match: (\$)\'(?!\w) - scope: variable.other.regexp.post-match.perl + push: maybe-item-access + # builtin + - match: ([$@%*]#?){{builtin_variables}} + scope: variable.language.perl captures: 1: punctuation.definition.variable.perl - - match: (\$)\+(?!\w) - scope: variable.other.regexp.last-paren-match.perl + push: maybe-item-access + - match: |- + (?x: + ([$@%*]\#?) + (?: + \^[A-Z]? | + [".:,;\]~?!/\\|()<>] | + [$@%](?![-+]) # no regexp match + )(?![$@%\w]) + ) + scope: variable.language.perl captures: 1: punctuation.definition.variable.perl - - match: (\$)\"(?!\w) - scope: variable.other.readwrite.list-separator.perl + push: maybe-item-access + # builtin variable, which may look like an operator + - match: ([$@]\#?)= + scope: variable.language.perl captures: 1: punctuation.definition.variable.perl - - match: (\$)0\b - scope: variable.other.predefined.program-name.perl + push: maybe-item-access + # user defined variables + - match: ([$@%*]#?){{identifier}} + scope: variable.other.readwrite.perl captures: 1: punctuation.definition.variable.perl - - match: (\$)[0-9]+\b - scope: variable.other.subpattern.perl + push: maybe-item-access + # deprecated/legacy variables + # - $# and $* were variables up to Perl v5.10.0 + - match: (\$)[#*\[](?=[^\w{$@%*]) + scope: variable.language.deprecated.perl captures: 1: punctuation.definition.variable.perl - # $Module::SubModule::member - # $::SubModule::member - - match: ([\$\@\%]#?)({{module}})?(?=\s*::) + push: maybe-item-access + # dereferenced variables + - match: ([$@%*&]#?)(\{)\s*({{identifier}})\s*(\}) + scope: meta.variable.perl captures: - 1: punctuation.definition.variable.perl - 2: support.class.perl - push: - - meta_scope: variable.other.readwrite.global.perl - - include: members-pop - - match: (\$)(\^[A-Z]|[_ab\*\.\/\|,\\;#%=\-~^:?!\$<>\(\)\[\]@])(?!\w) - scope: variable.other.predefined.perl + 1: keyword.operator.dereference.perl + 2: punctuation.definition.variable.begin.perl + 3: meta.string.perl string.unquoted.perl + 4: punctuation.definition.variable.end.perl + push: maybe-item-access + - match: ([$@%*&]#?)(\{) + captures: + 1: keyword.operator.dereference.perl + 2: punctuation.definition.variable.begin.perl + push: [maybe-item-access, variable-body, expressions-begin] + - match: '[$@%&]#?(?=[\w$@%*]|::)' + scope: keyword.operator.dereference.perl + push: function-identifier + + variable-not-operator: + # variables that look like operators need special treatment + - match: (\*#?)(?:[-+]|[1-9]+) + scope: variable.language.regexp.match-group.perl captures: 1: punctuation.definition.variable.perl - - match: ([\$\@\%]#?)(\w+)\b - scope: variable.other.readwrite.global.perl + set: maybe-item-access + - match: ([%*])= + scope: variable.language.perl captures: 1: punctuation.definition.variable.perl - - match: ([\$\@\%])(\{) - scope: punctuation.definition.variable.begin.perl + set: maybe-item-access + + variable-body: + - meta_scope: meta.variable.perl + - match: \} + scope: punctuation.definition.variable.end.perl + pop: true + - include: expressions-nested + + maybe-item-access: + # SEE: https://perldoc.perl.org/perllol.html + - match: \[ + scope: punctuation.section.item-access.begin.perl push: - - meta_scope: meta.braces.perl variable.other.readwrite.global.perl - - match: \} - scope: punctuation.definition.variable.end.perl - pop: true - - include: blocks-nested - - include: expressions + - - meta_scope: meta.item-access.perl + - match: \] + scope: punctuation.section.item-access.end.perl + pop: true + - include: expressions-nested + - expressions-begin + - match: (\{)\s*({{identifier}})\s*(\}) + scope: meta.item-access.perl + captures: + 1: punctuation.section.item-access.begin.perl + 2: constant.other.key.perl + 3: punctuation.section.item-access.end.perl + - match: \{ + scope: punctuation.section.item-access.begin.perl + push: + - - meta_scope: meta.item-access.perl + - match: \} + scope: punctuation.section.item-access.end.perl + pop: true + - include: expressions-nested + - expressions-begin + - include: immediately-pop diff --git a/Perl/syntax_test_perl.pl b/Perl/syntax_test_perl.pl index 5df20f7549..d35e2107c2 100644 --- a/Perl/syntax_test_perl.pl +++ b/Perl/syntax_test_perl.pl @@ -4,19 +4,19 @@ # ^^^^^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.perl # ^ - punctuation -### [ POD TESTS ] ############################################################ +###[ POD TESTS ] ############################################################# =pod -# <- comment.block.documentation.perl entity.name.tag.pod.perl -#^^^ comment.block.documentation.perl entity.name.tag.pod.perl +# <- meta.comment.perl comment.block.documentation.perl entity.name.tag.pod.perl +#^^^ meta.comment.perl comment.block.documentation.perl entity.name.tag.pod.perl =encoding utf8 -# <- comment.block.documentation.perl entity.name.tag.pod.perl -#^^^^^^^^^^^^^ comment.block.documentation.perl +# <- meta.comment.perl comment.block.documentation.perl entity.name.tag.pod.perl +#^^^^^^^^^^^^^ meta.comment.perl comment.block.documentation.perl #^^^^^^^^ entity.name.tag.pod.perl # ^^^^ markup.heading.perl =head1 B<--param> -# <- comment.block.documentation.perl entity.name.tag.pod.perl -#^^^^^^^^^^^^^^^^ comment.block.documentation.perl +# <- meta.comment.perl comment.block.documentation.perl entity.name.tag.pod.perl +#^^^^^^^^^^^^^^^^ meta.comment.perl comment.block.documentation.perl #^^^^^ entity.name.tag.pod.perl # ^^^^^^^^^^ markup.heading.perl # ^ entity.name.tag.bold.perl @@ -24,44 +24,44 @@ =head1 B<--param> # ^^^^^^^ markup.bold.perl # ^ punctuation.definition.tag.end.perl B -# ^^^^^^^ comment.block.documentation.perl +# ^^^^^^^ meta.comment.perl comment.block.documentation.perl # ^ entity.name.tag.bold.perl # ^ punctuation.definition.tag.begin.perl # ^^^^ markup.bold.perl # ^ punctuation.definition.tag.end.perl C -# ^^^^^^^ comment.block.documentation.perl +# ^^^^^^^ meta.comment.perl comment.block.documentation.perl # ^ entity.name.tag.code.perl # ^ punctuation.definition.tag.begin.perl # ^^^^ markup.quote.perl # ^ punctuation.definition.tag.end.perl E -# ^^^^^ comment.block.documentation.perl +# ^^^^^ meta.comment.perl comment.block.documentation.perl # ^ entity.name.tag.escaped.perl # ^ punctuation.definition.tag.begin.perl # ^^ constant.character.escape.perl # ^ punctuation.definition.tag.end.perl F -# ^^^^^^^^^^^ comment.block.documentation.perl +# ^^^^^^^^^^^ meta.comment.perl comment.block.documentation.perl # ^ entity.name.tag.filename.perl # ^ punctuation.definition.tag.begin.perl -# ^^^^^^^^ string.unquoted.perl +# ^^^^^^^^ meta.string.perl string.unquoted.perl # ^ punctuation.definition.tag.end.perl I -# ^^^^^^^^^ comment.block.documentation.perl +# ^^^^^^^^^ meta.comment.perl comment.block.documentation.perl # ^ entity.name.tag.italic.perl # ^ punctuation.definition.tag.begin.perl # ^^^^^^ markup.italic.perl # ^ punctuation.definition.tag.end.perl L -# ^^^^^^^^^^^^^^^^^^^^^^^^ comment.block.documentation.perl +# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.comment.perl comment.block.documentation.perl # ^ entity.name.tag.link.perl # ^ punctuation.definition.tag.begin.perl # ^^^^^^^^^^^^^^^^^^^^ markup.underline.link.perl # ^ punctuation.definition.tag.end.perl L -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block.documentation.perl +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.comment.perl comment.block.documentation.perl # ^ entity.name.tag.link.perl # ^ punctuation.definition.tag.begin.perl # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.perl @@ -75,7 +75,7 @@ =head1 B<--param> # ^ punctuation.definition.tag.end.perl # ^ punctuation.definition.tag.end.perl X -# ^^^^^^^^^^^^^^ comment.block.documentation.perl +# ^^^^^^^^^^^^^^ meta.comment.perl comment.block.documentation.perl # ^ entity.name.tag.index.perl # ^ punctuation.definition.tag.begin.perl # ^^^^^^^^^^^ entity.name.label.perl @@ -85,298 +85,980 @@ =head1 B<--param> # ^ entity.name.tag.escaped.perl =begin css -# <- entity.name.tag.pod.perl -#^^^^^^ entity.name.tag.pod.perl -# ^^^ string.unquoted.perl +# <- meta.comment.perl meta.interpolation.perl entity.name.tag.pod.perl +#^^^^^^^^^^ meta.comment.perl meta.interpolation.perl +#^^^^^ entity.name.tag.pod.perl +# ^ - constant - entity +# ^^^ constant.other.language-name.css.perl a { }; -# ^^^^^^^ comment.block.documentation.perl source.css.embedded.perl source.css +# ^^^^^^^ meta.comment.perl meta.interpolation.perl source.css.embedded.perl source.css =end -# <- comment.block.documentation.perl entity.name.tag.pod.perl -#^^^ comment.block.documentation.perl entity.name.tag.pod.perl +# <- meta.comment.perl meta.interpolation.perl entity.name.tag.pod.perl +#^^^ meta.comment.perl meta.interpolation.perl entity.name.tag.pod.perl =begin html -# <- comment.block.documentation.perl entity.name.tag.pod.perl -#^^^^^^^^^^ comment.block.documentation.perl -# ^^^^ string.unquoted.perl +# <- meta.comment.perl meta.interpolation.perl entity.name.tag.pod.perl +#^^^^^^^^^^ meta.comment.perl meta.interpolation.perl +#^^^^^ entity.name.tag.pod.perl +# ^ - constant - entity +# ^^^^ constant.other.language-name.html.perl -# <- comment.block.documentation.perl text.html.embedded.perl -#^^^^^^^^^ comment.block.documentation.perl text.html.embedded.perl +# <- meta.comment.perl meta.interpolation.perl text.html.embedded.perl +#^^^^^^^^^ meta.comment.perl meta.interpolation.perl text.html.embedded.perl -# <- comment.block.documentation.perl text.html.embedded.perl -#^^^^^^^^^ comment.block.documentation.perl text.html.embedded.perl +# <- meta.comment.perl meta.interpolation.perl text.html.embedded.perl +#^^^^^^^^^ meta.comment.perl meta.interpolation.perl text.html.embedded.perl =end -# <- comment.block.documentation.perl entity.name.tag.pod.perl -#^^^ comment.block.documentation.perl entity.name.tag.pod.perl +# <- meta.comment.perl meta.interpolation.perl entity.name.tag.pod.perl +#^^^ meta.comment.perl meta.interpolation.perl entity.name.tag.pod.perl =begin json -# <- entity.name.tag.pod.perl -#^^^^^^ entity.name.tag.pod.perl -# ^^^ string.unquoted.perl +# <- meta.comment.perl meta.interpolation.perl entity.name.tag.pod.perl +#^^^^^^^^^^ meta.comment.perl meta.interpolation.perl +#^^^^^ entity.name.tag.pod.perl +# ^ - constant - entity +# ^^^^ constant.other.language-name.json.perl { -# ^ comment.block.documentation.perl source.json.embedded.perl source.json +# ^ meta.comment.perl meta.interpolation.perl source.json.embedded.perl source.json "key": "value", -# ^^^^^^^^^^^^^^^ comment.block.documentation.perl source.json.embedded.perl source.json +# ^^^^^^^^^^^^^^^ meta.comment.perl meta.interpolation.perl source.json.embedded.perl source.json } -# ^ comment.block.documentation.perl source.json.embedded.perl source.json +# ^ meta.comment.perl meta.interpolation.perl source.json.embedded.perl source.json =end -# <- comment.block.documentation.perl entity.name.tag.pod.perl -#^^^ comment.block.documentation.perl entity.name.tag.pod.perl +# <- meta.comment.perl meta.interpolation.perl entity.name.tag.pod.perl +#^^^ meta.comment.perl meta.interpolation.perl entity.name.tag.pod.perl =begin sql -# <- entity.name.tag.pod.perl -#^^^^^^ entity.name.tag.pod.perl -# ^^^ string.unquoted.perl +# <- meta.comment.perl meta.interpolation.perl entity.name.tag.pod.perl +#^^^^^^^^^^ meta.comment.perl meta.interpolation.perl +#^^^^^ entity.name.tag.pod.perl +# ^ - constant - entity +# ^^^ constant.other.language-name.sql.perl SELECT * FROM `table` -# ^^^^^^^^^^^^^^^^^^^^^ comment.block.documentation.perl source.sql.embedded.perl source.sql +# ^^^^^^^^^^^^^^^^^^^^^ meta.comment.perl meta.interpolation.perl source.sql.embedded.perl source.sql =end -# <- comment.block.documentation.perl entity.name.tag.pod.perl -#^^^ comment.block.documentation.perl entity.name.tag.pod.perl +# <- meta.comment.perl meta.interpolation.perl entity.name.tag.pod.perl +#^^^ meta.comment.perl meta.interpolation.perl entity.name.tag.pod.perl =cut -# <- comment.block.documentation.perl entity.name.tag.pod.perl -#^^^ comment.block.documentation.perl entity.name.tag.pod.perl +# <- meta.comment.perl comment.block.documentation.perl entity.name.tag.pod.perl +#^^^ meta.comment.perl comment.block.documentation.perl entity.name.tag.pod.perl + +###[ FORMAT ]################################################################# + +format. +#^^^^^ meta.format.perl storage.type.format.perl +# ^ meta.format.perl invalid.illegal.identifier.perl + +format = +#^^^^^ meta.format.perl storage.type.format.perl +# ^ meta.format.perl keyword.operator.assignment.perl + text +# ^^^^^ meta.format.perl meta.string.perl string.unquoted.perl +. +# <- meta.format.perl punctuation.terminator.format.perl -### [ FORMAT ] ############################################################### +format +#^^^^^ meta.format.perl storage.type.format.perl + = +# ^ meta.format.perl keyword.operator.assignment.perl + text +# ^^^^^ meta.format.perl meta.string.perl string.unquoted.perl +. +# <- meta.format.perl punctuation.terminator.format.perl + +format format +#^^^^^ meta.format.perl storage.type.format.perl +# ^^^^^^ meta.format.perl variable.other.readwrite.perl +illegal +#^^^^^^ meta.format.perl invalid.illegal.identifier.perl + +format format = +#^^^^^ meta.format.perl storage.type.format.perl +# ^^^^^^ meta.format.perl variable.other.readwrite.perl +# ^ meta.format.perl keyword.operator.assignment.perl + text +# ^^^^^ meta.format.perl meta.string.perl string.unquoted.perl +. +# <- meta.format.perl punctuation.terminator.format.perl -format name = -# <- meta.block.format.perl storage.type.format.perl -#^^^^^^^^^^^^^ meta.block.format.perl +format +#^^^^^ meta.format.perl storage.type.format.perl + format +# ^^^^^^ meta.format.perl variable.other.readwrite.perl + = +# ^ meta.format.perl keyword.operator.assignment.perl + text +# ^^^^^ meta.format.perl meta.string.perl string.unquoted.perl +. +# <- meta.format.perl punctuation.terminator.format.perl + +format if::format = +#^^^^^^^^^^^^^^^^^^^ meta.format.perl #^^^^^ storage.type.format.perl -# ^^^^ variable.other.perl +# ^^ meta.path.perl variable.namespace.perl +# ^^ meta.path.perl punctuation.accessor.double-colon.perl +# ^^^^^^ meta.path.perl variable.other.readwrite.perl +# ^ keyword.operator.assignment.perl + text +# ^^^^^ meta.format.perl meta.string.perl string.unquoted.perl +. +# <- meta.format.perl punctuation.terminator.format.perl + +CORE::format if::format = +#^^^ variable.namespace.perl - meta.format +# ^^^^^^^^^^^^^^^^^^^^ meta.format.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^^^ storage.type.format.perl +# ^^ meta.path.perl variable.namespace.perl +# ^^ meta.path.perl punctuation.accessor.double-colon.perl +# ^^^^^^ meta.path.perl variable.other.readwrite.perl +# ^ keyword.operator.assignment.perl + text +# ^^^^^ meta.format.perl meta.string.perl string.unquoted.perl +. +# <- meta.format.perl punctuation.terminator.format.perl + +core::format +# ^^^^^^ - storage.type.format.perl +format::func +#^^^^^ - storage.type.format.perl +format $var = +#^^^^^^^^^^ meta.format.perl +# ^^ - meta.format.perl +# ^^^^ invalid.illegal.identifier.perl # ^ keyword.operator.assignment.perl +format var[0] = +#^^^^^^^^^^^^ meta.format.perl +# ^^ - meta.format.perl +# ^^^ variable.other.readwrite.perl +# ^^^ invalid.illegal.identifier.perl +# ^ keyword.operator.assignment.perl +format ns::$ns::var = +#^^^^^^^^^^^^^^^^^^ meta.format.perl +# ^^ - meta.format.perl +# ^^ variable.namespace.perl +# ^^^^^^^^ invalid.illegal.identifier.perl +# ^ keyword.operator.assignment.perl +format var = +# <- storage.type.format.perl +#^^^^^ meta.format.perl storage.type.format.perl +# ^^^ variable.other.readwrite.perl +# ^ keyword.operator.assignment.perl + ... terminate a text field, show "..." as truncation evidence +#^ meta.string.perl string.unquoted.perl - constant +# ^^^ meta.string.perl string.unquoted.perl constant.other.placeholder.text.perl +# ^ meta.string.perl string.unquoted.perl - constant + .... +#^^^^^^ meta.string.perl string.unquoted.perl - constant + ~ suppress line with all fields empty +#^ meta.string.perl string.unquoted.perl - constant +# ^ meta.string.perl string.unquoted.perl constant.other.placeholder.text.perl +# ^ meta.string.perl string.unquoted.perl - constant + ~~ repeat line until all fields are exhausted +#^ meta.string.perl string.unquoted.perl - constant +# ^^ meta.string.perl string.unquoted.perl constant.other.placeholder.text.perl +# ^ meta.string.perl string.unquoted.perl - constant + ~~~~ +#^^^^^^ meta.string.perl string.unquoted.perl - constant + ^0.### +#^ meta.string.perl string.unquoted.perl - constant +# ^^^^^^ meta.string.perl constant.other.placeholder.numeric.perl +# ^ punctuation.definition.placeholder.begin.perl +# ^ meta.string.perl string.unquoted.perl - constant + ^0##.# +#^ meta.string.perl string.unquoted.perl - constant +# ^^^^^^ meta.string.perl constant.other.placeholder.numeric.perl +# ^ punctuation.definition.placeholder.begin.perl +# ^ meta.string.perl string.unquoted.perl - constant ^#.### +#^ meta.string.perl string.unquoted.perl - constant +# ^^^^^^ meta.string.perl constant.other.placeholder.numeric.perl # ^ punctuation.definition.placeholder.begin.perl -# ^^^^^^ variable.parameter.special-field.perl - @#.### +# ^ meta.string.perl string.unquoted.perl - constant + ^<<<<< ^||||| ^>>>>> +#^ meta.string.perl string.unquoted.perl - constant +# ^^^^^^ meta.string.perl constant.other.placeholder.text.perl # ^ punctuation.definition.placeholder.begin.perl -# ^^^^^^ variable.parameter.regular-field.perl - ^* -# ^^ variable.parameter.multiline-width.perl - @* -# ^^ variable.parameter.multiline-width.perl - @variable -# ^^^^^^^^^ variable.other.readwrite.global.perl -# ^ punctuation.definition.variable.perl - ... -# ^^^ constant.character.escape.perl - ~ -# ^ constant.character.escape.perl - ~~ -# ^^ constant.character.escape.perl +# ^^^ meta.string.perl string.unquoted.perl - constant +# ^^^^^^ meta.string.perl constant.other.placeholder.text.perl +# ^ punctuation.definition.placeholder.begin.perl +# ^^^ meta.string.perl string.unquoted.perl - constant +# ^^^^^^ meta.string.perl constant.other.placeholder.text.perl +# ^ punctuation.definition.placeholder.begin.perl +# ^ meta.string.perl string.unquoted.perl - constant + @#.### @0.### @0##.# +#^ meta.string.perl string.unquoted.perl - constant +# ^^^^^^ meta.string.perl constant.other.placeholder.numeric.perl +# ^ punctuation.definition.placeholder.begin.perl +# ^^^ meta.string.perl string.unquoted.perl - constant +# ^^^^^^ meta.string.perl constant.other.placeholder.numeric.perl +# ^ punctuation.definition.placeholder.begin.perl +# ^^^ meta.string.perl string.unquoted.perl - constant +# ^^^^^^ meta.string.perl constant.other.placeholder.numeric.perl +# ^ punctuation.definition.placeholder.begin.perl +# ^ meta.string.perl string.unquoted.perl - constant + @<<<<< @||||| @>>>>> +#^ meta.string.perl string.unquoted.perl - constant +# ^^^^^^ meta.string.perl constant.other.placeholder.text.perl +# ^ punctuation.definition.placeholder.begin.perl +# ^^^ meta.string.perl string.unquoted.perl - constant +# ^^^^^^ meta.string.perl constant.other.placeholder.text.perl +# ^ punctuation.definition.placeholder.begin.perl +# ^^^ meta.string.perl string.unquoted.perl - constant +# ^^^^^^ meta.string.perl constant.other.placeholder.text.perl +# ^ punctuation.definition.placeholder.begin.perl +# ^ meta.string.perl string.unquoted.perl - constant + ^* variable width field for next line of a multi-line value +#^ meta.string.perl string.unquoted.perl - constant +# ^^ meta.string.perl constant.other.placeholder.text.perl +# ^ punctuation.definition.placeholder.begin.perl +# ^ meta.string.perl string.unquoted.perl - constant + @* variable width field for a multi-line value +# ^^ meta.string.perl constant.other.placeholder.text.perl +# ^ punctuation.definition.placeholder.begin.perl +# ^ meta.string.perl string.unquoted.perl - constant + @variable as test @array[0] @noarray [0] +#^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^^^^^^^ meta.string.perl meta.interpolation.perl variable.other.readwrite.perl - string.unquoted +# ^^^^^^^^^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^^^^^^^ meta.string.perl meta.interpolation.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^^^^^^ meta.string.perl meta.interpolation.perl - string.unquoted +# ^^^^^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^ punctuation.definition.variable.perl + $& $&[0] $&{'key'} +#^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.regexp.match.perl - string.unquoted +# ^ punctuation.definition.variable.perl +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.regexp.match.perl - string.unquoted +# ^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.regexp.match.perl - string.unquoted +# ^^^^^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation + $` $`[0] $`{'key'} +#^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.regexp.match.perl - string.unquoted +# ^ punctuation.definition.variable.perl +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.regexp.match.perl - string.unquoted +# ^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.regexp.match.perl - string.unquoted +# ^^^^^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation + $' $'[0] $'{'key'} +#^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.regexp.match.perl - string.unquoted +# ^ punctuation.definition.variable.perl +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.regexp.match.perl - string.unquoted +# ^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.regexp.match.perl - string.unquoted +# ^^^^^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation + $+ $+[0] $+{'key'} +#^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.regexp.match-group.perl - string.unquoted +# ^ punctuation.definition.variable.perl +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.regexp.match-group.perl - string.unquoted +# ^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.regexp.match-group.perl - string.unquoted +# ^^^^^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation + $" $"[0] $"{'key'} +#^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^ punctuation.definition.variable.perl +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^^^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation + $0 $0[0] $0{'key'} +#^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^ punctuation.definition.variable.perl +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^^^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation + @0 @0[0] @0{'key'} +#^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^ punctuation.definition.variable.perl +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^^^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation + %0 %0[0] %0{'key'} +#^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^ punctuation.definition.variable.perl +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^^^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation + $1 $1[0] $1{'key'} +#^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.regexp.match-group.perl - string.unquoted +# ^ punctuation.definition.variable.perl +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.regexp.match-group.perl - string.unquoted +# ^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.regexp.match-group.perl - string.unquoted +# ^^^^^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation + $_ $_[0] $_{'key'} +#^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^ punctuation.definition.variable.perl +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^^^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation + @_ @_[0] @_{'key'} +#^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^ punctuation.definition.variable.perl +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^^^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation + %_ %_[0] %_{'key'} +#^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^ punctuation.definition.variable.perl +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^^^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation + $#0 $#0[0] $#0{'key'} +#^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^^^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation + @#0 @#0[0] @#0{'key'} +#^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^^^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation + %#0 %#0[0] %#0{'key'} +#^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^^^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation + $#_ $#_[0] $#_{'key'} +#^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^^^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation + @#_ @#_[0] @#_{'key'} +#^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^^^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation + %#_ %#_[0] %#_{'key'} +#^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^ meta.string.perl meta.interpolation.perl variable.language.perl - string.unquoted +# ^^^^^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation + $Foo::Bar::baz $Foo::Bar::baz[0] $Foo::Bar::baz{'key'} +#^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^^^^^^^^^^^^ meta.string.perl meta.path.perl +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^^^^^^^^^^^^ meta.string.perl meta.path.perl +# ^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^^^^^^^^^^^^ meta.string.perl meta.path.perl +# ^^^^^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^ punctuation.definition.variable.perl +# ^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.other.readwrite.perl + ${ $foo[4] + $bar{baz} }[0]{'key'} +#^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.perl meta.variable.perl +# ^^^^^^^^^^ meta.string.perl meta.interpolation.perl meta.item-access.perl - string.unquoted +# ^ meta.string.perl string.unquoted.perl - meta.interpolation . -# <- punctuation.terminator.format.perl +# <- meta.format.perl punctuation.terminator.format.perl + +###[ SPRINTF FORMAT ]######################################################### + + "%???[|]? + + # sequences + + %% a percent sign +# ^^ constant.character.escape.perl + + %c %s %d %u %o %x %e %f %g %i +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^ - constant.other.placeholder -### [ HEREDOC ] ############################################################## + %X %E %G %b %B %p %n %a %A %F +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^ - constant.other.placeholder -$var = << CSS; -# ^^^^^^^ meta.heredoc.perl + %D = %ld %U = %lu %O = %lo %F = %f +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^^^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^^^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^^^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^^^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl + + # flags + + % d %+d %+ d % +d +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^^ constant.other.placeholder.perl +# ^ - constant.other.placeholder + %*s %6s %-6s %06s %*2$s %10.5s +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^^^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^^^^ constant.other.placeholder.perl +# ^ punctuation.separator.decimal.perl +# ^ - constant.other.placeholder + %#o %#O +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^ constant.other.placeholder.perl +# ^ - constant.other.placeholder + %#x %#X +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^ constant.other.placeholder.perl +# ^ - constant.other.placeholder + %#b %#B +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^ constant.other.placeholder.perl +# ^ - constant.other.placeholder + + # vector flag + + v%vd +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^ constant.other.placeholder.perl +# ^ - constant.other.placeholder + %0*v8b +#^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^^^^ constant.other.placeholder.perl +# ^ - constant.other.placeholder + %*4$vX +#^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^^^^ constant.other.placeholder.perl +# ^ - constant.other.placeholder + + # precicion + + %#.5o +#^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^^^ constant.other.placeholder.perl +# ^ punctuation.separator.decimal.perl +# ^ - constant.other.placeholder + + %f %.1f %.0f %e %0.1e +#^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^^ constant.other.placeholder.perl +# ^ punctuation.separator.decimal.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^^ constant.other.placeholder.perl +# ^ punctuation.separator.decimal.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^ constant.other.placeholder.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^^^ constant.other.placeholder.perl +# ^ punctuation.separator.decimal.perl +# ^ - constant.other.placeholder + + %-10.6d %#.6x %010.6x %6.*2$x +#^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^^^^^ constant.other.placeholder.perl +# ^ punctuation.separator.decimal.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^^^ constant.other.placeholder.perl +# ^ punctuation.separator.decimal.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^^^^^ constant.other.placeholder.perl +# ^ punctuation.separator.decimal.perl +# ^ - constant.other.placeholder +# ^ constant.other.placeholder.perl punctuation.definition.placeholder.perl +# ^^^^^^ constant.other.placeholder.perl +# ^ punctuation.separator.decimal.perl +# ^ - constant.other.placeholder + + # placeholder with interpolation (good luck!) +" + +###[ HEREDOC ]################################################################ + +$var = < -# <- meta.heredoc.perl text.html.embedded.perl -#^^^^^^^^^ meta.heredoc.perl text.html.embedded.perl +# <- meta.string.heredoc.perl text.html.embedded.perl +#^^^^^^^^^ meta.string.heredoc.perl text.html.embedded.perl HTML -# <- meta.heredoc.perl constant.language.heredoc.html.perl -#^^^ meta.heredoc.perl constant.language.heredoc.html.perl +# <- meta.string.heredoc.perl entity.name.tag.heredoc.html.perl +#^^^ meta.string.heredoc.perl entity.name.tag.heredoc.html.perl $var = <<'HTML'; -# <- variable.other.readwrite.global.perl -#^^^ variable.other.readwrite.global.perl +# <- variable.other.readwrite.perl +#^^^ variable.other.readwrite.perl # ^ keyword.operator.assignment.perl -# ^^^^^^^^^^ meta.heredoc.perl +# ^^^^^^^^^^ meta.string.heredoc.perl # ^^ keyword.operator.heredoc.perl -# ^^^^^^ string.other.heredoc.perl -# ^ punctuation.definition.string.begin.perl -# ^^^^ constant.language.heredoc.html.perl -# ^ punctuation.definition.string.end.perl +# ^ punctuation.definition.tag.begin.perl +# ^^^^^^ meta.tag.heredoc.perl +# ^^^^ entity.name.tag.heredoc.html.perl +# ^ punctuation.definition.tag.end.perl # ^ punctuation.terminator.statement.perl +# ^ - source.html.embedded.perl
-# <- meta.heredoc.perl text.html.embedded.perl -#^^^^^^^^^ meta.heredoc.perl text.html.embedded.perl +# <- meta.string.heredoc.perl text.html.embedded.perl +#^^^^^^^^^ meta.string.heredoc.perl text.html.embedded.perl HTML -# <- meta.heredoc.perl constant.language.heredoc.html.perl -#^^^ meta.heredoc.perl constant.language.heredoc.html.perl +# <- meta.string.heredoc.perl entity.name.tag.heredoc.html.perl +#^^^ meta.string.heredoc.perl entity.name.tag.heredoc.html.perl $var = <<"HTML"; -# <- variable.other.readwrite.global.perl -#^^^ variable.other.readwrite.global.perl +# <- variable.other.readwrite.perl +#^^^ variable.other.readwrite.perl # ^ keyword.operator.assignment.perl -# ^^^^^^^^^^ meta.heredoc.perl +# ^^^^^^^^^^ meta.string.heredoc.perl # ^^ keyword.operator.heredoc.perl -# ^^^^^^ string.other.heredoc.perl -# ^ punctuation.definition.string.begin.perl -# ^^^^ constant.language.heredoc.html.perl -# ^ punctuation.definition.string.end.perl +# ^ punctuation.definition.tag.begin.perl +# ^^^^^^ meta.tag.heredoc.perl +# ^^^^ entity.name.tag.heredoc.html.perl +# ^ punctuation.definition.tag.end.perl # ^ punctuation.terminator.statement.perl +# ^ - source.html.embedded.perl
-# <- meta.heredoc.perl text.html.embedded.perl -#^^^^^^^^^ meta.heredoc.perl text.html.embedded.perl +# <- meta.string.heredoc.perl text.html.embedded.perl +#^^^^^^^^^ meta.string.heredoc.perl text.html.embedded.perl HTML -# <- meta.heredoc.perl constant.language.heredoc.html.perl -#^^^ meta.heredoc.perl constant.language.heredoc.html.perl +# <- meta.string.heredoc.perl entity.name.tag.heredoc.html.perl +#^^^ meta.string.heredoc.perl entity.name.tag.heredoc.html.perl $var ? < -# <- meta.heredoc.perl text.html.embedded.perl -#^^^^^^^^^ meta.heredoc.perl text.html.embedded.perl +# <- meta.string.heredoc.perl text.html.embedded.perl +#^^^^^^^^^ meta.string.heredoc.perl text.html.embedded.perl HTML -# <- meta.heredoc.perl constant.language.heredoc.html.perl -#^^^ meta.heredoc.perl constant.language.heredoc.html.perl +# <- meta.string.heredoc.perl entity.name.tag.heredoc.html.perl +#^^^ meta.string.heredoc.perl entity.name.tag.heredoc.html.perl +# ^ - source.html.embedded.perl
-# <- meta.heredoc.perl text.html.embedded.perl -#^^^^^^^^^ meta.heredoc.perl text.html.embedded.perl +# <- meta.string.heredoc.perl text.html.embedded.perl +#^^^^^^^^^ meta.string.heredoc.perl text.html.embedded.perl HTML -# ^^^^ meta.heredoc.perl text.html.embedded.perl - constant.language.heredoc.html.perl +# ^^^^ meta.string.heredoc.perl text.html.embedded.perl - constant.other.language-name.html.perl HTML -# <- meta.heredoc.perl constant.language.heredoc.html.perl -#^^^ meta.heredoc.perl constant.language.heredoc.html.perl +# <- meta.string.heredoc.perl entity.name.tag.heredoc.html.perl +#^^^ meta.string.heredoc.perl entity.name.tag.heredoc.html.perl +# ^ - meta.string.heredoc.perl HTML # <- constant.other.perl #^^^ constant.other.perl $var = < -# ^^^^^^^^^^^^^^^ meta.heredoc.perl text.xml.embedded.perl +# ^^^^^^^^^^^^^^^ meta.string.heredoc.perl text.xml.embedded.perl XML -# <- meta.heredoc.perl constant.language.heredoc.xml.perl -#^^ meta.heredoc.perl constant.language.heredoc.xml.perl +# <- meta.string.heredoc.perl entity.name.tag.heredoc.xml.perl +#^^ meta.string.heredoc.perl entity.name.tag.heredoc.xml.perl $var = <<_EOD_; -# ^^^^^^^^^ meta.heredoc.perl +# ^^^^^^^^^ meta.string.heredoc.perl # ^^ keyword.operator.heredoc.perl -# ^^^^^ constant.language.heredoc.plain.perl +# ^^^^^ meta.tag.heredoc.perl entity.name.tag.heredoc.plain.perl # ^ punctuation.terminator.statement.perl - foo bar baz -# <- meta.heredoc.perl string.quoted.other.perl -#^^^^^^^^^^^^^ meta.heredoc.perl string.quoted.other.perl +# ^ - string.unquoted.heredoc.perl +HEREDOC \$with _&a_$var interpolation. +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.heredoc.perl +#^^^^^^^^^^^^^^^^^^ string.unquoted.heredoc.perl - meta.interpolation +# ^^ constant.character.escape.perl +# ^^^^ meta.interpolation.perl - string +# ^^^^^^^^^^^^^^^ string.unquoted.heredoc.perl - meta.interpolation _EOD_ -# <- meta.heredoc.perl constant.language.heredoc.plain.perl -#^^^^ meta.heredoc.perl constant.language.heredoc.plain.perl +# <- meta.string.heredoc.perl entity.name.tag.heredoc.plain.perl +#^^^^ meta.string.heredoc.perl entity.name.tag.heredoc.plain.perl + +$var = << _EOD_ +# ^^^^^^^^^ - meta.string.heredoc +# ^^ keyword.operator.bitwise.perl +# ^^^^^ constant.other.perl + +$var = << ' _EOD_'; +# ^^^^^^^^^^^^^^^ meta.string.heredoc.perl +# ^^ keyword.operator.heredoc.perl +# ^ punctuation.definition.tag.begin.perl +# ^^^^^^^^^^^ meta.tag.heredoc.perl +# ^^^^^^^^^ entity.name.tag.heredoc.plain.perl +# ^ punctuation.definition.tag.end.perl +# ^ punctuation.terminator.statement.perl +# ^ - string.unquoted.heredoc.perl +HEREDOC \$without $var interpolation. +# <- meta.string.heredoc.perl string.unquoted.heredoc.perl +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.heredoc.perl string.unquoted.heredoc.perl + _EOD_ +# ^^^^^^ meta.string.heredoc.perl string.unquoted.heredoc.perl + _EOD_ +# <- meta.string.heredoc.perl entity.name.tag.heredoc.plain.perl +#^^^^^^^^ meta.string.heredoc.perl entity.name.tag.heredoc.plain.perl $var = << " _EOD_"; -# ^^^^^^^^^^^^^^^ meta.heredoc.perl +# ^^^^^^^^^^^^^^^ meta.string.heredoc.perl # ^^ keyword.operator.heredoc.perl -# ^ punctuation.definition.string.begin.perl -# ^^^^^^^^^^^ string.other.heredoc.perl -# ^^^^^^^^^ constant.language.heredoc.plain.perl -# ^ punctuation.definition.string.end.perl +# ^ punctuation.definition.tag.begin.perl +# ^^^^^^^^^^^ meta.tag.heredoc.perl +# ^^^^^^^^^ entity.name.tag.heredoc.plain.perl +# ^ punctuation.definition.tag.end.perl # ^ punctuation.terminator.statement.perl - foo bar baz -# <- meta.heredoc.perl string.quoted.other.perl -#^^^^^^^^^^^^^ meta.heredoc.perl string.quoted.other.perl +# ^ - string.unquoted.heredoc.perl +HEREDOC \$with $var interpolation. +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.heredoc.perl +#^^^^^^^^^^^^^^ string.unquoted.heredoc - meta.interpolation +# ^^ constant.character.escape.perl +# ^^^^ meta.interpolation.perl - string +# ^^^^^^^^^^^^^^^ string.unquoted.heredoc - meta.interpolation _EOD_ -# ^^^^^^ meta.heredoc.perl string.quoted.other.perl +# ^^^^^^ meta.string.heredoc.perl string.unquoted.heredoc.perl _EOD_ -# <- meta.heredoc.perl constant.language.heredoc.plain.perl -#^^^^^^^^ meta.heredoc.perl constant.language.heredoc.plain.perl +# <- meta.string.heredoc.perl entity.name.tag.heredoc.plain.perl +#^^^^^^^^ meta.string.heredoc.perl entity.name.tag.heredoc.plain.perl + +$var = < -# ^^ keyword.operator.arrow.perl +# ^^ punctuation.accessor.arrow.perl **= # ^^^ keyword.operator.assignment.perl -= @@ -396,6 +1078,8 @@ =head1 B<--param> ** # ^^ keyword.operator.arithmetic.perl / +# ^ keyword.operator.arithmetic.perl + % # ^ keyword.operator.arithmetic.perl !~ # ^^ keyword.operator.binary.perl @@ -404,7 +1088,7 @@ =head1 B<--param> ~~ # ^^ keyword.operator.binary.perl <=> -# ^^^ keyword.operator.logical.perl +# ^^^ keyword.operator.comparison.perl // # ^^ keyword.operator.logical.perl && @@ -412,17 +1096,17 @@ =head1 B<--param> || # ^^ keyword.operator.logical.perl == -# ^^ keyword.operator.logical.perl +# ^^ keyword.operator.comparison.perl != -# ^^ keyword.operator.logical.perl +# ^^ keyword.operator.comparison.perl >= -# ^^ keyword.operator.logical.perl +# ^^ keyword.operator.comparison.perl <= -# ^^ keyword.operator.logical.perl +# ^^ keyword.operator.comparison.perl > -# ^ keyword.operator.logical.perl +# ^ keyword.operator.comparison.perl < -# ^ keyword.operator.logical.perl +# ^ keyword.operator.comparison.perl ! # ^ keyword.operator.logical.perl ? @@ -443,212 +1127,250 @@ =head1 B<--param> # ^^ keyword.operator.concat.perl .. # ^^ keyword.operator.range.perl + \ \\ \\\ +# ^ keyword.operator.reference.perl +# ^^ keyword.operator.reference.perl +# ^^^ keyword.operator.reference.perl -### [ VARIABLES ]############################################################# + and or xor as cmp eq gt ge lt le ne not +#^ - keyword +# ^^^ keyword.operator.logical.perl +# ^ - keyword +# ^^ keyword.operator.logical.perl +# ^ - keyword +# ^^^ keyword.operator.logical.perl +# ^ - keyword +# ^^ keyword.operator.logical.perl +# ^ - keyword +# ^^^ keyword.operator.logical.perl +# ^ - keyword +# ^^ keyword.operator.logical.perl +# ^ - keyword +# ^^ keyword.operator.logical.perl +# ^ - keyword +# ^^ keyword.operator.logical.perl +# ^ - keyword +# ^^ keyword.operator.logical.perl +# ^ - keyword +# ^^ keyword.operator.logical.perl +# ^ - keyword +# ^^ keyword.operator.logical.perl +# ^ - keyword +# ^^^ keyword.operator.logical.perl +# ^ - keyword - $& -# ^^ variable.other.regexp.match.perl -# ^ punctuation.definition.variable.perl - $` -# ^^ variable.other.regexp.pre-match.perl -# ^ punctuation.definition.variable.perl - $' -# ^^ variable.other.regexp.post-match.perl -# ^ punctuation.definition.variable.perl - $+ -# ^^ variable.other.regexp.last-paren-match.perl -# ^ punctuation.definition.variable.perl - $" -# ^^ variable.other.readwrite.list-separator.perl -# ^ punctuation.definition.variable.perl - $0 -# ^^ variable.other.predefined.program-name.perl -# ^ punctuation.definition.variable.perl - @0 -# ^^ variable.other.readwrite.global.perl -# ^ punctuation.definition.variable.perl - %0 -# ^^ variable.other.readwrite.global.perl -# ^ punctuation.definition.variable.perl - $1 -# ^^ variable.other.subpattern.perl -# ^ punctuation.definition.variable.perl - @1 -# ^^ variable.other.readwrite.global.perl -# ^ punctuation.definition.variable.perl - %1 -# ^^ variable.other.readwrite.global.perl -# ^ punctuation.definition.variable.perl - $_ -# ^^ variable.other.predefined.perl -# ^ punctuation.definition.variable.perl - @_ -# ^^ variable.other.readwrite.global.perl -# ^ punctuation.definition.variable.perl - %_ -# ^^ variable.other.readwrite.global.perl -# ^ punctuation.definition.variable.perl - $#0 -# ^^^ variable.other.readwrite.global.perl -# ^^ punctuation.definition.variable.perl - @#0 -# ^^^ variable.other.readwrite.global.perl -# ^^ punctuation.definition.variable.perl - %#0 -# ^^^ variable.other.readwrite.global.perl -# ^^ punctuation.definition.variable.perl - $#_ -# ^^^ variable.other.readwrite.global.perl -# ^^ punctuation.definition.variable.perl - @#_ -# ^^^ variable.other.readwrite.global.perl -# ^^ punctuation.definition.variable.perl - %#_ -# ^^^ variable.other.readwrite.global.perl -# ^^ punctuation.definition.variable.perl - $Foo::Bar::baz -# ^^^^^^^^^^^^^^ variable.other.readwrite.global.perl -# ^ punctuation.definition.variable.perl -# ^^^ support.class.perl -# ^^ punctuation.accessor.double-colon.perl -# ^^^ support.class.perl -# ^^ punctuation.accessor.double-colon.perl -# ^^^ variable.other.member.perl - $Foo :: Bar :: baz -# ^^^^^^^^^^^^^^ variable.other.readwrite.global.perl -# ^ punctuation.definition.variable.perl -# ^^^ support.class.perl -# ^^ punctuation.accessor.double-colon.perl -# ^^^ support.class.perl -# ^^ punctuation.accessor.double-colon.perl -# ^^^ variable.other.member.perl - $Foo::Bar->$baz -# ^^^^^^^^^ variable.other.readwrite.global.perl -# ^ punctuation.definition.variable.perl -# ^^^ support.class.perl -# ^^ punctuation.accessor.double-colon.perl -# ^^^ support.class.perl -# ^^ keyword.operator.arrow.perl - variable -# ^^^^ variable.other.readwrite.global.perl -# ^ punctuation.definition.variable.perl - $Foo :: Bar -> $baz -# ^^^^^^^^^ variable.other.readwrite.global.perl -# ^ punctuation.definition.variable.perl -# ^^^ support.class.perl -# ^^ punctuation.accessor.double-colon.perl -# ^^^ support.class.perl -# ^^ keyword.operator.arrow.perl - variable -# ^^^^ variable.other.readwrite.global.perl -# ^ punctuation.definition.variable.perl - $c = C::Scan->new(KEY => 'value') -# ^^ variable.other.readwrite.global.perl -# ^ keyword.operator.assignment.perl -# ^ support.class.perl -# ^^ punctuation.accessor.double-colon.perl -# ^^^^ support.class.perl -# ^^ keyword.operator.arrow.perl -# ^^^ variable.function.perl -# ^ punctuation.section.group.begin.perl -# ^^^ constant.other.perl -# ^^ keyword.operator.assignment.perl -# ^^^^^^^ string.quoted.single.perl -# ^ punctuation.section.group.end.perl - ${Foo::Bar::baz} -# ^^^^^^^^^^^^^^^^ variable.other.readwrite.global.perl -# ^^ punctuation.definition.variable.begin.perl -# ^^^ support.class.perl -# ^^ punctuation.accessor.double-colon.perl -# ^^^ support.class.perl -# ^^ punctuation.accessor.double-colon.perl -# ^^^ variable.other.member.perl -# ^ punctuation.definition.variable.end.perl - ${ -#^ - variable -# ^^ punctuation.definition.variable.begin.perl -# ^^^ variable.other.readwrite.global.perl - Foo::bar->baz() -# <- variable.other.readwrite.global.perl -#^^^^^^^^^^^^^^^^^^^ meta.braces.perl variable.other.readwrite.global.perl -# ^^^ support.class.perl -# ^^ punctuation.accessor.double-colon.perl -# ^^^ variable.other.member.perl -# ^^ keyword.operator.arrow.perl -# ^^^ variable.function.perl - } -# <- variable.other.readwrite.global.perl -#^^ variable.other.readwrite.global.perl -# ^ punctuation.definition.variable.end.perl -# ^ - variable - $::Config{'cf_email'} -# ^^^^^^^^^ variable.other.readwrite.global.perl -# ^ punctuation.definition.variable.perl -# ^^ punctuation.accessor.double-colon.perl -# ^^^^^^ support.class.perl -f # ^^ keyword.operator.filetest.perl -foo # ^^ - keyword.operator.filetest.perl - $_foo = "bar"; -# ^ punctuation.definition.variable.perl -# ^^^^^ variable.other.readwrite.global.perl -# ^ keyword.operator.assignment.perl -# ^ punctuation.definition.string.begin.perl -# ^^^^^ string.quoted.double.perl -# ^ punctuation.definition.string.end.perl -# ^ punctuation.terminator.statement.perl - %_foo = "bar"; -# ^ punctuation.definition.variable.perl -# ^^^^^ variable.other.readwrite.global.perl -# ^ keyword.operator.assignment.perl -# ^ punctuation.definition.string.begin.perl -# ^^^^^ string.quoted.double.perl -# ^ punctuation.definition.string.end.perl -# ^ punctuation.terminator.statement.perl - %{$foo{'bar'}{'bar'}} = 'excl'; -# ^^^^^^^^^^^^^^^^^^^^^ meta.braces.perl variable.other.readwrite.global.perl -# ^^ punctuation.definition.variable.begin.perl -# ^ punctuation.definition.variable.perl -# ^^^^ variable.other.readwrite.global.perl variable.other.readwrite.global.perl -# ^ punctuation.definition.variable.end.perl -# ^ keyword.operator.assignment.perl -# ^^^^^^ string.quoted.single.perl -# ^ punctuation.terminator.statement.perl -### [ CONSTANTS ] ############################################################ + +###[ CONSTANTS ] ############################################################# 1234 # decimal integer -# ^^^^ constant.numeric.integer.perl +# ^^^^ constant.numeric.integer.decimal.perl + 12_4 # decimal integer +# ^^^^ constant.numeric.integer.decimal.perl + +1234 # decimal integer +# ^ keyword.operator.arithmetic.perl +# ^^^^ constant.numeric.integer.decimal.perl + + 1234 # decimal integer +# ^ keyword.operator.arithmetic.perl +# ^^^^ constant.numeric.integer.decimal.perl + 1234+ # decimal integer +# ^^^^ constant.numeric.integer.decimal.perl +# ^ keyword.operator.arithmetic.perl -1234 # decimal integer -# ^^^^^ constant.numeric.integer.perl +# ^ keyword.operator.arithmetic.perl +# ^^^^ constant.numeric.integer.decimal.perl - 1234 # decimal integer # ^ keyword.operator.arithmetic.perl -# ^^^^ constant.numeric.integer.perl +# ^^^^ constant.numeric.integer.decimal.perl + 1234- # decimal integer +# ^^^^ constant.numeric.integer.decimal.perl +# ^ keyword.operator.arithmetic.perl + 0B0 # binary integer +# ^^ constant.numeric.integer.binary.perl punctuation.definition.numeric.binary.perl +# ^ constant.numeric.integer.binary.perl - punctuation 0b0 # binary integer -# ^^^ constant.numeric.binary.perl - 0b1110011 # binary integer -# ^^^^^^^^^ constant.numeric.binary.perl - 01234 # octal integer -# ^^^^^ constant.numeric.integer.perl - 0x1234 # hexadecimal integer -# ^^^^^^ constant.numeric.hex.perl +# ^^ constant.numeric.integer.binary.perl punctuation.definition.numeric.binary.perl +# ^ constant.numeric.integer.binary.perl - punctuation + -0b0 # binary integer +# ^ keyword.operator.arithmetic.perl +# ^^ constant.numeric.integer.binary.perl punctuation.definition.numeric.binary.perl +# ^ constant.numeric.integer.binary.perl - punctuation + 0b0- # binary integer +# ^^ constant.numeric.integer.binary.perl punctuation.definition.numeric.binary.perl +# ^ constant.numeric.integer.binary.perl - punctuation +# ^ keyword.operator.arithmetic.perl + 0b1.0b1 +# ^^ constant.numeric.integer.binary.perl punctuation.definition.numeric.binary.perl +# ^ constant.numeric.integer.binary.perl - punctuation +# ^ keyword.operator.concat.perl +# ^^ constant.numeric.integer.binary.perl punctuation.definition.numeric.binary.perl +# ^ constant.numeric.integer.binary.perl - punctuation + 0b11__011 # binary integer +# ^^ constant.numeric.integer.binary.perl punctuation.definition.numeric.binary.perl +# ^^^^^^^ constant.numeric.integer.binary.perl - punctuation + 01_34 # octal integer +# ^ constant.numeric.integer.octal.perl punctuation.definition.numeric.octal.perl +# ^^^^ constant.numeric.integer.octal.perl - punctuation + -01234 # octal integer +# ^ keyword.operator.arithmetic.perl +# ^ constant.numeric.integer.octal.perl punctuation.definition.numeric.octal.perl +# ^^^^ constant.numeric.integer.octal.perl - punctuation + 012_4- # octal integer +# ^ constant.numeric.integer.octal.perl punctuation.definition.numeric.octal.perl +# ^^^^ constant.numeric.integer.octal.perl - punctuation +# ^ keyword.operator.arithmetic.perl + 0x_234 # hexadecimal integer +# ^^ constant.numeric.integer.hexadecimal.perl punctuation.definition.numeric.hexadecimal.perl +# ^^^^ constant.numeric.integer.hexadecimal.perl - punctuation + 0X123_ # hexadecimal integer +# ^^ constant.numeric.integer.hexadecimal.perl punctuation.definition.numeric.hexadecimal.perl +# ^^^^ constant.numeric.integer.hexadecimal.perl - punctuation 0x9 # hexadecimal integer -# ^^^ constant.numeric.hex.perl +# ^^ constant.numeric.integer.hexadecimal.perl punctuation.definition.numeric.hexadecimal.perl +# ^ constant.numeric.integer.hexadecimal.perl - punctuation + +0x9 # hexadecimal integer +# ^ keyword.operator.arithmetic.perl +# ^^ constant.numeric.integer.hexadecimal.perl punctuation.definition.numeric.hexadecimal.perl +# ^ constant.numeric.integer.hexadecimal.perl - punctuation + 0x9- # hexadecimal integer +# ^^ constant.numeric.integer.hexadecimal.perl punctuation.definition.numeric.hexadecimal.perl +# ^ constant.numeric.integer.hexadecimal.perl - punctuation +# ^ keyword.operator.arithmetic.perl + 0x9.0x10 # hexadecimal integer +# ^^ constant.numeric.integer.hexadecimal.perl punctuation.definition.numeric.hexadecimal.perl +# ^ constant.numeric.integer.hexadecimal.perl - punctuation +# ^ keyword.operator.concat.perl +# ^^ constant.numeric.integer.hexadecimal.perl punctuation.definition.numeric.hexadecimal.perl +# ^ constant.numeric.integer.hexadecimal.perl - punctuation + 01.1 # normal float +# ^^^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl + 1.1 # normal float +# ^^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl + -1.1 # normal float +# ^ keyword.operator.arithmetic.perl +# ^^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl + 1.1- # normal float +# ^^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl +# ^ keyword.operator.arithmetic.perl + .1 # normal float +# ^ punctuation.separator.decimal.perl +# ^^ constant.numeric.float.decimal.perl + -.1 # normal float +# ^ keyword.operator.arithmetic.perl +# ^ punctuation.separator.decimal.perl +# ^^ constant.numeric.float.decimal.perl + .1- # normal float +# ^ punctuation.separator.decimal.perl +# ^^ constant.numeric.float.decimal.perl +# ^ keyword.operator.arithmetic.perl + 1. # normal float +# ^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl + -1. # normal float +# ^ keyword.operator.arithmetic.perl +# ^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl + 1.- # normal float +# ^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl +# ^ keyword.operator.arithmetic.perl + 1e5 1E5 # exponential notation +# ^^^ constant.numeric.float.decimal.perl +# ^^^ constant.numeric.float.decimal.perl +# ^^^ constant.numeric.float.decimal.perl + -1e5 # exponential notation +# ^ keyword.operator.arithmetic.perl +# ^^^ constant.numeric.float.decimal.perl + 1e5- # exponential notation +# ^^^ constant.numeric.float.decimal.perl +# ^ keyword.operator.arithmetic.perl + 1.e5 # exponential notation +# ^^^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl 12.34e56 # exponential notation -# ^^^^^^^^ constant.numeric.float.perl +# ^^^^^^^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl + _2._4E_6 # exponential notation +# ^^^^^^^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl -12.34e-56 # exponential notation -# ^^^^^^^^^^ constant.numeric.float.perl +# ^ keyword.operator.arithmetic.perl +# ^^^^^^^^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl - 12.34e-56 # exponential notation # ^ keyword.operator.arithmetic.perl -# ^^^^^^^^^ constant.numeric.float.perl +# ^^^^^^^^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl 12.34e+56 # exponential notation -# ^^^^^^^^^ constant.numeric.float.perl - "-12.34e56" # number specified as a string -# ^^^^^^^^^^^ string.quoted.double.perl -# ^^^^^^^^^ constant.numeric.float.perl - "1234" # number specified as a string -# ^^^^^^ string.quoted.double.perl -# ^^^^ constant.numeric.integer.perl +# ^^^^^^^^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl + 12.34e+56- # exponential notation +# ^^^^^^^^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl +# ^ keyword.operator.arithmetic.perl + "12_4" # number specified as a string +# ^^^^^^ meta.string.perl string.quoted.double.perl +# ^^^^ constant.numeric.integer.decimal.perl + "-1234" # number specified as a string +# ^^^^^^^ meta.string.perl string.quoted.double.perl +# ^^^^^ constant.numeric.integer.decimal.perl + "01234" # number specified as a string +# ^^^^^^^ meta.string.perl string.quoted.double.perl +# ^^^^^ constant.numeric.integer.decimal.perl - punctuation + "-01234" # number specified as a string +# ^^^^^^^^ meta.string.perl string.quoted.double.perl +# ^^^^^^ constant.numeric.integer.decimal.perl - punctuation + "1.1" # normal float +# ^^^^^ meta.string.perl string.quoted.double.perl +# ^^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl + "-1.1" # normal float +# ^^^^^^ meta.string.perl string.quoted.double.perl +# ^^^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl + ".1" # normal float +# ^^^^ meta.string.perl string.quoted.double.perl +# ^ punctuation.separator.decimal.perl +# ^^ constant.numeric.float.decimal.perl + "-.1" # normal float +# ^^^^^ meta.string.perl string.quoted.double.perl +# ^^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl + "1." # normal float +# ^^^^ meta.string.perl string.quoted.double.perl +# ^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl + "-1." # normal float +# ^^^^^ meta.string.perl string.quoted.double.perl +# ^^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl + "1e5" # exponential notation +# ^^^^^ meta.string.perl string.quoted.double.perl +# ^^^ constant.numeric.float.decimal.perl + "-1e5" # exponential notation +# ^^^^^^ meta.string.perl string.quoted.double.perl +# ^^^^ constant.numeric.float.decimal.perl + "1.e5" # exponential notation +# ^^^^^^ meta.string.perl string.quoted.double.perl +# ^^^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl + "12.34e56" # exponential notation +# ^^^^^^^^^^ meta.string.perl string.quoted.double.perl +# ^^^^^^^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl + "-12.34e-56" # exponential notation +# ^^^^^^^^^^^^ meta.string.perl string.quoted.double.perl +# ^^^^^^^^^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl '0.00_01' -# ^^^^^^^ - constant.numeric +# ^^^^^^^ constant.numeric.float.decimal.perl '01bau' # ^^^^^ - constant.numeric __PACKAGE__ @@ -659,74 +1381,225 @@ =head1 B<--param> # ^^^^^^^^ constant.language.perl __END__ # ^^^^^^^ constant.language.perl + + # note: language constants keep their scope ARGV # ^^^^ constant.language.filehandle.perl + ARGV:: +# ^^^^ constant.language.filehandle.perl + ARGV->func +# ^^^^ constant.language.filehandle.perl + ARGV() +# ^^^^ constant.language.filehandle.perl -### [ STRINGS ] ############################################################## + # note: user constants adapt their scope + URI +# ^^^ constant.other.perl + URI:: +# ^^^ variable.namespace.perl + URI->func +# ^^^ variable.namespace.perl + URI() +# ^^^ variable.function.perl - "quoted \"interpolated\" foo 'bar' baz" +###[ STRINGS ]################################################################ + + "$" "@" "%" "*" "$repl$" "%repl%" +# ^ punctuation.definition.string.begin.perl +# ^^^ meta.string.perl string.quoted.double.perl +# ^ punctuation.definition.string.end.perl +# ^ - meta.string - string +# ^ punctuation.definition.string.begin.perl +# ^^^ meta.string.perl string.quoted.double.perl +# ^ punctuation.definition.string.end.perl +# ^ - meta.string - string +# ^ punctuation.definition.string.begin.perl +# ^^^ meta.string.perl string.quoted.double.perl +# ^ punctuation.definition.string.end.perl +# ^ - meta.string - string +# ^ punctuation.definition.string.begin.perl +# ^^^ meta.string.perl string.quoted.double.perl +# ^ punctuation.definition.string.end.perl +# ^ - meta.string - string +# ^ meta.string.perl string.quoted.double.perl punctuation.definition.string.begin.perl +# ^^^^^ meta.string.perl meta.interpolation.perl variable.other.readwrite.perl +# ^ meta.string.perl string.quoted.double.perl +# ^ meta.string.perl string.quoted.double.perl punctuation.definition.string.end.perl +# ^ - meta.string - string +# ^ meta.string.perl string.quoted.double.perl punctuation.definition.string.begin.perl +# ^^^^^ meta.string.perl meta.interpolation.perl variable.other.readwrite.perl +# ^ meta.string.perl string.quoted.double.perl +# ^ meta.string.perl string.quoted.double.perl punctuation.definition.string.end.perl +# ^ - meta.string - string + `$` `@` `%` `*` `$repl$` `%repl%` # ^ punctuation.definition.string.begin.perl -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double.perl +# ^^^ meta.string.perl string.quoted.backtick.perl +# ^ punctuation.definition.string.end.perl +# ^ - meta.string - string +# ^ punctuation.definition.string.begin.perl +# ^^^ meta.string.perl string.quoted.backtick.perl +# ^ punctuation.definition.string.end.perl +# ^ - meta.string - string +# ^ punctuation.definition.string.begin.perl +# ^^^ meta.string.perl string.quoted.backtick.perl +# ^ punctuation.definition.string.end.perl +# ^ - meta.string - string +# ^ punctuation.definition.string.begin.perl +# ^^^ meta.string.perl string.quoted.backtick.perl +# ^ punctuation.definition.string.end.perl +# ^ - meta.string - string +# ^ meta.string.perl string.quoted.backtick.perl punctuation.definition.string.begin.perl +# ^^^^^ meta.string.perl meta.interpolation.perl variable.other.readwrite.perl +# ^ meta.string.perl string.quoted.backtick.perl +# ^ meta.string.perl string.quoted.backtick.perl punctuation.definition.string.end.perl +# ^ - meta.string - string +# ^ meta.string.perl string.quoted.backtick.perl punctuation.definition.string.begin.perl +# ^^^^^ meta.string.perl meta.interpolation.perl variable.other.readwrite.perl +# ^ meta.string.perl string.quoted.backtick.perl +# ^ meta.string.perl string.quoted.backtick.perl punctuation.definition.string.end.perl +# ^ - meta.string - string + <$>.<@>.<%>.<*>.<$repl$>.<%repl%> +# ^ punctuation.definition.string.begin.perl +# ^^^ meta.string.perl string.quoted.angle.perl +# ^ punctuation.definition.string.end.perl +# ^ - meta.string - string +# ^ punctuation.definition.string.begin.perl +# ^^^ meta.string.perl string.quoted.angle.perl +# ^ punctuation.definition.string.end.perl +# ^ - meta.string - string +# ^ punctuation.definition.string.begin.perl +# ^^^ meta.string.perl string.quoted.angle.perl +# ^ punctuation.definition.string.end.perl +# ^ - meta.string - string +# ^ punctuation.definition.string.begin.perl +# ^^^ meta.string.perl string.quoted.angle.perl +# ^ punctuation.definition.string.end.perl +# ^ - meta.string - string +# ^ meta.string.perl string.quoted.angle.perl punctuation.definition.string.begin.perl +# ^^^^^ meta.string.perl meta.interpolation.perl variable.other.readwrite.perl +# ^ meta.string.perl string.quoted.angle.perl +# ^ meta.string.perl string.quoted.angle.perl punctuation.definition.string.end.perl +# ^ - meta.string - string +# ^ meta.string.perl string.quoted.angle.perl punctuation.definition.string.begin.perl +# ^^^^^ meta.string.perl meta.interpolation.perl variable.other.readwrite.perl +# ^ meta.string.perl string.quoted.angle.perl +# ^ meta.string.perl string.quoted.angle.perl punctuation.definition.string.end.perl +# ^ - meta.string - string + "quoted \"interpolated\" foo 'bar' $baz $" +# ^ punctuation.definition.string.begin.perl +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.perl string.quoted.double.perl - meta.interpolation +# ^^^^ meta.string.perl meta.interpolation.perl - string +# ^^^ meta.string.perl string.quoted.double.perl - meta.interpolation # ^^ constant.character.escape.perl # ^^ constant.character.escape.perl -# ^ punctuation.definition.string.end.perl - 'quoted "interpolated" foo \'bar\' baz' +# ^^^^ variable.other.readwrite.perl +# ^ - variable +# ^ punctuation.definition.string.end.perl + 'quoted "interpolated" foo \'bar\' $baz $' # ^ punctuation.definition.string.begin.perl -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.single.perl +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.perl string.quoted.single.perl # ^^ constant.character.escape.perl # ^^ constant.character.escape.perl -# ^ punctuation.definition.string.end.perl - `quoted "interpolated" foo \`bar\` baz` +# ^^^^ - variable +# ^ - variable +# ^ punctuation.definition.string.end.perl + `quoted "interpolated" foo \`bar\` $baz $` # ^ punctuation.definition.string.begin.perl -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.backtick.perl +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.perl string.quoted.backtick.perl - meta.interpolation +# ^^^^ meta.string.perl meta.interpolation.perl - string +# ^^^ meta.string.perl string.quoted.backtick.perl - meta.interpolation # ^^ constant.character.escape.perl # ^^ constant.character.escape.perl -# ^ punctuation.definition.string.end.perl - q/quoted "interpolated" foo 'bar' \/ baz/ -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.perl +# ^^^^ variable.other.readwrite.perl +# ^ - variable +# ^ punctuation.definition.string.end.perl + <=quoted < ${"interpolated" . @foo{bar}}> $baz\> $> > +# ^ punctuation.definition.string.begin.perl +# ^^^^^^^^^^^ meta.string.perl string.quoted.angle.perl - meta.interpolation +# ^^ meta.string.perl meta.interpolation.perl meta.variable.perl - string +# ^^^^^^^^^^^^^^ meta.string.perl meta.interpolation.perl meta.variable.perl meta.string.perl +# ^^^^^^^^ meta.string.perl meta.interpolation.perl meta.variable.perl - string +# ^^^^^ meta.item-access.perl +# ^^^ meta.string.perl meta.interpolation.perl meta.variable.perl meta.item-access.perl +# ^^ meta.string.perl meta.interpolation.perl meta.variable.perl - string +# ^^ meta.string.perl string.quoted.angle.perl - meta.interpolation +# ^^^^ meta.string.perl meta.interpolation.perl - string +# ^^^^^ meta.string.perl string.quoted.angle.perl - meta.interpolation +# ^^^ - meta.string - string +# ^^ - keyword.operator +# ^ - punctuation +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.begin.perl +# ^^^^^^^^^^^^^ string.quoted.double.perl +# ^ keyword.operator.concat.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.section.item-access.begin.perl +# ^^^ constant.other.key.perl +# ^ punctuation.section.item-access.end.perl +# ^ punctuation.definition.variable.end.perl +# ^ - punctuation +# ^^^^ variable.other.readwrite.perl +# ^^ constant.character.escape.perl +# ^ - variable +# ^ punctuation.definition.string.end.perl +# ^ keyword.operator.comparison.perl + q/quoted "interpolated" foo 'bar' \/ $baz/ +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.perl # ^ support.function.perl # ^ punctuation.section.generic.begin.perl - string -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.unquoted.perl +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.perl string.unquoted.perl - meta.interpolation # ^^ constant.character.escape.perl +# ^^^^ - variable +# ^ punctuation.section.generic.end.perl - string + q\quoted "interpolated" foo 'bar' / $baz\ +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.perl +# ^ support.function.perl +# ^ punctuation.section.generic.begin.perl - string +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.unquoted.perl +# ^^^^ - variable # ^ punctuation.section.generic.end.perl - string - q{quoted "interpolated" {foo} 'bar' \/ baz} -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.perl + q{quoted "interpolated" {foo} 'bar' \/ $baz} +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.perl # ^ support.function.perl # ^ punctuation.section.braces.begin.perl - string -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.braces.perl -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.unquoted.perl +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.braces.perl +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.perl string.unquoted.perl # ^^ constant.character.escape.perl -# ^ punctuation.section.braces.end.perl - string - q[quoted "interpolated" [foo] 'bar' \] baz] -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.perl +# ^^^^ - variable +# ^ punctuation.section.braces.end.perl - string + q[quoted "interpolated" [foo] 'bar' \] $baz] +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.perl # ^ support.function.perl # ^ punctuation.section.brackets.begin.perl - string -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.brackets.perl -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.unquoted.perl +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.brackets.perl +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.perl string.unquoted.perl # ^^ constant.character.escape.perl -# ^ punctuation.section.brackets.end.perl - string - q 'bar' \> baz> -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.perl +# ^^^^ - variable +# ^ punctuation.section.brackets.end.perl - string + q 'bar' \> $baz> +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.perl # ^ support.function.perl # ^ punctuation.section.generic.begin.perl - string -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.generic.perl -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.unquoted.perl +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.generic.perl +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.perl string.unquoted.perl # ^^ constant.character.escape.perl -# ^ punctuation.section.generic.end.perl - string - q(quoted "interpolated" [foo] 'bar' \] baz) -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.perl +# ^^^^ - variable +# ^ punctuation.section.generic.end.perl - string + q(quoted "interpolated" [foo] 'bar' \] $baz) +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.perl # ^ support.function.perl # ^ punctuation.section.parens.begin.perl - string -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.parens.perl -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.unquoted.perl +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.parens.perl +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.perl string.unquoted.perl # ^^ constant.character.escape.perl -# ^ punctuation.section.parens.end.perl - string +# ^^^^ - variable +# ^ punctuation.section.parens.end.perl - string q[' # ^ support.function.perl # ^ punctuation.section.brackets.begin.perl - string # ^^ string - string -# ^^^^^^^ string + string $novar +# ^^^^^^^^^^^^^ string '] # ^ string # ^ punctuation.section.brackets.end.perl - string @@ -734,160 +1607,301 @@ =head1 B<--param> # ^ support.function.perl # ^ punctuation.section.generic.begin.perl - string # ^^ string - string -# ^^^^^^^ string + string $novar +# ^^^^^^^^^^^^^ string '> # ^ string # ^ punctuation.section.generic.end.perl - string -### [ REGEX ] ################################################################ + qq/foo $bar $/; +# ^^^^^^^^^^^^^^ meta.function-call.perl +# ^^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^^^^ meta.string.perl string.unquoted.perl - variable +# ^^^^ meta.string.perl meta.interpolation.perl variable.other.readwrite.perl - string +# ^^ meta.string.perl string.unquoted.perl - variable +# ^ punctuation.section.generic.end.perl +# ^ punctuation.terminator.statement.perl + qx:foo $bar $:; +# ^^^^^^^^^^^^^^ meta.function-call.perl +# ^^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^^^^ meta.string.perl string.unquoted.perl - bariable +# ^^^^ meta.string.perl meta.interpolation.perl variable.other.readwrite.perl - string +# ^^ meta.string.perl string.unquoted.perl - variable +# ^ punctuation.section.generic.end.perl +# ^ punctuation.terminator.statement.perl + qw/foo $bar/; +# ^^^^^^^^^^ meta.function-call.perl +# ^^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^^ meta.string.perl string.unquoted.perl +# ^^^^ - variable +# ^ punctuation.section.generic.end.perl +# ^ punctuation.terminator.statement.perl + + CORE::q// +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^ punctuation.section.generic.end.perl + CORE::qq// +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^ punctuation.section.generic.end.perl + CORE::qx// +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^ punctuation.section.generic.end.perl + CORE::qw// +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^ punctuation.section.generic.end.perl + +###[ REGEX ]################################################################## /[a-z]test\d{3}/g; # ^ punctuation.section.generic.begin.perl - string.regexp - source.regexp -# ^^^^^^^^^^^^^^ string.regexp.perl source.regexp +# ^^^^^^^^^^^^^^ meta.string.perl string.regexp.perl source.regexp # ^ punctuation.section.generic.end.perl - string.regexp - source.regexp # ^ constant.language.flags.regexp.perl + /[a-z]test\d{3}/g; +#^ punctuation.section.generic.begin.perl ( /[a-z]test\d{3}/g ); # ^ punctuation.section.generic.begin.perl - string.regexp - source.regexp -# ^^^^^^^^^^^^^^ string.regexp.perl source.regexp +# ^^^^^^^^^^^^^^ meta.string.perl string.regexp.perl source.regexp # ^ punctuation.section.generic.end.perl - string.regexp - source.regexp # ^ constant.language.flags.regexp.perl $@ = /[a-z]test\d{3}/g; # ^ punctuation.section.generic.begin.perl - string.regexp - source.regexp -# ^^^^^^^^^^^^^^ string.regexp.perl source.regexp +# ^^^^^^^^^^^^^^ meta.string.perl string.regexp.perl source.regexp # ^ punctuation.section.generic.end.perl - string.regexp - source.regexp # ^ constant.language.flags.regexp.perl m{^\s*(?:(-?\s*)(\d+(?:\.\d+){0,3})/(\d+))}; # comment # ^ support.function.perl - meta.braces # ^ punctuation.section.braces.begin.perl - string # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.braces.perl -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.regexp.perl +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.perl string.regexp.perl # ^ punctuation.section.braces.end.perl - string # ^ punctuation.terminator.statement.perl -# ^ comment.line.number-sign.perl punctuation.definition.comment.begin.perl +# ^ comment.line.number-sign.perl punctuation.definition.comment.perl m(^\s*(?:(-?\s*)(\d+(?:\.\d+){0,3})/(\d+))); # comment # ^ support.function.perl - meta.parens # ^ punctuation.section.parens.begin.perl - string # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.parens.perl -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.regexp.perl +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.perl string.regexp.perl # ^ punctuation.section.parens.end.perl - string # ^ punctuation.terminator.statement.perl -# ^ comment.line.number-sign.perl punctuation.definition.comment.begin.perl +# ^ comment.line.number-sign.perl punctuation.definition.comment.perl m[^\s*(?:(-?\s*)(\d+(?:\.\d+){0,3})/(\d+))]; # comment # ^ support.function.perl - meta.brackets # ^ punctuation.section.brackets.begin.perl - string # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.brackets.perl -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.regexp.perl +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.perl string.regexp.perl # ^ punctuation.section.brackets.end.perl - string # ^ punctuation.terminator.statement.perl -# ^ comment.line.number-sign.perl punctuation.definition.comment.begin.perl +# ^ comment.line.number-sign.perl punctuation.definition.comment.perl m<^\s*(?:(-?\s*)(\d+(?:\.\d+){0,3})/(\d+))>; # comment # ^ support.function.perl - meta.generic # ^ punctuation.section.generic.begin.perl - string # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.generic.perl -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.regexp.perl +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.perl string.regexp.perl # ^ punctuation.section.generic.end.perl - string # ^ punctuation.terminator.statement.perl -# ^ comment.line.number-sign.perl punctuation.definition.comment.begin.perl +# ^ comment.line.number-sign.perl punctuation.definition.comment.perl m/^\s*(?:(-?\s*)(\d+(?:\.\d+){0,3})\/(\d+))/g; # comment # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.perl # ^ support.function.perl # ^ punctuation.section.generic.begin.perl -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.regexp.perl +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.perl string.regexp.perl # ^ punctuation.section.generic.end.perl # ^ constant.language.flags.regexp.perl # ^ punctuation.terminator.statement.perl -# ^ comment.line.number-sign.perl punctuation.definition.comment.begin.perl +# ^ comment.line.number-sign.perl punctuation.definition.comment.perl + m\@pattern\g; # comment +# ^^^^^^^^^^^^ meta.function-call.perl +# ^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^^ meta.string.perl string.regexp.perl +# ^ punctuation.section.generic.end.perl +# ^ constant.language.flags.regexp.perl +# ^ punctuation.terminator.statement.perl +# ^ comment.line.number-sign.perl punctuation.definition.comment.perl + CORE::m +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^ support.function.perl + CORE::m//g +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^ punctuation.section.generic.end.perl +# ^ constant.language.flags.regexp.perl + core::m +# ^^^^ meta.path.perl variable.namespace.perl +# ^^ meta.path.perl punctuation.accessor.double-colon.perl +# ^ meta.path.perl variable.function.perl + m::core +# ^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^ punctuation.section.generic.end.perl +# ^^^^ constant.language.flags.regexp.perl + s { # ^^^^ meta.function-call.perl # ^^ meta.braces.perl # ^ support.function.perl # ^ punctuation.section.braces.begin.perl bar[a-z]{1,3} \/ .+ -# <- meta.function-call.perl meta.braces.perl string.regexp.perl - } [repl] gx; # comment -# <- meta.function-call.perl meta.braces.perl string.regexp.perl -#^^^^^^^^ meta.function-call.perl +# <- meta.function-call.perl meta.braces.perl meta.string.perl string.regexp.perl + } [repl $var]gx; # comment +# <- meta.function-call.perl meta.braces.perl meta.string.perl string.regexp.perl +#^^^^^^^^^^^^^^^^ meta.function-call.perl # ^ meta.braces.perl punctuation.section.braces.end.perl -# ^^^^^^ meta.brackets.perl +# ^^^^^^^^^^^ meta.brackets.perl # ^ punctuation.section.brackets.begin.perl -# ^^^^ string.unquoted.perl -# ^ punctuation.section.brackets.end.perl -# ^^ constant.language.flags.regexp.perl -# ^ punctuation.terminator.statement.perl -# ^^^^^^^^^ comment.line.number-sign.perl -# ^ punctuation.definition.comment.begin.perl - s/foo[a-z]{1,3} \/ .+/ bar $1 \/ /g; # comment -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.perl +# ^^^^^ meta.string.perl string.unquoted.perl +# ^^^^ meta.interpolation.perl variable.other.readwrite.perl +# ^ punctuation.section.brackets.end.perl +# ^^ constant.language.flags.regexp.perl +# ^ punctuation.terminator.statement.perl +# ^^^^^^^^^ comment.line.number-sign.perl + s {} + [repl @var]gx; # comment +# <- meta.function-call.perl +#^^^^^^^^^^^^^^ meta.function-call.perl +# ^^^^^^^^^^^ meta.brackets.perl +# ^ punctuation.section.brackets.begin.perl +# ^^^^^ meta.string.perl string.unquoted.perl +# ^^^^ meta.interpolation.perl variable.other.readwrite.perl +# ^ punctuation.section.brackets.end.perl +# ^^ constant.language.flags.regexp.perl +# ^ punctuation.terminator.statement.perl +# ^^^^^^^^^ comment.line.number-sign.perl + + # Even though the replacement looks like a valid script + # only variables are evaluated at this point. + s/L<(.*?)>/ +# ^^^^^^^^^^^^ meta.function-call.perl +# ^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^ punctuation.separator.sequence.perl + my($text,$page,$sect) = _split_pod_link($1); + defined $text + ? $text + : defined $sect + ? italic($sect) . ' in ' . italic($page) + : italic($page) +#^^^^^^^^^^^^^^^^^ meta.string.perl string.unquoted.perl +# ^^^^^ meta.string.perl meta.interpolation.perl variable.other.readwrite.perl +# ^^ meta.string.perl string.unquoted.perl + /ges; +#^^^^^^ meta.function-call.perl +# ^ punctuation.section.generic.end.perl +# ^^^ constant.language.flags.regexp.perl +# ^ punctuation.terminator.statement.perl + + s/foo[a-z]{1,3} \/ .+/ bar $1 \/ %/g; # comment +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.perl # ^ support.function.perl # ^ punctuation.section.generic.begin.perl -# ^^^^^^^^^^^^^^^^^^^ string.regexp.perl source.regexp +# ^^^^^^^^^^^^^^^^^^^ meta.string.perl string.regexp.perl source.regexp # ^ punctuation.separator.sequence.perl -# ^^^^^^^^^^^ string.unquoted.perl -# ^ punctuation.section.generic.end.perl -# ^ constant.language.flags.regexp.perl -# ^ punctuation.terminator.statement.perl -# ^^^^^^^^^ comment.line.number-sign.perl -# ^ punctuation.definition.comment.begin.perl - s#foo[a-z]{1,3} \# .+# bar $1 \# #g; # comment -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.perl +# ^^^^^ meta.string.perl string.unquoted.perl - meta.interpolation - variable +# ^^ meta.string.perl meta.interpolation.perl variable.language.regexp.match-group.perl - string +# ^^^^^ meta.string.perl string.unquoted.perl - meta.interpolation - variable +# ^ punctuation.section.generic.end.perl +# ^ constant.language.flags.regexp.perl +# ^ punctuation.terminator.statement.perl +# ^^^^^^^^^ comment.line.number-sign.perl +# ^ punctuation.definition.comment.perl + s\foo[a-z]{1,3} / .+\ bar $1 / $\g; # comment +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.perl # ^ support.function.perl # ^ punctuation.section.generic.begin.perl -# ^^^^^^^^^^^^^^^^^^^ string.regexp.perl source.regexp +# ^^^^^^^^^^^^^^^^^^ string.regexp.perl source.regexp +# ^ punctuation.separator.sequence.perl +# ^^^^^ meta.string.perl string.unquoted.perl +# ^^ meta.string.perl meta.interpolation.perl variable.language.regexp.match-group.perl +# ^^^ meta.function-call.perl meta.string.perl string.unquoted.perl +# ^ punctuation.section.generic.end.perl +# ^ constant.language.flags.regexp.perl +# ^ punctuation.terminator.statement.perl +# ^^^^^^^^^ comment.line.number-sign.perl +# ^ punctuation.definition.comment.perl + s#foo[a-z]{1,3} \# .+# bar $1 \# $#g; # comment +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.perl +# ^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^^^^^^^^^^^^^ meta.string.perl string.regexp.perl source.regexp # ^ punctuation.separator.sequence.perl -# ^^^^^^^^^^^ string.unquoted.perl -# ^ punctuation.section.generic.end.perl -# ^ constant.language.flags.regexp.perl -# ^ punctuation.terminator.statement.perl -# ^^^^^^^^^ comment.line.number-sign.perl -# ^ punctuation.definition.comment.begin.perl - s;foo[a-z]{1,3} \; .+; bar $1 \; ;g; # comment -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.perl +# ^^^^^ meta.string.perl string.unquoted.perl - meta.interpolation - variable +# ^^ meta.string.perl meta.interpolation.perl variable.language.regexp.match-group.perl - string +# ^^^^^ meta.string.perl string.unquoted.perl - meta.interpolation - variable +# ^ punctuation.section.generic.end.perl +# ^ constant.language.flags.regexp.perl +# ^ punctuation.terminator.statement.perl +# ^^^^^^^^^ comment.line.number-sign.perl +# ^ punctuation.definition.comment.perl + s;foo[a-z]{1,3} \; .+; bar $1 \; %;g; # comment +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.perl # ^ support.function.perl # ^ punctuation.section.generic.begin.perl -# ^^^^^^^^^^^^^^^^^^^ string.regexp.perl source.regexp +# ^^^^^^^^^^^^^^^^^^^ meta.string.perl string.regexp.perl source.regexp # ^ punctuation.separator.sequence.perl -# ^^^^^^^^^^^ string.unquoted.perl -# ^ punctuation.section.generic.end.perl -# ^ constant.language.flags.regexp.perl -# ^ punctuation.terminator.statement.perl -# ^^^^^^^^^ comment.line.number-sign.perl -# ^ punctuation.definition.comment.begin.perl - s!foo[a-z]{1,3} \! .+! bar $1 \! !g; # comment -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.perl +# ^^^^^ meta.string.perl string.unquoted.perl - meta.interpolation - variable +# ^^ meta.string.perl meta.interpolation.perl variable.language.regexp.match-group.perl - string +# ^^^^^ meta.string.perl string.unquoted.perl - meta.interpolation - variable +# ^ punctuation.section.generic.end.perl +# ^ constant.language.flags.regexp.perl +# ^ punctuation.terminator.statement.perl +# ^^^^^^^^^ comment.line.number-sign.perl +# ^ punctuation.definition.comment.perl + s!foo[a-z]{1,3} \! .+! bar $1 \! @!g; # comment +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.perl # ^ support.function.perl # ^ punctuation.section.generic.begin.perl -# ^^^^^^^^^^^^^^^^^^^ string.regexp.perl source.regexp +# ^^^^^^^^^^^^^^^^^^^ meta.string.perl string.regexp.perl source.regexp # ^ punctuation.separator.sequence.perl -# ^^^^^^^^^^^ string.unquoted.perl -# ^ punctuation.section.generic.end.perl -# ^ constant.language.flags.regexp.perl -# ^ punctuation.terminator.statement.perl -# ^^^^^^^^^ comment.line.number-sign.perl -# ^ punctuation.definition.comment.begin.perl +# ^^^^^ meta.string.perl string.unquoted.perl - meta.interpolation - variable +# ^^ meta.string.perl meta.interpolation.perl variable.language.regexp.match-group.perl - string +# ^^^^^ meta.string.perl string.unquoted.perl - meta.interpolation - variable +# ^ punctuation.section.generic.end.perl +# ^ constant.language.flags.regexp.perl +# ^ punctuation.terminator.statement.perl +# ^^^^^^^^^ comment.line.number-sign.perl +# ^ punctuation.definition.comment.perl s:\\:/:; # ^^^^^^^ meta.function-call.perl # ^ support.function.perl # ^ punctuation.section.generic.begin.perl -# ^^ string.regexp.perl source.regexp constant.character.escape.regexp +# ^^ meta.string.perl string.regexp.perl source.regexp constant.character.escape.regexp # ^ punctuation.separator.sequence.perl -# ^ string.unquoted.perl +# ^ meta.string.perl string.unquoted.perl # ^ punctuation.section.generic.end.perl # ^ punctuation.terminator.statement.perl s:\\\\:/\\\\:; # ^^^^^^^^^^^^^ meta.function-call.perl # ^ support.function.perl # ^ punctuation.section.generic.begin.perl -# ^^^^ string.regexp.perl source.regexp constant.character.escape.regexp +# ^^^^ meta.string.perl string.regexp.perl source.regexp constant.character.escape.regexp # ^ punctuation.separator.sequence.perl -# ^^^^^ string.unquoted.perl +# ^^^^^ meta.string.perl string.unquoted.perl # ^ punctuation.section.generic.end.perl # ^ punctuation.terminator.statement.perl s/^\s+//; # ^^^^^^^^ meta.function-call.perl # ^ support.function.perl # ^ punctuation.section.generic.begin.perl -# ^^^^ string.regexp.perl source.regexp +# ^^^^ meta.string.perl string.regexp.perl source.regexp # ^ punctuation.separator.sequence.perl # ^ punctuation.section.generic.end.perl # ^ punctuation.terminator.statement.perl @@ -901,383 +1915,2725 @@ =head1 B<--param> # ^ punctuation.section.generic.end.perl # ^^^^^^^^^^^^^^^ constant.language.flags.regexp.perl # ^ punctuation.terminator.statement.perl - qr:\\:; -# ^^^^^^ meta.function-call.perl -# ^^ support.function.perl -# ^ punctuation.section.generic.begin.perl -# ^^ string.regexp.perl source.regexp constant.character.escape.regexp -# ^ punctuation.section.generic.end.perl -# ^ punctuation.terminator.statement.perl - qr:\\\\:/; -# ^^^^^^^^ meta.function-call.perl + s@/\*.*?\*/@@g; +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^^^ meta.string.perl string.regexp.perl source.regexp +# ^ punctuation.separator.sequence.perl - variable +# ^ punctuation.section.generic.end.perl - variable +# ^ constant.language.flags.regexp.perl +# ^ punctuation.terminator.statement.perl + s@/\*.*?\*/@\@@g; +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^^^ meta.string.perl string.regexp.perl source.regexp +# ^ punctuation.separator.sequence.perl - variable +# ^^ meta.string.perl string.unquoted.perl constant.character.escape.perl +# ^ punctuation.section.generic.end.perl - variable +# ^ constant.language.flags.regexp.perl +# ^ punctuation.terminator.statement.perl + CORE::s +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^ support.function.perl + CORE::s///g +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^ punctuation.separator.sequence.perl +# ^ punctuation.section.generic.end.perl +# ^ constant.language.flags.regexp.perl + core::s +# ^^^^ meta.path.perl variable.namespace.perl +# ^^ meta.path.perl punctuation.accessor.double-colon.perl +# ^ meta.path.perl variable.function.perl + s::core:s # ^ support.function.perl -# ^ punctuation.section.generic.begin.perl -# ^^^^ string.regexp.perl source.regexp constant.character.escape.regexp +# ^ punctuation.section.generic.begin.perl +# ^ punctuation.separator.sequence.perl +# ^^^^ meta.string.perl string.unquoted.perl # ^ punctuation.section.generic.end.perl -# ^ keyword.operator.arithmetic.perl -# ^ punctuation.terminator.statement.perl - qr/^\s+/; -# ^^^^^^^^ meta.function-call.perl +# ^ constant.language.flags.regexp.perl + + tr/h-k/foo $bar baz/cdsr; +# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.perl # ^^ support.function.perl # ^ punctuation.section.generic.begin.perl -# ^^^^ string.regexp.perl source.regexp -# ^ punctuation.section.generic.end.perl -# ^ punctuation.terminator.statement.perl - -### [ DECLARATIONS ]########################################################## +# ^^^ meta.string.perl string.regexp.perl +# ^ punctuation.separator.sequence.perl +# ^^^^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^^ meta.string.perl meta.interpolation.perl variable.other.readwrite.perl - string +# ^^^^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^ punctuation.section.generic.end.perl +# ^^^^ constant.language.flags.regexp.perl +# ^ punctuation.terminator.statement.perl + CORE::tr +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^ support.function.perl + CORE::tr///g +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^ punctuation.separator.sequence.perl +# ^ punctuation.section.generic.end.perl +# ^ constant.language.flags.regexp.perl + core::tr +# ^^^^ meta.path.perl variable.namespace.perl +# ^^ meta.path.perl punctuation.accessor.double-colon.perl +# ^^ meta.path.perl variable.function.perl + tr::core:s +# ^^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^ punctuation.separator.sequence.perl +# ^^^^ meta.string.perl string.unquoted.perl +# ^ punctuation.section.generic.end.perl +# ^ constant.language.flags.regexp.perl -my -# <- keyword.declaration.variable -#^ keyword.declaration.variable - my $foo -#^ - storage -# ^^ keyword.declaration.variable -# ^ - keyword.declaration.variable - variable.other.readwrite -# ^ punctuation.definition.variable.perl -# ^^^^ variable.other.readwrite + y/\x68-k/\foo $bar baz/cdsr; +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.perl +# ^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^^^^^^ meta.string.perl string.regexp.perl +# ^ punctuation.separator.sequence.perl +# ^^^^^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^^^^ meta.string.perl meta.interpolation.perl variable.other.readwrite.perl - string +# ^^^^ meta.string.perl string.unquoted.perl - meta.interpolation +# ^ punctuation.section.generic.end.perl +# ^^^^ constant.language.flags.regexp.perl +# ^ punctuation.terminator.statement.perl + CORE::y +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^ support.function.perl + CORE::y///g +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^ punctuation.separator.sequence.perl +# ^ punctuation.section.generic.end.perl +# ^ constant.language.flags.regexp.perl + core::y +# ^^^^ meta.path.perl variable.namespace.perl +# ^^ meta.path.perl punctuation.accessor.double-colon.perl +# ^ meta.path.perl variable.function.perl + y::core:s +# ^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^ punctuation.separator.sequence.perl +# ^^^^ meta.string.perl string.unquoted.perl +# ^ punctuation.section.generic.end.perl +# ^ constant.language.flags.regexp.perl + +###[ REGEXP PATTERN ESCAPES ]################################################# + + /c:\\folder/i; +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^^^^ meta.string.perl string.regexp.perl +# ^ punctuation.section.generic.end.perl + /c:\\folder\//i; +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^^^^^^ meta.string.perl string.regexp.perl +# ^ punctuation.section.generic.end.perl + /c:\\folder\\/i; +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^^^^^^ meta.string.perl string.regexp.perl +# ^ punctuation.section.generic.end.perl + /c:\\folder\\\//i; +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^^^^^^^^ meta.string.perl string.regexp.perl +# ^ punctuation.section.generic.end.perl + m/c:\\folder/i; +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^^^^ meta.string.perl string.regexp.perl +# ^ punctuation.section.generic.end.perl + m/c:\\folder\//i; +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^^^^^^ meta.string.perl string.regexp.perl +# ^ punctuation.section.generic.end.perl + m/c:\\folder\\/i; +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^^^^^^ meta.string.perl string.regexp.perl +# ^ punctuation.section.generic.end.perl + m/c:\\folder\\\//i; +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^^^^^^^^ meta.string.perl string.regexp.perl +# ^ punctuation.section.generic.end.perl + s/c:\\folder//i; +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^^^^ meta.string.perl string.regexp.perl +# ^ punctuation.separator.sequence.perl +# ^ punctuation.section.generic.end.perl + s/c:\\folder\///i; +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^^^^^^ meta.string.perl string.regexp.perl +# ^ punctuation.separator.sequence.perl +# ^ punctuation.section.generic.end.perl + s/c:\\folder\\//i; +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^^^^^^ meta.string.perl string.regexp.perl +# ^ punctuation.separator.sequence.perl +# ^ punctuation.section.generic.end.perl + s/c:\\folder\\\///i; +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^^^^^^^^ meta.string.perl string.regexp.perl +# ^ punctuation.separator.sequence.perl +# ^ punctuation.section.generic.end.perl + +###[ REGEXP FLAGS ]########################################################### + + /^$/g; +# ^ constant.language.flags.regexp.perl + /^$/ g; +# ^ - constant.language.flags.regexp.perl + m/^$/g; +# ^ constant.language.flags.regexp.perl + m/^$/ g; +# ^ - constant.language.flags.regexp.perl + m{^$}g; +# ^ constant.language.flags.regexp.perl + m{^$} g; +# ^ - constant.language.flags.regexp.perl + m<^[pattern]$>g; +# ^ constant.language.flags.regexp.perl + m<^[pattern]$> g; +# ^ - constant.language.flags.regexp.perl + s///g; +# ^ constant.language.flags.regexp.perl + s/// g; +# ^ - constant.language.flags.regexp.perl + s[] []g; +# ^ constant.language.flags.regexp.perl + s[] [] g; +# ^ - constant.language.flags.regexp.perl + +###[ LANGUAGE VARIABLES ]##################################################### + +# Special Variables + + $_ $#_ $ARG $_[0] $_{'key'} $#_[0] $#_{'key'} +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^^^ meta.item-access.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^^^^^^^ meta.item-access.perl +# ^^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^^^ meta.item-access.perl +# ^^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^^^^^^^ meta.item-access.perl + @_ @#_ @ARG @_[0] @_{'key'} @#_[0] @#_{'key'} +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^^^ meta.item-access.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^^^^^^^ meta.item-access.perl +# ^^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^^^ meta.item-access.perl +# ^^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^^^^^^^ meta.item-access.perl + %_ %#_ %ARG %_[0] %_{'key'} %#_[0] %#_{'key'} +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^^^ meta.item-access.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^^^^^^^ meta.item-access.perl +# ^^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^^^ meta.item-access.perl +# ^^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^^^^^^^ meta.item-access.perl + *_ *ARG *_[0] *_{'key'} +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^^^ meta.item-access.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^^^^^^^ meta.item-access.perl + $" $LIST_SEPARATOR +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^^^^^^^^ variable.language.perl + $$ $PID $PROCESS_ID +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^^^^ variable.language.perl + $0 $PROGRAM_NAME +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl + $( $GID $REAL_GROUP_ID +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl + $) $EGID $EFFECTIVE_GROUP_ID +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl + $< $UID $REAL_USER_ID +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl + $> $EUID $EFFECTIVE_USER_ID +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl + $; $SUBSEP $SUBSCRIPT_SEPARATOR +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl + $@; +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.terminator.statement.perl + $a +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl + $b +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl + %ENV $ENV{'bar'} +# ^ punctuation.definition.variable.perl +# ^^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^^ variable.language.perl + $] $OLD_PERL_VERSION +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl + $^F $SYSTEM_FD_MAX +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl + @F # array of fields of each line with autosplit mode on +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl + %INC +# ^ punctuation.definition.variable.perl +# ^^^^ variable.language.perl + $^I $INPLACE_EDIT +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl + @ISA # list of that class's parent classes +# ^ punctuation.definition.variable.perl +# ^^^^ variable.language.perl + $^O $OSNAME +# ^ punctuation.definition.variable.perl +# ^^^ variable.language.perl + %SIG $SIG{"PIPE"} # hash of signal handlers for signals +# ^ punctuation.definition.variable.perl +# ^^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^^ variable.language.perl + $^O $OSNAME +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl + $^V $PERL_VERSION +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl + $^X $EXECUTABLE_NAME +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl + +# Variables related to regular expressions + + $& $MATCH $&[0] +# ^ punctuation.definition.variable.perl +# ^^ variable.language.regexp.match.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.regexp.match.perl +# ^^^ meta.item-access.perl + $` $PREMATCH +# ^ punctuation.definition.variable.perl +# ^^ variable.language.regexp.match.perl + $' $POSTMATCH +# ^ punctuation.definition.variable.perl +# ^^ variable.language.regexp.match.perl + $+ $LAST_PAREN_MATCH +# ^ punctuation.definition.variable.perl +# ^^ variable.language.regexp.match-group.perl + @+ @LAST_MATCH_END +# ^ punctuation.definition.variable.perl +# ^^ variable.language.regexp.match-group.perl + %+ %LAST_PAREN_MATCH +# ^ punctuation.definition.variable.perl +# ^^ variable.language.regexp.match-group.perl + $- $LAST_MATCH_START +# ^ punctuation.definition.variable.perl +# ^^ variable.language.regexp.match-group.perl + @- @LAST_MATCH_START +# ^ punctuation.definition.variable.perl +# ^^ variable.language.regexp.match-group.perl + %- %LAST_MATCH_START +# ^ punctuation.definition.variable.perl +# ^^ variable.language.regexp.match-group.perl + $1 $#1 $1[0] $#1[0] $1{key} +# ^ punctuation.definition.variable.perl +# ^^ variable.language.regexp.match-group.perl +# ^^ punctuation.definition.variable.perl +# ^^^ variable.language.regexp.match-group.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.regexp.match-group.perl +# ^^^ meta.item-access.perl +# ^^ punctuation.definition.variable.perl +# ^^^ variable.language.regexp.match-group.perl +# ^^^ meta.item-access.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.regexp.match-group.perl +# ^^^^^ meta.item-access.perl + 1*2*3*4*5*6 +# ^^^^^^^^^^^ - variable + $+[0]-$+[$#-] +# ^ punctuation.definition.variable.perl +# ^^ variable.language.regexp.match-group.perl +# ^^^ meta.item-access.perl +# ^ keyword.operator.arithmetic.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.regexp.match-group.perl +# ^^^^^ meta.item-access.perl +# ^^ punctuation.definition.variable.perl +# ^^^ variable.language.regexp.match-group.perl + $-[0]*$-[$-[2]] +# ^ punctuation.definition.variable.perl +# ^^ variable.language.regexp.match-group.perl +# ^^^ meta.item-access.perl +# ^ keyword.operator.arithmetic.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.regexp.match-group.perl +# ^^^ meta.item-access.perl - meta.item-access meta.item-access +# ^^^ meta.item-access.perl meta.item-access.perl +# ^ meta.item-access.perl - meta.item-access meta.item-access +# ^ punctuation.section.item-access.begin.perl +# ^^ variable.language.regexp.match-group.perl +# ^ punctuation.section.item-access.begin.perl +# ^ constant.numeric.integer.decimal.perl +# ^^ punctuation.section.item-access.end.perl + +# Variables related to input/output formating + + $, @, %, *, $OFS $OUTPUT_FIELD_SEPARATOR +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl + $. @. %. *. $NR $INPUT_LINE_NUMBER +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl + $/ @/ %/ */ $RS $INPUT_RECORD_SEPARATOR +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl + $\ @\ %\ *\ $ORS $OUTPUT_RECORD_SEPARATOR +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl + $| @| %| *| $OUTPUT_AUTOFLUSH +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl + $: @: %: *: $FORMAT_LINE_BREAK_CHARACTERS +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl + $= @=,%=,*= $FORMAT_LINES_PER_PAGE +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^^^^^^^^^^^^^^^ variable.language.perl + $^ @^ %^ *^ $FORMAT_TOP_NAME +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^^^^^^^^^ variable.language.perl + $~ @~ %~ *~ $FORMAT_NAME +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^^^^^ variable.language.perl + +# Error Variables + + $^E @^E %^E *^E $EXTENDED_OS_ERROR +# ^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^^^^^^^^^^^ variable.language.perl + $^S @^S %^S *^S $EXCEPTIONS_BEING_CAUGHT +# ^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^^^^^^^^^^^^^^^^^ variable.language.perl + $^W @^W %^W *^W $WARNING +# ^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^ variable.language.perl + $! @! %! *! $ERRNO $OS_ERROR +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^^ variable.language.perl + $@ @@ %@ *@ $EVAL_ERROR +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^^^^ variable.language.perl + $? @? %? *? $CHILD_ERROR +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^^^^^ variable.language.perl + +# Deprecated and removed variables + + $# # format printed numbers +# ^^ variable.language.deprecated.perl +# ^ punctuation.definition.variable.perl + $* # enable multiline matching +# ^^ variable.language.deprecated.perl +# ^ punctuation.definition.variable.perl + $[ # index of the first element in an array +# ^^ variable.language.deprecated.perl +# ^ punctuation.definition.variable.perl + +###[ UNQUALIFIED VARIABLES ]################################################## + + $_foo = "bar"; +# ^ punctuation.definition.variable.perl +# ^^^^^ variable.other.readwrite.perl +# ^ keyword.operator.assignment.perl +# ^ punctuation.definition.string.begin.perl +# ^^^^^ meta.string.perl string.quoted.double.perl +# ^ punctuation.definition.string.end.perl +# ^ punctuation.terminator.statement.perl + $_foo = "bar"; +# ^ punctuation.definition.variable.perl +# ^^^^^ variable.other.readwrite.perl +# ^ keyword.operator.assignment.perl +# ^ punctuation.definition.string.begin.perl +# ^^^^^ meta.string.perl string.quoted.double.perl +# ^ punctuation.definition.string.end.perl +# ^ punctuation.terminator.statement.perl + $foo{bar} +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.definition.variable.perl +# ^ punctuation.section.item-access.begin.perl +# ^^^^^ meta.item-access.perl +# ^^^ constant.other.key.perl +# ^ punctuation.section.item-access.end.perl + $foo{bar()} +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.definition.variable.perl +# ^ punctuation.section.item-access.begin.perl +# ^^^^^ meta.item-access.perl +# ^^^ variable.function.perl +# ^ punctuation.section.item-access.end.perl + $foo{10 + $bar} +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.definition.variable.perl +# ^ punctuation.section.item-access.begin.perl +# ^^^^^^^^^^^ meta.item-access.perl +# ^^ constant.numeric.integer.decimal.perl +# ^ keyword.operator.arithmetic.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.section.item-access.end.perl + +###[ QUALIFIED VARIABLES ]#################################################### + + $::foo # scalar in the 'main' namespace +# ^^^^^^ meta.path.perl +# ^ - meta.path +# ^ punctuation.definition.variable.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.other.readwrite.perl + $::Foo[$bar] # array in the 'main' namespace +# ^^^^^^ meta.path.perl - meta.item-access +# ^^^^^^ meta.item-access.perl - meta.path +# ^ punctuation.definition.variable.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.other.readwrite.perl +# ^ punctuation.section.item-access.begin.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.section.item-access.end.perl + $::FOO{'bar'} # hash in the 'main' namespace +# ^^^^^^ meta.path.perl - meta.item-access +# ^^^^^^^ meta.item-access.perl - meta.path +# ^ punctuation.definition.variable.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.other.readwrite.perl +# ^ punctuation.section.item-access.begin.perl +# ^^^^^ meta.string.perl string.quoted.single.perl +# ^ punctuation.section.item-access.end.perl + $::foo->[$bar] # reference in the 'main' namespace +# ^^^^^^ meta.path.perl - meta.item-access +# ^^ - meta.path - meta.item-access +# ^^^^^^ meta.item-access.perl - meta.path +# ^ punctuation.definition.variable.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.other.readwrite.perl +# ^^ punctuation.accessor.arrow.perl +# ^ punctuation.section.item-access.begin.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.section.item-access.end.perl + $::foo->{'bar'} # reference in the 'main' namespace +# ^^^^^^ meta.path.perl - meta.item-access +# ^^ - meta.path - meta.item-access +# ^^^^^^^ meta.item-access.perl - meta.path +# ^ punctuation.definition.variable.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.other.readwrite.perl +# ^^ punctuation.accessor.arrow.perl +# ^ punctuation.section.item-access.begin.perl +# ^^^^^ meta.string.perl string.quoted.single.perl +# ^ punctuation.section.item-access.end.perl + $Foo::bar # 'bar' is a scalar +# ^^^^^^^^^ meta.path.perl +# ^ - meta.path +# ^ punctuation.definition.variable.perl +# ^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.other.readwrite.perl + $Foo::bar->[0] # 'bar' is a reference of an array +# ^^^^^^^^^ meta.path.perl - meta.item-access +# ^^ - meta.path - meta.item-access +# ^^^ meta.item-access.perl - meta.path +# ^ punctuation.definition.variable.perl +# ^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.other.readwrite.perl +# ^^ punctuation.accessor.arrow.perl +# ^^^ meta.item-access.perl + $FOO::bar->{key} # 'bar' is a reference of a hash +# ^^^^^^^^^ meta.path.perl - meta.item-access +# ^^ - meta.path - meta.item-access +# ^^^^^ meta.item-access.perl - meta.path +# ^ punctuation.definition.variable.perl +# ^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.other.readwrite.perl +# ^^ punctuation.accessor.arrow.perl +# ^ punctuation.section.item-access.begin.perl +# ^^^ constant.other.key.perl +# ^ punctuation.section.item-access.end.perl + $Foo::bar->baz # 'Bar' is a reference to a class or namespace +# ^^^^^^^^^ meta.path.perl +# ^ - meta.path +# ^ punctuation.definition.variable.perl +# ^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.other.readwrite.perl +# ^^ punctuation.accessor.arrow.perl +# ^^^ variable.function.member.perl + $Foo::bar::baz +# ^^^^^^^^^^^^^^ meta.path.perl +# ^ - meta.path +# ^ punctuation.definition.variable.perl +# ^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.other.readwrite.perl + $Foo::$bar::baz # a part of the qualifier is a variable +# ^^^^^^^^^^^^^^^ meta.path.perl +# ^ - meta.path +# ^ punctuation.definition.variable.perl +# ^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.other.readwrite.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.other.readwrite.perl + $Foo::${bar}::baz # a part of the qualifier is a variable +# ^^^^^^^^^^^^^^^^^ meta.path.perl +# ^ - meta.path +# ^ punctuation.definition.variable.perl +# ^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^^^ meta.variable.perl +# ^^^ string.unquoted.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.other.readwrite.perl + $Foo::Bar::baz() # baz is not a function +# ^^^^^^^^^^^^^^ meta.path.perl +# ^^ - meta.path +# ^ punctuation.definition.variable.perl +# ^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.other.readwrite.perl +# ^ punctuation.section.group.begin.perl +# ^ punctuation.section.group.end.perl + $foo::Bar::baz[4] # 'baz' is an array +# ^^^^^^^^^^^^^^ meta.path.perl - meta.item-access +# ^^^ meta.item-access.perl - meta.path +# ^ punctuation.definition.variable.perl +# ^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.other.readwrite.perl +# ^ punctuation.section.item-access.begin.perl +# ^ constant.numeric.integer +# ^ punctuation.section.item-access.end.perl + $FOO::BAR::baz{key} # baz is a hash +# ^^^^^^^^^^^^^^ meta.path.perl - meta.item-access +# ^^^^^ meta.item-access.perl - meta.path +# ^ punctuation.definition.variable.perl +# ^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.other.readwrite.perl +# ^ punctuation.section.item-access.begin.perl +# ^^^ constant.other.key.perl +# ^ punctuation.section.item-access.end.perl + $Foo::Bar->$baz->[-1] +# ^^^^^^^^^ meta.path.perl +# ^ - meta.path +# ^ punctuation.definition.variable.perl +# ^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.other.readwrite.perl +# ^^ punctuation.accessor.arrow.perl - variable +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.definition.variable.perl +# ^^^ variable.other.readwrite.perl +# ^^ punctuation.accessor.arrow.perl +# ^ punctuation.section.item-access.begin.perl +# ^^^^ meta.item-access.perl +# ^ punctuation.section.item-access.end.perl + +###[ VARIABLE DEREFERENCING ]################################################# + + $$ref $$$refref $$$$refrefref +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.perl +# ^^^^ variable.other.readwrite.perl +# ^^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^ variable.other.readwrite.perl +# ^^^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^^^ variable.other.readwrite.perl + $@ref $$@refref $%$@refrefref +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.perl +# ^^^^ variable.other.readwrite.perl +# ^^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^ variable.other.readwrite.perl +# ^^^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^^^ variable.other.readwrite.perl + $%ref $$%refref $@$%refrefref +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.perl +# ^^^^ variable.other.readwrite.perl +# ^^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^ variable.other.readwrite.perl +# ^^^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^^^ variable.other.readwrite.perl + $#$ref #=> 2 ## Last element index, -1 if empty +# ^^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.perl +# ^^^^ variable.other.readwrite.perl + $#{$ref} #=> 2 ## Last element index, alternate syntax +# ^^^^^^^^ meta.variable.perl +# ^^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.begin.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.definition.variable.end.perl + @{$ref}[2,1,0] #=> (3, 2, 1) # Also: @$aref[2,1,0] +# ^^^^^^^ meta.variable.perl +# ^^^^^^^ meta.item-access.perl +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.begin.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.definition.variable.end.perl +# ^ punctuation.section.item-access.begin.perl +# ^ constant.numeric.integer.decimal.perl +# ^ punctuation.separator.sequence.perl +# ^ punctuation.section.item-access.end.perl + ${ &$coderef() }; # Call by function reference +# ^^^^^^^^^^^^^^^^ meta.variable.perl +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.begin.perl +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^ variable.other.readwrite.perl +# ^ punctuation.section.group.begin.perl +# ^ punctuation.section.group.end.perl +# ^ punctuation.definition.variable.end.perl + ${get_var_name()} +# ^^^^^^^^^^^^^^^^^ meta.variable.perl +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.begin.perl +# ^^^^^^^^^^^^ variable.function.perl +# ^ punctuation.definition.variable.end.perl + ${the_var_name}[0] +# ^^^^^^^^^^^^^^^ meta.variable.perl +# ^^^ meta.item-access.perl +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.begin.perl +# ^^^^^^^^^^^^ meta.string.perl string.unquoted.perl +# ^ punctuation.definition.variable.end.perl +# ^ punctuation.section.item-access.begin.perl +# ^ constant.numeric.integer.decimal.perl +# ^ punctuation.section.item-access.end.perl + ${/\w+$/g = $var} +# ^^^^^^^^^^^^^^^^^ meta.variable.perl +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.begin.perl +# ^ punctuation.section.generic.begin.perl +# ^^^^ meta.string.perl string.regexp.perl +# ^ punctuation.section.generic.end.perl +# ^ constant.language.flags.regexp.perl +# ^ keyword.operator.assignment.perl +# ^ punctuation.definition.variable.end.perl + %{$foo{bar}{baz}} = 'excl'; +# ^^^^^^^^^^^^^^^^^ meta.variable.perl +# ^^^^^^^^^^ meta.item-access.perl +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.begin.perl +# ^ punctuation.definition.variable.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.section.item-access.begin.perl +# ^^^ constant.other.key.perl +# ^ punctuation.section.item-access.end.perl +# ^^^ constant.other.key.perl +# ^ punctuation.section.item-access.end.perl +# ^ punctuation.definition.variable.end.perl +# ^ keyword.operator.assignment.perl +# ^^^^^^ meta.string.perl string.quoted.single.perl +# ^ punctuation.terminator.statement.perl + %{$foo{'bar'}{'bar'}} = 'excl'; +# ^^^^^^^^^^^^^^^^^^^^^ meta.variable.perl +# ^^^^^^^^^^^^^^ meta.item-access.perl +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.begin.perl +# ^ punctuation.definition.variable.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.section.item-access.begin.perl +# ^^^^^ meta.string.perl string.quoted.single.perl +# ^ punctuation.section.item-access.end.perl +# ^ punctuation.section.item-access.begin.perl +# ^^^^^ meta.string.perl string.quoted.single.perl +# ^ punctuation.section.item-access.end.perl +# ^ punctuation.definition.variable.end.perl +# ^ keyword.operator.assignment.perl +# ^^^^^^ meta.string.perl string.quoted.single.perl +# ^ punctuation.terminator.statement.perl + ${Foo::Bar::baz} +# ^^^^^^^^^^^^^^^^ meta.variable.perl +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.begin.perl +# ^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.function.perl +# ^ punctuation.definition.variable.end.perl + ${Foo::Bar::baz}[$var] +# ^^^^^^^^^^^^^^^^ meta.variable.perl +# ^^^^^^ meta.item-access.perl + ${ +#^ - variable +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.begin.perl +# ^^^ meta.variable.perl + Foo::bar->baz() +# <- meta.variable.perl +#^^^^^^^^^^^^^^^^^^^ meta.variable.perl +# ^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ variable.namespace.perl +# ^^ punctuation.accessor.arrow.perl +# ^^^ variable.function.member.perl + } +# <- meta.variable.perl +#^^ meta.variable.perl +# ^ punctuation.definition.variable.end.perl +# ^ - variable + ${ &$coderef() }; # Call by function reference +# ^^^^^^^^^^^^^^^^ meta.variable.perl +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.begin.perl +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^ variable.other.readwrite.perl +# ^ punctuation.section.group.begin.perl +# ^ punctuation.section.group.end.perl +# ^ punctuation.definition.variable.end.perl + &$coderef; +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^ variable.other.readwrite.perl +# ^ punctuation.terminator.statement.perl + &$coderef(); +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^ variable.other.readwrite.perl +# ^ punctuation.section.group.begin.perl +# ^ punctuation.section.group.end.perl +# ^ punctuation.terminator.statement.perl + &$::coderef(); +#^^ - meta.path.perl +# ^^^^^^^^^^ meta.path.perl +# ^^^ - meta.path.perl +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^^^^ variable.other.readwrite.perl +# ^ punctuation.section.group.begin.perl +# ^ punctuation.section.group.end.perl +# ^ punctuation.terminator.statement.perl + &$ns::coderef(); +#^^ - meta.path.perl +# ^^^^^^^^^^^^ meta.path.perl +# ^^^ - meta.path.perl +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^^^^ variable.other.readwrite.perl +# ^ punctuation.section.group.begin.perl +# ^ punctuation.section.group.end.perl + &{$coderef}(); +#^ - meta.variable +# ^^^^^^^^^^^ meta.variable.perl +# ^^^ - meta.variable +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.begin.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^ variable.other.readwrite.perl +# ^ punctuation.definition.variable.end.perl +# ^ punctuation.section.group.begin.perl +# ^ punctuation.section.group.end.perl + &{*coderef{NAME}}(); +#^ - meta.variable +# ^^^^^^^^^^^^^^^^^ meta.variable.perl +# ^^^^^^ meta.item-access.perl +# ^^^ - meta.variable +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.begin.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^ variable.other.readwrite.perl +# ^ punctuation.section.item-access.begin.perl +# ^^^^ constant.other.key.perl +# ^ punctuation.section.item-access.end.perl +# ^ punctuation.definition.variable.end.perl +# ^ punctuation.section.group.begin.perl +# ^ punctuation.section.group.end.perl + &{$Module::coderef}(); +# ^^^^^^^^^^^^^^^^^^^ meta.variable.perl +# ^^^ - meta.variable +# ^^ - meta.path.perl +# ^^^^^^^^^^^^^^^^ meta.path.perl +# ^^^ - meta.path.perl +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.begin.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^^^^ variable.other.readwrite.perl +# ^ punctuation.definition.variable.end.perl +# ^ punctuation.section.group.begin.perl +# ^ punctuation.section.group.end.perl +# ^ punctuation.terminator.statement.perl + &{ get_sub_reference() }(); #=> Calls returned subroutine reference +#^ - meta.variable +# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.variable.perl +# ^^^ - meta.variable +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.begin.perl +# ^^^^^^^^^^^^^^^^^ variable.function.perl +# ^ punctuation.section.group.begin.perl +# ^ punctuation.section.group.end.perl +# ^ punctuation.definition.variable.end.perl +# ^ punctuation.section.group.begin.perl +# ^ punctuation.section.group.end.perl +# ^ punctuation.terminator.statement.perl + # addin items to an array + $AoA[$i] = [ somefunc($i) ]; +# ^^^^ variable.other.readwrite.perl - meta.item-access +# ^^^^ meta.item-access.perl +# ^ punctuation.section.item-access.begin.perl +# ^^ variable.other.readwrite.perl +# ^ punctuation.section.item-access.end.perl +# ^ keyword.operator.assignment.perl +# ^ punctuation.section.brackets.begin.perl +# ^ punctuation.section.brackets.end.perl +# ^ punctuation.terminator.statement.perl + # add new columns to an existing row + push @{ $AoA[0] }, "wilma", "betty"; # explicit deref +# ^^^^ support.function.perl +# ^^^^^^^^^^^^ meta.variable.perl +# ^^^^ variable.other.readwrite.perl - meta.item-access +# ^^^ meta.item-access.perl +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.begin.perl +# ^ punctuation.definition.variable.perl +# ^ punctuation.section.item-access.begin.perl +# ^ constant.numeric.integer +# ^ punctuation.section.item-access.end.perl +# ^ punctuation.definition.variable.end.perl +# ^ punctuation.separator.sequence.perl +# ^^^^^^^ meta.string.perl string.quoted.double.perl +# ^ punctuation.separator.sequence.perl +# ^^^^^^^ meta.string.perl string.quoted.double.perl +# ^ punctuation.terminator.statement.perl + +###[ REFERENCES DEFINITIONS ]################################################# + + *_ = \my $a; +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ keyword.operator.assignment.perl +# ^ keyword.operator.reference.perl +# ^^ storage.type.variable.perl +# ^ punctuation.definition.variable.perl +# ^^ variable.language.perl +# ^ punctuation.terminator.statement.perl + $strref = \"foo"; +# ^ punctuation.definition.variable.perl +# ^^^^^^^ variable.other.readwrite.perl +# ^ keyword.operator.assignment.perl +# ^ keyword.operator.reference.perl +# ^^^^^ meta.string.perl string.quoted.double.perl + $refrefref = \\\"foo"; +# ^ punctuation.definition.variable.perl +# ^^^^^^^^^^ variable.other.readwrite.perl +# ^ keyword.operator.assignment.perl +# ^^^ keyword.operator.reference.perl +# ^^^^^ meta.string.perl string.quoted.double.perl + $globref = \*foo; +# ^ keyword.operator.assignment.perl +# ^ keyword.operator.reference.perl +# ^ punctuation.definition.variable.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.terminator.statement.perl + $scalarref = \$foo; +# ^ keyword.operator.assignment.perl +# ^ keyword.operator.reference.perl +# ^ punctuation.definition.variable.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.terminator.statement.perl + $scalarrefref = \\$foo; +# ^ keyword.operator.assignment.perl +# ^^ keyword.operator.reference.perl +# ^ punctuation.definition.variable.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.terminator.statement.perl + $arrayref = \@ARGV; +# ^ keyword.operator.assignment.perl +# ^ keyword.operator.reference.perl +# ^ punctuation.definition.variable.perl +# ^^^^^ variable.language.perl +# ^ punctuation.terminator.statement.perl + $arrayrefref = \\@ARGV; +# ^ keyword.operator.assignment.perl +# ^^ keyword.operator.reference.perl +# ^ punctuation.definition.variable.perl +# ^^^^^ variable.language.perl +# ^ punctuation.terminator.statement.perl + $hashref = \%ENV; +# ^ keyword.operator.assignment.perl +# ^ keyword.operator.reference.perl +# ^ punctuation.definition.variable.perl +# ^^^^ variable.language.perl +# ^ punctuation.terminator.statement.perl + $hashrefref = \\%ENV; +# ^ keyword.operator.assignment.perl +# ^^ keyword.operator.reference.perl +# ^ punctuation.definition.variable.perl +# ^^^^ variable.language.perl +# ^ punctuation.terminator.statement.perl + @list = (\$a, \@b, \%c); +# ^ punctuation.section.group.begin.perl +# ^ keyword.operator.reference.perl +# ^^ variable.language.perl +# ^ punctuation.separator.sequence.perl +# ^ keyword.operator.reference.perl +# ^^ variable.language.perl +# ^ punctuation.separator.sequence.perl +# ^ keyword.operator.reference.perl +# ^^ variable.other.readwrite.perl +# ^ punctuation.section.group.end.perl +# ^ punctuation.terminator.statement.perl + @list = \($a, @b, %c); # same thing! +# ^ keyword.operator.reference.perl +# ^ punctuation.section.group.begin.perl +# ^^ variable.language.perl +# ^ punctuation.separator.sequence.perl +# ^^ variable.language.perl +# ^ punctuation.separator.sequence.perl +# ^^ variable.other.readwrite.perl +# ^ punctuation.section.group.end.perl +# ^ punctuation.terminator.statement.perl + @list = \\($a, @b, %c); +# ^^ keyword.operator.reference.perl +# ^ punctuation.section.group.begin.perl +# ^^ variable.language.perl +# ^ punctuation.separator.sequence.perl +# ^^ variable.language.perl +# ^ punctuation.separator.sequence.perl +# ^^ variable.other.readwrite.perl +# ^ punctuation.section.group.end.perl +# ^ punctuation.terminator.statement.perl + $coderef = \&func; # Reference to function +# ^ keyword.operator.assignment.perl +# ^ keyword.operator.reference.perl +# ^ keyword.operator.dereference.perl +# ^^^^ variable.function.perl +# ^ punctuation.terminator.statement.perl + $coderef = \&if::func; +# ^^^^ - meta.path +# ^^^^^^^^ meta.path.perl +# ^ keyword.operator.assignment.perl +# ^ keyword.operator.reference.perl +# ^ keyword.operator.dereference.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl +# ^ punctuation.terminator.statement.perl + $coderef = \&{ get_sub_reference() } +# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.variable.perl +# ^ keyword.operator.assignment.perl +# ^ keyword.operator.reference.perl +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.begin.perl +# ^^^^^^^^^^^^^^^^^ variable.function.perl +# ^ punctuation.section.group.begin.perl +# ^ punctuation.section.group.end.perl +# ^ punctuation.definition.variable.end.perl + +###[ PACKAGE DEFINITION ]##################################################### + + package; +# ^^^^^^^ meta.namespace.perl storage.type.namespace.perl keyword.declaration.namespace.perl +# ^ punctuation.terminator.statement.perl - meta.namespace + package; # comment +# ^^^^^^^ meta.namespace.perl storage.type.namespace.perl keyword.declaration.namespace.perl +# ^^^^^^^^^^^ - meta.namespace +# ^ punctuation.terminator.statement.perl +# ^^^^^^^^^ comment.line.number-sign.perl + package package; +# ^^^^^^^^^^^^^^^ meta.namespace.perl - meta.path +# ^ - meta.namespace +# ^^^^^^^ storage.type.namespace.perl keyword.declaration.namespace.perl +# ^^^^^^^ entity.name.namespace.perl +# ^ punctuation.terminator.statement.perl + package Package; +# ^^^^^^^^^^^^^^^ meta.namespace.perl - meta.path +# ^ - meta.namespace +# ^^^^^^^ storage.type.namespace.perl keyword.declaration.namespace.perl +# ^^^^^^^ entity.name.namespace.perl +# ^ punctuation.terminator.statement.perl + package PACKAGE; +# ^^^^^^^^^^^^^^^ meta.namespace.perl - meta.path +# ^ - meta.namespace +# ^^^^^^^ storage.type.namespace.perl keyword.declaration.namespace.perl +# ^^^^^^^ entity.name.namespace.perl +# ^ punctuation.terminator.statement.perl + package # comment +# ^^^^^^^ meta.namespace.perl storage.type.namespace.perl keyword.declaration.namespace.perl +# ^^^^^^^^^ meta.namespace.perl comment.line.number-sign.perl + if; # Perl allows namespaces looking like keywords +# ^^ meta.namespace.perl entity.name.namespace.perl +# ^ punctuation.terminator.statement.perl + package name 5.023_234; +# ^^^^^^^^^^^^^^^^^^^^^^ meta.namespace.perl - meta.path +# ^ - meta.namespace +# ^^^^^^^ storage.type.namespace.perl keyword.declaration.namespace.perl +# ^^^^ entity.name.namespace.perl +# ^^^^^^^^^ constant.numeric.version.perl +# ^ punctuation.separator.decimal.perl +# ^ punctuation.terminator.statement.perl + package name 5.023_234 { print "block" }; +# ^^^^^^^^^^^^^^^^^^^^^^^ meta.namespace.perl - meta.path +# ^^^^^^^^^^^^^^^^^^ - meta.namespace +# ^^^^^^^ storage.type.namespace.perl keyword.declaration.namespace.perl +# ^^^^ entity.name.namespace.perl +# ^^^^^^^^^ constant.numeric.version.perl +# ^ punctuation.separator.decimal.perl +# ^ punctuation.section.block.begin.perl +# ^ punctuation.terminator.statement.perl + package ::name; +# ^^^^^^^^ meta.namespace.perl - meta.path +# ^^^^^^ meta.namespace.perl meta.path.perl +# ^ - meta.namespace +# ^^^^^^^ storage.type.namespace.perl keyword.declaration.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.namespace.perl +# ^ punctuation.terminator.statement.perl + package +# ^^^^^^^^ meta.namespace.perl +# ^^^^^^^ storage.type.namespace.perl keyword.declaration.namespace.perl + ::name; +# ^^ meta.namespace.perl - meta.path +# ^^^^^^ meta.namespace.perl meta.path.perl +# ^ - meta.namespace +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.namespace.perl +# ^ punctuation.terminator.statement.perl + package ns::name; +# ^^^^^^^^ meta.namespace.perl - meta.path +# ^^^^^^^^ meta.namespace.perl meta.path.perl +# ^ - meta.namespace +# ^^^^^^^ storage.type.namespace.perl keyword.declaration.namespace.perl +# ^^ entity.name.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.namespace.perl +# ^ punctuation.terminator.statement.perl + package Ns::Name; +# ^^^^^^^^ meta.namespace.perl - meta.path +# ^^^^^^^^ meta.namespace.perl meta.path.perl +# ^ - meta.namespace +# ^^^^^^^ storage.type.namespace.perl keyword.declaration.namespace.perl +# ^^ entity.name.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.namespace.perl +# ^ punctuation.terminator.statement.perl + package NS::NAME; +# ^^^^^^^^ meta.namespace.perl - meta.path +# ^^^^^^^^ meta.namespace.perl meta.path.perl +# ^ - meta.namespace +# ^^^^^^^ storage.type.namespace.perl keyword.declaration.namespace.perl +# ^^ entity.name.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.namespace.perl +# ^ punctuation.terminator.statement.perl + package if::else::name; +# ^^^^^^^^ meta.namespace.perl - meta.path +# ^^^^^^^^^^^^^^ meta.namespace.perl meta.path.perl +# ^ - meta.namespace +# ^^^^^^^ storage.type.namespace.perl keyword.declaration.namespace.perl +# ^^ entity.name.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.namespace.perl +# ^ punctuation.terminator.statement.perl + package +# ^^^^^^^^ meta.namespace.perl - meta.path +# ^^^^^^^ storage.type.namespace.perl keyword.declaration.namespace.perl + NS::NAME +# ^^ meta.namespace.perl - meta.path +# ^^^^^^^^ meta.namespace.perl meta.path.perl +# ^^ entity.name.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.namespace.perl + v5.24.1; +#^^^^^^^^^^ meta.namespace.perl +# ^ - meta.namespace +# ^^^^^^^ constant.numeric.version.perl +# ^ punctuation.definition.version.perl +# ^ punctuation.separator.decimal.perl +# ^ punctuation.separator.decimal.perl +# ^ punctuation.terminator.statement.perl + package 5.0; +# ^^^^^^^^^^^ meta.namespace.perl - meta.path +# ^ - meta.namespace +# ^^^^^^^ storage.type.namespace.perl keyword.declaration.namespace.perl +# ^^^ constant.numeric.version.perl + package "5.0"; +# ^^^^^^^^^^^^^ meta.namespace.perl - meta.path +# ^ - meta.namespace +# ^^^^^^^ storage.type.namespace.perl keyword.declaration.namespace.perl +# ^^^^^ meta.string.perl string.quoted.double.perl + package $name; +# ^^^^^^^^ meta.namespace.perl - meta.path +# ^^^^^^ - meta.namespace +# ^^^^^^^ storage.type.namespace.perl keyword.declaration.namespace.perl + package-name; +# ^^^^^^^ meta.namespace.perl - meta.path +# ^^^^^^ - meta.namespace +# ^^^^^^^ storage.type.namespace.perl keyword.declaration.namespace.perl + package.name; +# ^^^^^^^ meta.namespace.perl - meta.path +# ^^^^^^ - meta.namespace +# ^^^^^^^ storage.type.namespace.perl keyword.declaration.namespace.perl + CORE::package; +# ^^^^^^^ storage.type.namespace.perl keyword.declaration.namespace.perl + core::package; +# ^^^^^^^^^^^^^^ - meta.namespace.perl +# ^^^^^^^ - storage + package::name; +# ^^^^^^^^^^^^^^ - meta.namespace.perl +# ^^^^^^^ - storage + +###[ PACKAGE IMPORTS ]######################################################## + + require +# ^^^^^^^^ meta.preprocessor.require.perl +# ^^^^^^^ keyword.control.import.require.perl + require; +# ^^^^^^^ meta.preprocessor.require.perl entity.name.namespace.perl +# ^ punctuation.terminator.statement.perl + require # comment +# ^^^^^^^^^^^^^^^^^^ meta.preprocessor.require.perl +# ^^^^^^^ keyword.control.import.require.perl +# ^ comment.line.number-sign.perl + if ; # Perl allows namespaces looking like keywords +# ^^^ meta.preprocessor.require.perl +# ^^ entity.name.namespace.perl +# ^ punctuation.terminator.statement.perl +# ^ comment.line.number-sign.perl + require 5.024; +# ^^^^^^^^^^^^^ meta.preprocessor.require.perl +# ^ - meta.preprocessor +# ^^^^^^^ keyword.control.import.require.perl +# ^^^^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl +# ^ punctuation.terminator.statement.perl + require v5.24.1; # run time version check +# ^^^^^^^^^^^^^^^ meta.preprocessor.require.perl +# ^ - meta.preprocessor +# ^^^^^^^ keyword.control.import.require.perl +# ^ punctuation.definition.version.perl +# ^^^^^^^ constant.numeric.version.perl +# ^ punctuation.separator.decimal.perl +# ^ punctuation.separator.decimal.perl +# ^ punctuation.terminator.statement.perl +# ^ comment.line.number-sign.perl + require 5.24.1; # ditto +# ^^^^^^^^^^^^^^ meta.preprocessor.require.perl +# ^ - meta.preprocessor +# ^^^^^^^ keyword.control.import.require.perl +# ^^^^^^ constant.numeric.version.perl +# ^ punctuation.separator.decimal.perl +# ^ punctuation.separator.decimal.perl +# ^ punctuation.terminator.statement.perl +# ^ comment.line.number-sign.perl + require 5.024_001; # ditto; older syntax compatible +# ^^^^^^^^^^^^^^^^^ meta.preprocessor.require.perl +# ^ - meta.preprocessor +# ^^^^^^^ keyword.control.import.require.perl +# ^^^^^^^^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl +# ^ punctuation.terminator.statement.perl +# ^ comment.line.number-sign.perl + require +# ^^^^^^^^ meta.preprocessor.require.perl +# ^^^^^^^ keyword.control.import.require.perl + 5.024_001; # ditto; older syntax compatible +# ^^^^^^^^^^^ meta.preprocessor.require.perl +# ^ - meta.preprocessor +# ^^^^^^^^^ constant.numeric.float.decimal.perl +# ^ punctuation.separator.decimal.perl +# ^ punctuation.terminator.statement.perl +# ^ comment.line.number-sign.perl + require English; +# ^^^^^^^^^^^^^^^ meta.preprocessor.require.perl - meta.path +# ^ - meta.preprocessor +# ^^^^^^^ keyword.control.import.require.perl +# ^^^^^^^ entity.name.namespace.perl + require utf8; +# ^^^^^^^^^^^^ meta.preprocessor.require.perl - meta.path +# ^ - meta.preprocessor +# ^^^^^^^ keyword.control.import.require.perl +# ^^^^ entity.name.namespace.perl + require ::utf8; +# ^^^^^^^^ meta.preprocessor.require.perl - meta.path +# ^^^^^^ meta.preprocessor.require.perl meta.path.perl +# ^ - meta.preprocessor +# ^^^^^^^ keyword.control.import.require.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.namespace.perl + require Foo::bar; +# ^^^^^^^^ meta.preprocessor.require.perl - meta.path +# ^^^^^^^^ meta.preprocessor.require.perl meta.path.perl +# ^ - meta.preprocessor +# ^^^^^^^ keyword.control.import.require.perl +# ^^^ entity.name.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ entity.name.namespace.perl +# ^ punctuation.terminator.statement.perl + require +# ^^^^^^^^ meta.preprocessor.require.perl - meta.path +# ^^^^^^^ keyword.control.import.require.perl + Foo::Bar; +# ^^ meta.preprocessor.require.perl - meta.path +# ^^^^^^^^ meta.preprocessor.require.perl meta.path.perl +# ^ - meta.preprocessor +# ^^^ entity.name.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ entity.name.namespace.perl +# ^ punctuation.terminator.statement.perl + require "foo/bar.pm"; +# ^^^^^^^^^^^^^^^^^^^^ meta.preprocessor.require.perl - meta.path +# ^^^^^^^ keyword.control.import.require.perl +# ^^^^^^^^^^^^ meta.string.perl string.quoted.double.perl +# ^ punctuation.terminator.statement.perl + require $name; +# ^^^^^^^^^^^^^ meta.preprocessor.require.perl - meta.path +# ^^^^^^^ keyword.control.import.require.perl +# ^^^^^ variable.other.readwrite.perl +# ^ punctuation.terminator.statement.perl + require foo.$bar.pm; +# ^^^^^^^^^^^^^^^^^^^ meta.preprocessor.require.perl - meta.path +# ^^^^^^^ keyword.control.import.require.perl +# ^^^ meta.string.perl string.unquoted.perl +# ^ keyword.operator.concat.perl +# ^^^^ variable.other.readwrite.perl +# ^ keyword.operator.concat.perl +# ^^ variable.function.perl +# ^ punctuation.terminator.statement.perl + require-name; +# ^^^^^^^^^^^^ meta.preprocessor.require.perl - meta.path +# ^ - meta.preprocessor.require +# ^^^^^^^ keyword.control.import.require.perl +# ^ keyword.operator.arithmetic.perl +# ^^^^ variable.function.perl +# ^ punctuation.terminator.statement.perl + require.name; +# ^^^^^^^^^^^^ meta.preprocessor.require.perl - meta.path +# ^ - meta.preprocessor.require +# ^^^^^^^ keyword.control.import.require.perl +# ^ keyword.operator.concat.perl +# ^^^^ variable.function.perl +# ^ punctuation.terminator.statement.perl + CORE::require; +# ^^^^^^ - meta.preprocessor +# ^^^^^^^ meta.preprocessor.require.perl +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^^^^ keyword.control.import.require.perl +# ^ punctuation.terminator.statement.perl + core::require; +# ^^^^^^^^^^ - meta.preprocessor.require.perl +# ^^^^^^^ - keyword +# ^ punctuation.terminator.statement.perl + require::name; +# ^^^^^^^^^^^^^^ - meta.preprocessor.require.perl +# ^^^^^^^ - keyword +# ^ punctuation.terminator.statement.perl + +eval { require Mail::Send }; +# ^^^^^^^^ meta.preprocessor.require.perl - meta.path +# ^^^^^^^^^^ meta.preprocessor.require.perl meta.path.perl +# ^ meta.preprocessor.require.perl - meta.path +# ^^ - meta.preprocessor.require.perl +# ^^^^^^^ keyword.control.import.require.perl +eval { require Mail.'::'.Send }; +# ^^^^^^^^^^^^^^^^^^^^^^^ meta.preprocessor.require.perl +# ^^ - meta.preprocessor.require.perl +# ^^^^^^^ keyword.control.import.require.perl +eval { require B::Flags and $var++ }; +# ^^^^^^^^ meta.preprocessor.require.perl - meta.path +# ^^^^^^^^ meta.preprocessor.require.perl meta.path.perl +# ^ meta.preprocessor.require.perl - meta.path +# ^^^^^^^^^^^^^ - meta.preprocessor.require.perl +# ^^^^^^^ keyword.control.import.require.perl +# ^ meta.path.perl entity.name.namespace.perl +# ^^ meta.path.perl punctuation.accessor.double-colon.perl +# ^^^^^ meta.path.perl entity.name.namespace.perl +# ^^^ keyword.operator.logical.perl +use strict; +# <- meta.preprocessor.use.perl keyword.control.import.use.perl +#^^^^^^^^^ meta.preprocessor.use.perl +#^^ keyword.control.import.use.perl +# ^^^^^^ entity.name.namespace.perl +# ^ punctuation.terminator.statement.perl +use strict "vars"; +# <- meta.preprocessor.use.perl keyword.control.import.use.perl +#^^^^^^^^^^^^^^^^ meta.preprocessor.use.perl +#^^ keyword.control.import.use.perl +# ^^^^^^ entity.name.namespace.perl +# ^ punctuation.definition.string.begin.perl +# ^^^^^^ meta.string.perl string.quoted.double.perl +# ^ punctuation.definition.string.end.perl +# ^ punctuation.terminator.statement.perl + use attributes __PACKAGE__, \&foo, 'method'; +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.preprocessor.use.perl +# ^^^ keyword.control.import.use.perl +# ^^^^^^^^^^ entity.name.namespace.perl +# ^^^^^^^^^^^ constant.language.perl +# ^ punctuation.separator.sequence.perl + use if; +# ^^^^^^ meta.preprocessor.use.perl - meta.path +# ^ - meta.preprocessor - meta.path +# ^^^ keyword.control.import.use.perl +# ^^ entity.name.namespace.perl +# ^ punctuation.terminator.statement.perl + use if::else; +# ^^^^ meta.preprocessor.use.perl - meta.path +# ^^^^^^^^ meta.preprocessor.use.perl meta.path.perl +# ^ - meta.preprocessor - meta.path +# ^^^ keyword.control.import.use.perl +# ^^ entity.name.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.namespace.perl +# ^ punctuation.terminator.statement.perl + use warnings::register Foo::func; +# ^^^^ meta.preprocessor.use.perl - meta.path +# ^^^^^^^^^^^^^^^^^^ meta.preprocessor.use.perl meta.path.perl +# ^ meta.preprocessor.use.perl - meta.path +# ^^^^^^^^^ meta.preprocessor.use.perl meta.path.perl +# ^ - meta.preprocessor - meta.path +# ^^^ keyword.control.import.use.perl +# ^^^^^^^^ entity.name.namespace.perl +# ^^ meta.path.perl punctuation.accessor.double-colon.perl +# ^^^^^^^^ entity.name.namespace.perl +# ^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl +# ^ punctuation.terminator.statement.perl + CORE::use; +# ^^^^^^ - meta.preprocessor +# ^^^ meta.preprocessor.use.perl +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ keyword.control.import.use.perl +# ^ punctuation.terminator.statement.perl + core::use; +# ^^^^^^^^^^ - meta.preprocessor.use.perl +# ^^^ - keyword +# ^ punctuation.terminator.statement.perl + use::name; +# ^^^^^^^^^^ - meta.preprocessor.use.perl +# ^^^ - keyword +# ^ punctuation.terminator.statement.perl + + no strict; +# ^^^^^^^^^ meta.preprocessor.no.perl +# ^ - meta.preprocessor - meta.path +# ^^ keyword.control.import.no.perl +# ^^^^^^ entity.name.namespace.perl +# ^ punctuation.terminator.statement.perl + CORE::no; +# ^^^^^^ - meta.preprocessor +# ^^ meta.preprocessor.no.perl +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^ keyword.control.import.no.perl +# ^ punctuation.terminator.statement.perl + core::no; +# ^^^^^^^^^ - meta.preprocessor.no.perl +# ^^ - keyword +# ^ punctuation.terminator.statement.perl + no::name; +# ^^^^^^^^^^ - meta.preprocessor.no.perl +# ^^ - keyword +# ^ punctuation.terminator.statement.perl + +###[ DECLARATIONS ]########################################################### + +my +# <- storage.type.variable.perl +#^ storage.type.variable.perl + my $foo +#^ - storage +# ^^ storage.type.variable.perl +# ^ - storage.type.variable - variable.other.readwrite +# ^ punctuation.definition.variable.perl +# ^^^^ variable.other.readwrite.perl # ^ - variable.other.readwrite my $foo; -# <- keyword.declaration.variable.perl -#^ keyword.declaration.variable.perl +# <- storage.type.variable.perl +#^ storage.type.variable.perl # ^ punctuation.definition.variable.perl -# ^^^^ variable.other.readwrite.global.perl +# ^^^^ variable.other.readwrite.perl # ^ punctuation.terminator.statement.perl my $foo = "bar"; -# <- keyword.declaration.variable.perl -#^ keyword.declaration.variable.perl +# <- storage.type.variable.perl +#^ storage.type.variable.perl # ^ punctuation.definition.variable.perl -# ^^^^ variable.other.readwrite.global.perl +# ^^^^ variable.other.readwrite.perl # ^ keyword.operator.assignment.perl # ^ punctuation.definition.string.begin.perl -# ^^^^^ string.quoted.double.perl +# ^^^^^ meta.string.perl string.quoted.double.perl # ^ punctuation.definition.string.end.perl # ^ punctuation.terminator.statement.perl my ( -# <- keyword.declaration.variable.perl -#^ keyword.declaration.variable.perl +# <- storage.type.variable.perl +#^ storage.type.variable.perl $foo, $bar, # ^ punctuation.definition.variable.perl -# ^^^^ variable.other.readwrite.global.perl +# ^^^^ variable.other.readwrite.perl # ^ punctuation.separator.sequence.perl # ^ punctuation.definition.variable.perl -# ^^^^ variable.other.readwrite.global.perl +# ^^^^ variable.other.readwrite.perl $baz # ^ punctuation.definition.variable.perl -# ^^^^ variable.other.readwrite.global.perl +# ^^^^ variable.other.readwrite.perl ); # ^ punctuation.section.group.end.perl # ^ punctuation.terminator.statement.perl eval { my $foo = /pattern/; } # ^^^^ support.function.perl # ^ punctuation.section.block.begin.perl -# ^^ keyword.declaration.variable.perl -# ^^^^ variable.other.readwrite.global.perl +# ^^ storage.type.variable.perl +# ^^^^ variable.other.readwrite.perl # ^ keyword.operator.assignment.perl # ^ punctuation.section.generic.begin.perl -# ^^^^^^^ string.regexp.perl source.regexp meta.literal.regexp +# ^^^^^^^ meta.string.perl string.regexp.perl source.regexp meta.literal.regexp # ^ punctuation.section.generic.end.perl # ^ punctuation.terminator.statement.perl # ^ punctuation.section.block.end.perl - my::foo::bar -# ^^ - keyword.declaration.variable.perl + CORE::my +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^ storage.type.variable.perl + core::my +# ^^^^^^^^ meta.path.perl +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^ variable.function.perl + my::core +# ^^^^^^^^ meta.path.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl + our -# <- keyword.declaration.variable -#^^ keyword.declaration.variable +# <- storage.type.variable.perl +#^^ storage.type.variable.perl our $foo # <- #^ - storage -# ^^^ keyword.declaration.variable -# ^ - keyword.declaration.variable - variable.other.readwrite +# ^^^ storage.type.variable.perl +# ^ - storage.type.variable - variable.other.readwrite # ^ punctuation.definition.variable.perl -# ^^^^ variable.other.readwrite +# ^^^^ variable.other.readwrite.perl # ^ - variable.other.readwrite our $foo; -# <- keyword.declaration.variable.perl -#^^ keyword.declaration.variable.perl +# <- storage.type.variable.perl +#^^ storage.type.variable.perl # ^ punctuation.definition.variable.perl -# ^^^^ variable.other.readwrite.global.perl +# ^^^^ variable.other.readwrite.perl # ^ punctuation.terminator.statement.perl our $foo = "bar"; -# <- keyword.declaration.variable.perl -#^^ keyword.declaration.variable.perl +# <- storage.type.variable.perl +#^^ storage.type.variable.perl # ^ punctuation.definition.variable.perl -# ^^^^ variable.other.readwrite.global.perl +# ^^^^ variable.other.readwrite.perl # ^ keyword.operator.assignment.perl # ^ punctuation.definition.string.begin.perl -# ^^^^^ string.quoted.double.perl +# ^^^^^ meta.string.perl string.quoted.double.perl # ^ punctuation.definition.string.end.perl # ^ punctuation.terminator.statement.perl our ( -# <- keyword.declaration.variable.perl -#^^ keyword.declaration.variable.perl +# <- storage.type.variable.perl +#^^ storage.type.variable.perl $foo, $bar, # ^ punctuation.definition.variable.perl -# ^^^^ variable.other.readwrite.global.perl +# ^^^^ variable.other.readwrite.perl # ^ punctuation.separator.sequence.perl # ^ punctuation.definition.variable.perl -# ^^^^ variable.other.readwrite.global.perl +# ^^^^ variable.other.readwrite.perl $baz # ^ punctuation.definition.variable.perl -# ^^^^ variable.other.readwrite.global.perl +# ^^^^ variable.other.readwrite.perl ); # ^ punctuation.section.group.end.perl # ^ punctuation.terminator.statement.perl our $VERSION = do { -# <- keyword.declaration.variable.perl -#^^ keyword.declaration.variable.perl -# ^^^^^^^^ variable.other.readwrite.global.perl +# <- storage.type.variable.perl +#^^ storage.type.variable.perl +# ^^^^^^^^ variable.other.readwrite.perl # ^ keyword.operator.assignment.perl -# ^^ keyword.control.flow.perl +# ^^ keyword.control.flow.do.perl # ^ punctuation.section.block.begin.perl my @r = (q$Revision: 2.20 $ =~ /\d+/g); -# ^^ keyword.declaration.variable.perl -# ^^ variable.other.readwrite.global.perl +# ^^ storage.type.variable.perl +# ^^ variable.other.readwrite.perl # ^ keyword.operator.assignment.perl # ^ punctuation.section.group.begin.perl # ^ meta.function-call.perl support.function.perl # ^^^^^^^^^^^^^^^^^ meta.function-call.perl meta.generic.perl # ^ punctuation.section.generic.begin.perl -# ^^^^^^^^^^^^^^^ string.unquoted.perl +# ^^^^^^^^^^^^^^^ meta.string.perl string.unquoted.perl # ^^^^ - constant.numeric # ^ punctuation.section.generic.end.perl # ^^ keyword.operator.binary.perl # ^ punctuation.section.generic.begin.perl -# ^^^ string.regexp.perl source.regexp +# ^^^ meta.string.perl string.regexp.perl source.regexp # ^ punctuation.section.generic.end.perl # ^ constant.language.flags.regexp.perl sprintf "%d."."%02d" x $#r, @r # ^^^^^^^ support.function.perl +# ^^^^^ meta.string.perl string.quoted.double.perl +# ^^ constant.other.placeholder +# ^ keyword.operator.concat.perl +# ^^^^^^ meta.string.perl string.quoted.double.perl +# ^^^^ constant.other.placeholder +# ^ keyword.operator.arithmetic.perl +# ^^^ variable.other.readwrite.perl +# ^ punctuation.separator.sequence.perl +# ^^ variable.other.readwrite.perl }; # <- punctuation.section.block.end.perl state -# <- keyword.declaration.variable -#^^^^ keyword.declaration.variable +# <- storage.type.variable.perl +#^^^^ storage.type.variable.perl state $foo # <- #^ - storage -# ^^^^^ keyword.declaration.variable -# ^ - keyword.declaration.variable - variable.other.readwrite +# ^^^^^ storage.type.variable.perl +# ^ - storage.type.variable - variable.other.readwrite # ^ punctuation.definition.variable.perl -# ^^^^ variable.other.readwrite +# ^^^^ variable.other.readwrite.perl # ^ - variable.other.readwrite -require -# <- meta.import.require.perl keyword.control.import.require.perl -#^^^^^^ meta.import.require.perl keyword.control.import.require.perl -require "v5.1.0"; -# <- meta.import.require.perl keyword.control.import.require.perl -#^^^^^^^^^^^^^^^ meta.import.require.perl -#^^^^^^ keyword.control.import.require.perl -# ^^^^^^^^ string.quoted.double.perl - constant.numeric -# ^ punctuation.terminator.statement.perl -eval { require Mail::Send; }; -#<- support.function.perl -#^^^ support.function.perl -# ^ punctuation.section.block.begin.perl -# ^^^^^^^^^^^^^^^^^^ meta.import.require.perl -# ^^^^ - meta.import.require.perl -# ^^^^^^^ keyword.control.import.require.perl -eval { require Mail :: Send; }; -#<- support.function.perl -#^^^ support.function.perl -# ^ punctuation.section.block.begin.perl -# ^^^^^^^^^^^^^^^^^^^^ meta.import.require.perl -# ^^^^ support.class.perl -# ^^^^ - support.class -# ^^ punctuation.accessor.double-colon.perl -# ^^^^ support.class.perl -# ^^^^ - meta.import.require.perl -# ^^^^^^^ keyword.control.import.require.perl -use strict; -# <- meta.use.perl keyword.control.import.use.perl -#^^^^^^^^^ meta.use.perl -#^^ keyword.control.import.use.perl -# ^^^^^^ storage.modifier.perl + +###[ PREPROCESSOR ]########################################################### + + BEGIN { +# ^^^^^^ meta.function.perl +# ^^^^^ entity.name.function.prepocessor.perl +# ^ punctuation.section.block.begin.perl + } +# ^ punctuation.section.block.end.perl + ::BEGIN { +# ^^^^^^^^ meta.function.perl +# ^^ invalid.illegal.accessor.perl +# ^^^^^ entity.name.function.prepocessor.perl +# ^ punctuation.section.block.begin.perl + } +# ^ punctuation.section.block.end.perl + sub BEGIN { +# ^^^^^^^^^^ meta.function.perl +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^^ entity.name.function.prepocessor.perl +# ^ punctuation.section.block.begin.perl + } +# ^ punctuation.section.block.end.perl + sub ::BEGIN { +# ^^^^ meta.function.perl - meta.path.perl - meta.block +# ^^^^^^^ meta.function.perl meta.path.perl - meta.block +# ^ meta.function.perl - meta.path.perl - meta.block +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^^ entity.name.function.prepocessor.perl +# ^ punctuation.section.block.begin.perl + } +# ^ punctuation.section.block.end.perl + CHECK { +# ^^^^^^ meta.function.perl +# ^^^^^ entity.name.function.prepocessor.perl +# ^ punctuation.section.block.begin.perl + } +# ^ punctuation.section.block.end.perl + sub CHECK { +# ^^^^^^^^^^ meta.function.perl +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^^ entity.name.function.prepocessor.perl +# ^ punctuation.section.block.begin.perl + } +# ^ punctuation.section.block.end.perl + END { +# ^^^^ meta.function.perl +# ^^^ entity.name.function.prepocessor.perl +# ^ punctuation.section.block.begin.perl + } +# ^ punctuation.section.block.end.perl + sub END { +# ^^^^^^^^ meta.function.perl +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^ entity.name.function.prepocessor.perl +# ^ punctuation.section.block.begin.perl + } +# ^ punctuation.section.block.end.perl + INIT { +# ^^^^^ meta.function.perl +# ^^^^ entity.name.function.prepocessor.perl +# ^ punctuation.section.block.begin.perl + } +# ^ punctuation.section.block.end.perl + sub INIT { +# ^^^^^^^^^ meta.function.perl +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^ entity.name.function.prepocessor.perl +# ^ punctuation.section.block.begin.perl + } +# ^ punctuation.section.block.end.perl + UNITCHECK { +# ^^^^^^^^^^ meta.function.perl +# ^^^^^^^^^ entity.name.function.prepocessor.perl +# ^ punctuation.section.block.begin.perl + } +# ^ punctuation.section.block.end.perl + sub UNITCHECK { +# ^^^^^^^^^^^^^^ meta.function.perl +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^^^^^^ entity.name.function.prepocessor.perl +# ^ punctuation.section.block.begin.perl + } +# ^ punctuation.section.block.end.perl + sub AUTOLOAD () {} +# ^^^^^^^^^^^^^ meta.function.perl +# ^^ meta.function.parameters.perl +# ^ meta.function.perl +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^^^^^ entity.name.function.callback.perl + sub ::AUTOLOAD () {} +# ^^^^ meta.function.perl - meta.path +# ^^^^^^^^^^ meta.function.perl meta.path.perl - meta.function.parameters.perl +# ^ meta.function.perl - meta.function.parameters.perl - meta.path +# ^^ meta.function.parameters.perl - meta.function.perl - meta.path +# ^ meta.function.perl - meta.function.parameters.perl - meta.path +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^^^^^ entity.name.function.callback.perl + +###[ UNQUALIFIED SUBROUTINE DEFINITIONS ]###################################### + + sub +# ^^^ meta.function.perl storage.type.function.perl keyword.declaration.function.perl +# ^ - invalid + sub # comment +# ^^^^^^^^^^^^^^ meta.function.perl +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^ - comment - entity - keyword - invalid +# ^^^^^^^^^ comment.line.number-sign.perl + sub func +# ^^^^^^^^^ meta.function.perl +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^ entity.name.function.perl +# ^ - entity - invalid + sub func # comment +# ^^^^^^^^^^^^^^^^^^^ meta.function.perl +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^ entity.name.function.perl +# ^ - comment - entity - invalid +# ^^^^^^^^^ comment.line.number-sign.perl + sub func invalid +# ^^^^^^^^^^^^^^^^ meta.function.perl +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^ entity.name.function.perl +# ^ - entity - invalid +# ^^^^^^^ invalid.illegal.identifier.perl + sub func invalid # comment +# ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.perl +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^ entity.name.function.perl +# ^ - entity - invalid +# ^^^^^^^ invalid.illegal.identifier.perl +# ^ - comment - entity - invalid +# ^^^^^^^^^ comment.line.number-sign.perl + sub func; +# ^^^^^^^^ meta.function.perl +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^ entity.name.function.perl # ^ punctuation.terminator.statement.perl -use strict "vars"; -# <- meta.use.perl keyword.control.import.use.perl -#^^^^^^^^^^^^^^^^ meta.use.perl -#^^ keyword.control.import.use.perl -# ^^^^^^ storage.modifier.perl -# ^ punctuation.definition.string.begin.perl -# ^^^^^^ string.quoted.double.perl -# ^ punctuation.definition.string.end.perl -# ^ punctuation.terminator.statement.perl - use attributes __PACKAGE__, \&foo, 'method'; -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.use.perl -# ^^^ keyword.control.import.use.perl -# ^^^^^^^^^^ storage.modifier.perl -# ^^^^^^^^^^^ constant.language.perl -# ^ punctuation.separator.sequence.perl -use File; -# <- meta.use.perl keyword.control.import.use.perl -#^^^^^^^ meta.use.perl -#^^ keyword.control.import.use.perl -# ^^^^ support.class.perl -# ^ punctuation.terminator.statement.perl -use File::data; -# <- meta.use.perl keyword.control.import.use.perl -#^^^^^^^^^^^^^ meta.use.perl -#^^ keyword.control.import.use.perl -# ^^^^ support.class.perl -# ^^ punctuation.accessor.double-colon.perl -# ^^^^ variable.other.member.perl -# ^ punctuation.terminator.statement.perl -use warnings :: register File :: data; -# <- meta.use.perl keyword.control.import.use.perl -#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.use.perl -#^^ keyword.control.import.use.perl -# ^^^^^^^^^^^^^^^^^^^^ storage.modifier.perl -# ^^^^ support.class.perl -# ^^ punctuation.accessor.double-colon.perl -# ^^^^ variable.other.member.perl -# ^ punctuation.terminator.statement.perl -no strict; -# <- meta.no.perl keyword.declaration.no.perl -#^^^^^^^^ meta.no.perl -#^ keyword.declaration.no.perl -# ^^^^^^ storage.modifier.perl -# ^ punctuation.terminator.statement.perl + sub func invalid; +# ^^^^^^^^^^^^^^^^ meta.function.perl +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^ entity.name.function.perl +# ^^^^^^^ invalid.illegal.identifier.perl +# ^ punctuation.terminator.statement.perl + sub :attr ; +# ^^^^ meta.function.perl - meta.annotation +# ^^^^^^ meta.function.perl meta.annotation.perl +# ^ - meta.function +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^ punctuation.definition.annotation.perl +# ^^^^ variable.annotation.attribute.perl +# ^ punctuation.terminator.statement.perl + sub func : Attr ; +# ^^^^^^^^^ meta.function.perl - meta.annotation +# ^^^^^^^ meta.function.perl meta.annotation.perl +# ^ - meta.function +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^ entity.name.function.perl +# ^ punctuation.definition.annotation.perl +# ^^^^ variable.annotation.attribute.perl +# ^ punctuation.terminator.statement.perl + sub func : Attr :attr2 ; +# ^^^^^^^^^ meta.function.perl - meta.annotation +# ^^^^^^^^^^^^^^ meta.function.perl meta.annotation.perl +# ^ - meta.function +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^ entity.name.function.perl +# ^ punctuation.definition.annotation.perl +# ^^^^ variable.annotation.attribute.perl +# ^ punctuation.definition.annotation.perl +# ^^^^^ variable.annotation.attribute.perl +# ^ punctuation.terminator.statement.perl + sub func : attr invalid; +# ^^^^^^^^^ meta.function.perl - meta.annotation +# ^^^^^^^^^^^^^^ meta.function.perl meta.annotation.perl +# ^ - meta.function +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^ entity.name.function.perl +# ^ punctuation.definition.annotation.perl +# ^^^^ variable.annotation.attribute.perl +# ^^^^^^^ invalid.illegal.identifier.perl +# ^ punctuation.terminator.statement.perl + sub func invalid :attr; +# ^^^^^^^^^^^^^^^^^ meta.function.perl - meta.annotation +# ^^^^^ meta.function.perl meta.annotation.perl +# ^ - meta.function +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^ entity.name.function.perl +# ^^^^^^^ invalid.illegal.identifier.perl +# ^ punctuation.definition.annotation.perl +# ^^^^ variable.annotation.attribute.perl +# ^ punctuation.terminator.statement.perl -### [ SUB ]################################################################### - -sub -# <- meta.function.perl keyword.control.sub.perl -#^^ meta.function.perl keyword.control.sub.perl -# ^ - invalid -sub name -# <- meta.function.perl keyword.control.sub.perl -#^^^^^^^ meta.function.perl -#^^ keyword.control.sub.perl -# ^^^^ entity.name.function.perl -# ^ - invalid -sub name invalid -# <- meta.function.perl keyword.control.sub.perl -#^^^^^^^^^^^^^^^ meta.function.perl -#^^ keyword.control.sub.perl -# ^^^^ entity.name.function.perl -# ^^^^^^^ invalid.illegal.function-name.perl -sub name; -# <- meta.function.perl keyword.control.sub.perl -#^^^^^^^ meta.function.perl -#^^ keyword.control.sub.perl -# ^^^^ entity.name.function.perl -# ^ punctuation.terminator.statement.perl -sub name invalid; -# <- meta.function.perl keyword.control.sub.perl -#^^^^^^^^^^^^^^^ meta.function.perl -#^^ keyword.control.sub.perl -# ^^^^ entity.name.function.perl -# ^^^^^^^ invalid.illegal.function-name.perl -# ^ punctuation.terminator.statement.perl -sub { -# <- meta.function.perl keyword.control.sub.perl -#^^^^^^^^^^ meta.function.perl -#^^ keyword.control.sub.perl -# ^ punctuation.section.block.begin.perl - say "Hello"; -# <- meta.function.perl -#^^^^^^^^^^^^^^ meta.function.perl -# ^^^ support.function.perl -} -# <- meta.function.perl punctuation.section.block.end.perl -sub -{ -# <- meta.function.perl punctuation.section.block.begin.perl -} -# <- meta.function.perl punctuation.section.block.end.perl -sub name { -# <- meta.function.perl keyword.control.sub.perl -#^^^^^^^^^^ meta.function.perl -#^^ keyword.control.sub.perl -# ^^^^ entity.name.function.perl -# ^ punctuation.section.block.begin.perl - say "Hello"; -# <- meta.function.perl -#^^^^^^^^^^^^^^ meta.function.perl -# ^^^ support.function.perl -} -# <- meta.function.perl punctuation.section.block.end.perl + sub # comment +# ^^^^^^^^^^^^^^ meta.function.perl - meta.annotation +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^ - comment - entity - keyword - invalid +# ^^^^^^^^^ comment.line.number-sign.perl + func +# ^^^^ meta.function.perl entity.name.function.perl - meta.annotation + : +#^ meta.function.perl - meta.annotation +# ^^ meta.function.perl meta.annotation.perl +# ^ punctuation.definition.annotation.perl + attr +#^^^^^^ meta.function.perl meta.annotation.perl +# ^^^^ variable.annotation.attribute.perl + : +#^^^ meta.function.perl meta.annotation.perl +# ^ punctuation.definition.annotation.perl + attr +#^^^^^^ meta.function.perl meta.annotation.perl +# ^^^^ variable.annotation.attribute.perl + ; +#^ meta.function.perl meta.annotation.perl +# ^ punctuation.terminator.statement.perl - meta.function -sub name -{ -# <- meta.function.perl punctuation.section.block.begin.perl -} -# <- meta.function.perl punctuation.section.block.end.perl -sub name invalid { -# <- meta.function.perl keyword.control.sub.perl -#^^^^^^^^^^^^^^^^^ meta.function.perl -#^^ keyword.control.sub.perl -# ^^^^ entity.name.function.perl -# ^^^^^^^ invalid.illegal.function-name.perl -# ^ punctuation.section.block.begin.perl -} -# <- meta.function.perl punctuation.section.block.end.perl -sub name invalid -{ -# <- meta.function.perl punctuation.section.block.begin.perl -} -# <- meta.function.perl punctuation.section.block.end.perl - -sub name ($arg, $arg) { -# <- meta.function.perl keyword.control.sub.perl -#^^^^^^^^ meta.function.perl - meta.function.parameters.perl -# ^^^^^^^^^^^^ meta.function.parameters.perl - meta.function.perl -# ^^ meta.function.perl - meta.function.parameters.perl -#^^ keyword.control.sub.perl -# ^^^^ entity.name.function.perl -# ^ punctuation.section.group.begin.perl -# ^^^^ variable.parameter.perl +## subroutine with code block + + sub { say "Hello"; } +# ^^^^ meta.function.perl - meta.annotation +# ^^^^^^^^^^^^^^^^ - meta.function - meta.annotation +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^ punctuation.section.block.begin.perl +# ^^^ support.function.perl +# ^ punctuation.section.block.end.perl + sub func { say "Hello"; } +# ^^^^^^^^^ meta.function.perl - meta.annotation +# ^^^^^^^^^^^^^^^^ - meta.function - meta.annotation +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^ entity.name.function.perl +# ^ punctuation.section.block.begin.perl +# ^^^ support.function.perl +# ^ punctuation.section.block.end.perl + sub func invalid { say "Hello"; } +# ^^^^^^^^^^^^^^^^^ meta.function.perl - meta.annotation +# ^^^^^^^^^^^^^^^^ - meta.function - meta.annotation +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^ entity.name.function.perl +# ^^^^^^^ invalid.illegal.identifier.perl +# ^ punctuation.section.block.begin.perl +# ^^^ support.function.perl +# ^ punctuation.section.block.end.perl + sub :attr { say "Hello"; } +# ^^^^ meta.function.perl - meta.annotation +# ^^^^^^ meta.function.perl meta.annotation.perl +# ^^^^^^^^^^^^^^^^ - meta.function - meta.annotation +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^ punctuation.definition.annotation.perl +# ^^^^ variable.annotation.attribute.perl +# ^ punctuation.section.block.begin.perl +# ^^^ support.function.perl +# ^ punctuation.section.block.end.perl + sub :attr invalid { say "Hello"; } +# ^^^^ meta.function.perl - meta.annotation +# ^^^^^^^^^^^^^^ meta.function.perl meta.annotation.perl +# ^^^^^^^^^^^^^^^^ - meta.function - meta.annotation +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^ punctuation.definition.annotation.perl +# ^^^^ variable.annotation.attribute.perl +# ^^^^^^^ invalid.illegal.identifier.perl +# ^ punctuation.section.block.begin.perl +# ^^^ support.function.perl +# ^ punctuation.section.block.end.perl + sub func:attr { say "Hello"; } +# ^^^^^^^^ meta.function.perl - meta.annotation +# ^^^^^^ meta.function.perl meta.annotation.perl +# ^^^^^^^^^^^^^^^^ - meta.function - meta.annotation +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^ entity.name.function.perl +# ^ punctuation.definition.annotation.perl +# ^^^^ variable.annotation.attribute.perl +# ^ punctuation.section.block.begin.perl +# ^^^ support.function.perl +# ^ punctuation.section.block.end.perl + sub func:attr invalid { say "Hello"; } +# ^^^^^^^^ meta.function.perl - meta.annotation +# ^^^^^^^^^^^^^^ meta.function.perl meta.annotation.perl +# ^^^^^^^^^^^^^^^^ - meta.function - meta.annotation +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^ entity.name.function.perl +# ^ punctuation.definition.annotation.perl +# ^^^^ variable.annotation.attribute.perl +# ^^^^^^^ invalid.illegal.identifier.perl +# ^ punctuation.section.block.begin.perl +# ^^^ support.function.perl +# ^ punctuation.section.block.end.perl + + sub +# ^^^ meta.function.perl storage.type.function.perl keyword.declaration.function.perl + { } +# ^ punctuation.section.block.begin.perl +# ^ punctuation.section.block.end.perl + + sub +# ^^^ meta.function.perl storage.type.function.perl keyword.declaration.function.perl + func +# ^^^^ meta.function.perl entity.name.function.perl + { } +# ^ punctuation.section.block.begin.perl +# ^ punctuation.section.block.end.perl + + sub +# ^^^ meta.function.perl storage.type.function.perl keyword.declaration.function.perl + func +# ^^^^ meta.function.perl entity.name.function.perl + invalid +# ^^^^^^^ meta.function.perl invalid.illegal.identifier.perl + { } +# ^ punctuation.section.block.begin.perl +# ^ punctuation.section.block.end.perl + + sub +# ^^^ meta.function.perl storage.type.function.perl keyword.declaration.function.perl + : +# ^ meta.function.perl meta.annotation.perl punctuation.definition.annotation.perl + attr +# ^^^^ meta.function.perl meta.annotation.perl variable.annotation.attribute.perl + { } +# ^ punctuation.section.block.begin.perl +# ^ punctuation.section.block.end.perl + + sub +# ^^^ meta.function.perl storage.type.function.perl keyword.declaration.function.perl + : +# ^ meta.function.perl meta.annotation.perl punctuation.definition.annotation.perl + attr +# ^^^^ meta.function.perl meta.annotation.perl variable.annotation.attribute.perl + invalid +# ^^^^^^^ meta.function.perl meta.annotation.perl invalid.illegal.identifier.perl + { } +# ^ punctuation.section.block.begin.perl +# ^ punctuation.section.block.end.perl + + sub +# ^^^ meta.function.perl storage.type.function.perl keyword.declaration.function.perl + func +# ^^^^ meta.function.perl entity.name.function.perl + invalid +# ^^^^^^^ meta.function.perl invalid.illegal.identifier.perl + : +# ^ meta.function.perl meta.annotation.perl punctuation.definition.annotation.perl + attr +# ^^^^ meta.function.perl meta.annotation.perl variable.annotation.attribute.perl + { } +# ^ punctuation.section.block.begin.perl +# ^ punctuation.section.block.end.perl + + sub +# ^^^ meta.function.perl storage.type.function.perl keyword.declaration.function.perl + func +# ^^^^ meta.function.perl entity.name.function.perl + invalid +# ^^^^^^^ meta.function.perl invalid.illegal.identifier.perl + : +# ^ meta.function.perl meta.annotation.perl punctuation.definition.annotation.perl + attr +# ^^^^ meta.function.perl meta.annotation.perl variable.annotation.attribute.perl + : +# ^ meta.function.perl meta.annotation.perl punctuation.definition.annotation.perl + attr +# ^^^^ meta.function.perl meta.annotation.perl variable.annotation.attribute.perl + invalid +# ^^^^^^^ meta.function.perl meta.annotation.perl invalid.illegal.identifier.perl + { } +# ^ punctuation.section.block.begin.perl +# ^ punctuation.section.block.end.perl + + ## prototypes + + sub ($) ; +# ^^^^ meta.function.perl - meta.function.parameters - meta.annotation +# ^^^ meta.function.parameters.perl - meta.function.perl - meta.annotation +# ^ meta.function.perl - meta.function.parameters - meta.annotation - meta.block +# ^ - meta.function +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^ punctuation.section.parameters.begin.perl +# ^ variable.parameter.perl +# ^ punctuation.section.parameters.end.perl +# ^ punctuation.terminator.statement.perl + sub ($) {} +# ^^^^ meta.function.perl - meta.function.parameters - meta.annotation +# ^^^ meta.function.parameters.perl - meta.function.perl - meta.annotation +# ^ meta.function.perl - meta.function.parameters - meta.annotation - meta.block +# ^^ - meta.annotation +# ^ - meta.function +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^ punctuation.section.parameters.begin.perl +# ^ variable.parameter.perl +# ^ punctuation.section.parameters.end.perl +# ^ punctuation.section.block.begin.perl +# ^ punctuation.section.block.end.perl + sub ($;$) {} +# ^^^^ meta.function.perl - meta.function.parameters - meta.annotation +# ^^^^^ meta.function.parameters.perl - meta.function.perl - meta.annotation +# ^ meta.function.perl - meta.function.parameters - meta.annotation - meta.block +# ^^ - meta.annotation +# ^ - meta.function +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^ punctuation.section.parameters.begin.perl +# ^ variable.parameter.perl +# ^ punctuation.separator.sequence.perl +# ^ variable.parameter.perl +# ^ punctuation.section.parameters.end.perl +# ^ punctuation.section.block.begin.perl +# ^ punctuation.section.block.end.perl + sub func($;$;$) {} +# ^^^^^^^^ meta.function.perl - meta.function.parameters - meta.annotation +# ^^^^^^^ meta.function.parameters.perl - meta.function.perl - meta.annotation +# ^ meta.function.perl - meta.function.parameters - meta.annotation - meta.block +# ^^ - meta.annotation +# ^ - meta.function +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^ entity.name.function.perl +# ^ punctuation.section.parameters.begin.perl +# ^ variable.parameter.perl +# ^ punctuation.separator.sequence.perl +# ^ variable.parameter.perl # ^ punctuation.separator.sequence.perl -# ^^^^ variable.parameter.perl -# ^ punctuation.section.group.end.perl +# ^ variable.parameter.perl +# ^ punctuation.section.parameters.end.perl +# ^ punctuation.section.block.begin.perl +# ^ punctuation.section.block.end.perl + sub func:attr($) {} +# ^^^^^^^^ meta.function.perl - meta.function.parameters - meta.annotation +# ^^^^^ meta.function.perl meta.annotation.perl - meta.function.parameters +# ^^^ meta.function.parameters.perl - meta.function.perl - meta.annotation +# ^ meta.function.perl - meta.function.parameters - meta.annotation - meta.block +# ^^ - meta.annotation +# ^ - meta.function +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^ entity.name.function.perl +# ^ punctuation.definition.annotation.perl +# ^^^^ variable.annotation.attribute.perl +# ^ punctuation.section.parameters.begin.perl +# ^ variable.parameter.perl +# ^ punctuation.section.parameters.end.perl +# ^ punctuation.section.block.begin.perl +# ^ punctuation.section.block.end.perl + sub func : attr ( $ ) { } +# ^^^^^^^^^ meta.function.perl - meta.function.parameters - meta.annotation +# ^^^^^^ meta.function.perl meta.annotation.perl - meta.function.parameters +# ^^^^^ meta.function.parameters.perl - meta.function.perl - meta.annotation +# ^ meta.function.perl - meta.function.parameters - meta.annotation - meta.block +# ^^^ - meta.annotation +# ^ - meta.function +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^ entity.name.function.perl +# ^ punctuation.definition.annotation.perl +# ^^^^ variable.annotation.attribute.perl +# ^ punctuation.section.parameters.begin.perl +# ^ variable.parameter.perl +# ^ punctuation.section.parameters.end.perl +# ^ punctuation.section.block.begin.perl +# ^ punctuation.section.block.end.perl + sub func($) :attr {} +# ^^^^^^^^ meta.function.perl - meta.function.parameters- meta.annotation +# ^^^ meta.function.parameters.perl - meta.function.perl- meta.annotation +# ^ meta.function.perl - meta.function.parameters - meta.annotation - meta.block +# ^^^^^^ meta.function.perl meta.annotation.perl - meta.block +# ^^ +# ^ - meta.function +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^ entity.name.function.perl +# ^ punctuation.section.parameters.begin.perl +# ^ variable.parameter.perl +# ^ punctuation.section.parameters.end.perl +# ^ punctuation.definition.annotation.perl +# ^^^^ variable.annotation.attribute.perl +# ^ punctuation.section.block.begin.perl +# ^ punctuation.section.block.end.perl + sub func :attr($) :attr {} +# ^^^^^^^^^ meta.function.perl - meta.function.parameters - meta.annotation +# ^^^^^ meta.function.perl meta.annotation.perl - meta.function.parameters +# ^^^ meta.function.parameters.perl - meta.function.perl - meta.annotation +# ^ meta.function.perl - meta.function.parameters - meta.annotation - meta.block +# ^^^^^^ meta.function.perl meta.annotation.perl - meta.function.parameters +# ^^ +# ^ - meta.function +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^ entity.name.function.perl +# ^ punctuation.definition.annotation.perl +# ^^^^ variable.annotation.attribute.perl +# ^ punctuation.section.parameters.begin.perl +# ^ variable.parameter.perl +# ^ punctuation.section.parameters.end.perl +# ^ punctuation.definition.annotation.perl +# ^^^^ variable.annotation.attribute.perl +# ^ punctuation.section.block.begin.perl +# ^ punctuation.section.block.end.perl + sub func : ($var, 5) ($) : ([0, 10]) {} +# ^^^^^^^^^ meta.function.perl - meta.function.parameters - meta.annotation +# ^^ meta.function.perl meta.annotation.perl - meta.function.parameters - meta.annotation.parameters +# ^^^^^^^^^ meta.function.perl meta.annotation.parameters.perl - meta.function.parameters +# ^ meta.function.perl - meta.function.parameters - meta.annotation - meta.block +# ^^^ meta.function.parameters.perl - meta.function.perl - meta.annotation +# ^ meta.function.perl - meta.function.parameters - meta.annotation - meta.block +# ^^ meta.function.perl meta.annotation.perl - meta.function.parameters - meta.annotation.parameters +# ^^^^^^^^^ meta.function.perl meta.annotation.parameters.perl - meta.function.parameters +# ^ meta.function.perl - meta.function.parameters - meta.annotation - meta.block +# ^^ +# ^ - meta.function +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^ entity.name.function.perl +# ^ punctuation.definition.annotation.perl +# ^ punctuation.section.parameters.begin.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.separator.sequence.perl +# ^ constant.numeric.integer.decimal.perl +# ^ punctuation.section.parameters.end.perl +# ^ punctuation.section.parameters.begin.perl +# ^ variable.parameter.perl +# ^ punctuation.section.parameters.end.perl +# ^ punctuation.definition.annotation.perl +# ^ punctuation.section.parameters.begin.perl +# ^ punctuation.section.brackets.begin.perl +# ^ constant.numeric.integer.decimal.perl +# ^ punctuation.separator.sequence.perl +# ^^ constant.numeric.integer.decimal.perl +# ^ punctuation.section.brackets.end.perl +# ^ punctuation.section.parameters.end.perl +# ^ punctuation.section.block.begin.perl +# ^ punctuation.section.block.end.perl + sub func : attr ($var, 5) ($) : attr ([0, 10]) {} +# ^^^^^^^^^ meta.function.perl - meta.function.parameters - meta.annotation +# ^^^^^^^ meta.function.perl meta.annotation.perl - meta.function.parameters - meta.annotation.parameters +# ^^^^^^^^^ meta.function.perl meta.annotation.parameters.perl - meta.function.parameters +# ^ meta.function.perl - meta.function.parameters - meta.annotation - meta.block +# ^^^ meta.function.parameters.perl - meta.function.perl - meta.annotation +# ^ meta.function.perl - meta.function.parameters - meta.annotation - meta.block +# ^^^^^^^ meta.function.perl meta.annotation.perl - meta.function.parameters - meta.annotation.parameters +# ^^^^^^^^^ meta.function.perl meta.annotation.parameters.perl - meta.function.parameters +# ^ meta.function.perl - meta.function.parameters - meta.annotation - meta.block +# ^^ +# ^ - meta.function +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^ entity.name.function.perl +# ^ punctuation.definition.annotation.perl +# ^^^^ variable.annotation.attribute.perl +# ^ punctuation.section.parameters.begin.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.separator.sequence.perl +# ^ constant.numeric.integer.decimal.perl +# ^ punctuation.section.parameters.end.perl +# ^ punctuation.section.parameters.begin.perl +# ^ variable.parameter.perl +# ^ punctuation.section.parameters.end.perl +# ^ punctuation.definition.annotation.perl +# ^^^^ variable.annotation.attribute.perl +# ^ punctuation.section.parameters.begin.perl +# ^ punctuation.section.brackets.begin.perl +# ^ constant.numeric.integer.decimal.perl +# ^ punctuation.separator.sequence.perl +# ^^ constant.numeric.integer.decimal.perl +# ^ punctuation.section.brackets.end.perl +# ^ punctuation.section.parameters.end.perl +# ^ punctuation.section.block.begin.perl +# ^ punctuation.section.block.end.perl + + sub func inv : attr inv ($var, 5) inv ($inv;%@$) inv : attr inv ([0, 10]) inv {} +# ^^^^^^^^^^^^^ meta.function.perl - meta.function.parameters - meta.annotation +# ^^^^^^^^^^^ meta.function.perl meta.annotation.perl - meta.function.parameters - meta.annotation.parameters +# ^^^^^^^^^ meta.function.perl meta.annotation.parameters.perl - meta.function.parameters +# ^^^^^ meta.function.perl - meta.function.parameters - meta.annotation - meta.block +# ^^^^^^^^^^ meta.function.parameters.perl - meta.function.perl - meta.annotation +# ^^^^^ meta.function.perl - meta.function.parameters - meta.annotation - meta.block +# ^^^^^^^^^^^ meta.function.perl meta.annotation.perl - meta.function.parameters - meta.annotation.parameters +# ^^^^^^^^^ meta.function.perl meta.annotation.parameters.perl - meta.function.parameters +# ^^^^^ meta.function.perl - meta.function.parameters - meta.annotation - meta.block +# ^^ +# ^ - meta.function +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^^^ entity.name.function.perl +# ^^^ invalid.illegal.identifier.perl +# ^ punctuation.definition.annotation.perl +# ^^^^ variable.annotation.attribute.perl +# ^^^ invalid.illegal.identifier.perl +# ^ punctuation.section.parameters.begin.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.separator.sequence.perl +# ^ constant.numeric.integer.decimal.perl +# ^ punctuation.section.parameters.end.perl +# ^^^ invalid.illegal.identifier.perl +# ^ punctuation.section.parameters.begin.perl +# ^ variable.parameter.perl +# ^^^ invalid.illegal.parameter.perl +# ^ punctuation.separator.sequence.perl +# ^^^ variable.parameter.perl +# ^ punctuation.section.parameters.end.perl +# ^^^ invalid.illegal.identifier.perl +# ^ punctuation.definition.annotation.perl +# ^^^^ variable.annotation.attribute.perl +# ^^^ invalid.illegal.identifier.perl +# ^ punctuation.section.parameters.begin.perl +# ^ punctuation.section.brackets.begin.perl +# ^ constant.numeric.integer.decimal.perl +# ^ punctuation.separator.sequence.perl +# ^^ constant.numeric.integer.decimal.perl +# ^ punctuation.section.brackets.end.perl +# ^ punctuation.section.parameters.end.perl +# ^^^ invalid.illegal.identifier.perl +# ^ punctuation.section.block.begin.perl +# ^ punctuation.section.block.end.perl + +###[ QUALIFIED SUBROUTINE DEFINITIONS ]######################################## + + sub ::func +# ^^^^ meta.function.perl - meta.path - meta.annotation +# ^^^^^^ meta.function.perl meta.path.perl - meta.annotation +# ^ meta.function.perl - meta.path - meta.annotation +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.function.perl +# ^ - entity - invalid + sub ::func # comment +# ^^^^ meta.function.perl - meta.path - meta.annotation +# ^^^^^^ meta.function.perl meta.path.perl - meta.annotation +# ^^^^^^^^^^ meta.function.perl - meta.path - meta.annotation +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.function.perl +# ^ - comment - entity - invalid +# ^^^^^^^^^ comment.line.number-sign.perl + sub ::func invalid +# ^^^^ meta.function.perl - meta.path - meta.annotation +# ^^^^^^ meta.function.perl meta.path.perl - meta.annotation +# ^^^^^^^^^^ meta.function.perl - meta.path - meta.annotation +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.function.perl +# ^ - entity - invalid +# ^^^^^^^ invalid.illegal.identifier.perl + sub ::func invalid # comment +# ^^^^ meta.function.perl - meta.path - meta.annotation +# ^^^^^^ meta.function.perl meta.path.perl - meta.annotation +# ^^^^^^^^^^^^^^^^^^ meta.function.perl - meta.path - meta.annotation +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.function.perl +# ^ - entity - invalid +# ^^^^^^^ invalid.illegal.identifier.perl +# ^ - comment - entity - invalid +# ^^^^^^^^^ comment.line.number-sign.perl + sub ::func; +# ^^^^ meta.function.perl - meta.path - meta.annotation +# ^^^^^^ meta.function.perl meta.path.perl - meta.annotation +# ^ - meta.function.perl - meta.path - meta.annotation +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.function.perl +# ^ punctuation.terminator.statement.perl + sub ::func invalid; +# ^^^^ meta.function.perl - meta.path - meta.annotation +# ^^^^^^ meta.function.perl meta.path.perl - meta.annotation +# ^^^^^^^^ meta.function.perl - meta.path - meta.annotation +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.function.perl +# ^^^^^^^ invalid.illegal.identifier.perl +# ^ punctuation.terminator.statement.perl + sub ::func:attr:attr2 invalid; +# ^^^^ meta.function.perl - meta.path - meta.annotation +# ^^^^^^ meta.function.perl meta.path.perl - meta.annotation +# ^^^^^^^^^^^^^^^^^^^ meta.function.perl meta.annotation.perl - meta.path +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.function.perl +# ^ punctuation.definition.annotation.perl +# ^^^^ variable.annotation.attribute.perl +# ^ punctuation.definition.annotation.perl +# ^^^^^ variable.annotation.attribute.perl +# ^^^^^^^ invalid.illegal.identifier.perl +# ^ punctuation.terminator.statement.perl + sub ::func:attr:attr2 invalid :attr3; +# ^^^^ meta.function.perl - meta.path - meta.annotation +# ^^^^^^ meta.function.perl meta.path.perl - meta.annotation +# ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.perl meta.annotation.perl - meta.path +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.function.perl +# ^ punctuation.definition.annotation.perl +# ^^^^ variable.annotation.attribute.perl +# ^ punctuation.definition.annotation.perl +# ^^^^^ variable.annotation.attribute.perl +# ^^^^^^^ invalid.illegal.identifier.perl +# ^ punctuation.definition.annotation.perl +# ^^^^^ variable.annotation.attribute.perl +# ^ punctuation.terminator.statement.perl + sub +# ^^^^ meta.function.perl - meta.path + if::func +# ^^^^^^^^ meta.function.perl meta.path.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.function.perl + sub NS::func +# ^^^^ meta.function.perl - meta.path +# ^^^^^^^^ meta.function.perl meta.path.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.function.perl + sub ::NS::func +# ^^^^ meta.function.perl - meta.path +# ^^^^^^^^^^ meta.function.perl meta.path.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.function.perl + sub B::NS::func +# ^^^^ meta.function.perl - meta.path +# ^^^^^^^^^^^ meta.function.perl meta.path.perl +# ^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.function.perl + sub B::NS::func invalid +# ^^^^ meta.function.perl - meta.path +# ^^^^^^^^^^^ meta.function.perl meta.path.perl +# ^^^^^^^^ meta.function.perl - meta.path +# ^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.function.perl +# ^^^^^^^ invalid.illegal.identifier.perl + sub B::NS ::invalid; +# ^^^^ meta.function.perl - meta.path +# ^^^^^ meta.function.perl meta.path.perl +# ^^^^^^^^^^ meta.function.perl - meta.path +# ^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^ entity.name.function.perl +# ^^^^^^^^^ invalid.illegal.identifier.perl +# ^ punctuation.terminator.statement.perl + sub B::NS:: invalid {}; +# ^^^^ meta.function.perl - meta.path +# ^^^^^^^ meta.function.perl meta.path.perl +# ^^^^^^^^^ meta.function.perl - meta.path +# ^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^^^^ invalid.illegal.identifier.perl # ^ punctuation.section.block.begin.perl +# ^ punctuation.section.block.end.perl +# ^ punctuation.terminator.statement.perl + sub B::NS::func # comment +# ^^^^ meta.function.perl - meta.path +# ^^^^^^^^^^^ meta.function.perl meta.path.perl +# ^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.function.perl +# ^^^^^^^^^ comment.line.number-sign.perl + sub B::NS::func() # comment +# ^^^^ meta.function.perl - meta.path +# ^^^^^^^^^^^ meta.function.perl meta.path.perl +# ^^ meta.function.parameters.perl +# ^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.function.perl +# ^ punctuation.section.parameters.begin.perl +# ^ punctuation.section.parameters.end.perl +# ^^^^^^^^^ comment.line.number-sign.perl + sub B::NS::func { +# ^^^^ meta.function.perl - meta.path +# ^^^^^^^^^^^ meta.function.perl meta.path.perl +# ^ meta.function.perl - meta.path - meta.block +# ^ +# ^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.function.perl +# ^ punctuation.section.block.begin.perl } -# <- meta.function.perl punctuation.section.block.end.perl -sub name ($arg, $arg) -{ -# <- meta.function.perl punctuation.section.block.begin.perl -} -# <- meta.function.perl punctuation.section.block.end.perl - -sub name invalid ($arg, $arg) { -# <- meta.function.perl keyword.control.sub.perl -#^^^^^^^^^^^^^^^^ meta.function.perl - meta.function.parameters.perl -# ^^^^^^^^^^^^ meta.function.parameters.perl - meta.function.perl -# ^^ meta.function.perl - meta.function.parameters.perl -#^^ keyword.control.sub.perl -# ^^^^ entity.name.function.perl -# ^^^^^^^ invalid.illegal.function-name.perl -# ^ punctuation.section.group.begin.perl -# ^^^^ variable.parameter.perl -# ^ punctuation.separator.sequence.perl -# ^^^^ variable.parameter.perl -# ^ punctuation.section.group.end.perl -# ^ punctuation.section.block.begin.perl -} -# <- meta.function.perl punctuation.section.block.end.perl -sub name invalid ($arg, $arg) -{ -# <- meta.function.perl punctuation.section.block.begin.perl -} -# <- meta.function.perl punctuation.section.block.end.perl -$var = sub { -# <- variable.other.readwrite.global.perl punctuation.definition.variable.perl -#^^^ variable.other.readwrite.global.perl -# ^ keyword.operator.assignment.perl -# ^^^^^^^ meta.function.perl -# ^^^ keyword.control.sub.perl - say "hello"; -# <- meta.function.perl -# ^^^ meta.function.perl support.function.perl -} -# <- meta.function.perl punctuation.section.block.end.perl -sub name ($) {} -# ^ punctuation.section.group.begin.perl - variable.parameter.perl -# ^^^ meta.function.parameters.perl -# ^ variable.parameter.perl -# ^ punctuation.section.group.end.perl - variable.parameter.perl +# <- punctuation.section.block.end.perl + sub +# ^^^^ meta.function.perl - meta.path + B::NS::func +#^ meta.function.perl - meta.path +# ^^^^^^^^^^^ meta.function.perl meta.path.perl +# ^^ meta.function.perl - meta.path +# ^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ entity.name.function.perl + ( +# ^ meta.function.parameters.perl punctuation.section.parameters.begin.perl + $arg,; +# ^ meta.function.parameters.perl variable.parameter.perl +# ^^^^ meta.function.parameters.perl invalid.illegal.parameter.perl +# ^ meta.function.parameters.perl punctuation.separator.sequence.perl + ) +# ^ meta.function.parameters.perl punctuation.section.parameters.end.perl + { +# ^ punctuation.section.block.begin.perl + } +# ^ punctuation.section.block.end.perl + CORE::sub ; +# ^^^^^^ - meta.function.perl +# ^^^^ meta.function.perl +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^ storage.type.function.perl keyword.declaration.function.perl +# ^ punctuation.terminator.statement.perl + core::sub; +# ^^^^^^^^^ - meta.function.perl +# ^^^ - keyword +# ^ punctuation.terminator.statement.perl + sub::name; +# ^^^^^^^^^ - meta.function.perl +# ^^^ - keyword +# ^ punctuation.terminator.statement.perl + +###[ CONTROL KEYWORDS ]####################################################### + + # conditional + + default -> word +# ^^^^^^^ keyword.control.conditional.default.perl + default->word +# ^^^^^^^ keyword.control.conditional.default.perl + default - word +# ^^^^^^^ keyword.control.conditional.default.perl + default-word +# ^^^^^^^ keyword.control.conditional.default.perl + default_word +# ^^^^^^^ - keyword.control + default:word +# ^^^^^^^ - keyword.control + default :: word +# ^^^^^^^ keyword.control.conditional.default.perl + CORE::default +# ^^^^^^^ keyword.control.conditional.default.perl + core::default +# ^^^^^^^ - keyword.control + default::word +# ^^^^^^^ - keyword.control + else -> word +# ^^^^ keyword.control.conditional.else.perl + else->word +# ^^^^ keyword.control.conditional.else.perl + else - word +# ^^^^ keyword.control.conditional.else.perl + else-word +# ^^^^ keyword.control.conditional.else.perl + else_word +# ^^^^ - keyword.control + else:word +# ^^^^ - keyword.control + else :: word +# ^^^^ keyword.control.conditional.else.perl + CORE::else +# ^^^^ keyword.control.conditional.else.perl + core::else +# ^^^^ - keyword.control + else::word +# ^^^^ - keyword.control + elsif +# ^^^^^ keyword.control.conditional.elseif.perl + elif +# ^^^^ - keyword.control + elseif +# ^^^^^^ - keyword.control + given +# ^^^^^ keyword.control.conditional.given.perl + if +# ^^ keyword.control.conditional.if.perl + unless +# ^^^^^^ keyword.control.conditional.unless.perl + when +# ^^^^ keyword.control.conditional.when.perl -### [ EXPRESSIONS ]########################################################### + # flow + + break +# ^^^^^ keyword.control.flow.break.perl + caller +# ^^^^^^ keyword.control.flow.caller.perl + continue +# ^^^^^^^^ keyword.control.flow.continue.perl + die +# ^^^ keyword.control.flow.die.perl + do +# ^^ keyword.control.flow.do.perl + dump +# ^^^^ keyword.control.flow.dump.perl + exit +# ^^^^ keyword.control.flow.exit.perl + goto +# ^^^^ keyword.control.flow.goto.perl + last +# ^^^^ keyword.control.flow.last.perl + next retry +# ^^^^ keyword.control.flow.next.perl +# ^^^^^ variable.label.perl + next eval {if $retry} +# ^^^^ keyword.control.flow.next.perl +# ^^^^ support.function.perl + next retry if $retry +# ^^^^ keyword.control.flow.next.perl +# ^^^^^ variable.label.perl +# ^^ keyword.control.conditional.if.perl +# ^^^^^^ variable.other.readwrite.perl + next if $retry +# ^^^^ keyword.control.flow.next.perl +# ^^ keyword.control.conditional.if.perl +# ^^^^^^ variable.other.readwrite.perl + redo LINE +# ^^^^ keyword.control.flow.redo.perl +# ^^^^ variable.label.perl + redo LINE if $retry +# ^^^^ keyword.control.flow.redo.perl +# ^^^^ variable.label.perl +# ^^ keyword.control.conditional.if.perl +# ^^^^^^ variable.other.readwrite.perl + redo unless $retry +# ^^^^ keyword.control.flow.redo.perl +# ^^^^^^ keyword.control.conditional.unless.perl +# ^^^^^^ variable.other.readwrite.perl + return +# ^^^^^^ keyword.control.flow.return.perl + wait +# ^^^^ keyword.control.flow.wait.perl + +###[ LABELS ]################################################################# retry: # ^^^^^ entity.name.label.perl @@ -1285,24 +4641,706 @@ ($arg, $arg) retry:die "bye!"; # ^^^^^ entity.name.label.perl # ^ punctuation.separator.perl -# ^^^ keyword.other.flow.perl -# ^^^^^^ string.quoted.double.perl +# ^^^ keyword.control.flow.die.perl +# ^^^^^^ meta.string.perl string.quoted.double.perl # ^ punctuation.terminator.statement.perl retry:: # ^^^^^^^ - entity.name.label.perl + + LINE: +# ^^^^ entity.name.label.perl +# ^ punctuation.separator.perl + + LINE:exit -1 +# ^^^^ entity.name.label.perl +# ^ punctuation.separator.perl +# ^^^^ keyword.control.flow.exit.perl +# ^ keyword.operator.arithmetic.perl +# ^ constant.numeric.integer.decimal.perl + +###[ UNQUALIFIED FUNCTION CALLS ]############################################# + + ## Encapsulating arguments into parentheses is optional, + ## if the expression is clearly identified as function-call. + + print +# ^^^^^ support.function.perl + print # comment +# ^^^^^ support.function.perl +# ^ - comment - support +# ^ comment.line.number-sign.perl + print; +# ^^^^^ support.function.perl +# ^ punctuation.terminator.statement.perl + &print +# ^ keyword.operator.dereference.perl +# ^^^^^ support.function.perl + print /pattern/g; +# ^^^^^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^ meta.string.perl string.regexp.perl source.regexp +# ^ punctuation.section.generic.end.perl +# ^ constant.language.flags.regexp.perl +# ^ punctuation.terminator.statement.perl + print "string"; +# ^^^^^ support.function.perl +# ^^^^^^^^ meta.string.perl string.quoted.double.perl +# ^ punctuation.terminator.statement.perl + print STDOUT; +# ^^^^^ support.function.perl +# ^^^^^^ constant.language.filehandle.perl +# ^ punctuation.terminator.statement.perl + print func; +# ^^^^^ support.function.perl +# ^^^^ variable.function.perl +# ^ punctuation.terminator.statement.perl + print x::func; +# ^^^^^ support.function.perl +# ^^^^^^^ meta.path.perl +# ^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl + print $$$$refrefref; +# ^^^^^ support.function.perl +# ^^^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^^^ variable.other.readwrite.perl + print + 1 +# ^^^^^ support.function.perl +# ^ keyword.operator.arithmetic.perl + print x 1 +# ^^^^^ support.function.perl +# ^ keyword.operator.arithmetic.perl + print and 1 +# ^^^^^ support.function.perl +# ^^^ keyword.operator.logical.perl + func +# ^^^^ variable.function.perl +# ^ - variable + func; +# ^^^^ variable.function.perl +# ^ punctuation.terminator.statement.perl + func # comment +# ^^^^ variable.function.perl +# ^^ - comment - variable +# ^ comment.line.number-sign.perl + func "string"; +# ^^^^ variable.function.perl +# ^^^^^^^^ meta.string.perl string.quoted.double.perl + func /pattern/g; +# ^^^^ variable.function.perl +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^ meta.string.perl string.regexp.perl source.regexp +# ^ punctuation.section.generic.end.perl +# ^ constant.language.flags.regexp.perl +# ^ punctuation.terminator.statement.perl + Func x::path +# ^^^^ variable.function.perl +# ^^^^^^^ meta.path.perl +# ^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl + _func $var; +# ^^^^^ variable.function.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.terminator.statement.perl + _Func STDOUT, $var; +# ^^^^^ variable.function.perl +# ^^^^^^ constant.language.filehandle.perl +# ^ punctuation.separator.sequence.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.terminator.statement.perl + func join('foo', $bar), $baz; +# ^^^^ variable.function.perl +# ^^^^ support.function.perl +# ^ punctuation.section.group.begin.perl +# ^^^^^ meta.string.perl string.quoted.single.perl +# ^ punctuation.separator.sequence.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.section.group.end.perl +# ^ punctuation.separator.sequence.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.terminator.statement.perl + func <<_EOD_, $var; +# ^^^^ variable.function.perl +# ^^^^^^^^^^^^^^^ meta.string.heredoc.perl +# ^^ keyword.operator.heredoc.perl +# ^^^^^ entity.name.tag.heredoc.plain.perl +# ^ punctuation.separator.sequence.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.terminator.statement.perl + foo bar baz +# <- meta.string.heredoc.perl string.unquoted.heredoc.perl +#^^^^^^^^^^^^^ meta.string.heredoc.perl string.unquoted.heredoc.perl +_EOD_ +#<- meta.string.heredoc.perl entity.name.tag.heredoc.plain.perl +#^^^^ meta.string.heredoc.perl entity.name.tag.heredoc.plain.perl + &func + 1 +# ^ keyword.operator.dereference.perl +# ^^^^ variable.function.perl +# ^ keyword.operator.arithmetic.perl + &func x 1 +# ^ keyword.operator.dereference.perl +# ^^^^ variable.function.perl +# ^ keyword.operator.arithmetic.perl + &func and 1 +# ^ keyword.operator.dereference.perl +# ^^^^ variable.function.perl +# ^^^ keyword.operator.logical.perl + no_func + 1 +# ^^^^^^^ - variable.function +# ^ keyword.operator.arithmetic.perl + no_func x 1 +# ^^^^^^^ - variable.function +# ^ keyword.operator.arithmetic.perl + no_func and 1 +# ^^^^^^^ - variable.function +# ^^^ keyword.operator.logical.perl + + ## To ensure the interpreter identifies a function correctly, + ## the arguments need to be encapsulated in parentheses. + + print(/pattern/g); +# ^^^^^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^ meta.string.perl string.regexp.perl source.regexp +# ^ punctuation.section.generic.end.perl +# ^ constant.language.flags.regexp.perl +# ^ punctuation.terminator.statement.perl + func(/pattern/g); +# ^^^^ variable.function.perl +# ^ punctuation.section.group.begin.perl +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^ meta.string.perl string.regexp.perl source.regexp +# ^ punctuation.section.generic.end.perl +# ^ constant.language.flags.regexp.perl +# ^ punctuation.section.group.end.perl +# ^ punctuation.terminator.statement.perl + _func($var); +# ^^^^^ variable.function.perl +# ^ punctuation.section.group.begin.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.section.group.end.perl +# ^ punctuation.terminator.statement.perl + + ## The function call argument list can contain arbitary arguments + ## after the content of the `_EOD_` HEREDOC. + + Func(<<_EOD_; +# ^^^^ variable.function.perl +# ^ punctuation.section.group.begin.perl +# ^^^^^^^^^ meta.string.heredoc.perl +# ^^ keyword.operator.heredoc.perl +# ^^^^^ entity.name.tag.heredoc.plain.perl +# ^ punctuation.terminator.statement.perl + foo bar baz +# <- meta.string.heredoc.perl string.unquoted.heredoc.perl +#^^^^^^^^^^^^^ meta.string.heredoc.perl string.unquoted.heredoc.perl +_EOD_ +#<- meta.string.heredoc.perl entity.name.tag.heredoc.plain.perl +#^^^^ meta.string.heredoc.perl entity.name.tag.heredoc.plain.perl +# ^ - meta.string.heredoc + , $var +# ^ punctuation.separator.sequence.perl +# ^^^^ variable.other.readwrite.perl +) +# <- punctuation.section.group.end.perl + + ## The function call argument list can end at the same line + ## while the content of the `_EOD_` HEREDOC starts at the next one. + + func(<<_EOD_, $var); +# ^^^^ variable.function.perl +# ^ punctuation.section.group.begin.perl +# ^^^^^^^^^ meta.string.heredoc.perl +# ^^ keyword.operator.heredoc.perl +# ^^^^^ entity.name.tag.heredoc.plain.perl +# ^ punctuation.separator.sequence.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.section.group.end.perl +# ^ punctuation.terminator.statement.perl + foo bar baz +# <- meta.string.heredoc.perl string.unquoted.heredoc.perl +#^^^^^^^^^^^^^ meta.string.heredoc.perl string.unquoted.heredoc.perl +_EOD_ +#<- meta.string.heredoc.perl entity.name.tag.heredoc.plain.perl +#^^^^ meta.string.heredoc.perl entity.name.tag.heredoc.plain.perl + + func() + 1 +# ^^^^ variable.function.perl +# ^ punctuation.section.group.begin.perl +# ^ punctuation.section.group.end.perl +# ^ keyword.operator.arithmetic.perl + &func() + 1 +# ^ keyword.operator.dereference.perl +# ^^^^ variable.function.perl +# ^ punctuation.section.group.begin.perl +# ^ punctuation.section.group.end.perl +# ^ keyword.operator.arithmetic.perl + +###[ QUALIFIED FUNCTION CALL ]################################################ + + ::print +# ^^^^^^^ meta.path.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^^ support.function.perl + &::print +# ^ - meta.path +# ^^^^^^^ meta.path.perl +# ^ keyword.operator.dereference.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^^ support.function.perl + ::print(/pattern/g); +# ^^^^^^^ meta.path.perl +# ^ - meta.path +# ^^ punctuation.accessor.double-colon.perl +# ^^^^^ support.function.perl +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^ meta.string.perl string.regexp.perl source.regexp +# ^ punctuation.section.generic.end.perl +# ^ constant.language.flags.regexp.perl +# ^ punctuation.terminator.statement.perl + ::func +# ^^^^^^ meta.path.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl + &::func +# ^^^^^^ meta.path.perl +# ^ keyword.operator.dereference.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl + ::func "string"; +# ^^^^^^ meta.path.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl +# ^^^^^^^^ meta.string.perl string.quoted.double.perl + ::func /pattern/g; +# ^^^^^^ meta.path.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl +# ^ punctuation.section.generic.begin.perl +# ^^^^^^^ meta.string.perl string.regexp.perl source.regexp +# ^ punctuation.section.generic.end.perl +# ^ constant.language.flags.regexp.perl +# ^ punctuation.terminator.statement.perl + ::Func x::path +# ^^^^^^ meta.path.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl +# ^^^^^^^ meta.path.perl +# ^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl + ::_func $var; +# ^^^^^^^ meta.path.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^^ variable.function.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.terminator.statement.perl + ::_Func STDOUT, $var; +# ^^^^^^^ meta.path.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^^ variable.function.perl +# ^^^^^^ constant.language.filehandle.perl +# ^ punctuation.separator.sequence.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.terminator.statement.perl + ::func + 1 +# ^^^^^^ meta.path.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl +# ^ keyword.operator.arithmetic.perl + ::func x 1 +# ^^^^^^ meta.path.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl +# ^ keyword.operator.arithmetic.perl + ::func and 1 +# ^^^^^^ meta.path.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl +# ^^^ keyword.operator.logical.perl + main::print +# ^^^^^^^^^^^ meta.path.perl +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^^ support.function.perl + &main::print +# ^^^^^^^^^^^ meta.path.perl +# ^ keyword.operator.dereference.perl +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^^ support.function.perl + If::func +# ^^^^^^^^ meta.path.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl + If::_Func +# ^^^^^^^^^ meta.path.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl + If::Func +# ^^^^^^^^ meta.path.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl + IF::func +# ^^^^^^^^ meta.path.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl + IF::_Func +# ^^^^^^^^^ meta.path.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl + IF::Func +# ^^^^^^^^ meta.path.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl + if::func +# ^^^^^^^^ meta.path.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl + if::_Func +# ^^^^^^^^^ meta.path.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl + if::Func +# ^^^^^^^^ meta.path.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl + ::if::func +# ^^^^^^^^^^ meta.path.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl + i::f::func +# ^^^^^^^^^^ meta.path.perl +# ^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl + &i::f::func +# ^^^^^^^^^^ meta.path.perl +# ^ keyword.operator.dereference.perl +# ^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl + +###[ METHOD CALLS ]########################################################### + + $obj = URI->new +# ^^^^ variable.other.readwrite.perl +# ^ keyword.operator.assignment.perl +# ^^^ variable.namespace.perl - constant - meta.path +# ^^ punctuation.accessor.arrow.perl +# ^^^ variable.function.member.perl + $obj = Class->new +# ^^^^ variable.other.readwrite.perl +# ^ keyword.operator.assignment.perl +# ^^^^^ variable.namespace.perl - meta.path +# ^^ punctuation.accessor.arrow.perl +# ^^^ variable.function.member.perl + $obj = Class::Scan->new +# ^ - meta.path +# ^^^^^^^^^^^ meta.path.perl +# ^ - meta.path +# ^^^^ variable.other.readwrite.perl +# ^ keyword.operator.assignment.perl +# ^^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.arrow.perl +# ^^^ variable.function.member.perl + $obj = Class::Scan->new # comment +# ^ - meta.path +# ^^^^^^^^^^^ meta.path.perl +# ^ - meta.path +# ^^^^ variable.other.readwrite.perl +# ^ keyword.operator.assignment.perl +# ^^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.arrow.perl +# ^^^ variable.function.member.perl +# ^^^^^^^^^ comment.line.number-sign.perl + $obj = Class::Scan->new(KEY => 'value') +# ^ - meta.path +# ^^^^^^^^^^^ meta.path.perl +# ^ - meta.path +# ^^^^ variable.other.readwrite.perl +# ^ keyword.operator.assignment.perl +# ^^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.arrow.perl +# ^^^ variable.function.member.perl +# ^ punctuation.section.group.begin.perl +# ^^^ constant.other.key.perl +# ^ - constant +# ^^ punctuation.separator.key-value.perl +# ^^^^^^^ meta.string.perl string.quoted.single.perl +# ^ punctuation.section.group.end.perl + $obj->method +# ^^^^ variable.other.readwrite.perl +# ^^ punctuation.accessor.arrow.perl +# ^^^^^^ variable.function.member.perl + $obj->method # comment +# ^^^^ variable.other.readwrite.perl +# ^^ punctuation.accessor.arrow.perl +# ^^^^^^ variable.function.member.perl +# ^^^^^^^^^ comment.line.number-sign.perl + $obj->method() # comment +# ^^^^ variable.other.readwrite.perl +# ^^ punctuation.accessor.arrow.perl +# ^^^^^^ variable.function.member.perl +# ^ punctuation.section.group.begin.perl +# ^ punctuation.section.group.end.perl +# ^^^^^^^^^ comment.line.number-sign.perl + $obj +# ^^^^ variable.other.readwrite.perl + -> +# ^^ punctuation.accessor.arrow.perl + method() # comment +# ^^^^^^ variable.function.member.perl +# ^ punctuation.section.group.begin.perl +# ^ punctuation.section.group.end.perl +# ^^^^^^^^^ comment.line.number-sign.perl + $obj->method(1, "str", $var) +# ^^^^ variable.other.readwrite.perl +# ^^ punctuation.accessor.arrow.perl +# ^^^^^^ variable.function.member.perl +# ^ punctuation.section.group.begin.perl +# ^ constant.numeric.integer.decimal.perl +# ^ punctuation.separator.sequence.perl +# ^^^^^ meta.string.perl string.quoted.double.perl +# ^ punctuation.separator.sequence.perl +# ^^^^ variable.other.readwrite.perl +# ^ punctuation.section.group.end.perl + # call method and access first item of the returned array reference + $obj->method->[0] +# ^^^^ variable.other.readwrite.perl +# ^^ punctuation.accessor.arrow.perl +# ^^^^^^ variable.function.member.perl +# ^^ punctuation.accessor.arrow.perl +# ^^^ meta.item-access.perl + # call method and access item 'key' of the returned hash reference + $obj->method->{key} +# ^^^^ variable.other.readwrite.perl +# ^^ punctuation.accessor.arrow.perl +# ^^^^^^ variable.function.member.perl +# ^^ punctuation.accessor.arrow.perl +# ^^^^^ meta.item-access.perl + # call method and execute the returned function + $obj->method->($arg1, "val") +# ^^^^ variable.other.readwrite.perl +# ^^ punctuation.accessor.arrow.perl +# ^^^^^^ variable.function.member.perl +# ^^ punctuation.accessor.arrow.perl +# ^ punctuation.section.group.begin.perl +# ^^^^^ variable.other.readwrite.perl +# ^ punctuation.separator.sequence.perl +# ^^^^^ meta.string.perl string.quoted.double.perl +# ^ punctuation.section.group.end.perl + # call method and add 1 to the returned number + $obj->method + 1 +# ^^^^ variable.other.readwrite.perl +# ^^ punctuation.accessor.arrow.perl +# ^^^^^^ variable.function.member.perl +# ^ keyword.operator.arithmetic.perl +# ^ constant.numeric.integer.decimal.perl + # call method and multiply 1 to the returned matrice + $obj->method x 1 +# ^^^^ variable.other.readwrite.perl +# ^^ punctuation.accessor.arrow.perl +# ^^^^^^ variable.function.member.perl +# ^ keyword.operator.arithmetic.perl +# ^ constant.numeric.integer.decimal.perl + # call method and associate returned bool with TRUE + $obj->method and 1 +# ^^^^ variable.other.readwrite.perl +# ^^ punctuation.accessor.arrow.perl +# ^^^^^^ variable.function.member.perl +# ^^^ keyword.operator.logical.perl +# ^ constant.numeric.integer.decimal.perl + # call method of an nested object + $obj->{bar}->method +# ^^^^ variable.other.readwrite.perl +# ^^ punctuation.accessor.arrow.perl +# ^^^^^ meta.item-access.perl +# ^^ punctuation.accessor.arrow.perl +# ^^^^^^ variable.function.member.perl + $obj->if::func +# ^^^^^^ - meta.path +# ^^^^^^^^ meta.path.perl +# ^ - meta.path +# ^^^^ variable.other.readwrite.perl +# ^^ punctuation.accessor.arrow.perl +# ^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^ variable.function.perl + +###[ CONDITIONAL EXPRESSIONS ]################################################ + + if ($flags & (SVf_POK|SVf_IOkK)) +# ^^ keyword.control.conditional.if.perl +# ^ punctuation.section.group.begin.perl +# ^^^^^^ variable.other.readwrite.perl +# ^ keyword.operator.bitwise.perl +# ^ punctuation.section.group.begin.perl +# ^^^^^^^ constant.other.perl +# ^ keyword.operator.bitwise.perl +# ^^^^^^^^ constant.other.perl +# ^^ punctuation.section.group.end.perl if(exists($curargs{$index})) -# ^^ keyword.control.conditional.perl +# ^^ keyword.control.conditional.if.perl # ^ punctuation.section.group.begin.perl +# ^^^^^^ support.function.perl # ^ punctuation.section.group.begin.perl +# ^^^^^^^^ variable.other.readwrite.perl # ^ punctuation.section.group.end.perl - function_call /pattern/g; -# ^^^^^^^^^^^^^ variable.function.perl -# ^ punctuation.section.generic.begin.perl -# ^^^^^^^ string.regexp.perl source.regexp -# ^ punctuation.section.generic.end.perl -# ^ constant.language.flags.regexp.perl -# ^ punctuation.terminator.statement.perl - _function_call $var; -# ^^^^^^^^^^^^^^ variable.function.perl -# ^^^^ variable.other.readwrite.global.perl -# ^ punctuation.terminator.statement.perl + if(exists $curargs{$index}) +# ^^ keyword.control.conditional.if.perl +# ^ punctuation.section.group.begin.perl +# ^^^^^^ support.function.perl +# ^^^^^^^^ variable.other.readwrite.perl +# ^ punctuation.section.group.end.perl + if(func $curargs{$index}) +# ^^ keyword.control.conditional.if.perl +# ^ punctuation.section.group.begin.perl +# ^^^^ variable.function.perl +# ^^^^^^^^ variable.other.readwrite.perl +# ^ punctuation.section.group.end.perl + if (&$coderef()) {&$coderef()} +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^ variable.other.readwrite.perl +# ^ punctuation.section.group.begin.perl +# ^ punctuation.section.group.end.perl +# ^ keyword.operator.dereference.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^^ variable.other.readwrite.perl +# ^ punctuation.section.group.begin.perl +# ^ punctuation.section.group.end.perl + if ($self->value <= $self->other); +# ^^^^^ variable.function.member.perl +# ^^ keyword.operator.comparison.perl +# ^^^^^^^^^^ - string +# ^^ punctuation.accessor.arrow.perl + if ($value <= $self->other); +# ^^ keyword.operator.comparison.perl +# ^^^^^^^^^^ - string +# ^^ punctuation.accessor.arrow.perl +# ^^^^^ variable.function.member.perl + + # HEREDOC can start within a normal code block + if ($var) { $text = <<_EOT_; } else { $text = "foo"} +# ^^^^^^^^^^^^^^^^^^^^ - meta.string.heredoc.perl +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.heredoc.perl +# ^^ keyword.operator.heredoc.perl +# ^^^^^ entity.name.tag.heredoc.plain.perl +# ^ punctuation.terminator.statement.perl +# ^ punctuation.section.block.end.perl +# ^^^^ keyword.control.conditional.else.perl +# ^ punctuation.section.block.begin.perl +# ^^^^^ variable.other.readwrite.perl +# ^ keyword.operator.assignment.perl +# ^^^^^ meta.string.perl string.quoted.double.perl +# ^ punctuation.section.block.end.perl +_EOT_ +# <- meta.string.heredoc.perl entity.name.tag.heredoc.plain.perl +#^^^^ meta.string.heredoc.perl entity.name.tag.heredoc.plain.perl + +# <- - meta.string.heredoc.perl + +###[ LOOP EXPRESSIONS ]####################################################### + + for ($i = 1; $i < 10; $i++) { +# ^^^ keyword.control.loop.for.perl +# ^ punctuation.section.group.begin.perl +# ^ punctuation.section.group.end.perl +# ^ punctuation.section.block.begin.perl + break; +# ^^^^^ keyword.control.flow.break.perl + } +# ^ punctuation.section.block.end.perl + + for my $i (0..9) { +# ^^^ keyword.control.loop.for.perl +# ^^ storage.type.variable.perl +# ^^ variable.other.readwrite.perl +# ^ punctuation.section.group.begin.perl +# ^ constant.numeric.integer.decimal.perl +# ^^ keyword.operator.range.perl +# ^ constant.numeric.integer.decimal.perl +# ^ punctuation.section.group.end.perl +# ^ punctuation.section.block.begin.perl + CORE::break; +# ^^^^ variable.namespace.perl +# ^^ punctuation.accessor.double-colon.perl +# ^^^^^ keyword.control.flow.break.perl + } +# ^ punctuation.section.block.end.perl + + foreach my $vsn_mk (, ) { +# ^^^^^^^ keyword.control.loop.foreach.perl +# ^^ storage.type.variable.perl +# ^ punctuation.definition.variable.perl +# ^^^^^^^ variable.other.readwrite.perl +# ^ punctuation.section.group.begin.perl +# ^ punctuation.definition.string.begin.perl +# ^^^^^^^^^^^^^^ meta.string.perl string.quoted.angle.perl +# ^ punctuation.definition.string.end.perl +# ^ punctuation.separator.sequence.perl +# ^ punctuation.definition.string.begin.perl +# ^^^^^^^^^^^^^ meta.string.perl string.quoted.angle.perl +# ^ punctuation.definition.string.end.perl +# ^ punctuation.section.group.end.perl +# ^ punctuation.section.block.begin.perl + } +# ^ punctuation.section.block.end.perl + + LINE: until (STDIN) { next LINE if /^#/; } continue { while ($foo) { redo LINE if /@#/; } } +# ^^^^ entity.name.label.perl +# ^^^^^ keyword.control.loop.until.perl +# ^^^^^ constant.language.filehandle.perl +# ^^^^ keyword.control.flow.next.perl +# ^^^^ variable.label.perl +# ^^ keyword.control.conditional.if.perl +# ^^^^^^^^ keyword.control.flow.continue.perl +# ^^^^^ keyword.control.loop.while.perl +# ^^^^ keyword.control.flow.redo.perl +# ^^^^ variable.label.perl +# ^^ keyword.control.conditional.if.perl + + LINE: while ($foo++ < 10 && $bar > 5) { next LINE if /^#/; redo LINE if $bar } +# ^^^^ entity.name.label.perl +# ^^^^^ keyword.control.loop.while.perl +# ^ punctuation.section.group.begin.perl +# ^^^^ variable.other.readwrite.perl +# ^^ keyword.operator.arithmetic.perl +# ^ keyword.operator.comparison.perl +# ^^^^^^^^^^^^^^ - string +# ^^ constant.numeric.integer.decimal.perl +# ^^ keyword.operator.logical.perl +# ^^^^ variable.other.readwrite.perl +# ^ keyword.operator.comparison.perl +# ^ constant.numeric.integer.decimal.perl +# ^ punctuation.section.group.end.perl +# ^^^^ keyword.control.flow.next.perl +# ^^^^ variable.label.perl +# ^^ keyword.control.conditional.if.perl +# ^^^^ keyword.control.flow.redo.perl +# ^^^^ variable.label.perl +# ^^ keyword.control.conditional.if.perl diff --git a/Python/Python.sublime-syntax b/Python/Python.sublime-syntax index ef5c74e1b4..2acd86d835 100644 --- a/Python/Python.sublime-syntax +++ b/Python/Python.sublime-syntax @@ -21,7 +21,10 @@ file_extensions: - gyp - gypi - Snakefile + - vpy - wscript + - bazel + - bzl first_line_match: ^#!\s*/.*\bpython(\d(\.\d)?)?\b scope: source.python @@ -30,8 +33,9 @@ variables: identifier_continue: '[[:alnum:]_]' identifier: '\b[[:alpha:]_]{{identifier_continue}}*\b' identifier_constant: '\b(?:[\p{Lu}_][\p{Lu}_\d]*)?[\p{Lu}]{2,}[\p{Lu}_\d]*\b' # require 2 consecutive upper-case letters - digitpart: (?:\d(?:_?\d)*) - path: '({{identifier}} *\. *)*{{identifier}}' + digits: (?:\d+(?:_\d+)*) + exponent: (?:[eE][-+]?{{digits}}) + path: '({{identifier}}[ ]*\.[ ]*)*{{identifier}}' sql_indicator: \s*(?:SELECT|INSERT|UPDATE|DELETE|CREATE|REPLACE|ALTER|WITH)\b illegal_names: (?:and|as|assert|break|class|continue|def|del|elif|else|except|finally|for|from|global|if|import|in|is|lambda|not|or|pass|raise|return|try|while|with|yield) format_spec: |- @@ -46,6 +50,19 @@ variables: [bcdeEfFgGnosxX%]? # type ) strftime_spec: '(?:%(?:[aAwdbBGmyYHIpMSfzZjuUVWcxX%]|-[dmHIMSj]))' + # This can be used in look-aheads to parse simple expressions. + # Can't be recursive, because sregex doesn't support that, + # so we're skipping parentheses. + # Can't parse multiple lines as well, for obvious reasons + simple_expression: |- + (?x: + \s+ # whitespace + | [urfb]*"(?:\\.|[^"])*" # strings + | [urfb]*'(?:\\.|[^'])*' # ^ + | [\d.ej]+ # numerics + | [+*/%@-] | // | and | or # operators + | {{path}} # a path + )* contexts: @@ -62,7 +79,7 @@ contexts: - include: assignments - match: ; scope: punctuation.terminator.statement.python - - include: line-expressions + - include: expression-as-a-statement line-statements: - include: imports @@ -77,10 +94,10 @@ contexts: set: - meta_scope: meta.statement.raise.python - include: line-continuation-or-pop - - include: expressions - - include: expressions + - include: expression-in-a-statement + - include: expression-in-a-statement - match: \b(assert)\b - scope: keyword.other.assert.python + scope: keyword.control.flow.assert.python - match: \b(del)\b scope: keyword.other.del.python - match: \b(print)\b(?! *([,.()\]}])) @@ -95,8 +112,6 @@ contexts: scope: keyword.control.flow.continue.python - match: \b(pass)\b scope: keyword.control.flow.pass.python - - match: ':' - scope: punctuation.separator.annotation.variable.python imports: - match: \b(import)\b @@ -189,20 +204,20 @@ contexts: - match: \b(async +)?(for)\b captures: 1: storage.modifier.async.python - 2: keyword.control.flow.for.python + 2: keyword.control.loop.for.python push: - - meta_scope: meta.statement.for.python + - meta_scope: meta.statement.loop.for.python - include: line-continuation-or-pop - - match: \b(in)\b - scope: keyword.control.flow.for.in.python + - match: \bin\b + scope: keyword.control.loop.for.in.python set: - - meta_scope: meta.statement.for.python + - meta_content_scope: meta.statement.loop.for.python - include: line-continuation-or-pop - - match: ':' - scope: punctuation.section.block.for.python + - match: ':(?!=)' + scope: meta.statement.loop.for.python punctuation.section.block.loop.for.python pop: true - - include: expressions - - match: ':' + - include: expression-in-a-statement + - match: ':(?!=)' scope: invalid.illegal.missing-in.python pop: true - include: target-list @@ -213,67 +228,67 @@ contexts: 2: keyword.control.flow.with.python push: with-body # except ... as ...: - - match: \b(except)\b - scope: keyword.control.flow.except.python + - match: \bexcept\b + scope: keyword.control.exception.catch.python push: - - meta_scope: meta.statement.except.python + - meta_scope: meta.statement.exception.catch.python - include: line-continuation-or-pop - - match: ':' - scope: punctuation.section.block.except.python + - match: ':(?!=)' + scope: punctuation.section.block.exception.catch.python pop: true - - match: '\b(as)\b' - scope: keyword.control.flow.as.python + - match: '\bas\b' + scope: keyword.control.exception.catch.as.python set: - - meta_content_scope: meta.statement.except.python + - meta_content_scope: meta.statement.exception.catch.python - include: line-continuation-or-pop - match: ':' - scope: meta.statement.except.python punctuation.section.block.except.python + scope: meta.statement.exception.catch.python punctuation.section.block.exception.catch.python pop: true - include: name - include: target-list - match: \bif\b - scope: keyword.control.flow.conditional.python + scope: keyword.control.conditional.if.python push: - - meta_scope: meta.statement.if.python + - meta_scope: meta.statement.conditional.if.python - include: line-continuation-or-pop - - match: ':' - scope: punctuation.section.block.conditional.python + - match: ':(?!=)' + scope: punctuation.section.block.conditional.if.python pop: true - - include: expressions + - include: expression-in-a-statement - match: \bwhile\b - scope: keyword.control.flow.while.python + scope: keyword.control.loop.while.python push: - - meta_scope: meta.statement.while.python + - meta_scope: meta.statement.loop.while.python - include: line-continuation-or-pop - - match: ':' - scope: punctuation.section.block.while.python + - match: ':(?!=)' + scope: punctuation.section.block.loop.while.python pop: true - - include: expressions + - include: expression-in-a-statement - match: \b(else)\b(?:\s*(:))? - scope: meta.statement.conditional.python + scope: meta.statement.conditional.else.python captures: - 1: keyword.control.flow.conditional.python - 2: punctuation.section.block.python + 1: keyword.control.conditional.else.python + 2: punctuation.section.block.conditional.else.python - match: \b(try)\b(?:\s*(:))? - scope: meta.statement.try.python + scope: meta.statement.exception.try.python captures: - 1: keyword.control.flow.try.python - 2: punctuation.section.block.try.python + 1: keyword.control.exception.try.python + 2: punctuation.section.block.exception.try.python - match: \b(finally)\b(?:\s*(:))? - scope: meta.statement.finally.python + scope: meta.statement.exception.finally.python captures: - 1: keyword.control.flow.finally.python - 2: punctuation.section.block.finally.python + 1: keyword.control.exception.finally.python + 2: punctuation.section.block.exception.finally.python - match: \belif\b - scope: keyword.control.flow.conditional.python + scope: keyword.control.conditional.elseif.python push: - - meta_scope: meta.statement.conditional.python - - match: ':' - scope: punctuation.section.block.python + - meta_scope: meta.statement.conditional.elseif.python + - match: ':(?!=)' + scope: punctuation.section.block.conditional.elseif.python pop: true - match: $\n? pop: true - - include: line-expressions + - include: expression-in-a-statement with-body: - meta_scope: meta.statement.with.python @@ -281,12 +296,12 @@ contexts: - match: \b(as)\b scope: keyword.control.flow.with.as.python set: with-as - - match: ':' + - match: ':(?!=)' scope: punctuation.section.block.with.python pop: true - match: ',' scope: punctuation.separator.with-resources.python - - include: expressions + - include: expression-in-a-statement with-as: - meta_scope: meta.statement.with.python @@ -314,6 +329,9 @@ contexts: - include: strings - include: function-calls - include: item-access + - include: lists + - include: dictionaries-and-sets + - include: tuples - include: groups - match: \) scope: invalid.illegal.stray.brace.round.python @@ -321,20 +339,26 @@ contexts: scope: invalid.illegal.stray.brace.square.python - match: \} scope: invalid.illegal.stray.brace.curly.python - - include: lists - - include: dictionaries-and-sets - include: line-continuation - line-expressions: # Always include this last! + # Always include these last and only one at a time! + expression-as-a-statement: - include: expressions-common - include: qualified-name - expressions: # Always include this last! - # Differs from the line scope in that invalid-name matches will pop the current context - # and matches accessors continued on a different line + expression-in-a-statement: + # Differs from expression-as-a-statement in that: + # - invalid-name matches will pop the current context + # - assignment expressions - include: expressions-common - include: illegal-names-pop - include: qualified-name + - include: assignment-expression + + expression-in-a-group: # Always include this last! + # Differs from expression-in-a-statement in that: + # - accessor matching continues into the next line + - include: expression-in-a-statement - match: '(\.) *(?={{identifier}})' captures: 1: punctuation.accessor.dot.python @@ -366,9 +390,10 @@ contexts: - match: \] scope: meta.item-access.python punctuation.section.brackets.end.python pop: true + - include: illegal-assignment-expression - match: ':' scope: punctuation.separator.slice.python - - include: expressions + - include: expression-in-a-group # indirect function call following attribute access - include: function-calls # arbitrary attribute access @@ -403,74 +428,68 @@ contexts: # https://docs.python.org/3/reference/lexical_analysis.html#numeric-literals # hexadecimal - match: \b(?i)(0x)\h*(L) # py2 - scope: constant.numeric.integer.long.hexadecimal.python + scope: constant.numeric.integer.hexadecimal.python captures: - 1: punctuation.definition.numeric.hexadecimal.python - 2: storage.type.numeric.long.python + 1: punctuation.definition.numeric.base.python + 2: storage.type.numeric.python - match: \b(?i)(0x)(_?\h)+ scope: constant.numeric.integer.hexadecimal.python captures: - 1: punctuation.definition.numeric.hexadecimal.python + 1: punctuation.definition.numeric.base.python # octal - match: \b(?i)(0o?)(?=o|[0-7])[0-7]*(L) # py2 - scope: constant.numeric.integer.long.octal.python + scope: constant.numeric.integer.octal.python captures: - 1: punctuation.definition.integer.octal.python - 2: storage.type.numeric.long.python + 1: punctuation.definition.numeric.base.python + 2: storage.type.numeric.python - match: \b(?i)(0)[0-7]+ # py2 scope: constant.numeric.integer.octal.python captures: - 1: punctuation.definition.numeric.octal.python + 1: punctuation.definition.numeric.base.python - match: \b(?i)(0o)(_?[0-7])+ scope: constant.numeric.integer.octal.python captures: - 1: punctuation.definition.numeric.octal.python + 1: punctuation.definition.numeric.base.python # binary - match: \b(?i)(0b)[01]*(L) # py2 - scope: constant.numeric.integer.long.binary.python + scope: constant.numeric.integer.binary.python captures: - 1: punctuation.definition.numeric.binary.python - 2: storage.type.numeric.long.python + 1: punctuation.definition.numeric.base.python + 2: storage.type.numeric.python - match: \b(?i)(0b)(_?[01])* scope: constant.numeric.integer.binary.python captures: - 1: punctuation.definition.numeric.binary.python + 1: punctuation.definition.numeric.base.python # complex - - match: (?i){{digitpart}}?(\.){{digitpart}}(?:e[\-\+]?{{digitpart}})?(j) # mandatory fraction - scope: constant.numeric.complex.python - captures: - 1: punctuation.separator.decimal.python - 2: storage.type.numeric.complex.python - - match: \b(?i)(?:{{digitpart}}(?:(\.){{digitpart}}?)?|(\.){{digitpart}})(?:e[\-\+]?{{digitpart}})(j) # mandatory exponent - scope: constant.numeric.complex.python + - match: |- + (?x: + # 1.j, 1.1j, 1.1e1j, 1.1e-1j, 1.e1j, 1.e-1 | 1e1j, 1e-1j + \b{{digits}} (\.)? {{digits}}? {{exponent}}? + # .1j, .1e1j, .1e-1j + | (\.) {{digits}} {{exponent}}? + )([jJ]) + scope: constant.numeric.imaginary.decimal.python captures: 1: punctuation.separator.decimal.python 2: punctuation.separator.decimal.python - 3: storage.type.numeric.complex.python - - match: (?i){{digitpart}}(\.)?(j) # mandatory digitpart - scope: constant.numeric.complex.python - captures: - 1: punctuation.separator.decimal.python - 2: storage.type.numeric.complex.python + 3: storage.type.numeric.python # floating point - - match: (?i){{digitpart}}?(\.){{digitpart}}(?:e[\-\+]?{{digitpart}})? # mandatory fraction - scope: constant.numeric.float.python - captures: - 1: punctuation.separator.decimal.python - - match: \b(?i)(?:{{digitpart}}(?:(\.){{digitpart}}?)?|(\.){{digitpart}})(?:e[\-\+]?{{digitpart}}) # mandatory exponent - scope: constant.numeric.float.python + - match: |- + (?x: + # 1., 1.1, 1.1e1, 1.1e-1, 1.e1, 1.e-1 | 1e1, 1e-1 + \b{{digits}} (?: (\.) {{digits}}? {{exponent}}? | {{exponent}} ) + # .1, .1e1, .1e-1 + | (\.) {{digits}} {{exponent}}? + ) + scope: constant.numeric.float.decimal.python captures: 1: punctuation.separator.decimal.python 2: punctuation.separator.decimal.python - - match: (?i){{digitpart}}(\.) # mandatory digitpart - scope: constant.numeric.float.python - captures: - 1: punctuation.separator.decimal.python # integer - match: \b(?i)(?:[1-9]\d*|0)(L)\b # py2 - scope: constant.numeric.integer.long.decimal.python + scope: constant.numeric.integer.decimal.python captures: - 1: storage.type.numeric.long.python + 1: storage.type.numeric.python - match: \b(?i)([1-9][\d_]*|0)\b scope: constant.numeric.integer.decimal.python @@ -493,7 +512,18 @@ contexts: 1: keyword.control.flow.yield.python 2: keyword.control.flow.yield-from.python + assignment-expression: + - match: := + scope: keyword.operator.assignment.inline.python + + illegal-assignment-expression: + - match: := + scope: invalid.illegal.not-allowed-here.python + assignments: + - include: illegal-assignment-expression + - match: ':' + scope: punctuation.separator.annotation.variable.python - match: \+=|-=|\*=|/=|//=|%=|@=|&=|\|=|\^=|>>=|<<=|\*\*= scope: keyword.operator.assignment.augmented.python - match: '=(?!=)' @@ -530,7 +560,7 @@ contexts: classes: - match: '^\s*(class)\b' captures: - 1: storage.type.class.python + 1: storage.type.class.python keyword.declaration.class.python push: - meta_scope: meta.class.python - include: line-continuation-or-pop @@ -574,13 +604,13 @@ contexts: 1: punctuation.accessor.dot.python - match: '' pop: true - - include: expressions + - include: expression-in-a-group functions: - match: '^\s*(?:(async)\s+)?(def)\b' captures: 1: storage.modifier.async.python - 2: storage.type.function.python + 2: storage.type.function.python keyword.declaration.function.python push: - meta_scope: meta.function.python - include: line-continuation-or-pop @@ -608,6 +638,13 @@ contexts: - match: ',' scope: punctuation.separator.parameters.python push: allow-unpack-operators + - match: / + scope: storage.modifier.positional-args-only.python + push: + - match: (?=[,)]) + pop: true + - match: \S + scope: invalid.illegal.expected-comma.python - match: '(?==)' set: - match: '=' @@ -616,7 +653,8 @@ contexts: - meta_scope: meta.function.parameters.default-value.python - match: '(?=[,)])' set: [function-parameters, allow-unpack-operators] - - include: expressions + - include: illegal-assignment-expression + - include: expression-in-a-group - match: '(?=:)' set: - match: ':' @@ -625,7 +663,8 @@ contexts: - meta_scope: meta.function.parameters.annotation.python - match: '(?=[,)=])' set: function-parameters - - include: expressions + - include: illegal-assignment-expression + - include: expression-in-a-group - include: function-parameters-tuple - include: illegal-names - match: '{{identifier}}' @@ -670,10 +709,11 @@ contexts: - meta_content_scope: meta.function.annotation.return.python - match: -> scope: punctuation.separator.annotation.return.python + - include: illegal-assignment-expression - match: '(?=:)' set: function-after-parameters - include: line-continuation-or-pop - - include: expressions + - include: expression-in-a-statement - match: ':' scope: meta.function.python punctuation.section.function.begin.python pop: true @@ -769,7 +809,7 @@ contexts: pop: true - match: ':' scope: punctuation.separator.slice.python - - include: expressions + - include: expression-in-a-group function-calls: - match: '(?=(\.\s*)?{{path}}\s*\()' @@ -811,7 +851,7 @@ contexts: scope: punctuation.separator.arguments.python push: allow-unpack-operators - include: inline-for - - include: expressions + - include: expression-in-a-group keyword-arguments: - match: '(?={{identifier}}\s*=(?!=))' @@ -820,16 +860,17 @@ contexts: - match: '=' scope: keyword.operator.assignment.python set: - - match: (?=\s*[,):]) + - include: illegal-assignment-expression + - match: (?=[,):]) pop: true - - include: expressions + - include: expression-in-a-group - include: illegal-names - match: '{{identifier}}' scope: variable.parameter.python lambda: - match: \b(lambda)(?=\s|:|$) - scope: storage.type.function.inline.python + scope: storage.type.function.inline.python keyword.declaration.function.inline.python push: [lambda-parameters, allow-unpack-operators] lambda-parameters: @@ -838,7 +879,19 @@ contexts: - include: line-continuation-or-pop - match: '\:' scope: punctuation.section.function.begin.python - pop: true + set: + # clear meta_scope + - match: '' + set: + - meta_scope: meta.function.inline.body.python + - include: illegal-assignment-expression + # We don't know whether we are within a grouped + # or line-statement context at this point. + # If we're in a group, the underlying context will take over + # at the end of the line. + - match: (?=[,):])|$ + pop: true + - include: expression-in-a-statement - match: ',' scope: punctuation.separator.parameters.python push: allow-unpack-operators @@ -861,48 +914,172 @@ contexts: - match: ',' scope: punctuation.separator.tuple.python - include: inline-for - - include: expressions + - include: expression-in-a-group + + tuples: + # We don't know for certain, whether a parenthesized expression is a tuple, + # so try looking ahead. + - match: (\()\s*(\)) + scope: meta.sequence.tuple.empty.python + captures: + 1: punctuation.section.sequence.begin.python + 2: punctuation.section.sequence.end.python + push: after-expression + - match: \((?={{simple_expression}},|\s*\*{{path}}) + scope: punctuation.section.sequence.begin.python + push: inside-tuple + # TODO generator + # - match: \((?:{{simple_expression}}for) + + inside-tuple: + - meta_scope: meta.sequence.tuple.python + - match: \) + scope: punctuation.section.sequence.end.python + set: after-expression + - match: ',' + scope: punctuation.separator.sequence.python + push: allow-unpack-operators + - include: inline-for + - include: expression-in-a-group lists: - - match: '(\[)(\s*(\]))\b' + - match: (\[)\s*(\]) + scope: meta.sequence.list.empty.python captures: - 1: punctuation.section.list.begin.python - 2: meta.empty-list.python - 3: punctuation.section.list.end.python + 1: punctuation.section.sequence.begin.python + 2: punctuation.section.sequence.end.python + push: after-expression - match: \[ - scope: punctuation.section.list.begin.python - push: - - meta_scope: meta.structure.list.python - - match: \] - scope: punctuation.section.list.end.python - set: after-expression - - match: ',' - scope: punctuation.separator.list.python - push: allow-unpack-operators - - include: inline-for - - include: expressions + scope: punctuation.section.sequence.begin.python + push: [inside-list, allow-unpack-operators] + + inside-list: + - meta_scope: meta.sequence.list.python + - match: \] + scope: punctuation.section.sequence.end.python + set: after-expression + - match: ',' + scope: punctuation.separator.sequence.python + push: allow-unpack-operators + - include: inline-for + - include: expression-in-a-group dictionaries-and-sets: - - match: '(\{)(\s*(\}))' - scope: meta.structure.dictionary.python - captures: - 1: punctuation.section.dictionary.begin.python - 2: meta.empty-dictionary.python - 3: punctuation.section.dictionary.end.python + # Dictionaries and set literals use the same punctuation, + # so we try looking ahead to determine whether we have a dict or a set. + - match: '(\{)\s*(\})' + scope: meta.mapping.empty.python + captures: + 1: punctuation.section.mapping.begin.python + 2: punctuation.section.mapping.end.python + push: after-expression + - match: \{(?={{simple_expression}}:|\s*\*\*) + scope: punctuation.section.mapping.begin.python + push: inside-dictionary + - match: \{(?={{simple_expression}}[,}]|\s*\*) + scope: punctuation.section.set.begin.python + push: inside-set + # If the expression is "more complex" or on the next line, + # fall back to default and determine later. - match: \{ - scope: punctuation.section.dictionary-or-set.begin.python + scope: punctuation.section.mapping-or-set.begin.python push: - - meta_scope: meta.structure.dictionary-or-set.python + - meta_scope: meta.mapping-or-set.python - match: \} - scope: punctuation.section.dictionary-or-set.end.python + scope: punctuation.section.mapping-or-set.end.python set: after-expression + - match: (?={{simple_expression}}:|\s*\*\*) + set: inside-dictionary + - match: (?={{simple_expression}}[,}]|\s*\*) + set: inside-set - match: ',' - scope: punctuation.separator.dictionary-or-set.python - push: allow-unpack-operators + scope: punctuation.separator.set.python + set: inside-set + - include: illegal-assignment-expression - match: ':' - scope: punctuation.separator.key-value.python + scope: punctuation.separator.mapping.key-value.python + set: inside-directory-value + - include: inline-for + - include: expression-in-a-group + + inside-dictionary: + - meta_scope: meta.mapping.python + - match: \} + scope: punctuation.section.mapping.end.python + set: after-expression + - include: illegal-assignment-expression + - match: ':' + scope: punctuation.separator.mapping.key-value.python + set: inside-directory-value + - match: ',' + scope: invalid.illegal.expected-colon.python + - match: \*\* + scope: keyword.operator.unpacking.mapping.python + push: + - match: (?=\}) + pop: true + - match: ',' + scope: punctuation.separator.mapping.python + pop: true + - include: expression-in-a-group + - include: comments + - match: (?=\S) + push: + - clear_scopes: 1 + - meta_scope: meta.mapping.key.python + - match: \s*(?=\}|,|:) + pop: true + - include: expression-in-a-group + + inside-directory-value: + - meta_content_scope: meta.mapping.python + - match: \} + scope: punctuation.section.mapping.end.python + set: after-expression + - match: (?=,) + set: + # clear meta scope from this match, because 'inside-directory' has it in meta_scope + - match: ',' + scope: punctuation.separator.mapping.python + set: inside-dictionary + - match: (?=for\b) + push: + - match: (?=\}) + pop: true + - match: ',' + scope: invalid.illegal.unexpected-comma.python - include: inline-for - - include: expressions + - include: expression-in-a-group + - include: comments + - match: (?=\S) + push: + - clear_scopes: 1 + - meta_content_scope: meta.mapping.value.python + - match: (?=\s*(\}|,|for\b)) + pop: true + - include: expression-in-a-group + + inside-set: + - meta_scope: meta.set.python + - match: \} + scope: punctuation.section.set.end.python + set: after-expression + - include: illegal-assignment-expression + - match: ':' + scope: invalid.illegal.colon-inside-set.python + - match: ',' + scope: punctuation.separator.set.python + - match: \* + scope: keyword.operator.unpacking.sequence.python + push: + - match: (?=\}) + pop: true + - match: ',' + scope: punctuation.separator.set.python + pop: true + - include: expression-in-a-group + - include: inline-for + - include: expression-in-a-group builtin-exceptions: - match: |- @@ -1158,7 +1335,7 @@ contexts: pop: true escaped-char: - - match: '(\\x\h{2})|(\\[0-7]{3})|(\\[\\"''abfnrtv])' + - match: '(\\x\h{2})|(\\[0-7]{1,3})|(\\[\\"''abfnrtv])' captures: 1: constant.character.escape.hex.python 2: constant.character.escape.octal.python @@ -1173,6 +1350,14 @@ contexts: 2: constant.character.escape.unicode.32-bit-hex.python 3: constant.character.escape.unicode.name.python + escaped-fstring-escape: + # special-case the '\{{' sequence because it has higher priority than the deprecated '\{' + - match: (\\)(\{\{|\}\}) + scope: constant.character.escape.backslash.regexp + captures: + 1: invalid.deprecated.character.escape.python + 2: constant.character.escape.python + line-continuation-inside-string: - match: (\\)$\n? captures: @@ -1181,6 +1366,10 @@ contexts: scope: invalid.illegal.unclosed-string.python set: after-expression + line-continuation-inside-block-string: + - match: \\$ + scope: punctuation.separator.continuation.line.python + constant-placeholder: - match: |- # printf style (?x) @@ -1250,8 +1439,13 @@ contexts: - match: \} scope: invalid.illegal.stray-brace.python - f-string-content-reset: + f-string-content-with-regex: # Same as f-string-content, but will reset the entire scope stack + # and has an additional match. + - match: \\(\{\{|\}\}) + scope: constant.character.escape.backslash.regexp + captures: + 1: constant.character.escape.python - match: \{\{|\}\} scope: constant.character.escape.python - match: \{\s*\} @@ -1274,6 +1468,8 @@ contexts: pop: true - match: '![ars]' scope: storage.modifier.conversion.python + - match: = + scope: storage.modifier.debug.python - match: ':' push: - meta_scope: meta.format-spec.python constant.other.format-spec.python @@ -1286,12 +1482,12 @@ contexts: - match: '' push: - meta_content_scope: source.python.embedded - - match: (?=![^=]|:|\}) + - match: (?==?(![^=]|:|\})) pop: true - match: \\ scope: invalid.illegal.backslash-in-fstring.python - include: inline-for - - include: expressions + - include: expression-in-a-group f-string-replacement-reset: # Same as f-string-replacement, but with clear_scopes: true @@ -1322,7 +1518,7 @@ contexts: - match: \\ scope: invalid.illegal.backslash-in-fstring.python - include: inline-for - - include: expressions + - include: expression-in-a-group string-quoted-double-block: # Triple-quoted capital R raw string, unicode or not, no syntax embedding @@ -1417,10 +1613,9 @@ contexts: with_prototype: - match: '(?=""")' pop: true - - include: line-continuation-inside-string - - include: f-string-content-reset + - include: f-string-content-with-regex # Triple-quoted f-string - - match: ((?i)f|f)(""") + - match: ([fF])(""") captures: 1: storage.type.string.python 2: meta.string.interpolated.python string.quoted.double.block.python punctuation.definition.string.begin.python @@ -1429,6 +1624,8 @@ contexts: - match: '"""' scope: punctuation.definition.string.begin.python set: after-expression + - include: line-continuation-inside-block-string + - include: escaped-fstring-escape - include: escaped-unicode-char - include: escaped-char - include: f-string-content @@ -1450,6 +1647,7 @@ contexts: with_prototype: - match: '(?=""")' pop: true + - include: line-continuation-inside-block-string - include: escaped-unicode-char - include: escaped-char - include: constant-placeholder @@ -1459,6 +1657,7 @@ contexts: - match: '"""' scope: punctuation.definition.string.end.python set: after-expression + - include: line-continuation-inside-block-string - include: escaped-unicode-char - include: escaped-char - include: constant-placeholder @@ -1472,6 +1671,7 @@ contexts: - match: '"""' scope: punctuation.definition.string.end.python set: after-expression + - include: line-continuation-inside-block-string - include: escaped-char - include: constant-placeholder @@ -1576,9 +1776,9 @@ contexts: - match: '(?="|\n)' pop: true - include: line-continuation-inside-string - - include: f-string-content-reset + - include: f-string-content-with-regex # Single-line f-string - - match: ((?i)f|f)(") + - match: ([fF])(") captures: 1: storage.type.string.python 2: meta.string.interpolated.python string.quoted.double.python punctuation.definition.string.begin.python @@ -1587,6 +1787,7 @@ contexts: - match: '"' scope: punctuation.definition.string.end.python set: after-expression + - include: escaped-fstring-escape - include: escaped-unicode-char - include: escaped-char - include: line-continuation-inside-string @@ -1732,8 +1933,7 @@ contexts: with_prototype: - match: (?=''') pop: true - - include: line-continuation-inside-string - - include: f-string-content-reset + - include: f-string-content-with-regex # Triple-quoted f-string - match: ([fF])(''') captures: @@ -1744,6 +1944,8 @@ contexts: - match: "'''" scope: punctuation.definition.string.begin.python set: after-expression + - include: line-continuation-inside-block-string + - include: escaped-fstring-escape - include: escaped-unicode-char - include: escaped-char - include: f-string-content @@ -1765,6 +1967,7 @@ contexts: with_prototype: - match: (?=''') pop: true + - include: line-continuation-inside-block-string - include: escaped-unicode-char - include: escaped-char - include: constant-placeholder @@ -1774,6 +1977,7 @@ contexts: - match: "'''" scope: punctuation.definition.string.end.python set: after-expression + - include: line-continuation-inside-block-string - include: escaped-unicode-char - include: escaped-char - include: constant-placeholder @@ -1787,6 +1991,7 @@ contexts: - match: "'''" scope: punctuation.definition.string.end.python set: after-expression + - include: line-continuation-inside-block-string - include: escaped-char - include: constant-placeholder @@ -1894,9 +2099,9 @@ contexts: - match: (?='|\n) pop: true - include: line-continuation-inside-string - - include: f-string-content-reset + - include: f-string-content-with-regex # Single-line f-string - - match: ((?i)f|f)(') + - match: ([fF])(') captures: 1: storage.type.string.python 2: meta.string.interpolated.python string.quoted.single.python punctuation.definition.string.begin.python @@ -1905,6 +2110,7 @@ contexts: - match: "'" scope: punctuation.definition.string.end.python set: after-expression + - include: escaped-fstring-escape - include: escaped-unicode-char - include: escaped-char - include: line-continuation-inside-string @@ -1968,12 +2174,12 @@ contexts: - match: \b(?:(async)\s+)?(for)\b captures: 1: storage.modifier.async.python - 2: keyword.control.flow.for.generator.python + 2: keyword.control.loop.for.generator.python push: - include: comments - meta_scope: meta.expression.generator.python - - match: \b(in)\b - scope: keyword.control.flow.for.in.python + - match: \bin\b + scope: keyword.control.loop.for.in.python pop: true - match: '(?=[)\]}])' scope: invalid.illegal.missing-in.python @@ -1982,10 +2188,10 @@ contexts: - include: target-list inline-if: - - match: \b(if)\b - scope: keyword.control.flow.if.inline.python - - match: \b(else)\b - scope: keyword.control.flow.else.inline.python + - match: \bif\b + scope: keyword.control.conditional.if.python + - match: \belse\b + scope: keyword.control.conditional.else.python target-list: - match: ',' diff --git a/Python/syntax_test_python.py b/Python/syntax_test_python.py index a8dab191c4..23309479ef 100644 --- a/Python/syntax_test_python.py +++ b/Python/syntax_test_python.py @@ -109,9 +109,9 @@ #^^^^^^^^^ meta.qualified-name meta.generic-name class -#^^^^ storage.type.class +#^^^^ storage.type.class keyword.declaration.class.python def -#^^ storage.type.function +#^^ storage.type.function keyword.declaration.function.python # async and await are still recognized as valid identifiers unless in an "async" block async @@ -232,18 +232,18 @@ def _(): # ^^^^ - keyword a if b else c -# ^^ keyword.control.flow -# ^^^^ keyword.control.flow +# ^^ keyword.control.conditional.if +# ^^^^ keyword.control.conditional.else c = lambda: pass -# ^^^^^^^ meta.function.inline -# ^^^^^^ storage.type.function.inline +# ^^^^^^^^^^^^ meta.function.inline +# ^^^^^^ storage.type.function.inline keyword.declaration.function.inline.python # ^ punctuation.section.function.begin -# ^^^^ keyword +# ^^^^ invalid.illegal.name.python _(lambda x, y: 10) -# ^^^^^^^^^^^^ meta.function.inline -# ^^^^^^ storage.type.function.inline +# ^^^^^^^^^^^^^^^ meta.function.inline +# ^^^^^^ keyword.declaration.function.inline.python # ^^^^^ meta.function.inline.parameters # ^ variable.parameter # ^ punctuation.separator.parameters @@ -252,13 +252,14 @@ def _(): lambda \ a, \ - b=2: pass -# ^^^^ meta.function.inline + b=2: True +# ^^^^^^^^^ meta.function.inline # ^ keyword.operator.assignment # ^ punctuation.section.function.begin -# ^^^^ keyword +# ^^^^^ meta.function.inline.body +# ^^^^ constant.language.python - lambda as, in=2: pass + lambda as, in=2: 0 # ^^ invalid.illegal.name # ^^ invalid.illegal.name @@ -271,11 +272,12 @@ def _(): # ^ invalid.illegal.expected-parameter.python lambda x -# ^^^^^^ storage.type.function.inline +# ^^^^^^ storage.type.function.inline keyword.declaration.function.inline.python - lambda (x, y): pass -# ^^^^^^^^^^^^^^ meta.function.inline.python -# ^^^^^^^ meta.function.inline.parameters.python + lambda (x, y): 0 +# ^^^^^^^^^^^^^^^^ meta.function.inline +# ^^^^^^^^ meta.function.inline.parameters.python +# ^^ meta.function.inline.body.python # ^^^^^^ meta.group.python # ^ punctuation.section.group.begin.python # ^ variable.parameter.python @@ -283,7 +285,6 @@ def _(): # ^ variable.parameter.python # ^ punctuation.section.group.end.python # ^ punctuation.section.function.begin.python -# ^^^^ keyword.control.flow.pass.python lambda ( # ^^^^^^^^^ meta.function.inline.python # ^^^ meta.function.inline.parameters.python @@ -364,7 +365,7 @@ def _(): # ^^^ meta.item-access - meta.structure [1, 2, 3][2] -#^^^^^^^^ meta.structure.list +#^^^^^^^^ meta.sequence # ^^^ meta.item-access - meta.structure {True: False}.get(True) @@ -417,23 +418,23 @@ def _(): ################## def _(): for -# ^^^ keyword.control.flow.for +# ^^^ keyword.control.loop.for b = c in d -# ^^ keyword.operator.logical - keyword.control.flow.for.in +# ^^ keyword.operator.logical - keyword.control.loop.for.in for \ a \ in \ b: -# ^^ meta.statement.for -# ^ punctuation.section.block.for.python +# ^^ meta.statement.loop.for +# ^ punctuation.section.block.loop.for.python async for i in myfunc(): -# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.statement.for +# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.statement.loop.for # ^^^^^ storage.modifier.async -# ^^^ keyword.control.flow.for -# ^^ keyword.control.flow.for.in -# ^ punctuation.section.block.for +# ^^^ keyword.control.loop.for +# ^^ keyword.control.loop.for.in +# ^ punctuation.section.block.loop.for pass for i: @@ -491,23 +492,23 @@ def _(): # ^ punctuation.section.arguments.begin # ^ punctuation.section.arguments.end # ^^ keyword.control.flow.with.as -# ^ punctuation.section.list.begin +# ^ punctuation.section.sequence.begin # ^^^ meta.generic-name -# ^ punctuation.separator.list +# ^ punctuation.separator.sequence # ^^^ meta.generic-name -# ^ punctuation.section.list.end +# ^ punctuation.section.sequence.end # ^ punctuation.section.block.with with captured() \ as [ -# ^ punctuation.section.list.begin +# ^ punctuation.section.sequence.begin out, # ^^^ meta.generic-name -# ^ punctuation.separator.list +# ^ punctuation.separator.sequence err # ^^^ meta.generic-name ]: -# ^ punctuation.section.list.end +# ^ punctuation.section.sequence.end # ^ punctuation.section.block.with async with context_manager() as c: @@ -518,36 +519,39 @@ def _(): await something() # ^^^^^ keyword.other.await + assert foo == bar +# ^^^^^^ keyword.control.flow.assert.python + try: -# ^^^^ meta.statement.try.python -# ^^^ keyword.control.flow.try.python -# ^ punctuation.section.block.try.python +# ^^^^ meta.statement.exception.try.python +# ^^^ keyword.control.exception.try.python +# ^ punctuation.section.block.exception.try.python raise # ^^^^^ meta.statement.raise.python keyword.control.flow.raise.python except Exception as x: -# ^^^^^^^^^^^^^^^^^^^^^^ meta.statement.except.python - meta.statement.except.python meta.statement.except.python -# ^^^^^^ keyword.control.flow.except.python +# ^^^^^^^^^^^^^^^^^^^^^^ meta.statement.exception.catch.python - meta.statement.exception.catch.python meta.statement.exception.catch.python +# ^^^^^^ keyword.control.exception.catch.python # ^^^^^^^^^ support.type.exception.python -# ^^ keyword.control.flow.as.python +# ^^ keyword.control.exception.catch.as.python # ^ meta.generic-name.python -# ^ punctuation.section.block.except.python +# ^ punctuation.section.block.exception.catch.python pass finally : -# ^^^^^^^^^ meta.statement.finally.python -# ^^^^^^^ keyword.control.flow.finally.python -# ^ punctuation.section.block.finally.python +# ^^^^^^^^^ meta.statement.exception.finally.python +# ^^^^^^^ keyword.control.exception.finally.python +# ^ punctuation.section.block.exception.finally.python try_except_raise: # ^^^ - keyword while ( -# ^^^^^^^^ meta.statement.while.python -# ^^^^^ keyword.control.flow.while.python -# ^ meta.statement.while.python meta.group.python punctuation.section.group.begin.python +# ^^^^^^^^ meta.statement.loop.while.python +# ^^^^^ keyword.control.loop.while.python +# ^ meta.statement.loop.while.python meta.group.python punctuation.section.group.begin.python a is b -# ^^^^^^ meta.statement.while.python +# ^^^^^^ meta.statement.loop.while.python # ^^ keyword.operator.logical.python ): -# ^ meta.statement.while.python punctuation.section.block.while.python +# ^ meta.statement.loop.while.python punctuation.section.block.loop.while.python sleep() if a: break @@ -557,46 +561,46 @@ def _(): # ^^^^^^^^ keyword.control.flow.continue.python if 213 is 231: -# ^^^^^^^^^^^^^^ meta.statement.if.python -# ^^ keyword.control.flow.conditional.python +# ^^^^^^^^^^^^^^ meta.statement.conditional.if.python +# ^^ keyword.control.conditional.if.python # ^^^ constant.numeric.integer.decimal.python # ^^ keyword.operator.logical.python -# ^ punctuation.section.block.conditional.python +# ^ punctuation.section.block.conditional.if.python pass elif: -# ^^^^^ meta.statement.conditional.python -# ^ punctuation.section.block.python +# ^^^^^ meta.statement.conditional.elseif.python +# ^ punctuation.section.block.conditional.elseif.python pass elif False : -# ^^^^^^^^^^^^ meta.statement.conditional.python +# ^^^^^^^^^^^^ meta.statement.conditional.elseif.python # ^^^^^ constant.language -# ^ punctuation.section.block.python +# ^ punctuation.section.block.conditional.elseif.python pass else : -# ^^^^^^^ meta.statement.conditional.python -# ^ punctuation.section.block.python +# ^^^^^^^ meta.statement.conditional.else.python +# ^ punctuation.section.block.conditional.else.python pass if \ True: -# ^^^^^ meta.statement.if.python +# ^^^^^ meta.statement.conditional.if.python # ^^^^ constant.language.python -# ^ punctuation.section.block.conditional.python +# ^ punctuation.section.block.conditional.if.python # # verify that keywords also work when they are bare (useful when typing) for -# ^^^ keyword.control.flow.for.python +# ^^^ keyword.control.loop.for.python with # ^^^^ keyword.control.flow.with.python if -# ^^ keyword.control.flow.conditional.python +# ^^ keyword.control.conditional.if.python finally -# ^^^^^^^ keyword.control.flow.finally.python +# ^^^^^^^ keyword.control.exception.finally.python else -# ^^^^ keyword.control.flow.conditional.python +# ^^^^ keyword.control.conditional.else.python while -# ^^^^^ keyword.control.flow.while.python +# ^^^^^ keyword.control.loop.while.python return # ^^^^^^ keyword.control.flow.return.python raise @@ -695,7 +699,7 @@ def func(args, (x, y)=(0,0)): # ^ meta.function.parameters.python # ^^^^^^ meta.group.python # ^ - meta.group.python -# ^^^^^ meta.group.python +# ^^^^^ meta.sequence.tuple.python # ^ - meta.group.python # ^ punctuation.section.parameters.begin.python # ^ punctuation.separator.parameters.python @@ -705,18 +709,18 @@ def func(args, (x, y)=(0,0)): # ^ variable.parameter.python # ^ punctuation.section.group.end.python # ^ keyword.operator.assignment.python -# ^ punctuation.section.group.begin.python +# ^ punctuation.section.sequence.begin.python # ^ constant.numeric.integer.decimal.python -# ^ punctuation.separator.tuple.python +# ^ punctuation.separator.sequence.python # ^ constant.numeric.integer.decimal.python -# ^ punctuation.section.group.end.python +# ^ punctuation.section.sequence.end.python # ^ punctuation.section.parameters.end.python pass def foo(arg: int = 0, (x: float, y=20) = (0.0, "default")): # ^^^^^^^^^^^^^^^^ meta.group.python # ^^^ - meta.group.python -# ^^^^^^^^^^^^^^^^ meta.group.python +# ^^^^^^^^^^^^^^^^ meta.sequence.tuple.python # ^ punctuation.section.group.begin.python # ^ variable.parameter.python # ^^^^^^^ invalid.illegal.annotation.python @@ -725,10 +729,19 @@ def foo(arg: int = 0, (x: float, y=20) = (0.0, "default")): # ^^^ invalid.illegal.default-value.python # ^ punctuation.section.group.end.python # ^ keyword.operator.assignment.python -# ^ punctuation.section.group.begin.python -# ^ punctuation.section.group.end.python +# ^ punctuation.section.sequence.begin.python +# ^ punctuation.section.sequence.end.python pass +def name(p1, p2=None, /, p_or_kw=None, *, kw): pass +# ^ storage.modifier.positional-args-only.python +# ^ punctuation.separator.parameters.python +# ^ keyword.operator.unpacking.sequence.python +def name(p1, p2, /): pass +# ^ storage.modifier.positional-args-only.python +# ^ punctuation.section.parameters.end.python + + ################## # Class definitions ################## @@ -864,7 +877,7 @@ def wrapper(self): @deco \ def f(): pass -# ^^^ storage.type.function - meta.decorator +# ^^^ storage.type.function keyword.declaration.function.python - meta.decorator class AClass: @@ -881,139 +894,186 @@ def __call__(self, *args, **kwds): ################## mytuple = ("this", 'is', 4, tuple) -# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.group -# ^ punctuation.section.group.begin +# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.sequence.tuple.python +# ^ punctuation.section.sequence.begin # ^^^^^^ string.quoted.double -# ^ punctuation.separator.tuple +# ^ punctuation.separator.sequence # ^^^^ string.quoted.single -# ^ punctuation.separator.tuple +# ^ punctuation.separator.sequence # ^ constant.numeric -# ^ punctuation.separator.tuple +# ^ punctuation.separator.sequence # ^^^^^ support.type -# ^ punctuation.section.group.end +# ^ punctuation.section.sequence.end + +also_a_tuple = ()[-1] +# ^^ meta.sequence.tuple.empty.python +# ^^^^ meta.item-access + not_a_tuple = (a = 2, b += 3) +# ^^^^^^^^^^^^^^^ - meta.sequence # ^ - keyword # ^ - keyword +just_a_group = (1) +# ^^^ meta.group.python + mylist = [] -# ^^ meta.structure.list.python -# ^ punctuation.section.list.begin -# ^ punctuation.section.list.end +# ^^ meta.sequence.list.empty.python +# ^ punctuation.section.sequence.begin +# ^ punctuation.section.sequence.end mylist = [1, "testing", ["sublist", True]] -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.structure.list -# ^ punctuation.section.list.begin +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.sequence +# ^ punctuation.section.sequence.begin # ^ constant.numeric -# ^ punctuation.separator.list +# ^ punctuation.separator.sequence # ^^^^^^^^^ string.quoted.double # ^ punctuation.separator -# ^^^^^^^^^^^^^^^^^ meta.structure.list meta.structure.list -# ^ punctuation.section.list.begin +# ^^^^^^^^^^^^^^^^^ meta.sequence meta.sequence +# ^ punctuation.section.sequence.begin # ^^^^^^^^^ string.quoted.double -# ^ punctuation.separator.list +# ^ punctuation.separator.sequence # ^^^^ constant.language -# ^ punctuation.section.list.end -# ^ punctuation.section.list.end +# ^ punctuation.section.sequence.end +# ^ punctuation.section.sequence.end mydict = {} -# ^^ meta.structure.dictionary -# ^ punctuation.section.dictionary.begin -# ^ punctuation.section.dictionary.end +# ^^ meta.mapping.empty.python +# ^ punctuation.section.mapping.begin +# ^ punctuation.section.mapping.end key2 = "my_key" -mydict = {"key": True, key2: (1, 2, [-1, -2])} -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.structure.dictionary-or-set -# ^^^^^ string.quoted.double -# ^ punctuation.separator.key-value -# ^^^^ constant.language -# ^ punctuation.separator.dictionary-or-set -# ^ punctuation.separator.key-value -# ^^^^^^^^^^^^^^^^ meta.group -# ^ punctuation.section.group.begin +mydict = {"key": True, key2: (1, 2, [-1, -2]), ,} +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.mapping - meta.mapping meta.mapping +# ^ punctuation.section.mapping.begin +# ^^^^^ meta.mapping.key.python string.quoted.double +# ^ punctuation.separator.mapping.key-value +# ^^^^ meta.mapping.value.python constant.language +# ^ punctuation.separator.mapping +# ^^^^ meta.mapping.key.python meta.qualified-name +# ^ punctuation.separator.mapping +# ^^^^^^^^^^^^^^^^ meta.sequence.tuple +# ^ punctuation.section.sequence.begin # ^ constant.numeric # ^ constant.numeric -# ^^^^^^^ meta.structure.list -# ^ punctuation.separator.list -# ^ punctuation.section.group.end -# ^ punctuation.section.dictionary-or-set.begin -# ^ punctuation.section.dictionary-or-set.end - -myset = {"key", True, key2, [-1], {}} -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.structure.dictionary-or-set +# ^^^^^^^^ meta.sequence.list +# ^ punctuation.separator.sequence +# ^ punctuation.section.sequence.end +# ^ punctuation.separator.mapping.python +# ^ invalid.illegal.expected-colon.python +# ^ punctuation.section.mapping.end - meta.mapping.key + +mydict = { 'a' : xform, 'b' : form, 'c' : frm } +# ^ meta.mapping.python punctuation.separator.mapping.python +# ^ punctuation.separator.mapping.key-value.python + +myset = {"key", True, key2, [-1], {}:1} +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.set +# ^ punctuation.section.set.begin.python # ^^^^^ string.quoted.double -# ^ punctuation.separator.dictionary-or-set +# ^ punctuation.separator.set # ^^^^ constant.language -# ^ punctuation.separator.dictionary-or-set -# ^ punctuation.separator.dictionary-or-set -# ^^^^ meta.structure.list +# ^ punctuation.separator.set +# ^ punctuation.separator.set +# ^^^^ meta.sequence # ^ constant.numeric -# ^ punctuation.separator.dictionary-or-set -# ^^ meta.structure.dictionary +# ^ punctuation.separator.set +# ^^ meta.mapping.empty.python +# ^ invalid.illegal.colon-inside-set.python +# ^ punctuation.section.set.end.python + +mapping_or_set = { +# ^ meta.mapping-or-set.python punctuation.section.mapping-or-set.begin.python + 1: True +# ^ meta.mapping.key.python constant.numeric.integer.decimal.python +# ^ punctuation.separator.mapping.key-value.python +} +# <- meta.mapping.python punctuation.section.mapping.end.python + +complex_mapping = {(): "value"} +# ^^^ meta.mapping-or-set.python +# ^^^^^^^^^^ meta.mapping - meta.mapping-or-set + +more_complex_mapping = {**{1: 1}, 2: 2} +# ^ meta.mapping.python +# ^ meta.mapping.python punctuation.separator.mapping.python +# ^ meta.mapping.python punctuation.separator.mapping.key-value.python + +more_complex_set = { +# ^ meta.mapping-or-set.python + *{1}, 2: 2} +# ^ meta.set.python +# ^ meta.set.python punctuation.separator.set.python +# ^ meta.set.python invalid.illegal.colon-inside-set.python generator = (i for i in range(100)) # ^^^^^^^^^^^^^^^^^^^^^^^ meta.group # ^^^^^^^^ meta.expression.generator -# ^^^ keyword.control.flow.for.generator -# ^^ keyword.control.flow.for.in +# ^^^ keyword.control.loop.for.generator +# ^^ keyword.control.loop.for.in list_ = [i for i in range(100)] -# ^^^^^^^^^^^^^^^^^^^^^^^ meta.structure.list +# ^^^^^^^^^^^^^^^^^^^^^^^ meta.sequence # ^^^^^^^^ meta.expression.generator -# ^^^ keyword.control.flow.for.generator -# ^^ keyword.control.flow.for.in +# ^^^ keyword.control.loop.for.generator +# ^^ keyword.control.loop.for.in set_ = {i for i in range(100)} -# ^^^^^^^^^^^^^^^^^^^^^^^ meta.structure.dictionary-or-set +# ^^^^^^^^^^^^^^^^^^^^^^^ meta.mapping-or-set # ^^^^^^^^ meta.expression.generator -# ^^^ keyword.control.flow.for.generator -# ^^ keyword.control.flow.for.in +# ^^^ keyword.control.loop.for.generator +# ^^ keyword.control.loop.for.in dict_ = {i: i for i in range(100)} -# ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.structure.dictionary-or-set +# ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.mapping - meta.mapping meta.mapping +# ^ meta.mapping.key.python +# ^^^^^^^^^^^^^^^^^^^^^^^^ - meta.mapping.key.python +# ^ meta.mapping.value.python +# ^^^^^^^^^^^^^^^^^^^^^ - meta.mapping.value # ^^^^^^^^ meta.expression.generator -# ^^^ keyword.control.flow.for.generator -# ^^ keyword.control.flow.for.in +# ^^^ keyword.control.loop.for.generator +# ^^ keyword.control.loop.for.in list_ = [i for i in range(100) if i > 0 else -1] -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.structure.list +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.sequence # ^^^^^^^^ meta.expression.generator -# ^^ keyword.control.flow.if.inline -# ^^^^ keyword.control.flow.else.inline +# ^^ keyword.control.conditional.if +# ^^^^ keyword.control.conditional.else list2_ = [i in range(10) for i in range(100) if i in range(5, 15)] # ^^ keyword.operator.logical -# ^^ keyword.control.flow.for.in +# ^^ keyword.control.loop.for.in # ^^ keyword.operator.logical generator = ((k1, k2, v) for ((k1, k2), v) in xs) -# ^ meta.group.python -# ^^^^^^^^^^^ meta.group.python meta.group.python -# ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.group.python -# ^^ punctuation.section.group.begin.python -# ^ punctuation.section.group.end.python +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.group.python +# ^^^^^^^^^^^ meta.sequence.tuple.python +# ^ punctuation.section.group.begin.python +# ^ punctuation.section.sequence.begin.python +# ^ punctuation.section.sequence.end.python # ^^ punctuation.section.target-list.begin.python # ^ punctuation.section.target-list.end.python # ^ punctuation.section.target-list.end.python # ^ punctuation.section.group.end.python list_ = [(k1, k2, v) for ((k1, k2), v) in xs] -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.structure.list.python -# ^^^^^^^^^^^ meta.group.python -# ^ - meta.group.python - meta.expression.generator.python -# ^ punctuation.section.list.begin.python -# ^ punctuation.section.group.begin.python -# ^ punctuation.section.group.end.python +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.sequence.list.python +# ^^^^^^^^^^^ meta.sequence.tuple.python +# ^ - meta.sequence.tuple.python - meta.expression.generator.python +# ^ punctuation.section.sequence.begin.python +# ^ punctuation.section.sequence.begin.python +# ^ punctuation.section.sequence.end.python # ^^ punctuation.section.target-list.begin.python # ^ punctuation.section.target-list.end.python # ^ punctuation.section.target-list.end.python -# ^ punctuation.section.list.end.python +# ^ punctuation.section.sequence.end.python dict_ = {k1: (k2, v) for ((k1, k2), v) in xs} -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.structure.dictionary-or-set.python -# ^ punctuation.section.dictionary-or-set.begin.python -# ^^^^^^^ meta.group.python -# ^ punctuation.section.group.begin.python -# ^ punctuation.section.group.end.python +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.mapping - meta.mapping meta.mapping +# ^ punctuation.section.mapping.begin.python +# ^^^^^^^ meta.sequence.tuple.python +# ^ punctuation.section.sequence.begin.python +# ^ punctuation.section.sequence.end.python # ^^ punctuation.section.target-list.begin.python # ^ punctuation.section.target-list.end.python # ^ punctuation.section.target-list.end.python -# ^ punctuation.section.dictionary-or-set.end.python +# ^ punctuation.section.mapping.end.python list(i for i in generator) # ^^^^^^^^ meta.expression.generator @@ -1024,11 +1084,11 @@ def __call__(self, *args, **kwds): _ = [m for cls in self.__class__.mro() -# ^^^ keyword.control.flow.for.generator -# ^^ keyword.control.flow.for.in +# ^^^ keyword.control.loop.for.generator +# ^^ keyword.control.loop.for.in for m in cls.__dict__] -# ^^^ keyword.control.flow.for.generator -# ^^ keyword.control.flow.for.in +# ^^^ keyword.control.loop.for.generator +# ^^ keyword.control.loop.for.in result = [i async for i in aiter() if i % 2] # ^^^^^ storage.modifier.async @@ -1036,54 +1096,83 @@ def __call__(self, *args, **kwds): # ^^^^^ keyword.other.await.python +t = (*tuple(), *[1, 2], 3*1) +# ^^^^^^^^^^^^^^^^^^^^^^ meta.sequence.tuple.python +# ^ keyword.operator.arithmetic.python +# ^^^^^ support.type.python +# ^ keyword.operator.unpacking.sequence.python +# ^ keyword.operator.arithmetic.python + l = [1 * 2, 2**10, *result] # ^ keyword.operator.arithmetic.python # ^^ keyword.operator.arithmetic.python # ^ keyword.operator.unpacking.sequence.python +l = [*l] +# ^ keyword.operator.unpacking.sequence.python + d = {1: 3**4, **dict_} # ^^ keyword.operator.arithmetic.python # ^^ keyword.operator.unpacking.mapping.python +d = {**d, **dict()} +# ^^^^^^^^^^^^^^^ meta.mapping.python +# ^^^ - meta.mapping.key +# ^^ keyword.operator.unpacking.mapping.python +# ^ meta.qualified-name.python +# ^ punctuation.separator.mapping.python +# ^^^^^^^^ - meta.mapping.key +# ^^ keyword.operator.unpacking.mapping.python +# ^^^^ support.type.python + +s = {*d, *set()} +# ^^^^^^^^^^^^ meta.set.python +# ^ keyword.operator.unpacking.sequence.python +# ^ meta.qualified-name.python +# ^ punctuation.separator.set.python +# ^ keyword.operator.unpacking.sequence.python +# ^^^ support.type.python + generator = ( i for -# ^^^ keyword.control.flow.for.generator +# ^^^ keyword.control.loop.for.generator i in -# ^^ keyword.control.flow.for.in +# ^^ keyword.control.loop.for.in range(100) ) + ################## # Exception handling ################## except Exception: -#^^^^^^^^^^^^^^^^ meta.statement.except -#^^^^^ keyword.control.flow.except +#^^^^^^^^^^^^^^^^ meta.statement.exception.catch +#^^^^^ keyword.control.exception.catch # ^^^^^^^^^ support.type.exception # ^ punctuation.section.block except (KeyError, NameError) as e: -#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.statement.except -#^^^^^ keyword.control.flow.except +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.statement.exception.catch +#^^^^^ keyword.control.exception.catch # ^^^^^^^^ support.type.exception # ^ punctuation.separator.target-list # ^^^^^^^^^ support.type.exception -# ^^ keyword.control.flow.as +# ^^ keyword.control.exception.catch.as # ^ punctuation.section.block except \ StopIteration \ as \ err: -# ^^^^ meta.statement.except +# ^^^^ meta.statement.exception.catch except StopIteration as -# ^^ invalid.illegal.name - meta.statement.except +# ^^ invalid.illegal.name - meta.statement.exception.catch except -#^^^^^ keyword.control.flow.except +#^^^^^ keyword.control.exception.catch raise #^^^^ meta.statement.raise keyword.control.flow.raise @@ -1118,60 +1207,60 @@ def __call__(self, *args, **kwds): decimal = 1234567890 + 9876543210L + -1 + -42L * 0000 # ^^^^^^^^^^ constant.numeric.integer.decimal.python -# ^^^^^^^^^^^ constant.numeric.integer.long.decimal.python -# ^ storage.type.numeric.long.python +# ^^^^^^^^^^^ constant.numeric.integer.decimal.python +# ^ storage.type.numeric.python # ^ keyword.operator.arithmetic.python - constant.numeric # ^ keyword.operator.arithmetic.python - constant.numeric -# ^ storage.type.numeric.long.python +# ^ storage.type.numeric.python # ^^^^ constant.numeric.integer floating = 0.1 - .1 * 10e-20 - 0.0e2 % 2. -# ^^^ constant.numeric.float.python +# ^^^ constant.numeric.float.decimal.python # ^ punctuation.separator.decimal.python -# ^^ constant.numeric.float.python -# ^^^^^^ constant.numeric.float.python +# ^^ constant.numeric.float.decimal.python +# ^^^^^^ constant.numeric.float.decimal.python # ^ punctuation.separator.decimal.python -# ^^^^^ constant.numeric.float.python -# ^^ constant.numeric.float.python +# ^^^^^ constant.numeric.float.decimal.python +# ^^ constant.numeric.float.decimal.python # ^ punctuation.separator.decimal.python binary = 0b1010011 | 0b0110110L # ^^^^^^^^^ constant.numeric.integer.binary.python -# ^^ punctuation.definition.numeric.binary.python -# ^^^^^^^^^^ constant.numeric.integer.long.binary.python -# ^^ punctuation.definition.numeric.binary.python -# ^ storage.type.numeric.long.python +# ^^ punctuation.definition.numeric.base.python +# ^^^^^^^^^^ constant.numeric.integer.binary.python +# ^^ punctuation.definition.numeric.base.python +# ^ storage.type.numeric.python octal = 0o755 ^ 0o644L # ^^^^^ constant.numeric.integer.octal.python -# ^^ punctuation.definition.numeric.octal.python -# ^ storage.type.numeric.long.python -# ^^^^^^ constant.numeric.integer.long.octal.python -# ^^ punctuation.definition.integer.octal.python +# ^^ punctuation.definition.numeric.base.python +# ^ storage.type.numeric.python +# ^^^^^^ constant.numeric.integer.octal.python +# ^^ punctuation.definition.numeric.base.python old_style_octal = 010 + 007 - 012345670L # ^^^ constant.numeric.integer.octal.python -# ^ punctuation.definition.numeric.octal.python +# ^ punctuation.definition.numeric.base.python # ^^^ constant.numeric.integer.octal.python -# ^ punctuation.definition.numeric.octal.python -# ^^^^^^^^^^ constant.numeric.integer.long.octal.python -# ^ punctuation.definition.integer.octal.python -# ^ storage.type.numeric.long.python +# ^ punctuation.definition.numeric.base.python +# ^^^^^^^^^^ constant.numeric.integer.octal.python +# ^ punctuation.definition.numeric.base.python +# ^ storage.type.numeric.python hexadecimal = 0x100af - 0XDEADF00L # ^^^^^^^ constant.numeric.integer.hexadecimal.python -# ^^ punctuation.definition.numeric.hexadecimal.python -# ^^^^^^^^^^ constant.numeric.integer.long.hexadecimal.python -# ^^ punctuation.definition.numeric.hexadecimal.python -# ^ storage.type.numeric.long.python +# ^^ punctuation.definition.numeric.base.python +# ^^^^^^^^^^ constant.numeric.integer.hexadecimal.python +# ^^ punctuation.definition.numeric.base.python +# ^ storage.type.numeric.python unintuitive = 0B101 + 0O101 + 10l # ^^^^^ constant.numeric.integer.binary.python -# ^^ punctuation.definition.numeric.binary.python +# ^^ punctuation.definition.numeric.base.python # ^^^^^ constant.numeric.integer.octal.python -# ^^ punctuation.definition.numeric.octal.python -# ^^^ constant.numeric.integer.long.decimal.python -# ^ storage.type.numeric.long.python +# ^^ punctuation.definition.numeric.base.python +# ^^^ constant.numeric.integer.decimal.python +# ^ storage.type.numeric.python illegal = 1LL << 08 | 0b010203 | 0xAbraCadabra # ^ - constant.numeric @@ -1180,25 +1269,25 @@ def __call__(self, *args, **kwds): # ^^^^^^^^^ - constant.numeric amount = 10_000_000.0_2e2_0 + .e2 + 2_2._2 -# ^^^^^^^^^^^^^^^^^^ constant.numeric.float +# ^^^^^^^^^^^^^^^^^^ constant.numeric.float.decimal.python # ^ punctuation.separator.decimal.python # ^^^ - constant # ^^ - constant very_complex = 23_2.2e2_0J + 2_1j -# ^^^^^^^^^^^ constant.numeric.complex.python +# ^^^^^^^^^^^ constant.numeric.imaginary.decimal.python # ^ punctuation.separator.decimal.python -# ^^^^ constant.numeric.complex.python -# ^ storage.type.numeric.complex.python -# ^ storage.type.numeric.complex.python +# ^^^^ constant.numeric.imaginary.decimal.python +# ^ storage.type.numeric.python +# ^ storage.type.numeric.python addr = 0xCAFE_F00D # ^^^^^^^^^^^ constant.numeric -# ^^ punctuation.definition.numeric.hexadecimal.python +# ^^ punctuation.definition.numeric.base.python flags = 0b_0011_1111_0100_1110 | 0b_1 & 0b_0_ # ^^^^^^^^^^^^^^^^^^^^^^ constant.numeric -# ^^ punctuation.definition.numeric.binary.python +# ^^ punctuation.definition.numeric.base.python # ^^^^ constant.numeric.integer.binary.python # ^ - constant @@ -1247,7 +1336,7 @@ def another_func(): for x in y: break # ^^^^^ invalid.illegal.name -# ^ - meta.structure.list +# ^ - meta.sequence with open(x) as y: @@ -1285,3 +1374,86 @@ class Starship: stats: ClassVar[Dict[str, int]] = {} # ^ punctuation.separator.annotation.variable.python # ^ keyword.operator.assignment + + +################## +# Assignment Expressions +################## + +# Examples from https://www.python.org/dev/peps/pep-0572/ + +y := f(x) +# ^^ invalid.illegal.not-allowed-here.python + +(y := f(x)) +# ^^ keyword.operator.assignment.inline.python + +y0 = y1 := f(x) +# ^^ invalid.illegal.not-allowed-here.python + +y0 = (y1 := f(x)) +# ^^ keyword.operator.assignment.inline.python + +foo(x=(y := f(x))) +# ^^ keyword.operator.assignment.inline.python + +if (match := pattern.search(data)) is not None: +# ^^ keyword.operator.assignment.inline.python + pass + +if tz := self._tzstr(): +# ^^ keyword.operator.assignment.inline.python + s += tz + +while chunk := file.read(8192): +# ^^ keyword.operator.assignment.inline.python + process(chunk) + +[y := f(x), y**2, y**3] +# ^^ keyword.operator.assignment.inline.python + +filtered_data = [y for x in data if (y := f(x)) is not None] +# ^^ keyword.operator.assignment.inline.python + +def foo(answer=(p := 42)): +# ^^ keyword.operator.assignment.inline.python + +lambda: (x := 1) +# ^^ keyword.operator.assignment.inline.python + +lambda line: (m := re.match(pattern, line)) and m.group(1) # Valid +# ^^ keyword.operator.assignment.inline.python + +f'{(x:=10)}' +# ^^ keyword.operator.assignment.inline.python + +f'{x:=10}' +# ^^ - keyword.operator.assignment.inline.python + + +if any(len(longline := line) >= 100 for line in lines): +# ^^ keyword.operator.assignment.inline.python + print("Extremely long line:", longline) + +# These are all invalid. We could let linters handle them, +# but these weren't hard to implement. +def foo(x: y:=f(x)) -> a:=None: pass +# ^^ invalid.illegal.not-allowed-here.python +# ^^ invalid.illegal.not-allowed-here.python +foo(x = y := f(x), y=x:=2) +# ^^ invalid.illegal.not-allowed-here.python +# ^^ invalid.illegal.not-allowed-here.python +{a := 1: 2} +# ^^ invalid.illegal.not-allowed-here.python +{1, b := 2} +# ^^ invalid.illegal.not-allowed-here.python +[1][x:=0] +# ^^ invalid.illegal.not-allowed-here.python +def foo(answer = p := 42): pass +# ^^ invalid.illegal.not-allowed-here.python +(lambda: x := 1) +# ^^ invalid.illegal.not-allowed-here.python + + +# <- - meta +# ensure we're not leaking a context diff --git a/Python/syntax_test_python_strings.py b/Python/syntax_test_python_strings.py index aa80918a5c..f517b12162 100644 --- a/Python/syntax_test_python_strings.py +++ b/Python/syntax_test_python_strings.py @@ -4,7 +4,7 @@ # Strings and embedded syntaxes ############################### -var = "\x00 \xaa \xAF \070 \r \n \t \\ \a \b \' \v \f \u0aF1 \UFe0a182f \N{SPACE}" +var = "\x00 \xaa \xAF \070 \0 \r \n \t \\ \a \b \' \v \f \u0aF1 \UFe0a182f \N{SPACE}" # ^ meta.string.python # ^^^^ constant.character.escape.hex # ^^^^ constant.character.escape.hex @@ -19,14 +19,14 @@ # ^^ constant.character.escape # ^^ constant.character.escape # ^^ constant.character.escape -# ^^^^^^ constant.character.escape.unicode -# ^^^^^^^^^^ constant.character.escape.unicode -# ^^^^^^^^^ constant.character.escape.unicode +# ^^ constant.character.escape +# ^^^^^^ constant.character.escape.unicode +# ^^^^^^^^^^ constant.character.escape.unicode +# ^^^^^^^^^ constant.character.escape.unicode -invalid_escapes = "\. \7 \-" +invalid_escapes = "\. \-" # ^^ invalid.deprecated.character.escape.python # ^^ invalid.deprecated.character.escape.python -# ^^ invalid.deprecated.character.escape.python conn.execute("SELECT * FROM foobar") # ^ meta.string.python keyword.other.DML.sql @@ -136,10 +136,14 @@ string = """ # ^^^ string.quoted.double.block - string string +\ +# <- punctuation.separator.continuation.line.python """ string = r""" # ^^^ meta.string.python string.quoted.double.block +\ +# <- - punctuation """ string = r""" @@ -579,6 +583,18 @@ # ^^^^^ source.python.embedded meta.qualified-name.python meta.generic-name.python # ^ source.regexp.python meta.group.regexp punctuation.definition.group.end.regexp +line = re.sub(rf" ?\{{\\i.?\}}({x})\{{\\i.?\}}", r"\1", line) +# ^^^^^ constant.character.escape.backslash.regexp +# ^^ constant.character.escape.python +# ^^^ constant.character.escape.backslash.regexp +# ^^ constant.character.escape.python +# ^ punctuation.section.interpolation.begin.python + +f"\{{{x}\}} test" +# ^ invalid.deprecated.character.escape.python +# ^^ constant.character.escape.python +# ^ punctuation.section.interpolation.begin.python + f"{something}" #^^^^^^^^^^^^ meta.string.interpolated # <- storage.type.string @@ -634,6 +650,37 @@ # ^ invalid.illegal.stray-brace """ +fr''' +# ^ - invalid +''' + +# Most of these were inspired by +# https://github.com/python/cpython/commit/9a4135e939bc223f592045a38e0f927ba170da32 +f'{x=:}' +# ^ storage.modifier.debug.python +f'{x=:.2f}' +# ^ storage.modifier.debug.python +f'{x=!r}' +# ^ storage.modifier.debug.python +f'{x=!a}' +# ^ storage.modifier.debug.python +f'{x=!s:*^20}' +# ^ storage.modifier.debug.python +# ^^ storage.modifier.conversion.python +# ^^^^^ meta.format-spec.python +f'{"Σ"=}' +# ^ storage.modifier.debug.python +f'{0==1}' +# ^^ -storage.modifier.debug.python +f'{0!=1}' +# ^ -storage.modifier.debug.python +f'{0<=1}' +# ^ -storage.modifier.debug.python +f'{0>=1}' +# ^ -storage.modifier.debug.python +f'{f(a="3=")}' +# ^^^^ -storage.modifier.debug.python + f" { % ^ invalid.illegal.unclosed-string # TODO make this test pass @@ -645,7 +692,7 @@ # ^^^^^ source source.python.embedded f"{d for d in range(10)}" # yes, this doesn't make sense -# ^^^ keyword.control.flow.for.generator.python +# ^^^ keyword.control.loop.for.generator.python f' # ^ invalid.illegal.unclosed-string diff --git a/R/R.sublime-syntax b/R/R.sublime-syntax index 7b9196f9c0..a48a8158ce 100644 --- a/R/R.sublime-syntax +++ b/R/R.sublime-syntax @@ -5,19 +5,21 @@ name: R file_extensions: - R - r - - s - - S - Rprofile scope: source.r variables: + exponent: (?:[eE][-+]?\d+) var: '(?:[a-zA-Z._][a-zA-Z0-9._]*|`[^`]+`)' contexts: main: - include: roxygen + - include: codesection - include: comments - include: constants + - include: accessor + - include: operators - include: keywords - include: storage-types - include: strings @@ -28,65 +30,143 @@ contexts: - include: function-calls - include: general-variables + codesection: + - match: ^\s*((\#+)\s*(.+?)\s*(?:-{4,}|={4,}|#{4,})[ \t]*$\n?) + captures: + 1: comment.line.number-sign.r + 2: punctuation.definition.comment.r + 3: entity.name.section.r + comments: - - match: "#" + - match: \#+ scope: punctuation.definition.comment.r push: - meta_scope: comment.line.number-sign.r - match: \n pop: true + constants: - match: \b(pi|letters|LETTERS|month\.abb|month\.name)\b scope: support.constant.misc.r - match: \b(TRUE|FALSE|NULL|NA|NA_integer_|NA_real_|NA_complex_|NA_character_|Inf|NaN)\b scope: constant.language.r - - match: \b0(x|X)[0-9a-fA-F]+i\b + # complex imaginary + - match: \b(0[xX])\h+(?:(i)|(I))\b scope: constant.numeric.imaginary.hexadecimal.r - - match: \b[0-9]+\.?[0-9]*(?:(e|E)(\+|-)?[0-9]+)?i\b - scope: constant.numeric.imaginary.decimal.r - - match: \.[0-9]+(?:(e|E)(\+|-)?[0-9]+)?i\b + captures: + 1: punctuation.definition.numeric.hexadecimal.r + 2: storage.type.numeric.r + 3: invalid.illegal.numeric.r + - match: (?:(\.)\d+|\b\d+(\.)?\d*){{exponent}}?(?:(i)|(I))\b scope: constant.numeric.imaginary.decimal.r - - match: \b0(x|X)[0-9a-fA-F]+L\b + captures: + 1: punctuation.separator.decimal.r + 2: punctuation.separator.decimal.r + 3: storage.type.numeric.r + 4: invalid.illegal.numeric.r + # integers + - match: \b(0[xX])\h+(?:(L)|(l))\b scope: constant.numeric.integer.hexadecimal.r - - match: \b(?:[0-9]+\.?[0-9]*)L\b + captures: + 1: punctuation.definition.numeric.hexadecimal.r + 2: storage.type.numeric.r + 3: invalid.illegal.numeric.r + - match: \b\d+(\.)?\d*(?:(L)|(l))\b scope: constant.numeric.integer.decimal.r - - match: \b0(x|X)[0-9a-fA-F]+\b + captures: + 1: punctuation.separator.decimal.r + 2: storage.type.numeric.r + 3: invalid.illegal.numeric.r + # floats + - match: \b(0[xX])\h+\b scope: constant.numeric.float.hexadecimal.r - - match: \b[0-9]+\.?[0-9]*(?:(e|E)(\+|-)?[0-9]+)?\b - scope: constant.numeric.float.decimal.r - - match: \.[0-9]+(?:(e|E)(\+|-)?[0-9]+)?\b + captures: + 1: punctuation.definition.numeric.hexadecimal.r + - match: |- + (?x: + # 1., 1.1, 1.1e1, 1.1e-1, 1.e1, 1.e-1 | 1, 1e1, 1e-1 + \b\d+ (?: (\.) (?: \d* {{exponent}}? \b )? | {{exponent}}? \b ) + # .1, .1e1, .1e-1 + | (\.) \d+ {{exponent}}? \b + ) scope: constant.numeric.float.decimal.r + captures: + 1: punctuation.separator.decimal.r + 2: punctuation.separator.decimal.r general-variables: - match: '{{var}}' keywords: - - match: \b(break|next|repeat|else|in)\b - scope: keyword.control.r - - match: \b(if|for|return|while|invisible)\b(?=\s*\() - scope: keyword.control.r - - match: (\-|\+|\*|\/|%\/%|%%|%\*%|%o%|%x%|\^) + - match: \bif\b(?=\s*\() + scope: keyword.control.conditional.if.r + - match: \belse\b + scope: keyword.control.conditional.else.r + - match: \bbreak\b + scope: keyword.control.flow.break.r + - match: \bnext\b + scope: keyword.control.flow.continue.r + - match: \breturn(?=\s*\() + scope: keyword.control.flow.return.r + - match: \brepeat\b + scope: keyword.control.loop.repeat.r + - match: \bfor\b(?=\s*\() + scope: keyword.control.loop.for.r + - match: \bwhile\b(?=\s*\() + scope: keyword.control.loop.while.r + - match: \bin\b + scope: keyword.operator.word.r + + accessor: + - match: '\$' + scope: keyword.accessor.dollar.r + push: + - include: function-calls + - include: general-variables + - match: '' + pop: true + + operators: + # NOTE: sorted by length to ensure not to break ligatures + + # operators with 3+ characters + - match: '%[*/ox]%' scope: keyword.operator.arithmetic.r - - match: (=|<-|<<-|->|->>) + - match: (<<-|->>) scope: keyword.operator.assignment.r - - match: (==|!=|<>|<|>|<=|>=) - scope: keyword.operator.comparison.r - - match: (!|&{1,2}|[|]{1,2}) - scope: keyword.operator.logical.r - - match: (%in%|:=|%between%|%chin%|%like%|%\+%|%\+replace%|%:%|%do%|%dopar%|%>%|%<>%|%T>%|%\$%) + - match: '%(between|chin|do|dopar|in|like|\+replace|\+|:|T>|<>|>|\$)%' scope: keyword.operator.other.r - - match: (:::?) + - match: \.\.\. + scope: keyword.other.r + - match: :::? scope: punctuation.accessor.colons.r - - match: (\.\.\.|\$|:|\~|@) + # operators with 2 characters + - match: (%%|\*\*) + scope: keyword.operator.arithmetic.r + - match: (<-|->) + scope: keyword.operator.assignment.r + - match: (==|!=|<=|>=|<>|&&|\|\|) + scope: keyword.operator.logical.r + - match: := + scope: keyword.operator.other.r + # operators with 1 characters + - match: '[-+*/^]' + scope: keyword.operator.arithmetic.r + - match: = + scope: keyword.operator.assignment.r + - match: '[!&|<>]' + scope: keyword.operator.logical.r + - match: '[:~@]' scope: keyword.other.r - match: ; scope: punctuation.terminator.semicolon.r storage-types: - - match: \b(character|complex|double|expression|integer|list|logical|numeric|single|raw)\b(\s*\() + - match: \b(character|complex|double|expression|integer|list|logical|numeric|single|raw)\s*(?=\() + scope: meta.function-call.name.r captures: 1: storage.type.r - push: function-parameters + push: function-call-arguments strings: - match: '"' @@ -145,27 +225,57 @@ contexts: - include: main function-declarations: - - match: ({{var}})\s*(< name - Symbol Overrides + Symbol List: Sections scope - source.erlang entity.name.function, source.erlang entity.name.type.class + entity.name.section.r settings showInSymbolList - 0 + 1 diff --git a/R/syntax_test_r.R b/R/syntax_test_r.R index 38c7ed58a3..51d35aed69 100644 --- a/R/syntax_test_r.R +++ b/R/syntax_test_r.R @@ -1,7 +1,65 @@ # SYNTAX TEST "Packages/R/R.sublime-syntax" # comment -# ^^^^^^^ comment.line.number-sign.r +# ^^^^^^^^ comment.line.number-sign.r + +# no section --- +# ^^^^^^^^^^^^^^^ comment.line.number-sign.r - entity + +# section 1 ---- +#^ comment.line.number-sign.r - entity +# ^^^^^^^^^ entity.name.section.r +# ^^^^^^ comment.line.number-sign.r - entity + +## section 1.1 ---- +#^^ comment.line.number-sign.r - entity +# ^^^^^^^^^^^ entity.name.section.r +# ^^^^^^ comment.line.number-sign.r - entity + + #### section 1.1.1 ---- +#^ - comment +# ^^^^^ comment.line.number-sign.r - entity +# ^^^^^^^^^^^^^ entity.name.section.r +# ^^^^^^ comment.line.number-sign.r - entity + +# no section === +# ^^^^^^^^^^^^^^ comment.line.number-sign.r - entity + +# section 2 ==== +#^ comment.line.number-sign.r - entity +# ^^^^^^^^^ entity.name.section.r +# ^^^^^^ comment.line.number-sign.r - entity + +## section 2.1 ==== +#^^ comment.line.number-sign.r - entity +# ^^^^^^^^^^^ entity.name.section.r +# ^^^^^^ comment.line.number-sign.r - entity + +#### section 2.1.1 ==== +#^^^^ comment.line.number-sign.r - entity +# ^^^^^^^^^^^^^ entity.name.section.r +# ^^^^^^ comment.line.number-sign.r - entity + +# no section ### +# ^^^^^^^^^^^^^^^ comment.line.number-sign.r - entity + +# no section -=#=- +# ^^^^^^^^^^^^^^^^^ comment.line.number-sign.r - entity + +# section 3 #### +#^ comment.line.number-sign.r - entity +# ^^^^^^^^^ entity.name.section.r +# ^^^^^^ comment.line.number-sign.r - entity + +## section 3.1 #### +#^^ comment.line.number-sign.r - entity +# ^^^^^^^^^^^ entity.name.section.r +# ^^^^^^ comment.line.number-sign.r - entity + +#### section 3.1.1 #### +#^^^^ comment.line.number-sign.r - entity +# ^^^^^^^^^^^^^ entity.name.section.r +# ^^^^^^ comment.line.number-sign.r - entity # constants pi @@ -35,65 +93,196 @@ Inf NaN # <- constant.language.r - 12L -# ^^^ constant.numeric.integer.decimal.r +# complex imaginary - 12 -# ^^ constant.numeric.float.decimal.r + 0x1afi +# ^^ punctuation.definition.numeric.hexadecimal.r +# ^^^^^^ constant.numeric.imaginary.hexadecimal.r +# ^ storage.type.numeric.r + + 0X1afi 0X1afI +# ^^ punctuation.definition.numeric.hexadecimal.r +# ^^^^^^ constant.numeric.imaginary.hexadecimal.r +# ^ storage.type.numeric.r +# ^^ punctuation.definition.numeric.hexadecimal.r +# ^^^^^^ constant.numeric.imaginary.hexadecimal.r +# ^ invalid.illegal.numeric.r + + 12i 12I +# ^^^ constant.numeric.imaginary.decimal.r +# ^ storage.type.numeric.r +# ^^^ constant.numeric.imaginary.decimal.r +# ^ invalid.illegal.numeric.r + + 12.i 12.I +# ^^^^ constant.numeric.imaginary.decimal.r +# ^ punctuation.separator.decimal.r +# ^ storage.type.numeric.r +# ^^^^ constant.numeric.imaginary.decimal.r +# ^ punctuation.separator.decimal.r +# ^ invalid.illegal.numeric.r + + .345i +# ^^^^^ constant.numeric.imaginary.decimal.r +# ^ punctuation.separator.decimal.r +# ^ storage.type.numeric.r + + 12.34e-12i +# ^^^^^^^^^^ constant.numeric.imaginary.decimal.r +# ^ punctuation.separator.decimal.r +# ^ storage.type.numeric.r + + 12.34E-12i +# ^^^^^^^^^^ constant.numeric.imaginary.decimal.r +# ^ punctuation.separator.decimal.r +# ^ storage.type.numeric.r + + 12.34e+12i +# ^^^^^^^^^^ constant.numeric.imaginary.decimal.r +# ^ punctuation.separator.decimal.r +# ^ storage.type.numeric.r + + 12.34E+12i +# ^^^^^^^^^^ constant.numeric.imaginary.decimal.r +# ^ punctuation.separator.decimal.r +# ^ storage.type.numeric.r - 0x1afL + 12.3456i 12.3456I +# ^^^^^^^^ constant.numeric.imaginary.decimal.r +# ^ punctuation.separator.decimal.r +# ^ storage.type.numeric.r +# ^^^^^^^^ constant.numeric.imaginary.decimal.r +# ^ punctuation.separator.decimal.r +# ^ invalid.illegal.numeric.r + +# integers + + 0x1afL 0x1afl 0x1afx +# ^^ punctuation.definition.numeric.hexadecimal.r # ^^^^^^ constant.numeric.integer.hexadecimal.r +# ^ storage.type.numeric.r +# ^^ punctuation.definition.numeric.hexadecimal.r +# ^^^^^^ constant.numeric.integer.hexadecimal.r +# ^ invalid.illegal.numeric.r +# ^^^^^^ - constant 0X1afL +# ^^ punctuation.definition.numeric.hexadecimal.r # ^^^^^^ constant.numeric.integer.hexadecimal.r +# ^ storage.type.numeric.r + + 12L 12l +# ^^^ constant.numeric.integer.decimal.r +# ^ storage.type.numeric.r +# ^^^ constant.numeric.integer.decimal.r +# ^ invalid.illegal.numeric.r + + 12.L +# ^^^^ constant.numeric.integer.decimal.r +# ^ punctuation.separator.decimal.r +# ^ storage.type.numeric.r + + 12.000L +# ^^^^^^^ constant.numeric.integer.decimal.r +# ^ punctuation.separator.decimal.r +# ^ storage.type.numeric.r + +# floats 0x1af +# ^^ punctuation.definition.numeric.hexadecimal.r # ^^^^^ constant.numeric.float.hexadecimal.r 0X1af +# ^^ punctuation.definition.numeric.hexadecimal.r # ^^^^^ constant.numeric.float.hexadecimal.r - 99.99e-12 -# ^^^^^^^^^ constant.numeric.float.decimal.r - - 99.99E-12 -# ^^^^^^^^^ constant.numeric.float.decimal.r + 12 +# ^^ constant.numeric.float.decimal.r - 99.99e+12 -# ^^^^^^^^^ constant.numeric.float.decimal.r + 12. +# ^^^ constant.numeric.float.decimal.r +# ^ punctuation.separator.decimal.r - 99.99E+12 -# ^^^^^^^^^ constant.numeric.float.decimal.r + .3456 +# ^ punctuation.separator.decimal.r +# ^^^^^ constant.numeric.float.decimal.r - 99.9999 + 12.3456 # ^^^^^^^ constant.numeric.float.decimal.r +# ^ punctuation.separator.decimal.r - .9999 -# ^^^^ constant.numeric.float.decimal.r - - 12i -# ^^^ constant.numeric.imaginary.decimal.r - - 0x1afi -# ^^^^^^ constant.numeric.imaginary.hexadecimal.r - - 0x1afi -# ^^^^^^ constant.numeric.imaginary.hexadecimal.r - - 99.99e-12i -# ^^^^^^^^^^ constant.numeric.imaginary.decimal.r - - 99.99E-12i -# ^^^^^^^^^^ constant.numeric.imaginary.decimal.r + 12.34e-12 +# ^^^^^^^^^ constant.numeric.float.decimal.r +# ^ punctuation.separator.decimal.r - 99.99e+12i -# ^^^^^^^^^^ constant.numeric.imaginary.decimal.r + 12.34E-12 +# ^^^^^^^^^ constant.numeric.float.decimal.r +# ^ punctuation.separator.decimal.r - 99.99E+12i -# ^^^^^^^^^^ constant.numeric.imaginary.decimal.r + 12.34e+12 +# ^^^^^^^^^ constant.numeric.float.decimal.r +# ^ punctuation.separator.decimal.r - 99.9999i -# ^^^^^^^^ constant.numeric.imaginary.decimal.r + 12.34E+12 +# ^^^^^^^^^ constant.numeric.float.decimal.r +# ^ punctuation.separator.decimal.r + + 12e34 +# ^^^^^ constant.numeric.float.decimal.r + + 12e-34 +# ^^^^^^ constant.numeric.float.decimal.r + + %*% %/% %% %o% %x% %:% %+% +# ^^^ keyword.operator.arithmetic.r +# ^^^ keyword.operator.arithmetic.r +# ^^ keyword.operator.arithmetic.r +# ^^^ keyword.operator.arithmetic.r +# ^^^ keyword.operator.arithmetic.r +# ^^^ keyword.operator.other.r +# ^^^ keyword.operator.other.r + + ** * - + / ^ +# ^^ keyword.operator.arithmetic.r +# ^ keyword.operator.arithmetic.r +# ^ keyword.operator.arithmetic.r +# ^ keyword.operator.arithmetic.r +# ^ keyword.operator.arithmetic.r +# ^ keyword.operator.arithmetic.r + + <<- <- = -> ->> +# ^^^ keyword.operator.assignment.r +# ^^ keyword.operator.assignment.r +# ^ keyword.operator.assignment.r +# ^^ keyword.operator.assignment.r +# ^^^ keyword.operator.assignment.r + + == != <= >= <> < > && & || | ! +# ^^ keyword.operator.logical.r +# ^^ keyword.operator.logical.r +# ^^ keyword.operator.logical.r +# ^^ keyword.operator.logical.r +# ^^ keyword.operator.logical.r +# ^ keyword.operator.logical.r +# ^ keyword.operator.logical.r +# ^^ keyword.operator.logical.r +# ^ keyword.operator.logical.r +# ^^ keyword.operator.logical.r +# ^ keyword.operator.logical.r +# ^ keyword.operator.logical.r + + %:% := ::: :: +# ^^^ keyword.operator.other.r +# ^^ keyword.operator.other.r +# ^^^ punctuation.accessor.colons.r +# ^^ punctuation.accessor.colons.r + + ... : ~ @ +# ^^^ keyword.other.r +# ^ keyword.other.r +# ^ keyword.other.r +# ^ keyword.other.r foo.99 <- 1 # ^^^ - constant.numeric @@ -114,15 +303,33 @@ x <- 'abc' "\n\r" #^^^^ constant.character.escape.r + +if (1) {} else {return()} +#<- keyword.control.conditional.if.r +# ^^^^ keyword.control.conditional.else.r +# ^^^^^^ keyword.control.flow.return.r + + for (i in 1:10) { -# <- keyword.control.r +# <- keyword.control.loop.for.r # ^ punctuation.section.parens.begin.r -# ^^ keyword.control.r +# ^^ keyword.operator.word.r # ^ punctuation.section.parens.end.r # ^ punctuation.section.braces.begin.r } # <- punctuation.section.braces.end.r + +repeat {next} +#^^^^^ keyword.control.loop.repeat.r +# ^^^^ keyword.control.flow.continue.r + + +while (1) {break} +#^^^^ keyword.control.loop.while.r +# ^^^^^ keyword.control.flow.break.r + + foo[bar] # ^ punctuation.section.brackets.single.begin.r # ^^^^^ meta.item-access.r @@ -140,16 +347,19 @@ foo[[bar]] foo[1:10] # ^ meta.item-access.r meta.item-access.arguments.r keyword.other.r + f = function(x, y){ } -#^^^^^^^^^^^^^^^^^ meta.function.r +# <- meta.function.name.r +#^ meta.function.name.r - meta.function.r +# ^^^^^^^^^^ meta.function.r - meta.function.parameters.r # <- entity.name.function.r # ^ keyword.operator.assignment.r -# ^^^^^^^^ keyword.control.r -# ^ punctuation.section.parens.begin.r -# ^^^^ meta.function.parameters.r +# ^^^^^^^^ storage.type.function.r +# ^ punctuation.section.parameters.begin.r +# ^^^^ meta.function.parameters.r - meta.function.r # ^ variable.parameter.r # ^ punctuation.separator.parameters.r -# ^ punctuation.section.parens.end.r +# ^ punctuation.section.parameters.end.r # ^ punctuation.section.braces.begin.r # ^ punctuation.section.braces.end.r @@ -160,34 +370,37 @@ function(x = "string", y = 2) {} # ^ meta.function.parameters.r constant.numeric.float.decimal.r foo(200, x = function(x) {x + y}) -#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.r +#^^ meta.function-call.name.r - meta.function-call.arguments.r # <- variable.function.r -# ^ punctuation.section.parens.begin.r -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.parameters.r +# ^ punctuation.section.arguments.begin.r +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.r - meta.function-call.name.r # ^^^ constant.numeric.float.decimal.r # ^ variable.parameter.r # ^ keyword.operator.assignment.r -# ^^^^^^^^^^^ meta.function.r -# ^ punctuation.section.parens.end.r +# ^^^^^^^^ meta.function.r storage.type.function.r - meta.function.parameters.r +# ^^^ meta.function.parameters.r +# ^ punctuation.section.arguments.end.r .foo(200, x = function(x) {x + y}) -# <- meta.function-call.r -#^^^^^^^^^^^^^^^^^^^^^ meta.function-call.r +# <- meta.function-call.name.r +#^^^ meta.function-call.name.r - meta.function-call.arguments.r # <- variable.function.r -# ^ punctuation.section.parens.begin.r -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.parameters.r +# ^ punctuation.section.arguments.begin.r +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.r - meta.function-call.name.r # ^^^ constant.numeric.float.decimal.r # ^ variable.parameter.r # ^ keyword.operator.assignment.r -# ^^^^^^^^^^^ meta.function.r -# ^ punctuation.section.parens.end.r +# ^^^^^^^^ meta.function.r - meta.function.parameters.r +# ^^^ meta.function.parameters.r +# ^ punctuation.section.arguments.end.r print.foo() #^^^^^^^^ variable.function.r plot() -# ^^^^^^ meta.function-call.r +# ^^^^ meta.function-call.name.r - meta.function-call.arguments.r +# ^^ meta.function-call.arguments.r - meta.function-call.name.r # ^^^^ support.function.r #' @param xyz abcde @@ -208,7 +421,7 @@ foo[[bar[1]]] # # issue #1120 sum(x == 1) # ^^^^^^ - variable.parameter.r -# ^^ meta.function-call.r meta.function-call.parameters.r keyword.operator.assignment.r +# ^^ keyword.operator.logical.r function( x = 1, # this should be comment @@ -235,3 +448,9 @@ a[[1, 2]] foo:::bar # ^^^ punctuation.accessor.colons.r + + +foo$update() +# ^ keyword.accessor.dollar.r +# ^^^^^^ meta.function-call.name.r variable.function.r +# ^^^^^^ - support.function.r diff --git a/Rails/Ruby on Rails.sublime-syntax b/Rails/Ruby on Rails.sublime-syntax index 9a7ed6c170..d5e5b11e73 100644 --- a/Rails/Ruby on Rails.sublime-syntax +++ b/Rails/Ruby on Rails.sublime-syntax @@ -19,12 +19,113 @@ contexts: early-expressions: # Uses negative lookahead to filter out symbols - - match: '\b(before_(filter|action)|skip_before_(filter|action)|skip_after_(filter|action)|after_(filter|action)|around_(filter|action)|filter|filter_parameter_logging|layout|require_dependency|render|render_action|render_text|render_file|render_template|render_nothing|render_component|render_without_layout|rescue_from|url_for|redirect_to|redirect_to_path|redirect_to_url|respond_to|helper|helper_method|model|observer|serialize|scaffold|verify|hide_action|append_view_path|prepend_view_path|view_paths)(?![?!:])\b' + - match: | + (?x) + \b + ( + before_(filter|action) + | skip_before_(filter|action) + | skip_after_(filter|action) + | after_(filter|action) + | around_(filter|action) + | filter + | filter_parameter_logging + | layout + | require_dependency + | render + | render_action + | render_text + | render_file + | render_template + | render_nothing + | render_component + | render_without_layout + | rescue_from + | url_for + | redirect_to + | redirect_to_path + | redirect_to_url + | respond_to + | helper + | helper_method + | model + | observer + | serialize + | scaffold + | verify + | hide_action + | append_view_path + | prepend_view_path + | view_paths + ) + (?![?!:]) + \b scope: support.function.actionpack.rails # Uses negative lookahead to filter out symbols - - match: '\b(named_scope|default_scope|scope|after_create|after_destroy|after_save|after_update|after_validation|after_validation_on_create|after_validation_on_update|before_create|before_destroy|before_save|before_update|before_validation|before_validation_on_create|before_validation_on_update|composed_of|belongs_to|has_one|has_many|has_and_belongs_to_many|validate|validate_on_create|validates_numericality_of|validate_on_update|validates_acceptance_of|validates_associated|validates_confirmation_of|validates_each|validates_format_of|validates_inclusion_of|validates_exclusion_of|validates_length_of|validates_presence_of|validates_size_of|validates_uniqueness_of|validates|attr_protected|attr_accessible|attr_readonly)(?![?!:])\b' + - match: | + (?x) + \b + ( + named_scope + | default_scope + | scope + | after_create + | after_destroy + | after_save + | after_update + | after_validation + | after_validation_on_create + | after_validation_on_update + | after_rollback + | after_(create_|destroy_|update_)?commit + | before_create + | before_destroy + | before_save + | before_update + | before_validation + | before_validation_on_create + | before_validation_on_update + | composed_of + | belongs_to + | has_one + | has_many + | has_and_belongs_to_many + | validate + | validate_on_create + | validates_numericality_of + | validate_on_update + | validates_acceptance_of + | validates_associated + | validates_confirmation_of + | validates_each + | validates_format_of + | validates_inclusion_of + | validates_exclusion_of + | validates_length_of + | validates_presence_of + | validates_size_of + | validates_uniqueness_of + | validates + | attr_protected + | attr_accessible + | attr_readonly + ) + (?![?!:]) + \b scope: support.function.activerecord.rails - - match: \b(alias_method_chain|alias_attribute|delegate|cattr_accessor|mattr_accessor|class_attribute|returning)\b + - match: | + (?x) + \b + ( + alias_method_chain + | alias_attribute + | delegate + | cattr_accessor + | mattr_accessor + | class_attribute + | returning + ) + \b scope: support.function.activesupport.rails # These expressions match the leading whitespace to properly match the correct diff --git a/Rails/Snippets/$LABEL.sublime-snippet b/Rails/Snippets/$LABEL.sublime-snippet deleted file mode 100644 index 039803136d..0000000000 --- a/Rails/Snippets/$LABEL.sublime-snippet +++ /dev/null @@ -1,6 +0,0 @@ - - - $L - source.yaml - $LABEL - diff --git a/Rails/Snippets/%3C%=-Fixtures_identify(%3Asymbol)-%%3E.sublime-snippet b/Rails/Snippets/%3C%=-Fixtures_identify(%3Asymbol)-%%3E.sublime-snippet deleted file mode 100644 index 6385680082..0000000000 --- a/Rails/Snippets/%3C%=-Fixtures_identify(%3Asymbol)-%%3E.sublime-snippet +++ /dev/null @@ -1,6 +0,0 @@ - - - fi - source.yaml - <%= Fixtures.identify(:symbol) %> - diff --git a/Rails/Snippets/Create-controller-class.sublime-snippet b/Rails/Snippets/Create-controller-class.sublime-snippet index c5cc5cbab8..1165e4fc23 100644 --- a/Rails/Snippets/Create-controller-class.sublime-snippet +++ b/Rails/Snippets/Create-controller-class.sublime-snippet @@ -1,6 +1,6 @@ - + :create]]> aftvoc source.ruby.rails - after_validation_on_create + after_validation on create diff --git a/Rails/Snippets/after_validation_on_update.sublime-snippet b/Rails/Snippets/after_validation_on_update.sublime-snippet index d23e8ff0d5..5a5b767ce9 100644 --- a/Rails/Snippets/after_validation_on_update.sublime-snippet +++ b/Rails/Snippets/after_validation_on_update.sublime-snippet @@ -1,5 +1,5 @@ - + :update]]> aftvou source.ruby.rails after_validation_on_update diff --git a/Rails/Snippets/before_validation_on_create.sublime-snippet b/Rails/Snippets/before_validation_on_create.sublime-snippet index d7f6abfa58..182dd930e7 100644 --- a/Rails/Snippets/before_validation_on_create.sublime-snippet +++ b/Rails/Snippets/before_validation_on_create.sublime-snippet @@ -1,6 +1,6 @@ - + :create]]> befvoc source.ruby.rails - before_validation_on_create + before_validation on create diff --git a/Rails/Snippets/before_validation_on_update.sublime-snippet b/Rails/Snippets/before_validation_on_update.sublime-snippet index 98ef4eb26c..0097746692 100644 --- a/Rails/Snippets/before_validation_on_update.sublime-snippet +++ b/Rails/Snippets/before_validation_on_update.sublime-snippet @@ -1,6 +1,6 @@ - + :update]]> befvou source.ruby.rails - before_validation_on_update + before_validation on update diff --git a/Rails/syntax_test_rails.rb b/Rails/syntax_test_rails.rb index 9c49e71a9e..f0c69767ad 100644 --- a/Rails/syntax_test_rails.rb +++ b/Rails/syntax_test_rails.rb @@ -1,7 +1,7 @@ # SYNTAX TEST "Packages/Rails/Ruby on Rails.sublime-syntax" class ApplicationController < ApplicationController -# <- keyword.control.class +# <- storage.type.class # ^ entity.name.class # ^ punctuation.separator # ^ entity.other.inherited-class @@ -24,4 +24,12 @@ def find_model end end +class PictureFile < ApplicationRecord + after_commit :delete_picture_file_from_disk, on: :destroy +# ^ support.function.activerecord.rails + + after_destroy_commit :delete_picture_file_from_disk +# ^ support.function.activerecord.rails +end + # <- source.ruby.rails diff --git a/RestructuredText/reStructuredText.sublime-syntax b/RestructuredText/reStructuredText.sublime-syntax index 3c9e031a2b..eed343134a 100644 --- a/RestructuredText/reStructuredText.sublime-syntax +++ b/RestructuredText/reStructuredText.sublime-syntax @@ -9,44 +9,42 @@ file_extensions: scope: text.restructuredtext contexts: main: - - match: '^([ \t]*)(?=\S)' + - match: '^(?=(\s*)\S)' push: - meta_content_scope: meta.paragraph.restructuredtext - match: ^(?!\1(?=\S)) pop: true - include: inline inline: - - match: '^([ \t]*)((\.\.)\sraw(::)) html' + - match: '^(\s*)((\.\.)\s+raw(::)) html' comment: directives.html captures: 2: meta.directive.restructuredtext 3: punctuation.definition.directive.restructuredtext 4: punctuation.separator.key-value.restructuredtext push: - - match: '^(?!\1[ \t])' - captures: - 2: meta.directive.restructuredtext - 3: punctuation.definition.directive.restructuredtext - 4: punctuation.separator.key-value.restructuredtext + - match: '^(?!\1\s+)(?=\s*\S+)' pop: true + - meta_content_scope: text.html.basic - include: scope:text.html.basic - - match: '(\.\.)\s[A-z][A-z0-9-_]+(::)\s*$' + - match: '^(\s*)((\.\.)\s+[A-z][A-z0-9\-_]+(::))\s*' comment: directives - scope: meta.other.directive.restructuredtext captures: - 1: punctuation.definition.directive.restructuredtext - 2: punctuation.separator.key-value.restructuredtext - - match: '^([ \t]*).*?((::))' + 2: meta.other.directive.restructuredtext + 3: punctuation.definition.directive.restructuredtext + 4: punctuation.separator.key-value.restructuredtext + push: + - match: '^(?!\1\s+)(?=\s*\S+)' + pop: true + - include: inline + - match: '^(\s*).*?((::))' comment: verbatim blocks captures: 2: markup.raw.restructuredtext 3: punctuation.definition.raw.restructuredtext push: - meta_scope: meta.raw.block.restructuredtext - - match: '^(?=\1[^\s]+)' - captures: - 2: markup.raw.restructuredtext - 3: punctuation.definition.raw.restructuredtext + - match: '^(?!\1\s+)(?=\s*\S+)' pop: true - match: .+ scope: markup.raw.restructuredtext @@ -190,11 +188,11 @@ contexts: scope: markup.heading.restructuredtext captures: 1: punctuation.definition.heading.restructuredtext - - match: ^(\.\.) + - match: ^(\s*)(\.\.) comment: comment captures: - 1: punctuation.definition.comment.restructuredtext + 2: punctuation.definition.comment.restructuredtext push: - meta_scope: comment.line.double-dot.restructuredtext - - match: '^(?=\S)' + - match: '^(?!\1\s+)(?=\s*\S+)' pop: true diff --git a/RestructuredText/syntax_test_restructuredtext.rst b/RestructuredText/syntax_test_restructuredtext.rst index 7c872d9a7e..2fbdf32d56 100644 --- a/RestructuredText/syntax_test_restructuredtext.rst +++ b/RestructuredText/syntax_test_restructuredtext.rst @@ -13,6 +13,13 @@ .. a multi-line comment ends at the first character in the first column +This is not a comment +.. <- meta.paragraph.restructuredtext + +.. multi line comments can contain blank lines. + + These are still part of the comment if they're indented. +.. <- comment.line.double-dot.restructuredtext Some text .. <- meta.paragraph.restructuredtext @@ -60,3 +67,71 @@ This is *italic*. this is **bold**. .. ^^^^^^^^ markup.bold.restructuredtext + + +Directive tests +-------------- + +.. note that comments within multiline directives must be indented, else they + convert the contents of that directive into a comment + +.. note:: Single line note +.. <- punctuation.definition.directive.restructuredtext +.. ^^^^ meta.other.directive.restructuredtext +.. ^^ punctuation.separator.key-value.restructuredtext + +.. note:: + .. ^^^^ meta.other.directive.restructuredtext + .. ^^ punctuation.separator.key-value.restructuredtext + + Outer note + + .. note:: Inner single line note + .. <- punctuation.definition.directive.restructuredtext + .. ^^^^ meta.other.directive.restructuredtext + .. ^^ punctuation.separator.key-value.restructuredtext + + +Verbatim tests +-------------- + +:: + + Verbatim +.. ^^^^^^^^ meta.raw.block.restructuredtext + +Can start with other text:: + + Verbatim +.. ^^^^^^^^ meta.raw.block.restructuredtext + +.. blank lines should not cause scopes to be left + +:: + + Verbatim + + Also Verbatim +.. ^^^^^^^^^^^^^ meta.raw.block.restructuredtext + +:: + + Verbatim + + Also Verbatim +.. ^^^^^^^^^^^^^ meta.raw.block.restructuredtext + + +:: + + Verbatim + +Not verbatim +.. <- meta.paragraph.restructuredtext + +.. raw:: html + + Blank lines are fine + + +.. ^^^^ text.html.basic \ No newline at end of file diff --git a/Ruby/Ruby.sublime-syntax b/Ruby/Ruby.sublime-syntax index 77e2f35a9a..7475862dd1 100644 --- a/Ruby/Ruby.sublime-syntax +++ b/Ruby/Ruby.sublime-syntax @@ -17,21 +17,6 @@ name: Ruby # • Nested heredocs are not really supportable at present # # text: -# print <<-'THERE' -# This is single quoted. -# The above used #{Time.now} -# THERE -# symtoms: -# From Programming Ruby p306; should be a non-interpolated heredoc. -# -# text: -# "a\332a" -# symptoms: -# '\332' is not recognized as slash3.. which should be octal 332. -# solution: -# plain regexp.. should be easy. -# -# text: # val?(a):p(b) # val?'a':'b' # symptoms: @@ -74,9 +59,24 @@ file_extensions: - thor - Thorfile - Vagrantfile -first_line_match: ^#!\s*/.*\bj?ruby\b +first_line_match: |- + (?xi: + ^\#! .* \bj?ruby\b | # shebang + ^\# \s* -\*- [^*]* ruby [^*]* -\*- # editorconfig + ) scope: source.ruby variables: + bdigits: (?:[01]+(?:_[01]+)*) + ddigits: (?:\d+(?:_\d+)*) + hdigits: (?:\h+(?:_\h+)*) + odigits: (?:[0-7]+(?:_[0-7]+)*) + exponent: (?:[Ee][-+]?{{ddigits}}) + heredoc_type_css: (?:[[:upper:]_]_)?CSS + heredoc_type_html: (?:[[:upper:]_]_)?HTML + heredoc_type_js: (?:[[:upper:]_]_)?(?:JS|JAVASCRIPT) + heredoc_type_ruby: (?:[[:upper:]_]_)?RUBY + heredoc_type_shell: (?:[[:upper:]_]_)?(?:SH|SHELL) + heredoc_type_sql: (?:[[:upper:]_]_)?SQL identifier: '\b[[:alpha:]_][[:alnum:]_]*\b' method_punctuation: '(?:[?!]|=(?![>=]))?' method_name: '{{identifier}}{{method_punctuation}}' @@ -87,9 +87,9 @@ contexts: - include: expressions expressions: + - include: constants - include: class - include: module - - include: constants - include: invalid - include: blocks - include: keywords @@ -100,33 +100,36 @@ contexts: - include: comments - include: data-section - include: heredocs + - include: punctuation - include: operators - include: identifiers-accessors comments: # multiline comments - match: ^=begin - scope: punctuation.definition.comment.ruby + scope: punctuation.definition.comment.begin.ruby push: - meta_scope: comment.block.documentation.ruby - match: ^=end - scope: punctuation.definition.comment.ruby + scope: punctuation.definition.comment.end.ruby + pop: true + - match: \#+ + scope: punctuation.definition.comment.ruby + push: + - meta_scope: comment.line.number-sign.ruby + - match: \n pop: true - - match: '(#).*$\n?' - scope: comment.line.number-sign.ruby - captures: - 1: punctuation.definition.comment.ruby class: # Defining a class method - - match: \b(class)\b(?=\s*<) - scope: keyword.control.class.ruby - - match: '\b(class)\b' - scope: meta.class.ruby keyword.control.class.ruby + - match: \bclass\b(?=\s*<) + scope: storage.type.class.ruby keyword.declaration.class.ruby + - match: \bclass\b + scope: storage.type.class.ruby keyword.declaration.class.ruby push: class-declaration class-declaration: - - meta_content_scope: meta.class.ruby + - meta_scope: meta.class.ruby - match: '(?={{path_lookahead}})' set: class-name # Escape if no valid match @@ -159,15 +162,15 @@ contexts: pop: true module: - - match: \b(module)\b - scope: meta.module.ruby keyword.control.module.ruby + - match: \bmodule\b + scope: storage.type.namespace.ruby keyword.declaration.namespace.ruby push: module-declaration module-declaration: - - meta_content_scope: meta.module.ruby + - meta_scope: meta.namespace.ruby - match: '(?=(::)?({{identifier}}::)*{{identifier}})' set: - - meta_content_scope: meta.module.ruby entity.name.module.ruby + - meta_content_scope: meta.namespace.ruby entity.name.namespace.ruby - include: name-parts - match: '' pop: true @@ -176,14 +179,11 @@ contexts: pop: true name-parts: - - match: '::' - scope: punctuation.accessor.ruby - - match: '\.' - scope: punctuation.accessor.ruby - - match: '({{identifier}})(::|\.)' + - match: ({{identifier}})?(?:(::)|(\.)) captures: 1: support.other.namespace.ruby - 2: punctuation.accessor.ruby + 2: punctuation.accessor.double-colon.ruby + 3: punctuation.accessor.dot.ruby - match: '{{identifier}}' invalid: @@ -205,12 +205,103 @@ contexts: scope: constant.language.ruby - match: '\b(__(FILE|LINE|ENCODING)__|self)\b(?![?!])' scope: variable.language.ruby - - match: '\b(0[xX]\h(_?\h)*|\d(_?\d)*(\.(?![^[:space:][:digit:]])(_?\d)*)?([eE][-+]?\d(_?\d)*)?|0[bB][01]+)\b' - scope: constant.numeric.ruby + # hexadecimal imaginary numbers: 0xAi, 0xAri + - match: '\b(0[xX]){{hdigits}}(r?i)(r)?\b' + scope: constant.numeric.imaginary.hexadecimal.ruby + captures: + 1: punctuation.definition.numeric.base.ruby + 2: storage.type.numeric.ruby + 3: invalid.illegal.numeric.ruby + # octal imaginary numbers: 0o1i, 0o1ri, 01i, 01ri + - match: '\b(0[oO]?){{odigits}}(r?i)(r)?\b' + scope: constant.numeric.imaginary.octal.ruby + captures: + 1: punctuation.definition.numeric.base.ruby + 2: storage.type.numeric.ruby + 3: invalid.illegal.numeric.ruby + # binary imaginary numbers: 0b1i, 0b1ri + - match: '\b(0[bB]){{bdigits}}(r?i)(r)?\b' + scope: constant.numeric.imaginary.binary.ruby + captures: + 1: punctuation.definition.numeric.base.ruby + 2: storage.type.numeric.ruby + 3: invalid.illegal.numeric.ruby + # decimal imaginary numbers: 0d1i, 0d1ri, 1i, 1ri, 1.1i, 1.1ri, 1e1i, 1.1e1i + - match: |- + \b(?x: + (?: + # 0d1i, 0d1ri, 1i, 1ri | 1.1i, 1.1ri + (?: (0[dD])? {{ddigits}} | {{ddigits}} (\.) {{ddigits}} ) (r?i) + # 1e1i, 1.1e1i + | {{ddigits}} (?: (\.) {{ddigits}} )? {{exponent}} (r)? (i) + ) (r)? + )\b + scope: constant.numeric.imaginary.decimal.ruby + captures: + 1: punctuation.definition.numeric.base.ruby + 2: punctuation.separator.decimal.ruby + 3: storage.type.numeric.ruby + 4: punctuation.separator.decimal.ruby + 5: invalid.illegal.numeric.ruby + 6: storage.type.numeric.ruby + 7: invalid.illegal.numeric.ruby + # hexadecimal rational numbers: 0xAr + - match: '\b(0[xX]){{hdigits}}(r)\b' + scope: constant.numeric.rational.hexadecimal.ruby + captures: + 1: punctuation.definition.numeric.base.ruby + 2: storage.type.numeric.ruby + # octal rational numbers: 0o1r, 01r + - match: '\b(0[oO]?){{odigits}}(r)\b' + scope: constant.numeric.rational.octal.ruby + captures: + 1: punctuation.definition.numeric.base.ruby + 2: storage.type.numeric.ruby + # binary rational numbers: 0b1r + - match: '\b(0[bB]){{bdigits}}(r)\b' + scope: constant.numeric.rational.binary.ruby + captures: + 1: punctuation.definition.numeric.base.ruby + 2: storage.type.numeric.ruby + # decimal rational numbers: 0d1r, 1r, 1.1r + - match: '\b(?:(0[dD])?{{ddigits}}|{{ddigits}}(\.){{ddigits}})(r)\b' + scope: constant.numeric.rational.decimal.ruby + captures: + 1: punctuation.definition.numeric.base.ruby + 2: punctuation.separator.decimal.ruby + 3: storage.type.numeric.ruby + # decimal floating point numbers: 1.1, 1e1, 1.1e1 + - match: '\b{{ddigits}}(?:(\.){{ddigits}}|(?:(\.){{ddigits}})?{{exponent}}(r)?)\b' + scope: constant.numeric.float.decimal.ruby + captures: + 1: punctuation.separator.decimal.ruby + 2: punctuation.separator.decimal.ruby + 3: invalid.illegal.numeric.rational.ruby + # hexadecimal integer numbers: 0xA + - match: '\b(0[xX]){{hdigits}}\b' + scope: constant.numeric.integer.hexadecimal.ruby + captures: + 1: punctuation.definition.numeric.base.ruby + # octal integer numbers: 0o1, 01 + - match: '\b(0[oO]?){{odigits}}\b' + scope: constant.numeric.integer.octal.ruby + captures: + 1: punctuation.definition.numeric.base.ruby + # binary integer numbers: 0b1 + - match: '\b(0[bB]){{bdigits}}\b' + scope: constant.numeric.integer.binary.ruby + captures: + 1: punctuation.definition.numeric.base.ruby + # decimal integer numbers: 0d1, 1 + - match: '\b(0[dD])?{{ddigits}}\b' + scope: constant.numeric.integer.decimal.ruby + captures: + 1: punctuation.definition.numeric.base.ruby + # Quoted symbols - match: ":'" scope: punctuation.definition.constant.ruby push: - - meta_scope: constant.other.symbol.single-quoted.ruby + - meta_scope: meta.constant.ruby constant.other.symbol.single-quoted.ruby - match: "'" scope: punctuation.definition.constant.ruby pop: true @@ -219,7 +310,7 @@ contexts: - match: ':"' scope: punctuation.definition.constant.ruby push: - - meta_scope: constant.other.symbol.double-quoted.ruby + - meta_scope: meta.constant.ruby constant.other.symbol.double-quoted.ruby - match: '"' scope: punctuation.definition.constant.ruby pop: true @@ -246,34 +337,56 @@ contexts: scope: constant.other.symbol.ruby captures: 1: punctuation.definition.constant.ruby - # matches questionmark-letters. - # - # examples (1st alternation = hex): - # ?\x1 ?\x61 - # - # examples (2nd alternation = octal): - # ?\0 ?\07 ?\017 - # - # examples (3rd alternation = escaped): - # ?\n ?\b - # - # examples (4th alternation = meta-ctrl): - # ?\C-a ?\M-a ?\C-\M-\C-\M-a - # - # examples (4th alternation = normal): - # ?a ?A ?0 - # ?* ?" ?( - # ?. ?# - # - # the negative lookbehind prevents against matching - # p(42.tainted?) - - match: '\?(\\(x\h{1,2}\b|0[0-7]{0,2}\b|[^x0MC]\b)|(\\[MC]-)+\w\b|[a-zA-Z0-9_]\b(?!\s*:)|[^a-zA-Z0-9_\s\\])' - scope: constant.numeric.ruby + # questionmark literals + - match: ((\?)\\u)(\{) + captures: + 1: constant.character.ruby + 2: punctuation.definition.constant.ruby + 3: meta.braces.ruby punctuation.section.braces.begin.ruby + push: + - meta_scope: meta.constant.ruby + - meta_content_scope: meta.braces.ruby + - match: \} + scope: meta.braces.ruby punctuation.section.braces.end.ruby + pop: true + - match: \h{0,6} + scope: constant.numeric.integer.hexadecimal.ruby + - match: \S + scope: invalid.illegal.escape.ruby + - match: |- + (?x: (\?)(?: + # examples (meta control sequences): + # ?\C-a ?\M-a ?\M-\C-a ?\ca ?\M-ca + (?:\\(?:[MC]-|c)){1,2}[[:ascii:]] | + \\(?: + # examples (hex): + # ?\x1 ?\x61 + x\h{1,2}\b | + # examples (octal): + # ?\0 ?\07 ?\017 + 0[0-7]{0,2}\b | + # examples (escaped): + # ?\n ?\b ?\\ + .(?!\w) + ) | + # examples (illegal): + # ?abc ?\xAG ?\\n + # ?_a0 + ([[:alpha:]_\\]\S+)\b(?!\s*:) | + # examples (normal): + # ?a ?A ?0 + # ?* ?" ?( + # ?. ?# ?\ + [[:alnum:]_]\b(?!\s*:) | [^[:alnum:]_\s] + ) ) + scope: constant.character.ruby + captures: + 1: punctuation.definition.constant.ruby + 2: invalid.illegal.character.ruby blocks: - - match: \b(do)\b\s* - captures: - 1: keyword.control.start-block.ruby + - match: \bdo\b + scope: keyword.control.block.do.ruby push: maybe-block-parameters - match: \{ scope: punctuation.section.scope.ruby @@ -312,92 +425,163 @@ contexts: - include: expressions keywords: - - match: '\b(BEGIN|END)\b(?![?!])' - scope: keyword.control.ruby - - match: '\b(class|module)\b(?![?!])' - scope: keyword.control.ruby - - match: '\b(begin|end|ensure|rescue)\b(?![?!])' - scope: keyword.control.ruby - - match: '\b(case|else|ensure|for|in|then)\b(?![?!])' - scope: keyword.control.ruby - - match: '\b(elsif|if|unless|when|while|until)\b(?![?!])' - scope: keyword.control.ruby + # blocks + - match: \bbegin\b(?![?!]) + scope: keyword.control.block.begin.ruby + push: after-keyword + - match: \bend\b(?![?!]) + scope: keyword.control.block.end.ruby + # conditional + - match: \bcase\b(?![?!]) + scope: keyword.control.conditional.case.ruby + push: after-keyword + - match: \belse\b(?![?!]) + scope: keyword.control.conditional.if.ruby + push: after-keyword + - match: \belsif\b(?![?!]) + scope: keyword.control.conditional.elseif.ruby + push: after-keyword + - match: \bif\b(?![?!]) + scope: keyword.control.conditional.if.ruby + push: after-keyword + - match: \bthen\b(?![?!]) + scope: keyword.control.conditional.then.ruby + - match: \bunless\b(?![?!]) + scope: keyword.control.conditional.unless.ruby + push: after-keyword + - match: \bwhen\b(?![?!]) + scope: keyword.control.conditional.when.ruby + push: after-keyword + # exception + - match: \bensure\b(?![?!]) + scope: keyword.control.exception.ensure.ruby + push: after-keyword + - match: \brescue\b(?![?!]) + scope: keyword.control.exception.rescue.ruby + push: after-keyword + # loop + - match: \bfor\b(?![?!]) + scope: keyword.control.loop.for.ruby push: after-keyword - - match: \b(and|not|or)\b + - match: \buntil\b(?![?!]) + scope: keyword.control.loop.until.ruby + push: after-keyword + - match: \bwhile\b(?![?!]) + scope: keyword.control.loop.while.ruby + push: after-keyword + # flow + - match: \bbreak\b(?![?!]) + scope: keyword.control.flow.break.ruby + - match: \bnext\b(?![?!]) + scope: keyword.control.flow.next.ruby + - match: \bredo\b(?![?!]) + scope: keyword.control.flow.redo.ruby + - match: \bretry\b(?![?!]) + scope: keyword.control.flow.retry.ruby + - match: \breturn\b(?![?!]) + scope: keyword.control.flow.return.ruby + - match: \byield\b(?![?!]) + scope: keyword.control.flow.yield.ruby + # declarations + - match: \b(?:alias|alias_method)\b(?![?!]) + scope: keyword.declaration.alias.ruby + push: after-keyword + - match: \bundef\b(?![?!]) + scope: keyword.declaration.undef.ruby + push: after-keyword + # operators + - match: \b(?:and|not|or)\b scope: keyword.operator.logical.ruby push: after-keyword - - match: '!+|&&|\|\||\^' + - match: \bin\b(?![?!]) scope: keyword.operator.logical.ruby - push: after-operator - - match: '\b(alias|alias_method|break|next|redo|retry|return|super|undef|yield)\b(?![?!])|\bdefined\?|\bblock_given\?' - scope: keyword.control.pseudo-method.ruby + push: after-keyword + # other functions + - match: \b(?:BEGIN|END)\b(?![?!]) + scope: entity.name.function.prepocessor.ruby + - match: \b(?:defined|block_given)\? + scope: support.function.builtin.ruby + push: after-keyword + - match: \bsuper\b(?![?!]) + scope: support.function.builtin.ruby + push: after-keyword operators: - - match: '=>' - scope: punctuation.separator.key-value.ruby + - match: '>>' + scope: keyword.operator.other.ruby push: after-operator - - match: '<<=|%=|&=|\*=|\*\*=|\+=|\-=|\^=|\|{1,2}=|<<' + # note: `/=` is matched in the `regexes` context + - match: <<=|&&=|\|\|=|\*\*=|[-+*&|^]=|<< scope: keyword.operator.assignment.augmented.ruby push: after-operator - - match: '<=>|<(?!<|=)|>(?!<|=|>)|<=|>=|===|==|=~|!=|!~' + - match: <=>|===|<=|>=|==|=~|!=|!~|<|> scope: keyword.operator.comparison.ruby push: after-operator - - match: (%|&|\*\*|\*|\+|\-|/) + - match: \*\*|[-+*/%] scope: keyword.operator.arithmetic.ruby push: after-operator - - match: '=' + - match: = scope: keyword.operator.assignment.ruby push: after-operator - - match: \||~|>> - scope: keyword.operator.other.ruby + - match: '!+|&&|\|\|' + scope: keyword.operator.logical.ruby + push: after-operator + - match: '[~&|^]' + scope: keyword.operator.bitwise.ruby push: after-operator - match: \? scope: keyword.operator.conditional.ruby push: # Handle hash-key-lookalike of identifier: in ternary - - match: '\s*{{identifier}}(:)(?!:)' + - match: \s*{{identifier}}(:)(?!:) captures: 1: keyword.operator.conditional.ruby + set: after-operator - include: after-operator - - match: ':(?!:)' + - match: :(?!:) scope: keyword.operator.conditional.ruby push: after-operator - - match: \; - scope: punctuation.terminator.statement.ruby + - match: \.\.\.? + scope: keyword.operator.range.ruby push: after-operator - - match: "," - scope: punctuation.separator.ruby + + punctuation: + - match: => + scope: punctuation.separator.key-value.ruby push: after-operator - - match: '\[' + - match: ',' + scope: punctuation.separator.sequence.ruby + push: after-operator + - match: ; + scope: punctuation.terminator.statement.ruby + push: after-operator + - match: \[ scope: punctuation.section.array.ruby push: after-operator - match: \( scope: punctuation.definition.group.begin.ruby push: after-operator # Opening { is handled by "block" context to try and detect parameters - - match: '\}' + - match: \} scope: punctuation.section.scope.ruby - - match: '\]' + - match: \] scope: punctuation.section.array.ruby - match: \) scope: punctuation.definition.group.end.ruby - - match: '\.\.\.?' - scope: keyword.operator.ruby - push: after-operator identifiers-accessors: # This consumes class/module access to prevent issues parsing : as part # of a ternary operator - - match: '(::)(?={{identifier}}{{method_punctuation}})' - scope: punctuation.accessor.ruby + - match: ::(?={{identifier}}{{method_punctuation}}) + scope: punctuation.accessor.double-colon.ruby push: - include: well-known-methods - match: '{{identifier}}{{method_punctuation}}' - match: '' set: after-identifier # This consumes attribute access so we don't need a lookbehind for . - - match: '(\.)(?={{identifier}}{{method_punctuation}})' - scope: punctuation.accessor.ruby + - match: \.(?={{identifier}}{{method_punctuation}}) + scope: punctuation.accessor.dot.ruby push: - include: well-known-methods - match: '{{identifier}}{{method_punctuation}}' @@ -407,8 +591,10 @@ contexts: - match: '{{identifier}}{{method_punctuation}}' # This consumes module/class accessor so we don't need a lookbehind for :: push: after-identifier - - match: '::|\.' - scope: punctuation.accessor.ruby + - match: \. + scope: punctuation.accessor.dot.ruby + - match: '::' + scope: punctuation.accessor.double-colon.ruby after-identifier: # Handles a : right after an identifier. In this case it can't be the @@ -446,22 +632,33 @@ contexts: - include: expressions - match: '(::)?(\b[[:upper:]]\w*)(?=((\.|::)[[:alpha:]_]|\[))' captures: - 1: punctuation.accessor.ruby + 1: punctuation.accessor.double-colon.ruby 2: support.class.ruby - match: '\b[[:upper:]]\w*\b' scope: variable.other.constant.ruby well-known-methods: - - match: '\b(initialize|new|loop|include|extend|prepend|raise|fail|attr_reader|attr_writer|attr_accessor|attr|catch|throw|module_function|public|protected|private)\b(?![?!])' + # exceptions + - match: \bcatch\b(?![?!]) + scope: keyword.control.exception.catch.ruby + push: function-call-arguments + # flow + - match: \b(?:fail|raise|throw)\b(?![?!]) + scope: keyword.control.flow.throw.ruby + push: function-call-arguments + # loop + - match: \bloop\b(?![?!]) + scope: keyword.control.loop.loop.ruby + push: function-call-arguments + # other + - match: \b(initialize|new|include|extend|prepend|attr_reader|attr_writer|attr_accessor|attr|module_function|public|protected|private)\b(?![?!]) scope: keyword.other.special-method.ruby + push: function-call-arguments - match: \b(require|require_relative|gem)\b - captures: - 1: keyword.other.special-method.ruby + scope: keyword.control.import.ruby push: - meta_scope: meta.require.ruby - - match: $|(?=#) - captures: - 1: keyword.other.special-method.ruby + - match: $|(?=[#}]) pop: true - include: expressions # Conversion methods @@ -487,25 +684,29 @@ contexts: (?![!?=]) ) scope: support.function.builtin.ruby + push: function-call-arguments # Methods that may be followed by a regex - match: |- (?x: \b( - gsub!| - sub! - )(?=\s) + gsub| + sub + )(!|\b) + | + \b( + match + )(\?|\b) | \b( assert_match| - gsub| + assert_no_match| index| - match| - scan| - sub - )\b + rindex| + scan + )\b(?![!?=]) ) scope: support.function.builtin.ruby - push: try-regex + push: function-call-arguments # Methods from the Object class not handled elsewhere, ending in punctuation - match: |- (?x: @@ -523,6 +724,7 @@ contexts: ) ) scope: support.function.builtin.ruby + push: function-call-arguments # Methods from the Object class not handled elsewhere - match: |- (?x: @@ -564,7 +766,7 @@ contexts: (?![!?=]) ) scope: support.function.builtin.ruby - + push: function-call-arguments # Methods from the Kernel class not handled elsewhere, ending in punctuation - match: |- (?x: @@ -575,6 +777,7 @@ contexts: ) ) scope: support.function.builtin.ruby + push: function-call-arguments # Methods from the Kernel class not handled elsewhere - match: |- (?x: @@ -639,6 +842,7 @@ contexts: (?![!?=]) ) scope: support.function.builtin.ruby + push: function-call-arguments # Methods from the Kernel class not handled elsewhere, ending in punctuation - match: |- (?x: @@ -655,6 +859,7 @@ contexts: ) ) scope: support.function.builtin.ruby + push: function-call-arguments # Methods from the Module class not handled elsewhere - match: |- (?x: @@ -703,26 +908,31 @@ contexts: (?![!?=]) ) scope: support.function.builtin.ruby + push: function-call-arguments + + function-call-arguments: + - include: try-regex method: - - match: \b(def)\b - scope: meta.function.ruby keyword.control.def.ruby + - match: \bdef\b + scope: meta.function.ruby storage.type.function.ruby keyword.declaration.function.ruby push: - meta_content_scope: meta.function.ruby - match: '(self)(\.)({{identifier}}{{method_punctuation}}|===?|>[>=]?|<=>|<[<=]?|[%&`/\|]|\*\*?|=?~|[-+]@?|\[\]=?)' captures: 1: variable.language.ruby - 2: punctuation.accessor.ruby + 2: punctuation.accessor.dot.ruby 3: entity.name.function.ruby set: method-parameters-start - match: '===?|>[>=]?|<=>|<[<=]?|[%&`/\|]|\*\*?|=?~|[-+]@?|\[\]=?' scope: entity.name.function.ruby set: method-parameters-start - - match: '(?:({{identifier}})(::|\.))?{{identifier}}{{method_punctuation}}' + - match: '(?:({{identifier}})(?:(::)|(\.)))?{{identifier}}{{method_punctuation}}' scope: entity.name.function.ruby captures: 1: support.other.namespace.ruby - 2: punctuation.accessor.ruby + 2: punctuation.accessor.double-colon.ruby + 3: punctuation.accessor.dot.ruby set: method-parameters-start - match: '$' pop: true @@ -844,7 +1054,7 @@ contexts: - match: "'" scope: punctuation.definition.string.begin.ruby push: - - meta_scope: string.quoted.single.ruby + - meta_scope: meta.string.ruby string.quoted.single.ruby - match: "'" scope: punctuation.definition.string.end.ruby pop: true @@ -855,7 +1065,7 @@ contexts: - match: '"' scope: punctuation.definition.string.begin.ruby push: - - meta_scope: string.quoted.double.ruby + - meta_scope: meta.string.ruby string.quoted.double.ruby - match: '"' scope: punctuation.definition.string.end.ruby pop: true @@ -866,7 +1076,7 @@ contexts: - match: "`" scope: punctuation.definition.string.begin.ruby push: - - meta_scope: string.interpolated.ruby + - meta_scope: meta.string.ruby string.interpolated.ruby - match: "`" scope: punctuation.definition.string.end.ruby pop: true @@ -876,7 +1086,7 @@ contexts: - match: '%x\{' scope: punctuation.definition.string.begin.ruby push: - - meta_scope: string.interpolated.ruby + - meta_scope: meta.string.ruby string.interpolated.ruby - match: '\}' scope: punctuation.definition.string.end.ruby pop: true @@ -887,7 +1097,7 @@ contexts: - match: '%x\[' scope: punctuation.definition.string.begin.ruby push: - - meta_scope: string.interpolated.ruby + - meta_scope: meta.string.ruby string.interpolated.ruby - match: '\]' scope: punctuation.definition.string.end.ruby pop: true @@ -898,7 +1108,7 @@ contexts: - match: '%x\<' scope: punctuation.definition.string.begin.ruby push: - - meta_scope: string.interpolated.ruby + - meta_scope: meta.string.ruby string.interpolated.ruby - match: \> scope: punctuation.definition.string.end.ruby pop: true @@ -909,7 +1119,7 @@ contexts: - match: '%x\(' scope: punctuation.definition.string.begin.ruby push: - - meta_scope: string.interpolated.ruby + - meta_scope: meta.string.ruby string.interpolated.ruby - match: \) scope: punctuation.definition.string.end.ruby pop: true @@ -920,7 +1130,7 @@ contexts: - match: '%x([^\w])' scope: punctuation.definition.string.begin.ruby push: - - meta_scope: string.interpolated.ruby + - meta_scope: meta.string.ruby string.interpolated.ruby - match: \1 scope: punctuation.definition.string.end.ruby pop: true @@ -932,7 +1142,7 @@ contexts: - match: '%[QWI]?\(' scope: punctuation.definition.string.begin.ruby push: - - meta_scope: string.quoted.other.literal.upper.ruby + - meta_scope: meta.string.ruby string.quoted.other.literal.upper.ruby - match: \) scope: punctuation.definition.string.end.ruby pop: true @@ -943,7 +1153,7 @@ contexts: - match: '%[QWI]?\[' scope: punctuation.definition.string.begin.ruby push: - - meta_scope: string.quoted.other.literal.upper.ruby + - meta_scope: meta.string.ruby string.quoted.other.literal.upper.ruby - match: '\]' scope: punctuation.definition.string.end.ruby pop: true @@ -954,7 +1164,7 @@ contexts: - match: '%[QWI]?\<' scope: punctuation.definition.string.begin.ruby push: - - meta_scope: string.quoted.other.literal.upper.ruby + - meta_scope: meta.string.ruby string.quoted.other.literal.upper.ruby - match: \> scope: punctuation.definition.string.end.ruby pop: true @@ -965,7 +1175,7 @@ contexts: - match: '%[QWI]?\{' scope: punctuation.definition.string.begin.ruby push: - - meta_scope: string.quoted.double.ruby.mod + - meta_scope: meta.string.ruby string.quoted.double.ruby.mod - match: '\}' scope: punctuation.definition.string.end.ruby pop: true @@ -976,7 +1186,7 @@ contexts: - match: '%[QWI]([^\w])' scope: punctuation.definition.string.begin.ruby push: - - meta_scope: string.quoted.other.literal.upper.ruby + - meta_scope: meta.string.ruby string.quoted.other.literal.upper.ruby - match: \1 scope: punctuation.definition.string.end.ruby pop: true @@ -986,7 +1196,7 @@ contexts: - match: '%([^\w\s=])' scope: punctuation.definition.string.begin.ruby push: - - meta_scope: string.quoted.other.literal.other.ruby + - meta_scope: meta.string.ruby string.quoted.other.literal.other.ruby - match: \1 scope: punctuation.definition.string.end.ruby pop: true @@ -996,7 +1206,7 @@ contexts: - match: '%[qwsi]\(' scope: punctuation.definition.string.begin.ruby push: - - meta_scope: string.quoted.other.literal.lower.ruby + - meta_scope: meta.string.ruby string.quoted.other.literal.lower.ruby - match: \) scope: punctuation.definition.string.end.ruby pop: true @@ -1007,7 +1217,7 @@ contexts: - match: '%[qwsi]\<' scope: punctuation.definition.string.begin.ruby push: - - meta_scope: string.quoted.other.literal.lower.ruby + - meta_scope: meta.string.ruby string.quoted.other.literal.lower.ruby - match: \> scope: punctuation.definition.string.end.ruby pop: true @@ -1018,7 +1228,7 @@ contexts: - match: '%[qwsi]\[' scope: punctuation.definition.string.begin.ruby push: - - meta_scope: string.quoted.other.literal.lower.ruby + - meta_scope: meta.string.ruby string.quoted.other.literal.lower.ruby - match: '\]' scope: punctuation.definition.string.end.ruby pop: true @@ -1029,7 +1239,7 @@ contexts: - match: '%[qwsi]\{' scope: punctuation.definition.string.begin.ruby push: - - meta_scope: string.quoted.other.literal.lower.ruby + - meta_scope: meta.string.ruby string.quoted.other.literal.lower.ruby - match: '\}' scope: punctuation.definition.string.end.ruby pop: true @@ -1040,7 +1250,7 @@ contexts: - match: '%[qwsi]([^\w])' scope: punctuation.definition.string.begin.ruby push: - - meta_scope: string.quoted.other.literal.lower.ruby + - meta_scope: meta.string.ruby string.quoted.other.literal.lower.ruby - match: \1 scope: punctuation.definition.string.end.ruby pop: true @@ -1056,15 +1266,14 @@ contexts: try-regex: # Generally for multiline regexes, one of the %r forms below will be used, # so we bail out if we can't find a second / on the current line - - match: '\s*(/)(?![*+{}?])(?=.*/)' + - match: \s*(/)(?=(?!=).*/) captures: - 1: string.regexp.classic.ruby punctuation.definition.string.ruby + 1: punctuation.definition.string.begin.ruby push: - - meta_content_scope: string.regexp.classic.ruby - - match: "(/)([eimnosux]*)" - scope: string.regexp.classic.ruby + - meta_scope: meta.string.regexp.ruby string.regexp.classic.ruby + - match: (/)([eimnosux]*) captures: - 1: punctuation.definition.string.ruby + 1: punctuation.definition.string.end.ruby 2: keyword.other.ruby pop: true - include: regex-sub @@ -1083,7 +1292,7 @@ contexts: - match: '%r\{' scope: punctuation.definition.string.begin.ruby push: - - meta_scope: string.regexp.mod-r.ruby + - meta_scope: meta.string.ruby string.regexp.mod-r.ruby - match: '\}[eimnosux]*' scope: punctuation.definition.string.end.ruby pop: true @@ -1093,7 +1302,7 @@ contexts: - match: '%r\[' scope: punctuation.definition.string.begin.ruby push: - - meta_scope: string.regexp.mod-r.ruby + - meta_scope: meta.string.ruby string.regexp.mod-r.ruby - match: '\][eimnosux]*' scope: punctuation.definition.string.end.ruby pop: true @@ -1103,7 +1312,7 @@ contexts: - match: '%r\(' scope: punctuation.definition.string.begin.ruby push: - - meta_scope: string.regexp.mod-r.ruby + - meta_scope: meta.string.ruby string.regexp.mod-r.ruby - match: '\)[eimnosux]*' scope: punctuation.definition.string.end.ruby pop: true @@ -1113,7 +1322,7 @@ contexts: - match: '%r\<' scope: punctuation.definition.string.begin.ruby push: - - meta_scope: string.regexp.mod-r.ruby + - meta_scope: meta.string.ruby string.regexp.mod-r.ruby - match: '\>[eimnosux]*' scope: punctuation.definition.string.end.ruby pop: true @@ -1123,7 +1332,7 @@ contexts: - match: '%r([^\w])' scope: punctuation.definition.string.begin.ruby push: - - meta_scope: string.regexp.mod-r.ruby + - meta_scope: meta.string.ruby string.regexp.mod-r.ruby - match: '\1[eimnosux]*' scope: punctuation.definition.string.end.ruby pop: true @@ -1133,14 +1342,14 @@ contexts: - include: interpolated-ruby - include: escaped-char - match: '(\{)\d+(,\d+)?(\})' - scope: string.regexp.arbitrary-repetition.ruby + scope: meta.string.ruby string.regexp.arbitrary-repetition.ruby captures: 1: punctuation.definition.arbitrary-repetition.ruby 3: punctuation.definition.arbitrary-repetition.ruby - match: '\[(?:\^?\])?' scope: punctuation.definition.character-class.ruby push: - - meta_scope: string.regexp.character-class.ruby + - meta_scope: meta.string.ruby string.regexp.character-class.ruby - match: '\]' scope: punctuation.definition.character-class.ruby pop: true @@ -1148,7 +1357,7 @@ contexts: - match: \( scope: punctuation.definition.group.ruby push: - - meta_scope: string.regexp.group.ruby + - meta_scope: meta.string.ruby string.regexp.group.ruby - match: \) scope: punctuation.definition.group.ruby pop: true @@ -1249,33 +1458,74 @@ contexts: scope: constant.other.placeholder.ruby escaped-char: - - match: '\\(?:[0-7]{1,3}|x[\da-fA-F]{1,2}|.)' + # SEE: https://ruby-doc.org/core-2.6.3/doc/syntax/literals_rdoc.html + # meta control sequence + - match: (?:\\(?:[MC]-|c)){1,2}[[:ascii:]] + scope: constant.character.escape.ruby + # extended unicode character + - match: \\u\{ + push: + - meta_scope: constant.character.escape.ruby + - match: \} + pop: true + - match: \h{0,6} + - match: \S + scope: invalid.illegal.escape.ruby + # octal, hex, unicode, normal escaped character + - match: \\(?:[0-7]{1,3}|x\h{1,2}|u\h{4}|.) scope: constant.character.escape.ruby interpolated-ruby: - match: '#\{' scope: punctuation.section.interpolation.begin.ruby push: - - clear_scopes: 1 - - meta_scope: meta.interpolation - - meta_content_scope: source.ruby.embedded - - match: '\}' - scope: punctuation.section.interpolation.end.ruby - pop: true - - include: nest-curly-expressions - - include: expressions + - clear_scopes: 1 # remove `string`/`constant` + - meta_scope: meta.interpolation.ruby + - meta_content_scope: source.ruby.embedded.ruby + - include: interpolated-ruby-expressions + - match: '(?=#[@$])' + push: + - clear_scopes: 1 # remove `string`/`constant` + - meta_scope: meta.interpolation.ruby + - include: interpolated-ruby-variables + + interpolated-heredoc-ruby: + - match: '#\{' + scope: punctuation.section.interpolation.begin.ruby + push: + - meta_scope: meta.interpolation.ruby + - meta_content_scope: source.ruby.embedded.ruby + - include: interpolated-ruby-expressions + - match: '(?=#[@$])' + push: + - meta_scope: meta.interpolation.ruby + - include: interpolated-ruby-variables + + interpolated-ruby-expressions: + - match: '\}' + scope: punctuation.section.interpolation.end.ruby + pop: true + - include: nest-curly-expressions + - include: expressions + + interpolated-ruby-variables: - match: '(#@)[[:alpha:]_]\w*' scope: variable.other.readwrite.instance.ruby captures: 1: punctuation.definition.variable.ruby + pop: true - match: '(#@@)[[:alpha:]_]\w*' scope: variable.other.readwrite.class.ruby captures: 1: punctuation.definition.variable.ruby + pop: true - match: '(#\$)[[:alpha:]_]\w*' scope: variable.other.readwrite.global.ruby captures: 1: punctuation.definition.variable.ruby + pop: true + - match: '' + pop: true nest-curly-expressions: - match: '\{' @@ -1357,143 +1607,333 @@ contexts: - include: escaped-char - include: nest-parens-i +###[ HEREDOCS ]################################################################ + heredocs: - # heredoc with embedded HTML and indented terminator - - match: '(<<[-~]"?((?:[_\w]+_|)HTML)\b"?)' - scope: punctuation.definition.string.begin.ruby - push: [heredoc-html, trailing-heredoc-start] - # heredoc with embedded SQL and indented terminator - - match: '(<<[-~]"?((?:[_\w]+_|)SQL)\b"?)' - scope: punctuation.definition.string.begin.ruby - push: [heredoc-sql, trailing-heredoc-start] - # heredoc with embedded css and indented terminator - - match: '(<<[-~]"?((?:[_\w]+_|)CSS)\b"?)' - scope: punctuation.definition.string.begin.ruby - push: [heredoc-css, trailing-heredoc-start] - # heredoc with embedded javascript and indented terminator - - match: '(<<[-~]"?((?:[_\w]+_|)(?:JS|JAVASCRIPT))\b"?)' - scope: punctuation.definition.string.begin.ruby - push: [heredoc-js, trailing-heredoc-start] - # heredoc with embedded ruby and indented terminator - - match: '(<<[-~]"?((?:[_\w]+_|)RUBY)\b"?)' - scope: punctuation.definition.string.begin.ruby - push: [heredoc-ruby, trailing-heredoc-start] - # Escaped to prevent recursion? - # heredoc with embedded shell and indented terminator - # - match: '(<<[-~]("?)((?:[_\w]+_|)(?:SH|SHELL))\b\1)' - # scope: punctuation.definition.string.begin.ruby - # push: [heredoc-shell, trailing-heredoc-start] - - match: (\=)\s*(<<(\w+)) - captures: - 1: keyword.operator.assignment.ruby - 2: punctuation.definition.string.begin.ruby - push: [heredoc-assign, trailing-heredoc-no-embedding-start] - # heredoc with indented terminator - - match: '(<<[-~](\w+))' - scope: punctuation.definition.string.begin.ruby - push: [heredoc-plain, trailing-heredoc-no-embedding-start] + # SEE: https://ruby-doc.org/core-2.5.0/doc/syntax/literals_rdoc.html + - include: heredoc-css + - include: heredoc-js + - include: heredoc-html + - include: heredoc-ruby + - include: heredoc-shell + - include: heredoc-sql + - include: heredoc-plain + + heredoc-css: + - match: <<[-~]["`]?({{heredoc_type_css}})["`]? + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-css-indented-interpolated, trailing-heredoc-start] + - match: <<[-~]'({{heredoc_type_css}})' + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-css-indented-literal, trailing-heredoc-start] + - match: <<["`]?({{heredoc_type_css}})["`]? + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-css-unindented-interpolated, trailing-heredoc-start] + - match: <<'({{heredoc_type_css}})' + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-css-unindented-literal, trailing-heredoc-start] + + heredoc-css-indented-interpolated: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: source.css.embedded.ruby + - include: indented-heredoc-end + - include: interpolated-heredoc-ruby + - include: scope:source.css + - include: escaped-char + + heredoc-css-indented-literal: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: source.css.embedded.ruby + - include: indented-heredoc-end + - include: scope:source.css + + heredoc-css-unindented-interpolated: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: source.css.embedded.ruby + - include: unindented-heredoc-end + - include: scope:source.css + - include: escaped-char + + heredoc-css-unindented-literal: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: source.css.embedded.ruby + - include: unindented-heredoc-end + - include: scope:source.css + + heredoc-js: + - match: <<[-~]["`]?({{heredoc_type_js}})["`]? + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-js-indented-interpolated, trailing-heredoc-start] + - match: <<[-~]'({{heredoc_type_js}})' + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-js-indented-literal, trailing-heredoc-start] + - match: <<["`]?({{heredoc_type_js}})["`]? + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-js-unindented-interpolated, trailing-heredoc-start] + - match: <<'({{heredoc_type_js}})' + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-js-unindented-literal, trailing-heredoc-start] + + heredoc-js-indented-interpolated: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: source.js.embedded.ruby + - include: indented-heredoc-end + - include: interpolated-heredoc-ruby + - include: scope:source.js + - include: escaped-char + + heredoc-js-indented-literal: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: source.js.embedded.ruby + - include: indented-heredoc-end + - include: scope:source.js + + heredoc-js-unindented-interpolated: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: source.js.embedded.ruby + - include: unindented-heredoc-end + - include: scope:source.js + - include: escaped-char + + heredoc-js-unindented-literal: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: source.js.embedded.ruby + - include: unindented-heredoc-end + - include: scope:source.js heredoc-html: - - meta_scope: string.unquoted.embedded.html.ruby + - match: <<[-~]["`]?({{heredoc_type_html}})["`]? + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-html-indented-interpolated, trailing-heredoc-start] + - match: <<[-~]'({{heredoc_type_html}})' + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-html-indented-literal, trailing-heredoc-start] + - match: <<["`]?({{heredoc_type_html}})["`]? + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-html-unindented-interpolated, trailing-heredoc-start] + - match: <<'({{heredoc_type_html}})' + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-html-unindented-literal, trailing-heredoc-start] + + heredoc-html-indented-interpolated: + - meta_scope: meta.string.heredoc.ruby - meta_content_scope: text.html.embedded.ruby - - match: ^\s*\2$ - scope: punctuation.definition.string.end.ruby - pop: true + - include: indented-heredoc-end + - include: interpolated-heredoc-ruby - include: scope:text.html.basic - - include: interpolated-ruby - include: escaped-char - heredoc-sql: - - meta_scope: string.unquoted.embedded.sql.ruby - - meta_content_scope: text.sql.embedded.ruby - - match: ^\s*\2$ - scope: punctuation.definition.string.end.ruby - pop: true - - include: scope:source.sql - - include: interpolated-ruby - - include: escaped-char + heredoc-html-indented-literal: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: text.html.embedded.ruby + - include: indented-heredoc-end + - include: scope:text.html.basic - heredoc-css: - - meta_scope: string.unquoted.embedded.css.ruby - - meta_content_scope: text.css.embedded.ruby - - match: ^\s*\2$ - scope: punctuation.definition.string.end.ruby - pop: true - - include: 'scope:source.css' - - include: interpolated-ruby + heredoc-html-unindented-interpolated: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: text.html.embedded.ruby + - include: unindented-heredoc-end + - include: scope:text.html.basic - include: escaped-char - heredoc-js: - - meta_scope: string.unquoted.embedded.js.ruby - - meta_content_scope: text.js.embedded.ruby - - match: ^\s*\2$ - scope: punctuation.definition.string.end.ruby - pop: true - - include: 'scope:source.js' - - include: interpolated-ruby - - include: escaped-char + heredoc-html-unindented-literal: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: text.html.embedded.ruby + - include: unindented-heredoc-end + - include: scope:text.html.basic heredoc-ruby: - - meta_scope: string.unquoted.embedded.ruby.ruby - - meta_content_scope: text.ruby.embedded.ruby - - match: ^\s*\2$ - scope: punctuation.definition.string.end.ruby - pop: true - - include: interpolated-ruby + - match: <<[-~]["`]?({{heredoc_type_ruby}})["`]? + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-ruby-indented-interpolated, trailing-heredoc-start] + - match: <<[-~]'({{heredoc_type_ruby}})' + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-ruby-indented-literal, trailing-heredoc-start] + - match: <<["`]?({{heredoc_type_ruby}})["`]? + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-ruby-unindented-interpolated, trailing-heredoc-start] + - match: <<'({{heredoc_type_ruby}})' + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-ruby-unindented-literal, trailing-heredoc-start] + + heredoc-ruby-indented-interpolated: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: source.ruby.embedded.ruby + - include: indented-heredoc-end + - include: interpolated-heredoc-ruby - include: escaped-char - include: expressions - #heredoc-shell: - # - meta_scope: string.unquoted.embedded.shell.ruby - # - meta_content_scope: text.shell.embedded.ruby - # - match: ^\s*\2$ - # scope: punctuation.definition.string.end.ruby - # pop: true - # - include: Shell-Unix-Generic.sublime-syntax - # - include: interpolated-ruby - # - include: escaped-char - - # This prevents clear_scopes from applying to the push token - trailing-heredoc-start: - - match: '' - set: trailing-heredoc + heredoc-ruby-indented-literal: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: source.ruby.embedded.ruby + - include: indented-heredoc-end + - include: expressions - trailing-heredoc: - - clear_scopes: 2 - - match: '$' - pop: true + heredoc-ruby-unindented-interpolated: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: source.ruby.embedded.ruby + - include: unindented-heredoc-end + - include: interpolated-heredoc-ruby + - include: escaped-char - include: expressions - heredoc-assign: - - meta_scope: string.unquoted.heredoc.ruby - - match: ^\s*\3$ - scope: punctuation.definition.string.end.ruby - pop: true + heredoc-ruby-unindented-literal: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: source.ruby.embedded.ruby + - include: unindented-heredoc-end + - include: expressions + + heredoc-plain: + - match: <<[-~]["`]?(\w+)["`]? + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-plain-indented-interpolated, trailing-heredoc-start] + - match: <<[-~]'(\w+)' + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-plain-indented-literal, trailing-heredoc-start] + - match: <<["`]?(\w+)["`]? + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-plain-unindented-interpolated, trailing-heredoc-start] + - match: <<'(\w+)' + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-plain-unindented-literal, trailing-heredoc-start] + + heredoc-plain-indented-interpolated: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: string.unquoted.heredoc.ruby + - include: indented-heredoc-end - include: interpolated-ruby - include: escaped-char - heredoc-plain: - - meta_scope: string.unquoted.heredoc.ruby - - match: ^\s*\2$ - scope: punctuation.definition.string.end.ruby - pop: true + heredoc-plain-indented-literal: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: string.unquoted.heredoc.ruby + - include: indented-heredoc-end + + heredoc-plain-unindented-interpolated: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: string.unquoted.heredoc.ruby + - include: unindented-heredoc-end - include: interpolated-ruby - include: escaped-char - # This prevents clear_scopes from applying to the push token - trailing-heredoc-no-embedding-start: + heredoc-plain-unindented-literal: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: string.unquoted.heredoc.ruby + - include: unindented-heredoc-end + + heredoc-shell: + - match: <<[-~]["`]?({{heredoc_type_shell}})["`]? + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-shell-indented-interpolated, trailing-heredoc-start] + - match: <<[-~]'({{heredoc_type_shell}})' + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-shell-indented-literal, trailing-heredoc-start] + - match: <<["`]?({{heredoc_type_shell}})["`]? + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-shell-unindented-interpolated, trailing-heredoc-start] + - match: <<'({{heredoc_type_shell}})' + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-shell-unindented-literal, trailing-heredoc-start] + + heredoc-shell-indented-interpolated: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: source.shell.embedded.ruby + - include: indented-heredoc-end + - include: interpolated-heredoc-ruby + - include: scope:source.shell + - include: escaped-char + + heredoc-shell-indented-literal: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: source.shell.embedded.ruby + - include: indented-heredoc-end + - include: scope:source.shell + + heredoc-shell-unindented-interpolated: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: source.shell.embedded.ruby + - include: unindented-heredoc-end + - include: scope:source.shell + - include: escaped-char + + heredoc-shell-unindented-literal: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: source.shell.embedded.ruby + - include: unindented-heredoc-end + - include: scope:source.shell + + heredoc-sql: + - match: <<[-~]["`]?({{heredoc_type_sql}})["`]? + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-sql-indented-interpolated, trailing-heredoc-start] + - match: <<[-~]'({{heredoc_type_sql}})' + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-sql-indented-literal, trailing-heredoc-start] + - match: <<["`]?({{heredoc_type_sql}})["`]? + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-sql-unindented-interpolated, trailing-heredoc-start] + - match: <<'({{heredoc_type_sql}})' + scope: string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby + push: [heredoc-sql-unindented-literal, trailing-heredoc-start] + + heredoc-sql-indented-interpolated: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: source.sql.embedded.ruby + - include: indented-heredoc-end + - include: interpolated-heredoc-ruby + - include: scope:source.sql + - include: escaped-char + + heredoc-sql-indented-literal: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: source.sql.embedded.ruby + - include: indented-heredoc-end + - include: scope:source.sql + + heredoc-sql-unindented-interpolated: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: source.sql.embedded.ruby + - include: unindented-heredoc-end + - include: scope:source.sql + - include: escaped-char + + heredoc-sql-unindented-literal: + - meta_scope: meta.string.heredoc.ruby + - meta_content_scope: source.sql.embedded.ruby + - include: unindented-heredoc-end + - include: scope:source.sql + + indented-heredoc-end: + - match: ^\s*(\1)$ # HEREDOC delimiter + scope: string.unquoted.heredoc.ruby + captures: + 1: punctuation.definition.string.end.ruby + pop: true + + unindented-heredoc-end: + - match: ^\1$ # HEREDOC delimiter + scope: string.unquoted.heredoc.ruby punctuation.definition.string.end.ruby + pop: true + + trailing-heredoc-start: + # This prevents clear_scopes from applying to the push token - match: '' - set: trailing-heredoc-no-embedding + set: trailing-heredoc - trailing-heredoc-no-embedding: - - clear_scopes: 1 - - match: '$' + trailing-heredoc: + # The rest of the line right after the heredoc tag needs to be handled + # as ordinary ruby source. The embedded syntax starts at the next line. + - clear_scopes: 2 + - match: ^ pop: true - include: expressions +###[ DATA SECTION ]############################################################ + data-section: - match: ^__END__\n - scope: string.unquoted.program-block.ruby + scope: meta.string.ruby string.unquoted.program-block.ruby push: - meta_content_scope: text.plain - match: (?= /}${2:e} +${TM_SELECTED_TEXT/([\t ]*).*/$1/m}rescue ${1:StandardError}${2/.+/ => /}${2:e} ${TM_SELECTED_TEXT/([\t ]*).*/$1/m} $0 ${TM_SELECTED_TEXT/([\t ]*).*/$1/m}end ]]> diff --git a/Ruby/syntax_test_ruby.rb b/Ruby/syntax_test_ruby.rb index ba718f949c..79e4389a78 100644 --- a/Ruby/syntax_test_ruby.rb +++ b/Ruby/syntax_test_ruby.rb @@ -1,40 +1,174 @@ # SYNTAX TEST "Packages/Ruby/Ruby.sublime-syntax" ################## -# Strings and heredocs +# block comments ################## -puts 'test' +=begin +#<- comment.block.documentation.ruby punctuation.definition.comment.begin.ruby +#^^^^^ comment.block.documentation.ruby punctuation.definition.comment.begin.ruby + =end +# ^^^^^ comment.block.documentation.ruby - punctuation +=end +#<- comment.block.documentation.ruby punctuation.definition.comment.end.ruby +#^^^ comment.block.documentation.ruby punctuation.definition.comment.end.ruby + +################## +# line comments +################## -puts <<~EOF +## comment +#<- comment.line.number-sign.ruby punctuation.definition.comment.ruby +#^ comment.line.number-sign.ruby punctuation.definition.comment.ruby +# ^^^^^^^^ comment.line.number-sign.ruby - punctuation + + ## comment +#^ - comment - punctuation +# ^^ comment.line.number-sign.ruby punctuation.definition.comment.ruby +# ^^^^^^^^^ comment.line.number-sign.ruby - punctuation + +################## +# Heredocs +################## + +# HEREDOC with indented end tag containing an interpolated string +puts <<~EOF; # comment +#^^^^ - meta.string - string.unquoted +# ^^^^^^ meta.string.heredoc.ruby string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby +# ^ punctuation.terminator.statement.ruby - meta.string - string +# ^ comment.line.number-sign.ruby punctuation.definition.comment.ruby - meta.string - string Indented string! +# ^^^^^^^^^^^^^^^^^ meta.string.heredoc.ruby string.unquoted.heredoc.ruby + #{ sym } #@var +# ^ meta.string.heredoc.ruby string.unquoted.heredoc.ruby - meta.interpolation +# ^^^^^^^^ meta.string.heredoc.ruby meta.interpolation.ruby +# ^ meta.string.heredoc.ruby string.unquoted.heredoc.ruby - meta.interpolation +# ^^^^^ meta.string.heredoc.ruby meta.interpolation.ruby variable.other.readwrite.instance.ruby +# ^ meta.string.heredoc.ruby string.unquoted.heredoc.ruby - meta.interpolation +# ^^ punctuation.section.interpolation.begin.ruby +# ^^^^^ source.ruby.embedded.ruby +# ^ punctuation.section.interpolation.end.ruby +# ^^ punctuation.definition.variable.ruby +# ^^^^^ variable.other.readwrite.instance.ruby EOF -# ^ string.unquoted.heredoc -# ^ - string.unquoted.heredoc - -puts <<-HTML +# ^^^ meta.string.heredoc.ruby string.unquoted.heredoc.ruby punctuation.definition.string.end.ruby +# ^ - meta.string - string.unquoted + +# HEREDOC with indented end tag containing a plain string +puts <<~'EOF'; # comment +#^^^^ - meta.string - string.unquoted +# ^^^^^^^^ meta.string.heredoc.ruby string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby +# ^ punctuation.terminator.statement.ruby - meta.string - string +# ^ comment.line.number-sign.ruby punctuation.definition.comment.ruby - meta.string - string + Indented string! +# ^^^^^^^^^^^^^^^^^ meta.string.heredoc.ruby string.unquoted.heredoc.ruby + #{ sym } #@var +# ^^^^^^^^^^^^^^^^^ meta.string.heredoc.ruby string.unquoted.heredoc.ruby - meta.interpolation + EOF +# ^^^ meta.string.heredoc.ruby string.unquoted.heredoc.ruby punctuation.definition.string.end.ruby +# ^ - meta.string - string.unquoted + +# HEREDOC with unindented end tag containing an interpolated string +puts < -# ^^^^^^ meta.tag.structure +# ^^^^^^ meta.string.heredoc.ruby text.html.embedded.ruby meta.tag.structure + #{ sym } #@var +# ^ meta.string.heredoc.ruby text.html.embedded.ruby - meta.interpolation +# ^^^^^^^^ meta.string.heredoc.ruby meta.interpolation.ruby +# ^ meta.string.heredoc.ruby text.html.embedded.ruby - meta.interpolation +# ^^^^^ meta.string.heredoc.ruby meta.interpolation.ruby variable.other.readwrite.instance.ruby +# ^ meta.string.heredoc.ruby text.html.embedded.ruby - meta.interpolation +# ^^ punctuation.section.interpolation.begin.ruby +# ^^^^^ source.ruby.embedded.ruby +# ^ punctuation.section.interpolation.end.ruby +# ^^ punctuation.definition.variable.ruby +# ^^^^^ variable.other.readwrite.instance.ruby +# ^^^^^^^ meta.string.heredoc.ruby text.html.embedded.ruby meta.tag.structure.any.html HTML +# ^^^^ meta.string.heredoc.ruby string.unquoted.heredoc.ruby punctuation.definition.string.end.ruby +# ^ - meta.string - string.unquoted class_eval <<-RUBY, __FILE__, __LINE__ + 1 def #{sym}(*args, &block) -# ^^ punctuation.section.interpolation.begin -# ^ punctuation.section.interpolation.end +# ^^^^ meta.string.heredoc.ruby - meta.interpolation +# ^^^^^^ meta.string.heredoc.ruby source.ruby.embedded.ruby meta.interpolation.ruby +# ^^^^^^^^^^^^^^^ meta.string.heredoc.ruby source.ruby.embedded.ruby - meta.interpolation +# ^^ punctuation.section.interpolation.begin.ruby +# ^ punctuation.section.interpolation.end.ruby custom(Mime[:#{sym}], *args, &block) end RUBY +#^^^ meta.string.heredoc.ruby string.unquoted.heredoc.ruby punctuation.definition.string.end.ruby +# ^ - meta.string - string.unquoted + +puts <<-SH; # comment +# ^^^^^ meta.string.heredoc.ruby string.unquoted.heredoc.ruby punctuation.definition.string.begin.ruby +# ^ punctuation.terminator.statement.ruby - meta.string - string +# ^ comment.line.number-sign.ruby punctuation.definition.comment.ruby - meta.string - string + git log +# ^^^^^^^ meta.string.heredoc.ruby source.shell.embedded.ruby + SH +# ^^ meta.string.heredoc.ruby string.unquoted.heredoc.ruby punctuation.definition.string.end.ruby +# ^ - meta.string - string.unquoted DB.fetch(<<-SQL, conn).name #^^^^^^^^^^^^^^^^^^^^^^^^^^ source.ruby -# ^^^^^^ string.unquoted -# ^^^^^^^^^^^^ - string.unquoted +# ^^^^^^ meta.string.heredoc.ruby string.unquoted.heredoc.ruby +# ^^^^^^^^^^^^ - meta.string - string # ^ punctuation.separator # ^ punctuation.definition.group.end -SELECT * FROM users; -#^^^^^^^^^^^^^^^^^^^ text.sql.embedded +SELECT * FROM #$users; +#^^^^^^^^^^^^^ meta.string.heredoc.ruby source.sql.embedded.ruby - meta.interpolation +# ^^^^^^^ meta.string.heredoc.ruby source.sql.embedded.ruby meta.interpolation.ruby variable.other.readwrite.global +# ^ meta.string.heredoc.ruby source.sql.embedded.ruby - meta.interpolation SQL +#^^ meta.string.heredoc.ruby string.unquoted.heredoc.ruby punctuation.definition.string.end.ruby +# ^ - meta.string - string.unquoted foo, bar = < "\x01" +#^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^ constant.character.ruby +# ^ - constant + ?\M-a ?\m-a ?\ma #=> "\xE1" +#^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^ constant.character.ruby +# ^^^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^^ constant.character.ruby +# ^^^ invalid.illegal.character.ruby +# ^ - constant + ?\M-\C-a ?\M-\ca #=> "\x81" +#^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^^^^^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^^^^^ constant.character.ruby +# ^ - constant + ?\C-\M-a ?\c\M-a #=> "\x81", same as above +#^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^^^^^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^^^^^ constant.character.ruby +# ^ - constant + + ## hexadecimal + + ?\x10 ?\xAF ?\xAG ?\x0AF +#^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^^^ constant.character.ruby +# ^^^^ invalid.illegal.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^^^^ constant.character.ruby +# ^^^^^ invalid.illegal.character.ruby +# ^ - constant + + ## octal + + ?\00 ?\07 ?\000 ?\077 ?\080 ?\0777 +#^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^^^ constant.character.ruby +# ^^^^ invalid.illegal.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^^^^ constant.character.ruby +# ^^^^^ invalid.illegal.character.ruby +# ^ - constant + + ## escape sequences + + ?\b ?\n ?\s ?\\ ?\\n ?\bn +#^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^ constant.character.ruby +# ^ - constant +# ^ constant.character.ruby punctuation.definition.constant.ruby +# ^^^ constant.character.ruby invalid.illegal.character.ruby +# ^ - constant +# ^ constant.character.ruby punctuation.definition.constant.ruby +# ^^^ constant.character.ruby invalid.illegal.character.ruby +# ^ - constant + + ## unicode + + ?\u{41} #=> "A" +# ^^^ meta.constant.ruby - meta.braces.ruby constant.character.ruby +# ^^^^ meta.constant.ruby meta.braces.ruby - constant.character.ruby +# ^ punctuation.definition.constant.ruby +# ^ punctuation.section.braces.begin.ruby +# ^^ constant.numeric.integer.hexadecimal.ruby +# ^ punctuation.section.braces.end.ruby + ?\u{012ACF 0gxs} +# ^^^ meta.constant.ruby - meta.braces.ruby constant.character.ruby +# ^^^^^^^^^^^^^ meta.constant.ruby meta.braces.ruby - constant.character.ruby +# ^ punctuation.definition.constant.ruby +# ^ punctuation.section.braces.begin.ruby +# ^^^^^^ constant.numeric.integer.hexadecimal.ruby +# ^ constant.numeric.integer.hexadecimal.ruby +# ^^^ invalid.illegal.escape.ruby +# ^ punctuation.section.braces.end.ruby + + ## normal character literals + + ?0 ?1 ?9 ?20 +#^ - constant +# ^ punctuation.definition.constant.ruby +# ^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^ constant.character.ruby +# ^ - constant +# ^ keyword.operator.conditional.ruby +# ^^ constant.numeric.integer.decimal.ruby + ?a ?A ?あ ?abc ?a0 +#^ - constant +# ^ punctuation.definition.constant.ruby +# ^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^^ constant.character.ruby +# ^^^ invalid.illegal.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^^ constant.character.ruby +# ^^ invalid.illegal.character.ruby +# ^ - constant + ?* ?" ?( ?[ ?{ ?. ?# ?_ ?\ +#^ - constant +# ^ punctuation.definition.constant.ruby +# ^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^ constant.character.ruby +# ^ - constant +# ^ punctuation.definition.constant.ruby +# ^^ constant.character.ruby +# ^ - constant + +################## +# Constant reserved keyword symbols +################## + +begin: 'begin' +# ^^^^ constant.other.symbol +end: 'end' +# ^^ constant.other.symbol +require: 'require' +# ^^^^^^ constant.other.symbol +class: 'class' +# ^^^^ constant.other.symbol +module: 'module' +# ^^^^^ constant.other.symbol + +################## +# Operators +################## + + , +# ^ punctuation.separator.sequence.ruby + ; +# ^ punctuation.terminator.statement.ruby + . +# ^ punctuation.accessor.dot.ruby + :: +# ^^ punctuation.accessor.double-colon.ruby + <<= +# ^^^ keyword.operator.assignment.augmented.ruby + &&= +# ^^^ keyword.operator.assignment.augmented.ruby + ||= +# ^^^ keyword.operator.assignment.augmented.ruby + **= +# ^^^ keyword.operator.assignment.augmented.ruby + += +# ^^ keyword.operator.assignment.augmented.ruby + -= +# ^^ keyword.operator.assignment.augmented.ruby + *= +# ^^ keyword.operator.assignment.augmented.ruby + /= +# ^^ keyword.operator.assignment.augmented.ruby + &= +# ^^ keyword.operator.assignment.augmented.ruby + |= +# ^^ keyword.operator.assignment.augmented.ruby + ^= +# ^^ keyword.operator.assignment.augmented.ruby + << +# ^^ keyword.operator.assignment.augmented.ruby + >> +# ^^ keyword.operator.other.ruby + + +# ^ keyword.operator.arithmetic.ruby + - +# ^ keyword.operator.arithmetic.ruby + * +# ^ keyword.operator.arithmetic.ruby + ** +# ^^ keyword.operator.arithmetic.ruby + / +# ^ keyword.operator.arithmetic.ruby + % +# ^ keyword.operator.arithmetic.ruby + !~ +# ^^ keyword.operator.comparison.ruby + =~ +# ^^ keyword.operator.comparison.ruby + <=> +# ^^^ keyword.operator.comparison.ruby + == +# ^^ keyword.operator.comparison.ruby + != +# ^^ keyword.operator.comparison.ruby + >= +# ^^ keyword.operator.comparison.ruby + <= +# ^^ keyword.operator.comparison.ruby + > +# ^ keyword.operator.comparison.ruby + < +# ^ keyword.operator.comparison.ruby + && +# ^^ keyword.operator.logical.ruby + || +# ^^ keyword.operator.logical.ruby + ! +# ^ keyword.operator.logical.ruby + ? +# ^ keyword.operator.conditional.ruby + : +# ^ keyword.operator.conditional.ruby + ~ +# ^ keyword.operator.bitwise.ruby + & +# ^ keyword.operator.bitwise.ruby + | +# ^ keyword.operator.bitwise.ruby + ^ +# ^ keyword.operator.bitwise.ruby + .. +# ^^ keyword.operator.range.ruby + ... +# ^^^ keyword.operator.range.ruby ################## # Blocks @@ -119,7 +894,7 @@ def #{sym}(*args, &block) # ^ punctuation.section.scope do |&bl| end -# <- keyword.control +# <- keyword.control.block.do.ruby # ^^^^^ meta.block.parameters # ^ punctuation.definition.parameters # ^ keyword.operator @@ -150,27 +925,40 @@ def #{sym}(*args, &block) ################## module MyModule -# <- keyword.control.module -# ^^^^^^^^ entity.name.module +#^^^^^^^^^^^^^^ meta.namespace +# <- meta.namespace storage.type.namespace keyword.declaration.namespace +#^^^^^ storage.type.namespace keyword.declaration.namespace +# ^ - entity - keyword - storage +# ^^^^^^^^ entity.name.namespace end module MyModule::OtherModule -# <- keyword.control.module -# ^^^^^^^^^^^^^^^^^^^^^ entity.name.module +#^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.namespace +# <- meta.namespace storage.type.namespace keyword.declaration.namespace +# ^^^^^^^^^^^^^^^^^^^^^ entity.name.namespace +#^^^^^ storage.type.namespace keyword.declaration.namespace +# ^ - entity - keyword - storage # ^^^^^^^^ support.other.namespace -# ^^ punctuation.accessor +# ^^ punctuation.accessor.double-colon +# ^^^^^^^^^^^ entity.name.namespace end class ::MyModule::MyClass < MyModule::InheritedClass #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class -# ^^ punctuation.accessor -# ^^ punctuation.accessor +# <- meta.class storage.type.class keyword.declaration.class +#^^^^ storage.type.class keyword.declaration.class +# ^ - entity - keyword - storage - punctuation +# ^^ punctuation.accessor.double-colon +# ^^^^^^^^ support.other.namespace +# ^^ punctuation.accessor.double-colon +# ^^^^^^^ entity.name.class # ^ punctuation.separator.inheritance # ^^^^^^^^^^^^^^^^^^^^^^^^ entity.other.inherited-class -# ^^ punctuation.accessor +# ^^ punctuation.accessor.double-colon def my_method(param1, param2) # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function +# ^^^ storage.type.function keyword.declaration.function # ^^^^^^^^^ entity.name.function # ^^^^^^^^^^^^^^^^ meta.function.parameters # ^ punctuation.definition.group.begin @@ -180,8 +968,9 @@ def my_method(param1, param2) def self.my_second_method *arg_without_parens # comment # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function +# ^^^ storage.type.function keyword.declaration.function # ^^^^ variable.language -# ^ punctuation.accessor +# ^ punctuation.accessor.dot # ^^^^^^^^^^^^^^^^ entity.name.function # ^^^^^^^^^^^^^^^^^^^ meta.function.parameters # ^ keyword.operator.splat @@ -191,8 +980,9 @@ def self.my_second_method *arg_without_parens # comment def self.my_third_method(a, b="foo", c=[], d=foo(), *args) # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function +# ^^^ storage.type.function keyword.declaration.function # ^^^^ variable.language -# ^ punctuation.accessor +# ^ punctuation.accessor.dot # ^^^^^^^^^^^^^^^ entity.name.function # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.parameters # ^ punctuation.definition.group.begin @@ -218,6 +1008,7 @@ def self.my_third_method(a, b="foo", c=[], d=foo(), *args) def nested((a, b), c, (d, *e)) # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function +# ^^^ storage.type.function keyword.declaration.function # ^^^^^^ entity.name.function # ^^^^^^^^^^^^^^^^^^^^ meta.function.parameters # ^ punctuation.definition.group.begin @@ -238,6 +1029,7 @@ def nested((a, b), c, (d, *e)) end def block_param(&block) +# ^^^ storage.type.function keyword.declaration.function # ^^^^^^^^ meta.function.parameters # ^ keyword.operator # ^^^^^ variable.parameter @@ -269,8 +1061,10 @@ def MyModule::module_method #^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function # ^^^^^^^^^^^^^^^^^^^^^^^ entity.name.function # ^^^^^^^^ support.other.namespace -# ^^ punctuation.accessor - +# ^^ punctuation.accessor.double-colon + super /pattern/ +# ^^^^^ support.function.builtin.ruby +# ^^^^^^^^^ meta.string.regexp.ruby end def my_function @@ -279,16 +1073,16 @@ def my_function end f = MyModule::MyClass.new -# ^^ punctuation.accessor +# ^^ punctuation.accessor.double-colon def f.my_instance_method #^^^^^^^^^^^^^^^^^^^^^^^ meta.function # ^^^^^^^^^^^^^^^^^^^^ entity.name.function -# ^ punctuation.accessor +# ^ punctuation.accessor.dot end class MyClass -# ^ meta.class.ruby keyword.control.class.ruby +# ^ meta.class.ruby storage.type.class.ruby # ^ meta.class.ruby entity.name.class.ruby prepend Module.new @@ -304,9 +1098,9 @@ class MyClass A, B, C = :a, :b, :c # ^ meta.constant.ruby entity.name.constant.ruby -# ^ punctuation.separator.ruby +# ^ punctuation.separator.sequence.ruby # ^ meta.constant.ruby entity.name.constant.ruby -# ^ punctuation.separator.ruby +# ^ punctuation.separator.sequence.ruby # ^ meta.constant.ruby entity.name.constant.ruby end @@ -352,7 +1146,7 @@ class MyClass # ^ keyword.operator.conditional puts ?1 -# ^^ constant.numeric +# ^^ constant.character.ruby puts 1 ? foo:bar # ^ keyword.operator.conditional @@ -361,7 +1155,7 @@ class MyClass puts 1 ? foo::baz:bar # ^ keyword.operator.conditional -# ^^ punctuation.accessor +# ^^ punctuation.accessor.double-colon # ^^^ - constant.other.symbol # ^ keyword.operator.conditional @@ -379,29 +1173,64 @@ class MyClass "foo".sub! /t{1,}/i # ^^^^^^^^ string.regexp # ^ keyword.other +"foo".sub!(/t{1,}/i) +# ^^^^^^^^ string.regexp +# ^ keyword.other "foo".gsub /t{1,}/i # ^^^^^^^^ string.regexp # ^ keyword.other "foo".gsub! /t{1,}/i # ^^^^^^^^ string.regexp # ^ keyword.other +"foo".gsub!(/t{1,}/i) +# ^^^^^^^^ string.regexp +# ^ keyword.other +"foo".eql? /t{1,}/i +# ^^^^^^^^ string.regexp +# ^ keyword.other +"foo".eql?(/t{1,}/i) +# ^^^^^^^^ string.regexp +# ^ keyword.other +'foo'.match? /t{1,}/i +# ^^^^^^^^ string.regexp +# ^ keyword.other +'foo'.match?(/t{1,}/i) +# ^^^^^^^^ string.regexp +# ^ keyword.other +'foo'.matches?(/t{1,}/i) +# ^^^^^^^^ string.regexp +# ^ keyword.other a = /(foo)*baz/m # ^^^^^^^^^^^^ string.regexp +a = /{foo}*baz/m +# ^^^^^^^^^^^^ string.regexp + +a = /?foo*baz/m +# ^^^^^^^^^^^ string.regexp + +a = /=foo/m +# ^^ keyword.operator.assignment.augmented.ruby +# ^^^^^^^ - string.regexp + begin +# <- keyword.control.block.begin end while /foo/ =~ bar # ^^^^^ string.regexp if /foo/i =~ baz +# <- keyword.control.conditional.if # ^^^^^^ string.regexp # ^^ keyword.operator end +# <- keyword.control.block.end.ruby if baz =~ /foo/i # ^^ keyword.operator # ^^^^^^ string.regexp end +# <- keyword.control.block.end.ruby ['a()', 'b()'].select { |var| /^a\(/ =~ var } # ^^^^^^ string.regexp @@ -428,6 +1257,7 @@ class MyClass rule /`/ do # ^^^ string.regexp # ^ - string.regexp string.regexp +# ^^ keyword.control.block.do end ################## @@ -440,6 +1270,7 @@ def huh?(a, b=def huh?(a); "h?"; end) # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.parameters # ^^^^^^^^^^^ meta.function meta.function # ^^^ meta.function.parameters meta.function.parameters +#^^ storage.type.function keyword.declaration.function # ^ variable.parameter a end @@ -467,3 +1298,21 @@ def huh?(a, b=def huh?(a); "h?"; end) /foo/ => :foo # ^^^^^ string.regexp.classic.ruby } + + assert_no_match /1/, "2" +# ^^^^^^^^^^^^^^^ support.function.builtin.ruby +# ^ punctuation.definition.string.begin.ruby +# ^^^ meta.string.regexp.ruby string.regexp.classic.ruby +# ^ punctuation.definition.string.end.ruby +# ^ punctuation.separator.sequence.ruby +# ^^^ string.quoted.double.ruby + +# issue #2181 +foo << bar if baz.include?(x) +# ^^ keyword.control.conditional.if.ruby +foo << bar.baz if baz.include?(x) +# ^^ keyword.control.conditional.if.ruby +foo << bar.assert_match if baz.include?(x) +# ^^ keyword.control.conditional.if.ruby +foo << bar.to_s if baz.include?(x) +# ^^ keyword.control.conditional.if.ruby diff --git a/Rust/Cargo.sublime-build b/Rust/Cargo.sublime-build index b2941c8fa6..4af07858f9 100644 --- a/Rust/Cargo.sublime-build +++ b/Rust/Cargo.sublime-build @@ -1,10 +1,12 @@ { "cmd": ["cargo", "build"], - "selector": "source.rust", "file_regex": "(?|, ([^,<\n]*\\.[A-z]{2}):([0-9]+)|[ \t]*-->[ \t]*([^<\n]*):([0-9]+):([0-9]+))", "syntax": "Packages/Rust/Cargo.sublime-syntax", + "keyfiles": ["Cargo.toml"], + "working_dir": "${folder:${project_path:${file_path}}}", - "variants": [ + "variants": + [ { "cmd": ["cargo", "run"], "name": "Run" diff --git a/Rust/Rust.sublime-syntax b/Rust/Rust.sublime-syntax index 6c1c617110..3c3544861d 100644 --- a/Rust/Rust.sublime-syntax +++ b/Rust/Rust.sublime-syntax @@ -9,7 +9,7 @@ variables: identifier: '(?:(?:[[:alpha:]][_[:alnum:]]*|_[_[:alnum:]]+)\b)' # include a word boundary at the end to ensure all possible characters are consumed, to prevent catastrophic backtracking escaped_byte: '\\(x\h{2}|n|r|t|0|"|''|\\)' escaped_char: '\\(x\h{2}|n|r|t|0|"|''|\\|u\{\h{1,6}\})' - int_suffixes: 'i8|i16|i32|i64|isize|u8|u16|u32|u64|usize' + int_suffixes: 'i8|i16|i32|i64|i128|isize|u8|u16|u32|u64|u128|usize' support_type: \b(Copy|Send|Sized|Sync|Drop|Fn|FnMut|FnOnce|Box|ToOwned|Clone|PartialEq|PartialOrd|Eq|Ord|AsRef|AsMut|Into|From|Default|Iterator|Extend|IntoIterator|DoubleEndedIterator|ExactSizeIterator|Option|Some|None|Result|Ok|Err|SliceConcatExt|String|ToString|Vec)\b contexts: main: @@ -23,6 +23,14 @@ contexts: - match: '\${{identifier}}' scope: variable.other.rust + else-pop: + - match: (?=\S) + pop: true + + pop-immediately: + - match: '' + pop: true + statements: - match: '(''{{identifier}})\s*(:)' @@ -223,9 +231,7 @@ contexts: scope: keyword.operator.rust push: after-operator - - match: '=' - scope: keyword.operator.rust - push: after-operator + - include: operators - match: ';' scope: punctuation.terminator.rust @@ -235,12 +241,31 @@ contexts: scope: punctuation.separator.rust push: after-operator - - match: '\.\.\.|\.\.|[-=<>&|!~@?+*/%^''#$]|\b_\b' - scope: keyword.operator.rust - - match: '\.' scope: punctuation.accessor.dot.rust + operators: + - match: \.{2,3} + scope: keyword.operator.range.rust + - match: '(?:[-+%/*^&|]|<<|>>)=' + scope: keyword.operator.assignment.rust + - match: '[!<>=]=|[<>]' + scope: keyword.operator.comparison.rust + - match: '=' + scope: keyword.operator.assignment.rust + push: after-operator + - match: '&&|\|\||!' + scope: keyword.operator.logical.rust + - match: '[-+%/*]' + scope: keyword.operator.arithmetic.rust + - match: '[&|^]|<<|>>' + scope: keyword.operator.bitwise.rust + - match: '[@~?$#'']' + scope: keyword.operator.rust + - match: '\b_\b' + scope: keyword.operator.rust + + attributes: - match: '(#!?)(\[)' captures: @@ -432,7 +457,7 @@ contexts: captures: 1: support.type.rust push: generic-angles - - match: \b(Self|i8|i16|i32|i64|isize|u8|u16|u32|u64|usize|f32|f64|bool|char|str)\b + - match: \b(Self|i8|i16|i32|i64|i128|isize|u8|u16|u32|u64|u128|usize|f32|f64|bool|char|str)\b scope: storage.type.rust generic-angles: @@ -629,96 +654,112 @@ contexts: - include: type-any-identifier macro-block: + # This meta scope requires some juggling - meta_scope: meta.macro.rust - - match: '\}' - scope: meta.block.rust punctuation.section.block.end.rust - pop: true - - match: '[\])]' - scope: punctuation.section.group.end.rust - pop: true - - match: '\{' - scope: punctuation.section.block.begin.rust - push: - - meta_scope: meta.block.rust - - match: '(?=\})' + - match: \{ + scope: meta.block.rust punctuation.section.block.begin.rust + set: + - meta_content_scope: meta.macro.rust meta.block.rust + - match: \} + scope: meta.macro.rust meta.block.rust punctuation.section.block.end.rust pop: true - include: macro-block-contents - - match: '\[' - scope: punctuation.section.group.begin.rust - push: - - meta_scope: meta.group.rust - - match: '(?=\])' + - match: \[ + scope: meta.group.rust punctuation.section.group.begin.rust + set: + - meta_content_scope: meta.macro.rust meta.group.rust + - match: \] + scope: meta.macro.rust meta.group.rust punctuation.section.group.end.rust pop: true - include: macro-block-contents - - match: '\(' - scope: punctuation.section.group.begin.rust - push: - - meta_scope: meta.group.rust - - match: '(?=\))' + - match: \( + scope: meta.group.rust punctuation.section.group.begin.rust + set: + - meta_content_scope: meta.macro.rust meta.group.rust + - match: \) + scope: meta.macro.rust meta.group.rust punctuation.section.group.end.rust pop: true - include: macro-block-contents + - include: else-pop macro-block-contents: - include: comments - - match: '\(' - scope: punctuation.section.group.begin.rust - push: macro-matcher - - match: ';' + - match: (?=\() + push: + - macro-terminator + - macro-body + - macro-match-operator + - macro-matcher macro-matcher: - - meta_include_prototype: false - - meta_scope: meta.group.rust - - match: '\)' - scope: punctuation.section.group.end.rust - set: macro-match-operator - - match: '(\$)(\()' - captures: - 1: keyword.operator.rust - 2: punctuation.section.group.begin.rust - push: - - match: '(\))[^*+]?([*+])' + - match: \( + scope: punctuation.section.group.begin.rust + set: + - meta_include_prototype: false + - meta_scope: meta.group.macro-matcher.rust + - match: \) + scope: punctuation.section.group.end.rust + pop: true + - match: ((\$)\() captures: - 1: punctuation.section.group.end.rust + 1: punctuation.section.group.begin.rust 2: keyword.operator.rust - pop: true + push: + - meta_scope: meta.group.rust + - meta_include_prototype: false + - match: (\))(?:\s*[^*+]?\s*([*+]))? + captures: + 1: punctuation.section.group.end.rust + 2: keyword.operator.rust + pop: true + - include: macro-metavariable - include: macro-metavariable - - include: macro-metavariable macro-match-operator: - - match: '=>' + - match: => scope: keyword.operator.rust - - match: '\{' + pop: true + - include: else-pop + + macro-body: + - match: \{ scope: punctuation.section.block.begin.rust set: - - meta_scope: meta.block.rust - - match: '\}' + - meta_scope: meta.block.macro-body.rust + - match: \} scope: punctuation.section.block.end.rust pop: true - include: statements - - match: '\(' + - match: \( scope: punctuation.section.group.begin.rust set: - - meta_scope: meta.group.rust - - match: '\)' + - meta_scope: meta.group.macro-body.rust + - match: \) scope: punctuation.section.group.end.rust pop: true - include: statements - - match: '\[' + - match: \[ scope: punctuation.section.group.begin.rust set: - - meta_scope: meta.group.rust - - match: '\]' + - meta_scope: meta.group.macro-body.rust + - match: \] scope: punctuation.section.group.end.rust pop: true - include: statements + - include: else-pop macro-metavariable: - match: '(\${{identifier}})(:)(ident|path|expr|ty|pat|stmt|block|item|meta|tt)' captures: - 1: variable.parameter.rust + 1: variable.parameter.macro.rust 2: punctuation.separator.rust 3: storage.type.rust + macro-terminator: + - match: ;|, + scope: punctuation.terminator.macro-matcher.rust + - include: else-pop + impl-definition: - meta_scope: meta.impl.rust - include: comments @@ -912,6 +953,9 @@ contexts: - match: \*/ scope: punctuation.definition.comment.rust pop: true + - match: ^\s*(\*)(?!/) + captures: + 1: punctuation.definition.comment.rust - include: block-comments - match: /\* scope: punctuation.definition.comment.rust @@ -1002,14 +1046,14 @@ contexts: scope: punctuation.separator.continuation.line.rust raw-string: - - match: (r)(#*)" + - match: (r)((#*)") captures: 1: storage.type.string.rust 2: punctuation.definition.string.begin.rust push: - meta_include_prototype: false - meta_scope: string.quoted.double.raw.rust - - match: '"\2' + - match: '"\3' scope: punctuation.definition.string.end.rust pop: true diff --git a/Rust/syntax_test_rust.rs b/Rust/syntax_test_rust.rs index 3ee4f38bf4..978893a157 100644 --- a/Rust/syntax_test_rust.rs +++ b/Rust/syntax_test_rust.rs @@ -19,19 +19,24 @@ Block doc comments // ^^^^^^^^^^^^^^^^^^ comment.block.documentation comment.block */ +/** + * +// ^ comment.block.documentation.rust punctuation.definition.comment.rust +*/ + let c = 'c'; // <- storage.type -// ^ keyword.operator +// ^ keyword.operator.assignment // ^^^ string.quoted.single let b = b'c'; // <- storage.type -// ^ keyword.operator +// ^ keyword.operator.assignment // ^ storage.type // ^^^ string.quoted.single let s = "This is a string \x01_\u{007F}_\"_\'_\\_\r_\n_\t_\0"; // <- storage.type -// ^ keyword.operator +// ^ keyword.operator.assignment // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double // ^^^^ constant.character.escape // ^^^^^^^^ constant.character.escape @@ -42,11 +47,14 @@ let s = "This is a string \x01_\u{007F}_\"_\'_\\_\r_\n_\t_\0"; // ^^ constant.character.escape // ^^ constant.character.escape // ^^ constant.character.escape -let r = r#"This is a raw string, no escapes! \x00 \0 \n"#; +let r = r##"This is a raw string, no escapes! \x00 \0 \n"###; // <- storage.type -// ^ keyword.operator +// ^ keyword.operator.assignment // ^ storage.type -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double - constant.character.escape +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double.raw - constant.character.escape +// ^^^ punctuation.definition.string.begin.rust +// ^^^ punctuation.definition.string.end.rust +// ^ - string let bytes = b"This won't escape unicode \u{0123}, but will do \x01_\"_\'_\\_\r_\n_\t_\0"; // <- storage.type @@ -173,7 +181,7 @@ use foo::{Baz, QUX, quux}; String my_var = format!("Hello {0}", "World"); // ^^^ support.type -// ^ keyword.operator +// ^ keyword.operator.assignment // ^^^^^^^ support.macro // ^ punctuation.section.group.begin // ^^^^^^^^^^^^^^^^^^^^^^ meta.group @@ -182,7 +190,7 @@ String my_var = format!("Hello {0}", "World"); // ^ punctuation.section.group.end my_var = format!("Hello {name}, how are you?", -// ^ keyword.operator +// ^ keyword.operator.assignment // ^^^^^^^ support.macro // ^ punctuation.section.group.begin // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.group @@ -190,7 +198,7 @@ my_var = format!("Hello {name}, how are you?", // ^^^^^^ constant.other.placeholder name="John"); // ^^^^^^^^^^^^^ meta.group -// ^ keyword.operator +// ^ keyword.operator.assignment // ^^^^^^ string.quoted.double // ^ punctuation.section.group.end @@ -269,7 +277,7 @@ impl fmt::Display for PrintableStruct { let logical: bool = true; // ^ punctuation.separator // ^^^^ storage.type -// ^ keyword.operator +// ^ keyword.operator.assignment // ^^^^ constant.language // ^ punctuation.terminator let mut mutable = 12; @@ -369,14 +377,14 @@ const ZERO: u64 = 0; // ^^^^ constant.other // ^ punctuation.separator // ^^^ storage.type -// ^ keyword.operator +// ^ keyword.operator.assignment // ^ constant.numeric.integer.decimal static NAME: &'static str = "John"; // <- storage.type // ^ keyword.operator // ^^^^^^^ storage.modifier.lifetime // ^^^ storage.type -// ^ keyword.operator +// ^ keyword.operator.assignment // ^^^^^^ string.quoted.double @@ -384,7 +392,7 @@ let z = { // ^ meta.block punctuation.section.block.begin 2 * 5 // ^ constant.numeric.integer.decimal -// ^ keyword.operator +// ^ keyword.operator.arithmetic // ^ constant.numeric.integer.decimal }; // <- meta.block punctuation.section.block.end @@ -406,6 +414,7 @@ fn my_func(x: i32) let n = 5; if n < 0 { +// ^ keyword.operator.comparison // ^ meta.block punctuation.section.block.begin // <- keyword.control print!("{} is negative", n); @@ -426,7 +435,7 @@ if n < 0 { // <- meta.block punctuation.section.block.end let big_n = -// ^ keyword.operator +// ^ keyword.operator.assignment if n < 10 && n > -10 { // ^ meta.block punctuation.section.block.begin 10 * n @@ -443,8 +452,10 @@ let big_n = // ^^^^ keyword.control // ^ meta.block punctuation.section.block.begin n += 1; +// ^^ keyword.operator.assignment if n / 2 == 5 { -// ^ keyword.operator +// ^ keyword.operator.arithmetic +// ^^ keyword.operator.comparison continue; // ^^^^^^^^ keyword.control } @@ -463,7 +474,7 @@ for i in 1..10 { // <- keyword.control // ^^ keyword.operator // ^ constant.numeric.integer.decimal -// ^^ keyword.operator +// ^^ keyword.operator.range // ^^ constant.numeric.integer.decimal println!("I: {}", i); // ^^^^^^^^^^^^^^^^^^^^^^ meta.block @@ -482,7 +493,7 @@ let o = match n { // ^^^^^ string.quoted.double 3...5 => "a few", // ^ constant.numeric.integer.decimal -// ^^^ keyword.operator +// ^^^ keyword.operator.range // ^ constant.numeric.integer.decimal // ^^ keyword.operator // ^^^^^^^ string.quoted.double @@ -497,7 +508,7 @@ let mut j = BasicStruct(10); if let BasicStruct(i) = j { // ^^^ storage.type -// ^ keyword.operator +// ^ keyword.operator.assignment // ^ meta.block punctuation.section.block.begin println!("Basic value: {}", i); } @@ -506,7 +517,7 @@ if let BasicStruct(i) = j { while let BasicStruct(k) = j { //^^^ keyword.control // ^^^ storage.type -// ^ keyword.operator +// ^ keyword.operator.assignment // ^ meta.block punctuation.section.block.begin println!("Constructed example: {}", j) j = BasicStruct(j + 1); @@ -534,12 +545,12 @@ match n { // <- keyword.control a if n > 5 => println!("Big: {}", a), // ^^ keyword.control -// ^ keyword.operator +// ^ keyword.operator.comparison // ^^ keyword.operator // ^^^^^^^^ support.macro b if n <= 5 => println!("Small: {}", b), // ^^ keyword.control -// ^^ keyword.operator +// ^^ keyword.operator.comparison // ^^ keyword.operator // ^^^^^^^^ support.macro // ^^ constant.other.placeholder @@ -612,8 +623,9 @@ impl Point self.x *= 2; // ^^^^ variable.language // ^ punctuation.accessor.dot - // ^^ keyword.operator - self.y *= 2; + // ^^ keyword.operator.assignment + self.y >>= 2; + // ^^^ keyword.operator.assignment.rust } fn sum((x, y): (i32, i32)) -> i32 { @@ -693,7 +705,7 @@ let f = |(x, y): (u32, &mut u32)| { x + y }; let c = a | b; -// ^ keyword.operator +// ^ keyword.operator.bitwise call_func(|c| 1 + 2 + c); // ^^^^^^^^^^^^^ meta.function.closure @@ -815,10 +827,10 @@ fn collect_vec() { // ^^^^^ storage.type // ^^^^^ storage.type // ^ punctuation.section.group.end -// ^ keyword.operator +// ^ keyword.operator.assignment // ^ punctuation.section.group.begin // ^ constant.numeric.integer.decimal -// ^^ keyword.operator +// ^^ keyword.operator.range // ^^ constant.numeric.integer.decimal // ^ punctuation.section.group.end // ^ punctuation.accessor.dot @@ -923,34 +935,47 @@ macro_rules! alternate_group ( ) macro_rules! kleene_star { +// ^^^^^^^^^^^^^^^^^^^^^^^^ meta.macro.rust - meta.macro.rust meta.macro.rust +// ^ meta.block.rust punctuation.section.block.begin.rust ($($arg:tt)+) => ( -// ^ meta.macro meta.block meta.group keyword.operator -// ^ meta.macro meta.block meta.group punctuation.section.group.begin -// ^^^^ meta.macro meta.block meta.group variable.other -// ^^^^^ meta.macro meta.block meta.group -// ^ meta.macro meta.block meta.group punctuation.section.group.end -// ^ meta.macro meta.block keyword.operator +// ^^^^^^^^^^^^^^^^^^ meta.macro meta.block +// ^^^^^^^^^^^^^ meta.group.macro-matcher +// ^^^^^^^^^^ meta.group.macro-matcher meta.group +// ^^ punctuation.section.group.begin +// ^ keyword.operator +// ^^^^ variable.parameter.macro.rust +// ^^ storage.type.rust +// ^ keyword.operator.rust +// ^ meta.group punctuation.section.group.end +// ^^ keyword.operator +// ^ meta.group.macro-body.rust punctuation.section.group.begin.rust println!($($arg)); ), ($($arg:tt)*) => ( -// ^^^^ meta.macro meta.block meta.group variable.other -// ^^^^^ meta.macro meta.block meta.group -// ^ meta.macro meta.block meta.group punctuation.section.group.end -// ^ meta.macro meta.block keyword.operator +// ^^^^^^^^^^^^^ meta.macro meta.block meta.group.macro-matcher +// ^^^^ variable.parameter.macro.rust +// ^^ meta.macro meta.block keyword.operator println!($($arg)*); +// ^^^^ variable.other.rust +// ^^^^^^^^^ meta.macro.rust meta.block.rust meta.group.macro-body.rust meta.group.rust ), - ($($arg:tt);+) => ( -// ^^^^ meta.macro meta.block meta.group variable.other -// ^^^^^^ meta.macro meta.block meta.group -// ^ meta.macro meta.block meta.group punctuation.section.group.end -// ^ meta.macro meta.block keyword.operator + ($($arg:tt) ; +) => ( +// ^^^^^^^^^^^^^^^^ meta.macro meta.block meta.group.macro-matcher +// ^^^^ variable.parameter.macro.rust +// ^^ meta.macro meta.block keyword.operator println!($($arg)); ), ($($arg:tt),*) => ( -// ^^^^ meta.macro meta.block meta.group variable.other -// ^^^^^^ meta.macro meta.block meta.group -// ^ meta.macro meta.block meta.group punctuation.section.group.end -// ^ meta.macro meta.block keyword.operator +// ^^^^^^^^^^^^^^ meta.macro meta.block meta.group.macro-matcher +// ^^^^ variable.parameter.macro.rust +// ^^ meta.macro meta.block keyword.operator + println!($($arg)*); + ), + +// incomplete blocks + ($($arg:tt),*) , +// ^ meta.macro.rust meta.block.rust punctuation.terminator.macro-matcher.rust + ($($x:tt),*) => ($x) , println!($($arg)*); ) } diff --git a/SQL/SQL.sublime-syntax b/SQL/SQL.sublime-syntax index 6ba447199b..c57ee6550a 100644 --- a/SQL/SQL.sublime-syntax +++ b/SQL/SQL.sublime-syntax @@ -6,18 +6,23 @@ file_extensions: - ddl - dml scope: source.sql + +variables: + end_identifier: (?=[ \t]*(?:[^\w'"`. \t]|$)) + contexts: main: - include: comments - - match: '(?i:\s*\b(create(?:\s+or\s+replace)?)\s+(aggregate|conversion|database|domain|function|group|(?:unique\s+)?index|language|operator class|operator|procedure|rule|schema|sequence|table|tablespace|trigger|type|user|view)\s+)(?:(\w+)|''(\w+)''|"(\w+)"|`(\w+)`)' + - match: |- + (?xi) + \b(create(?:\s+or\s+replace)?)\s+ + (aggregate|conversion|database|domain|function|group|(?:unique\s+)?index|language|operator class|operator|procedure|rule|schema|sequence|table(?:space)?|trigger|type|user|view) + \b\s* scope: meta.create.sql captures: 1: keyword.other.create.sql 2: keyword.other.sql - 3: entity.name.function.sql - 4: entity.name.function.sql - 5: entity.name.function.sql - 6: entity.name.function.sql + push: identifier_create - match: (?i:\s*\b(drop)\s+(aggregate|conversion|database|domain|function|group|index|language|operator class|operator|procedure|rule|schema|sequence|table|tablespace|trigger|type|user|view)) scope: meta.drop.sql captures: @@ -38,23 +43,23 @@ contexts: - match: |- (?xi) - # normal stuff, capture 1 - \b(bigint|bigserial|bit|boolean|box|bytea|cidr|circle|date|datetime|double\sprecision|inet|int|integer|line|lseg|macaddr|money|ntext|oid|path|point|polygon|real|serial|smallint|sysdate|sysname|text)\b + # normal stuff, capture 1 + \b(bigint|bigserial|bit|boolean|box|bytea|cidr|circle|date|datetime|double\sprecision|inet|int|integer|line|lseg|macaddr|money|ntext|oid|path|point|polygon|real|serial|smallint|sysdate|sysname|text)\b - # numeric suffix, capture 2 + 3i - |\b(bit\svarying|character\s(?:varying)?|tinyint|var\schar|float|interval)\((\d+)\) + # numeric suffix, capture 2 + 3i + |\b(bit\svarying|character\s(?:varying)?|tinyint|var\schar|float|interval)\((\d+)\) - # optional numeric suffix, capture 4 + 5i - |\b(char|number|nvarchar|varbinary|varchar\d?)\b(?:\((\d+)\))? + # optional numeric suffix, capture 4 + 5i + |\b(char|number|nvarchar|varbinary|varchar\d?)\b(?:\((\d+)\))? - # special case, capture 6 + 7i + 8i - |\b(numeric|decimal)\b(?:\((\d+),(\d+)\))? + # special case, capture 6 + 7i + 8i + |\b(numeric|decimal)\b(?:\((\d+),(\d+)\))? - # special case, captures 9, 10i, 11 - |\b(times?)\b(?:\((\d+)\))?(\swith(?:out)?\stime\szone\b)? + # special case, captures 9, 10i, 11 + |\b(times?)\b(?:\((\d+)\))?(\swith(?:out)?\stime\szone\b)? - # special case, captures 12, 13, 14i, 15 - |\b(timestamp)(?:(s|tz))?\b(?:\((\d+)\))?(\s(with|without)\stime\szone\b)? + # special case, captures 12, 13, 14i, 15 + |\b(timestamp)(?:(s|tz))?\b(?:\((\d+)\))?(\s(with|without)\stime\szone\b)? captures: @@ -79,26 +84,29 @@ contexts: scope: constant.numeric.sql - match: (?i:\b(true|false)\b) scope: constant.boolean.sql - - match: (?i:\b(select(\s+(distinct|top))?|insert(\s+(ignore\s+)?into)?|update|delete|truncate|from|set|where|group\sby|or|like|between|and|with|case|when|then|else|end|union(\s+all)?|having|order\sby|limit|(inner|cross)\s+join|join|straight_join|(left|right)(\s+outer)?\s+join|natural(\s+(left|right)(\s+outer)?)?\s+join)\b) + - match: (?i:\b(select(\s+(distinct|top))?|insert(\s+(ignore\s+)?into)?|update|delete|truncate|from|set|where|group\s+by|with|case|when|then|else|end|union(\s+all)?|using|order\s+by|limit|(inner|cross)\s+join|join|straight_join|(left|right)(\s+outer)?\s+join|natural(\s+(left|right)(\s+outer)?)?\s+join)\b) scope: keyword.other.DML.sql - - match: (?i:\b(on|((is\s+)?not\s+)?null)\b) - scope: keyword.other.DDL.create.II.sql + - match: (?i:\b(?:(is)\s+)?(?:(not)\s+)?(null)\b) + captures: + 1: keyword.operator.logical.sql + 2: keyword.operator.logical.sql + 3: constant.language.sql + - match: (?i:\b(and|or|like|having|exists|between|in)\b) + scope: keyword.operator.logical.sql - match: (?i:\bvalues\b) scope: keyword.other.DML.II.sql - match: (?i:\b(begin(\s+work)?|start\s+transaction|commit(\s+work)?|rollback(\s+work)?)\b) scope: keyword.other.LUW.sql - match: (?i:\b(grant(\swith\sgrant\soption)?|revoke)\b) scope: keyword.other.authorization.sql - - match: (?i:\bin\b) - scope: keyword.other.data-integrity.sql - match: (?i:\s*\b(comment\s+on\s+(table|column|aggregate|constraint|database|domain|function|index|operator|rule|schema|sequence|trigger|type|view))\s+.*?\s+(is)\s+) scope: keyword.other.object-comments.sql - - match: (?i)\bAS\b - scope: keyword.other.alias.sql - - match: (?i)\b(DESC|ASC)\b + - match: (?i)\bas\b + scope: keyword.operator.assignment.alias.sql + - match: (?i)\b(asc|desc)\b scope: keyword.other.order.sql - match: \* - scope: keyword.operator.star.sql + scope: variable.language.star.sql - match: "<=>|[!<>]?=|<>|<|>" scope: keyword.operator.comparison.sql - match: '-|\+|/' @@ -144,28 +152,27 @@ contexts: - meta_scope: comment.block.c - match: \*/ pop: true + - match: ^\s*(\*)(?!/) + captures: + 1: punctuation.definition.comment.sql regexps: - match: /(?=\S.*/) - captures: - 0: punctuation.definition.string.begin.sql + scope: punctuation.definition.string.begin.sql push: - meta_scope: string.regexp.sql - match: / - captures: - 0: punctuation.definition.string.end.sql + scope: punctuation.definition.string.end.sql pop: true - include: string_interpolation - match: \\/ scope: constant.character.escape.slash.sql - match: '%r\{' comment: We should probably handle nested bracket pairs!?! -- Allan - captures: - 0: punctuation.definition.string.begin.sql + scope: punctuation.definition.string.begin.sql push: - meta_scope: string.regexp.modr.sql - match: '\}' - captures: - 0: punctuation.definition.string.end.sql + scope: punctuation.definition.string.end.sql pop: true - include: string_interpolation string_escape: @@ -179,46 +186,55 @@ contexts: 3: punctuation.definition.string.end.sql strings: - match: "'" - captures: - 0: punctuation.definition.string.begin.sql + scope: punctuation.definition.string.begin.sql push: - meta_scope: string.quoted.single.sql - match: "''" scope: constant.character.escape.sql - match: "'" - captures: - 0: punctuation.definition.string.end.sql + scope: punctuation.definition.string.end.sql pop: true - include: string_escape - match: "`" - captures: - 0: punctuation.definition.string.begin.sql + scope: punctuation.definition.string.begin.sql push: - meta_scope: string.quoted.other.backtick.sql - match: "`" - captures: - 0: punctuation.definition.string.end.sql + scope: punctuation.definition.string.end.sql pop: true - include: string_escape - match: '"' - captures: - 0: punctuation.definition.string.begin.sql + scope: punctuation.definition.string.begin.sql push: - meta_scope: string.quoted.double.sql - match: '""' scope: constant.character.escape.sql - match: '"' - captures: - 0: punctuation.definition.string.end.sql + scope: punctuation.definition.string.end.sql pop: true - include: string_interpolation - match: '%\{' - captures: - 0: punctuation.definition.string.begin.sql + scope: punctuation.definition.string.begin.sql push: - meta_scope: string.other.quoted.brackets.sql - match: '\}' - captures: - 0: punctuation.definition.string.end.sql + scope: punctuation.definition.string.end.sql pop: true - include: string_interpolation + identifier_create: + - meta_content_scope: meta.toc-list.full-identifier.sql + - match: '(?:(\w+)|''([^'']+)''|"([^"]+)"|`([^`]+)`){{end_identifier}}' + scope: meta.toc-list.full-identifier.sql + captures: + 1: entity.name.function.sql + 2: entity.name.function.sql + 3: entity.name.function.sql + 4: entity.name.function.sql + pop: true + # Schema identifiers + - match: (?:\w+|'[^']+'|"[^"]+"|`[^`]+`)\s*(\.) + captures: + 1: punctuation.accessor.dot.sql + # Handle situations where the schema and . + - match: '{{end_identifier}}' + pop: true diff --git a/SQL/syntax_test_sql.sql b/SQL/syntax_test_sql.sql index 62b982bad9..882a8639b5 100644 --- a/SQL/syntax_test_sql.sql +++ b/SQL/syntax_test_sql.sql @@ -9,16 +9,58 @@ SELECT "My "" Crazy Column Name" FROM my_table; ;CREATE TABLE foo (id INTEGER PRIMARY KEY); -- <- keyword.other.create --^^^^^ keyword.other.create +-- ^^^^^ keyword.other +-- ^^^ entity.name.function +-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - entity.name.function + +create table some_schema.test2( id serial ); +--^^^^ meta.create keyword.other.create +-- ^^^^^ meta.create keyword.other +-- ^^^^^^^^^^^^ - entity.name.function +-- ^ punctuation.accessor.dot +-- ^^^^^ entity.name.function +-- ^^^^^^^^^^^^^^ - entity.name.function + +create table some_schema . test2 ( id serial ); +--^^^^ meta.create keyword.other.create +-- ^^^^^ meta.create keyword.other +-- ^^^^^^^^^^^^^^ - entity.name +-- ^ punctuation.accessor.dot +-- ^^^^^ entity.name.function +-- ^^^^^^^^^^^^^^^ - entity.name.function + +create table "testing123" (id integer); +--^^^^ meta.create keyword.other.create +-- ^^^^^ meta.create keyword.other +-- ^ - entity.name.function +-- ^^^^^^^^^^ entity.name.function +-- ^^^^^^^^^^^^^^^^ - entity.name.function + +create table `dbo`."testing123" (id integer); +--^^^^ meta.create keyword.other.create +-- ^^^^^ meta.create keyword.other +-- ^^^^^^^ - entity.name.function +-- ^ punctuation.accessor.dot +-- ^^^^^^^^^^ entity.name.function +-- ^^^^^^^^^^^^^^^^ - entity.name.function + +select * +from some_table +where exists(select * from other_table where id = some_table.id) +-- ^^^^^^ keyword.operator.logical SELECT ( SELECT CASE field +USING a +-- <- keyword.other.DML WHEN 1 THEN -- comment's say that -- ^ comment.line.double-dash EXISTS( select 1) ELSE NULL + END ) as result @@ -27,8 +69,30 @@ This is a multiline comment -- ^ source.sql comment.block.c */ + +/** + * +-- ^ punctuation.definition.comment.sql +*/ + select <=> -- ^^^ keyword.operator.comparison.sql + +SELECT *, +-- ^^^ keyword.other.DML.sql +-- ^ variable.language.star.sql + f.id AS database_id +-- ^^ keyword.operator.assignment.alias.sql +FROM foo +WHERE f.a IS NULL +-- ^^ keyword.other.DML.sql +-- ^^ keyword.operator.logical.sql +-- ^^^^ constant.language.sql + AND f.b IS NOT NULL +-- ^^^ keyword.operator.logical.sql +-- ^^ keyword.operator.logical.sql +-- ^^^ keyword.operator.logical.sql +-- ^^^^ constant.language.sql diff --git a/Scala/Scala.sublime-syntax b/Scala/Scala.sublime-syntax index fa83f944a4..08a24b5736 100644 --- a/Scala/Scala.sublime-syntax +++ b/Scala/Scala.sublime-syntax @@ -5,6 +5,7 @@ name: Scala file_extensions: - scala - sbt + - sc scope: source.scala variables: # all reserved words (https://www.safaribooksonline.com/library/view/learning-scala/9781449368814/apa.html) @@ -17,7 +18,7 @@ variables: operator_character: '[\p{Sm}\p{So}[{{disallowed_as_operator}}&&[\x{20}-\x{7E}]]]' upper: '[$\p{Lu}]' # This is "letter", but without _ so we can ensure it is not last - idcont: '[$\p{Lu}\p{Ll}\p{Lt}\p{Lo}\p{Nl}0-9'']' + idcont: '[$\p{Lu}\p{Ll}\p{Lt}\p{Lo}\p{Nl}0-9]' # note the handling of ' characters in identifiers is somewhat conservative # TLS doesn't document this feature very well (read: at all), but this is how it's used @@ -35,10 +36,10 @@ variables: [:@\x{2190}\x{21D2}#]{{operator_character}}+ ) - # {{operator_character}}+ \ {:, =, =>, <-, @, ←, ⇒, #, <%, <:, :<, +, -} + # {{operator_character}}+ \ {:, =, =>, <-, @, ←, ⇒, #, <%, <:, :<} typeop: |- (?x: - [[^:=<@\x{2190}\x{21D2}#+\-]&&{{operator_character}}]{{operator_character}}*| + [[^:=<@\x{2190}\x{21D2}#]&&{{operator_character}}]{{operator_character}}*| =[[^>]&&{{operator_character}}]{{operator_character}}*| =>{{operator_character}}+| <(?!{{operator_character}}|[[:alpha:]])| @@ -46,7 +47,7 @@ variables: <[:%\-]{{operator_character}}+| :[[^<]&&{{operator_character}}]+| :<{{operator_character}}+| - [@\x{2190}\x{21D2}#+\-]{{operator_character}}+ + [@\x{2190}\x{21D2}#]{{operator_character}}+ ) idrest: '(?:(?:{{idcont}}|_(?=[^{{operator_character}}]))*(?:_{{operator_character}}+)?)' @@ -124,6 +125,9 @@ contexts: - match: \*/ scope: punctuation.definition.comment.scala pop: true + - match: ^\s*(\*)(?!/) + captures: + 1: punctuation.definition.comment.scala - match: (@\w+\s) scope: keyword.other.documentation.scaladoc.scala - match: '\{@link\s+[^\}]*\}' @@ -150,8 +154,19 @@ contexts: captures: 1: punctuation.definition.comment.scala + ascription-no-function: + - match: '{{typeprefix}}' + captures: + 1: punctuation.ascription.scala + push: + - match: '(?={{rightarrow}})' + pop: true + - include: single-type-expression-no-function + ascription: - match: '{{typeprefix}}' + captures: + 1: punctuation.ascription.scala push: single-type-expression annotation: @@ -176,15 +191,25 @@ contexts: annotation-parameters: - meta_content_scope: meta.annotation.parameters.scala + - match: (?=\(\)) + push: + - match: \( + scope: punctuation.section.arguments.annotation.begin.scala + - match: (?=\)) + scope: punctuation.section.arguments.annotation.end.scala + pop: true - match: \( scope: punctuation.section.arguments.annotation.begin.scala push: - - match: ',' - scope: punctuation.separator.arguments.annotation.scala - - match: \) + - match: (?=\)) scope: punctuation.section.arguments.annotation.end.scala pop: true + - match: ',' + scope: punctuation.separator.arguments.annotation.scala - include: main + - match: \) + scope: punctuation.section.arguments.annotation.end.scala + pop: true - match: \[ scope: punctuation.section.arguments.annotation.begin.scala push: @@ -197,16 +222,18 @@ contexts: lambdas: # lambda lookahead - - match: '(?=({{idorunder}}|{{idorunder}}\s*:(\s*{{id}}\s*{{withinbrackets}}?(\s*[\.#]\s*{{id}}\s*{{withinbrackets}}?)*)+|{{idorunder}}\s*:\s*{{withinparens}}|{{withinparens}})\s*(?:{{rightarrow}})[[[:alpha:]]0-9\s\)\]\}])' + - match: '(?=({{idorunder}}|{{idorunder}}\s*:(\s*{{id}}\s*{{withinbrackets}}?(\s*[\.#]\s*{{id}}\s*{{withinbrackets}}?)*)+|{{idorunder}}\s*:\s*{{withinparens}}|{{withinparens}})\s*(?:{{rightarrow}})(?:/\*|//|[[[:alpha:]]0-9\s\)\]\}]))' push: - match: '{{rightarrow}}' - scope: storage.type.function.arrow.scala + scope: storage.type.function.arrow.lambda.scala pop: true - include: lambda-declaration lambda-declaration-base: - match: \( + scope: punctuation.section.group.begin.scala push: - match: \) + scope: punctuation.section.group.end.scala pop: true - include: lambda-declaration-parens - match: '{{id}}' @@ -215,6 +242,8 @@ contexts: scope: variable.language.underscore.scala lambda-declaration-parens: - match: '{{typeprefix}}' + captures: + 1: punctuation.ascription.scala push: - match: ',' scope: punctuation.separator.scala @@ -225,6 +254,8 @@ contexts: - include: lambda-declaration-base lambda-declaration: - match: '{{typeprefix}}' + captures: + 1: punctuation.ascription.scala push: - match: '(?={{nonopchar}}({{rightarrow}}){{nonopchar}})' pop: true @@ -232,33 +263,45 @@ contexts: - include: lambda-declaration-base base-types: - - match: \b(Unit|Boolean|Byte|Char|Short|Int|Float|Long|Double|Any|AnyRef|AnyVal|Nothing)\b + - match: \b(?:Unit|Boolean|Byte|Char|Short|Int|Float|Long|Double|Any|AnyRef|AnyVal|Nothing)\b scope: storage.type.primitive.scala literal-constants: - - match: \b(false|null|true)\b + - match: \b(?:false|null|true)\b scope: constant.language.scala # TODO negation # source: http://www.scala-lang.org/files/archive/spec/2.11/01-lexical-syntax.html#floating-point-literals - match: |- - (?x) - \b(?:[0-9]+\.[0-9]+(?:[eE][+\-]?[0-9]+)?[fFdD]?)\b| - (?:\.[0-9]+(?:[eE][+\-]?[0-9]+)?[fFdD]?)\b| - \b(?:[0-9]+(?:[eE][+\-]?[0-9]+)[fFdD]?)\b| - \b(?:[0-9]+(?:[eE][+\-]?[0-9]+)?[fFdD])\b - scope: constant.numeric.float.scala + (?x: + # 1.1, 1.1e1, 1.1e-1, 1.1d, 1.1e1d, 1.1e-1d, 1.e1d | 1e1 1e1d | 1d + \b\d+ (?: (?: (\.) \d+ (?:[eE][-+]?\d+)? | (?:[eE][-+]?\d+) ) ([dDfF])? | ([dDfF]) ) + # .1, .1e1, .1e-1 + | (\.) \d+ (?:[eE][-+]?\d+)? ([dDfF])? + )\b + scope: constant.numeric.float.decimal.scala + captures: + 1: punctuation.separator.decimal.scala + 2: storage.type.numeric.scala + 3: storage.type.numeric.scala + 4: punctuation.separator.decimal.scala + 5: storage.type.numeric.scala # source: http://www.scala-lang.org/files/archive/spec/2.11/01-lexical-syntax.html#integer-literals - - match: '\b(?:0[xX][0-9a-fA-F]+[lL]?)\b' - scope: constant.numeric.hex.scala - - match: '\b(?:(?:0|[1-9][0-9]*)[lL]?)\b' - scope: constant.numeric.integer.scala - - match: '\(\)' + - match: \b(0[xX])\h+([lL]?)\b + scope: constant.numeric.integer.hexadecimal.scala + captures: + 1: punctuation.definition.numeric.base.scala + 2: storage.type.numeric.scala + - match: \b(?:0|[1-9][0-9]*)([lL]?)\b + scope: constant.numeric.integer.decimal.scala + captures: + 1: storage.type.numeric.scala + - match: \(\) scope: constant.language.scala base-constants: - include: literal-constants - - match: \b(this|super)\b + - match: \b(?:this|super)\b scope: variable.language.scala # base-types with try-dispatch followup - - match: \b(Unit|Boolean|Byte|Char|Short|Int|Float|Long|Double)\b + - match: \b(?:Unit|Boolean|Byte|Char|Short|Int|Float|Long|Double)\b scope: storage.type.primitive.scala push: try-dispatch constants: @@ -272,13 +315,18 @@ contexts: push: try-dispatch try-dispatch: - match: '\(' + scope: punctuation.section.group.begin.scala push: - match: \) + scope: punctuation.section.group.end.scala pop: true - include: main - match: '\[' + scope: punctuation.definition.generic.begin.scala push: + - meta_scope: meta.generic.scala - match: \] + scope: punctuation.definition.generic.end.scala pop: true - include: delimited-type-expression - match: '(?=[\S\n;])' @@ -290,7 +338,7 @@ contexts: 1: storage.type.function.scala 2: entity.name.function.scala push: function-type-parameter-list - - match: '\b(case\s+)?(class|trait|object)(?:\s+({{id}}))' + - match: '\b(case\s+)?(class|trait|object)(\s+({{id}}))' scope: meta.class.identifier.scala captures: 1: storage.type.class.scala @@ -305,8 +353,11 @@ contexts: - match: '(?=[\n;\}\)\]])' pop: true - match: '\[' + scope: punctuation.definition.generic.begin.scala push: + - meta_scope: meta.generic.scala - match: '\]' + scope: punctuation.definition.generic.end.scala pop: true - include: type-constraints - include: delimited-type-expression @@ -316,33 +367,31 @@ contexts: - match: '(?=[\n\}\)\]])' pop: true - include: delimited-type-expression - - match: '=' + - match: '=[ \t]*' scope: keyword.operator.assignment.scala - set: type-alias-body + set: single-type-expression-leading-newline - match: '\b(var)\s+({{id}})' captures: 1: storage.type.volatile.scala - 2: entity.name.var.scala - - match: '\b(val)\b' - captures: - 1: storage.type.stable.scala - push: - - match: '(?=[=\n\}\)\]])' - pop: true - - include: val-pattern-match + 2: variable.other.readwrite.scala + - match: '\bval\b' + scope: storage.type.stable.scala + push: val-simple-body - match: '\b(package)\s+(object)\s+({{id}})' captures: 1: keyword.control.scala 2: storage.type.class.scala 3: entity.name.class.scala push: class-inheritance-extends - - match: '\b(package)\s+({{id}}(?:\.{{id}})*)\s*\{' + - match: '\b(package)\s+({{id}}(?:\.{{id}})*)\s*(\{)' captures: 1: keyword.control.scala 2: entity.name.namespace.scoped.scala + 3: punctuation.section.block.begin.scala push: - meta_scope: meta.namespace.scala - match: '\}' + scope: punctuation.section.block.end.scala pop: true - include: main - match: '\b(package)\s+({{id}}(?:\.{{id}})*)' @@ -351,42 +400,29 @@ contexts: 1: keyword.control.scala 2: entity.name.namespace.header.scala # what follows is identical to case-pattern, except it goes to case-body-first - - match: '\b(case)\b(?!\s+class\b)' + - match: '\bcase\b(?!\s+class\b)' scope: keyword.other.declaration.scala push: - meta_content_scope: meta.pattern.scala - match: '(?=\bclass\b)' pop: true - - match: '\b(if)\b' - captures: - 1: keyword.control.flow.scala + - match: '\bif\b' + scope: keyword.control.flow.scala set: - match: '{{rightarrow}}' - scope: keyword.operator.arrow.scala + scope: storage.type.function.arrow.case.scala set: case-body-first - include: main-no-lambdas # eliminates arrow from the pattern meta scope - match: '(?={{rightarrow}})' set: - match: '{{rightarrow}}' - scope: keyword.operator.arrow.scala + scope: storage.type.function.arrow.case.scala set: case-body-first - match: '(?=\}|\bcase\b)' # makes typing more pleasant pop: true - include: pattern-match - type-alias-body: - - match: \n - set: type-alias-body-newline - - match: '(?=[;\}\)\]])' - pop: true - - include: delimited-type-expression - - type-alias-body-newline: - - include: decl-newline-double-check - - match: (?=\S) - set: type-alias-body - case-body-first: - meta_content_scope: meta.block.case.first.scala - match: \{ @@ -413,23 +449,22 @@ contexts: # this exists to clear the meta_scope from first or non-first case-pattern: - - match: '\b(case)\b' + - match: '\bcase\b' scope: keyword.other.declaration.scala set: - meta_content_scope: meta.pattern.scala - - match: '\b(if)\b' - captures: - 1: keyword.control.flow.scala + - match: '\bif\b' + scope: keyword.control.flow.scala set: - match: '{{rightarrow}}' - scope: keyword.operator.arrow.scala + scope: storage.type.function.arrow.case.scala set: case-body-non-first - include: main-no-lambdas # eliminates arrow from the pattern meta scope - match: '(?={{rightarrow}})' set: - match: '{{rightarrow}}' - scope: keyword.operator.arrow.scala + scope: storage.type.function.arrow.case.scala set: case-body-non-first - match: '(?=\}|\bcase\b)' # makes typing more pleasant pop: true @@ -457,7 +492,7 @@ contexts: - meta_scope: meta.group.scala - match: \) scope: punctuation.section.group.end.scala - pop: true + set: try-dispatch - include: main - match: \{ scope: punctuation.section.block.begin.scala @@ -472,7 +507,7 @@ contexts: # this is included when a single newline is found in a declaration # you should never push/set this context, only include decl-newline-double-check: - - match: '(?=[\{\}\)]|\b(case|class|def|val|var|trait|object|private|protected|for|while|if|final|sealed|implicit|type|import|override)\b)' + - match: '(?=[\{\}\)]|\b(?:case|class|def|val|var|trait|object|private|protected|for|while|if|final|sealed|implicit|type|import|override)\b)' pop: true - match: '\n' pop: true @@ -481,8 +516,10 @@ contexts: - match: '(?=\()' set: function-parameter-list - match: '\[' + scope: punctuation.definition.generic.begin.scala push: function-tparams-brackets - match: ':' + scope: punctuation.ascription.scala set: function-return-type-definition - match: '(?=[\{\};]|{{nonopchar}}?={{nonopchar}})' pop: true @@ -497,9 +534,12 @@ contexts: set: function-type-parameter-list function-tparams-brackets: + - meta_scope: meta.generic.scala - match: '\[' + scope: punctuation.definition.generic.begin.scala push: function-tparams-brackets - match: '\]' + scope: punctuation.definition.generic.end.scala pop: true - include: type-constraints - include: delimited-type-expression @@ -520,14 +560,18 @@ contexts: function-parameter-list: - match: '\(' + scope: punctuation.section.group.begin.scala push: - match: '\)' + scope: punctuation.section.group.end.scala pop: true - match: '({{alphaid}})(?=\s*:)' captures: 1: variable.parameter.scala push: - match: '{{typeprefix}}' + captures: + 1: punctuation.ascription.scala set: - match: '(\*)\s*(?=[\),=])' captures: @@ -542,7 +586,7 @@ contexts: pop: true - include: main - match: ':' - scope: punctuation.separator.scala + scope: punctuation.ascription.scala set: function-return-type-definition - match: '\n' set: function-parameter-list-newline @@ -555,13 +599,19 @@ contexts: set: function-parameter-list class-type-parameter-list: - - match: '\b(private|protected)\b' + - match: '\b(?:private|protected)\b' scope: storage.modifier.access.scala + - match: (?=@{{plainid}}) + set: + - include: annotation + - match: '(?=\S)' + set: class-type-parameter-list - match: '(?=\()' set: class-parameter-list - match: '\[' + scope: punctuation.definition.generic.begin.scala push: class-tparams-brackets - - match: '(?=\b(extends|with)\b)' + - match: '(?=\b(?:extends|with)\b)' set: class-inheritance-extends - match: '(?=\{)' set: class-pre-inheritance-early-initializer @@ -576,27 +626,36 @@ contexts: set: class-type-parameter-list class-tparams-brackets: + - meta_scope: meta.generic.scala - match: '\[' + scope: punctuation.definition.generic.begin.scala push: class-tparams-brackets - match: '\]' + scope: punctuation.definition.generic.end.scala pop: true - - match: '\b(this|super)\b' + - match: '\b(?:this|super)\b' scope: variable.language.scala - include: type-constraints - include: delimited-type-expression class-parameter-list: - match: '\(' + scope: punctuation.section.group.begin.scala push: - match: '\)' + scope: punctuation.section.group.end.scala pop: true - - match: '\b(val)\b' + - match: '\bval\b' scope: storage.type.scala + - match: '\bvar\b' + scope: storage.type.volatile.scala - match: '({{alphaid}})(?=\s*:)' captures: 1: variable.parameter.scala push: - match: '{{typeprefix}}' + captures: + 1: punctuation.ascription.scala set: - match: '(\*)\s*(?=[\),=])' captures: @@ -610,7 +669,7 @@ contexts: - match: '(?=[=])' pop: true - include: main - - match: '(?=\b(extends|with)\b)' + - match: '(?=\b(?:extends|with)\b)' set: class-inheritance-extends - match: '(?=\{)' set: class-pre-inheritance-early-initializer @@ -633,7 +692,7 @@ contexts: scope: punctuation.section.braces.end.scala pop: true - include: main - - match: '(?=\b(extends|with)\b)' + - match: '(?=\b(?:extends|with)\b)' set: class-inheritance-extends - match: '(?=\S)' pop: true @@ -677,10 +736,10 @@ contexts: scope: entity.other.inherited-class.scala set: class-inheritance-extends-token-after - match: \( - scope: punctuation.section.parens.begin.scala + scope: punctuation.definition.parens.begin.scala set: - match: \) - scope: punctuation.section.parens.end.scala + scope: punctuation.definition.parens.end.scala set: class-inheritance-with - include: delimited-type-expression - match: '\n' @@ -694,6 +753,7 @@ contexts: set: class-inheritance-extends-token class-inheritance-extends-token-after: + # we don't use punctuation.definition here because it's not part of the type anymore - match: \( scope: punctuation.section.parens.begin.scala push: @@ -702,13 +762,13 @@ contexts: pop: true - include: main - match: \[ - scope: punctuation.section.brackets.begin.scala + scope: punctuation.definition.generic.begin.scala push: - match: \] - scope: punctuation.section.brackets.end.scala + scope: punctuation.definition.generic.end.scala pop: true - include: delimited-type-expression - - match: (?=\b(with|extends)\b) + - match: (?=\b(?:with|extends)\b) set: class-inheritance-with - match: (?=\{) set: class-inheritance-early-initializer @@ -761,33 +821,34 @@ contexts: set: class-inheritance-with imports: - - match: \b(import)\b + - match: \bimport\b scope: keyword.other.import.scala push: - meta_scope: meta.import.scala - - match: ',\n' # TODO operator scoping for , and . in imports + - match: '(,)[ \t]*\n' # TODO real newline inference + captures: + 1: punctuation.separator.scala + - match: ',' + scope: punctuation.separator.scala - match: '(?=[\n;])' pop: true - - match: '(?:{{id}}\.)+{{id}}?' - scope: variable.package.scala - match: '{{id}}' - scope: variable.import.scala + - match: \. + scope: punctuation.accessor.dot.scala - match: '_' scope: variable.language.underscore.scala - match: "{" + scope: punctuation.section.group.begin.scala push: - meta_scope: meta.import.selector.scala - match: "}" + scope: punctuation.section.group.end.scala pop: true - - match: '({{id}})\s*({{rightarrow}})\s*({{id}})' - captures: - 1: variable.import.renamed-from.scala - 2: keyword.operator.arrow.scala - 3: variable.import.renamed-to.scala + - match: ',' + scope: punctuation.separator.scala - match: '{{rightarrow}}' scope: keyword.operator.arrow.scala - match: '{{id}}' - scope: variable.import.scala - match: '_' scope: variable.language.underscore.scala @@ -795,41 +856,117 @@ contexts: # it would be incorrect to scope operators specially, since they are just identifiers # by pulling them out HERE though and refusing to scope them, we emulate lookbehind operators: + - match: ; + scope: punctuation.terminator.scala - match: '{{op}}(?=[\(\[])' # no explicit scope, just pulling it out push: try-dispatch - match: '{{op}}' # no explicit scope, just pulling it out initialization: - - match: '\b(new)(?:\s+|\b)' - captures: - 1: keyword.other.scala - push: - # anonymous inner class AnyRef declaration syntax - - match: '(?=\{)' - pop: true - # emergency bail-out for better experience while typing - - match: '(?=[\n\}\),])' - pop: true - - match: '(?=\S)' - set: single-type-expression - try-initialization: - - match: (?=\s*with\b) - set: single-type-expression-tail - - include: try-dispatch + - match: '\bnew\b' + scope: keyword.other.scala + push: initialization-body + + initialization-block: + - match: \{ + scope: punctuation.section.block.begin.scala + set: + - meta_scope: meta.block.scala + - match: \} + scope: punctuation.section.block.end.scala + set: initialization-term-tail + - include: main + + initialization-body-base: + - include: initialization-block + - match: \( + scope: punctuation.section.group.begin.scala + set: + - match: \) + scope: punctuation.section.group.end.scala + set: initialization-term-tail + - include: delimited-type-expression + - match: \[ + scope: punctuation.definition.generic.begin.scala + set: + - meta_scope: meta.generic.scala + - match: \] + scope: punctuation.definition.generic.end.scala + set: initialization-term-tail + - include: delimited-type-expression + - match: '\bwith\b' + scope: keyword.declaration.scala + set: initialization-body-allow-newline + - match: '{{upperid}}' + scope: support.class.scala + set: initialization-term-tail + - match: '{{typeid}}' + scope: support.type.scala + set: initialization-term-tail + + initialization-body-allow-newline: + - include: initialization-body-base + - match: \n + set: initialization-body + + initialization-body: + - include: initialization-body-base + # emergency bail-out for better experience while typing + - match: '(?=[\S\n])' + pop: true + + initialization-term-tail: + - include: initialization-block + - match: '(?=\s+with\b)' + set: initialization-body + - match: \( + scope: punctuation.section.group.begin.scala + set: + - match: \) + scope: punctuation.section.group.end.scala + set: + - match: '(?=\s+with\b)' + set: initialization-body + - match: '(?=.)' + pop: true + - include: main + - match: \[ + scope: punctuation.definition.generic.begin.scala + set: + - meta_scope: meta.generic.scala + - match: \] + scope: punctuation.definition.generic.end.scala + set: + - match: '(?=\s+with\b)' + set: initialization-body + - match: '(?=\s*\()' + set: initialization-term-tail + - match: '(?=.)' + pop: true + - include: delimited-type-expression + - match: '[.#]' + scope: punctuation.accessor.scala + set: initialization-body-allow-newline + - match: '(?=[^ \t])' + pop: true for-comprehension: - - match: '\b(for)\s*\{' + - match: '\b(for)\s*(\{)' captures: 1: keyword.control.flow.scala + 2: punctuation.section.block.begin.scala push: - match: '\}' + scope: punctuation.section.block.end.scala pop: true - include: for-braces-body - - match: '\b(for)\s*\(' + - match: '\b(for)\s*(\()' captures: 1: keyword.control.flow.scala + 2: punctuation.section.group.begin.scala push: - match: '\)' + scope: punctuation.section.group.end.scala pop: true - include: for-parens-body for-braces-body: @@ -846,7 +983,7 @@ contexts: (?:{{nonopchar}}|_)(<-|\x{2190}|=){{nonopchar}} ) push: - - match: '\b(val)\b' + - match: '\bval\b' scope: storage.type.stable.scala - match: <-|\x{2190}|= scope: keyword.operator.assignment.scala @@ -855,13 +992,13 @@ contexts: - include: main - include: main for-parens-body: - - match: '\b(if)\b' + - match: '\bif\b' scope: keyword.control.flow.scala push: for-parens-expr - match: '<-|\x{2190}|=' scope: keyword.operator.assignment.scala push: for-parens-expr - - match: '\b(val)\b' + - match: '\bval\b' scope: storage.type.stable.scala - include: pattern-match for-parens-expr: @@ -872,18 +1009,18 @@ contexts: - include: main keywords: - - match: \b(return|throw)\b + - match: \b(?:return|throw)\b scope: keyword.control.flow.jump.scala - - match: \b(else|if|do|while|for|yield|match)\b + - match: \b(?:else|if|do|while|for|yield|match)\b scope: keyword.control.flow.scala - - match: \b(catch|finally|try)\b + - match: \b(?:catch|finally|try)\b scope: keyword.control.exception.scala - - match: \b(macro)\b + - match: \bmacro\b scope: keyword.other.scala - match: \?\?\? scope: keyword.other.scala - - match: \b(eq|ne)\b - scope: keyword.operator.word.scala + - match: '[!=]=(?={{nonopchar}})|\b(?:eq|ne)\b' + scope: keyword.operator.comparison.scala late-keywords: - match: \bextends\b @@ -900,7 +1037,7 @@ contexts: scope: storage.type.scala - match: \bvar\b scope: storage.type.volatile.scala - - match: \b(package)\b + - match: \bpackage\b scope: keyword.control.scala late-operators: @@ -931,9 +1068,9 @@ contexts: scope: constant.other.symbol.scala storage-modifiers: - - match: '\b(private\[\S+\]|protected\[\S+\]|private|protected)\b' + - match: '\b(?:private\[\S+\]|protected\[\S+\]|private|protected)\b' scope: storage.modifier.access.scala - - match: \b(abstract|final|lazy|sealed|implicit|override)\b + - match: \b(?:abstract|final|lazy|sealed|implicit|override)\b scope: storage.modifier.other.scala # see http://www.scala-lang.org/docu/files/ScalaReference.pdf part 1.3.5-6 (page 18) @@ -1056,10 +1193,14 @@ contexts: scope: constant.other.formatting.scala interpolated-vars-expressions: - - match: '(\$){{alphaid}}' - scope: variable.other.scala - captures: - 1: punctuation.definition.variable.scala + # we duplicate this pattern to encode a greedy ? on the ['] + - match: '\$(?={{alphaid}})' + scope: punctuation.definition.variable.scala variable.other.scala + push: + - clear_scopes: 1 + - match: '{{alphaid}}' + scope: variable.other.scala + pop: true - match: '\$\{' scope: punctuation.definition.expression.scala push: @@ -1205,13 +1346,16 @@ contexts: - include: xml-should-be-entity val-pattern-match-main: - - include: keywords + - match: '(?={{keywords}})' + pop: true + - include: base-constants - include: char-literal - include: scala-symbol - include: strings - include: xml-literal - include: late-keywords + - match: '`' scope: punctuation.definition.identifier.scala push: @@ -1238,7 +1382,7 @@ contexts: - match: (?=\S) pop: true - match: '\b{{varid}}' - scope: entity.name.val.scala + scope: variable.other.constant.scala - match: \[ push: - match: \] @@ -1253,25 +1397,63 @@ contexts: scope: variable.language.underscore.scala - match: ',' scope: punctuation.separator.scala - val-pattern-match: - - match: '(?:{{upperid}}|{{op}})(?=[\s=:])' - scope: entity.name.val.scala + - include: ascription + + val-bailout: + - match: '(?=[=\n\}\)\]])' + pop: true + + val-simple-ascription: + - match: '\bif\b' + scope: invalid.keyword.if-in-val-match.scala + pop: true + - match: '(?=[\]\}\)])' + pop: true + - match: '(?={{nonopchar}}?={{nonopchar}})' + pop: true + - include: delimited-type-expression + - match: '(?=[\{\n])' + pop: true + + val-simple-body: + - include: val-bailout + + - match: '(?={{keywords}})' + pop: true + + # special form lookahead to prevent invalid operator ascription syntax + - match: '(?:{{op}}|{{id}}_{{operator_character}}*):(?=\s+:|\s*=|\s*$)' + scope: variable.other.constant.scala + set: val-simple-body-tail + - match: '({{op}}|{{id}}_{{operator_character}}*)(:)(?=\s)' + captures: + 1: variable.other.constant.scala + 2: invalid.ascription.following-operator.scala + set: val-simple-ascription + + # an id followed by a type, or an =, or EOL + - match: '{{id}}(?=\s*:{{nonopchar}}|\s*=|\s*$)' + scope: variable.other.constant.scala + set: val-simple-body-tail + - match: (?=\S) + set: + - include: val-bailout + - include: val-pattern-match + + val-simple-body-tail: - match: '{{typeprefix}}' - push: - - match: '\bif\b' - scope: invalid.keyword.if-in-val-match.scala - pop: true - - match: '(?=[\]\}\)])' - pop: true - - match: '(?={{nonopchar}}?={{nonopchar}})' - pop: true - - include: delimited-type-expression - - match: '(?=[\{\n])' - pop: true + captures: + 1: punctuation.ascription.scala + set: val-simple-ascription + - match: (?=\S) + pop: true + + val-pattern-match: - include: val-pattern-match-main - match: \( scope: punctuation.section.group.begin.scala push: val-pattern-match-inner-paren + val-pattern-match-inner-paren: - match: \( scope: punctuation.section.group.begin.scala @@ -1281,12 +1463,6 @@ contexts: pop: true - include: val-pattern-match-inner val-pattern-match-inner: - # ascription with ',' stop token - - match: '{{typeprefix}}' - push: - - match: '(?=,)' - pop: true - - include: single-type-expression - include: val-pattern-match-main - match: '{{upperid}}|\b{{varid}}(?=\s*\()' scope: support.class.scala @@ -1353,6 +1529,8 @@ contexts: nested-pattern-match: - include: base-pattern-match - match: '{{typeprefix}}' + captures: + 1: punctuation.ascription.scala push: - match: '(?=[,\)@])' pop: true @@ -1366,7 +1544,7 @@ contexts: - include: nested-pattern-match pattern-match: - include: base-pattern-match - - include: ascription + - include: ascription-no-function - match: \( scope: punctuation.section.group.begin.scala push: @@ -1375,79 +1553,133 @@ contexts: pop: true - include: nested-pattern-match - base-type-expression: + base-type-expression-no-function: + - match: ; + scope: punctuation.terminator.scala + pop: true - match: \( + scope: punctuation.definition.group.begin.scala push: - match: \) + scope: punctuation.definition.group.end.scala pop: true - include: delimited-type-expression - match: \[ + scope: punctuation.definition.generic.begin.scala push: - match: \] + scope: punctuation.definition.generic.end.scala pop: true - include: delimited-type-expression - match: \{ + scope: punctuation.definition.block.begin.scala push: - match: \} + scope: punctuation.definition.block.end.scala pop: true - include: declarations - - match: =>|\x{21D2} - scope: keyword.operator.arrow.scala - match: '_\s*\*' scope: keyword.operator.varargs.scala + + base-type-expression: + - include: base-type-expression-no-function + - match: '{{rightarrow}}' + scope: keyword.operator.arrow.scala + type-constraints: - match: '<:|>:|<%|\+|-|:' scope: keyword.operator.bound.scala + delimited-type-expression: - include: annotation # kind-projector support - - match: '\?' - scope: variable.language.qmark.scala + - match: '\?|\*' + scope: variable.language.hole.scala # \x{03BB} = λ - match: '\bLambda\b|\x{03BB}' scope: keyword.operator.type-lambda.scala - - match: '\b(type)\b' + - match: '\btype\b' scope: keyword.other.scala - - match: '\b(with)\b' + - match: '\bwith\b' scope: keyword.declaration.scala - match: '[\.#]' scope: punctuation.accessor.scala - - include: literal-constants - - include: char-literal - - include: scala-symbol - - include: strings + - match: ',' + scope: punctuation.separator.scala + # - include: literal-constants + # - include: char-literal + # - include: scala-symbol + # - include: strings - include: base-types - - match: '\b(forSome)\b' + - match: '\b(?:forSome)\b' scope: keyword.declaration.scala - - match: '\b(this|super)\b' + - match: '\b(?:this|super)\b' scope: variable.language.scala + - match: '(?={{keywords}})' + pop: true - match: '{{upperid}}' scope: support.class.scala - match: _ + scope: variable.language.underscore.scala - match: '{{typeid}}' scope: support.type.scala - include: base-type-expression - - match: '(?={{keywords}})' + + # single-type is a type expression with semicolon inference + single-type-expression-no-function: + - match: '\btype\b' + scope: keyword.other.scala + - match: \b(?:Unit|Boolean|Byte|Char|Short|Int|Float|Long|Double)\b + scope: storage.type.primitive.scala + set: single-type-expression-tail-no-function + - match: '\b(?:forSome)\b' + scope: keyword.declaration.scala + - match: '\b(?:this|super)\b' + scope: variable.language.scala + set: single-type-expression-tail-no-function + - match: '{{upperid}}' + scope: support.class.scala + set: single-type-expression-tail-no-function + # - include: literal-constants + # - include: char-literal + # - include: scala-symbol + # - include: strings + - match: '{{typeid}}' + scope: support.type.scala + set: single-type-expression-tail-no-function + - match: (?=@{{plainid}}) + set: single-type-expression-tail-no-function + - match: \( + scope: punctuation.definition.generic.begin.scala + set: + - match: \) + scope: punctuation.definition.generic.end.scala + set: single-type-expression-tail-no-function + - include: delimited-type-expression + - include: base-type-expression-no-function + - match: '(?=.)' # we can be SUPER aggressive about popping out here pop: true + single-type-expression: - match: '(?=\bif\b)' # for pattern matching pop: true - - match: '\b(type)\b' + - match: '\btype\b' scope: keyword.other.scala - - match: \b(Unit|Boolean|Byte|Char|Short|Int|Float|Long|Double)\b + - match: \b(?:Unit|Boolean|Byte|Char|Short|Int|Float|Long|Double)\b scope: storage.type.primitive.scala set: single-type-expression-tail - - match: '\b(forSome)\b' + - match: '\b(?:forSome)\b' scope: keyword.declaration.scala - - match: '\b(this|super)\b' + - match: '\b(?:this|super)\b' scope: variable.language.scala + set: single-type-expression-tail - match: '{{upperid}}' scope: support.class.scala set: single-type-expression-tail - - include: literal-constants - - include: char-literal - - include: scala-symbol - - include: strings + # - include: literal-constants + # - include: char-literal + # - include: scala-symbol + # - include: strings - match: '(?={{keywords}})' pop: true - match: '{{typeid}}' @@ -1455,9 +1687,89 @@ contexts: set: single-type-expression-tail - match: (?=@{{plainid}}) set: single-type-expression-tail + - match: \( + scope: punctuation.definition.group.begin.scala + set: + - match: \) + scope: punctuation.definition.group.end.scala + set: single-type-expression-tail + - include: delimited-type-expression - include: base-type-expression - - match: '(?=[\s,\)\}\]])' + - match: '(?=.)' # we can be SUPER aggressive about popping out here pop: true + + # single-type-expression, but with an allowance for one *leading* newline and whitespace + single-type-expression-leading-newline: + - match: \n + set: + - match: '\s+' + set: single-type-expression + - match: '(?=\S)' + set: single-type-expression + - match: '\s+' + set: single-type-expression + - match: '(?=.)' + set: single-type-expression + + # we already saw one type component, now we *might* see a second + single-type-expression-tail-no-function: + - match: (?=@{{plainid}}) + set: + - include: annotation + - match: '(?=\S)' + set: single-type-expression-tail-no-function + - match: '[\.#]' + scope: punctuation.accessor.scala + set: single-type-expression-no-function + - match: \[ + scope: punctuation.definition.generic.begin.scala + set: + - meta_scope: meta.generic.scala + - match: \] + scope: punctuation.definition.generic.end.scala + set: single-type-expression-tail-no-function + - include: delimited-type-expression + - match: '\b(with)(?:\s+|\b)' + captures: + 1: keyword.declaration.scala + set: single-type-expression-no-function + - match: '\btype\b' + scope: invalid.keyword.type.in-tail-position.scala + - match: \b(?:Unit|Boolean|Byte|Char|Short|Int|Float|Long|Double)\b + scope: storage.type.primitive.scala + set: single-type-expression-tail-no-function-type-expectation + - match: '\b(?:forSome)\b' + scope: keyword.declaration.scala + - match: '\b(?:this|super)\b' + scope: variable.language.scala + set: single-type-expression-tail-no-function-type-expectation + - match: '{{upperid}}' + scope: support.class.scala + set: single-type-expression-tail-no-function-type-expectation + # - include: literal-constants + # - include: char-literal + # - include: scala-symbol + # - include: strings + - match: '(?={{keywords}})' + pop: true + - match: '{{typeid}}' + scope: support.type.scala + set: single-type-expression-tail-no-function-type-expectation + - match: '\{' + scope: punctuation.definition.block.begin.scala + set: + - match: \} + scope: punctuation.definition.block.end.scala + set: single-type-expression-tail-no-function + - include: main + - match: '(?=\()' + push: try-dispatch + - include: base-type-expression-no-function + - match: \n + pop: true + - match: '(?=\S)' + pop: true + single-type-expression-tail: - match: (?=@{{plainid}}) set: @@ -1481,15 +1793,65 @@ contexts: captures: 1: keyword.declaration.scala set: single-type-expression - - match: (?={{typeid}}) - set: single-type-expression + - match: '\btype\b' + scope: invalid.keyword.type.in-tail-position.scala + - match: \b(?:Unit|Boolean|Byte|Char|Short|Int|Float|Long|Double)\b + scope: storage.type.primitive.scala + set: single-type-expression-tail-type-expectation + - match: '\b(?:forSome)\b' + scope: keyword.declaration.scala + - match: '\b(?:this|super)\b' + scope: variable.language.scala + set: single-type-expression-tail-type-expectation + - match: '{{upperid}}' + scope: support.class.scala + set: single-type-expression-tail-type-expectation + # - include: literal-constants + # - include: char-literal + # - include: scala-symbol + # - include: strings - match: '(?={{keywords}})' pop: true + - match: '{{typeid}}' + scope: support.type.scala + set: single-type-expression-tail-type-expectation + - match: '\{' + scope: punctuation.definition.block.begin.scala + set: + - match: \} + scope: punctuation.definition.block.end.scala + set: single-type-expression-tail + - include: main + - match: '(?=\()' + push: try-dispatch + - match: '{{rightarrow}}' + scope: keyword.operator.arrow.scala + set: single-type-expression-leading-newline + - include: base-type-expression-no-function + - match: \n + pop: true + - match: '(?=\S)' + pop: true + + # we saw an infix type component, eat a single newline + single-type-expression-tail-no-function-type-expectation: + - match: \n + set: single-type-expression-tail-no-function-newline + - match: '(?=\S)' + set: single-type-expression-no-function + + single-type-expression-tail-type-expectation: - match: \n set: single-type-expression-tail-newline - match: '(?=\S)' - set: try-initialization # this is needed for initialization (new ...) and doesn't HURT elsewhere + set: single-type-expression + + single-type-expression-tail-no-function-newline: + - include: decl-newline-double-check + - match: '(?=\S)' + set: single-type-expression-no-function + single-type-expression-tail-newline: - include: decl-newline-double-check - match: '(?=\S)' - set: single-type-expression-tail + set: single-type-expression diff --git a/Scala/Symbols-val.tmPreferences b/Scala/Symbols-val.tmPreferences index e7921b103d..4d55ad83eb 100644 --- a/Scala/Symbols-val.tmPreferences +++ b/Scala/Symbols-val.tmPreferences @@ -4,7 +4,7 @@ name Symbols (val) scope - source.scala entity.name.val + source.scala variable.other.constant settings showInSymbolList diff --git a/Scala/Symbols-var.tmPreferences b/Scala/Symbols-var.tmPreferences index 6e0a254e3d..e7fb5e1907 100644 --- a/Scala/Symbols-var.tmPreferences +++ b/Scala/Symbols-var.tmPreferences @@ -4,7 +4,7 @@ name Symbols (var) scope - source.scala entity.name.var + source.scala variable.other.readwrite settings showInSymbolList diff --git a/Scala/Symbols.tmPreferences b/Scala/Symbols.tmPreferences index 1a81ce60a5..46551f6548 100644 --- a/Scala/Symbols.tmPreferences +++ b/Scala/Symbols.tmPreferences @@ -4,7 +4,7 @@ name Symbol List scope - source.scala entity.name.function, source.scala entity.name.class, source.scala entity.name.val, source.scala entity.name.type, source.scala entity.name.namespace.scoped + source.scala entity.name.function, source.scala entity.name.class, source.scala variable.other.constant, source.scala variable.other.readwrite, source.scala entity.name.type, source.scala entity.name.namespace.scoped settings showInIndexedSymbolList diff --git a/Scala/syntax_test_scala.scala b/Scala/syntax_test_scala.scala index 24228c8f81..979fec7613 100644 --- a/Scala/syntax_test_scala.scala +++ b/Scala/syntax_test_scala.scala @@ -8,26 +8,28 @@ package fubar package fubar { // ^^^^ keyword.control.scala // ^^^^^ entity.name.namespace.scoped.scala +// ^ punctuation.section.block.begin.scala // <- meta.namespace.scala -} + } +// ^ punctuation.section.block.end.scala import fubar.{Unit, Foo} // ^^^ keyword.other.import // <- meta.import.scala -// ^^^^^ variable.package.scala -// ^^^^ variable.import.scala +// ^ punctuation.separator.scala def foo: Baz = 42 //^ storage.type.function.scala // ^^^ entity.name.function.scala // ^^^ support.class // ^ keyword.operator.assignment.scala -// ^^ constant.numeric.integer.scala +// ^^ constant.numeric.integer.decimal.scala -def foo: Baz => Bar = 42 +def foo: Baz => Bar = 42; // ^^^ support.class // ^^^ support.class // ^ keyword.operator.assignment.scala +// ^ punctuation.terminator.scala def foo(a: Int, b: Bar): Baz = 42 @@ -38,7 +40,7 @@ def foo(a: Int, b: Bar): Baz = 42 // ^^^ support.class // ^^^ support.class // ^ keyword.operator.assignment.scala -// ^^ constant.numeric.integer.scala +// ^^ constant.numeric.integer.decimal.scala def +(a: Int) // ^^^ storage.type.function.scala @@ -83,15 +85,19 @@ def foo(a: Int, b: Bar): Baz = 42 def foo(implicit bar: Int): Unit // ^^^^^^^^ storage.modifier.other +// ^ punctuation.ascription.scala +// ^ punctuation.ascription.scala - val foo: Unit + val foo: Unit; 42 // ^^^ storage.type.stable.scala -// ^^^ entity.name.val +// ^^^ variable.other.constant.scala // ^^^^ storage.type.primitive.scala +// ^ punctuation.terminator.scala +// ^^ constant.numeric.integer.decimal.scala var foo: Unit // ^^^ storage.type.volatile.scala -// ^^^ entity.name.var +// ^^^ variable.other.readwrite.scala // ^^^^ storage.type.primitive.scala class Foo[A](a: Bar) extends Baz with Bin @@ -146,7 +152,9 @@ object Foo type Foo[A, B, C] = Bar // ^ support.class +// ^ punctuation.separator.scala // ^ support.class +// ^ punctuation.separator.scala // ^ support.class // ^ keyword.operator.assignment.scala @@ -162,35 +170,127 @@ type Foo = Bar[A] forSome { type A } Bar // ^^^ support.constant - 42 -// ^^ constant.numeric.integer.scala - - .421 -// ^^^^ constant.numeric.float.scala - - 42D -// ^^^ constant.numeric.float.scala - - 42d -// ^^^ constant.numeric.float.scala - - 42F -// ^^^ constant.numeric.float.scala - - 42f -// ^^^ constant.numeric.float.scala - - 42L -// ^^^ constant.numeric.integer.scala - - 42l -// ^^^ constant.numeric.integer.scala - - 0x0aF9123 -// ^^^^^^^^^ constant.numeric.hex.scala - - 0.045e-2 -// ^^^^^^^^ constant.numeric.float.scala +// floating point numbers + + 42D 42d +//^ - constant +// ^^^ constant.numeric.float.decimal.scala +// ^ storage.type.numeric.scala +// ^ - constant +// ^^^ constant.numeric.float.decimal.scala +// ^ storage.type.numeric.scala +// ^ - constant + + 42F 42f +//^ - constant +// ^^^ constant.numeric.float.decimal.scala +// ^ storage.type.numeric.scala +// ^ - constant +// ^^^ constant.numeric.float.decimal.scala +// ^ storage.type.numeric.scala +// ^ - constant + + .045 .045e2 .045e-2 .045e+2 .045e2f .045e-2f .045e+2f +//^ - constant +// ^ punctuation.separator.decimal.scala +// ^^^^ constant.numeric.float.decimal.scala +// ^ - constant +// ^^^^^^ constant.numeric.float.decimal.scala +// ^ punctuation.separator.decimal.scala +// ^ - constant +// ^^^^^^^ constant.numeric.float.decimal.scala +// ^ punctuation.separator.decimal.scala +// ^ - constant +// ^^^^^^^ constant.numeric.float.decimal.scala +// ^ punctuation.separator.decimal.scala +// ^ - constant +// ^^^^^^^ constant.numeric.float.decimal.scala +// ^ punctuation.separator.decimal.scala +// ^ storage.type.numeric.scala +// ^ - constant +// ^^^^^^^^ constant.numeric.float.decimal.scala +// ^ punctuation.separator.decimal.scala +// ^ storage.type.numeric.scala +// ^ - constant +// ^^^^^^^^ constant.numeric.float.decimal.scala +// ^ punctuation.separator.decimal.scala +// ^ storage.type.numeric.scala +// ^ - constant + + 0.045 0.045e2 0.045e-2 0.045e+2 0.045e2f 0.045e-2f 0.045e+2f +//^ - constant +// ^^^^^ constant.numeric.float.decimal.scala +// ^ punctuation.separator.decimal.scala +// ^ - constant +// ^^^^^^^ constant.numeric.float.decimal.scala +// ^ punctuation.separator.decimal.scala +// ^ - constant +// ^^^^^^^^ constant.numeric.float.decimal.scala +// ^ punctuation.separator.decimal.scala +// ^ - constant +// ^^^^^^^^ constant.numeric.float.decimal.scala +// ^ punctuation.separator.decimal.scala +// ^ - constant +// ^^^^^^^^ constant.numeric.float.decimal.scala +// ^ punctuation.separator.decimal.scala +// ^ storage.type.numeric.scala +// ^ - constant +// ^^^^^^^^^ constant.numeric.float.decimal.scala +// ^ punctuation.separator.decimal.scala +// ^ storage.type.numeric.scala +// ^ - constant +// ^^^^^^^^^ constant.numeric.float.decimal.scala +// ^ punctuation.separator.decimal.scala +// ^ storage.type.numeric.scala +// ^ - constant + + 1e2 1e-2 1e+2 1e2f 1e-2f 1e+2f +//^ - constant +// ^^^ constant.numeric.float.decimal.scala +// ^ - constant +// ^^^^ constant.numeric.float.decimal.scala +// ^ - constant +// ^^^^ constant.numeric.float.decimal.scala +// ^ - constant +// ^^^^ constant.numeric.float.decimal.scala +// ^ storage.type.numeric.scala +// ^ - constant +// ^^^^^ constant.numeric.float.decimal.scala +// ^ storage.type.numeric.scala +// ^ - constant +// ^^^^^ constant.numeric.float.decimal.scala +// ^ storage.type.numeric.scala + +// decimal integers + + 42 42L 42l +//^ - constant +// ^^ constant.numeric.integer.decimal.scala +// ^ - constant +// ^^^ constant.numeric.integer.decimal.scala +// ^ storage.type.numeric.scala +// ^ - constant +// ^^^ constant.numeric.integer.decimal.scala +// ^ storage.type.numeric.scala +// ^ - constant + +// hexadecimal integers + + 0x0aF9123 0x42L 0x42l +//^ - constant +// ^^ punctuation.definition.numeric.base.scala +// ^^^^^^^^^ constant.numeric.integer.hexadecimal.scala +// ^ - constant +// ^^ punctuation.definition.numeric.base.scala +// ^^^^^ constant.numeric.integer.hexadecimal.scala +// ^ storage.type.numeric.scala +// ^ - constant +// ^^ punctuation.definition.numeric.base.scala +// ^^^^^ constant.numeric.integer.hexadecimal.scala +// ^ storage.type.numeric.scala +// ^ - constant + +// characters 'a' // ^^^ constant.character.literal.scala @@ -247,7 +347,7 @@ type Foo = Bar[A] forSome { type A } // ^ support.function // ^^ variable.other // ^^ punctuation.definition.expression -// ^^ constant.numeric.integer.scala +// ^^ constant.numeric.integer.decimal.scala // ^ punctuation.definition.expression s"""testing $a ${42}""" @@ -255,13 +355,13 @@ type Foo = Bar[A] forSome { type A } // ^ support.function // ^^ variable.other // ^^ punctuation.definition.expression -// ^^ constant.numeric.integer.scala +// ^^ constant.numeric.integer.decimal.scala // ^ punctuation.definition.expression // ^^^ string.quoted.triple.interpolated.scala f"formatted: x: $x%+,.3f ca" // ^ support.function -// ^ variable.other.scala +// ^ variable.other.scala - string // ^^^^^^ constant.other.formatting.scala f"formatted: date: $x%T " @@ -305,6 +405,8 @@ type Foo = Bar[A] forSome { type A } /** // <- comment.block.documentation.scala + * +// ^ punctuation.definition.comment.scala */ /**/0xff @@ -447,14 +549,14 @@ type Foo = Bar[A] forSome { type A } // ^^^ support.class // ^^^ variable.parameter // ^ variable.language.underscore.scala -// ^^ keyword.operator.arrow.scala +// ^^ storage.type.function.arrow.case.scala case abc @ `abc` => // ^^^ variable.parameter // ^ keyword.operator.at.scala // ^ punctuation.definition.identifier.scala // ^ punctuation.definition.identifier.scala -// ^^ keyword.operator.arrow.scala +// ^^ storage.type.function.arrow.case.scala // ^^^^^ - variable.parameter case foo: (Int => Boolean) :: _ => @@ -468,7 +570,7 @@ type Foo = Bar[A] forSome { type A } => case 42 => -// ^^ constant.numeric.integer.scala +// ^^ constant.numeric.integer.decimal.scala case 'a' => // ^^^ constant.character.literal.scala @@ -504,7 +606,7 @@ type Foo = Bar[A] forSome { type A } val abc @ `abc` // ^^^ storage.type.stable.scala -// ^^^ entity.name.val +// ^^^ variable.other.constant.scala // ^ keyword.operator.at.scala // ^ punctuation.definition.identifier.scala // ^ punctuation.definition.identifier.scala @@ -515,7 +617,7 @@ type Foo = Bar[A] forSome { type A } val ble @ `abc` = _ // ^^^ storage.type.stable.scala -// ^^^ entity.name.val +// ^^^ variable.other.constant.scala // ^ keyword.operator.at.scala // ^^^^^ - entity.name // ^ keyword.operator.assignment.scala @@ -624,7 +726,10 @@ type Foo = Bar[A] forSome { type A } back <- Traverse[Option] // ^^^^ variable.parameter // ^^^^^^^^ support.constant +// ^^^^^^^^ meta.generic.scala +// ^ punctuation.definition.generic.begin.scala // ^^^^^^ support.class +// ^ punctuation.definition.generic.end.scala .traverse[Free, Stuff](res) { r => } // ^^^^^^^^ - entity.name // ^^^ - entity.name @@ -633,16 +738,18 @@ type Foo = Bar[A] forSome { type A } val baseSettings: Seq[Def.Setting[_]] = _ -// ^^^^^^^^^^^^ entity.name.val.scala +// ^^^^^^^^^^^^ variable.other.constant.scala // ^^^ support.class -// ^ - keyword +// ^ variable.language.underscore.scala - keyword for { r <- blah } yield r.copy(foo = a) -// ^ - entity.name -// ^^^^ - entity.name -// ^^^ - entity.name +// ^ - variable +// ^^^^ - variable +// ^ punctuation.section.group.begin.scala +// ^^^ - variable +// ^ punctuation.section.group.end.scala { case foo.Bar => 42 @@ -654,11 +761,52 @@ type Foo = Bar[A] forSome { type A } } val Foo = 42 -// ^^^ entity.name.val +// ^^^ variable.other.constant.scala + + val * = 42 +// ^ variable.other.constant.scala + + val *: abc = 42 +// ^ variable.other.constant.scala +// ^ invalid.ascription.following-operator.scala +// ^^^ support.type.scala + + val foo_::: abc +// ^^^^^^ variable.other.constant.scala +// ^ invalid.ascription.following-operator.scala + + val ::: abc +// ^ invalid.ascription.following-operator.scala + + val :: : abc +// ^^ variable.other.constant.scala +// ^ punctuation.ascription.scala - invalid + + val foo_:::: = 42 +// ^^^^^^^^ variable.other.constant.scala +// ^ - invalid + + val :::: = 42 +// ^^^^ variable.other.constant.scala +// ^ - invalid + + val foo_: : abc +// ^^^^^ variable.other.constant.scala +// ^ - invalid +// ^ - invalid + val foo_:: : abc +// ^^^^^^ variable.other.constant.scala +// ^ - invalid +// ^ - invalid + + val * : abc = 42 +// ^ variable.other.constant.scala +// ^ punctuation.ascription.scala - invalid +// ^^^ support.type.scala val (Foo, x) = 42 // ^^^ support.constant.scala -// ^ entity.name.val +// ^ variable.other.constant.scala { Set[Foo[A, A] forSome { type A }, A] @@ -742,8 +890,10 @@ type Foo >: Bar // ^ variable.parameter { (a, b) => ??? } -// ^ variable.parameter -// ^ variable.parameter +// ^ punctuation.section.group.begin.scala +// ^ variable.parameter.scala +// ^ variable.parameter.scala +// ^ punctuation.section.group.end.scala { a: Int => ??? } // ^ variable.parameter @@ -790,7 +940,7 @@ type Foo >: Bar case _ if thing => // ^^^^ keyword.other.declaration.scala // ^^^^^ - variable.parameter -// ^^ - storage.type.function.arrow +// ^^ - keyword } a =>a @@ -798,7 +948,7 @@ type Foo >: Bar a =>42 // ^ variable.parameter -// ^^ constant.numeric.integer.scala +// ^^ constant.numeric.integer.decimal.scala (a: Int => Boolean) => 42 // ^^ keyword.operator.arrow.scala @@ -885,31 +1035,27 @@ class Foo(a: A :: B) import foo // <- meta.import.scala -// ^^^ variable.import.scala + +import foo, bar +// ^ punctuation.separator.scala import foo; import bar -// ^^^ variable.import.scala +// ^ punctuation.terminator.scala // ^^^^^^ keyword.other.import.scala -// ^^^ variable.import.scala import foo.bar -// ^^^^^^^ variable.package.scala +// ^ punctuation.accessor.dot.scala import foo.{bar, bar => baz, bar=>baz} // ^^^^^^^^^^^^^^^^^ meta.import.selector.scala -// ^^^ variable.import.scala -// ^^^ variable.import.renamed-from.scala // ^^ keyword.operator.arrow.scala -// ^^^ variable.import.renamed-to.scala -// ^^^ variable.import.renamed-from.scala // ^^ keyword.operator.arrow.scala -// ^^^ variable.import.renamed-to.scala import foo.{ bar => bin -// ^^^ variable.import.renamed-from.scala -// ^^^ variable.import.renamed-to.scala +// ^^^ meta.import.scala +// ^^^ meta.import.scala } import foo._ @@ -931,8 +1077,8 @@ for {} yield () foo: m.type // ^^^^ keyword.other.scala - == -// ^^ - keyword + === +// ^^^ - keyword offset >= 0 // ^^ - keyword @@ -943,7 +1089,7 @@ offset >= 0 } val chunk #: h = ??? -// ^ entity.name.val +// ^ variable.other.constant.scala for { if things >= stuff @@ -1006,16 +1152,16 @@ val (foo, bar) = ??? // ^ punctuation.separator.scala foo eq bar -// ^^ keyword.operator.word.scala +// ^^ keyword.operator.comparison.scala foo ne bar -// ^^ keyword.operator.word.scala +// ^^ keyword.operator.comparison.scala new Config() // ^^ - constant val A: Foo = stuff -// ^ entity.name.val.scala +// ^ variable.other.constant.scala type Maybe[A] = { type Inner = A; def x: Int } // ^^ storage.type.function.scala @@ -1072,12 +1218,12 @@ xs: Foo with Bar } val Stuff(thing, other) = ??? -// ^^^^^ entity.name.val.scala -// ^^^^^ entity.name.val.scala +// ^^^^^ variable.other.constant.scala +// ^^^^^ variable.other.constant.scala x: List[Int] => () // ^ variable.parameter.scala -// ^^ storage.type.function.arrow.scala +// ^^ storage.type.function.arrow.lambda.scala /** private */ class Foo // ^^^^^ storage.type.class @@ -1126,11 +1272,11 @@ def <(a: Int) = 42 // ^ text.xml meta.tag.xml // ^ text.xml string.quoted.single.xml punctuation.definition.string.begin.xml // ^ text.xml string.quoted.single.xml punctuation.definition.string.end.xml -// ^^ source.scala constant.numeric.integer.scala +// ^^ source.scala constant.numeric.integer.decimal.scala { 42 + "thing" // ^^^^^^^^^^^^ - text.xml -// ^^ source.scala constant.numeric.integer.scala +// ^^ source.scala constant.numeric.integer.decimal.scala // ^^^^^^^ source.scala string.quoted.double.scala // comments! // ^^^^^^^^^^^^ source.scala comment.line.double-slash.scala @@ -1226,15 +1372,15 @@ def test // ^^^ storage.type.function.scala def foo: Map[Bar]=42 -// ^^ constant.numeric.integer.scala +// ^^ constant.numeric.integer.decimal.scala x: Foo.Bar => () // ^ variable.parameter.scala -// ^^ storage.type.function.arrow.scala +// ^^ storage.type.function.arrow.lambda.scala x: Foo#Bar => () // ^ variable.parameter.scala -// ^^ storage.type.function.arrow.scala +// ^^ storage.type.function.arrow.lambda.scala object Stuff { case @@ -1252,13 +1398,13 @@ def foo: Map[Bar]=42 for { abc = () => 42 -// ^^ storage.type.function.arrow.scala +// ^^ storage.type.function.arrow.lambda.scala } for ( abc = () => 42 -// ^^ storage.type.function.arrow.scala +// ^^ storage.type.function.arrow.lambda.scala ) new { @@ -1270,10 +1416,17 @@ def foo(a: String*, b: (Int => String)*, c: Int*): Negative* // ^ keyword.operator.varargs.scala // ^ keyword.operator.varargs.scala // ^ keyword.operator.varargs.scala -// ^ support.type.scala - keyword +// ^ - support -def foo(a: Int * String): Unit -// ^ support.type.scala - keyword +def foo[A[_] <: B](a: Int + String): Unit +// ^ punctuation.definition.generic.begin.scala +// ^ punctuation.definition.generic.begin.scala +// ^ punctuation.definition.generic.end.scala +// ^ punctuation.definition.generic.end.scala +// ^^^^^^^^^^^ meta.generic.scala +// ^ punctuation.section.group.begin.scala +// ^ support.type.scala - keyword +// ^ punctuation.section.group.end.scala class Foo(a: String*) // ^ keyword.operator.varargs.scala @@ -1288,12 +1441,37 @@ trait AlgebraF[F[_]] { type f[x] = Algebra[F,x] } // ^^^^ storage.type.scala // ^ keyword.operator.assignment.scala +class Foo @Inject()(a: String) +// ^^^^^^ meta.annotation.identifier +// ^- meta.annotation +// ^ variable.parameter.scala + +class Foo @Inject() @Provided(scope = "test")(a: String) +// ^^^^^^ meta.annotation.identifier +// ^- meta.annotation +// ^^^^^^^ meta.annotation.identifier +// ^^^^^^^ meta.annotation.parameters +// ^- meta.annotation +// ^ variable.parameter.scala + +class Foo @Inject(z = "a")(a: String) +// ^^^^^^ variable.annotation +// ^^^^^^^ meta.annotation.parameters +// ^ variable.parameter.scala + +class Foo[A] @Inject()(a: String) +// ^ support.class +// ^^^^^^ meta.annotation.identifier +// ^- meta.annotation +// ^ variable.parameter.scala + // annotation examples from: http://www.scala-lang.org/files/archive/spec/2.11/11-annotations.html @deprecated("Use D", "1.0") class C { ... } // <- meta.annotation // ^^ variable.annotation +// ^ meta.annotation.parameters.scala punctuation.section.arguments.annotation.begin.scala // ^^ string -// ^ meta.annotation +// ^ meta.annotation // ^ - meta.annotation @transient @volatile var m: Int @@ -1331,7 +1509,7 @@ trait Function0[@specialized(Unit, Int, Double) T] { // ^ support.class // ^ punctuation.definition.annotation // ^ meta.annotation -// ^ meta.annotation.parameters +// ^ meta.annotation.parameters // ^ - meta.annotation // ^ punctuation.separator.arguments.annotation def apply: T @@ -1362,7 +1540,7 @@ class Foo extends Bar[A with B](42) // ^ support.class.scala // ^^^^ keyword.declaration.scala // ^ support.class.scala -// ^^ constant.numeric.integer.scala +// ^^ constant.numeric.integer.decimal.scala class Foo extends Bar { val x = 42 } with Baz // ^ punctuation.section.braces.begin.scala @@ -1409,12 +1587,12 @@ class Foo extends Bar(42) // ^ punctuation.section.parens.end.scala class Foo extends (Int => String) -// ^ punctuation.section.parens.begin.scala -// ^ punctuation.section.parens.end.scala +// ^ punctuation.definition.parens.begin.scala +// ^ punctuation.definition.parens.end.scala class Foo extends Bar[Int] -// ^ punctuation.section.brackets.begin.scala -// ^ punctuation.section.brackets.end.scala +// ^ punctuation.definition.generic.begin.scala +// ^ punctuation.definition.generic.end.scala object Underscore_ // ^^^^^^ storage.type.class.scala @@ -1461,26 +1639,25 @@ class Foo extends Bar def foo 42 -// ^^ constant.numeric.integer.scala +// ^^ constant.numeric.integer.decimal.scala def foo() 42 -// ^^ constant.numeric.integer.scala +// ^^ constant.numeric.integer.decimal.scala def foo(): 42 -// ^^ constant.numeric.integer.scala +// ^^ constant.numeric.integer.decimal.scala val foo: Thing =42 -// ^^ constant.numeric.integer.scala +// ^^ constant.numeric.integer.decimal.scala var foo: Thing =42 -// ^^ constant.numeric.integer.scala +// ^^ constant.numeric.integer.decimal.scala class Foo extends Bar with { import Thing._ // ^^^^^^ keyword.other.import.scala -// ^^^^^ variable.package.scala } class Foo extends Bar.Baz with bin.Baz @@ -1497,9 +1674,9 @@ final case class } val ~ = 42 -// ^ entity.name.val.scala +// ^ variable.other.constant.scala val \/- = 42 -// ^^^ entity.name.val.scala +// ^^^ variable.other.constant.scala type ~[+A] = A // ^ keyword.operator @@ -1575,10 +1752,18 @@ new Monad[Catenable] with Traverse // ^^^^^^^^ support.class.scala final class A - final class B + final class B[A[_] <: B](a: B) // ^^^^^ storage.modifier.other.scala // ^^^^^ storage.type.class.scala // ^ entity.name.class.scala +// ^^^^^^^^^^^ meta.generic.scala +// ^ punctuation.definition.generic.begin.scala +// ^ punctuation.definition.generic.begin.scala +// ^ punctuation.definition.generic.end.scala +// ^^ keyword.operator.bound.scala +// ^ punctuation.definition.generic.end.scala +// ^ punctuation.section.group.begin.scala +// ^ punctuation.section.group.end.scala abc match { case $foo(bar) => () @@ -1615,7 +1800,7 @@ new RangeColumn(range) with LongColumn { def apply(row: Int) = a + row } type Foo = Bar -// ^^^ support.constant.scala +// ^^^ support.constant.scala - support.class type Foo = Unit type Bar = Unit @@ -1624,12 +1809,14 @@ new RangeColumn(range) with LongColumn { def apply(row: Int) = a + row } type =?>[A] = Any // ^^^ entity.name.type.scala - +// ^^^ meta.generic.scala +// ^ punctuation.definition.generic.begin.scala +// ^ punctuation.definition.generic.end.scala val x: Foo @> Bar // ^^ support.type.scala val x: = 42 -// ^^ constant.numeric.integer.scala +// ^^ constant.numeric.integer.decimal.scala object Foo IO @@ -1639,20 +1826,17 @@ val x: = 42 IO // ^^ support.constant.scala -val foo' = 42 -// ^^^^ entity.name.val.scala - -val foo'' = 42 -// ^^^^^ entity.name.val.scala - -def foo' = () -// ^^^^ entity.name.function.scala +val a' = 42 +// ^ - entity.name val ' = 42 // ^ - entity.name type Foo = Monad[OptionT[IO, ?]] -// ^ variable.language.qmark.scala +// ^ variable.language.hole.scala + +type Foo = Monad[OptionT[IO, *]] +// ^ variable.language.hole.scala type Foo = Monad[λ[α => OptionT[IO, α]]] // ^ keyword.operator.type-lambda.scala @@ -1662,33 +1846,17 @@ type Foo = Monad[Lambda[α => OptionT[IO, α]]] import scalaz._, Scalaz._ -// ^^^^^^^ meta.import.scala variable.package.scala +// ^^^^^^ meta.import.scala import scalaz._ Scalaz._ -// ^^^^^^ support.constant.scala - -type Foo = 42 -// ^^ constant.numeric.integer.scala - -type Foo = "foo" -// ^^^^^ string.quoted.double.scala - -type Foo = 'foo -// ^^^^ constant.other.symbol.scala - -type Foo = 'a' -// ^^^ constant.character.literal.scala - -type Foo = true -// ^^^^ constant.language.scala - -type Foo = null -// ^^^^ constant.language.scala +// ^^^^^^ support.constant.scala - meta.import for { +// ^ punctuation.section.block.begin.scala _ <_ } yield true +// ^ punctuation.section.block.end.scala // ^^^^^ keyword.control.flow.scala x: ResourceError \/ Resource @@ -1700,6 +1868,16 @@ type Foo = null import library._ // ^^^^^^ - support.type + type Foo = Thing { val a: Int } + // ^ punctuation.definition.block.begin.scala + // ^ punctuation.definition.block.end.scala + + type Foo = (Bar op (Baz)) + // ^ punctuation.definition.group.begin.scala + // ^ punctuation.definition.group.begin.scala + // ^ punctuation.definition.group.end.scala + // ^ punctuation.definition.group.end.scala + def identity: CFId override final def equals(other: Any): Boolean // ^^^^^^^^ - support.type @@ -1714,6 +1892,7 @@ type Foo = null // ^^^^^ variable.language.scala a match { +// ^ punctuation.section.block.begin.scala case x: b if Foo => // ^^ keyword.control.flow.scala // ^^^ support.constant.scala @@ -1742,14 +1921,14 @@ tail: _ * val Message( Address(from), -// ^^^^ entity.name.val.scala +// ^^^^ variable.other.constant.scala Address(to), -// ^^ entity.name.val.scala +// ^^ variable.other.constant.scala subject, -// ^^^^^^^ entity.name.val.scala +// ^^^^^^^ variable.other.constant.scala Content(tpe, value)) = m -// ^^^ entity.name.val.scala -// ^^^^^ entity.name.val.scala +// ^^^ variable.other.constant.scala +// ^^^^^ variable.other.constant.scala { case Foo() => @@ -1805,12 +1984,14 @@ for { } for (_<- fu; _← fu; _= fu) +// ^ punctuation.section.group.begin.scala // ^ variable.language.underscore.scala // ^^ keyword.operator.assignment.scala // ^ variable.language.underscore.scala // ^ keyword.operator.assignment.scala // ^ variable.language.underscore.scala // ^ keyword.operator.assignment.scala +// ^ punctuation.section.group.end.scala raw"foo\nbar\rbaz" // ^^^ string.quoted.raw.interpolated.scala support.function.scala @@ -1834,3 +2015,190 @@ val x: AnyVal val x: Nothing // ^^^^^^^ storage.type.primitive.scala + +fold(a => b, { case c => d }) +// ^^ storage.type.function.arrow.lambda.scala +// ^^ storage.type.function.arrow.case.scala + +gzis =>/* foo */ +// ^^ storage.type.function.arrow.lambda.scala +// ^^^^^^^^^ comment.block.scala + +gzis =>// foo +// ^^ storage.type.function.arrow.lambda.scala +// ^^ comment.line.double-slash.scala punctuation.definition.comment.scala + +s"testing '$foo' bar" +// ^ string.quoted.interpolated.scala - variable +// ^ string.quoted.interpolated.scala - variable + + class Context(var abc: Boolean, val fed: Int) +// ^^^ storage.type.volatile.scala +// ^^^ variable.parameter.scala +// ^^^ storage.type.scala +// ^^^ variable.parameter.scala + +(abc)() +// ^^ - constant + + type S = Map + evalNT +// ^^^^^^ - support.type + + type S = Map x + evalNT +// ^^^^^^ support.type.scala + + type S = Map x y + evalNT +// ^^^^^^ - support.type + + type S = Map x y z + evalNT +// ^^^^^^ support.type.scala + + type S = Map x y z q + evalNT +// ^^^^^^ - support.type + + new Foo + evalNT +// ^^^^^^ - support.type.scala + + def c: String + override def d = "blah" +// ^^^^^^^^ storage.modifier.other.scala + + new DataCodec { + import PreciseKeys._ +// ^^^^^^ meta.import.scala keyword.other.import.scala +// ^^^^^^^^^^^ meta.import.scala +// ^ meta.import.scala punctuation.accessor.dot.scala +// ^ meta.import.scala variable.language.underscore.scala + } foo + bar +// ^^^ - support + +type Foo = (Bar, Baz) => Result +// ^^ keyword.operator.arrow.scala +// ^^^^^^ support.class.scala + +{ + case _: NumberFormatException => + val col = foo +// ^^^ storage.type.stable.scala +// ^^^ variable.other.constant.scala +// ^ keyword.operator.assignment.scala + case _: (NumberFormatException => Bar) => Bar + // ^^^ support.class.scala +} + +new AsyncException else data(i) +// ^^^^ keyword.control.flow.scala +// ^^^^ - support + +type Foo = this.Bar +// ^^^ support.class.scala + +type Foo = super.Bar +// ^^^ support.class.scala + +new Foo().bar +// ^ punctuation.section.group.begin.scala +// ^ punctuation.section.group.end.scala +// ^^^ - support + +new Foo[A].bar +// ^ punctuation.definition.generic.begin.scala +// ^ punctuation.definition.generic.end.scala +// ^^^ - support + +val foo: () => Unit +// ^^ - constant + +type T = Foo => (Bar, Baz) +// ^^^ support.class.scala +// ^^^ support.class.scala +// ^^^ support.class.scala + +new Array[Long]() +// ^ punctuation.section.group.begin.scala +// ^ punctuation.section.group.end.scala + +val foo: Bar = baz +// ^ punctuation.ascription.scala +// ^ - punctuation + +val (foo: Bar) = baz +// ^ punctuation.ascription.scala + +{ + case foo: Bar => baz +// ^ punctuation.ascription.scala +} + +foo: Bar +// ^ punctuation.ascription.scala + +(foo: Bar) => 42 +// ^ punctuation.ascription.scala + +def foo(bar: Baz): Unit +// ^ punctuation.ascription.scala + +class Foo(bar: Baz) +// ^ punctuation.ascription.scala + +val firstA :: firstB :: Nil = results +// ^^^^^^ variable.other.constant.scala +// ^^ - entity +// ^^^^^^ variable.other.constant.scala +// ^^ - entity +// ^^^ support.constant.scala - entity + +val (firstA :: firstB :: Nil) :: (secondA :: secondB :: Nil) :: Nil = results +// ^^^^^^ variable.other.constant.scala +// ^^ - entity +// ^^^^^^ variable.other.constant.scala +// ^^ - entity +// ^^^ support.constant.scala - entity +// ^^^^^^^ variable.other.constant.scala +// ^^ - entity +// ^^^^^^ variable.other.constant.scala +// ^^^ support.constant.scala - entity +// ^^ - entity +// ^^^ support.constant.scala - entity + +{ + case (firstA :: firstB :: Nil) :: (secondA :: secondB :: Nil) :: Nil => results +// ^^^^^^ variable.parameter.scala +// ^^ - variable +// ^^^^^^ variable.parameter.scala +// ^^ - variable +// ^^^ support.constant.scala - variable +// ^^ - variable +// ^^^^^^^ variable.parameter.scala +// ^^ - variable +// ^^^^^^^ variable.parameter.scala +// ^^ - variable +// ^^^ support.constant.scala - variable +// ^^ - variable +// ^^^ support.constant.scala - variable +// ^^^^^^^ - variable +} + + val JsonStreamEq: + protected +// ^^^^^^^^^ storage.modifier.access.scala + +foo == bar +// ^^ keyword.operator.comparison.scala + +foo != bar +// ^^ keyword.operator.comparison.scala + +foo eq bar +// ^^ keyword.operator.comparison.scala + +foo ne bar +// ^^ keyword.operator.comparison.scala diff --git a/ShellScript/.python-version b/ShellScript/.python-version new file mode 100644 index 0000000000..98fccd6d02 --- /dev/null +++ b/ShellScript/.python-version @@ -0,0 +1 @@ +3.8 \ No newline at end of file diff --git a/ShellScript/Bash.sublime-syntax b/ShellScript/Bash.sublime-syntax index a9efc35e86..e973e319a7 100644 --- a/ShellScript/Bash.sublime-syntax +++ b/ShellScript/Bash.sublime-syntax @@ -13,6 +13,7 @@ file_extensions: - sh - bash - zsh + - ash - .bash_aliases - .bash_completions - .bash_functions @@ -23,28 +24,19 @@ file_extensions: - .bashrc - .profile - .textmate_init + - .zlogin + - .zlogout + - .zprofile + - .zshenv - .zshrc - PKGBUILD # https://jlk.fjfi.cvut.cz/arch/manpages/man/PKGBUILD.5 - .ebuild - .eclass first_line_match: | - (?x) # ignore whitespace in this regex - ^ # assert start of the line - \#! # shebang token - .* # any characters - \b(bash|zsh|sh|tcsh)\b # "bash" or "zsh" or "sh" or "tcsh" - | # ... or ... - ^ # assert start of the line - \# # literal "#" character - \s* # any whitespace - -\*- # literal "-*-" string - [^*]* # any characters except "*" - mode: # literal "mode:" string - \s* # any whitespace - shell-script # literal "shell-script" string - [^*]* # any characters except "*" - -\*- # literal "-*-" string + (?x) + ^\#! .* \b(bash|zsh|sh|tcsh|ash)\b + | ^\# \s* -\*- [^*]* mode: \s* shell-script [^*]* -\*- #------------------------------------------------------------------------------- variables: @@ -60,7 +52,7 @@ variables: is_path_component: (?=[^\s/]*/) is_start_of_arguments: '[`=|&;()<>\s]' is_variable: (?=\s*{{nbc}}(?:[({]{{nbc}}[)}])?{{nbc}}=) - keyword_boundary_end: (?!=)(?=[^\w_-]|$) + keyword_break: (?![-=\w]) # A character that, when unquoted, separates words. A metacharacter is a # space, tab, newline, or one of the following characters: ‘|’, ‘&’, ‘;’, @@ -68,11 +60,6 @@ variables: metachar: '[\s\t\n|&;()<>]' nbc: '[^{}()=\s]*' # non bracket characters (and also non-whitespace, parens) - reset_and: \s*(&&) - reset_job: \s*(&) - reset_or: \s*(\|\|) - reset_pipe: \s*(\|) - reset_semicolon: \s*(;)(?![;&]) start_of_option: (?:\s+|^)--?(?=[\w$]) varassign: '[+\-?]?=' #------------------------------------------------------------------------------- @@ -130,6 +117,7 @@ contexts: - include: funcdef - include: vardef - include: redirection + - include: operator-exclamation - match: '{{is_command}}' push: cmd @@ -151,107 +139,112 @@ contexts: push: cmd-bt control: - - match: \b(if){{keyword_boundary_end}}(?:\s*(!))? - captures: - 1: keyword.control.if.begin.shell - 2: keyword.operator.logical.shell - - match: \bthen\b - scope: keyword.control.if.then.shell + - match: \bif{{keyword_break}} + scope: keyword.control.conditional.if.shell pop: true - - match: \b(elif){{keyword_boundary_end}}(?:\s*(!))? - captures: - 1: keyword.control.if.elif.shell - 2: keyword.operator.logical.shell - - match: \bfi{{keyword_boundary_end}} - scope: keyword.control.if.end.shell + - match: \bthen{{keyword_break}} + scope: keyword.control.conditional.then.shell + pop: true + - match: \belif{{keyword_break}} + scope: keyword.control.conditional.elseif.shell + pop: true + - match: \bfi{{keyword_break}} + scope: keyword.control.conditional.end.shell set: [cmd-post, cmd-args] - - match: \belse{{keyword_boundary_end}} - scope: keyword.control.if.else.shell + - match: \belse{{keyword_break}} + scope: keyword.control.conditional.else.shell pop: true - - match: \bfor{{keyword_boundary_end}} - scope: keyword.control.for.shell + - match: \bfor{{keyword_break}} + scope: keyword.control.loop.for.shell set: [cmd-post, for-args] - - match: \bdo{{keyword_boundary_end}} - scope: keyword.control.do.shell + - match: \bdo{{keyword_break}} + scope: keyword.control.loop.do.shell pop: true - - match: \bdone{{keyword_boundary_end}} - scope: keyword.control.done.shell + - match: \bdone{{keyword_break}} + scope: keyword.control.loop.end.shell set: [cmd-post, cmd-args] - - match: \bwhile{{keyword_boundary_end}} - scope: keyword.control.while.shell - - match: \buntil{{keyword_boundary_end}} - scope: keyword.control.until.shell - - match: \bcase{{keyword_boundary_end}} - scope: keyword.control.case.begin.shell - set: [case-body, case-item, case-item-first-character, case-preamble] - - match: \bcontinue{{keyword_boundary_end}} + - match: \bwhile{{keyword_break}} + scope: keyword.control.loop.while.shell + - match: \buntil{{keyword_break}} + scope: keyword.control.loop.until.shell + - match: \bcase{{keyword_break}} + scope: keyword.control.conditional.case.shell + set: [case-body, case-word] + - match: \bcontinue{{keyword_break}} scope: keyword.control.flow.continue.shell - - match: \bbreak{{keyword_boundary_end}} + - match: \bbreak{{keyword_break}} scope: keyword.control.flow.break.shell set: [cmd-post, cmd-args] + - match: \besac{{keyword_break}} + scope: keyword.control.conditional.end.shell + pop: true - case-preamble: - - match: \bin(?=[^\w_-]) - scope: keyword.control.case.in.shell + case-word: + - match: \bin{{keyword_break}} + scope: keyword.control.in.shell pop: true + - include: case-end-ahead - include: expansion-and-string - case-item-highlights: - - include: expansion-and-string + case-body: + - meta_scope: meta.conditional.case.shell + - match: \besac{{keyword_break}} + scope: keyword.control.conditional.end.shell + pop: true + - match: (?=\() + push: + - clear_scopes: 1 # remove meta.conditional.case.shell + - match: \( + scope: keyword.control.conditional.patterns.begin.shell + set: case-clause-patterns + - match: (?=\S) + push: case-clause-patterns + + case-clause-patterns: + - clear_scopes: 1 # remove meta.conditional.case.shell + - meta_scope: meta.conditional.case.clause.patterns.shell + - match: \) + scope: keyword.control.conditional.patterns.end.shell + set: case-clause-commands + # emergency bail outs if ')' is missing + - match: (?=;;&?|;&) + set: case-clause-commands + - include: case-end-ahead + - include: case-clause-patterns-body + + case-clause-patterns-body: + # [Bash] 3.2.4.2: Each pattern undergoes tilde expansion, parameter + # expansion, command substitution, and arithmetic expansion. + - include: expansion-pattern + - include: expansion-tilde + - include: expansion-parameter + - include: expansion-command + - include: expansion-arithmetic + - include: string - match: \| scope: keyword.operator.logical.shell - match: \( scope: punctuation.section.parens.begin.shell - push: case-item-inside - - case-item-inside: - - match: \) - scope: punctuation.section.parens.end.shell - pop: true - - include: case-item-highlights - - case-item: - - match: \) - scope: keyword.control.case.item.shell - pop: true - - include: case-item-highlights - - case-item-first-character: - - match: (?=\() - set: - - match: \( - scope: keyword.control.case.item.shell + push: + - match: \) + scope: punctuation.section.parens.end.shell pop: true - - match: (?=\S) - pop: true + - include: case-clause-patterns-body - case-body: - - match: \s*(;;&?|;&) - captures: - 1: punctuation.terminator.case.shell - set: - # An opening parenthesis is optional - - match: (?=\() - set: - - match: \( - scope: keyword.control.case.item.shell - set: case-body-item - - match: (?=\S) - set: case-body-item - - match: \s*\b(esac)\b - captures: - 1: keyword.control.case.end.shell + case-clause-commands: + - clear_scopes: 1 # remove meta.conditional.case.shell + - meta_content_scope: meta.conditional.case.clause.commands.shell + - match: ;;&?|;& + scope: + meta.conditional.case.clause.commands.shell + punctuation.terminator.case.clause.shell pop: true + - include: case-end-ahead - include: main - case-body-item: - - match: \besac\b - scope: keyword.control.case.end.shell + case-end-ahead: + - match: (?=\besac{{keyword_break}}) pop: true - - match: \) - scope: keyword.control.case.item.shell - set: case-body - - include: case-item-highlights # I don't think anybody will write a for-loop inside backticks. Hence no # for-args-bt context. @@ -261,7 +254,7 @@ contexts: - meta_scope: meta.group.for.shell - include: cmd-args-boilerplate - include: arithmetic - - match: \bin\b + - match: \bin{{keyword_break}} scope: keyword.control.in.shell expansion-and-string: @@ -273,7 +266,7 @@ contexts: captures: 1: storage.type.function.shell push: [funcdef-body, funcdef-parens, funcdef-name] - - match: \bcoproc{{keyword_boundary_end}} + - match: \bcoproc{{keyword_break}} scope: keyword.other.coproc.shell push: [cmd-post, cmd-args, coproc-body] @@ -282,7 +275,7 @@ contexts: captures: 1: storage.type.function.shell push: [funcdef-body-bt, funcdef-parens, funcdef-name] - - match: \bcoproc{{keyword_boundary_end}} + - match: \bcoproc{{keyword_break}} scope: keyword.other.coproc.shell push: [cmd-post, cmd-args-bt, coproc-body] @@ -343,7 +336,7 @@ contexts: - include: main-bt vardef: - - match: \s*\b(alias){{keyword_boundary_end}} + - match: \s*\b(alias){{keyword_break}} captures: 1: support.function.alias.shell push: @@ -353,7 +346,7 @@ contexts: - vardef-assign - vardef-alias-name - vardef-alias-options - - match: \s*\b(typeset|declare|local){{keyword_boundary_end}} + - match: \s*\b(typeset|declare|local){{keyword_break}} captures: 1: storage.modifier.shell push: @@ -363,7 +356,7 @@ contexts: - vardef-assign - vardef-name - vardef-declare-options - - match: \s*\b(export){{keyword_boundary_end}} + - match: \s*\b(export){{keyword_break}} captures: 1: storage.modifier.shell push: @@ -373,7 +366,7 @@ contexts: - vardef-assign - vardef-name - vardef-export-options - - match: \s*\b(readonly){{keyword_boundary_end}} + - match: \s*\b(readonly){{keyword_break}} captures: 1: storage.modifier.shell push: @@ -419,10 +412,7 @@ contexts: pop: true - include: cmd-args-boilerplate - match: (?=\S) - push: - - vardef-value - - vardef-assign - - vardef-name + push: [vardef-value, vardef-assign, vardef-name] vardef-alias-options: - match: \s*((-)p) @@ -738,31 +728,23 @@ contexts: - include: line-continuation-or-pop-at-end cmd-post: # looks like [main, cmd-post] at this point - - match: "" - set: - - meta_content_scope: meta.post-cmd.shell - - match: '{{reset_semicolon}}' - captures: - 1: keyword.operator.logical.continue.shell - pop: true - - match: '{{reset_or}}' - captures: - 1: keyword.operator.logical.or.shell - pop: true - - match: '{{reset_pipe}}' - captures: - 1: keyword.operator.logical.pipe.shell - pop: true - - match: '{{reset_and}}' - captures: - 1: keyword.operator.logical.and.shell - pop: true - - match: '{{reset_job}}' - captures: - 1: keyword.operator.logical.job.shell - pop: true - - match: "" - pop: true + - match: ;(?![;&]) + scope: keyword.operator.logical.continue.shell + pop: true + - match: \|\| + scope: keyword.operator.logical.or.shell + pop: true + - match: \| + scope: keyword.operator.logical.pipe.shell + pop: true + - match: \&\& + scope: keyword.operator.logical.and.shell + pop: true + - match: \& + scope: keyword.operator.logical.job.shell + pop: true + - match: $|(?=\S) + pop: true cmd-args-boilerplate: - match: (?={{is_end_of_interpolation}}) @@ -1257,8 +1239,8 @@ contexts: expression: # A leading ‘0x’ or ‘0X’ denotes hexadecimal. - - match: \b(?i)0x - scope: punctuation.definition.numeric.hexadecimal.shell + - match: \b0[xX] + scope: punctuation.definition.numeric.base.shell push: - meta_scope: constant.numeric.integer.hexadecimal.shell - match: '[g-zG-Z]' @@ -1268,7 +1250,7 @@ contexts: pop: true # Constants with a leading 0 are interpreted as octal numbers. - match: \b0(?=[0-7]) - scope: punctuation.definition.numeric.octal.shell + scope: punctuation.definition.numeric.base.shell push: - meta_scope: constant.numeric.integer.octal.shell - match: '[89]' @@ -1281,11 +1263,10 @@ contexts: # a number in that base. When specifying n, the digits greater than 9 are # represented by the lowercase letters, the uppercase letters, ‘@’, and ‘_’, # in that order. - - match: \b(\d+)(#)([a-zA-Z0-9@_]+) + - match: \b(\d+#)[a-zA-Z0-9@_]+ + scope: constant.numeric.integer.other.shell captures: - 1: constant.numeric.integer.decimal.base.shell - 2: punctuation.definition.numeric.base.shell - 3: constant.numeric.integer.generic-base.shell + 1: punctuation.definition.numeric.base.shell # If base# is omitted, then base 10 is used. - match: \b\d+ scope: constant.numeric.integer.decimal.shell @@ -1339,6 +1320,16 @@ contexts: - match: ==?|!=?|<|>|\|\||&& scope: keyword.operator.logical.shell + operator-exclamation: + - match: \!(?!\S) + scope: keyword.operator.logical.shell + - match: (\!)(-?\d+|!) + scope: variable.language.history.shell + captures: + 1: punctuation.definition.history.shell + - match: \! + scope: punctuation.definition.history.shell + string: - include: string-quoted-double - include: string-quoted-single diff --git a/ShellScript/Snippets/#!-usr-bin-env-(!env).sublime-snippet b/ShellScript/Snippets/#!-usr-bin-env-(!env).sublime-snippet index 6d1dd68044..102acb50c3 100644 --- a/ShellScript/Snippets/#!-usr-bin-env-(!env).sublime-snippet +++ b/ShellScript/Snippets/#!-usr-bin-env-(!env).sublime-snippet @@ -1,5 +1,5 @@ - !env source.actionscript.2, source.applescript, source.clojure, source.cs, source.d, source.dart, source.fsharp, source.groovy, source.haskell, source.java, source.js, source.julia, source.lisp, source.lua, source.makefile, source.ocaml, source.perl, source.php, source.python, source.r, source.ruby, source.rust, source.scala, source.shell, source.swift, source.tcl, source.ts diff --git a/ShellScript/Snippets/case-..-esac-(case).sublime-snippet b/ShellScript/Snippets/case-..-esac-(case).sublime-snippet index 79e009e82f..8c238438cd 100644 --- a/ShellScript/Snippets/case-..-esac-(case).sublime-snippet +++ b/ShellScript/Snippets/case-..-esac-(case).sublime-snippet @@ -4,6 +4,6 @@ $0;; esac]]> case - source.shell + source.shell.bash case … esac diff --git a/ShellScript/Snippets/elif-..-(elif).sublime-snippet b/ShellScript/Snippets/elif-..-(elif).sublime-snippet index a89f8110e3..2898dfb6d5 100644 --- a/ShellScript/Snippets/elif-..-(elif).sublime-snippet +++ b/ShellScript/Snippets/elif-..-(elif).sublime-snippet @@ -2,6 +2,6 @@ elif - source.shell + source.shell.bash elif … diff --git a/ShellScript/Snippets/for-...-done-(for).sublime-snippet b/ShellScript/Snippets/for-...-done-(for).sublime-snippet index f28e2a6691..9079ef4427 100644 --- a/ShellScript/Snippets/for-...-done-(for).sublime-snippet +++ b/ShellScript/Snippets/for-...-done-(for).sublime-snippet @@ -3,6 +3,6 @@ ${0:#statements} done]]> for - source.shell + source.shell.bash for … done diff --git a/ShellScript/Snippets/for-in-done-(forin).sublime-snippet b/ShellScript/Snippets/for-in-done-(forin).sublime-snippet index eb7b57509b..cd39e386f0 100644 --- a/ShellScript/Snippets/for-in-done-(forin).sublime-snippet +++ b/ShellScript/Snippets/for-in-done-(forin).sublime-snippet @@ -3,6 +3,6 @@ ${0:#statements} done]]> forin - source.shell + source.shell.bash for … in … done diff --git a/ShellScript/Snippets/if-...-then-(if).sublime-snippet b/ShellScript/Snippets/if-...-then-(if).sublime-snippet index 8fea467bf2..20322aa0d5 100644 --- a/ShellScript/Snippets/if-...-then-(if).sublime-snippet +++ b/ShellScript/Snippets/if-...-then-(if).sublime-snippet @@ -3,6 +3,6 @@ ${0:#statements} fi]]> if - source.shell + source.shell.bash if … fi diff --git a/ShellScript/Snippets/until-(done).sublime-snippet b/ShellScript/Snippets/until-(done).sublime-snippet index 0e38bb6a0a..67999de3a6 100644 --- a/ShellScript/Snippets/until-(done).sublime-snippet +++ b/ShellScript/Snippets/until-(done).sublime-snippet @@ -3,6 +3,6 @@ ${0:#statements} done]]> until - source.shell + source.shell.bash until … done diff --git a/ShellScript/Snippets/while-(done).sublime-snippet b/ShellScript/Snippets/while-(done).sublime-snippet index c4e86dfb4a..5fdedde07c 100644 --- a/ShellScript/Snippets/while-(done).sublime-snippet +++ b/ShellScript/Snippets/while-(done).sublime-snippet @@ -3,6 +3,6 @@ ${0:#statements} done]]> while - source.shell + source.shell.bash while … done diff --git a/ShellScript/test/syntax_test_bash.sh b/ShellScript/test/syntax_test_bash.sh index e4c2a25c9e..bfe863be07 100755 --- a/ShellScript/test/syntax_test_bash.sh +++ b/ShellScript/test/syntax_test_bash.sh @@ -471,16 +471,94 @@ local-pid # ^ - storage.modifier # ^^ - variable.parameter -if [[ -z "$PLATFORM" ]]; then PLATFORM=docker; fi -# ^ variable.other.readwrite.assignment -# ^ keyword.operator.assignment -# ^ string.unquoted - +if [[ ! -z "$PLATFORM" ]] && ! cmd || ! cmd2; then PLATFORM=docker; fi +#^ keyword.control.conditional.if +# ^ keyword.operator.logical +# ^^ keyword.operator.logical.and +# ^ keyword.operator.logical.shell +# ^^^ meta.function-call.shell variable.function +# ^^ keyword.operator.logical.or.shell +# ^ keyword.operator.logical.shell +# ^^^^ meta.function-call.shell variable.function.shell +# ^ keyword.operator.logical.continue +# ^^^^ keyword.control.conditional.then +# ^ variable.other.readwrite.assignment +# ^ keyword.operator.assignment +# ^ string.unquoted +if cmd && \ + ! cmd +# ^ keyword.operator.logical.shell +# ^^^ meta.function-call.shell variable.function.shell +if cmd && + ! cmd +# ^ keyword.operator.logical.shell +# ^^^ meta.function-call.shell variable.function.shell +if cmd || \ + ! cmd +# ^ keyword.operator.logical.shell +# ^^^ meta.function-call.shell variable.function.shell +if cmd || + ! cmd +# ^ keyword.operator.logical.shell +# ^^^ meta.function-call.shell variable.function.shell +if \ + ! cmd +# ^ keyword.operator.logical.shell +# ^^^ meta.function-call.shell variable.function.shell +if !cmd +# ^ punctuation.definition.history.shell +# ^^^ meta.function-call.shell variable.function.shell +! cmd +# <- keyword.operator.logical.shell +# ^^^ meta.function-call.shell variable.function.shell +!cmd +# <- punctuation.definition.history.shell +#^^^ meta.function-call.shell variable.function.shell +! \ +# <- keyword.operator.logical.shell +# ^ punctuation.separator.continuation.line.shell +! \ + cmd +#^^^ meta.function-call.shell variable.function.shell +!\ +# <- punctuation.definition.history.shell +#^ punctuation.separator.continuation.line.shell +!\ + cmd +#^^^ meta.function-call.shell variable.function.shell +! [[ ]] +# <- keyword.operator.logical.shell +# ^^^^^ meta.function-call.arguments.shell +![[ ]] +# <- punctuation.definition.history.shell +#^^^^^ meta.function-call.arguments.shell +!! +# <- variable.language.history.shell punctuation.definition.history.shell +#^ variable.language.history.shell +!-1 +# <- variable.language.history.shell punctuation.definition.history.shell +#^^ variable.language.history.shell +!51 +# <- variable.language.history.shell punctuation.definition.history.shell +#^^ variable.language.history.shell + +then- +#^^^^ - keyword +-then +#^^^^ - keyword if-up # <- - keyword # ^ - keyword up-if # ^^ - keyword +then- +#^^^^ - keyword +-then +#^^^^ - keyword +then-fi +#^^^^^^ - keyword +if-then +#^^^^^^ - keyword done-foo # <- - keyword foo-done @@ -1072,6 +1150,19 @@ if [[ ' foobar' == [\ ]foo* ]]; then # ^^ support.function.double-brace.end : fi + +case- +#^ - keyword + +esac +#^ keyword.control.conditional.end - meta.conditional.case + +case +#^ meta.conditional.case keyword.control.conditional.case + +esac +#^ meta.conditional.case keyword.control.conditional.end + case $_G_unquoted_arg in *[\[\~\#\&\*\(\)\{\}\|\;\<\>\?\'\ ]*|*]*|"") #^ keyword.control.regexp.set.begin @@ -1138,7 +1229,7 @@ exec >&${tee[1]} 2>&1 # Misc. operators # ################### (( 0123456708 )) -# ^ constant.numeric.integer.octal punctuation.definition.numeric.octal +# ^ constant.numeric.integer.octal punctuation.definition.numeric.base # ^^^^^^^^^ constant.numeric.integer.octal # ^ constant.numeric.integer.octal invalid.illegal.not-an-octal-character (( 0 )) @@ -1226,19 +1317,19 @@ exec >&${tee[1]} 2>&1 # ^^^^^^^^^ meta.group.parens # ^^ - meta.group.parens (( 0xDEADBEEF 0xdeadbeef 0x1234567890abcdefg )) -# ^^ constant.numeric.integer.hexadecimal punctuation.definition.numeric.hexadecimal +# ^^ constant.numeric.integer.hexadecimal punctuation.definition.numeric.base # ^^^^^^^^ constant.numeric.integer.hexadecimal -# ^^ constant.numeric.integer.hexadecimal punctuation.definition.numeric.hexadecimal +# ^^ constant.numeric.integer.hexadecimal punctuation.definition.numeric.base # ^^^^^^^^ constant.numeric.integer.hexadecimal -# ^^ constant.numeric.integer.hexadecimal punctuation.definition.numeric.hexadecimal +# ^^ constant.numeric.integer.hexadecimal punctuation.definition.numeric.base # ^^^^^^^^^^^^^^^^ constant.numeric.integer.hexadecimal # ^ constant.numeric.integer.hexadecimal invalid.illegal.not-a-hex-character (( 64#123@_ )) -# ^^ constant.numeric.integer.decimal.base -# ^ punctuation.definition.numeric.base -# ^^^^^ constant.numeric.integer.generic-base +# ^^^^^^^^ constant.numeric.integer.other +# ^^^ punctuation.definition.numeric.base (( 0x1f )) # ^^^^ constant.numeric.integer.hexadecimal +# ^^ punctuation.definition.numeric.base (( a * b )) # ^ keyword.operator.arithmetic - keyword.operator.regexp ((a+=b)) @@ -1483,27 +1574,27 @@ for (( i = 0; i < 10; i++ )); do # ^^ meta.group.for keyword.operator.arithmetic # ^^ meta.group.for punctuation.section.arithmetic.end # ^ keyword.operator.logical.continue -# ^^ keyword.control.do +# ^^ keyword.control.loop.do echo $i # <- meta.function-call support.function.echo # ^ meta.function-call.arguments punctuation.definition.variable # ^ meta.function-call.arguments variable.other.readwrite done -# <- keyword.control +# <- keyword.control.loop.end for i in $(seq 100); do -# <- keyword.control.for +# <- keyword.control.loop.for # ^^ meta.group.for keyword.control.in # ^ meta.group.for punctuation.definition.variable # ^ meta.group.for punctuation.section.parens.begin # ^^^ meta.group.for meta.function-call variable.function # ^ meta.group.for punctuation.section.parens.end # ^ keyword.operator.logical.continue -# ^^ keyword.control.do +# ^^ keyword.control.loop.do : # <- meta.function-call support.function.colon done -# <- keyword.control.done +# <- keyword.control.loop.end [[ "${foo}" == bar*baz ]] # <- support.function.double-brace.begin @@ -1513,33 +1604,33 @@ done # ^^ meta.function-call.arguments support.function.double-brace.end case "$1" in -# <- keyword.control.case +# <- keyword.control.conditional.case # ^ string.quoted.double punctuation.definition.string.begin # ^ string.quoted.double punctuation.definition.variable # ^ string.quoted.double variable.other.readwrite # ^ string.quoted.double punctuation.definition.string.end -# ^^ keyword.control.case.in +# ^^ keyword.control.in setup ) # <- - variable.function - support.function - meta.function-call -# ^ keyword.control.case.item +# ^ keyword.control.conditional.patterns echo Preparing the server... # <- meta.function-call support.function.echo # ^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments ;; -# <- punctuation.terminator.case -#^ punctuation.terminator.case +# <- punctuation.terminator.case.clause +#^ punctuation.terminator.case.clause deploy ) # <- - variable.function - support.function - meta.function-call -# ^ keyword.control.case.item +# ^ keyword.control.conditional.patterns echo Deploying... # <- meta.function-call support.function.echo # ^^^^^^^^^^^^^ meta.function-call.arguments ;; -# <- punctuation.terminator.case -#^ punctuation.terminator.case +# <- punctuation.terminator.case.clause +#^ punctuation.terminator.case.clause * ) # <- keyword.operator.regexp.quantifier -# ^ keyword.control.case.item +# ^ keyword.control.conditional.patterns cat <<'ENDCAT' # <- meta.function-call variable.function # ^^ meta.function-call.arguments string.unquoted.heredoc keyword.operator.assignment.redirection @@ -1551,10 +1642,10 @@ foo ENDCAT # <- meta.function-call.arguments string.unquoted.heredoc keyword.control.heredoc-token ;; -# <- punctuation.terminator.case -#^ punctuation.terminator.case +# <- punctuation.terminator.case.clause +#^ punctuation.terminator.case.clause esac -# <- keyword.control.case.end +# <- keyword.control.conditional.end if [ ! -f q4m-$Q4MVER.tar.gz ]; then #^ support.function.test.begin @@ -1593,7 +1684,7 @@ fi # ^ constant.numeric.integer.decimal.file-descriptor - variable.function if [ "$1" != "" -a "$2" != "" ]; then -# <- keyword.control.if.begin +# <- keyword.control.conditional.if # ^ support.function.test.begin # ^^ meta.function-call.arguments keyword.operator.logical # ^ meta.function-call.arguments variable.parameter punctuation.definition.parameter @@ -1601,7 +1692,7 @@ if [ "$1" != "" -a "$2" != "" ]; then # ^^ meta.function-call.arguments keyword.operator.logical # ^ meta.function-call.arguments support.function.test.end # ^ keyword.operator.logical.continue -# ^^^^ keyword.control.if.then +# ^^^^ keyword.control.conditional.then local DIR=$1 # <- storage.modifier # ^^^ variable.other.readwrite.assignment @@ -1611,8 +1702,8 @@ if [ "$1" != "" -a "$2" != "" ]; then # ^^^^^^ variable.other.readwrite.assignment # ^ keyword.operator.assignment elif [ "$1" ]; then -# <- keyword.control.if.elif -# ^^^^ keyword.control.if.then +# <- keyword.control.conditional.elseif +# ^^^^ keyword.control.conditional.then local DIR=$PWD # <- storage.modifier # ^^^ variable.other.readwrite.assignment @@ -1622,7 +1713,7 @@ elif [ "$1" ]; then # ^^^^^^ variable.other.readwrite.assignment # ^ keyword.operator.assignment fi -# <- keyword.control.if.end +# <- keyword.control.conditional.end function clk { typeset base=/sys/class/drm/card0/device @@ -1638,7 +1729,7 @@ function clk { echo "Usage: $FUNCNAME [ low | high | default ]" printf '%s\n' "temp: $(<${base}/hwmon/hwmon0/temp1_input)C" "current profile: $(<${base}/power_profile)" esac - # <- meta.function keyword.control.case.end + # <- meta.function keyword.control.conditional.end } # <- punctuation @@ -1661,7 +1752,7 @@ f() { $1|$2) local "$x"'+=(4)' esac - # <- meta.function keyword.control.case.end + # <- meta.function keyword.control.conditional.end IFS=, local -a "$x"'=("${x}: ${'"$x"'[*]}")' # ^ variable.other.readwrite.assignment @@ -1675,31 +1766,50 @@ f() { done } -case "${foo}" in -# <- keyword.control.case.begin -# ^^ keyword.control.case.in +case "${foo}" in- in_ in=10 in +#^^^^^^^^^^^^^^^^^^^^^^^^ meta.conditional.case.shell +# <- keyword.control.conditional.case +# ^^ - keyword.control.in +# ^^ - keyword.control.in +# ^^ - keyword.control.in +# ^^ keyword.control.in ( help | h ) bar ;; - # <- keyword.control - # ^ keyword.control - # ^^ punctuation +#^^^ meta.conditional.case.shell - meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands +# ^^^^^^^^^^^^ meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands - meta.conditional.case.shell +# ^^^^^^^ meta.conditional.case.clause.commands - meta.conditional.case.clause.patterns - meta.conditional.case.shell +# ^ meta.conditional.case.shell - meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands + # <- keyword.control.conditional.patterns.begin + # ^ keyword.control.conditional.patterns.end + # ^^ punctuation.terminator.case.clause do1 ) foo1 ;& - # ^ keyword.control - # ^^ punctuation +#^^^ meta.conditional.case.shell - meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands +# ^^^^^ meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands - meta.conditional.case.shell +# ^^^^^^^^ meta.conditional.case.clause.commands - meta.conditional.case.clause.patterns - meta.conditional.case.shell +# ^ meta.conditional.case.shell - meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands + # ^ keyword.control.conditional.patterns.end + # ^^ punctuation.terminator.case.clause (do2 ) foo2 ;;& - # <- keyword.control - # ^ keyword.control - # ^^^ punctuation +#^^^ meta.conditional.case.shell - meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands +# ^^^^^^ meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands - meta.conditional.case.shell +# ^^^^^^^^^ meta.conditional.case.clause.commands - meta.conditional.case.clause.patterns - meta.conditional.case.shell +# ^ meta.conditional.case.shell - meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands + # <- keyword.control.conditional.patterns.begin + # ^ keyword.control.conditional.patterns.end + # ^^^ punctuation.terminator.case.clause *) bar - #^ keyword.control +#^^^ meta.conditional.case.shell - meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands +# ^^ meta.conditional.case.clause.patterns - meta.conditional.case.clause.commands - meta.conditional.case.shell +# ^^^^^ meta.conditional.case.clause.commands - meta.conditional.case.clause.patterns - meta.conditional.case.shell + #^ keyword.control.conditional.patterns.end esac -# <- keyword.control.case.end +# <- keyword.control.conditional.end case $TERM in sun-cmd) - # ^ keyword.control.case.item + # ^ keyword.control.conditional.patterns update_terminal_cwd() { print -Pn "\e]l%~\e\\" };; # ^ meta.function punctuation.section.braces.end - # ^^ punctuation.terminator.case + # ^^ punctuation.terminator.case.clause *xterm*|rxvt|(dt|k|E)term) # ^ keyword.operator.regexp.quantifier # ^ keyword.operator.logical @@ -1707,20 +1817,20 @@ case $TERM in # ^ keyword.operator.logical # ^ keyword.operator.logical # ^ punctuation.section.parens.end - # ^ keyword.control.case.item + # ^ keyword.control.conditional.patterns update_terminal_cwd() { print -Pn "\e]2;%~\a" };; # ^ meta.function punctuation.section.braces.end - # ^^ punctuation.terminator.case + # ^^ punctuation.terminator.case.clause *) # <- keyword.operator.regexp.quantifier - #^ keyword.control.case.item + #^ keyword.control.conditional.patterns update_terminal_cwd() {};; # ^ meta.function punctuation.section.braces.end - # ^^ punctuation.terminator.case + # ^^ punctuation.terminator.case.clause esac case $SERVER in -# <- keyword.control.case.begin +# <- keyword.control.conditional.case ws-+([0-9]).host.com) echo "Web Server" # ^ keyword.operator.regexp.quantifier # ^ punctuation.section.parens.begin @@ -1728,10 +1838,10 @@ ws-+([0-9]).host.com) echo "Web Server" # ^ keyword.operator.word # ^ keyword.control.regexp.set.end # ^ punctuation.section.parens.end -# ^ keyword.control.case.item +# ^ keyword.control.conditional.patterns ;; -# <- punctuation.terminator.case - # <- punctuation.terminator.case +# <- punctuation.terminator.case.clause + # <- punctuation.terminator.case.clause db-+([0-9])\.host\.com) echo "DB server" # ^ keyword.operator.regexp.quantifier # ^ punctuation.section.parens.begin @@ -1739,10 +1849,10 @@ db-+([0-9])\.host\.com) echo "DB server" # ^ keyword.operator.word # ^ keyword.control.regexp.set.end # ^ punctuation.section.parens.end -# ^ keyword.control.case.item +# ^ keyword.control.conditional.patterns ;; -# <- punctuation.terminator.case - # <- punctuation.terminator.case +# <- punctuation.terminator.case.clause + # <- punctuation.terminator.case.clause bk-+([0-9])\.host\.com) echo "Backup server" # ^ keyword.operator.regexp.quantifier # ^ punctuation.section.parens.begin @@ -1750,18 +1860,18 @@ bk-+([0-9])\.host\.com) echo "Backup server" # ^ keyword.operator.word # ^ keyword.control.regexp.set.end # ^ punctuation.section.parens.end -# ^ keyword.control.case.item +# ^ keyword.control.conditional.patterns ;; -# <- punctuation.terminator.case - # <- punctuation.terminator.case +# <- punctuation.terminator.case.clause + # <- punctuation.terminator.case.clause *)echo "Unknown server" # <- keyword.operator.regexp.quantifier - # <- keyword.control.case.item + # <- keyword.control.conditional.patterns ;; -# <- punctuation.terminator.case - # <- punctuation.terminator.case +# <- punctuation.terminator.case.clause + # <- punctuation.terminator.case.clause esac -# <- keyword.control.case.end +# <- keyword.control.conditional.end if [ "$*" = '*' ] then remotefilter="cat" @@ -1785,9 +1895,9 @@ else remotefilter="grep" # ^ variable.other.readwrite.assignment # ^ keyword.operator.assignment done - # <- keyword.control.done + # <- keyword.control.loop.end fi -# <- keyword.control.if.end +# <- keyword.control.conditional.end ################################ # And, or, pipes, redirections # @@ -2261,7 +2371,7 @@ foo=$( } # <- punctuation.section func - + # <- meta.group.expansion.command ) # <- punctuation.section @@ -2304,3 +2414,22 @@ function [[]] () { [[]] # <- meta.function-call variable.function #^^^ meta.function-call variable.function + +__git_aliased_command () +{ + local word cmdline=$(__git config --get "alias.$1") + for word in $cmdline; do + case "$word" in + {) : skip start of shell helper function ;; +# ^ - punctuation.section.expansion.brace.begin +# ^ keyword.control.conditional.patterns + \'*) : skip opening quote after sh -c ;; + *) + echo "$word" + return + esac + done +} +# <- meta.function punctuation.section.braces.end + +# <- - meta.function diff --git a/XML/Comments.tmPreferences b/XML/Comments.tmPreferences index 9ba96bd3d6..7e8205f488 100644 --- a/XML/Comments.tmPreferences +++ b/XML/Comments.tmPreferences @@ -4,7 +4,7 @@ name Comments scope - text.xml + text.xml - meta.tag settings shellVariables diff --git a/XML/Snippets/comment.sublime-snippet b/XML/Snippets/comment.sublime-snippet deleted file mode 100644 index 07a525181e..0000000000 --- a/XML/Snippets/comment.sublime-snippet +++ /dev/null @@ -1,6 +0,0 @@ - - Comment - }]]> - c - text.xml - diff --git a/XML/Snippets/long-tag.sublime-snippet b/XML/Snippets/long-tag.sublime-snippet deleted file mode 100644 index 8006a8d51d..0000000000 --- a/XML/Snippets/long-tag.sublime-snippet +++ /dev/null @@ -1,6 +0,0 @@ - - ${2:$SELECTION}]]> - < - text.xml - Long Tag - diff --git a/XML/Snippets/cdata.sublime-snippet b/XML/Snippets/xml-cdata.sublime-snippet similarity index 100% rename from XML/Snippets/cdata.sublime-snippet rename to XML/Snippets/xml-cdata.sublime-snippet diff --git a/XML/Snippets/XML-Processing-Instruction.sublime-snippet b/XML/Snippets/xml-declaration.sublime-snippet similarity index 57% rename from XML/Snippets/XML-Processing-Instruction.sublime-snippet rename to XML/Snippets/xml-declaration.sublime-snippet index 05cc329384..a60565e7bd 100644 --- a/XML/Snippets/XML-Processing-Instruction.sublime-snippet +++ b/XML/Snippets/xml-declaration.sublime-snippet @@ -1,6 +1,6 @@ ]]> - xml + xml-declaration text.xml - XML Processing Instruction + XML Declaration diff --git a/XML/Snippets/xml-long-tag.sublime-snippet b/XML/Snippets/xml-long-tag.sublime-snippet new file mode 100644 index 0000000000..3d01c2739e --- /dev/null +++ b/XML/Snippets/xml-long-tag.sublime-snippet @@ -0,0 +1,6 @@ + + ${0:$SELECTION}]]> + lt + text.xml - meta.tag - comment - string + Long Tag + diff --git a/XML/Snippets/xml-model.sublime-snippet b/XML/Snippets/xml-model.sublime-snippet new file mode 100644 index 0000000000..1861c677d4 --- /dev/null +++ b/XML/Snippets/xml-model.sublime-snippet @@ -0,0 +1,6 @@ + + $0]]> + xml-model + text.xml + XML Model + diff --git a/XML/Snippets/short-tag.sublime-snippet b/XML/Snippets/xml-short-tag.sublime-snippet similarity index 55% rename from XML/Snippets/short-tag.sublime-snippet rename to XML/Snippets/xml-short-tag.sublime-snippet index 5fa32e3f72..2561d680b2 100644 --- a/XML/Snippets/short-tag.sublime-snippet +++ b/XML/Snippets/xml-short-tag.sublime-snippet @@ -1,6 +1,6 @@ ]]> - > - text.xml + st + text.xml - meta.tag - comment - string Short Tag diff --git a/XML/Snippets/xml-stylesheet.sublime-snippet b/XML/Snippets/xml-stylesheet.sublime-snippet new file mode 100644 index 0000000000..6ac1f4717c --- /dev/null +++ b/XML/Snippets/xml-stylesheet.sublime-snippet @@ -0,0 +1,6 @@ + + $0]]> + xml-stylesheet + text.xml + XML Stylesheet + diff --git a/XML/XML.sublime-settings b/XML/XML.sublime-settings index a5275bbc5a..3f8131ffcc 100644 --- a/XML/XML.sublime-settings +++ b/XML/XML.sublime-settings @@ -1,3 +1,3 @@ { - "hidden_extensions": ["rss", "sublime-snippet", "vcproj", "tmLanguage", "tmTheme", "tmSnippet", "tmPreferences", "dae", "csproj"] + "hidden_extensions": ["rss", "sublime-snippet", "tmLanguage", "tmTheme", "tmSnippet", "tmPreferences", "dae", "csproj", "fsproj", "sqlproj", "vbproj", "vcproj", "vcxproj", "props", "targets" ] } diff --git a/XML/XML.sublime-syntax b/XML/XML.sublime-syntax index b3dbeddfef..ad7d9c871a 100644 --- a/XML/XML.sublime-syntax +++ b/XML/XML.sublime-syntax @@ -1,5 +1,6 @@ %YAML 1.2 --- + name: XML file_extensions: - xml @@ -7,250 +8,612 @@ file_extensions: - xslt - tld - dtml + - rng - rss - opml - svg first_line_match: |- - (?x) - ^(?: - <\?xml\s - | \s*<([\w-]+):Envelope\s+xmlns:\1\s*=\s*"http://schemas.xmlsoap.org/soap/envelope/"\s*> - ) + (?x: + ^(?: + <\?xml\s + | \s*<([\w-]+):Envelope\s+xmlns:\1\s*=\s*"http://schemas.xmlsoap.org/soap/envelope/"\s*> + | \s*(?i:])) + ) + ) scope: text.xml variables: + # The atomic part of a tag or attribute name without namespace separator `:` + identifier: '[[:alpha:]_][[:alnum:]_.-]*' # This is the full XML Name production, but should not be used where namespaces # are possible. Those locations should use a qualified_name. name: '[[:alpha:]:_][[:alnum:]:_.-]*' - # This is the form that allows a namespace prefix (ns:) followed by a local - # name. The captures are: - # 1: namespace prefix name - # 2: namespace prefix colon - # 3: local tag name - qualified_name: '(?:([[:alpha:]_][[:alnum:]_.-]*)(:))?([[:alpha:]_][[:alnum:]_.-]*)' + # The qualified tag name allows a namespace prefix (ns:) followed by a local + # name while both parts are validated separately. The namespace is optional, + # but is matched valid if not followed by a localname in order to not disturb + # writing. + qualified_tag_name: |- + (?x) + (?: + (?: + ({{identifier}}) # 1: valid namespace + | + ([^?!/<>\s][^:/<>\s]*) # 2: invalid namespace + )(:) + )? # namespace is optional + (?: + ({{identifier}})(?=[/<>\s]) # 3: valid localname + | + ([^?!/<>\s][^/<>\s]*) # 4: invalid localname + ) + + qualified_attribute_name: |- + (?x) + (?: + (?: + ({{identifier}}) # 1: valid namespace + | + ([^:=/<>\s]+) # 2: invalid namespace + )(:) + )? # namespace is optional + (?: + ({{identifier}}) # 3: valid localname + | + ([^=/<>\s]+?) # 4: invalid localname + )(?=[=<>\s]|[/?]>) + + # A doctype definition identifier is always followed by one of the + # characters of `dtd_break`. + dtd_break: '[''"\[\]()<>\s]' + # A valid or invalid doctype declaration identifiere consists of any + # character but one of `dtd_break`. + invalid_dtd_name: '[^{{dtd_break}}]+' + # A qualified doctype declaration identifier consists of a valid + # name which is followed by a valid break character. + qualified_dtd_name: '{{name}}(?=[{{dtd_break}}])' + contexts: + main: - - match: '(<\?)(xml)(?=\s)' + - include: preprocessor + - include: doctype + - include: comment + - include: cdata + - include: tag + - include: entity + - include: should-be-entity + +###[ CDATA ]################################################################## + + cdata: + - match: ( + - meta_scope: meta.tag.sgml.cdata.xml + - meta_content_scope: string.unquoted.cdata.xml + - match: ']]>' scope: punctuation.definition.tag.end.xml pop: true - - match: '\s+{{qualified_name}}(=)?' - captures: - 1: entity.other.attribute-name.namespace.xml - 2: entity.other.attribute-name.xml punctuation.separator.namespace.xml - 3: entity.other.attribute-name.localname.xml - 4: punctuation.separator.key-value.xml - - include: double-quoted-string - - include: single-quoted-string - - match: '() - captures: - 1: punctuation.definition.tag.end.xml + - meta_scope: comment.block.xml + - match: '-->' + scope: punctuation.definition.comment.end.xml pop: true - - include: internal-subset - - include: comment - - match: '(\s]*)' + - match: '-{2,}' + scope: invalid.illegal.double-hyphen-within-comment.xml + +###[ DOCTYPE DECLARATION ]#################################################### + + doctype: + - match: ( - scope: punctuation.definition.tag.end.xml - pop: true - - include: tag-stuff - - match: '( - scope: punctuation.definition.tag.end.xml - pop: true - - include: tag-stuff - - match: '(<\?)(xml-stylesheet|xml-model)(?=\s|\?>)' + 3: variable.other.documentroot.xml punctuation.separator.namespace.xml + 4: variable.other.documentroot.localname.xml + 5: invalid.illegal.bad-tag-name.xml + pop: true + - include: dtd-else-pop + +###[ DTD TAGS ]############################################################### + + dtd: + - include: cdata + - include: comment + - include: dtd-entity + - include: dtd-element + - include: dtd-attlist + - include: dtd-notation + - include: dtd-subset + - include: dtd-unknown + - include: entity-parameter + - include: preprocessor + +###[ DTD ENTITY ]############################################################# + + dtd-entity: + - match: ( - scope: punctuation.definition.tag.end.xml - pop: true - - include: tag-stuff - - match: '(<\?)((?![xX][mM][lL]){{qualified_name}})(?=\s|\?>)' + - dtd-entity-meta + - dtd-entity-content + - dtd-content-type + - dtd-entity-name + - dtd-entity-punctuation + + dtd-entity-meta: + - meta_scope: meta.tag.sgml.entity.xml + - include: dtd-end + + dtd-entity-punctuation: + - match: '%' + scope: punctuation.definition.entity.xml + pop: true + - include: dtd-else-pop + + dtd-entity-name: + - match: '{{qualified_dtd_name}}' + scope: variable.other.entity.xml + pop: true + - include: dtd-common-name + + dtd-entity-content: + - match: NDATA\b + scope: storage.type.ndata.xml + set: dtd-content-unquoted + - include: dtd-content-quoted + +###[ DTD ELEMENT ]############################################################ + + dtd-element: + - match: ( - scope: punctuation.definition.tag.end.xml + - dtd-element-meta + - dtd-element-content + - dtd-element-name + + dtd-element-meta: + - meta_scope: meta.tag.sgml.element.xml + - include: dtd-end + + dtd-element-name: + - match: '{{qualified_dtd_name}}' + scope: variable.other.element.xml + pop: true + - include: dtd-common-name + + dtd-element-content: + - match: \b(?:EMPTY|ANY)\b + scope: constant.other.xml + pop: true + - match: \( + scope: punctuation.definition.group.begin.xml + set: dtd-element-parens + - include: entity-parameter + - include: dtd-content-quoted + + dtd-element-parens: + - meta_scope: meta.group.xml + - match: \) + scope: punctuation.definition.group.end.xml + set: + - match: '[*?+]' + scope: keyword.operator.xml pop: true + - include: dtd-else-pop + - match: \( + scope: punctuation.definition.group.begin.xml + push: dtd-element-parens + - match: '[*?+]' + scope: keyword.operator.xml + - match: '[,|]' + scope: punctuation.separator.xml + - include: entity-parameter - include: entity - - match: '' - scope: punctuation.definition.string.end.xml - pop: true - - match: ']]>' - scope: invalid.illegal.missing-entity.xml - include: should-be-entity - should-be-entity: - - match: '&' - scope: invalid.illegal.bad-ampersand.xml - - match: '<' - scope: invalid.illegal.missing-entity.xml - double-quoted-string: - - match: '"' - scope: punctuation.definition.string.begin.xml + - include: string-unquoted + +###[ DTD ATTLIST ]############################################################ + + dtd-attlist: + - match: (' - scope: punctuation.definition.comment.end.xml - pop: true - - match: '-{2,}' - scope: invalid.illegal.double-hyphen-within-comment.xml - internal-subset: - - match: \[ - scope: punctuation.definition.constant.xml + - dtd-notation-meta + - dtd-content-quoted + - dtd-content-type + - dtd-notation-name + + dtd-notation-meta: + - meta_scope: meta.tag.sgml.notation.xml + - include: dtd-end + + dtd-notation-name: + - match: '{{qualified_dtd_name}}' + scope: variable.other.notation.xml + pop: true + - include: dtd-common-name + +###[ DTD SUBSET ]############################################################# + + dtd-subset: + - match: + scope: punctuation.definition.tag.end.xml + pop: true + - match: '[/\?]?>' + scope: invalid.illegal.bad-tag-end.xml + pop: true + - include: tag-end-missing-pop + + dtd-subset-name: + - match: '{{qualified_dtd_name}}' + scope: variable.other.subset.xml + pop: true + - include: dtd-common-name + + dtd-subset-brackets: + - match: \[ + scope: punctuation.section.brackets.begin.xml + set: + - meta_scope: meta.brackets.xml meta.internal-subset.xml - match: \] + scope: punctuation.section.brackets.end.xml pop: true - - include: comment - - include: entity-decl - - include: element-decl - - include: attlist-decl - - include: notation-decl - - include: parameter-entity - entity-decl: - - match: '(\s]*) captures: 1: punctuation.definition.tag.begin.xml - 2: keyword.entity.xml - 3: punctuation.definition.entity.xml - 4: variable.entity.xml - 5: keyword.entitytype.xml + 2: invalid.illegal.bad-tag-name.xml push: - - match: '>' - scope: punctuation.definition.tag.end.xml - pop: true - - include: double-quoted-string - - include: single-quoted-string - element-decl: - - match: '(' + scope: punctuation.definition.tag.end.xml + pop: true + - match: \s?(?=[<\]]) + scope: invalid.illegal.missing-tag-end.xml + pop: true + - match: '[/\?]>' + scope: invalid.illegal.bad-tag-end.xml + pop: true + - match: \S + scope: invalid.illegal.unexpected.xml + + entity-parameter: + - match: (#)P?CDATA + scope: constant.other.placeholder.xml + captures: + 1: punctuation.definition.constant.xml + - match: (%){{name}}(;) + scope: variable.parameter.xml + captures: + 1: punctuation.definition.parameter.xml + 2: punctuation.terminator.parameter.xml + +###[ XML PREPROCESSOR ]####################################################### + + preprocessor: + # Prolog tags like without respect of details + # Examples: + # + # + # + # + - match: |- + (?x) + (<\?) # opening \s]) + | + # invalid mixed or uppercase tag name + ([xX][mM][lL][^?<>\s]*) + ) captures: 1: punctuation.definition.tag.begin.xml - 2: keyword.element.xml - 3: variable.element.xml + 2: entity.name.tag.xml + 3: invalid.illegal.bad-tag-name.xml push: - - match: '>' - scope: punctuation.definition.tag.end.xml - pop: true - - match: '\b(EMPTY|ANY)\b' - scope: constant.other.xml - - include: element-parens - element-parens: - - match: \( - scope: punctuation.definition.group.xml + - meta_scope: meta.tag.preprocessor.xml + - include: preprocessor-end + - include: tag-end-missing-pop + - include: tag-attribute + # Processing instructions like + # meta tag without internal highlighting + - match: (<\?)({{name}})\b + captures: + 1: punctuation.definition.tag.begin.xml + 2: entity.name.tag.xml push: - - match: (\))([*?+])? - captures: - 1: punctuation.definition.group.xml - 2: keyword.operator.xml - pop: true - - match: '#PCDATA' - scope: constant.other.xml - - match: '[*?+]' - scope: keyword.operator.xml - - match: '[,|]' - scope: punctuation.separator.xml - - include: element-parens - attlist-decl: - - match: '( + scope: punctuation.definition.tag.end.xml + pop: true + +###[ XML TAGS ]############################################################### + + tag: + # end-tag without attribute support + - match: (' scope: punctuation.definition.tag.end.xml pop: true - - include: double-quoted-string - - include: single-quoted-string - notation-decl: - - match: '(' + scope: invalid.illegal.bad-tag-end.xml + pop: true + - match: \S + scope: invalid.illegal.unexpected-attribute.xml + # opening maybe self-closing tag with optional attributes + - match: (<){{qualified_tag_name}} captures: 1: punctuation.definition.tag.begin.xml - 2: keyword.notation.xml - 3: variable.notation.xml + 2: entity.name.tag.namespace.xml + 3: invalid.illegal.bad-tag-name.xml + 4: entity.name.tag.xml punctuation.separator.namespace.xml + 5: entity.name.tag.localname.xml + 6: invalid.illegal.bad-tag-name.xml push: - - match: '>' + - meta_scope: meta.tag.xml + - match: /?> scope: punctuation.definition.tag.end.xml pop: true - - include: double-quoted-string - - include: single-quoted-string - parameter-entity: - - match: '(%){{name}}(;)' - scope: constant.character.parameter-entity.xml - captures: - 1: punctuation.definition.constant.xml - 2: punctuation.definition.constant.xml - single-quoted-string: - - match: "'" - scope: punctuation.definition.string.begin.xml - push: - - meta_scope: string.quoted.single.xml - - match: "'" - scope: punctuation.definition.string.end.xml + - match: \?> + scope: invalid.illegal.bad-tag-end.xml pop: true - - include: entity - - include: should-be-entity - tag-stuff: - - match: '(?:\s+|^){{qualified_name}}\s*(=)' + - include: tag-end-missing-pop + - include: tag-attribute + + tag-attribute: + - match: '{{qualified_attribute_name}}' captures: 1: entity.other.attribute-name.namespace.xml - 2: entity.other.attribute-name.xml punctuation.separator.namespace.xml - 3: entity.other.attribute-name.localname.xml - 4: punctuation.separator.key-value.xml - - match: '(?:\s+|^)([[:alnum:]:_.-]+)\s*(=)' + 2: invalid.illegal.bad-attribute-name.xml + 3: entity.other.attribute-name.xml punctuation.separator.namespace.xml + 4: entity.other.attribute-name.localname.xml + 5: invalid.illegal.bad-attribute-name.xml + push: tag-attribute-separator-key-value + + tag-attribute-separator-key-value: + - match: '=' + scope: punctuation.separator.key-value.xml + set: + - include: string-quoted-pop + - match: '[^?/<>\s]+' + scope: invalid.illegal.bad-attribute-value.xml + pop: true + - include: tag-else-pop + - include: tag-else-pop + + tag-else-pop: + # pop, if nothing else matched and ensure `tag-end-missing-pop` works + - match: (?=\s?<|\S) + pop: true + + tag-end-missing-pop: + # pop, if the next opening tag is following, while scoping the + # preceding space to give a hint about the unclosed tag + - match: \s?(?=<) + scope: invalid.illegal.missing-tag-end.xml + pop: true + +###[ CONSTANTS ]############################################################## + + entity: + - match: (&#[xX])\h+(;) + scope: constant.character.entity.hexadecimal.xml + captures: + 1: punctuation.definition.entity.xml + 2: punctuation.terminator.entity.xml + - match: (&#)[0-9]+(;) + scope: constant.character.entity.decimal.xml captures: - 1: invalid.illegal.bad-attribute-name.xml - 2: punctuation.separator.key-value.xml - - include: double-quoted-string - - include: single-quoted-string + 1: punctuation.definition.entity.xml + 2: punctuation.terminator.entity.xml + - match: (&){{name}}(;) + scope: constant.character.entity.named.xml + captures: + 1: punctuation.definition.entity.xml + 2: punctuation.terminator.entity.xml + + should-be-entity: + - match: '&' + scope: invalid.illegal.bad-ampersand.xml + - match: '<' + scope: invalid.illegal.missing-entity.xml + + string-unquoted: + - match: '{{name}}' + scope: string.unquoted.xml + + string-unquoted-pop: + - match: '{{name}}' + scope: string.unquoted.xml + pop: true + + string-quoted: + - include: string-double-quoted + - include: string-single-quoted + + string-quoted-pop: + - include: string-double-quoted-pop + - include: string-single-quoted-pop + + string-double-quoted: + - match: '"' + scope: punctuation.definition.string.begin.xml + push: string-double-quoted-body + + string-double-quoted-pop: + - match: '"' + scope: punctuation.definition.string.begin.xml + set: string-double-quoted-body + + string-double-quoted-body: + - meta_scope: string.quoted.double.xml + - match: '"' + scope: punctuation.definition.string.end.xml + pop: true + - include: tag-end-missing-pop + - include: entity + - include: should-be-entity + + string-single-quoted: + - match: "'" + scope: punctuation.definition.string.begin.xml + push: string-single-quoted-body + + string-single-quoted-pop: + - match: "'" + scope: punctuation.definition.string.begin.xml + set: string-single-quoted-body + + string-single-quoted-body: + - meta_scope: string.quoted.single.xml + - match: "'" + scope: punctuation.definition.string.end.xml + pop: true + - include: tag-end-missing-pop + - include: entity + - include: should-be-entity + diff --git a/XML/syntax_test_xml.xml b/XML/syntax_test_xml.xml index 9b074aa40a..8db0895a6b 100644 --- a/XML/syntax_test_xml.xml +++ b/XML/syntax_test_xml.xml @@ -1,331 +1,1925 @@ - +## SYNTAX TEST "Packages/XML/XML.sublime-syntax" + + + +## ^ - meta.tag.preprocessor +## ^^^^^^^ meta.tag.preprocessor +## ^^ punctuation.definition.tag.begin +## ^^^ entity.name.tag +## ^^ punctuation.definition.tag.end +## ^ - meta.tag.preprocessor + + - - - - - - - - - - +## ^ meta.tag invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^^^^^^^^^ meta.tag.preprocessor +## ^^ punctuation.definition.tag.begin +## ^^^ entity.name.tag +## ^^^^^^^ entity.other.attribute-name +## ^ punctuation.separator.key-value +## ^ punctuation.definition.string.begin +## ^^^^^ string.quoted +## ^ punctuation.definition.string.end +## ^^ punctuation.definition.tag.end +## ^ - meta.tag.preprocessor + + +## ^ - meta.tag - invalid +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.preprocessor +## ^^ punctuation.definition.tag.begin +## ^^^ entity.name.tag +## ^^^^^^^ entity.other.attribute-name +## ^ punctuation.separator.key-value +## ^^^^^^^^ invalid.illegal.bad-attribute-value +## ^^^^^^^^^^ entity.other.attribute-name +## ^^ punctuation.definition.tag.end +## ^ - meta.tag.preprocessor + + +## ^ - meta.tag - invalid +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.preprocessor +## ^^ punctuation.definition.tag.begin +## ^^^ entity.name.tag +## ^^^^^^^ entity.other.attribute-name +## ^ punctuation.separator.key-value +## ^^^^^^^^ invalid.illegal.bad-attribute-value +## ^^^^^^^^^^ invalid.illegal.bad-attribute-name +## ^^ punctuation.definition.tag.end +## ^ - meta.tag.preprocessor + + +## ^ - meta.tag - invalid +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.preprocessor +## ^^ punctuation.definition.tag.begin +## ^^^ entity.name.tag +## ^^^^^^^ entity.other.attribute-name +## ^ punctuation.separator.key-value +## ^^^^^^^^ invalid.illegal.bad-attribute-value +## ^^^^^^^^^^ entity.other.attribute-name +## ^^ punctuation.definition.tag.end +## ^ - meta.tag.preprocessor + + +## ^ - meta.tag - invalid +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.preprocessor +## ^^ punctuation.definition.tag.begin +## ^^^ entity.name.tag +## ^^^^^^^ entity.other.attribute-name +## ^ punctuation.separator.key-value +## ^^^^^^^^^ invalid.illegal.bad-attribute-value +## ^ - punctuation.separator.key-value +## ^^^^^^^^^^ entity.other.attribute-name +## ^ punctuation.separator.key-value +## ^^ punctuation.definition.tag.end +## ^ - meta.tag.preprocessor + + +## ^ - meta.tag - invalid +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.preprocessor +## ^^ punctuation.definition.tag.begin +## ^^^ entity.name.tag +## ^^^^^^^ entity.other.attribute-name +## ^ punctuation.separator.key-value +## ^^^^^^^^^^^^^ invalid.illegal.bad-attribute-value +## ^ - punctuation.separator.key-value +## ^^^^^^^^^^ entity.other.attribute-name +## ^ punctuation.separator.key-value +## ^^^^ invalid.illegal.bad-attribute-value +## ^^ punctuation.definition.tag.end +## ^ - meta.tag.preprocessor + + +## ^^ punctuation.definition.tag.end +## ^ - meta.tag.preprocessor + +## ^^ punctuation.definition.tag.end +## ^ - meta.tag.preprocessor + + +## ^^ punctuation.definition.tag.end +## ^ - meta.tag.preprocessor + + +## ^^ punctuation.definition.tag.end +## ^ - meta.tag.preprocessor + + + + +## ^ - meta.tag.preprocessor +## ^^^^^^^ meta.tag.preprocessor +## ^ - meta.tag.preprocessor +## ^^ punctuation.definition.tag.begin +## ^^^ invalid.illegal.bad-tag-name +## ^^ punctuation.definition.tag.end + + +## ^ - meta.tag.preprocessor +## ^^^^^^^ meta.tag.preprocessor +## ^ - meta.tag.preprocessor +## ^^ punctuation.definition.tag.begin +## ^^^ invalid.illegal.bad-tag-name +## ^^ punctuation.definition.tag.end - +## ^ - meta.tag.preprocessor +## ^^^^^^^^^^^^^^^^^^^^^^ meta.tag.preprocessor +## ^ - meta.tag.preprocessor +## ^^ punctuation.definition.tag.begin +## ^^^ invalid.illegal.bad-tag-name +## ^^^^^^^ entity.other.attribute-name +## ^ punctuation.separator.key-value +## ^ punctuation.definition.string.begin +## ^^^^^ string.quoted +## ^ punctuation.definition.string.end +## ^^ punctuation.definition.tag.end + + + + + + + +## ^ - meta.tag.preprocessor +## ^^^^^^^^^^^^^^^^^^ meta.tag.preprocessor +## ^ - meta.tag.preprocessor +## ^^ punctuation.definition.tag.begin +## ^^^^^^^^^^^^^^ entity.name.tag +## ^^ punctuation.definition.tag.end - - - - - - - - - - - +## ^ - meta.tag.preprocessor +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.preprocessor +## ^ - meta.tag.preprocessor +## ^^ punctuation.definition.tag.begin +## ^^^^^^^^^^^^^^ entity.name.tag +## ^ - entity +## ^^^^ entity.other.attribute-name.localname +## ^ punctuation.separator.key-value +## ^ punctuation.definition.string.begin +## ^^^^^^^^^^ string.quoted.single +## ^ punctuation.definition.string.end +## ^ - string + + +## ^^ meta.tag.preprocessor punctuation.definition.tag.end +## ^ - meta.tag.preprocessor + + +## ^^ meta.tag.preprocessor punctuation.definition.tag.end +## ^ - meta.tag.preprocessor + + + + +## ^ - meta.tag.preprocessor +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.preprocessor +## ^ - meta.tag.preprocessor +## ^^ punctuation.definition.tag.begin +## ^^^^^^^^^^^^^^ invalid.illegal.bad-tag-name +## ^ - entity +## ^^^^ entity.other.attribute-name.localname +## ^ punctuation.separator.key-value +## ^ punctuation.definition.string.begin +## ^^^^^^^^^^ string.quoted.single +## ^ punctuation.definition.string.end +## ^ - string + + + + + + + +## ^ - meta.tag.preprocessor +## ^^^^^^^^^^^^^ meta.tag.preprocessor +## ^ - meta.tag.preprocessor +## ^^ punctuation.definition.tag.begin +## ^^^^^^^^^ entity.name.tag +## ^^ punctuation.definition.tag.end - - - - - - +## ^ - meta.tag.preprocessor +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.preprocessor +## ^ - meta.tag.preprocessor +## ^^ punctuation.definition.tag.begin +## ^^^^^^^^^ entity.name.tag +## ^ - entity +## ^^^^ entity.other.attribute-name.localname +## ^ punctuation.separator.key-value +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double +## ^^ punctuation.definition.tag.end + + +## ^^ punctuation.definition.tag.end +## ^ - meta.tag.preprocessor + + + + + + + +## ^ - meta.tag.preprocessor +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.preprocessor +## ^ - meta.tag.preprocessor +## ^^ punctuation.definition.tag.begin +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ entity.name.tag +## ^^^^ entity.other.attribute-name +## ^ punctuation.separator.key-value +## ^^^^^ string.quoted.double +## ^^ punctuation.definition.tag.end + + +## ^ meta.tag.sgml.doctype string.quoted.double invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.doctype +## ^ - meta.tag.sgml.doctype +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ keyword.declaration.doctype +## ^ - entity - constant +## ^^^^ variable.other.documentroot +## ^ - constant - keyword +## ^^^^^^ storage.type.external-content +## ^ - keyword - string +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double +## ^ - string +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double +## ^ punctuation.definition.tag.end - string + + +## ^^ meta.tag.sgml.doctype invalid.illegal.bad-tag-end +## ^ - meta.tag.sgml.doctype + + +## ^^ meta.tag.sgml.doctype invalid.illegal.bad-tag-end +## ^ - meta.tag.sgml.doctype + + +## ^ - meta.tag.sgml.doctype +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.doctype +## ^ - meta.brackets - meta.internal-subset +## ^^^^^^^^^^^^ meta.brackets meta.internal-subset +## ^ - meta.brackets - meta.internal-subset +## ^ string.quoted.double +## ^ string.quoted.double +## ^ string.quoted.double +## ^ punctuation.section.brackets.begin +## ^ punctuation.section.brackets.end +## ^ punctuation.definition.tag.end +## ^ - meta.tag.sgml.doctype + + +## ^ - meta.tag.sgml.doctype +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.doctype +## ^ - meta.brackets - meta.internal-subset +## ^^^^^^^^^^^ meta.brackets meta.internal-subset +## ^ - meta.brackets - meta.internal-subset +## ^ - meta.tag.sgml.doctype +## ^ string.quoted.double +## ^ string.quoted.double +## ^ punctuation.section.brackets.begin +## ^ punctuation.section.brackets.end +## ^ punctuation.definition.tag.end +## ^ - meta.tag.sgml.doctype + %name; ]> - - - - - - - - - - - - - - - +## ^ - meta.tag.sgml.doctype +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.doctype +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.brackets.xml meta.internal-subset +## ^ - meta.tag.sgml.doctype +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ keyword.declaration.doctype +## ^^^^ variable.other.documentroot +## ^ - constant - keyword - punctuation +## ^ punctuation.section.brackets.begin +## ^^ punctuation.definition.tag.begin +## ^^^^^^ keyword.declaration.entity +## ^^ variable.other.entity +## ^ punctuation.definition.parameter +## ^^^^ variable.parameter +## ^ punctuation.terminator.parameter +## ^^^^^^^^^^^^^^^^ comment.block +## ^^^^ punctuation.definition.comment.begin +## ^^^ punctuation.definition.comment.end +## ^ punctuation.section.brackets.end +## ^ punctuation.definition.tag.end - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +## ^ keyword.declaration.doctype +## ^ variable.other.documentroot + + + + ?> +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.preprocessor +## ^^ punctuation.definition.tag.begin +## ^^ entity.name.tag +## ^^ punctuation.definition.tag.end +## ^ - meta.tag.preprocessor + + + + + +## ^ - meta.tag.sgml.entity +## ^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.entity +## ^ - meta.tag.sgml.entity +## ^^ punctuation.definition.tag.begin +## ^^^^^^ keyword.declaration.entity +## ^^^^ variable.other.entity +## ^^^^^^^^ string.quoted.double +## ^ punctuation.definition.tag.end + + +## ^ meta.tag.sgml.entity invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.entity +## ^ - meta.tag.sgml.entity +## ^^ punctuation.definition.tag.begin +## ^^^^^^ keyword.declaration.entity +## ^ punctuation.definition.entity +## ^^^^^^^^^^ variable.other.entity +## ^^^^^^ storage.type.external-content +## ^^^^^ string.quoted.double +## ^^^^^ string.quoted.double +## ^^^^^ storage.type.ndata +## ^^^^ string.unquoted +## ^ punctuation.definition.tag.end + + + + + +## ^ meta.tag.sgml.element invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.element +## ^ - meta.tag.sgml.element +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ keyword.declaration.element +## ^ - keyword - variable +## ^^^^^^^^^ variable.other.element +## ^ - keyword - variable - constant - string +## ^^^ constant.other +## ^ punctuation.definition.tag.end + + +## ^ - meta.tag.sgml.element - invalid +## ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.element +## ^ - meta.tag.sgml.element +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ keyword.declaration.element +## ^ - keyword - variable +## ^^^^^^^^^ variable.other.element +## ^ - keyword - variable - constant - string +## ^^^^^ constant.other +## ^ punctuation.definition.tag.end + + +## ^ - meta.tag.sgml.element - invalid +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.element +## ^ - meta.tag.sgml.element +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ keyword.declaration.element +## ^ - keyword - variable +## ^^^^^^^^^ variable.other.element +## ^^^^^^^^^^^^^^^^ string.quoted.double +## ^ punctuation.definition.tag.end + + +## ^ - meta.tag.sgml.element - illegal +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.element +## ^ - meta.tag.sgml.element +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ keyword.declaration.element +## ^ - keyword - variable +## ^^^^^^^^^ variable.other.element +## ^ punctuation.definition.parameter +## ^^^^^^^^^^^^^^^^ variable.parameter +## ^ punctuation.terminator.parameter +## ^ punctuation.definition.tag.end + + +## ^ - meta.tag.sgml.element - illegal +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.element +## ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.group +## ^^^^^^^^^^^^^^^^^^^^ meta.group meta.group +## ^^ meta.group +## ^ - meta.tag.sgml.element +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ keyword.declaration.element +## ^ - keyword - variable +## ^^^^^^^^^ variable.other.element +## ^ punctuation.definition.group.begin +## ^^^^^^^ constant.other.placeholder +## ^ punctuation.separator +## ^^^ string.unquoted +## ^ keyword.operator +## ^ punctuation.separator +## ^^^ string.unquoted +## ^ keyword.operator +## ^ punctuation.separator +## ^ punctuation.definition.parameter +## ^^^^^ variable.parameter +## ^ punctuation.terminator.parameter +## ^ punctuation.separator +## ^ punctuation.definition.group.begin +## ^ punctuation.definition.entity +## ^^^^^ constant.character.entity.named +## ^ punctuation.terminator.entity +## ^ punctuation.separator +## ^^ punctuation.definition.entity +## ^^^^^ constant.character.entity.decimal +## ^ punctuation.terminator.entity +## ^ punctuation.separator +## ^^^ punctuation.definition.entity +## ^^^^^^ constant.character.entity.hexadecimal +## ^ punctuation.terminator.entity +## ^ punctuation.definition.group.end +## ^ keyword.operator +## ^ punctuation.definition.group.end +## ^ keyword.operator +## ^ punctuation.definition.tag.end + + + + + +## ^ meta.tag.sgml.attlist invalid.illegal.missing-tag-end +## ^ - meta.tag.sgml.attlist - invalid +## ^^^^^^^^^^ meta.tag.sgml.attlist +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ keyword.declaration.attlist +## ^ punctuation.definition.tag.end + + +## ^ meta.tag.sgml.attlist invalid.illegal.missing-tag-end +## ^ - meta.tag.sgml.attlist +## ^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.attlist +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ keyword.declaration.attlist +## ^ - keyword - variable +## ^^^^^^^^^ variable.other.element +## ^ punctuation.definition.tag.end + + +## ^^^^^^^^^^^^ variable.other.element + + +## ^ - meta.tag.sgml.attlist - invalid +## ^ - meta.tag.sgml.attlist +## ^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.attlist +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ keyword.declaration.attlist +## ^ - keyword - variable +## ^^^^^^^^^ invalid.illegal.bad-identifier +## ^ punctuation.definition.tag.end + + +## ^ meta.tag.sgml.attlist invalid.illegal.missing-tag-end +## ^ - meta.tag.sgml.attlist +## ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.attlist +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ keyword.declaration.attlist +## ^ - keyword - variable +## ^^^^^^^^^ variable.other.element +## ^ - variable - entity +## ^^^^ entity.other.attribute-name +## ^ punctuation.definition.tag.end + + +## ^ meta.tag.sgml.attlist invalid.illegal.missing-tag-end +## ^ - meta.tag.sgml.attlist +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.attlist +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ keyword.declaration.attlist +## ^ - keyword - variable +## ^^^^^^^^^ variable.other.element +## ^ - variable - entity +## ^^^^ entity.other.attribute-name +## ^ - entity - storage +## ^^^^^ storage.type.attribute +## ^ punctuation.definition.tag.end + + +## ^ meta.tag.sgml.attlist invalid.illegal.missing-tag-end +## ^ - meta.tag.sgml.attlist +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.attlist +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ keyword.declaration.attlist +## ^ - keyword - variable +## ^^^^^^^^^ variable.other.element +## ^ - variable - entity +## ^^^^ entity.other.attribute-name +## ^ - entity - storage +## ^^^^^ storage.type.attribute +## ^ - storage - constant +## ^^^^^^^^ storage.modifier.attribute.default-value +## ^ punctuation.definition.tag.end + + + + + +## ^ meta.tag.sgml.notation invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.notation +## ^ - meta.tag.sgml.notation +## ^^ punctuation.definition.tag.begin +## ^^^^^^^^ keyword.declaration.notation +## ^^^^^^ storage.type.external-content +## ^^^^^^^^^^^ string.quoted.double +## ^^^^^ string.quoted.double +## ^ punctuation.definition.tag.end + + + + + ]]> +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.cdata + + +## ^ meta.tag.sgml.subset invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^^^^ meta.tag.sgml.subset +## ^ - meta.tag.sgml.subset +## ^^^ punctuation.definition.tag.begin +## ^^^^^^^^^^^ variable.other.subset +## ^^ meta.brackets +## ^ punctuation.section.brackets.begin +## ^ punctuation.section.brackets.end +## ^ invalid.illegal.bad-tag-end + + +## ^ meta.tag.sgml.subset invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^^^^^ meta.tag.sgml.subset +## ^ - meta.tag.sgml.subset +## ^^^ punctuation.definition.tag.begin +## ^^^^^^^^^^^ variable.other.subset +## ^^ meta.brackets +## ^ punctuation.section.brackets.begin +## ^ punctuation.section.brackets.end +## ^^ punctuation.definition.tag.end + + ]]> +## ^ - meta.tag.sgml.subset - invalid +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.subset +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.internal-subset meta.internal-subset +## ^^^ punctuation.definition.tag.begin +## ^ punctuation.definition.parameter +## ^^^^^^^^^^^^^ variable.parameter +## ^ punctuation.terminator.parameter +## ^ punctuation.section.brackets.begin +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ keyword.declaration.element +## ^^^^^^^^^^^^ variable.other.element +## ^ punctuation.definition.string.begin +## ^^^^^^ string.quoted.single +## ^ punctuation.definition.string.end +## ^ punctuation.definition.tag.end +## ^^^^^^^^^^^^^^^^ comment.block +## ^ punctuation.section.brackets.end +## ^^ punctuation.definition.tag.end + + + + +## ^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.unknown +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ invalid.illegal.bad-tag-name +## ^^^^ invalid.illegal.unexpected +## ^^^^^^^ invalid.illegal.unexpected + + +## ^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.unknown +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ invalid.illegal.bad-tag-name +## ^^^^ invalid.illegal.unexpected +## ^^^^^^^ invalid.illegal.unexpected + + +## ^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.unknown +## ^^ punctuation.definition.tag.begin +## ^^^^^^ invalid.illegal.bad-tag-name +## ^^^^ invalid.illegal.unexpected +## ^^^^^^^ invalid.illegal.unexpected ]> + +## ^^^^^^^^^^^ meta.tag.sgml.doctype +## ^^ punctuation.definition.tag.begin +## ^^^^^^^ invalid.illegal.bad-tag-name +## ^ punctuation.definition.tag.end + - - - - - +## ^^^^ punctuation.definition.comment.begin +## ^ - punctuation.definition.comment.begin +## ^^^^^^^^^^^^^^^^^^^ comment.block +## ^^^ punctuation.definition.comment.end +## ^ - comment.block - - - - - - +## ^^^^ punctuation.definition.comment.begin +## ^ - punctuation.definition.comment.begin +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block - meta.tag - constant.character.entity +## ^^^ punctuation.definition.comment.end +## ^ - comment.block +## ^^^^ - punctuation.definition - - - - - +## ^^^^ punctuation.definition.comment.begin +## ^ - punctuation.definition.comment.begin +## ^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block - string.unquoted.cdata +## ^^^ punctuation.definition.comment.end +## ^ - comment.block - - - - +## <- comment.block +## ^^^^^^^^^^^^^^^^ comment.block +## ^^^ punctuation.definition.comment.end +## ^ - comment.block + + , so should end here: --> +## ^^ comment.block invalid.illegal.double-hyphen-within-comment +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block - invalid +## ^^^ comment.block invalid.illegal.double-hyphen-within-comment +## ^^^ comment.block punctuation.definition.comment.end +## ^ - comment + + - - - - - - - - - - - - - - +## ^ meta.tag invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag +## ^ - meta.tag +## ^ punctuation.definition.tag.begin +## ^^ entity.name.tag.namespace +## ^ punctuation.separator.namespace +## ^^^^^^^ entity.name.tag.localname +## ^ - entity +## ^^^^^ entity.other.attribute-name.namespace +## ^ punctuation.separator.namespace +## ^^ entity.other.attribute-name.localname +## ^ punctuation.separator.key-value +## ^ punctuation.definition.string.begin +## ^^^^^ string.quoted +## ^ punctuation.definition.string.end +## ^ punctuation.definition.tag.end + + +## ^ punctuation.definition.tag.end +## ^ - meta.tag + + > +## ^ - meta.tag +## ^^^^^^^^^^^^ meta.tag +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.tag +## ^ punctuation.definition.tag.begin +## ^^ entity.name.tag.namespace +## ^ punctuation.separator.namespace +## ^^^^^^^ entity.name.tag.localname +## ^ invalid.illegal.missing-tag-end - entity +## ^^^^ punctuation.definition.comment.begin +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block +## ^^^ punctuation.definition.comment.end +## ^ - punctuation.definition.tag.end + + > +## ^ - meta.tag +## ^^^^^ meta.tag +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.tag +## ^ punctuation.definition.tag.begin +## ^^^ entity.name.tag.localname +## ^ invalid.illegal.missing-tag-end +## ^^^^ punctuation.definition.comment.begin +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block +## ^^^ punctuation.definition.comment.end +## ^ - punctuation.definition.tag.end + + bar="baz" /> +## ^ - meta.tag +## ^^^^^^^^^ meta.tag +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.tag +## ^ punctuation.definition.tag.begin +## ^^^ entity.name.tag.localname +## ^^^ entity.other.attribute-name.localname +## ^ invalid.illegal.missing-tag-end +## ^^^^ punctuation.definition.comment.begin +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block +## ^^^ punctuation.definition.comment.end +## ^^^ - entity.other.attribute-name.localname +## ^ - punctuation.separator.key-value +## ^^^^^ - string.quoted.double +## ^^ - punctuation.definition.tag.end + + bar="baz" /> +## ^ - meta.tag +## ^^^^^^^^^^ meta.tag +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.tag +## ^ punctuation.definition.tag.begin +## ^^^ entity.name.tag.localname +## ^^^ entity.other.attribute-name.localname +## ^ punctuation.separator.key-value +## ^ invalid.illegal.missing-tag-end +## ^^^^ punctuation.definition.comment.begin +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block +## ^^^ punctuation.definition.comment.end +## ^^^ - entity.other.attribute-name.localname +## ^ - punctuation.separator.key-value +## ^^^^^ - string.quoted.double +## ^^ - punctuation.definition.tag.end + + +## ^ - meta.tag +## ^^^^^^^^^^^^^^ meta.tag +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.tag +## ^ punctuation.definition.tag.begin +## ^^^ entity.name.tag.localname +## ^^^ entity.other.attribute-name.localname +## ^ punctuation.separator.key-value +## ^^^^^ string.quoted.double +## ^ invalid.illegal.missing-tag-end +## ^^^^ punctuation.definition.comment.begin +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block +## ^^^ punctuation.definition.comment.end +## ^^^ - entity.other.attribute-name.localname +## ^ - punctuation.separator.key-value +## ^^^^^ - string.quoted.double +## ^^ - punctuation.definition.tag.end + + bar="baz" /> +## ^ - meta.tag +## ^^^^^^^^^^^^^^^ meta.tag +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.tag +## ^ punctuation.definition.tag.begin +## ^^^ entity.name.tag.localname +## ^^^ entity.other.attribute-name.localname +## ^ punctuation.separator.key-value +## ^^^^^ string.quoted.double +## ^ invalid.illegal.missing-tag-end +## ^^^^ punctuation.definition.comment.begin +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block +## ^^^ punctuation.definition.comment.end +## ^^^ - entity.other.attribute-name.localname +## ^ - punctuation.separator.key-value +## ^^^^^ - string.quoted.double +## ^^ - punctuation.definition.tag.end + + +## ^ invalid.illegal.missing-tag-end +## ^^^^ punctuation.definition.comment.begin +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block +## ^^^ punctuation.definition.comment.end + bar="baz" +## ^^^^^^^^^ text +## ^^^ - entity.other.attribute-name.localname +## ^ - punctuation.separator.key-value +## ^^^^^ - string.quoted.double + /> +## ^^ text - punctuation.definition.tag.end + + +## ^ invalid.illegal.missing-tag-end +## ^^^^ punctuation.definition.comment.begin +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block +## ^^^ punctuation.definition.comment.end + bar="baz" +## ^^^^^^^^^ text +## ^^^ - entity.other.attribute-name.localname +## ^ - punctuation.separator.key-value +## ^^^^^ - string.quoted.double + /> +## ^^ text - punctuation.definition.tag.end + + +## ^ invalid.illegal.missing-tag-end +## ^^^^ punctuation.definition.comment.begin +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block +## ^^^ punctuation.definition.comment.end + bar="baz" +## ^^^^^^^^^ text +## ^^^ - entity.other.attribute-name.localname +## ^ - punctuation.separator.key-value +## ^^^^^ - string.quoted.double + /> +## ^^ text - punctuation.definition.tag.end + text - +## ^^^^ text > - +## ^ text - punctuation - illegal ]]> - - +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.sgml.cdata +## ^^^ punctuation.definition.tag.begin +## ^^^^^ keyword.declaration.cdata +## ^ punctuation.definition.tag.begin +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.unquoted.cdata +## ^ - string.unquoted.cdata +## ^^^ punctuation.definition.tag.end + +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.unquoted.cdata + ]]> +## ^ - string.unquoted.cdata +## ^^^ punctuation.definition.tag.end + + +## ^^^^^^^^^^^^^^^^^^^^ string.unquoted.cdata +## ^^^ - punctuation.definition.tag.begin +## ^^^^^ - keyword.declaration.cdata +## ^ - punctuation.definition.tag.begin +## ^^^ punctuation.definition.tag.end + ]]> +## ^^^ - punctuation - invalid.illegal.missing-entity.xml ?> - - - - - +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.preprocessor +## ^^ punctuation.definition.tag.begin +## ^^ entity.name.tag +## ^^ punctuation.definition.tag.end +## ^ - meta.tag.preprocessor <таĝñäᴹə ατţř="șƬűʃ⨍" >Contents - - - - - - - - - - - - - - - +## ^^^^^^^^^^^^^^^^^^^^^^^ meta.tag +## ^ punctuation.definition.tag.begin +## ^^^^^^^ entity.name.tag.localname +## ^ - entity.name.tag.localname +## ^^^^ entity.other.attribute-name.localname +## ^ punctuation.separator.key-value - entity.other.attribute-name.localname +## ^^^^^^^ string.quoted +## ^ - string.quoted - punctuation.definition +## ^ punctuation.definition.tag.end +## ^^^^^^^^ text - meta.tag +## ^^ punctuation.definition.tag.begin +## ^^^^^^^^^^ meta.tag +## ^^^^^^^ entity.name.tag.localname +## ^ punctuation.definition.tag.end +## ^ - meta.tag - - - - - - - - - - - - +## ^ punctuation.definition.tag.begin +## ^^ punctuation.definition.tag.end - string +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag +## ^ - meta.tag +## ^^ entity.other.attribute-name.namespace +## ^ entity.other.attribute-name punctuation.separator.namespace +## ^^^^ entity.other.attribute-name.localname +## ^ punctuation.separator.key-value +## ^^^^^^^^ string.quoted.single +## ^ punctuation.definition.string.begin +## ^ punctuation.definition.string.end +## ^^^^^ constant.character.entity + + - - - - - - - +## ^ meta.tag invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^ meta.tag +## ^ - meta.tag +## ^^ punctuation.definition.tag.begin +## ^^ entity.name.tag.namespace +## ^ punctuation.separator.namespace +## ^^^^^^^ entity.name.tag.localname +## ^ punctuation.definition.tag.end + + +## ^ - meta.tag - invalid.illegal.missing-tag-end +## ^^^^^^^^^^^^^^ meta.tag +## ^^ punctuation.definition.tag.begin +## ^^ entity.name.tag.namespace +## ^ punctuation.separator.namespace +## ^^^^^^^ entity.name.tag.localname +## ^^ invalid.illegal.bad-tag-end + + +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag +## ^ - meta.tag +## ^^ punctuation.definition.tag.begin +## ^^ entity.name.tag.namespace +## ^ punctuation.separator.namespace +## ^^^^^^^ entity.name.tag.localname +## ^^^^^^^^^^^^ invalid.illegal.unexpected-attribute +## ^^ invalid.illegal.bad-tag-end + + +## ^^ meta.tag invalid.illegal.bad-tag-end - - - - +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag +## ^ - meta.tag +## ^ punctuation.definition.tag.begin +## ^^^^^^^ entity.name.tag.localname +## ^^^^^^^^^^^^^^^ entity.other.attribute-name.localname +## ^ punctuation.separator.key-value +## ^ punctuation.definition.string.begin +## ^^^^^^^ string.quoted.double +## ^ punctuation.definition.string.end +## ^^ punctuation.definition.tag.end - +## ^^^^^^^^^^^ string.quoted - punctuation - illegal + + +##^^^^^^^^^^ meta.tag +## ^ - meta.tag +##^ entity.other.attribute-name.localname +## ^^^^^ string.quoted.double +## ^ - string.quoted.double + + +##^^^^^^^^^^^^^^^^^^ meta.tag +## ^ - meta.tag +## ^^^ entity.other.attribute-name.localname +## ^^^^^ string.quoted.double +## ^ - string.quoted.double +## ^^ punctuation.definition.tag.end - - - - + +##^^^^^^ meta.tag +## ^^ punctuation.definition.tag.end +## ^ - meta.tag - - - - - - - +## ^^^^^^^^^^^^^^ meta.tag +## ^ - meta.tag +## ^ punctuation.definition.tag.begin +## ^^ entity.name.tag.namespace +## ^ punctuation.separator.namespace +## ^^^^^^^^ entity.name.tag.localname +## ^^ punctuation.definition.tag.end + +## ^^ meta.tag punctuation.definition.tag.end +## ^ - meta.tag & - - - - - +## ^ punctuation.definition.entity +## ^^^ - punctuation.definition.entity +## ^^^^^ constant.character.entity +## ^ punctuation.terminator.entity +## ^ - constant.character.entity - punctuation.definition.entity + + &ut-d-att_da; +## ^ punctuation.definition.entity +## ^^^ - punctuation.definition.entity +## ^^^^^^^^^^^^^ constant.character.entity +## ^ punctuation.terminator.entity +## ^ - constant.character.entity - punctuation.definition.entity   - - - - - +## ^ punctuation.definition.entity +## ^^^ - punctuation.definition.entity +## ^^^^^^ constant.character.entity +## ^ punctuation.terminator.entity +## ^ - constant.character.entity + + © +## ^ punctuation.definition.entity +## ^^ - punctuation.definition.entity +## ^^^^^^ constant.character.entity +## ^ punctuation.terminator.entity +## ^ - constant.character.entity + + %no-parameter; +## ^^^^^^^^^^^^^^ - variable.parameter - +## ^ - punctuation.definition.entity - - - - +## ^^^^^^^^^^^^^^^^^^ string.quoted.double +## ^ - string.quoted.double +## ^^^^^^ constant.character.entity +## ^^^^^^ constant.character.entity & - - +## ^ invalid.illegal.bad-ampersand +## ^ - invalid.illegal.bad-ampersand <1tag> - - - - - - - +## ^^^^ invalid.illegal - entity.name.tag +## ^^^^ invalid.illegal - entity.name.tag +## ^ punctuation.definition.tag.end +## ^ punctuation.definition.tag.begin +## ^ punctuation.definition.tag.end +## ^^^^^^^^^^^^^ meta.tag +## ^ - meta.tag <1tag attr1="ok" 2attr="nope"> - - - - - - - - - - - - - - +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag +## ^ punctuation.definition.tag.begin +## ^^^^ invalid.illegal - entity.name.tag +## ^^^^^^^^^^^^ - invalid.illegal - entity.name.tag +## ^^^^^ entity.other.attribute-name.localname +## ^ punctuation.separator.key-value +## ^^^^ string.quoted +## ^^^^^ invalid.illegal - entity.other.attribute-name.localname +## ^^^^^ string.quoted +## ^ punctuation.definition.tag.end +## ^^ punctuation.definition.tag.begin +## ^^^^ invalid.illegal - entity.name.tag +## ^ punctuation.definition.tag.end +## ^ - meta.tag < - - +## ^ invalid.illegal.missing-entity +## ^ - invalid.illegal.missing-entity ]]> - - - - - - - - - - - - - - - - - - - - +## ^^^ - punctuation - invalid.illegal.missing-entity - , so should end here: --> - - - - - + +## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag +## ^ punctuation.definition.tag.begin +## ^^ entity.name.tag.namespace +## ^ punctuation.separator.namespace +## ^^^^ invalid.illegal.bad-tag-name - entity.name.tag +## ^^ entity.other.attribute-name.namespace +## ^ entity.other.attribute-name.xml punctuation.separator.namespace.xml +## ^^^^^^ invalid.illegal.bad-attribute-name - entity.other.attribute-name +## ^ punctuation.separator.key-value +## ^^^^ string.quoted +## ^^ entity.other.attribute-name.namespace +## ^ entity.other.attribute-name.xml punctuation.separator.namespace.xml +## ^^^^^ invalid.illegal.bad-attribute-name - entity.other.attribute-name +## ^ punctuation.separator.key-value +## ^^^^^^ string.quoted +## ^ punctuation.definition.tag.end +## ^^ punctuation.definition.tag.begin +## ^^ entity.name.tag.namespace +## ^ punctuation.separator.namespace.xml +## ^^^^ invalid.illegal.bad-tag-name - entity.name.tag +## ^ punctuation.definition.tag.end +## ^ - meta.tag + + <-ns:tag -ns:attr="value">content +## ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag +## ^^^^^^^^^^^^^^^^^^^^^^^^ - meta.tag +## ^^^^^^^^^^ meta.tag +## ^ - meta.tag +## ^ punctuation.definition.tag.begin - illegal +## ^^^ invalid.illegal.bad-tag-name +## ^ punctuation.separator.namespace - illegal +## ^^^ entity.name.tag.localname - illegal +## ^ - entity - illegal +## ^^^ invalid.illegal.bad-attribute-name +## ^ entity.other.attribute-name punctuation.separator.namespace +## ^^^^ entity.other.attribute-name.localname +## ^ punctuation.definition.tag.end +## ^^ punctuation.definition.tag.begin - illegal +## ^^^ invalid.illegal.bad-tag-name +## ^ punctuation.separator.namespace - illegal +## ^^^ entity.name.tag.localname - illegal +## ^ punctuation.definition.tag.end + + <1ns:tag 1ns:attr="value">content +## ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag +## ^^^^^^^^^^^^^^^^^^^^^^^^ - meta.tag +## ^^^^^^^^^^ meta.tag +## ^ - meta.tag +## ^ punctuation.definition.tag.begin - illegal +## ^^^ invalid.illegal.bad-tag-name +## ^ punctuation.separator.namespace - illegal +## ^^^ entity.name.tag.localname - illegal +## ^ - entity - illegal +## ^^^ invalid.illegal.bad-attribute-name +## ^ entity.other.attribute-name punctuation.separator.namespace +## ^^^^ entity.other.attribute-name.localname +## ^ punctuation.definition.tag.end +## ^^ punctuation.definition.tag.begin - illegal +## ^^^ invalid.illegal.bad-tag-name +## ^ punctuation.separator.namespace - illegal +## ^^^ entity.name.tag.localname - illegal +## ^ punctuation.definition.tag.end + + content +## ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag +## ^^^^^^^^^^^^^^^^^^^^^^^^ - meta.tag +## ^^^^^^^^^^ meta.tag +## ^ - meta.tag +## ^ punctuation.definition.tag.begin - illegal +## ^^^ invalid.illegal.bad-tag-name +## ^ punctuation.separator.namespace - illegal +## ^^^ entity.name.tag.localname - illegal +## ^ - entity - illegal +## ^^^ invalid.illegal.bad-attribute-name +## ^ entity.other.attribute-name punctuation.separator.namespace +## ^^^^ entity.other.attribute-name.localname +## ^ punctuation.definition.tag.end +## ^^ punctuation.definition.tag.begin - illegal +## ^^^ invalid.illegal.bad-tag-name +## ^ punctuation.separator.namespace - illegal +## ^^^ entity.name.tag.localname - illegal +## ^ punctuation.definition.tag.end + + content +## ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag +## ^^^^^^^^^^^^^^^^^^^^^^^^ - meta.tag +## ^^^^^^^^^^ meta.tag +## ^ - meta.tag +## ^ punctuation.definition.tag.begin - illegal +## ^^^ invalid.illegal.bad-tag-name +## ^ punctuation.separator.namespace - illegal +## ^^^ entity.name.tag.localname - illegal +## ^ - entity - illegal +## ^^^ invalid.illegal.bad-attribute-name +## ^ entity.other.attribute-name punctuation.separator.namespace +## ^^^^ entity.other.attribute-name.localname +## ^ punctuation.definition.tag.end +## ^^ punctuation.definition.tag.begin - illegal +## ^^^ invalid.illegal.bad-tag-name +## ^ punctuation.separator.namespace - illegal +## ^^^ entity.name.tag.localname - illegal +## ^ punctuation.definition.tag.end diff --git a/YAML/YAML.sublime-syntax b/YAML/YAML.sublime-syntax index 9f0197ac6a..b9db2c1907 100644 --- a/YAML/YAML.sublime-syntax +++ b/YAML/YAML.sublime-syntax @@ -73,7 +73,7 @@ variables: ns_anchor_name: '{{ns_anchor_char}}+' # double-quoted scalar - c_ns_esc_char: \\([0abtnvfre "/\\N_Lp]|x\d\d|u\d{4}|U\d{8}) + c_ns_esc_char: \\(?:[0abtnvfre "/\\N_Lp]|x[\dA-Fa-f]{2}|u[\dA-Fa-f]{4}|U[\dA-Fa-f]{8}) # plain scalar begin and end patterns ns_plain_first_plain_in: |- # c=plain-in @@ -119,34 +119,35 @@ variables: ) _type_int: |- # http://yaml.org/type/int.html (?x: - [-+]? 0b [0-1_]+ # (base 2) - | [-+]? 0 [0-7_]+ # (base 8) - | [-+]? (?: 0|[1-9][0-9_]*) # (base 10) - | [-+]? 0x [0-9a-fA-F_]+ # (base 16) - | [-+]? [1-9] [0-9_]* (?: :[0-5]?[0-9])+ # (base 60) + ([-+]? (0b) [0-1_]+) # (base 2) + | ([-+]? (0) [0-7_]+) # (base 8) + | ([-+]? (?: 0|[1-9][0-9_]*)) # (base 10) + | ([-+]? (0x) [0-9a-fA-F_]+) # (base 16) + | ([-+]? [1-9] [0-9_]* (?: :[0-5]?[0-9])+) # (base 60) ) _type_float: |- # http://yaml.org/type/float.html (?x: - [-+]? (?: [0-9] [0-9_]*)? \. [0-9.]* (?: [eE] [-+] [0-9]+)? # (base 10) - | [-+]? [0-9] [0-9_]* (?: :[0-5]?[0-9])+ \. [0-9_]* # (base 60) - | [-+]? \. (?: inf|Inf|INF) # (infinity) - | \. (?: nan|NaN|NAN) # (not a number) + ([-+]? (?: [0-9] [0-9_]*)? (\.) [0-9.]* (?: [eE] [-+] [0-9]+)?) # (base 10) + | ([-+]? [0-9] [0-9_]* (?: :[0-5]?[0-9])+ (\.) [0-9_]*) # (base 60) + | ([-+]? (\.) (?: inf|Inf|INF)) # (infinity) + | ( (\.) (?: nan|NaN|NAN)) # (not a number) ) _type_timestamp: |- # http://yaml.org/type/timestamp.html (?x: - \d{4} - \d{2} - \d{2} # (y-m-d) + \d{4} (-) \d{2} (-) \d{2} # (y-m-d) | \d{4} # (year) - - \d{1,2} # (month) - - \d{1,2} # (day) + (-) \d{1,2} # (month) + (-) \d{1,2} # (day) (?: [Tt] | [ \t]+) \d{1,2} # (hour) - : \d{2} # (minute) - : \d{2} # (second) - (?: \.\d*)? # (fraction) + (:) \d{2} # (minute) + (:) \d{2} # (second) + (?: (\.)\d*)? # (fraction) + [ \t]* (?: - (?:[ \t]*) Z - | [-+] \d{1,2} (?: :\d{1,2})? + Z | [-+] \d{1,2} (?: (:)\d{1,2})? )? # (time zone) ) + _type_value: '=' # http://yaml.org/type/value.html _type_merge: '<<' # http://yaml.org/type/merge.html @@ -331,11 +332,44 @@ contexts: captures: # &implicit_type_captures 1: constant.language.null.yaml 2: constant.language.boolean.yaml - 3: constant.numeric.integer.yaml - 4: constant.numeric.float.yaml - 5: constant.other.timestamp.yaml - 6: constant.language.value.yaml - 7: constant.language.merge.yaml + # binary integer + 4: constant.numeric.integer.binary.yaml + 5: punctuation.definition.numeric.base.yaml + # octal integer + 6: constant.numeric.integer.octal.yaml + 7: punctuation.definition.numeric.base.yaml + # decimal integer + 8: constant.numeric.integer.decimal.yaml + # hexadecimal integer + 9: constant.numeric.integer.hexadecimal.yaml + 10: punctuation.definition.numeric.base.yaml + # other integer + 11: constant.numeric.integer.other.yaml + # decimal float + 13: constant.numeric.float.decimal.yaml + 14: punctuation.separator.decimal.yaml + # other float + 15: constant.numeric.float.other.yaml + 16: punctuation.separator.decimal.yaml + # infinity float + 17: constant.numeric.float.other.yaml + 18: punctuation.separator.decimal.yaml + # not a number + 19: constant.numeric.float.other.yaml + 20: punctuation.separator.decimal.yaml + # timestamp + 21: constant.other.timestamp.yaml + 22: punctuation.separator.date.yaml + 23: punctuation.separator.date.yaml + 24: punctuation.separator.date.yaml + 25: punctuation.separator.date.yaml + 26: punctuation.separator.time.yaml + 27: punctuation.separator.time.yaml + 28: punctuation.separator.time.yaml + 29: punctuation.separator.time.yaml + # constants + 30: constant.language.value.yaml + 31: constant.language.merge.yaml flow-scalar-plain-out-implicit-type: - match: | @@ -346,11 +380,44 @@ contexts: # Alias does not work, see https://github.com/SublimeTextIssues/Core/issues/967 1: constant.language.null.yaml 2: constant.language.boolean.yaml - 3: constant.numeric.integer.yaml - 4: constant.numeric.float.yaml - 5: constant.other.timestamp.yaml - 6: constant.language.value.yaml - 7: constant.language.merge.yaml + # binary integer + 4: constant.numeric.integer.binary.yaml + 5: punctuation.definition.numeric.base.yaml + # octal integer + 6: constant.numeric.integer.octal.yaml + 7: punctuation.definition.numeric.base.yaml + # decimal integer + 8: constant.numeric.integer.decimal.yaml + # hexadecimal integer + 9: constant.numeric.integer.hexadecimal.yaml + 10: punctuation.definition.numeric.base.yaml + # other integer + 11: constant.numeric.integer.other.yaml + # decimal float + 13: constant.numeric.float.decimal.yaml + 14: punctuation.separator.decimal.yaml + # other float + 15: constant.numeric.float.other.yaml + 16: punctuation.separator.decimal.yaml + # infinity float + 17: constant.numeric.float.other.yaml + 18: punctuation.separator.decimal.yaml + # not a number + 19: constant.numeric.float.other.yaml + 20: punctuation.separator.decimal.yaml + # timestamp + 21: constant.other.timestamp.yaml + 22: punctuation.separator.date.yaml + 23: punctuation.separator.date.yaml + 24: punctuation.separator.date.yaml + 25: punctuation.separator.date.yaml + 26: punctuation.separator.time.yaml + 27: punctuation.separator.time.yaml + 28: punctuation.separator.time.yaml + 29: punctuation.separator.time.yaml + # constants + 30: constant.language.value.yaml + 31: constant.language.merge.yaml flow-scalar-plain-out: # http://yaml.org/spec/1.2/spec.html#style/flow/plain @@ -459,7 +526,7 @@ contexts: captures: 1: keyword.control.flow.block-scalar.literal.yaml 2: keyword.control.flow.block-scalar.folded.yaml - 3: constant.numeric.indentation-indicator.yaml + 3: constant.numeric.integer.decimal.indentation-indicator.yaml 4: storage.modifier.chomping-indicator.yaml push: - meta_include_prototype: false diff --git a/YAML/tests/syntax_test_block.yaml b/YAML/tests/syntax_test_block.yaml index 8d3a3ead83..910f49cb3c 100644 --- a/YAML/tests/syntax_test_block.yaml +++ b/YAML/tests/syntax_test_block.yaml @@ -18,11 +18,11 @@ - >1 # ^ keyword.control.flow.block-scalar -# ^ constant.numeric.indentation-indicator +# ^ constant.numeric.integer.decimal.indentation-indicator - |1- # ^ keyword.control.flow.block-scalar -# ^ constant.numeric.indentation-indicator +# ^ constant.numeric.integer.decimal.indentation-indicator # ^ storage.modifier.chomping-indicator # Headers and content ################ diff --git a/YAML/tests/syntax_test_flow.yaml b/YAML/tests/syntax_test_flow.yaml index 4879b7b354..7cf372544f 100644 --- a/YAML/tests/syntax_test_flow.yaml +++ b/YAML/tests/syntax_test_flow.yaml @@ -32,7 +32,7 @@ #^^^^^^^^^^^^ string.quoted.double # ^ punctuation.definition.string.end -"\" \0 \\ \x12 \u1234 \U12345678" +"\" \0 \\ \x1b \u12c4 \U1234F678" #^^ constant.character.escape # ^^ constant.character.escape # ^^ constant.character.escape diff --git a/YAML/tests/syntax_test_types.yaml b/YAML/tests/syntax_test_types.yaml index 3ee56762a1..814c506633 100644 --- a/YAML/tests/syntax_test_types.yaml +++ b/YAML/tests/syntax_test_types.yaml @@ -38,34 +38,43 @@ ## http://yaml.org/type/int.html - [0b0, +0b1_0_1, -0b1, ~, 0b, 0b2, 0b1 abc -# ^^^ constant.numeric.integer -# ^^^^^^^^ constant.numeric.integer -# ^^^^ constant.numeric.integer +# ^^^ constant.numeric.integer.binary +# ^^ punctuation.definition.numeric.base +# ^^^^^^^^ constant.numeric.integer.binary +# ^^ punctuation.definition.numeric.base +# ^^^^ constant.numeric.integer.binary +# ^^ punctuation.definition.numeric.base # ^^^^^^^^^^^^^^^^ -constant 01, +0_761, -07, ~, 09, 0123 f -# ^^ constant.numeric.integer -# ^^^^^^ constant.numeric.integer -# ^^^ constant.numeric.integer +# ^^ constant.numeric.integer.octal +# ^ punctuation.definition.numeric.base +# ^^^^^^ constant.numeric.integer.octal +# ^ punctuation.definition.numeric.base +# ^^^ constant.numeric.integer.octal +# ^ punctuation.definition.numeric.base # ^^^^^^^^^^ -constant 0, +1, -12_345, ~, 3 not a number -# ^ constant.numeric.integer -# ^^ constant.numeric.integer -# ^^^^^^^ constant.numeric.integer +# ^ constant.numeric.integer.decimal +# ^^ constant.numeric.integer.decimal +# ^^^^^^^ constant.numeric.integer.decimal # ^^^^^^^^^^^^^^ -constant 0x0, +0x12_34_56, -0xabcdef, ~, 0xyz, 0x, -# ^^^ constant.numeric.integer -# ^^^^^^^^^^^ constant.numeric.integer -# ^^^^^^^^^ constant.numeric.integer +# ^^^ constant.numeric.integer.hexadecimal +# ^^ punctuation.definition.numeric.base +# ^^^^^^^^^^^ constant.numeric.integer.hexadecimal +# ^^ punctuation.definition.numeric.base +# ^^^^^^^^^ constant.numeric.integer.hexadecimal +# ^^ punctuation.definition.numeric.base # ^^^^^^^^ -constant # Note: pyyaml does not handle hexagesimal literals correctly (for linting purposes) 1:20, +1:9, -1_234:59:00, ~, 1:60, :60, 1:2 s -# ^^^^ constant.numeric.integer -# ^^^^ constant.numeric.integer -# ^^^^^^^^^^^^ constant.numeric.integer +# ^^^^ constant.numeric.integer.other +# ^^^^ constant.numeric.integer.other +# ^^^^^^^^^^^^ constant.numeric.integer.other # ^^^^^^^^^^^^^^^^ -constant ] @@ -74,18 +83,26 @@ ## http://yaml.org/type/float.html - [0.1, +.293, -1_123.e-3, 2.234.567, ~, 0.1 f -# ^^^ constant.numeric.float -# ^^^^^ constant.numeric.float -# ^^^^^^^^^^ constant.numeric.float -# ^^^^^^^^^ constant.numeric.float +# ^^^ constant.numeric.float.decimal +# ^ punctuation.separator.decimal +# ^^^^^ constant.numeric.float.decimal +# ^ punctuation.separator.decimal +# ^^^^^^^^^^ constant.numeric.float.decimal +# ^ punctuation.separator.decimal +# ^^^^^^^^^ constant.numeric.float.decimal +# ^ punctuation.separator.decimal # ^^^^^ -constant .inf, +.INF, -.Inf, ~, .inF, .inf .inf -# ^^^^ constant.numeric.float -# ^^^^^ constant.numeric.float -# ^^^^^ constant.numeric.float +# ^^^^ constant.numeric.float.other +# ^ punctuation.separator.decimal +# ^^^^^ constant.numeric.float.other +# ^ punctuation.separator.decimal +# ^^^^^ constant.numeric.float.other +# ^ punctuation.separator.decimal # ^^^^^^^^^^^^^^^ -constant .NaN, ~, .Nan, -# ^^^^ constant.numeric.float +# ^^^^ constant.numeric.float.other +# ^ punctuation.separator.decimal # ^^^^ -constant ] @@ -93,11 +110,35 @@ ############################################################################## ## http://yaml.org/type/timestamp.html -- [2015-08-15, 2015-08-15 1:20:30.123, 2015-08-15T12:20:30.123-9:00, 2015-08-15 1:20:30.123 Z] -# ^^^^^^^^^^ constant.other.timestamp -# ^^^^^^^^^^^^^^^^^^^^^^ constant.other.timestamp -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant.other.timestamp +- [2015-08-15, 2015-08-15 1:20:30.123, 2015-08-15T12:20:30.123-9:00, 2015-08-15 1:20:30.123 Z, 2001-12-14 21:59:43.10 -5] +# ^^^^^^^^^^ constant.other.timestamp +# ^ punctuation.separator.date +# ^ punctuation.separator.date +# ^^^^^^^^^^^^^^^^^^^^^^ constant.other.timestamp +# ^ punctuation.separator.date +# ^ punctuation.separator.date +# ^ punctuation.separator.time +# ^ punctuation.separator.time +# ^ punctuation.separator.time +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant.other.timestamp +# ^ punctuation.separator.date +# ^ punctuation.separator.date +# ^ punctuation.separator.time +# ^ punctuation.separator.time +# ^ punctuation.separator.time +# ^ punctuation.separator.time # ^^^^^^^^^^^^^^^^^^^^^^^^ constant.other.timestamp +# ^ punctuation.separator.date +# ^ punctuation.separator.date +# ^ punctuation.separator.time +# ^ punctuation.separator.time +# ^ punctuation.separator.time +# ^^^^^^^^^^^^^^^^^^^^^^^^^ constant.other.timestamp +# ^ punctuation.separator.date +# ^ punctuation.separator.date +# ^ punctuation.separator.time +# ^ punctuation.separator.time +# ^ punctuation.separator.time ############################################################################## @@ -113,14 +154,20 @@ true: false #^^^ constant.language.boolean -# ^ punctuation +# ^ punctuation.separator.key-value.mapping # ^^^^^ constant.language.boolean 3.e-3: 3.e+3 -#^^^^ constant.numeric.float -# ^ punctuation -# ^^^^^ constant.numeric.float +#^^^^ constant.numeric.float.decimal +#^ punctuation.separator.decimal +# ^ punctuation.separator.key-value.mapping +# ^^^^^ constant.numeric.float.decimal {.NaN: 2, 2: 2015-08-15} -#^^^^ constant.numeric.float -# ^ constant.numeric.integer -# ^ constant.numeric.integer +#^^^^ constant.numeric.float.other +# ^ punctuation.separator.key-value.mapping +# ^ constant.numeric.integer.decimal +# ^ punctuation.separator.mapping +# ^ constant.numeric.integer.decimal +# ^ punctuation.separator.key-value.mapping # ^^^^^^^^^^ constant.other.timestamp +# ^ punctuation.separator.date +# ^ punctuation.separator.date