diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ca3c44789f..aab5a4e982 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,9 +5,23 @@ on: - '*' tags-ignore: - '*' + paths: + - '**/syntax_test_*' + - '**/*.hidden-tmLanguage' + - '**/*.sublime-syntax' + - '**/*.tmLanguage' + - '**/*.tmPreferences' + - '.github/workflows/ci.yml' pull_request: branches: - '*' + paths: + - '**/syntax_test_*' + - '**/*.hidden-tmLanguage' + - '**/*.sublime-syntax' + - '**/*.tmLanguage' + - '**/*.tmPreferences' + - '.github/workflows/ci.yml' jobs: build: @@ -17,7 +31,7 @@ jobs: - uses: actions/checkout@master - name: Download syntax_tests - run: wget -O st_syntax_tests.tar.xz https://download.sublimetext.com/st_syntax_tests_build_4090_x64.tar.xz + run: wget -O st_syntax_tests.tar.xz https://download.sublimetext.com/st_syntax_tests_build_4112_x64.tar.xz - name: Extract syntax_tests run: tar xf st_syntax_tests.tar.xz diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..e43b0f9889 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.DS_Store diff --git a/ASP/ASP.sublime-syntax b/ASP/ASP.sublime-syntax index fcca419707..8cbc15833e 100644 --- a/ASP/ASP.sublime-syntax +++ b/ASP/ASP.sublime-syntax @@ -3,7 +3,7 @@ # http://www.sublimetext.com/docs/3/syntax.html name: ASP file_extensions: - - asa # asp is handled by HTML-ASP.sublime-syntax + - vbs # Visual Basic Script scope: source.asp variables: apostrophe_comment_begin: "'" diff --git a/ASP/HTML (ASP).sublime-syntax b/ASP/HTML (ASP).sublime-syntax index 74b28af12b..01651ae7c2 100644 --- a/ASP/HTML (ASP).sublime-syntax +++ b/ASP/HTML (ASP).sublime-syntax @@ -9,6 +9,7 @@ extends: Packages/HTML/HTML.sublime-syntax file_extensions: - asp + - asa contexts: diff --git a/AppleScript/AppleScript.sublime-syntax b/AppleScript/AppleScript.sublime-syntax index d39aa257b9..c2cb342985 100644 --- a/AppleScript/AppleScript.sublime-syntax +++ b/AppleScript/AppleScript.sublime-syntax @@ -518,7 +518,7 @@ contexts: - match: \b(?i:seconds|minutes|hours|days)\b scope: support.class.built-in.time.applescript comments: - - match: ^\s*(#!).*$\n? + - match: ^\s*(#).*$\n? scope: comment.line.number-sign.applescript captures: 1: punctuation.definition.comment.applescript diff --git a/AppleScript/Comments.tmPreferences b/AppleScript/Comments.tmPreferences index e96b286fbe..eb673b62cd 100644 --- a/AppleScript/Comments.tmPreferences +++ b/AppleScript/Comments.tmPreferences @@ -19,7 +19,7 @@ name TM_COMMENT_START_2 value - #! + # name diff --git a/C#/C#.sublime-syntax b/C#/C#.sublime-syntax index 58036c34c9..0a87f739c7 100644 --- a/C#/C#.sublime-syntax +++ b/C#/C#.sublime-syntax @@ -56,7 +56,7 @@ contexts: comments: - match: '^\s*(///)' captures: - 1: comment.block.documentation.cs punctuation.definition.comment.documentation.cs + 1: comment.line.documentation.cs punctuation.definition.comment.documentation.cs push: documentation - match: '//' scope: punctuation.definition.comment.cs @@ -279,11 +279,16 @@ contexts: scope: storage.modifier.cs - match: '{{visibility}}' scope: storage.modifier.access.cs - - match: \b(class|record)\s+({{name}}) + - match: \b(class)\s+({{name}}) captures: 1: storage.type.class.cs 2: entity.name.class.cs push: [class_signature, data_type_signature] + - match: \b(record)\s+({{name}}) + captures: + 1: storage.type.class.record.cs + 2: entity.name.class.cs + push: [record_signature, data_type_signature] - match: '(?:\b(readonly)\s+)?(?:\b(ref)\s+)?\b(struct)\s+({{name}})' captures: 1: storage.modifier.cs @@ -396,6 +401,11 @@ contexts: - match: '' set: [class_body, data_type_body] + record_signature: + - meta_scope: meta.class.record.cs + - match: '' + set: [class_body, record_type_body] + interface_signature: - meta_scope: meta.interface.cs - match: '' @@ -434,6 +444,27 @@ contexts: scope: invalid.illegal pop: true + record_type_body: + - match: \{ + scope: punctuation.section.block.begin.cs + set: + - meta_scope: meta.block.cs + - match: \} + scope: punctuation.section.block.end.cs + pop: true + - include: attribute + - include: class_declaration + - include: interface_declaration + - include: delegate_declaration + - include: method_declaration + - include: stray_close_bracket + - match: \( + scope: punctuation.section.group.begin.cs + set: [data_type_signature, method_params] + - match: ';' + scope: punctuation.terminator.cs + pop: true + data_type_signature: - match: '<' scope: meta.generic.cs punctuation.definition.generic.begin.cs @@ -445,7 +476,7 @@ contexts: set: type_constraint - match: (?=where\b) set: type_constraint - - match: (?=\{) + - match: (?=[{;(]) pop: true type_constraint: @@ -500,10 +531,10 @@ contexts: scope: punctuation.section.block.end.cs pop: true - match: \b(add)\b - scope: storage.type.function.accessor.add.cs + scope: keyword.declaration.function.accessor.add.cs push: method_body - match: \b(remove)\b - scope: storage.type.function.accessor.remove.cs + scope: keyword.declaration.function.accessor.remove.cs push: method_body - match: (?==) set: member_variables_declaration @@ -579,7 +610,7 @@ contexts: captures: 1: variable.other.member.cs 2: meta.method.cs - 3: storage.type.function.accessor.get.cs + 3: keyword.declaration.function.accessor.get.cs set: - meta_scope: meta.property.cs - meta_content_scope: meta.method.cs @@ -729,7 +760,7 @@ contexts: scope: storage.modifier.other.cs push: type_constraint - match: (=>) - scope: keyword.declaration.function.anonymous.cs + scope: keyword.declaration.function.arrow.cs set: - meta_content_scope: meta.method.cs - include: line_of_code_in @@ -771,16 +802,16 @@ contexts: - match: (?:\b(readonly)\b\s+)?\b(get)\b captures: 1: storage.modifier.cs - 2: storage.type.function.accessor.get.cs + 2: keyword.declaration.function.accessor.get.cs push: method_body - match: \b(set|init)\b - scope: storage.type.function.accessor.set.cs + scope: keyword.declaration.function.accessor.set.cs push: method_body - match: '{{visibility}}' scope: storage.modifier.access.cs - include: attribute - match: '=>' - scope: keyword.declaration.function.anonymous.cs + scope: keyword.declaration.function.arrow.cs set: - meta_content_scope: meta.method.cs - include: line_of_code_in @@ -979,7 +1010,7 @@ contexts: - match: ({{name}})\s+(=>)\s* captures: 1: variable.parameter.cs - 2: storage.type.function.lambda.cs + 2: keyword.declaration.function.arrow.cs push: - meta_scope: meta.function.anonymous.cs - match: '(?=;)' @@ -999,7 +1030,7 @@ contexts: - match: (\))\s*(=>) captures: 1: meta.group.cs punctuation.section.group.end.cs - 2: storage.type.function.lambda.cs + 2: keyword.declaration.function.arrow.cs set: - meta_content_scope: meta.function.anonymous.cs - match: '(?=;)' @@ -1330,43 +1361,12 @@ contexts: 2: punctuation.separator.cs 3: punctuation.section.brackets.end.cs 4: keyword.operator.pointer.cs - - match: \((?=(?:[^,)(]|\([^\)]*\))*,) - scope: punctuation.section.group.begin.cs - push: - - meta_scope: meta.group.tuple.cs - - match: \) - scope: punctuation.section.group.end.cs - pop: true - - match: ',' - scope: punctuation.separator.tuple.cs - - match: ':' - scope: keyword.operator.assignment.cs - - match: _\b - scope: variable.language.deconstruction.discard.cs - - match: (?!{{reserved}})(?={{namespaced_name}}{{type_suffix}}\s+{{name}}\s*[:,]) - push: var_declaration_explicit - - match: '({{name}})(<)' - captures: - 1: support.type.cs - 2: meta.generic.cs punctuation.definition.generic.begin.cs - push: - - meta_content_scope: meta.generic.cs - - match: ',' - scope: punctuation.separator.type.cs - - match: '>' - scope: meta.generic.cs punctuation.definition.generic.end.cs - pop: true - - include: type - - include: line_of_code_in_no_semicolon - match: \( scope: punctuation.section.group.begin.cs - push: - - meta_scope: meta.group.cs - - match: \) - scope: punctuation.section.group.end.cs - pop: true - - include: lambdas - - include: line_of_code_in_no_semicolon + branch_point: tuple_or_group + branch: + - group + - tuple - match: \{ scope: punctuation.section.block.begin.cs set: @@ -1377,6 +1377,49 @@ contexts: - match: (?=\}|\)|>|\]|,|{{reserved}}) pop: true + tuple: + - meta_scope: meta.group.tuple.cs + - match: \) + scope: punctuation.section.group.end.cs + pop: true + - match: ',' + scope: punctuation.separator.tuple.cs + - match: ':' + scope: keyword.operator.assignment.cs + - match: _\b + scope: variable.language.deconstruction.discard.cs + - match: (?!{{reserved}})(?={{namespaced_name}}{{type_suffix}}\s+{{name}}\s*[:,]) + push: var_declaration_explicit + - match: '({{name}})(<)' + captures: + 1: support.type.cs + 2: meta.generic.cs punctuation.definition.generic.begin.cs + push: + - meta_content_scope: meta.generic.cs + - match: ',' + scope: punctuation.separator.type.cs + - match: (>)\s*(\() + captures: + 1: meta.generic.cs punctuation.definition.generic.end.cs + 2: meta.function-call.cs meta.group.cs punctuation.section.group.begin.cs + set: [function_call_arguments, arguments] + - match: '>' + scope: meta.generic.cs punctuation.definition.generic.end.cs + pop: true + - include: type + - include: line_of_code_in_no_semicolon + - include: line_of_code_in_no_semicolon + + group: + - meta_scope: meta.group.cs + - match: \) + scope: punctuation.section.group.end.cs + pop: true + - match: ',' + fail: tuple_or_group + - include: lambdas + - include: line_of_code_in_no_semicolon + attribute_arguments: - meta_content_scope: meta.annotation.cs meta.group.cs - match: '' @@ -1428,7 +1471,7 @@ contexts: scope: invalid.illegal.expected-close-paren.cs pop: true - include: stray_close_bracket - - match: '(?=\S)' + - match: (?=\S) push: - include: lambdas - include: line_of_code_in_no_semicolon @@ -2182,7 +2225,7 @@ contexts: documentation: - meta_include_prototype: false - - meta_content_scope: comment.block.documentation.cs + - meta_content_scope: comment.line.documentation.cs - match: '(<)({{name}})' captures: 1: punctuation.definition.tag.begin.cs diff --git a/C#/tests/syntax_test_C#7.cs b/C#/tests/syntax_test_C#7.cs index 2e06c2f396..ae4de41f2f 100644 --- a/C#/tests/syntax_test_C#7.cs +++ b/C#/tests/syntax_test_C#7.cs @@ -351,6 +351,22 @@ public void TupleTest () { /// ^ punctuation.section.group.end /// ^ punctuation.terminator.statement + ( +/// ^ meta.group.tuple punctuation.section.group.begin + string Alpha, +/// ^^^^^^ storage.type +/// ^^^^^ variable.other +/// ^ punctuation.separator.tuple + string Beta + ) namedLetters = ("a", "b"); +/// ^ punctuation.section.group.end +/// ^^^^^^^^^^^^ variable.other +/// ^ keyword.operator.assignment +/// ^ punctuation.section.group.begin +/// ^ punctuation.separator.tuple +/// ^ punctuation.section.group.end +/// ^ punctuation.terminator.statement + (SomeType[] Alpha, SomeType Beta) example = (a, b); /// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.group.tuple /// ^ punctuation.section.group.begin @@ -564,7 +580,7 @@ private static (int Max, int Min) Range(IEnumerable numbers) /// ^^^^ variable.other /// ^ keyword.operator.assignment.variable /// ^ variable.parameter -/// ^^ storage.type.function.lambda +/// ^^ keyword.declaration.function.arrow /// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.group /// ^ punctuation.section.group.begin /// ^^^^^^^^ variable.other @@ -764,7 +780,7 @@ public class MyClass { public MyClass () => obj = null; /// ^^^^^^^ meta.method.constructor entity.name.function.constructor /// ^^^^^^^^^^^^^^^^^ meta.class.body meta.block meta.method -/// ^^ keyword.declaration.function.anonymous.cs +/// ^^ keyword.declaration.function.arrow.cs /// ^^^ variable.other /// ^ keyword.operator.assignment /// ^^^^ constant.language @@ -789,7 +805,7 @@ public class Person // https://stackoverflow.com/a/41974829/4473405 /// ^^^ variable.parameter /// ^ punctuation.section.parameters.end /// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.method -/// ^^ keyword.declaration.function.anonymous.cs +/// ^^ keyword.declaration.function.arrow.cs /// ^ meta.group punctuation.section.group.begin /// ^^^^ meta.group variable.other /// ^ meta.group punctuation.separator.tuple diff --git a/C#/tests/syntax_test_C#8.cs b/C#/tests/syntax_test_C#8.cs index e2e44ab011..742402f5c4 100644 --- a/C#/tests/syntax_test_C#8.cs +++ b/C#/tests/syntax_test_C#8.cs @@ -22,7 +22,7 @@ interface ILogger { void Log(LogLevel level, string message); void Log(Exception ex) => Log(LogLevel.Error, ex.ToString()); // New overload -/// ^^ keyword.declaration.function.anonymous +/// ^^ keyword.declaration.function.arrow } public static decimal CalculateToll(object vehicle) => @@ -87,7 +87,7 @@ public struct Point3D /// ^^^^^^^^ storage.modifier /// ^^^^^^^ support.type /// ^^^^^^^ variable.other.member -/// ^^ storage.type.function.accessor.get +/// ^^ keyword.declaration.function.accessor.get /// ^^^ keyword.other /// ^^^^^^ variable.other /// ^ punctuation.terminator.statement diff --git a/C#/tests/syntax_test_C#9.cs b/C#/tests/syntax_test_C#9.cs index f33cb80777..dde311a37d 100644 --- a/C#/tests/syntax_test_C#9.cs +++ b/C#/tests/syntax_test_C#9.cs @@ -10,16 +10,16 @@ public record Person { private readonly string lastName; public string FirstName { get; init; } -/// ^^^ storage.type.function.accessor.get +/// ^^^ keyword.declaration.function.accessor.get /// ^ punctuation.terminator -/// ^^^^ storage.type.function.accessor.set +/// ^^^^ keyword.declaration.function.accessor.set /// ^ punctuation.terminator public string LastName { get => lastName; init => lastName = (value ?? throw new ArgumentNullException(nameof(LastName))); -/// ^^^^ storage.type.function.accessor.set -/// ^^ keyword.declaration.function.anonymous +/// ^^^^ keyword.declaration.function.accessor.set +/// ^^ keyword.declaration.function.arrow /// ^^^^^^^^ variable.other } } @@ -298,3 +298,82 @@ DeliveryTruck t when (t.GrossWeightClass < 3000) => 10.00m - 2.00m, if (e is not Customer) { } /// ^^^^^^ keyword.operator.reflection /// ^^^^^^^^ support.type + +public record A(int Num); +/// ^^^^^^^^^^^^^^^^^ meta.class +/// ^ punctuation.terminator.statement +/// ^ meta.class.record entity.name.class +/// ^ punctuation.section.group.begin +/// ^^^^^^^^ meta.method.parameters +/// ^^^ storage.type +/// ^^^ variable.parameter +/// ^ punctuation.section.parameters.end +public record B(T Num); +/// ^^^^^^^^^^^ meta.class.record +/// ^^^^^^ storage.type.class.record +/// ^ entity.name.class +/// ^^^ meta.generic +/// ^ punctuation.definition.generic.begin +/// ^ support.type +/// ^ punctuation.definition.generic.end +/// ^ punctuation.section.group.begin +/// ^^^^^ meta.method.parameters +/// ^ punctuation.section.parameters.end +/// ^ punctuation.terminator.statement +public record C (TNum Num) where TNum : class; +/// ^^^^^^ storage.type.class.record +/// ^ entity.name.class +/// ^ punctuation.definition.generic.begin +/// ^^^^ support.type +/// ^ punctuation.definition.generic.end +/// ^ punctuation.section.group.begin +/// ^^^^ support.type +/// ^^^ variable.parameter +/// ^ punctuation.section.parameters.end +/// ^^^^^ storage.modifier +/// ^^^^ support.type +/// ^ punctuation.separator.type +/// ^^^^^ storage.type +/// ^ punctuation.terminator.statement +public record D (TNum Num) where TNum : class { public const int TEST = 4; } +/// ^^^^^^ storage.type.class.record +/// ^ entity.name.class +/// ^ punctuation.definition.generic.begin +/// ^^^^ support.type +/// ^ punctuation.definition.generic.end +/// ^ punctuation.section.group.begin +/// ^^^^ support.type +/// ^^^ variable.parameter +/// ^ punctuation.section.parameters.end +/// ^^^^^ storage.modifier +/// ^^^^ support.type +/// ^ punctuation.separator.type +/// ^^^^^ storage.type +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block +/// ^ punctuation.section.block.begin +/// ^^^^^^ storage.modifier.access +/// ^^^^^ storage.modifier +/// ^^^ storage.type +/// ^^^^ variable.other +/// ^ keyword.operator.assignment.variable +/// ^ constant.numeric.value +/// ^ punctuation.terminator.statement +/// ^ punctuation.section.block.end +public record Person( +///^^^ storage.modifier.access +/// ^^^^^^ meta.class.record storage.type.class.record +/// ^^^^^^ meta.class.record entity.name.class +/// ^ punctuation.section.group.begin + [property: JsonPropertyName("firstName")]string FirstName, +/// ^ punctuation.definition.annotation.begin +/// ^ punctuation.definition.annotation.end +/// ^^^^^^ storage.type +/// ^^^^^^^^^ variable.parameter +/// ^ punctuation.separator.parameter.function + [property: JsonPropertyName("lastName")]string LastName); +/// ^ punctuation.definition.annotation.begin +/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.body meta.method.parameters meta.annotation +/// ^^^^^^ storage.type +/// ^^^^^^^^ variable.parameter +/// ^ punctuation.section.parameters.end +/// ^ punctuation.terminator.statement diff --git a/C#/tests/syntax_test_Comments.cs b/C#/tests/syntax_test_Comments.cs index 1dcfbb52e7..49cfc4a8ef 100755 --- a/C#/tests/syntax_test_Comments.cs +++ b/C#/tests/syntax_test_Comments.cs @@ -8,7 +8,7 @@ namespace HelloWorld { /// //* ^^^ punctuation.definition.comment.documentation.cs -//* ^^^^^^^^^^^^^^ comment.block.documentation +//* ^^^^^^^^^^^^^^ comment.line.documentation //* ^ punctuation.definition.tag.begin //* ^^^^^^^ entity.name.tag.begin //* ^ punctuation.definition.tag.end @@ -16,7 +16,7 @@ namespace HelloWorld //* ^^^^^^^^^ - text.documentation //* ^ text.documentation /// This class is testing comments -//* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block.documentation +//* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.documentation //* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ text.documentation /// //* ^^ punctuation.definition.tag.begin diff --git a/C#/tests/syntax_test_GeneralStructure.cs b/C#/tests/syntax_test_GeneralStructure.cs index 06646fb2f5..753f80e7cc 100644 --- a/C#/tests/syntax_test_GeneralStructure.cs +++ b/C#/tests/syntax_test_GeneralStructure.cs @@ -46,14 +46,14 @@ public Int YourProperty { /// ^ meta.property punctuation.section.block.begin get {return x;} /// ^^^^^^^^^^^^^^^ meta.property meta.method -/// ^ storage.type.function.accessor.get +/// ^ keyword.declaration.function.accessor.get /// ^^^^^^^^^^^ meta.property meta.method.body meta.block /// ^ punctuation.section.block.begin /// ^ punctuation.terminator /// ^ punctuation.section.block.end set {x = value;} /// ^^^^^^^^^^^^^^^^ meta.property meta.method -/// ^ storage.type.function.accessor.set +/// ^ keyword.declaration.function.accessor.set /// ^^^^^^^^^^^^ meta.property meta.method.body meta.block /// ^ punctuation.section.block.begin /// ^ variable.other @@ -71,7 +71,7 @@ public Int YourProperty { /// ^^^^ support.type /// ^^^^^ variable.parameter /// ^ punctuation.section.parameters.end -/// ^^ keyword.declaration.function.anonymous.cs +/// ^^ keyword.declaration.function.arrow.cs /// ^^^^ variable.language /// ^^ keyword.operator.reflection /// ^^^^^ support.type @@ -96,7 +96,7 @@ public Int YourProperty { /// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.property /// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.method /// ^ variable.other.member -/// ^^ storage.type.function.accessor.get +/// ^^ keyword.declaration.function.accessor.get /// ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call /// ^^^^^^^ support.type /// ^^^^^^ meta.generic @@ -108,9 +108,9 @@ public Int YourProperty { /// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.property /// ^^^^^^^^^^^^^^ variable.other.member /// ^^^^^^^^^^^^^^^^^^^^ meta.property meta.block -/// ^^^ storage.type.function.accessor.get +/// ^^^ keyword.declaration.function.accessor.get /// ^^^^^^^ storage.modifier.access -/// ^^^ storage.type.function.accessor.set +/// ^^^ keyword.declaration.function.accessor.set /// ^ keyword.operator.assignment /// ^^^^^ constant.language @@ -120,7 +120,7 @@ public Int YourProperty { /// ^^^^^^^^^^^^^^^^^^^^ meta.method /// ^^^^^^^^^ entity.name.function /// ^^ meta.method.parameters -/// ^^ keyword.declaration.function.anonymous.cs +/// ^^ keyword.declaration.function.arrow.cs /// ^^^^^ constant.language } @@ -715,8 +715,8 @@ IEnumerable Traverse() /// ^ punctuation.section.brackets.end /// ^^^ storage.type /// ^^^ variable.parameter -/// ^^^ storage.type.function.accessor -/// ^^^ storage.type.function.accessor +/// ^^^ keyword.declaration.function.accessor +/// ^^^ keyword.declaration.function.accessor ///////////////////////////// @@ -792,7 +792,7 @@ public virtual ActionResult Process([ModelBinder(typeof(MyModelBinder))] /// ^^^ storage.type /// ^^^^^^^ variable.other.member /// ^^^^ meta.method -/// ^^ storage.type.function +/// ^^ keyword.declaration.function /// ^ constant.numeric /// ^ punctuation.terminator @@ -829,24 +829,24 @@ void CodeContainingLambdas(){ /// ^^^ variable.other /// ^ keyword.operator.assignment /// ^^^^^^^^ meta.function.anonymous -/// ^^ storage.type.function.lambda +/// ^^ keyword.declaration.function.arrow Func times2 = x => x + x; /// ^^^ support.type /// ^^^ variable.other /// ^ keyword.operator.assignment /// ^^^^^^^^^^ meta.function.anonymous -/// ^^ storage.type.function.lambda +/// ^^ keyword.declaration.function.arrow var changes = refs.ToDictionary(kvp => kvp.key, arg => k + 5); /// ^^^^^^^^^^^^^^ meta.function.anonymous.cs /// ^^^ variable.parameter.cs -/// ^^ storage.type.function.lambda.cs +/// ^^ keyword.declaration.function.arrow.cs /// ^^^ variable.other.cs /// ^ punctuation.separator.argument.cs /// ^^ - meta.function.anonymous /// ^^^^^^^^^^^^ meta.function.anonymous.cs /// ^^^ variable.parameter.cs -/// ^^ storage.type.function.lambda.cs +/// ^^ keyword.declaration.function.arrow.cs /// ^ variable.other.cs /// ^ keyword.operator.cs /// ^ meta.number.integer.decimal.cs @@ -862,7 +862,7 @@ void CodeContainingLambdas(){ /// ^ punctuation.separator.parameter.function.cs /// ^^^^^ variable.parameter.cs /// ^ punctuation.section.group.end.cs -/// ^^ storage.type.function.lambda.cs +/// ^^ keyword.declaration.function.arrow.cs /// ^^^^^ variable.other.cs } @@ -1010,7 +1010,7 @@ void TestMethod(int argument) { void TestMe () { a = b => b * 2; -/// ^^ storage.type.function.lambda +/// ^^ keyword.declaration.function.arrow /// ^^^^^^^^ meta.function.anonymous /// ^ punctuation.terminator.statement - meta.function.anonymous @@ -1031,7 +1031,7 @@ void TestMe () { } a = b => { return b * 2; }; -/// ^^ meta.function.anonymous storage.type.function.lambda +/// ^^ meta.function.anonymous keyword.declaration.function.arrow /// ^ meta.function.anonymous punctuation.section.block.begin /// ^ punctuation.section.block.end /// ^ punctuation.terminator.statement - meta.function.anonymous @@ -1055,7 +1055,7 @@ void TestMe () { /// ^ variable.parameter /// ^ punctuation.separator /// ^ variable.parameter -/// ^^ storage.type.function.lambda +/// ^^ keyword.declaration.function.arrow /// ^ meta.function.anonymous punctuation.section.block.begin /// ^ punctuation.section.block.end /// ^ punctuation.terminator.statement - meta.function.anonymous @@ -1082,7 +1082,7 @@ void TestMe () { /// ^ variable.parameter /// ^ punctuation.separator.parameter.function /// ^ variable.parameter -/// ^^ storage.type.function.lambda +/// ^^ keyword.declaration.function.arrow /// ^ punctuation.terminator.statement /// ^ - meta.function.anonymous @@ -1133,7 +1133,7 @@ void TestMe () { /// ^^^^^^ meta.cast support.type /// ^ punctuation.section.group.begin /// ^^ meta.function.anonymous meta.group -/// ^^ storage.type.function.lambda +/// ^^ keyword.declaration.function.arrow /// ^ punctuation.section.group.end test = (Action)(() => {}); /// ^^^^^^^^ meta.cast @@ -1141,7 +1141,7 @@ void TestMe () { /// ^^^^^^^ meta.function.anonymous /// ^ meta.group punctuation.section.group.begin /// ^ meta.group punctuation.section.group.end -/// ^^ storage.type.function.lambda +/// ^^ keyword.declaration.function.arrow /// ^ punctuation.section.block.begin /// ^ punctuation.section.block.end /// ^ meta.group punctuation.section.group.end @@ -1306,7 +1306,7 @@ protected event EventHandler IDrawingObject.OnDraw { /// ^ punctuation.section.block.begin add -/// ^^^ meta.method storage.type.function.accessor.add +/// ^^^ meta.method keyword.declaration.function.accessor.add { /// ^ punctuation.section.block.begin lock (objectLock) @@ -1319,7 +1319,7 @@ protected event EventHandler IDrawingObject.OnDraw /// ^ punctuation.section.block.end /// ^ - meta.method remove -/// ^^^^^^ meta.method storage.type.function.accessor.remove +/// ^^^^^^ meta.method keyword.declaration.function.accessor.remove { lock (objectLock) { @@ -1368,7 +1368,7 @@ public int Counter { readonly get => counter; /// ^^^^^^^^ storage.modifier -/// ^^^ storage.type.function.accessor.get +/// ^^^ keyword.declaration.function.accessor.get set => counter = value; } } diff --git a/C#/tests/syntax_test_Generics.cs b/C#/tests/syntax_test_Generics.cs index a28383465a..e38f53c023 100755 --- a/C#/tests/syntax_test_Generics.cs +++ b/C#/tests/syntax_test_Generics.cs @@ -154,7 +154,7 @@ string Frag { /// <- punctuation.section.block.begin get -/// ^^^ - storage.type.function +/// ^^^ - keyword.declaration.function { /// ^ punctuation.section.block.begin var list = new List(); diff --git a/C#/tests/syntax_test_Using.cs b/C#/tests/syntax_test_Using.cs index 09e1a46a1a..902857c4b0 100755 --- a/C#/tests/syntax_test_Using.cs +++ b/C#/tests/syntax_test_Using.cs @@ -141,7 +141,7 @@ public static Test Default { /// ^^^^^ meta.annotation /// ^ variable.annotation get { -/// ^ storage.type.function.accessor.get +/// ^ keyword.declaration.function.accessor.get return defaultInstance; } } diff --git a/C++/C++.sublime-syntax b/C++/C++.sublime-syntax index 6744826ac5..7fb0999345 100644 --- a/C++/C++.sublime-syntax +++ b/C++/C++.sublime-syntax @@ -21,19 +21,28 @@ first_line_match: '-\*- C\+\+ -\*-' scope: source.c++ variables: # number digits - dec_digits: '(?:\d(?:[\d'']*\d)?)' + bin_digit: '[01'']' + oct_digit: '[0-7'']' + dec_digit: '[\d'']' + hex_digit: '[\h'']' + + dec_digits: '(?:\d(?:{{dec_digit}}*\d)?)' # number exponents - dec_exponent: '(?:[eE][-+]??{{dec_digits}})' - hex_exponent: '(?:[pP][-+]??{{dec_digits}})' + dec_exponent: '(?:[eE][-+]?{{dec_digit}}*)' + hex_exponent: '(?:[pP][-+]?{{dec_digit}}*)' # 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:]_'']))' + # note: nearly everything can be defined as suffix + # a) see user literals + # https://en.cppreference.com/w/cpp/language/user_literal + # b) see complex `operator` keyword + # https://en.cppreference.com/w/cpp/numeric/complex/operator%22%22i + bin_suffix: '[2-9a-zA-Z_][[:alnum:]_]*' + oct_suffix: '[8-9g-zG-Z_][[:alnum:]_]*' + dec_suffix: '[a-zA-Z_][[:alnum:]_]*' + hex_suffix: '[g-zG-Z_][[: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 @@ -48,11 +57,12 @@ variables: before_tag: 'struct|union|enum\s+class|enum\s+struct|enum|class' declspec: '__declspec\(\s*\w+(?:\([^)]+\))?\s*\)' storage_classes: 'static|export|extern|friend|explicit|virtual|register|thread_local' - type_qualifier: 'const|constexpr|mutable|typename|volatile' + type_qualifier: 'const|mutable|typename|volatile' + constant_expression_specifiers: 'consteval|constexpr|constinit' compiler_directive: 'inline|restrict|__restrict__|__restrict' visibility_modifiers: 'private|protected|public' other_keywords: 'typedef|nullptr|{{visibility_modifiers}}|static_assert|sizeof|using|typeid|alignof|alignas|namespace|template' - modifiers: '{{storage_classes}}|{{type_qualifier}}|{{compiler_directive}}' + modifiers: '{{storage_classes}}|{{type_qualifier}}|{{compiler_directive}}|{{constant_expression_specifiers}}' non_angle_brackets: '(?=<<|<=)' regular: '[^(){}&;*^%=<>-]*' @@ -130,7 +140,7 @@ contexts: scope: keyword.operator.word.c++ unique-types: - - match: \b(char16_t|char32_t|wchar_t|nullptr_t)\b + - match: \b(char8_t|char16_t|char32_t|wchar_t|nullptr_t)\b scope: storage.type.c++ - match: \bclass\b scope: keyword.declaration.class.c++ @@ -154,110 +164,76 @@ contexts: (?x: \b({{dec_digits}}) (?: - (?: - (\.) + ( (\.) (?: # 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}})? + {{dec_digit}}+ {{dec_exponent}}? # 1.e1, 1.e-1, 1.e1f, 1.e-1f, 1.e1L, 1.e-1L - | ({{dec_exponent}}) + | {{dec_exponent}} # 1., 1.f, 1.L # but not `..` | (?!\.) ) # 1e1 1e1f 1e1L - | ({{dec_exponent}}) + | {{dec_exponent}} ) ({{dec_suffix}})? # 1f | ({{float_suffix}}) ) # .1, .1e1, .1e-1, .1f, .1e1f, .1e-1f, .1L, .1e1L, .1e-1L - | (\.) ({{dec_digits}}) ({{dec_exponent}})? ({{dec_suffix}})? + | ( (\.) {{dec_digit}}+ {{dec_exponent}}? ) ({{dec_suffix}})? ) scope: meta.number.float.decimal.c++ captures: 1: constant.numeric.value.c++ - 2: punctuation.separator.decimal.c++ - 3: constant.numeric.value.c++ - 4: constant.numeric.value.exponent.c++ - 5: constant.numeric.value.exponent.c++ - 6: constant.numeric.value.exponent.c++ - 7: constant.numeric.suffix.c++ + 2: constant.numeric.value.c++ + 3: punctuation.separator.decimal.c++ + 4: constant.numeric.suffix.c++ + 5: constant.numeric.suffix.c++ + 6: constant.numeric.value.c++ + 7: punctuation.separator.decimal.c++ 8: constant.numeric.suffix.c++ - 9: punctuation.separator.decimal.c++ - 10: constant.numeric.value.c++ - 11: constant.numeric.value.exponent.c++ - 12: constant.numeric.suffix.c++ - - # hexadecimal float (C99) - - match: \b0[xX](?=[[:alnum:]_''.]+?[pP]) - scope: constant.numeric.base.c++ - push: - - meta_include_prototype: false - - meta_scope: meta.number.float.hexadecimal.c++ - - match: '({{hex_exponent}})([fFlL]\b)?' - captures: - 1: constant.numeric.value.exponent.c++ - 2: constant.numeric.suffix.c++ - pop: true - - match: \. - scope: punctuation.separator.decimal.c++ - - match: \h - scope: constant.numeric.value.c++ - - match: . - scope: invalid.illegal.numeric.digit.c++ - - # https://en.cppreference.com/w/c/language/integer_constant - - # binary integer - - match: \b0[bB] - scope: constant.numeric.base.c++ - push: - - meta_include_prototype: false - - meta_scope: meta.number.integer.binary.c++ - - include: decimal-suffix - - match: '[2-9]' - scope: invalid.illegal.numeric.digit.c++ - - match: . - scope: constant.numeric.value.c++ + + # hexadecimal float + - match: \b(0[xX])({{hex_digit}}*(\.){{hex_digit}}*{{hex_exponent}})({{dec_suffix}})? + scope: meta.number.float.hexadecimal.c++ + captures: + 1: constant.numeric.base.c++ + 2: constant.numeric.value.c++ + 3: punctuation.separator.decimal.c++ + 4: constant.numeric.suffix.c++ + + # https://en.cppreference.com/w/cpp/language/integer_literal + # hexadecimal integer - - match: \b0[xX] - scope: constant.numeric.base.c++ - push: - - meta_include_prototype: false - - meta_scope: meta.number.integer.hexadecimal.c++ - - include: hexadecimal-suffix - - match: . - scope: constant.numeric.value.c++ + - match: \b(0[xX])({{hex_digit}}*)({{hex_suffix}})? + scope: meta.number.integer.hexadecimal.c++ + captures: + 1: constant.numeric.base.c++ + 2: constant.numeric.value.c++ + 3: constant.numeric.suffix.c++ + + # binary integer (C++14) + - match: \b(0[bB])({{bin_digit}}*)({{bin_suffix}})? + scope: meta.number.integer.binary.c++ + captures: + 1: constant.numeric.base.c++ + 2: constant.numeric.value.c++ + 3: constant.numeric.suffix.c++ + # octal integer - - match: \b0(?=[\d'']) - scope: constant.numeric.base.c++ - push: - - meta_include_prototype: false - - meta_scope: meta.number.integer.octal.c++ - - include: decimal-suffix - - match: '[89]' - scope: invalid.illegal.numeric.digit.c++ - - match: . - scope: constant.numeric.value.c++ - # decimal integer - - match: \b\d+ - scope: constant.numeric.value.c++ - push: - - meta_include_prototype: false - - meta_scope: meta.number.integer.decimal.c++ - - include: decimal-suffix - - match: . - scope: constant.numeric.value.c++ - - decimal-suffix: - - match: '{{dec_suffix}}' - scope: constant.numeric.suffix.c++ - pop: true + - match: \b(0)({{oct_digit}}+)({{oct_suffix}})? + scope: meta.number.integer.octal.c++ + captures: + 1: constant.numeric.base.c++ + 2: constant.numeric.value.c++ + 3: constant.numeric.suffix.c++ - hexadecimal-suffix: - - match: '{{hex_suffix}}' - scope: constant.numeric.suffix.c++ - pop: true + # decimal integer + - match: \b({{dec_digits}})({{dec_suffix}})? + scope: meta.number.integer.decimal.c++ + captures: + 1: constant.numeric.value.c++ + 2: constant.numeric.suffix.c++ identifiers: - match: '(?:(::)\s*)?{{identifier}}\s*(::)\s*' @@ -1173,7 +1149,7 @@ contexts: scope: keyword.declaration.struct.type.c++ set: data-structures-struct-definition - match: '\benum(\s+(class|struct))?\b' - scope: keyword.declaration.union.type.c++ + scope: keyword.declaration.enum.type.c++ set: data-structures-enum-definition - match: '\bunion\b' scope: keyword.declaration.union.type.c++ diff --git a/C++/C.sublime-syntax b/C++/C.sublime-syntax index bc4ba39cb3..c68df90ef1 100644 --- a/C++/C.sublime-syntax +++ b/C++/C.sublime-syntax @@ -9,13 +9,25 @@ first_line_match: "-[*]-( Mode:)? C -[*]-" scope: source.c variables: + # number digits + bin_digit: '[01]' + oct_digit: '[0-7]' + dec_digit: '\d' + hex_digit: '\h' + + dec_digits: '{{dec_digit}}+' + # number exponents - dec_exponent: '(?:[eE][-+]??\d+)' - hex_exponent: '(?:[pP][-+]??\d+)' + dec_exponent: '(?:[eE][-+]?{{dec_digit}}*)' + hex_exponent: '(?:[pP][-+]?{{dec_digit}}*)' # number suffixes + bin_suffix: '[2-9a-zA-Z_][[:alnum:]_]*' + oct_suffix: '[8-9g-zG-Z_][[:alnum:]_]*' dec_suffix: '[a-zA-Z_][[:alnum:]_]*' hex_suffix: '[g-zG-Z_][[:alnum:]_]*' + double_suffix: '[fFlL]' + float_suffix: '[fF]' integer_suffix: '[lL]{1,2}[uU]?|[uU][lL]{0,2}' identifier: \b[[:alpha:]_][[:alnum:]_]*\b # upper and lowercase @@ -185,95 +197,85 @@ contexts: # decimal floats - match: |- (?x: - \b(\d+) + \b({{dec_digits}}) (?: - (?: (\.) (?: (\d+) ({{dec_exponent}})? | ({{dec_exponent}}) | (?=[^.])) | ({{dec_exponent}}) ) - (?: ([fFlL])\b | ({{dec_suffix}})? ) | ([fF])\b - ) - | (\.) (\d+) ({{dec_exponent}})? (?: ([fFlL])\b | ({{dec_suffix}})? ) + ( (\.) + (?: + # 1.1, 1.1e1, 1.1e-1, 1.1f, 1.1e1f, 1.1e-1f, 1.1L, 1.1e1L, 1.1e-1L + {{dec_digit}}+ {{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}} + ) ({{double_suffix}})? + # 1f + | ({{float_suffix}}) + ) ({{dec_suffix}})? + # .1, .1e1, .1e-1, .1f, .1e1f, .1e-1f, .1L, .1e1L, .1e-1L + | ( (\.) {{dec_digit}}+ {{dec_exponent}}? ) (?: ({{double_suffix}}) | ({{dec_suffix}}) )? ) scope: meta.number.float.decimal.c captures: 1: constant.numeric.value.c - 2: punctuation.separator.decimal.c - 3: constant.numeric.value.c - 4: constant.numeric.value.exponent.c - 5: constant.numeric.value.exponent.c - 6: constant.numeric.value.exponent.c - 7: constant.numeric.suffix.c - 8: invalid.illegal.numeric.suffix.c + 2: constant.numeric.value.c + 3: punctuation.separator.decimal.c + 4: constant.numeric.suffix.c + 5: constant.numeric.suffix.c + 6: invalid.illegal.numeric.suffix.c + 7: constant.numeric.value.c + 8: punctuation.separator.decimal.c 9: constant.numeric.suffix.c - 10: punctuation.separator.decimal.c - 11: constant.numeric.value.c - 12: constant.numeric.value.exponent.c - 13: constant.numeric.suffix.c - 14: invalid.illegal.numeric.suffix.c + 10: invalid.illegal.numeric.suffix.c + # hexadecimal float (C99) - - match: \b0[xX](?=[[:alnum:].]+?[pP]) - scope: constant.numeric.base.c - push: - - meta_include_prototype: false - - meta_scope: meta.number.float.hexadecimal.c - - match: '({{hex_exponent}})([fFlL]\b)?' - captures: - 1: constant.numeric.value.exponent.c - 2: constant.numeric.suffix.c - pop: true - - match: \. - scope: punctuation.separator.decimal.c - - match: \h - scope: constant.numeric.value.c - - match: . - scope: invalid.illegal.numeric.digit.c + - match: \b(0[xX])({{hex_digit}}*(\.){{hex_digit}}*{{hex_exponent}})(?:([fFlL]\b)|({{dec_suffix}}))? + scope: meta.number.float.hexadecimal.c + captures: + 1: constant.numeric.base.c + 2: constant.numeric.value.c + 3: punctuation.separator.decimal.c + 4: constant.numeric.suffix.c + 5: invalid.illegal.numeric.suffix.c # https://en.cppreference.com/w/c/language/integer_constant + # binary integer (C23) + - match: \b(0[bB])({{bin_digit}}*)(?:({{integer_suffix}})|({{bin_suffix}}))? + scope: meta.number.integer.binary.c + captures: + 1: constant.numeric.base.c + 2: constant.numeric.value.c + 3: constant.numeric.suffix.c + 4: invalid.illegal.numeric.suffix.c + # hexadecimal integer - - match: \b0[xX] - scope: constant.numeric.base.c - push: - - meta_include_prototype: false - - meta_scope: meta.number.integer.hexadecimal.c - - include: hexadecimal-suffix - - match: . - scope: constant.numeric.value.c + - match: \b(0[xX])({{hex_digit}}*)(?:({{integer_suffix}})|({{hex_suffix}}))? + scope: meta.number.integer.hexadecimal.c + captures: + 1: constant.numeric.base.c + 2: constant.numeric.value.c + 3: constant.numeric.suffix.c + 4: invalid.illegal.numeric.suffix.c + # octal integer - - match: \b0(?=\d) - scope: constant.numeric.base.c - push: - - meta_include_prototype: false - - meta_scope: meta.number.integer.octal.c - - match: '[89]' - scope: invalid.illegal.numeric.digit.c - - include: decimal-suffix - - match: . - scope: constant.numeric.value.c + - match: \b(0)({{oct_digit}}+)(?:({{integer_suffix}})|({{oct_suffix}}))? + scope: meta.number.integer.octal.c + captures: + 1: constant.numeric.base.c + 2: constant.numeric.value.c + 3: constant.numeric.suffix.c + 4: invalid.illegal.numeric.suffix.c # decimal integer - - match: \b\d+ - scope: constant.numeric.value.c - push: - - meta_include_prototype: false - - meta_scope: meta.number.integer.decimal.c - - include: decimal-suffix - - match: . - scope: constant.numeric.value.c - - decimal-suffix: - - match: (?:{{integer_suffix}})?\b - scope: constant.numeric.suffix.c - pop: true - - match: '{{dec_suffix}}' - scope: invalid.illegal.numeric.suffix.c - pop: true - - hexadecimal-suffix: - - match: (?:{{integer_suffix}})?\b - scope: constant.numeric.suffix.c - pop: true - - match: '{{hex_suffix}}' - scope: invalid.illegal.numeric.suffix.c - pop: true + - match: \b({{dec_digits}})(?:({{integer_suffix}})|({{dec_suffix}}))? + scope: meta.number.integer.decimal.c + captures: + 1: constant.numeric.value.c + 2: constant.numeric.suffix.c + 3: invalid.illegal.numeric.suffix.c operators: - match: (?:\+\+|--) diff --git a/C++/syntax_test_c.c b/C++/syntax_test_c.c index 410665eb39..3148b71aae 100644 --- a/C++/syntax_test_c.c +++ b/C++/syntax_test_c.c @@ -721,11 +721,7 @@ oct2 = 01284967Z0L; /* ^^^^^^^^^^^ meta.number.integer.octal.c */ /* ^ constant.numeric.base.c */ /* ^^ constant.numeric.value.c */ -/* ^ invalid.illegal.numeric.digit.c */ -/* ^ constant.numeric.value.c */ -/* ^ invalid.illegal.numeric.digit.c */ -/* ^^ constant.numeric.value.c */ -/* ^^^ invalid.illegal.numeric.suffix.c */ +/* ^^^^^^^^ invalid.illegal.numeric.suffix.c */ /* ^ punctuation.terminator - constant */ hex1 = 0x0+0xFL+0xaull+0xallu+0xfu+0x'f'12_4uz; @@ -759,127 +755,102 @@ hex1 = 0x0+0xFL+0xaull+0xallu+0xfu+0x'f'12_4uz; hex2 = 0xc1.01AbFp-1+0x1.45c778p+7f; /* ^^^^^^^^^^^^^ meta.number.float.hexadecimal.c */ /* ^^ constant.numeric.base.c */ -/* ^^ constant.numeric.value.c */ +/* ^^^^^^^^^^^ constant.numeric.value.c */ /* ^ punctuation.separator.decimal.c */ -/* ^^^^^ constant.numeric.value.c */ -/* ^^^ constant.numeric.value.exponent.c */ /* ^ keyword.operator.arithmetic - constant.c */ /* ^^^^^^^^^^^^^^ meta.number.float.hexadecimal.c */ /* ^^ constant.numeric.base.c */ -/* ^ constant.numeric.value.c */ +/* ^^^^^^^^^^^ constant.numeric.value.c */ /* ^ punctuation.separator.decimal.c */ -/* ^^^^^^ constant.numeric.value.c */ -/* ^^^ constant.numeric.value.exponent.c */ /* ^ constant.numeric.suffix.c */ /* ^ 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; /* ^^^ meta.number.float.decimal.c */ -/* ^ constant.numeric.value.c */ +/* ^^^ constant.numeric.value.c */ /* ^ punctuation.separator.decimal.c */ -/* ^ constant.numeric.value.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^^^ meta.number.float.decimal.c */ -/* ^ constant.numeric.value.c */ +/* ^^^^^ constant.numeric.value.c */ /* ^ punctuation.separator.decimal.c */ -/* ^ constant.numeric.value.c */ -/* ^^ constant.numeric.value.exponent.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^^^^ meta.number.float.decimal.c */ -/* ^ constant.numeric.value.c */ +/* ^^^^^^ constant.numeric.value.c */ /* ^ punctuation.separator.decimal.c */ -/* ^ constant.numeric.value.c */ -/* ^^^ constant.numeric.value.exponent.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^^ meta.number.float.decimal.c */ -/* ^ constant.numeric.value.c */ +/* ^^^ constant.numeric.value.c */ /* ^ punctuation.separator.decimal.c */ -/* ^ constant.numeric.value.c */ /* ^ constant.numeric.suffix.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^^^^ meta.number.float.decimal.c */ -/* ^ constant.numeric.value.c */ +/* ^^^^^ constant.numeric.value.c */ /* ^ punctuation.separator.decimal.c */ -/* ^ constant.numeric.value.c */ -/* ^^ constant.numeric.value.exponent.c */ /* ^ constant.numeric.suffix.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^^^^^ meta.number.float.decimal.c */ -/* ^ constant.numeric.value.c */ +/* ^^^^^^ constant.numeric.value.c */ /* ^ punctuation.separator.decimal.c */ -/* ^ constant.numeric.value.c */ -/* ^^^ constant.numeric.value.exponent.c */ /* ^ constant.numeric.suffix.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^^ meta.number.float.decimal.c */ -/* ^ constant.numeric.value.c */ +/* ^^^ constant.numeric.value.c */ /* ^ punctuation.separator.decimal.c */ -/* ^ constant.numeric.value.c */ /* ^ constant.numeric.suffix.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^^^^ meta.number.float.decimal.c */ -/* ^ constant.numeric.value.c */ +/* ^^^^^ constant.numeric.value.c */ /* ^ punctuation.separator.decimal.c */ -/* ^ constant.numeric.value.c */ -/* ^^ constant.numeric.value.exponent.c */ /* ^ constant.numeric.suffix.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^^^^^ meta.number.float.decimal.c */ -/* ^ constant.numeric.value.c */ +/* ^^^^^^ constant.numeric.value.c */ /* ^ punctuation.separator.decimal.c */ -/* ^ constant.numeric.value.c */ -/* ^^^ constant.numeric.value.exponent.c */ /* ^ constant.numeric.suffix.c */ /* ^ punctuation.terminator - constant */ f = 1.e1+1.e-1+1.e1f+1.e-1f+1.e1L+1.e-1L; /* ^^^^ meta.number.float.decimal.c */ -/* ^ constant.numeric.value.c */ +/* ^^^^ constant.numeric.value.c */ /* ^ punctuation.separator.decimal.c */ -/* ^^ constant.numeric.value.exponent.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^^^ meta.number.float.decimal.c */ -/* ^ constant.numeric.value.c */ +/* ^^^^^ constant.numeric.value.c */ /* ^ punctuation.separator.decimal.c */ -/* ^^^ constant.numeric.value.exponent.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^^^ meta.number.float.decimal.c */ -/* ^ constant.numeric.value.c */ +/* ^^^^ constant.numeric.value.c */ /* ^ punctuation.separator.decimal.c */ -/* ^^ constant.numeric.value.exponent.c */ /* ^ constant.numeric.suffix.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^^^^ meta.number.float.decimal.c */ -/* ^ constant.numeric.value.c */ +/* ^^^^^ constant.numeric.value.c */ /* ^ punctuation.separator.decimal.c */ -/* ^^^ constant.numeric.value.exponent.c */ /* ^ constant.numeric.suffix.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^^^ meta.number.float.decimal.c */ -/* ^ constant.numeric.value.c */ +/* ^^^^ constant.numeric.value.c */ /* ^ punctuation.separator.decimal.c */ -/* ^^ constant.numeric.value.exponent.c */ /* ^ constant.numeric.suffix.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^^^^ meta.number.float.decimal.c */ -/* ^ constant.numeric.value.c */ +/* ^^^^^ constant.numeric.value.c */ /* ^ punctuation.separator.decimal.c */ -/* ^^^ constant.numeric.value.exponent.c */ /* ^ constant.numeric.suffix.c */ /* ^ punctuation.terminator - constant */ f = 1.+1.f+1.L+1..; /* ^^ meta.number.float.decimal.c */ -/* ^ constant.numeric.value.c */ +/* ^^ constant.numeric.value.c */ /* ^ punctuation.separator.decimal.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^ meta.number.float.decimal.c */ -/* ^ constant.numeric.value.c */ +/* ^^ constant.numeric.value.c */ /* ^ punctuation.separator.decimal.c */ /* ^ constant.numeric.suffix.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^ meta.number.float.decimal.c */ -/* ^ constant.numeric.value.c */ +/* ^^ constant.numeric.value.c */ /* ^ punctuation.separator.decimal.c */ /* ^ constant.numeric.suffix.c */ /* ^ keyword.operator.arithmetic.c */ @@ -890,83 +861,111 @@ f = 1.+1.f+1.L+1..; f = 1e1+1e1f+1e1L; /* ^^^ meta.number.float.decimal.c */ -/* ^ constant.numeric.value.c */ -/* ^^ constant.numeric.value.exponent.c */ +/* ^^^ constant.numeric.value.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^^ meta.number.float.decimal.c */ -/* ^ constant.numeric.value.c */ -/* ^^ constant.numeric.value.exponent.c */ +/* ^^^ constant.numeric.value.c */ /* ^ constant.numeric.suffix.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^^ meta.number.float.decimal.c */ -/* ^ constant.numeric.value.c */ -/* ^^ constant.numeric.value.exponent.c */ +/* ^^^ constant.numeric.value.c */ /* ^ constant.numeric.suffix.c */ /* ^ punctuation.terminator - constant */ f = .1+.1e1+.1e-1+.1f+.1e1f+.1e-1f+.1L+.1e1L+.1e-1L; /* ^^ meta.number.float.decimal.c */ +/* ^^ constant.numeric.value.c */ /* ^ punctuation.separator.decimal.c */ -/* ^ constant.numeric.value.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^^ meta.number.float.decimal.c */ /* ^ punctuation.separator.decimal.c */ -/* ^ constant.numeric.value.c */ -/* ^^ constant.numeric.value.exponent.c */ +/* ^^^^ constant.numeric.value.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^^^ meta.number.float.decimal.c */ /* ^ punctuation.separator.decimal.c */ -/* ^ constant.numeric.value.c */ -/* ^^^ constant.numeric.value.exponent.c */ +/* ^^^^^ constant.numeric.value.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^ meta.number.float.decimal.c */ /* ^ punctuation.separator.decimal.c */ -/* ^ constant.numeric.value.c */ +/* ^^ constant.numeric.value.c */ /* ^ constant.numeric.suffix.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^^^ meta.number.float.decimal.c */ /* ^ punctuation.separator.decimal.c */ -/* ^ constant.numeric.value.c */ -/* ^^ constant.numeric.value.exponent.c */ +/* ^^^^ constant.numeric.value.c */ /* ^ constant.numeric.suffix.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^^^^ meta.number.float.decimal.c */ /* ^ punctuation.separator.decimal.c */ -/* ^ constant.numeric.value.c */ -/* ^^^ constant.numeric.value.exponent.c */ +/* ^^^^^ constant.numeric.value.c */ /* ^ constant.numeric.suffix.c */ /* ^^^ meta.number.float.decimal.c */ /* ^ punctuation.separator.decimal.c */ -/* ^ constant.numeric.value.c */ +/* ^^ constant.numeric.value.c */ /* ^ constant.numeric.suffix.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^^^ meta.number.float.decimal.c */ /* ^ punctuation.separator.decimal.c */ -/* ^ constant.numeric.value.c */ -/* ^^ constant.numeric.value.exponent.c */ +/* ^^^^ constant.numeric.value.c */ /* ^ constant.numeric.suffix.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^^^^ meta.number.float.decimal.c */ /* ^ punctuation.separator.decimal.c */ -/* ^ constant.numeric.value.c */ -/* ^^^ constant.numeric.value.exponent.c */ +/* ^^^^^ constant.numeric.value.c */ /* ^ constant.numeric.suffix.c */ /* ^ punctuation.terminator - constant */ -f = 1.0suff+1.suff*.0suff/{1suff} -/* ^^^ meta.number.float.decimal - invalid */ -/* ^^^^ meta.number.float.decimal invalid.illegal.numeric.suffix */ -/* ^ keyword.operator.arithmetic */ -/* ^^ meta.number.float.decimal - invalid */ -/* ^^^^ meta.number.float.decimal invalid.illegal.numeric.suffix */ -/* ^ keyword.operator */ -/* ^^ meta.number.float.decimal - invalid */ -/* ^^^^ meta.number.float.decimal invalid.illegal.numeric.suffix */ -/* ^ keyword.operator.arithmetic */ -/* ^ punctuation.section.block.begin */ -/* ^ meta.number.integer.decimal - invalid */ -/* ^^^^ meta.number.integer.decimal invalid.illegal.numeric.suffix */ -/* ^ punctuation.section.block.end */ +units0 = 1.0suff+1.suff*.0suff/{1suff} +/* ^^^^^^^ meta.number.float.decimal */ +/* ^^^^ invalid.illegal.numeric.suffix */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ meta.number.float.decimal */ +/* ^^^^ invalid.illegal.numeric.suffix */ +/* ^ keyword.operator */ +/* ^^^^^^ meta.number.float.decimal */ +/* ^^^^ invalid.illegal.numeric.suffix */ +/* ^ keyword.operator.arithmetic */ +/* ^ punctuation.section.block.begin */ +/* ^^^^^ meta.number.integer.decimal */ +/* ^ constant.numeric.value */ +/* ^^^^ invalid.illegal.numeric.suffix */ +/* ^ punctuation.section.block.end */ + +units1 = 134h + 123.45h; +/* ^^^^ meta.number.integer.decimal */ +/* ^ invalid.illegal.numeric.suffix */ +/* ^^^ - constant */ +/* ^^^^^^^ meta.number.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ invalid.illegal.numeric.suffix */ +/* ^ punctuation.terminator - constant */ + +units2 = 147min + 147.min; +/* ^^^^^^ meta.number.integer.decimal */ +/* ^^^ invalid.illegal.numeric.suffix */ +/* ^^^ - constant */ +/* ^^^^^^^ meta.number.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^^^ invalid.illegal.numeric.suffix */ +/* ^ punctuation.terminator - constant */ + +units3 = 357s + 34.7s; +/* ^^^^ meta.number.integer.decimal */ +/* ^ invalid.illegal.numeric.suffix */ +/* ^^^ - constant */ +/* ^^^^^ meta.number.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ invalid.illegal.numeric.suffix */ +/* ^ punctuation.terminator - constant */ + +units4 = 234_custom + 10e-1_custom; +/* ^^^^^^^^^^ meta.number.integer.decimal */ +/* ^^^ constant.numeric.value */ +/* ^^^^^^^ invalid.illegal.numeric.suffix */ +/* ^^^ - constant */ +/* ^^^^^^^^^^^^ meta.number.float.decimal */ +/* ^^^^^^^ invalid.illegal.numeric.suffix */ +/* ^ punctuation.terminator - constant */ scanf("%ms %as %*[, ]", &buf); /* ^^^ constant.other.placeholder */ diff --git a/C++/syntax_test_cpp.cpp b/C++/syntax_test_cpp.cpp index 0597f64c80..2630e8e8c6 100644 --- a/C++/syntax_test_cpp.cpp +++ b/C++/syntax_test_cpp.cpp @@ -269,10 +269,10 @@ char str1[] = "abc"; /* ^ string.quoted.double */ /* ^ punctuation.definition.string.end */ -char str2[] = u8"abc"; -/* ^ storage.type.string */ -/* ^ punctuation.definition.string.begin */ -/* ^ string.quoted.double */ +char8_t str2[] = u8"abc"; +/* ^ storage.type.string */ +/* ^ punctuation.definition.string.begin */ +/* ^ string.quoted.double */ char16_t str3[] = u"abc"; /* ^ storage.type.string */ @@ -312,13 +312,16 @@ char str8[] = "\x0a|\x41|\xA|\x000065"; /* ^^^ constant.character.escape */ /* ^^^^^^^^ constant.character.escape */ -char16_t str9[] = u"\u0063"; +char8_t str9[] = u8"\u0063"; /* ^^^^^^ constant.character.escape */ -char32_t str10[] = U"\U00000063"; +char16_t str10[] = u"\u0063"; +/* ^^^^^^ constant.character.escape */ + +char32_t str11[] = U"\U00000063"; /* ^^^^^^^^^^ constant.character.escape */ -char str11[] = "\q"; +char str12[] = "\q"; /* ^^ invalid.illegal.unknown-escape */ scanf("%ms %as %*[, ]", &buf); @@ -847,6 +850,12 @@ const int XYZ = 2; constexpr int ABC = 3 + 5; /* <- storage.modifier */ +consteval int f() { return 42; } +/* <- storage.modifier */ + +constinit const int i = f(); +/* <- storage.modifier */ + thread_local int x; /* <- storage.modifier */ @@ -1093,13 +1102,12 @@ hex5 = 0x0+0xFL+0xaull+0xallu+0xfu+0xf'12_4_uz; hex2 = 0xc1.01AbFp-1+0x1.45c778p+7f; /* ^^^^^^^^^^^^^ meta.number.float.hexadecimal.c++ */ /* ^^ constant.numeric.base.c++ */ -/* ^^ constant.numeric.value.c++ */ +/* ^^^^^^^^^^^ constant.numeric.value.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^^^^^ constant.numeric.value.c++ */ -/* ^^^ constant.numeric.value.exponent.c++ */ /* ^ keyword.operator.arithmetic - constant.c++ */ /* ^^^^^^^^^^^^^^ meta.number.float.hexadecimal.c++ */ /* ^^ constant.numeric.base.c++ */ +/* ^^^^^^^^^^^ constant.numeric.value.c++ */ /* ^ punctuation.separator.decimal.c++ */ /* ^ constant.numeric.suffix.c++ */ /* ^ punctuation.terminator - constant */ @@ -1124,181 +1132,151 @@ bin3 = 0b1001'1101'0010'1100; f = 1.1+1.1e1+1.1e-1+1.1f+1.1e1f+1.1e-1f+1.1L+1.1e1L+1.1e-1L; /* ^^^ meta.number.float.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ +/* ^^^ constant.numeric.value.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^^^ meta.number.float.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ +/* ^^^^^ constant.numeric.value.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ -/* ^^ constant.numeric.value.exponent.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^^^^ meta.number.float.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ +/* ^^^^^^ constant.numeric.value.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ -/* ^^^ constant.numeric.value.exponent.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^^ meta.number.float.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ +/* ^^^ constant.numeric.value.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ /* ^ constant.numeric.suffix.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^^^^ meta.number.float.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ +/* ^^^^^ constant.numeric.value.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ -/* ^^ constant.numeric.value.exponent.c++ */ /* ^ constant.numeric.suffix.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^^^^^ meta.number.float.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ +/* ^^^^^^ constant.numeric.value.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ -/* ^^^ constant.numeric.value.exponent.c++ */ /* ^ constant.numeric.suffix.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^^ meta.number.float.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ +/* ^^^ constant.numeric.value.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ /* ^ constant.numeric.suffix.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^^^^ meta.number.float.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ +/* ^^^^^ constant.numeric.value.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ -/* ^^ constant.numeric.value.exponent.c++ */ /* ^ constant.numeric.suffix.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^^^^^ meta.number.float.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ +/* ^^^^^^ constant.numeric.value.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ -/* ^^^ constant.numeric.value.exponent.c++ */ /* ^ constant.numeric.suffix.c++ */ /* ^ punctuation.terminator - constant */ f = 1.e1+1.e-1+1.e1f+1.e-1f+1.e1L+1.e-1L; /* ^^^^ meta.number.float.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ +/* ^^^^ constant.numeric.value.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^^ constant.numeric.value.exponent.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^^^ meta.number.float.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ +/* ^^^^^ constant.numeric.value.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^^^ constant.numeric.value.exponent.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^^^ meta.number.float.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ +/* ^^^^ constant.numeric.value.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^^ constant.numeric.value.exponent.c++ */ /* ^ constant.numeric.suffix.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^^^^ meta.number.float.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ +/* ^^^^^ constant.numeric.value.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^^^ constant.numeric.value.exponent.c++ */ /* ^ constant.numeric.suffix.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^^^ meta.number.float.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ +/* ^^^^ constant.numeric.value.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^^ constant.numeric.value.exponent.c++ */ /* ^ constant.numeric.suffix.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^^^^ meta.number.float.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ +/* ^^^^^ constant.numeric.value.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^^^ constant.numeric.value.exponent.c++ */ /* ^ constant.numeric.suffix.c++ */ /* ^ punctuation.terminator - constant */ f = 1.+1.f+1.L+1..; /* ^^ meta.number.float.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ +/* ^^ constant.numeric.value.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^ meta.number.float.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ +/* ^^ constant.numeric.value.c++ */ /* ^ punctuation.separator.decimal.c++ */ /* ^ constant.numeric.suffix.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^ meta.number.float.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ +/* ^^ constant.numeric.value.c++ */ /* ^ punctuation.separator.decimal.c++ */ /* ^ constant.numeric.suffix.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^ keyword.operator.arithmetic.c */ /* ^ meta.number.integer.decimal.c++ */ /* ^ constant.numeric.value.c++ */ -/* ^^ invalid.illegal.syntax */ +/* ^^ invalid.illegal.syntax.c */ /* ^ punctuation.terminator - constant */ f = 1e1+1e1f+1e1L; /* ^^^ meta.number.float.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ -/* ^^ constant.numeric.value.exponent.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^^^ constant.numeric.value.c++ */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^^ meta.number.float.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ -/* ^^ constant.numeric.value.exponent.c++ */ +/* ^^^ constant.numeric.value.c++ */ /* ^ constant.numeric.suffix.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^^ meta.number.float.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ -/* ^^ constant.numeric.value.exponent.c++ */ +/* ^^^ constant.numeric.value.c++ */ /* ^ constant.numeric.suffix.c++ */ /* ^ punctuation.terminator - constant */ f = .1+.1e1+.1e-1+.1f+.1e1f+.1e-1f+.1L+.1e1L+.1e-1L; /* ^^ meta.number.float.decimal.c++ */ +/* ^^ constant.numeric.value.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^^ meta.number.float.decimal.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ -/* ^^ constant.numeric.value.exponent.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^^^^ constant.numeric.value.c++ */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^^^ meta.number.float.decimal.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ -/* ^^^ constant.numeric.value.exponent.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.value.c++ */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^ meta.number.float.decimal.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ +/* ^^ constant.numeric.value.c++ */ /* ^ constant.numeric.suffix.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^^^ meta.number.float.decimal.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ -/* ^^ constant.numeric.value.exponent.c++ */ +/* ^^^^ constant.numeric.value.c++ */ /* ^ constant.numeric.suffix.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^^^^ meta.number.float.decimal.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ -/* ^^^ constant.numeric.value.exponent.c++ */ +/* ^^^^^ constant.numeric.value.c++ */ /* ^ constant.numeric.suffix.c++ */ /* ^^^ meta.number.float.decimal.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ +/* ^^ constant.numeric.value.c++ */ /* ^ constant.numeric.suffix.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^^^ meta.number.float.decimal.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ -/* ^^ constant.numeric.value.exponent.c++ */ +/* ^^^^ constant.numeric.value.c++ */ /* ^ constant.numeric.suffix.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^^^^ meta.number.float.decimal.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ -/* ^^^ constant.numeric.value.exponent.c++ */ +/* ^^^^^ constant.numeric.value.c++ */ /* ^ constant.numeric.suffix.c++ */ /* ^ punctuation.terminator - constant */ @@ -1315,6 +1293,22 @@ f = 23e-1'000; /* ^^^^^^^^^ meta.number.float.decimal */ /* ^ punctuation.terminator - constant */ +units0 = 1.0suff+1.suff*.0suff/{1suff} +/* ^^^^^^^ meta.number.float.decimal */ +/* ^^^^ constant.numeric.suffix */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ meta.number.float.decimal */ +/* ^^^^ constant.numeric.suffix */ +/* ^ keyword.operator */ +/* ^^^^^^ meta.number.float.decimal */ +/* ^^^^ constant.numeric.suffix */ +/* ^ keyword.operator.arithmetic */ +/* ^ punctuation.section.block.begin */ +/* ^^^^^ meta.number.integer.decimal */ +/* ^ constant.numeric.value */ +/* ^^^^ constant.numeric.suffix */ +/* ^ punctuation.section.block.end */ + units1 = 134h + 123.45h; /* ^^^^ meta.number.integer.decimal */ /* ^ constant.numeric.suffix */ diff --git a/CSS/CSS.sublime-syntax b/CSS/CSS.sublime-syntax index 4b1ca31aa2..ce8bafbdd2 100644 --- a/CSS/CSS.sublime-syntax +++ b/CSS/CSS.sublime-syntax @@ -30,7 +30,7 @@ variables: # matching (?!{{escape}}) which also effects performance negative. break: (?=[[^-_[:alnum:]\\]&&[[:ascii:]]]|\Z) - # Identifiers + # Identifiers # https://www.w3.org/TR/css-syntax-3/#typedef-ident-token # https://www.w3.org/TR/css3-selectors/#lex ident: (?:{{custom_ident}}|{{generic_ident}}) @@ -52,13 +52,24 @@ variables: # Units # https://www.w3.org/TR/css3-values/#lengths - font_relative_lengths: (?i:em|ex|ch|rem) - viewport_percentage_lengths: (?i:vw|vh|vmin|vmax) - absolute_lengths: (?i:cm|mm|q|in|pt|pc|px|fr) - angle_units: (?i:deg|grad|rad|turn) - duration_units: (?i:s|ms) - frequency_units: (?i:Hz|kHz) - resolution_units: (?i:dpi|dpcm|dppx) + units: |- + (?x: + % + | {{absolute_lengths}} + | {{angle_units}} + | {{duration_units}} + | {{font_relative_lengths}} + | {{frequency_units}} + | {{resolution_units}} + | {{viewport_percentage_lengths}} + ) + font_relative_lengths: (?i:em|ex|ch|rem)\b + viewport_percentage_lengths: (?i:vw|vh|vmin|vmax)\b + absolute_lengths: (?i:cm|mm|q|in|pt|pc|px|fr)\b + angle_units: (?i:deg|grad|rad|turn)\b + duration_units: (?i:s|ms)\b + frequency_units: (?i:Hz|kHz)\b + resolution_units: (?i:dpi|dpcm|dppx)\b # Combinators # https://drafts.csswg.org/selectors-4/#combinators @@ -246,6 +257,14 @@ variables: | upper-alpha | upper-armenian | upper-latin | upper-roman ){{break}} + # @counter-style Property Names + # https://developer.mozilla.org/en-US/docs/Web/CSS/@counter-style + counter_style_property_names: |- + \b(?xi: + additive-symbols | negative | pad | prefix | range + | suffix | symbols (?# | fallback | speak-as | system ) + ){{break}} + # Predefined Counter Speak As Property Constants # https://drafts.csswg.org/css-counter-styles-3/#counter-style-speak-as counter_speak_as_constants: |- @@ -256,6 +275,15 @@ variables: counter_system_constants: |- \b(?xi: cyclic | numeric | alphabetic | symbolic | additive | fixed ){{break}} + # @font-face Property Names + # https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face + font_face_property_names: |- + \b(?xi: + ascent-override | descent-override | font-display | (?# font-family | ) src + | font-feature-settings | font-variation-settings | font-stretch | font-style + | font-weight | font-variant | line-gap-override | size-adjust | unicode-range + ){{break}} + # Page Margin Property Names # https://www.w3.org/TR/css-page-3/#margin-at-rule page_margin_property_names: |- @@ -265,90 +293,149 @@ variables: ){{break}} # Property names are sorted by popularity in descending order. - # Popularity data taken from https://www.chromestatus.com/metrics/css/popularity + # Note: + # 1) Popularity data taken from https://www.chromestatus.com/metrics/css/popularity + # 2) Properties starting with `alias-` or `webkit-` are removed property_names: |- \b(?xi: - display | width | background-color | height | position | font-family - | font-weight | font | top | opacity | cursor | background-image | right - | visibility | box-sizing | user-select | left | float | margin-left - | margin-top | line-height | padding-left | z-index | margin-bottom - | margin-right | margin | vertical-align | padding-top | white-space - | border-radius | padding-bottom | padding-right | padding | bottom | clear - | max-width | box-shadow | content | border-color | min-height | min-width - | font-style | border-width | border-collapse | background-size - | text-overflow | max-height | text-transform | text-shadow | text-indent - | border-style | overflow-y | list-style-type | word-wrap | border-spacing - | appearance | zoom | overflow-x | border-top-left-radius - | border-bottom-left-radius | border-top-color | pointer-events - | border-bottom-color | align-items | justify-content | letter-spacing - | border-top-right-radius | border-bottom-right-radius | border-right-width - | font-smoothing | border-bottom-width | border-right-color | direction - | border-top-width | src | border-left-color | border-left-width - | tap-highlight-color | table-layout | background-clip | word-break - | transform-origin | resize | filter | backface-visibility | text-rendering - | box-orient | transition-property | transition-duration | word-spacing - | quotes | outline-offset | animation-timing-function | animation-duration - | animation-name | transition-timing-function | border-bottom-style - | border-bottom | transition-delay | transition | unicode-bidi - | border-top-style | border-top | unicode-range | list-style-position - | orphans | outline-width | line-clamp | order | flex-direction | box-pack - | animation-fill-mode | outline-color | list-style-image | list-style - | touch-action | flex-grow | border-left-style | border-left - | animation-iteration-count | page-break-inside | box-flex | box-align - | page-break-after | animation-delay | widows | border-right-style - | border-right | flex-align | outline-style | outline | background-origin - | animation-direction | fill-opacity | background-attachment | flex-wrap - | transform-style | overflow-wrap | animation-play-state | animation - | will-change | box-ordinal-group | image-rendering | marks | mask-image - | flex-flow | background-position-y | stroke-width | background-position-x - | background-position | background-blend-mode | flex-shrink | flex-basis - | flex-order | flex-item-align | flex-line-pack | flex-negative | flex-pack - | flex-positive | flex-preferred-size | flex | user-drag | font-stretch - | column-count | empty-cells | align-self | caption-side | mask-size - | column-gap | mask-repeat | box-direction | font-feature-settings - | mask-position | align-content | object-fit | columns | text-fill-color - | clip-path | stop-color | font-kerning | page-break-before - | stroke-dasharray | size | fill-rule | border-image-slice | column-width - | break-inside | column-break-before | border-image-width| stroke-dashoffset - | border-image-repeat | border-image-outset | line-break | stroke-linejoin - | stroke-linecap | stroke-miterlimit | stroke-opacity | stroke - | shape-rendering | border-image-source | border-image | border | tab-size - | writing-mode | perspective-origin-y | perspective-origin-x - | perspective-origin | perspective | text-align-last | text-align - | clip-rule | clip | text-anchor | column-rule-color | box-decoration-break - | column-fill | fill | column-rule-style | mix-blend-mode - | text-emphasis-color | baseline-shift | dominant-baseline | page - | alignment-baseline | column-rule-width | column-rule | break-after - | font-variant-ligatures | transform-origin-y | transform-origin-x - | transform | object-position | break-before | column-span | isolation - | shape-outside | all | color-interpolation-filters | marker | marker-end - | marker-start | marker-mid | color-rendering | color-interpolation - | background-repeat-x | background-repeat-y | background-repeat - | background | mask-type | flood-color | flood-opacity | text-orientation - | mask-composite | text-emphasis-style | paint-order | lighting-color - | shape-margin | text-emphasis-position | text-emphasis - | shape-image-threshold | mask-clip | mask-origin | mask | font-variant-caps - | font-variant-alternates | font-variant-east-asian | font-variant-numeric - | font-variant-position | font-variant | font-size-adjust | font-size - | font-language-override | font-display | font-synthesis | font - | line-box-contain | text-justify | text-decoration-color - | text-decoration-style | text-decoration-line | text-decoration - | text-underline-position | grid-template-rows | grid-template-columns - | grid-template-areas | grid-template | rotate | scale | translate - | scroll-behavior | grid-column-start | grid-column-end | grid-column-gap - | grid-row-start | grid-row-end | grid-auto-rows | grid-area - | grid-auto-flow | grid-auto-columns | image-orientation | hyphens - | overflow-scrolling | overflow | color-profile | kerning | nbsp-mode - | color | image-resolution | grid-row-gap | grid-row | grid-column - | blend-mode | azimuth | pause-after | pause-before | pause | pitch-range - | pitch | text-height | system | negative | prefix | suffix | range | pad - | fallback | additive-symbols | symbols | speak-as | speak | grid-gap | grid - | justify-items | justify-self + width | height | display | position | padding | border | margin | top + | left | margin-top | color | font-size | background-color | text-align + | opacity | font-weight | font-family | background | overflow | line-height + | float | box-sizing | text-decoration | z-index | cursor | margin-left + | border-radius | vertical-align | margin-bottom | margin-right | right + | padding-top | padding-left | max-width | box-shadow | bottom | content + | padding-right | transform | white-space | min-height | padding-bottom + | background-image | border-bottom | visibility | outline + | background-position | min-width | transition | border-top | border-color + | background-repeat | text-transform | background-size | max-height + | list-style | clear | font-style | justify-content | border-left + | align-items | border-right | border-width | font | text-overflow + | overflow-y | pointer-events | border-style | flex-direction | animation + | overflow-x | letter-spacing | flex | word-wrap | flex-wrap | fill + | transform-origin | list-style-type | border-collapse + | border-top-left-radius | border-bottom-left-radius | user-select | clip + | text-shadow | border-bottom-right-radius | word-break | flex-grow + | border-top-right-radius | border-bottom-color | border-top-color + | flex-shrink | align-self | text-rendering | animation-timing-function + | direction | background-clip | zoom | border-spacing | text-indent + | outline-offset | border-left-color | transition-property + | border-right-color | animation-name | stroke | touch-action + | animation-duration | transition-delay | filter | overflow-wrap + | animation-delay | border-bottom-width | variable | font-variant + | flex-basis | transition-duration | border-top-width | animation-fill-mode + | object-fit | transition-timing-function | will-change | outline-width + | order | outline-style | stroke-width | border-right-width | align-content + | resize | table-layout | appearance | animation-iteration-count + | border-left-width | flex-flow | stroke-dashoffset | stroke-dasharray + | backface-visibility | unicode-bidi | border-bottom-style + | text-size-adjust | border-top-style | animation-direction | word-spacing + | contain | speak | grid-template-columns | font-feature-settings + | perspective | list-style-position | clip-path | image-rendering + | font-display | transform-style | border-left-style | outline-color + | background-position-x | background-attachment | border-right-style + | margin-block-end | background-origin | animation-play-state | hyphens + | stroke-linecap | font-stretch | object-position | page-break-inside + | column-gap | counter-reset | counter-increment | background-position-y + | margin-block-start | size | grid-template-rows | column-count | quotes + | padding-inline-end | text-decoration-skip | border-image | all + | page-break-after | fill-opacity | font-variant-ligatures + | scroll-boundary-behavior | empty-cells | list-style-image | justify-self + | overflow-anchor | padding-inline-start | grid-gap | text-decoration-color + | margin-inline-start | caret-color | grid-column-gap | aspect-ratio + | stroke-opacity | margin-inline-end | grid-column | perspective-origin + | caption-side | columns | scroll-behavior | justify-items | line-break + | grid-row-gap | column-width | orphans | widows | backdrop-filter + | mix-blend-mode | tab-size | stop-color | column-rule | grid-area + | stroke-miterlimit | text-align-last | page-break-before + | grid-column-start | border-image-slice | border-image-repeat + | text-decoration-style | border-image-width | grid-column-end | grid-row + | scroll-snap-align | scroll-snap-type | border-image-outset + | text-decoration-line | column-fill | border-inline-end-width + | border-inline-start-width | grid-row-start | stroke-linejoin + | inset-inline-end | inset-inline-start | grid-auto-flow | grid-auto-rows + | grid-template-areas | border-image-source | fill-rule | font-kerning + | grid-row-end | font-variant-numeric | break-inside | shape-outside + | color-scheme | shape-image-threshold | scroll-boundary-behavior-y + | text-decoration-skip-ink | page | isolation | background-blend-mode + | page-orientation | inset | gap | scroll-snap-margin | column-rule-color + | place-items | column-rule-style | shape-rendering | content-visibility + | grid-auto-columns | scroll-boundary-behavior-x | writing-mode | clip-rule + | font-variant-caps | scroll-padding | text-anchor | mask | row-gap + | background-repeat-x | intrinsic-size | text-underline-position + | font-variant-east-asian | column-span | vector-effect | dominant-baseline + | stop-opacity | break-after | grid-template | break-before | mask-type + | scroll-snap-stop | border-inline-start-color | border-inline-end-color | r + | alignment-baseline | text-decoration-thickness | column-rule-width | d + | image-orientation | rx | text-orientation | cx | baseline-shift + | scroll-padding-top | padding-block-start | padding-block-end | cy + | min-inline-size | inline-size | background-repeat-y | shape-margin + | block-size | marker | min-block-size | paint-order | ry + | scroll-snap-margin-top | border-block-end-color | border-block-end-width + | border-inline-start-style | border-inline-end-style + | border-block-end-style | font-variation-settings + | border-block-start-width | border-block-start-color + | border-block-start-style | place-content | y | x | ruby-position + | text-combine-upright | color-interpolation-filters | color-interpolation + | color-rendering | transform-box | marker-end | flood-color | marker-start + | marker-mid | flood-opacity | lighting-color | forced-color-adjust + | buffered-rendering | place-self | offset-path | scroll-padding-left + | offset-distance | offset-rotate | text-underline-offset | max-inline-size + | max-block-size | border-inline-end | scroll-snap-margin-inline-start + | scroll-padding-inline-start | scroll-snap-margin-block-end + | scroll-snap-margin-block-start | scroll-padding-block-end + | scroll-snap-margin-inline-end | scroll-padding-block-start + | scroll-padding-inline-end | font-optical-sizing | grid + | scroll-padding-bottom | scroll-snap-margin-left | inset-block-end + | overscroll-behavior-block | overscroll-behavior-inline | inset-block-start + | scroll-snap-margin-right | scroll-padding-right + | scroll-snap-margin-bottom | border-inline-start | margin-inline + | border-end-start-radius | border-end-end-radius | margin-block + | border-start-start-radius | border-start-end-radius | padding-inline + | counter-set | padding-block | border-block-end | offset + | border-block-start | inset-inline | inset-block | scroll-snap-margin-block + | scroll-padding-inline | scroll-padding-block | scroll-snap-margin-inline + | border-block | offset-rotation | border-inline | border-block-color + | border-inline-width | border-inline-color | border-block-style + | border-block-width | border-inline-style | motion | motion-offset + | motion-path | font-size-adjust | text-justify | scale | scrollbar-gutter + | animation-timeline | rotate | translate | snap-height | math-style + | math-shift | math-depth | offset-anchor | offset-position + | glyph-orientation-vertical | internal-callback | text-line-through + | text-line-through-color | text-line-through-mode | text-line-through-style + | text-line-through-width | text-overline | text-overline-color + | text-overline-mode | text-overline-style | text-overline-width + | text-underline | text-underline-color | text-underline-mode + | text-underline-style | text-underline-width | shape-inside | shape-padding + | enable-background | color-profile | glyph-orientation-horizontal | kerning + | image-resolution | max-zoom | min-zoom | orientation | user-zoom + | mask-source-type | touch-action-delay | scroll-blocks-on | motion-rotation + | scroll-snap-points-x | scroll-snap-points-y | scroll-snap-coordinate + | scroll-snap-destination | apply-at-rule | viewport-fit | overflow-block + | syntax | content-size | intrinsic-block-size | intrinsic-height + | intrinsic-inline-size | intrinsic-width | render-subtree + | origin-trial-test-property | subtree-visibility + | math-superscript-shift-style | start + # END OF QUERY RESULTS + # BEGIN OF legacy properties which existed before the last query + | box-direction | line-box-contain | mask-image | mask-origin | flex-order + | font-synthesis | line-clamp | flex-negative | blend-mode + | font-variant-position | flex-align | column-break-before + | flex-item-align | azimuth | user-drag | mask-repeat | box-flex + | flex-preferred-size | font-language-override | box-align + | text-emphasis-color | box-ordinal-group | mask-composite + | transform-origin-y | pause | tap-highlight-color | text-fill-color + | text-emphasis-style | transform-origin-x | text-emphasis-position + | box-pack | box-decoration-break | box-orient + | text-emphasis | mask-clip | nbsp-mode | pause-after | pitch + | text-height | mask-position | flex-line-pack | perspective-origin-x + | mask-size | font-variant-alternates | perspective-origin-y + | font-smoothing | overflow-scrolling | flex-positive | pitch-range ){{break}} property_value_constants: |- (?x: - {{font_property_constants}} + {{font_display_constants}} + | {{font_property_constants}} | {{font_size_constants}} | {{font_style_constants}} | {{unsorted_property_constants}} @@ -365,7 +452,7 @@ variables: | avoid(-column|-page|-region)? | background(-color|-image|-position|-size)? | backwards|balance|baseline|below|bevel|bicubic|bidi-override|blink - | block(-line-height)? + | block-line-height | blur | border(-bottom|-left|-right|-top)?-(color|radius|width|style) | border-(bottom|top)-(left|right)-radius @@ -512,6 +599,12 @@ variables: | zoom(-in|-out)? ){{break}} + # https://www.w3.org/TR/css-fonts-4/#font-display-desc + font_display_constants: |- + \b(?xi: + block | swap | fallback | optional + ){{break}} + # Generic Font Families font_family_constants: |- \b(?xi: @@ -528,13 +621,13 @@ variables: # https://www.w3.org/TR/CSS22/fonts.html#font-shorthand font_property_constants: |- \b(?xi: - caption | icon | menu | message-box | small-caption | status-bar + caption | icon | menu | message-box | small-caption | status-bar ){{break}} # https://www.w3.org/TR/CSS22/fonts.html#font-size-props font_size_constants: |- \b(?xi: - larger | large | medium | small | smaller | x{1,2}-(?: large | small ) + larger | large | medium | small | smaller | x{1,2}-(?: large | small ) ){{break}} # https://www.w3.org/TR/CSS22/fonts.html#font-boldness @@ -542,7 +635,7 @@ variables: # https://www.w3.org/TR/CSS22/fonts.html#small-caps font_style_constants: |- \b(?xi: - normal | bold | bolder | lighter | italic | oblique | small-caps + normal | bold | bolder | lighter | italic | oblique | small-caps ){{break}} ############################################################################### @@ -622,16 +715,35 @@ contexts: at-counter-style-content: - meta_scope: meta.at-rule.counter-style.css - - include: rule-list + - match: \{ + scope: punctuation.section.block.begin.css + push: at-counter-style-block-content - include: at-counter-style-names - include: at-rule-end + at-counter-style-block-content: + - meta_scope: meta.property-list.css meta.block.css + - include: block-end2 + - include: comments + - include: at-counter-style-property-names + - include: property-values + - include: rule-terminators + - include: illegal-blocks + - include: illegal-groups + at-counter-style-names: - match: '{{counter_style_illegal_names}}' scope: invalid.illegal.identifier.css - match: '{{ident}}' scope: entity.other.counter-style-name.css + at-counter-style-property-names: + - include: counter-style-fallback-properties + - include: counter-style-system-properties + - include: counter-style-speak-as-properties + - match: '{{counter_style_property_names}}' + scope: meta.property-name.css support.type.property-name.css + # @custom-media # https://?? at-custom-media: @@ -683,9 +795,28 @@ contexts: at-font-face-content: - meta_scope: meta.at-rule.font-face.css - - include: rule-list + - match: \{ + scope: punctuation.section.block.begin.css + push: at-font-face-block-content - include: at-rule-end + at-font-face-block-content: + - meta_scope: meta.property-list.css meta.block.css + - include: block-end2 + - include: comments + - include: at-font-face-property-names + - include: property-values + - include: rule-terminators + - include: illegal-blocks + - include: illegal-groups + + at-font-face-property-names: + - match: \b(?i:font-family){{break}} + scope: meta.property-name.css support.type.property-name.css + push: font-property-value + - match: '{{font_face_property_names}}' + scope: meta.property-name.css support.type.property-name.css + # @import # https://www.w3.org/TR/css-cascade-4/#at-ruledef-import at-import: @@ -954,6 +1085,7 @@ contexts: | (?: device- )? (?: height | width | aspect-ratio | pixel-ratio ) ) | (?:any-)?(?: pointer | hover ) + | prefers-(?: reduced-motion | color-scheme ) | display-mode | grid | orientation | scan | scripting | overflow-(?: block | inline ) ) @@ -984,6 +1116,8 @@ contexts: | optional-paged | paged | scroll # pointer: | coarse | fine + # prefers-color-scheme: + | dark | light # scan: | interlace | progressive # scripting: @@ -1013,7 +1147,7 @@ contexts: ###[ SELECTORS ]############################################################### selectors: - - match: (?=[:.*#[:alpha:]\[]) + - match: (?=[:.*#[:alpha:]\[]|{{combinators}}) push: selector-content selector-content: @@ -1231,7 +1365,7 @@ contexts: # Functional Pseudo Classes with selector list pseudo-class-function-with-selector-args: - - match: (?i:matches|not|has)(?=\() + - match: (?i:matches|is|where|not|has)(?=\() scope: meta.function-call.identifier.css entity.other.pseudo-class.css set: - meta_include_prototype: false @@ -1321,9 +1455,6 @@ contexts: - include: vendor-prefixes # specific properties with special treatment - include: counter-property - - include: counter-style-fallback-property - - include: counter-style-system-property - - include: counter-style-speak-as-property - include: font-property # common properties - include: builtin-property @@ -1439,10 +1570,10 @@ contexts: # Counter Style Fallback # https://drafts.csswg.org/css-counter-styles-3/#counter-style-fallback - counter-style-fallback-property: + counter-style-fallback-properties: - match: \b(?i:fallback){{break}} - scope: support.type.property-name.css - set: counter-style-fallback-property-value + scope: meta.property-name.css support.type.property-name.css + push: counter-style-fallback-property-value counter-style-fallback-property-value: - match: ':' @@ -1467,10 +1598,10 @@ contexts: # Counter Style System # https://drafts.csswg.org/css-counter-styles-3/#counter-style-system - counter-style-system-property: + counter-style-system-properties: - match: \b(?i:system){{break}} - scope: support.type.property-name.css - set: counter-style-system-property-value + scope: meta.property-name.css support.type.property-name.css + push: counter-style-system-property-value counter-style-system-property-value: - match: ':' @@ -1502,10 +1633,10 @@ contexts: # Counter Style Speak As # https://drafts.csswg.org/css-counter-styles-3/#counter-style-speak-as - counter-style-speak-as-property: + counter-style-speak-as-properties: - match: \b(?i:speak-as){{break}} - scope: support.type.property-name.css - set: counter-style-speak-as-property-value + scope: meta.property-name.css support.type.property-name.css + push: counter-style-speak-as-property-value counter-style-speak-as-property-value: - match: ':' @@ -1701,6 +1832,7 @@ contexts: - meta_scope: meta.function-call.arguments.css meta.group.css - include: function-arguments-common - include: comma-delimiters + - include: calc-functions - include: percentage-constants - include: scalar-constants @@ -1718,6 +1850,7 @@ contexts: - meta_scope: meta.function-call.arguments.css meta.group.css - include: function-arguments-common - include: comma-delimiters + - include: calc-functions - include: angle-constants - include: percentage-constants - include: scalar-constants @@ -1734,6 +1867,7 @@ contexts: - meta_scope: meta.function-call.arguments.css meta.group.css - include: function-arguments-common - include: comma-delimiters + - include: calc-functions - include: percentage-constants - include: scalar-constants @@ -1749,6 +1883,7 @@ contexts: - meta_scope: meta.function-call.arguments.css meta.group.css - include: function-arguments-common - include: comma-delimiters + - include: calc-functions - include: color-adjuster-functions # must be included before `color-values` - include: color-values - include: percentage-constants @@ -1766,6 +1901,7 @@ contexts: - meta_scope: meta.function-call.arguments.css meta.group.css - include: function-arguments-common - include: comma-delimiters + - include: calc-functions - include: color-adjuster-functions # must be included before `color-values` - include: color-values - include: angle-constants @@ -1784,6 +1920,7 @@ contexts: set: - meta_scope: meta.function-call.arguments.css meta.group.css - include: function-arguments-common + - include: calc-functions - include: color-adjuster-operators - include: percentage-constants - include: scalar-constants @@ -1798,6 +1935,7 @@ contexts: set: - meta_scope: meta.function-call.arguments.css meta.group.css - include: function-arguments-common + - include: calc-functions - include: color-adjuster-operators - include: angle-constants @@ -1811,6 +1949,7 @@ contexts: set: - meta_scope: meta.function-call.arguments.css meta.group.css - include: function-arguments-common + - include: calc-functions - include: color-adjuster-operators - include: percentage-constants @@ -1826,6 +1965,7 @@ contexts: set: - meta_scope: meta.function-call.arguments.css meta.group.css - include: function-arguments-common + - include: calc-functions - include: percentage-constants # blend(), blenda() - Not yet implemented by browsers @@ -1838,10 +1978,11 @@ contexts: set: - meta_scope: meta.function-call.arguments.css meta.group.css - include: function-arguments-common - - match: \b(?i:rgb|hsl|hwb){{break}} - scope: keyword.other.color-space.css + - include: calc-functions - include: color-values - include: percentage-constants + - match: \b(?i:rgb|hsl|hwb){{break}} + scope: keyword.other.color-space.css ###[ BUILTIN FILTER FUNCTIONS ]################################################ @@ -1876,6 +2017,7 @@ contexts: set: - meta_scope: meta.function-call.arguments.css meta.group.css - include: function-arguments-common + - include: calc-functions - include: length-constants # brightness(), contrast(), grayscale(), invert(), opacity(), saturate(), sepia() @@ -1889,6 +2031,7 @@ contexts: set: - meta_scope: meta.function-call.arguments.css meta.group.css - include: function-arguments-common + - include: calc-functions - include: percentage-constants - include: scalar-constants @@ -1903,6 +2046,7 @@ contexts: set: - meta_scope: meta.function-call.arguments.css meta.group.css - include: function-arguments-common + - include: calc-functions - include: color-values - include: length-constants @@ -1917,6 +2061,7 @@ contexts: set: - meta_scope: meta.function-call.arguments.css meta.group.css - include: function-arguments-common + - include: calc-functions - include: angle-constants ###[ BUILTIN GRID FUNCTIONS ]################################################## @@ -1934,6 +2079,7 @@ contexts: - meta_scope: meta.function-call.arguments.css meta.group.css - include: function-arguments-common - include: comma-delimiters + - include: calc-functions - include: grid-constants - include: length-constants - include: percentage-constants @@ -1953,6 +2099,7 @@ contexts: - include: comma-delimiters - match: \b(?i:auto-fill|auto-fit){{break}} scope: keyword.other.grid.css + - include: calc-functions - include: minmax-functions - include: grid-constants - include: length-constants @@ -2024,10 +2171,33 @@ contexts: # Gradient Functions # https://drafts.csswg.org/css-images-3/#gradients gradient-functions: + # conic-gradient() + # https://developer.mozilla.org/en-US/docs/Web/CSS/conic-gradient() + # repeating-conic-gradient() + # https://developer.mozilla.org/en-US/docs/Web/CSS/repeating-conic-gradient() + - match: \b((?:repeating-)?conic-gradient)(?=\() + scope: meta.function-call.identifier.css support.function.gradient.css + push: + - meta_include_prototype: false + - match: \( + scope: punctuation.section.group.begin.css + set: + - meta_scope: meta.function-call.arguments.css meta.group.css + - include: function-arguments-common + - include: comma-delimiters + - match: \b(?i:at|from){{break}} + scope: keyword.other.gradient.css + - match: \b(?i:bottom|center|left|right|top){{break}} + scope: support.constant.property-value.css + - include: color-values + - include: angle-constants + - include: length-constants + - include: percentage-constants + # linear-gradient() - # https://drafts.csswg.org/css-images-3/#linear-gradients + # https://developer.mozilla.org/en-US/docs/Web/CSS/linear-gradient() # repeating-linear-gradient() - # https://drafts.csswg.org/css-images-3/#funcdef-repeating-linear-gradient + # https://developer.mozilla.org/en-US/docs/Web/CSS/repeating-linear-gradient() - match: \b((?:repeating-)?linear-gradient)(?=\() scope: meta.function-call.identifier.css support.function.gradient.css push: @@ -2040,7 +2210,7 @@ contexts: - include: comma-delimiters - match: \b(?i:to){{break}} scope: keyword.other.gradient.css - - match: \b(?i:top|right|bottom|left){{break}} + - match: \b(?i:bottom|left|right|top){{break}} scope: support.constant.property-value.css - include: color-values - include: angle-constants @@ -2048,9 +2218,9 @@ contexts: - include: percentage-constants # radial-gradient() - # https://drafts.csswg.org/css-images-3/#radial-gradients + # https://developer.mozilla.org/en-US/docs/Web/CSS/radial-gradient() # repeating-radial-gradient() - # https://drafts.csswg.org/css-images-3/#funcdef-repeating-radial-gradient + # https://developer.mozilla.org/en-US/docs/Web/CSS/repeating-radial-gradient() - match: \b((?:repeating-)?radial-gradient)(?=\() scope: meta.function-call.identifier.css support.function.gradient.css push: @@ -2063,7 +2233,7 @@ contexts: - include: comma-delimiters - match: \b(?i:at|circle|ellipse){{break}} scope: keyword.other.gradient.css - - match: \b(?i:left|center|right|top|bottom|(closest|farthest)-(corner|side)){{break}} + - match: \b(?i:bottom|center|left|right|top|(closest|farthest)-(corner|side)){{break}} scope: support.constant.property-value.css - include: color-values - include: length-constants @@ -2087,6 +2257,7 @@ contexts: - include: function-arguments-common - match: \b(?i:auto){{break}} scope: support.constant.property-value.css + - include: calc-functions - include: length-constants # inset() @@ -2102,6 +2273,7 @@ contexts: - include: function-arguments-common - match: \b(?i:round){{break}} scope: keyword.other.shape.css + - include: calc-functions - include: length-constants - include: percentage-constants @@ -2122,6 +2294,7 @@ contexts: scope: keyword.other.shape.css - match: \b(?i:top|right|bottom|left|center|closest-side|farthest-side){{break}} scope: support.constant.property-value.css + - include: calc-functions - include: length-constants - include: percentage-constants @@ -2160,6 +2333,7 @@ contexts: - meta_scope: meta.function-call.arguments.css meta.group.css - include: function-arguments-common - include: comma-delimiters + - include: calc-functions - include: scalar-constants # steps() @@ -2174,6 +2348,7 @@ contexts: - meta_scope: meta.function-call.arguments.css meta.group.css - include: function-arguments-common - include: comma-delimiters + - include: calc-functions - match: \b(?i:end|middle|start){{break}} scope: keyword.other.timing.css - include: scalar-integer-constants @@ -2195,6 +2370,7 @@ contexts: - meta_scope: meta.function-call.arguments.css meta.group.css - include: function-arguments-common - include: comma-delimiters + - include: calc-functions - include: scalar-constants # transform functions with comma separated or types @@ -2209,6 +2385,7 @@ contexts: - meta_scope: meta.function-call.arguments.css meta.group.css - include: function-arguments-common - include: comma-delimiters + - include: calc-functions - include: percentage-constants - include: length-constants - include: scalar-constants @@ -2224,6 +2401,7 @@ contexts: set: - meta_scope: meta.function-call.arguments.css meta.group.css - include: function-arguments-common + - include: calc-functions - include: percentage-constants - include: length-constants - include: scalar-constants @@ -2239,6 +2417,7 @@ contexts: set: - meta_scope: meta.function-call.arguments.css meta.group.css - include: function-arguments-common + - include: calc-functions - include: angle-constants # transform functions with comma separated types @@ -2253,6 +2432,7 @@ contexts: - meta_scope: meta.function-call.arguments.css meta.group.css - include: function-arguments-common - include: comma-delimiters + - include: calc-functions - include: angle-constants # transform functions with a single type @@ -2266,6 +2446,7 @@ contexts: set: - meta_scope: meta.function-call.arguments.css meta.group.css - include: function-arguments-common + - include: calc-functions - include: length-constants # transform functions with a comma separated or types @@ -2280,6 +2461,7 @@ contexts: - meta_scope: meta.function-call.arguments.css meta.group.css - include: function-arguments-common - include: comma-delimiters + - include: calc-functions - include: angle-constants - include: scalar-constants @@ -2295,6 +2477,7 @@ contexts: - meta_scope: meta.function-call.arguments.css meta.group.css - include: function-arguments-common - include: comma-delimiters + - include: calc-functions - include: scalar-constants ###[ BUILTIN VALUE FUNCTIONS ]################################################# @@ -2326,25 +2509,16 @@ contexts: - meta_scope: meta.function-call.arguments.css meta.group.css - include: function-arguments-common - include: comma-delimiters - - match: |- - \b(?x: - {{font_relative_lengths}} - | {{viewport_percentage_lengths}} - | {{absolute_lengths}} - | {{angle_units}} - | {{duration_units}} - | {{frequency_units}} - | {{resolution_units}} - ){{break}} + - match: '{{units}}' scope: keyword.other.unit.css - include: color-values - include: common-constants - include: generic-font-names - include: numeric-constants - # calc() - # https://www.w3.org/TR/css3-values/#funcdef-calc calc-functions: + # calc() + # https://www.w3.org/TR/css3-values/#funcdef-calc - match: \b(?i:calc)(?=\() scope: meta.function-call.identifier.css support.function.calc.css push: @@ -2355,6 +2529,23 @@ contexts: - meta_scope: meta.function-call.arguments.css meta.group.css - include: calc-function-arguments-content + # clamp() + # https://developer.mozilla.org/en-US/docs/Web/CSS/clamp() + # max() + # https://developer.mozilla.org/en-US/docs/Web/CSS/max() + # min() + # https://developer.mozilla.org/en-US/docs/Web/CSS/min() + - match: \b(?i:clamp|max|min)(?=\() + scope: meta.function-call.identifier.css support.function.calc.css + push: + - meta_include_prototype: false + - match: \( + scope: punctuation.section.group.begin.css + set: + - meta_scope: meta.function-call.arguments.css meta.group.css + - include: calc-function-arguments-content + - include: comma-delimiters + calc-function-arguments-content: - meta_scope: meta.group.css - match: \) @@ -2368,7 +2559,21 @@ contexts: - include: attr-functions - include: calc-functions - include: var-functions - - include: numeric-constants + - match: '{{float}}({{units}})?' + scope: meta.number.float.decimal.css + captures: + 1: keyword.operator.arithmetic.css + 2: constant.numeric.value.css + 3: punctuation.separator.decimal.css + 4: constant.numeric.suffix.css + push: maybe-illegal-operator + - match: '{{integer}}({{units}})?' + scope: meta.number.integer.decimal.css + captures: + 1: keyword.operator.arithmetic.css + 2: constant.numeric.value.css + 3: constant.numeric.suffix.css + push: maybe-illegal-operator - match: '[-+*/]' scope: keyword.operator.arithmetic.css @@ -2385,6 +2590,7 @@ contexts: - meta_scope: meta.function-call.arguments.css meta.group.css - include: function-arguments-common - include: comma-delimiters + - include: calc-functions - include: vendor-prefixes - include: color-values - include: common-constants @@ -2454,6 +2660,8 @@ contexts: set: - meta_scope: meta.function-call.arguments.css meta.group.css - include: function-arguments-common + - include: comma-delimiters + - include: calc-functions - include: quoted-strings - include: numeric-constants - include: other-constants @@ -2518,13 +2726,19 @@ contexts: # https://www.w3.org/TR/css3-values/#numeric-constantss numeric-constants: - - include: angle-constants - - include: frequency-constants - - include: length-constants - - include: resolution-constants - - include: percentage-constants - - include: time-constants - - include: scalar-constants + - match: '{{float}}({{units}})?' + scope: meta.number.float.decimal.css + captures: + 1: keyword.operator.arithmetic.css + 2: constant.numeric.value.css + 3: punctuation.separator.decimal.css + 4: constant.numeric.suffix.css + - match: '{{integer}}({{units}})?' + scope: meta.number.integer.decimal.css + captures: + 1: keyword.operator.arithmetic.css + 2: constant.numeric.value.css + 3: constant.numeric.suffix.css # Make sure `scalar-constants` is included after any other numeric values # as `scalar-constants` will consume all numeric values. @@ -2539,7 +2753,6 @@ contexts: 1: keyword.operator.arithmetic.css 2: constant.numeric.value.css 3: punctuation.separator.decimal.css - push: maybe-illegal-operator scalar-integer-constants: - match: '{{integer}}' @@ -2547,7 +2760,6 @@ contexts: captures: 1: keyword.operator.arithmetic.css 2: constant.numeric.value.css - push: maybe-illegal-operator scalar-rational-constants: - match: \d+(/)\d+ @@ -2556,78 +2768,68 @@ contexts: 1: keyword.operator.arithmetic.css angle-constants: - - match: '{{float}}({{angle_units}})\b' + - match: '{{float}}({{angle_units}})' scope: meta.number.float.decimal.css captures: 1: keyword.operator.arithmetic.css 2: constant.numeric.value.css 3: punctuation.separator.decimal.css 4: constant.numeric.suffix.css - push: maybe-illegal-operator - - match: '{{integer}}({{angle_units}})\b' + - match: '{{integer}}({{angle_units}})' scope: meta.number.integer.decimal.css captures: 1: keyword.operator.arithmetic.css 2: constant.numeric.value.css 3: constant.numeric.suffix.css - push: maybe-illegal-operator - match: \b0\b(?!%) scope: meta.number.integer.decimal.css constant.numeric.value.css - push: maybe-illegal-operator frequency-constants: - - match: '{{float}}({{frequency_units}})\b' + - match: '{{float}}({{frequency_units}})' scope: meta.number.float.decimal.css captures: 1: keyword.operator.arithmetic.css 2: constant.numeric.value.css 3: punctuation.separator.decimal.css 4: constant.numeric.suffix.css - push: maybe-illegal-operator - - match: '{{integer}}({{frequency_units}})\b' + - match: '{{integer}}({{frequency_units}})' scope: meta.number.integer.decimal.css captures: 1: keyword.operator.arithmetic.css 2: constant.numeric.value.css 3: constant.numeric.suffix.css - push: maybe-illegal-operator length-constants: - - match: '{{float}}({{font_relative_lengths}}|{{viewport_percentage_lengths}}|{{absolute_lengths}})\b' + - match: '{{float}}({{font_relative_lengths}}|{{viewport_percentage_lengths}}|{{absolute_lengths}})' scope: meta.number.float.decimal.css captures: 1: keyword.operator.arithmetic.css 2: constant.numeric.value.css 3: punctuation.separator.decimal.css 4: constant.numeric.suffix.css - push: maybe-illegal-operator - - match: '{{integer}}({{font_relative_lengths}}|{{viewport_percentage_lengths}}|{{absolute_lengths}})\b' + - match: '{{integer}}({{font_relative_lengths}}|{{viewport_percentage_lengths}}|{{absolute_lengths}})' scope: meta.number.integer.decimal.css captures: 1: keyword.operator.arithmetic.css 2: constant.numeric.value.css 3: constant.numeric.suffix.css - push: maybe-illegal-operator - match: \b0\b(?!%) scope: meta.number.integer.decimal.css constant.numeric.value.css - push: maybe-illegal-operator resolution-constants: - - match: '{{float}}({{resolution_units}})\b' + - match: '{{float}}({{resolution_units}})' scope: meta.number.float.decimal.css captures: 1: keyword.operator.arithmetic.css 2: constant.numeric.value.css 3: punctuation.separator.decimal.css 4: constant.numeric.suffix.css - push: maybe-illegal-operator - - match: '{{integer}}({{resolution_units}})\b' + - match: '{{integer}}({{resolution_units}})' scope: meta.number.integer.decimal.css captures: 1: keyword.operator.arithmetic.css 2: constant.numeric.value.css 3: constant.numeric.suffix.css - push: maybe-illegal-operator percentage-constants: - match: '{{float}}(%)' @@ -2637,31 +2839,27 @@ contexts: 2: constant.numeric.value.css 3: punctuation.separator.decimal.css 4: constant.numeric.suffix.css - push: maybe-illegal-operator - match: '{{integer}}(%)' scope: meta.number.integer.decimal.css captures: 1: keyword.operator.arithmetic.css 2: constant.numeric.value.css 3: constant.numeric.suffix.css - push: maybe-illegal-operator time-constants: - - match: '{{float}}({{duration_units}})\b' + - match: '{{float}}({{duration_units}})' scope: meta.number.float.decimal.css captures: 1: keyword.operator.arithmetic.css 2: constant.numeric.value.css 3: punctuation.separator.decimal.css 4: constant.numeric.suffix.css - push: maybe-illegal-operator - - match: '{{integer}}({{duration_units}})\b' + - match: '{{integer}}({{duration_units}})' scope: meta.number.integer.decimal.css captures: 1: keyword.operator.arithmetic.css 2: constant.numeric.value.css 3: constant.numeric.suffix.css - push: maybe-illegal-operator # Unicode Ranges # https://www.w3.org/TR/css-syntax-3/#urange @@ -2820,7 +3018,7 @@ contexts: scope: constant.character.escape.url.css captures: 1: punctuation.definition.escape.css - - match: '[/&?]|://' + - match: '[/&?#]|://' scope: punctuation.separator.path.css ###[ OPERATORS ]############################################################### diff --git a/CSS/Completion Rules.tmPreferences b/CSS/Completion Rules.tmPreferences deleted file mode 100644 index 42f1748b04..0000000000 --- a/CSS/Completion Rules.tmPreferences +++ /dev/null @@ -1,12 +0,0 @@ - - - - scope - source.css meta.selector - settings - - cancelCompletion - .* - - - diff --git a/CSS/Default.sublime-keymap b/CSS/Default.sublime-keymap index ba5b5d3617..1ccfca4d14 100644 --- a/CSS/Default.sublime-keymap +++ b/CSS/Default.sublime-keymap @@ -73,6 +73,26 @@ ] }, + // Expand /*|*/ to /* | */ when space is pressed + { "keys": [" "], "command": "insert_snippet", "args": {"contents": " $0 "}, "context": + [ + { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, + { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, + { "key": "selector", "operator": "equal", "operand": "source.css comment", "match_all": true }, + { "key": "preceding_text", "operator": "regex_contains", "operand": "/\\*$", "match_all": true }, + { "key": "following_text", "operator": "regex_contains", "operand": "^\\*/", "match_all": true } + ] + }, + { "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Left Right.sublime-macro"}, "context": + [ + { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, + { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, + { "key": "selector", "operator": "equal", "operand": "source.css comment", "match_all": true }, + { "key": "preceding_text", "operator": "regex_contains", "operand": "/\\* $", "match_all": true }, + { "key": "following_text", "operator": "regex_contains", "operand": "^ \\*/", "match_all": true } + ] + }, + // Auto-pair double quotes (also if followed by comma or semicolon) // Example: key: |; -> key: "|"; { "keys": ["\""], "command": "insert_snippet", "args": {"contents": "\"$0\""}, "context": diff --git a/CSS/css_completions.py b/CSS/css_completions.py index 2fbb9400e1..d85caaee17 100644 --- a/CSS/css_completions.py +++ b/CSS/css_completions.py @@ -126,6 +126,14 @@ def get_properties(): 'generic_name': [ 'serif', 'sans-serif', 'cursive', 'fantasy', 'monospace' ], + 'gradient': [ + ['conic-gradient()', 'conic-gradient($1)'], + ['linear-gradient()', 'linear-gradient($1)'], + ['radial-gradient()', 'radial-gradient($1)'], + ['repeating-conic-gradient()', 'repeating-conic-gradient($1)'], + ['repeating-linear-gradient()', 'repeating-linear-gradient($1)'], + ['repeating-radial-gradient()', 'repeating-radial-gradient($1)'] + ], 'grid': [ ['repeat()', 'repeat(${1:2}, ${2:1fr})'], ['minmax()', 'minmax(${1:100px}, ${2:1fr})'], @@ -199,8 +207,8 @@ def get_properties(): 'animation-play-state': ['running', 'paused'], 'backface-visibility': ['visible', 'hidden'], 'background': [ - '', '', 'repeat', 'repeat-x', 'repeat-y', 'no-repeat', - 'scroll', 'fixed', '' + '', '', '', '', + 'repeat', 'repeat-x', 'repeat-y', 'no-repeat', 'scroll', 'fixed' ], 'background-attachment': ['fixed', 'local', 'scroll'], 'background-blend-mode': [''], @@ -334,6 +342,7 @@ def get_properties(): 'caption', 'icon', 'italic', 'menu', 'message-box', 'oblique', 'small-caps', 'small-caption', 'status-bar' ], + 'font-display': ['auto', 'block', 'swap', 'fallback', 'optional'], 'font-family': [''], 'font-feature-settings': ['normal', ''], 'font-kerning': ['auto', 'normal', 'none'], @@ -625,7 +634,7 @@ def on_query_completions(self, view, prefix, locations): if not match_selector(view, pt, selector): return None - if match_selector(view, pt, "meta.property-value.css meta.function-call"): + if match_selector(view, pt, "meta.property-value.css meta.function-call.arguments"): items = self.complete_function_argument(view, prefix, pt) elif match_selector(view, pt, "meta.property-value.css"): items = self.complete_property_value(view, prefix, pt) @@ -706,4 +715,26 @@ def complete_property_value(self, view, prefix, pt): return completions def complete_function_argument(self, view, prefix, pt): + args_region = view.expand_by_class( + pt, sublime.CLASS_PUNCTUATION_START | sublime.CLASS_PUNCTUATION_END) + func_region = view.expand_by_class( + args_region.a - 2, sublime.CLASS_WORD_START | sublime.CLASS_WORD_END) + func_name = view.substr(func_region) + + # TODO: provide more function specific argument completions + + if func_name == "var": + return [ + sublime.CompletionItem( + trigger=symbol, + completion_format=sublime.COMPLETION_FORMAT_TEXT, + kind=sublime.KIND_VARIABLE, + details="var() argument" + ) + for symbol in set( + view.substr(symbol_region) + for symbol_region in view.find_by_selector("entity.other.custom-property") + ) + if not prefix or symbol.startswith(prefix) + ] return None diff --git a/CSS/syntax_test_css.css b/CSS/syntax_test_css.css index 92184089dd..6b252bb04f 100644 --- a/CSS/syntax_test_css.css +++ b/CSS/syntax_test_css.css @@ -505,6 +505,32 @@ /* ^^^^^ support.constant.property-value.css */ /* ^ punctuation.section.group.end.css */ + @media (prefers-color-scheme: dark) {} +/* ^^^^^^^ meta.at-rule.media.css - meta.group */ +/* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.at-rule.media.css meta.group.css - meta.group meta.group */ +/* ^ meta.at-rule.media.css - meta.block - meta.group */ +/* ^^ meta.at-rule.media.css meta.block.css - meta.group - meta.property-list */ +/* ^ - meta.at-rule - meta.block */ +/* ^ keyword.control.directive.css punctuation.definition.keyword.css */ +/* ^^^^^ keyword.control.directive.css - punctuation */ +/* ^ punctuation.section.group.begin.css */ +/* ^^^^^^^^^^^^^^^^^^^^ support.type.property-name.css */ +/* ^ punctuation.separator.key-value.css */ +/* ^^^^ support.constant.property-value.css */ +/* ^ punctuation.section.group.end.css */ + + @media (prefers-reduced-motion) {} +/* ^^^^^^^ meta.at-rule.media.css - meta.group */ +/* ^^^^^^^^^^^^^^^^^^^^^^^^ meta.at-rule.media.css meta.group.css - meta.group meta.group */ +/* ^ meta.at-rule.media.css - meta.block - meta.group */ +/* ^^ meta.at-rule.media.css meta.block.css - meta.group - meta.property-list */ +/* ^ - meta.at-rule - meta.block */ +/* ^ keyword.control.directive.css punctuation.definition.keyword.css */ +/* ^^^^^ keyword.control.directive.css - punctuation */ +/* ^ punctuation.section.group.begin.css */ +/* ^^^^^^^^^^^^^^^^^^^^^^ support.type.property-name.css */ +/* ^ punctuation.section.group.end.css */ + @media (min-width: 700px, (max-width < 100 {} /* ^^^^^^^ meta.at-rule.media.css - meta.group */ /* ^^^^^^^^^^^^^^^^^ meta.at-rule.media.css meta.group.css - meta.group meta.group */ @@ -843,6 +869,18 @@ { /* <- meta.at-rule.font-face.css meta.property-list.css meta.block.css punctuation.section.block.begin.css */ + ascent-override: normal; +/* ^^^^^^^^^^^^^^^ meta.property-name.css support.type.property-name.css */ +/* ^^^^^^ meta.property-value.css support.constant.property-value.css */ + + descent-override: normal; +/* ^^^^^^^^^^^^^^^^ meta.property-name.css support.type.property-name.css */ +/* ^^^^^^ meta.property-value.css support.constant.property-value.css */ + + font-display: swap; +/* ^^^^^^^^^^^^ meta.property-name.css support.type.property-name.css */ +/* ^^^^ meta.property-value.css support.constant.property-value.css */ + font-family: monospace, /* ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.at-rule.font-face.css meta.property-list.css meta.block.css */ /* ^^^^^^^^^^^ support.type.property-name.css */ @@ -859,6 +897,38 @@ font-family: Gentium Bold; /* ^^^^^^^^^^^^ meta.string.css string.unquoted.css */ + font-feature-settings: normal; +/* ^^^^^^^^^^^^^^^^^^^^^ meta.property-name.css support.type.property-name.css */ +/* ^^^^^^ meta.property-value.css support.constant.property-value.css */ + + font-variation-settings: normal; +/* ^^^^^^^^^^^^^^^^^^^^^^^ meta.property-name.css support.type.property-name.css */ +/* ^^^^^^ meta.property-value.css support.constant.property-value.css */ + + font-stretch: expanded; +/* ^^^^^^^^^^^^ meta.property-name.css support.type.property-name.css */ +/* ^^^^^^^^ meta.property-value.css support.constant.property-value.css */ + + font-style: oblique; +/* ^^^^^^^^^^ meta.property-name.css support.type.property-name.css */ +/* ^^^^^^^ meta.property-value.css support.constant.property-value.css */ + + font-weight: bold; +/* ^^^^^^^^^^^ meta.property-name.css support.type.property-name.css */ +/* ^^^^ meta.property-value.css support.constant.property-value.css */ + + font-variant: discretionary-ligatures; +/* ^^^^^^^^^^^^ meta.property-name.css support.type.property-name.css */ +/* ^^^^^^^^^^^^^^^^^^^^^^^ meta.property-value.css support.constant.property-value.css */ + + line-gap-override: normal; +/* ^^^^^^^^^^^^^^^^^ meta.property-name.css support.type.property-name.css */ +/* ^^^^^^ meta.property-value.css support.constant.property-value.css */ + + size-adjust: 50%; +/* ^^^^^^^^^^^ meta.property-name.css support.type.property-name.css */ +/* ^^^ meta.property-value.css meta.number.integer.decimal.css */ + src: format("embedded-opentype"); /* ^^^^^^ support.function.font-face.css */ /* ^ punctuation.definition.string.begin.css */ @@ -910,6 +980,12 @@ /* ^ punctuation.section.group.begin.css */ /* ^^^^^^^^^^^^ variable.other.custom-property.css */ /* ^^ punctuation.section.group.end.css */ + + unicode-range: U+0-10FFFF; +/* ^^^^^^^^^^^^^ meta.property-name.css support.type.property-name.css */ +/* ^ punctuation.separator.key-value.css */ +/* ^^^^^^^^^^ meta.property-value.css meta.number.unicode-range.css */ +/* ^ punctuation.terminator.rule.css */ } /* <- meta.at-rule.font-face.css meta.property-list.css meta.block.css punctuation.section.block.end.css */ @@ -1022,6 +1098,12 @@ /* ^^^^^^^^^^^^^ keyword.control.directive.css - punctuation */ /* ^^^^ entity.other.counter-style-name.css */ + additive-symbols: ; +/* ^^^^^^^^^^^^^^^^^^^^^ meta.at-rule.counter-style.css meta.property-list.css meta.block.css */ +/* ^^^^^^^^^^^^^^^^ meta.property-name.css support.type.property-name.css */ +/* ^ punctuation.separator.key-value.css */ +/* ^ punctuation.terminator.rule.css*/ + system: extends disc; /* ^^^^^^^^^^^^^^^^^^^^^^^ meta.at-rule.counter-style.css meta.property-list.css meta.block.css */ /* ^ - meta.property-name - meta.property-value */ @@ -1257,7 +1339,7 @@ } /* <- meta.at-rule.counter-style.css meta.property-list.css meta.block.css punctuation.section.block.end.css */ -.test-var-functions { +.test-var-functions { --test-var: arial; /* ^^^^^^^^^^ entity.other.custom-property.css */ /* ^ punctuation.separator.key-value.css*/ @@ -1345,6 +1427,20 @@ } .test-operators { + + margin: -1 -1 +1; + /* ^ keyword.operator.arithmetic.css */ + /* ^ keyword.operator.arithmetic.css */ + /* ^ keyword.operator.arithmetic.css */ + + margin: -1px -1px +1px; + /* ^ keyword.operator.arithmetic.css */ + /* ^ keyword.operator.arithmetic.css */ + /* ^ keyword.operator.arithmetic.css */ +} + +.test-operators-in-calc { + top: calc(1px + 1px); /* ^ keyword.operator.arithmetic.css */ top: calc(+1px+1px); @@ -1402,6 +1498,40 @@ /* ^ keyword.operator.arithmetic.css */ } +.text-calc-clamp-max-min { + top: clamp(1*5pt, calc(12/5), 100rem); +/* ^^^^^ support.function.calc.css */ +/* ^ constant.numeric.value.css */ +/* ^ keyword.operator.arithmetic.css */ +/* ^ constant.numeric.value.css */ +/* ^^ constant.numeric.suffix.css */ +/* ^ punctuation.separator.sequence.css */ +/* ^^^^ support.function.calc.css */ +/* ^^ constant.numeric.value.css */ +/* ^ keyword.operator.arithmetic.css */ +/* ^ constant.numeric.value.css */ +/* ^ punctuation.separator.sequence.css */ +/* ^^^ constant.numeric.value.css */ +/* ^^^ constant.numeric.suffix.css */ + + top: max(5*6, min(10 + 5, calc(var(--size) / 5))); +/* ^^^ support.function.calc.css */ +/* ^ constant.numeric.value.css */ +/* ^ keyword.operator.arithmetic.css */ +/* ^ constant.numeric.value.css */ +/* ^ punctuation.separator.sequence.css */ +/* ^^^ support.function.calc.css */ +/* ^^ constant.numeric.value.css */ +/* ^ keyword.operator.arithmetic.css */ +/* ^ constant.numeric.value.css */ +/* ^ punctuation.separator.sequence.css */ +/* ^^^^ support.function.calc.css */ +/* ^^^ support.function.var.css */ +/* ^ keyword.operator.arithmetic.css */ +/* ^ constant.numeric.value.css */ +} + + .test-important { top: 1px !important; /* ^^^^^^^^^^ keyword.other.important.css */ @@ -1409,10 +1539,30 @@ /* ^^^^^^^^^^ keyword.other.important.css */ } +.test:has(> .class) {} +/*^^^^^^^^^^^^^^^^^ meta.selector.css */ +/* ^^^ - meta.selector.css */ +/* ^^^ meta.function-call.identifier.css - meta.function-call meta.function-call - meta.group*/ +/* ^^^^^^^^^^ meta.function-call.arguments.css meta.group.css */ +/* ^ punctuation.section.group.begin.css */ +/* ^ keyword.operator.combinator.css */ +/* ^^^^^^ entity.other.attribute-name.class.css */ +/* ^ punctuation.section.group.end.css */ + +.test:has(>> .class) {} +/*^^^^^^^^^^^^^^^^^^ meta.selector.css */ +/* ^^^ - meta.selector.css */ +/* ^^^ meta.function-call.identifier.css - meta.function-call meta.function-call - meta.group*/ +/* ^^^^^^^^^^ meta.function-call.arguments.css meta.group.css */ +/* ^ punctuation.section.group.begin.css */ +/* ^^ keyword.operator.combinator.css */ +/* ^^^^^^ entity.other.attribute-name.class.css */ +/* ^ punctuation.section.group.end.css */ + /* Test Functional Pseudo Class Meta Scopes */ .test:nth-child(even) {} /*^^^^^^^^^^^^^^^^^^^ meta.selector.css */ -/* ^^ - meta.selector.css */ +/* ^^^ - meta.selector.css */ /* ^^^^^^^^^ meta.function-call.identifier.css - meta.function-call meta.function-call - meta.group*/ /* ^^^^^^ meta.function-call.arguments.css meta.group.css */ /* ^ punctuation.section.group.begin.css */ @@ -1532,6 +1682,16 @@ /* ^^^ entity.other.pseudo-class.css */ /* ^ variable.language.wildcard.asterisk.css */ +.test-pseudo-class-tag:is(*) {} +/* ^ punctuation.definition.pseudo-class.css - entity */ +/* ^^ entity.other.pseudo-class.css */ +/* ^ variable.language.wildcard.asterisk.css */ + +.test-pseudo-class-tag:where(*) {} +/* ^ punctuation.definition.pseudo-class.css - entity */ +/* ^^^^^ entity.other.pseudo-class.css */ +/* ^ variable.language.wildcard.asterisk.css */ + .test-pseudo-elements::before {} /* ^^ punctuation.definition.pseudo-element.css - entity */ /* ^^^^^^ entity.other.pseudo-element.css */ @@ -2161,6 +2321,23 @@ /* ^^^ meta.number.float.decimal.css constant.numeric.value.css */ /* ^ meta.number.float.decimal.css constant.numeric.suffix.css */ + top: blend(hsl(219, 10%, 6%) 50%); +/* ^^^^^ support.function.color.css */ +/* ^ punctuation.section.group.begin.css */ +/* ^^^ support.function.color.css */ +/* ^ punctuation.section.group.begin.css */ +/* ^^^ meta.number.integer.decimal.css constant.numeric.value.css */ +/* ^ punctuation.separator.sequence.css */ +/* ^^ meta.number.integer.decimal.css constant.numeric.value.css */ +/* ^ meta.number.integer.decimal.css constant.numeric.suffix.css */ +/* ^ punctuation.separator.sequence.css */ +/* ^ meta.number.integer.decimal.css constant.numeric.value.css */ +/* ^ meta.number.integer.decimal.css constant.numeric.suffix.css */ +/* ^ punctuation.section.group.end.css */ +/* ^^ meta.number.integer.decimal.css constant.numeric.value.css */ +/* ^ meta.number.integer.decimal.css constant.numeric.suffix.css */ +/* ^ punctuation.section.group.end.css */ + top: blenda(red 50% hsl); /* ^^^^^^ support.function.color.css */ /* ^^^ support.constant.color.w3c.standard.css */ @@ -2238,7 +2415,7 @@ /* ^^^^^ support.function.transform.css */ /* ^ meta.number.integer.decimal.css constant.numeric.value.css */ /* ^^^ meta.number.integer.decimal.css constant.numeric.suffix.css */ - + top: skew(1deg, 2turn); /* ^^^^ support.function.transform.css */ /* ^ meta.number.integer.decimal.css constant.numeric.value.css */ @@ -2484,16 +2661,16 @@ /* ^^^ support.function.url.css */ /* ^ meta.string.css string.unquoted.css */ - top: url("foo/bar%20baz.php?page=10&func=test()"); -/* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.function-call meta.function-call */ + top: url("foo/bar%20baz.php?page=10&func=test()#ancor"); +/* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.function-call meta.function-call */ /* ^^^ meta.function-call.identifier.css */ -/* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.css meta.group.css */ -/* ^ - meta.function-call */ +/* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.css meta.group.css */ +/* ^ - meta.function-call */ /* ^ - meta.string - meta.path */ /* ^ meta.string.css - meta.path */ -/* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.path.url.css meta.string.css */ -/* ^ meta.string.css - meta.path */ -/* ^ - meta.string - meta.path */ +/* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.path.url.css meta.string.css */ +/* ^ meta.string.css - meta.path */ +/* ^ - meta.string - meta.path */ /* ^^^ support.function.url.css */ /* ^ punctuation.section.group.begin.css */ /* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double.css */ @@ -2503,9 +2680,10 @@ /* ^^ constant.character.escape.url.css - punctuation */ /* ^ punctuation.separator.path.css */ /* ^ punctuation.separator.path.css */ -/* ^ punctuation.definition.string.end.css */ -/* ^ punctuation.section.group.end.css */ -/* ^ punctuation.terminator.rule.css */ +/* ^ punctuation.separator.path.css */ +/* ^ punctuation.definition.string.end.css */ +/* ^ punctuation.section.group.end.css */ +/* ^ punctuation.terminator.rule.css */ top: url('foo/bar%20baz.php?page=10&func=test()'); /* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.function-call meta.function-call */ @@ -2543,8 +2721,13 @@ /* ^ punctuation.separator.path.css */ /* ^ constant.character.escape.url.css punctuation.definition.escape.css */ /* ^^ constant.character.escape.url.css - punctuation */ +/* ^^^^^^^ - punctuation.separator.path */ /* ^ punctuation.separator.path.css */ +/* ^^^^^^^ - punctuation.separator.path */ /* ^ punctuation.separator.path.css */ +/* ^^^^^^^^^^^^^^ - punctuation.separator.path */ +/* ^ punctuation.separator.path.css */ +/* ^^ - punctuation.separator.path */ /* ^^^^ constant.character.escape.css */ /* ^ invalid.illegal.unexpected-token.css */ /* ^^ constant.character.escape.css */ @@ -2677,6 +2860,13 @@ } .test-gradient-functions { + top: conic-gradient(from 0.25turn at 50% 30%, #f69d3c, 10deg, #3f87a6, 350deg, #ebf8e1); +/* ^^^^^^^^^^^^^^ support.function.gradient.css */ +/* ^^^^ keyword.other.gradient.css */ +/* ^^^^ meta.number.float.decimal.css constant.numeric.value.css */ +/* ^^^^ meta.number.float.decimal.css constant.numeric.suffix.css */ +/* ^^ keyword.other.gradient.css */ + top: linear-gradient(); /* ^^^^^^^^^^^^^^^ support.function.gradient.css */ diff --git a/Clojure/Clojure.sublime-syntax b/Clojure/Clojure.sublime-syntax index d30d7347b6..41e6627124 100644 --- a/Clojure/Clojure.sublime-syntax +++ b/Clojure/Clojure.sublime-syntax @@ -24,12 +24,12 @@ variables: # Similar to the number regexps in the Clojure reader. # This doesn't include evil octals and dot-terminated decimals. sign: '[-+]?' - exponent: (?:[eE]{{sign}}\d+) + dec_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}}]) + float: ({{sign}})(\d+)(?:((\.)\d+{{dec_exponent}}?|{{dec_exponent}})(M)?|(M))(?=[{{non_number_chars}}]) contexts: main: @@ -78,40 +78,38 @@ contexts: - match: '{{dec_integer}}' scope: meta.number.integer.decimal.clojure captures: - 1: punctuation.definition.numeric.sign.clojure + 1: keyword.operator.arithmetic.clojure 2: constant.numeric.value.clojure 3: constant.numeric.suffix.clojure - match: '{{hex_integer}}' scope: meta.number.integer.hexadecimal.clojure captures: - 1: punctuation.definition.numeric.sign.clojure + 1: keyword.operator.arithmetic.clojure 2: constant.numeric.base.clojure 3: constant.numeric.value.clojure 4: constant.numeric.suffix.clojure - match: '{{other_integer}}' scope: meta.number.integer.other.clojure captures: - 1: punctuation.definition.numeric.sign.clojure + 1: keyword.operator.arithmetic.clojure 2: constant.numeric.base.clojure 3: constant.numeric.value.clojure - match: '{{rational}}' scope: meta.number.rational.decimal.clojure captures: - 1: punctuation.definition.numeric.sign.clojure + 1: keyword.operator.arithmetic.clojure 2: constant.numeric.value.clojure 3: punctuation.separator.rational.clojure 4: constant.numeric.value.clojure - match: '{{float}}' scope: meta.number.float.decimal.clojure captures: - 1: punctuation.definition.numeric.sign.clojure + 1: keyword.operator.arithmetic.clojure 2: constant.numeric.value.clojure - 3: punctuation.separator.decimal.clojure - 4: constant.numeric.value.clojure - 5: constant.numeric.value.exponent.clojure - 6: constant.numeric.value.exponent.clojure - 7: constant.numeric.suffix.clojure - 8: constant.numeric.suffix.clojure + 3: constant.numeric.value.clojure + 4: punctuation.separator.decimal.clojure + 5: constant.numeric.suffix.clojure + 6: constant.numeric.suffix.clojure - match: '{{atom}}' pop-expr: @@ -162,14 +160,14 @@ contexts: - match: '{{dec_integer}}' scope: meta.number.integer.decimal.clojure captures: - 1: punctuation.definition.numeric.sign.clojure + 1: keyword.operator.arithmetic.clojure 2: constant.numeric.value.clojure 3: constant.numeric.suffix.clojure pop: true - match: '{{hex_integer}}' scope: meta.number.integer.hexadecimal.clojure captures: - 1: punctuation.definition.numeric.sign.clojure + 1: keyword.operator.arithmetic.clojure 2: constant.numeric.base.clojure 3: constant.numeric.value.clojure 4: constant.numeric.suffix.clojure @@ -177,14 +175,14 @@ contexts: - match: '{{other_integer}}' scope: meta.number.integer.other.clojure captures: - 1: punctuation.definition.numeric.sign.clojure + 1: keyword.operator.arithmetic.clojure 2: constant.numeric.base.clojure 3: constant.numeric.value.clojure pop: true - match: '{{rational}}' scope: meta.number.rational.decimal.clojure captures: - 1: punctuation.definition.numeric.sign.clojure + 1: keyword.operator.arithmetic.clojure 2: constant.numeric.value.clojure 3: punctuation.separator.rational.clojure 4: constant.numeric.value.clojure @@ -192,14 +190,12 @@ contexts: - match: '{{float}}' scope: meta.number.float.decimal.clojure captures: - 1: punctuation.definition.numeric.sign.clojure + 1: keyword.operator.arithmetic.clojure 2: constant.numeric.value.clojure - 3: punctuation.separator.decimal.clojure - 4: constant.numeric.value.clojure - 5: constant.numeric.value.exponent.clojure - 6: constant.numeric.value.exponent.clojure - 7: constant.numeric.suffix.clojure - 8: constant.numeric.suffix.clojure + 3: constant.numeric.value.clojure + 4: punctuation.separator.decimal.clojure + 5: constant.numeric.suffix.clojure + 6: constant.numeric.suffix.clojure pop: true - match: '{{atom}}' pop: true diff --git a/Clojure/tests/syntax_test_clojure.clj b/Clojure/tests/syntax_test_clojure.clj index 0abfb212d6..91852fc905 100644 --- a/Clojure/tests/syntax_test_clojure.clj +++ b/Clojure/tests/syntax_test_clojure.clj @@ -84,20 +84,20 @@ ; ^ constant.numeric.suffix.clojure ; ^ - meta.number ; ^^^^^ meta.number.integer.decimal.clojure -; ^ punctuation.definition.numeric.sign.clojure +; ^ keyword.operator.arithmetic.clojure ; ^^^^ constant.numeric.value.clojure ; ^ - meta.number ; ^^^^^^ meta.number.integer.decimal.clojure -; ^ punctuation.definition.numeric.sign.clojure +; ^ keyword.operator.arithmetic.clojure ; ^^^^ constant.numeric.value.clojure ; ^ constant.numeric.suffix.clojure ; ^ - meta.number ; ^^^^^ meta.number.integer.decimal.clojure -; ^ punctuation.definition.numeric.sign.clojure +; ^ keyword.operator.arithmetic.clojure ; ^^^^ constant.numeric.value.clojure ; ^ - meta.number ; ^^^^^^ meta.number.integer.decimal.clojure -; ^ punctuation.definition.numeric.sign.clojure +; ^ keyword.operator.arithmetic.clojure ; ^^^^ constant.numeric.value.clojure ; ^ constant.numeric.suffix.clojure 0x1234af 0x1234afN 0X1234AF 0X1234AFN @@ -120,45 +120,45 @@ ; ^ constant.numeric.suffix.clojure +0x1234af +0x1234afN +0X1234AF +0X1234AFN ; ^^^^^^^^^ meta.number.integer.hexadecimal.clojure -; ^ punctuation.definition.numeric.sign.clojure +; ^ keyword.operator.arithmetic.clojure ; ^^ constant.numeric.base.clojure ; ^^^^^^ constant.numeric.value.clojure ; ^ - meta.number ; ^^^^^^^^^^ meta.number.integer.hexadecimal.clojure -; ^ punctuation.definition.numeric.sign.clojure +; ^ keyword.operator.arithmetic.clojure ; ^^ constant.numeric.base.clojure ; ^^^^^^ constant.numeric.value.clojure ; ^ constant.numeric.suffix.clojure ; ^ - meta.number ; ^^^^^^^^^ meta.number.integer.hexadecimal.clojure -; ^ punctuation.definition.numeric.sign.clojure +; ^ keyword.operator.arithmetic.clojure ; ^^ constant.numeric.base.clojure ; ^^^^^^ constant.numeric.value.clojure ; ^ - meta.number ; ^^^^^^^^^^ meta.number.integer.hexadecimal.clojure -; ^ punctuation.definition.numeric.sign.clojure +; ^ keyword.operator.arithmetic.clojure ; ^^ constant.numeric.base.clojure ; ^^^^^^ constant.numeric.value.clojure ; ^ constant.numeric.suffix.clojure -0x1234af -0x1234afN -0X1234AF -0X1234AFN ; ^^^^^^^^^ meta.number.integer.hexadecimal.clojure -; ^ punctuation.definition.numeric.sign.clojure +; ^ keyword.operator.arithmetic.clojure ; ^^ constant.numeric.base.clojure ; ^^^^^^ constant.numeric.value.clojure ; ^ - meta.number ; ^^^^^^^^^^ meta.number.integer.hexadecimal.clojure -; ^ punctuation.definition.numeric.sign.clojure +; ^ keyword.operator.arithmetic.clojure ; ^^ constant.numeric.base.clojure ; ^^^^^^ constant.numeric.value.clojure ; ^ constant.numeric.suffix.clojure ; ^ - meta.number ; ^^^^^^^^^ meta.number.integer.hexadecimal.clojure -; ^ punctuation.definition.numeric.sign.clojure +; ^ keyword.operator.arithmetic.clojure ; ^^ constant.numeric.base.clojure ; ^^^^^^ constant.numeric.value.clojure ; ^ - meta.number ; ^^^^^^^^^^ meta.number.integer.hexadecimal.clojure -; ^ punctuation.definition.numeric.sign.clojure +; ^ keyword.operator.arithmetic.clojure ; ^^ constant.numeric.base.clojure ; ^^^^^^ constant.numeric.value.clojure ; ^ constant.numeric.suffix.clojure @@ -188,62 +188,62 @@ ; ^^^^^^ constant.numeric.value.clojure +2r1010 +16r1234af +32r1234az +2R1010 +16R1234AF +32R1234AZ ; ^^^^^^^ meta.number.integer.other.clojure -; ^ punctuation.definition.numeric.sign.clojure +; ^ keyword.operator.arithmetic.clojure ; ^^ constant.numeric.base.clojure ; ^^^^ constant.numeric.value.clojure ; ^ - meta.number ; ^^^^^^^^^^ meta.number.integer.other.clojure -; ^ punctuation.definition.numeric.sign.clojure +; ^ keyword.operator.arithmetic.clojure ; ^^^ constant.numeric.base.clojure ; ^^^^^^ constant.numeric.value.clojure ; ^ - meta.number ; ^^^^^^^^^^ meta.number.integer.other.clojure -; ^ punctuation.definition.numeric.sign.clojure +; ^ keyword.operator.arithmetic.clojure ; ^^^ constant.numeric.base.clojure ; ^^^^^^ constant.numeric.value.clojure ; ^ - meta.number ; ^^^^^^^ meta.number.integer.other.clojure -; ^ punctuation.definition.numeric.sign.clojure +; ^ keyword.operator.arithmetic.clojure ; ^^ constant.numeric.base.clojure ; ^^^^ constant.numeric.value.clojure ; ^ - meta.number ; ^^^^^^^^^^ meta.number.integer.other.clojure -; ^ punctuation.definition.numeric.sign.clojure +; ^ keyword.operator.arithmetic.clojure ; ^^^ constant.numeric.base.clojure ; ^^^^^^ constant.numeric.value.clojure ; ^ - meta.number ; ^^^^^^^^^^ meta.number.integer.other.clojure -; ^ punctuation.definition.numeric.sign.clojure +; ^ keyword.operator.arithmetic.clojure ; ^^^ constant.numeric.base.clojure ; ^^^^^^ constant.numeric.value.clojure -2r1010 -16r1234af -32r1234az -2R1010 -16R1234AF -32R1234AZ ; ^^^^^^^ meta.number.integer.other.clojure -; ^ punctuation.definition.numeric.sign.clojure +; ^ keyword.operator.arithmetic.clojure ; ^^ constant.numeric.base.clojure ; ^^^^ constant.numeric.value.clojure ; ^ - meta.number ; ^^^^^^^^^^ meta.number.integer.other.clojure -; ^ punctuation.definition.numeric.sign.clojure +; ^ keyword.operator.arithmetic.clojure ; ^^^ constant.numeric.base.clojure ; ^^^^^^ constant.numeric.value.clojure ; ^ - meta.number ; ^^^^^^^^^^ meta.number.integer.other.clojure -; ^ punctuation.definition.numeric.sign.clojure +; ^ keyword.operator.arithmetic.clojure ; ^^^ constant.numeric.base.clojure ; ^^^^^^ constant.numeric.value.clojure ; ^ - meta.number ; ^^^^^^^ meta.number.integer.other.clojure -; ^ punctuation.definition.numeric.sign.clojure +; ^ keyword.operator.arithmetic.clojure ; ^^ constant.numeric.base.clojure ; ^^^^ constant.numeric.value.clojure ; ^ - meta.number ; ^^^^^^^^^^ meta.number.integer.other.clojure -; ^ punctuation.definition.numeric.sign.clojure +; ^ keyword.operator.arithmetic.clojure ; ^^^ constant.numeric.base.clojure ; ^^^^^^ constant.numeric.value.clojure ; ^ - meta.number ; ^^^^^^^^^^ meta.number.integer.other.clojure -; ^ punctuation.definition.numeric.sign.clojure +; ^ keyword.operator.arithmetic.clojure ; ^^^ constant.numeric.base.clojure ; ^^^^^^ constant.numeric.value.clojure 0/10 10/20 30/0 @@ -263,37 +263,37 @@ ; ^ constant.numeric.value.clojure +0/10 +10/20 +30/0 ; ^^^^^ meta.number.rational.decimal.clojure -; ^ punctuation.definition.numeric.sign.clojure +; ^ keyword.operator.arithmetic.clojure ; ^ constant.numeric.value.clojure ; ^ punctuation.separator.rational.clojure ; ^^ constant.numeric.value.clojure ; ^ - meta.number ; ^^^^^^ meta.number.rational.decimal.clojure -; ^ punctuation.definition.numeric.sign.clojure +; ^ keyword.operator.arithmetic.clojure ; ^^ constant.numeric.value.clojure ; ^ punctuation.separator.rational.clojure ; ^^ constant.numeric.value.clojure ; ^ - meta.number ; ^^^^^ meta.number.rational.decimal.clojure -; ^ punctuation.definition.numeric.sign.clojure +; ^ keyword.operator.arithmetic.clojure ; ^^ constant.numeric.value.clojure ; ^ punctuation.separator.rational.clojure ; ^ constant.numeric.value.clojure -0/10 -10/20 -30/0 ; ^^^^^ meta.number.rational.decimal.clojure -; ^ punctuation.definition.numeric.sign.clojure +; ^ keyword.operator.arithmetic.clojure ; ^ constant.numeric.value.clojure ; ^ punctuation.separator.rational.clojure ; ^^ constant.numeric.value.clojure ; ^ - meta.number ; ^^^^^^ meta.number.rational.decimal.clojure -; ^ punctuation.definition.numeric.sign.clojure +; ^ keyword.operator.arithmetic.clojure ; ^^ constant.numeric.value.clojure ; ^ punctuation.separator.rational.clojure ; ^^ constant.numeric.value.clojure ; ^ - meta.number ; ^^^^^ meta.number.rational.decimal.clojure -; ^ punctuation.definition.numeric.sign.clojure +; ^ keyword.operator.arithmetic.clojure ; ^^ constant.numeric.value.clojure ; ^ punctuation.separator.rational.clojure ; ^ constant.numeric.value.clojure @@ -314,206 +314,164 @@ ; ^ constant.numeric.suffix.clojure +1234M +1234.0M +1234.1234M ; ^^^^^^ meta.number.float.decimal.clojure -; ^ punctuation.definition.numeric.sign.clojure +; ^ keyword.operator.arithmetic.clojure ; ^^^^ constant.numeric.value.clojure ; ^ constant.numeric.suffix.clojure ; ^ - meta.number ; ^^^^^^^^ meta.number.float.decimal.clojure -; ^ punctuation.definition.numeric.sign.clojure +; ^ keyword.operator.arithmetic.clojure ; ^^^^ constant.numeric.value.clojure ; ^ punctuation.separator.decimal.clojure ; ^ constant.numeric.value.clojure ; ^ constant.numeric.suffix.clojure ; ^ - meta.number ; ^^^^^^^^^^^ meta.number.float.decimal.clojure -; ^ punctuation.definition.numeric.sign.clojure +; ^ keyword.operator.arithmetic.clojure ; ^^^^ constant.numeric.value.clojure ; ^ punctuation.separator.decimal.clojure ; ^^^^ constant.numeric.value.clojure ; ^ constant.numeric.suffix.clojure -1234M -1234.0M -1234.1234M ; ^^^^^^ meta.number.float.decimal.clojure -; ^ punctuation.definition.numeric.sign.clojure +; ^ keyword.operator.arithmetic.clojure ; ^^^^ constant.numeric.value.clojure ; ^ constant.numeric.suffix.clojure ; ^ - meta.number ; ^^^^^^^^ meta.number.float.decimal.clojure -; ^ punctuation.definition.numeric.sign.clojure +; ^ keyword.operator.arithmetic.clojure ; ^^^^ constant.numeric.value.clojure ; ^ punctuation.separator.decimal.clojure ; ^ constant.numeric.value.clojure ; ^ constant.numeric.suffix.clojure ; ^ - meta.number ; ^^^^^^^^^^^ meta.number.float.decimal.clojure -; ^ punctuation.definition.numeric.sign.clojure +; ^ keyword.operator.arithmetic.clojure ; ^^^^ constant.numeric.value.clojure ; ^ punctuation.separator.decimal.clojure ; ^^^^ constant.numeric.value.clojure ; ^ constant.numeric.suffix.clojure 1234e10 1234E10M 1234.1234e10M 1234.1234E10M ; ^^^^^^^ meta.number.float.decimal.clojure -; ^^^^ constant.numeric.value.clojure -; ^^^ constant.numeric.value.exponent.clojure +; ^^^^^^^ constant.numeric.value.clojure ; ^ - meta.number ; ^^^^^^^ meta.number.float.decimal.clojure -; ^^^^ constant.numeric.value.clojure -; ^^^ constant.numeric.value.exponent.clojure +; ^^^^^^^ constant.numeric.value.clojure ; ^ constant.numeric.suffix.clojure ; ^ - meta.number ; ^^^^^^^^^^^^^ meta.number.float.decimal.clojure -; ^^^^ constant.numeric.value.clojure +; ^^^^^^^^^^^^ constant.numeric.value.clojure ; ^ punctuation.separator.decimal.clojure -; ^^^^ constant.numeric.value.clojure -; ^^^ constant.numeric.value.exponent.clojure ; ^ constant.numeric.suffix.clojure ; ^ - meta.number ; ^^^^^^^^^^^^^ meta.number.float.decimal.clojure -; ^^^^ constant.numeric.value.clojure +; ^^^^^^^^^^^^ constant.numeric.value.clojure ; ^ punctuation.separator.decimal.clojure -; ^^^^ constant.numeric.value.clojure -; ^^^ constant.numeric.value.exponent.clojure ; ^ constant.numeric.suffix.clojure +1234e10 +1234E10M +1234.1234e10M +1234.1234E10M ; ^^^^^^^^ meta.number.float.decimal.clojure -; ^ punctuation.definition.numeric.sign.clojure -; ^^^^ constant.numeric.value.clojure -; ^^^ constant.numeric.value.exponent.clojure +; ^ keyword.operator.arithmetic.clojure +; ^^^^^^^ constant.numeric.value.clojure ; ^ - meta.number ; ^^^^^^^^^ meta.number.float.decimal.clojure -; ^ punctuation.definition.numeric.sign.clojure -; ^^^^ constant.numeric.value.clojure -; ^^^ constant.numeric.value.exponent.clojure +; ^ keyword.operator.arithmetic.clojure +; ^^^^^^^ constant.numeric.value.clojure ; ^ constant.numeric.suffix.clojure ; ^ - meta.number ; ^^^^^^^^^^^^^^ meta.number.float.decimal.clojure -; ^ punctuation.definition.numeric.sign.clojure -; ^^^^ constant.numeric.value.clojure +; ^ keyword.operator.arithmetic.clojure +; ^^^^^^^^^^^^ constant.numeric.value.clojure ; ^ punctuation.separator.decimal.clojure -; ^^^^ constant.numeric.value.clojure -; ^^^ constant.numeric.value.exponent.clojure ; ^ constant.numeric.suffix.clojure ; ^ - meta.number ; ^^^^^^^^^^^^^^ meta.number.float.decimal.clojure -; ^ punctuation.definition.numeric.sign.clojure -; ^^^^ constant.numeric.value.clojure +; ^ keyword.operator.arithmetic.clojure +; ^^^^^^^^^^^^ constant.numeric.value.clojure ; ^ punctuation.separator.decimal.clojure -; ^^^^ constant.numeric.value.clojure -; ^^^ constant.numeric.value.exponent.clojure ; ^ constant.numeric.suffix.clojure -1234e10 -1234E10M -1234.1234e10M -1234.1234E10M ; ^^^^^^^^ meta.number.float.decimal.clojure -; ^ punctuation.definition.numeric.sign.clojure -; ^^^^ constant.numeric.value.clojure -; ^^^ constant.numeric.value.exponent.clojure +; ^ keyword.operator.arithmetic.clojure +; ^^^^^^^ constant.numeric.value.clojure ; ^ - meta.number ; ^^^^^^^^^ meta.number.float.decimal.clojure -; ^ punctuation.definition.numeric.sign.clojure -; ^^^^ constant.numeric.value.clojure -; ^^^ constant.numeric.value.exponent.clojure +; ^ keyword.operator.arithmetic.clojure +; ^^^^^^^ constant.numeric.value.clojure ; ^ constant.numeric.suffix.clojure ; ^ - meta.number ; ^^^^^^^^^^^^^^ meta.number.float.decimal.clojure -; ^ punctuation.definition.numeric.sign.clojure -; ^^^^ constant.numeric.value.clojure +; ^ keyword.operator.arithmetic.clojure +; ^^^^^^^^^^^^ constant.numeric.value.clojure ; ^ punctuation.separator.decimal.clojure -; ^^^^ constant.numeric.value.clojure -; ^^^ constant.numeric.value.exponent.clojure ; ^ constant.numeric.suffix.clojure ; ^ - meta.number ; ^^^^^^^^^^^^^^ meta.number.float.decimal.clojure -; ^ punctuation.definition.numeric.sign.clojure -; ^^^^ constant.numeric.value.clojure +; ^ keyword.operator.arithmetic.clojure +; ^^^^^^^^^^^^ constant.numeric.value.clojure ; ^ punctuation.separator.decimal.clojure -; ^^^^ constant.numeric.value.clojure -; ^^^ constant.numeric.value.exponent.clojure ; ^ constant.numeric.suffix.clojure 1234.1234e+10 1234.1234E+10 1234.1234e-10 1234.1234E-10 ; ^^^^^^^^^^^^^ meta.number.float.decimal.clojure -; ^^^^ constant.numeric.value.clojure +; ^^^^^^^^^^^^^ constant.numeric.value.clojure ; ^ punctuation.separator.decimal.clojure -; ^^^^ constant.numeric.value.clojure -; ^^^^ constant.numeric.value.exponent.clojure ; ^ - meta.number ; ^^^^^^^^^^^^^ meta.number.float.decimal.clojure -; ^^^^ constant.numeric.value.clojure +; ^^^^^^^^^^^^^ constant.numeric.value.clojure ; ^ punctuation.separator.decimal.clojure -; ^^^^ constant.numeric.value.clojure -; ^^^^ constant.numeric.value.exponent.clojure ; ^ - meta.number ; ^^^^^^^^^^^^^ meta.number.float.decimal.clojure -; ^^^^ constant.numeric.value.clojure +; ^^^^^^^^^^^^^ constant.numeric.value.clojure ; ^ punctuation.separator.decimal.clojure -; ^^^^ constant.numeric.value.clojure -; ^^^^ constant.numeric.value.exponent.clojure ; ^ - meta.number ; ^^^^^^^^^^^^^ meta.number.float.decimal.clojure -; ^^^^ constant.numeric.value.clojure +; ^^^^^^^^^^^^^ constant.numeric.value.clojure ; ^ punctuation.separator.decimal.clojure -; ^^^^ constant.numeric.value.clojure -; ^^^^ constant.numeric.value.exponent.clojure +1234.1234e+10M +1234.1234E+10M +1234.1234e-10M +1234.1234E-10M ; ^^^^^^^^^^^^^^^ meta.number.float.decimal.clojure -; ^ punctuation.definition.numeric.sign.clojure -; ^^^^ constant.numeric.value.clojure +; ^ keyword.operator.arithmetic.clojure +; ^^^^^^^^^^^^^ constant.numeric.value.clojure ; ^ punctuation.separator.decimal.clojure -; ^^^^ constant.numeric.value.clojure -; ^^^^ constant.numeric.value.exponent.clojure ; ^ constant.numeric.suffix.clojure ; ^ - meta.number ; ^^^^^^^^^^^^^^^ meta.number.float.decimal.clojure -; ^ punctuation.definition.numeric.sign.clojure -; ^^^^ constant.numeric.value.clojure +; ^ keyword.operator.arithmetic.clojure +; ^^^^^^^^^^^^^ constant.numeric.value.clojure ; ^ punctuation.separator.decimal.clojure -; ^^^^ constant.numeric.value.clojure -; ^^^^ constant.numeric.value.exponent.clojure ; ^ constant.numeric.suffix.clojure ; ^ - meta.number ; ^^^^^^^^^^^^^^^ meta.number.float.decimal.clojure -; ^ punctuation.definition.numeric.sign.clojure -; ^^^^ constant.numeric.value.clojure +; ^ keyword.operator.arithmetic.clojure +; ^^^^^^^^^^^^^ constant.numeric.value.clojure ; ^ punctuation.separator.decimal.clojure -; ^^^^ constant.numeric.value.clojure -; ^^^^ constant.numeric.value.exponent.clojure ; ^ constant.numeric.suffix.clojure ; ^ - meta.number ; ^^^^^^^^^^^^^^^ meta.number.float.decimal.clojure -; ^ punctuation.definition.numeric.sign.clojure -; ^^^^ constant.numeric.value.clojure +; ^ keyword.operator.arithmetic.clojure +; ^^^^^^^^^^^^^ constant.numeric.value.clojure ; ^ punctuation.separator.decimal.clojure -; ^^^^ constant.numeric.value.clojure -; ^^^^ constant.numeric.value.exponent.clojure ; ^ constant.numeric.suffix.clojure -1234.1234e+10M -1234.1234E+10M -1234.1234e-10M -1234.1234E-10M ; ^^^^^^^^^^^^^^^ meta.number.float.decimal.clojure -; ^ punctuation.definition.numeric.sign.clojure -; ^^^^ constant.numeric.value.clojure +; ^ keyword.operator.arithmetic.clojure +; ^^^^^^^^^^^^^ constant.numeric.value.clojure ; ^ punctuation.separator.decimal.clojure -; ^^^^ constant.numeric.value.clojure -; ^^^^ constant.numeric.value.exponent.clojure ; ^ constant.numeric.suffix.clojure ; ^ - meta.number ; ^^^^^^^^^^^^^^^ meta.number.float.decimal.clojure -; ^ punctuation.definition.numeric.sign.clojure -; ^^^^ constant.numeric.value.clojure +; ^ keyword.operator.arithmetic.clojure +; ^^^^^^^^^^^^^ constant.numeric.value.clojure ; ^ punctuation.separator.decimal.clojure -; ^^^^ constant.numeric.value.clojure -; ^^^^ constant.numeric.value.exponent.clojure ; ^ constant.numeric.suffix.clojure ; ^ - meta.number ; ^^^^^^^^^^^^^^^ meta.number.float.decimal.clojure -; ^ punctuation.definition.numeric.sign.clojure -; ^^^^ constant.numeric.value.clojure +; ^ keyword.operator.arithmetic.clojure +; ^^^^^^^^^^^^^ constant.numeric.value.clojure ; ^ punctuation.separator.decimal.clojure -; ^^^^ constant.numeric.value.clojure -; ^^^^ constant.numeric.value.exponent.clojure ; ^ constant.numeric.suffix.clojure ; ^ - meta.number ; ^^^^^^^^^^^^^^^ meta.number.float.decimal.clojure -; ^ punctuation.definition.numeric.sign.clojure -; ^^^^ constant.numeric.value.clojure +; ^ keyword.operator.arithmetic.clojure +; ^^^^^^^^^^^^^ constant.numeric.value.clojure ; ^ punctuation.separator.decimal.clojure -; ^^^^ constant.numeric.value.clojure -; ^^^^ constant.numeric.value.exponent.clojure ; ^ constant.numeric.suffix.clojure ; ## Breaks diff --git a/D/D.sublime-syntax b/D/D.sublime-syntax index d6b45ebe0d..c9643786a3 100644 --- a/D/D.sublime-syntax +++ b/D/D.sublime-syntax @@ -40,7 +40,7 @@ variables: string_lookahead: '(?=`|[rxq]?"|q{)' definitely_value_lookahead: '(?=!|~|\+|\-|\*|&|\bcast\b|\bdelete\b|\bnew\b|\bimport\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)' + definitely_declaration_lookahead: '(?=({{name}})(\s+\*|(\*|\[.*\])?\s+)({{name}})|\b({{type_qualifier}})\b)' type_qualifier: 'const|immutable|inout|shared' type_qualifier_lookahead: '(?=\b({{type_qualifier}})\b)' @@ -194,7 +194,7 @@ contexts: - include: integer-opt - include: not-whitespace-illegal-pop integer-opt: - - match: '(0[bB])(_?)({{bin_digits}})({{integer_suffix}})?' + - match: (0[bB])(_?)({{bin_digits}})({{integer_suffix}})? scope: meta.number.integer.binary.d captures: 1: constant.numeric.base.d @@ -202,7 +202,7 @@ contexts: 3: constant.numeric.value.d 4: constant.numeric.suffix.d pop: true - - match: '(0[xX])(_?)({{hex_digits}})({{integer_suffix}})?' + - match: (0[xX])(_?)({{hex_digits}})({{integer_suffix}})? scope: meta.number.integer.hexadecimal.d captures: 1: constant.numeric.base.d @@ -210,7 +210,7 @@ contexts: 3: constant.numeric.value.d 4: constant.numeric.suffix.d pop: true - - match: '({{dec_integer}})({{integer_suffix}})?' + - match: ({{dec_integer}})({{integer_suffix}})? scope: meta.number.integer.decimal.d captures: 1: constant.numeric.value.d @@ -222,77 +222,67 @@ contexts: - include: not-whitespace-illegal-pop floating-point-opt: # decimal imaginary numbers - - match: '({{dec_integer}})?(?:(\.)({{dec_digits}})?)?({{dec_exponent}})?({{imaginary_suffix}})' + - match: ({{dec_integer}}?(?:(\.){{dec_digits}}?)?{{dec_exponent}}?)({{imaginary_suffix}}) scope: meta.number.imaginary.decimal.d captures: 1: constant.numeric.value.d 2: punctuation.separator.decimal.d - 3: constant.numeric.value.d - 4: constant.numeric.value.exponent.d - 5: constant.numeric.suffix.d + 3: constant.numeric.suffix.d pop: true # decimal floats - match: |- (?x: ({{dec_integer}}) (?: - (?: + ( (\.) (?: # 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}})? + {{dec_digits}} {{dec_exponent}}? # 1.e1, 1.e-1, 1.e1f, 1.e-1f, 1.e1L, 1.e-1L - | ({{dec_exponent}}) + | {{dec_exponent}} # 1., 1.f, 1.L # but not `..` or method/attribute access | (?!\.|\s*[[:alpha:]_]) ) # 1e1 1e1f 1e1L - | ({{dec_exponent}}) + | {{dec_exponent}} ) ({{integer_float_suffix}})? # 1f | ({{float_suffix}}) ) # .1, .1e1, .1e-1, .1f, .1e1f, .1e-1f, .1L, .1e1L, .1e-1L - | (\.) ({{dec_digits}}) ({{dec_exponent}})? ({{integer_float_suffix}})? + | ( (\.) {{dec_digits}} {{dec_exponent}}? ) ({{integer_float_suffix}})? ) scope: meta.number.float.decimal.d captures: 1: constant.numeric.value.d - 2: punctuation.separator.decimal.d - 3: constant.numeric.value.d - 4: constant.numeric.value.exponent.d - 5: constant.numeric.value.exponent.d - 6: constant.numeric.value.exponent.d - 7: constant.numeric.suffix.d + 2: constant.numeric.value.d + 3: punctuation.separator.decimal.d + 4: constant.numeric.suffix.d + 5: constant.numeric.suffix.d + 6: constant.numeric.value.d + 7: punctuation.separator.decimal.d 8: constant.numeric.suffix.d - 9: punctuation.separator.decimal.d - 10: constant.numeric.value.d - 11: constant.numeric.value.exponent.d - 12: constant.numeric.suffix.d pop: true # hexadecimal imaginary numbers - - match: (0[xX])(_?)({{hex_digits}})?(?:(\.)({{hex_digits}})?)?({{hex_exponent}})?({{imaginary_suffix}}) + - match: (0[xX])(_?)({{hex_digits}}?(?:(\.){{hex_digits}}?)?{{hex_exponent}}?)({{imaginary_suffix}}) scope: meta.number.imaginary.hexadecimal.d captures: 1: constant.numeric.base.d 2: invalid.illegal.numeric.d 3: constant.numeric.value.d 4: punctuation.separator.decimal.d - 5: constant.numeric.value.d - 6: constant.numeric.value.exponent.d - 7: constant.numeric.suffix.d + 5: constant.numeric.suffix.d pop: true # hexadecimal floats - - match: (0[xX])(_?)({{hex_digits}})?(?:(\.)({{hex_digits}})?)?({{hex_exponent}})({{integer_float_suffix}})? + - match: (0[xX])(_?)({{hex_digits}}?(?:(\.){{hex_digits}}?)?{{hex_exponent}})({{integer_float_suffix}})? scope: meta.number.float.hexadecimal.d captures: 1: constant.numeric.base.d 2: invalid.illegal.numeric.d 3: constant.numeric.value.d 4: punctuation.separator.decimal.d - 5: constant.numeric.value.d - 6: constant.numeric.value.exponent.d - 7: constant.numeric.suffix.d + 5: constant.numeric.suffix.d pop: true # binary imaginary numbers @@ -1109,6 +1099,13 @@ contexts: - include: first-value-parens-after value: + - match: '\b({{name}})\s*(:)' + captures: + 1: variable.other.d + 2: punctuation.separator.mapping.key-value.d + set: value + - include: value-no-mapping-key + value-no-mapping-key: - include: attribute-in - match: '!' scope: keyword.operator.logical.d @@ -1236,11 +1233,6 @@ contexts: - 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 @@ -1432,7 +1424,7 @@ contexts: set: value-maybe-pointer-after - match: '\?' scope: keyword.operator.ternary.d - set: [value-condition-after, value] + set: [value-condition-after, value-condition] - match: '(?=\b(function|delegate)\b)' set: [value-after, basic-type2] - match: '(?=\S)' @@ -1464,6 +1456,10 @@ contexts: set: basic-type2 - match: '(?=\S)' set: value + value-condition: + - match: (?=:) + pop: 1 + - include: value-no-mapping-key value-condition-after: - match: ':' scope: keyword.operator.ternary.d @@ -1496,6 +1492,19 @@ contexts: set: value-list - include: not-whitespace-illegal-pop + value-list-no-mapping-key: + - match: '(?=\)|}|]|;|:)' + pop: true + - match: '(?=\S)' + set: [value-list-after-no-mapping-key, value-no-mapping-key] + value-list-after-no-mapping-key: + - match: '(?=\)|}|]|;|:)' + pop: true + - match: ',' + scope: punctuation.separator.sequence.d + set: value-list-no-mapping-key + - include: not-whitespace-illegal-pop + value-array-list: - match: '(?=\])' pop: true @@ -2080,9 +2089,10 @@ contexts: - match: '\(' scope: punctuation.section.parens.begin.d set: [switch-after, value] + - include: not-whitespace-illegal-pop - match: '\bcase\b' scope: keyword.control.flow.d - push: [case-after, value-list] + push: [case-after, value-list-no-mapping-key] - match: '\bdefault\b' scope: keyword.control.flow.d push: @@ -2104,7 +2114,7 @@ contexts: set: - match: '\bcase\b' scope: keyword.control.flow.d - set: [case-after, value] + set: [case-after, value-no-mapping-key] - include: not-whitespace-illegal-pop - match: '(?=\S)' pop: true @@ -2117,6 +2127,9 @@ contexts: - match: '\)' scope: punctuation.section.parens.end.d pop: true + - match: ';' + scope: punctuation.terminator.d + push: first-value - include: statement-list-in - include: not-whitespace-illegal-pop diff --git a/D/tests/syntax_test_d.d b/D/tests/syntax_test_d.d index 46f00a93dc..08d808fde9 100644 --- a/D/tests/syntax_test_d.d +++ b/D/tests/syntax_test_d.d @@ -233,19 +233,17 @@ imag = 123_45i + 0_.1_i + 12_.e1i; // ^ constant.numeric.suffix.d // ^ keyword.operator.arithmetic.d // ^^^^^^ meta.number.imaginary.decimal.d -// ^^ constant.numeric.value.d +// ^^^^^ constant.numeric.value.d // ^ punctuation.separator.decimal.d -// ^^ constant.numeric.value.d // ^ constant.numeric.suffix.d // ^^^^^^^ meta.number.imaginary.decimal.d -// ^^^ constant.numeric.value.d -// ^ punctuation.separator.decimal.d -// ^^ constant.numeric.value.exponent.d -// ^ constant.numeric.suffix.d +// ^^^ constant.numeric.value.d - punctuation +// ^ constant.numeric.value.d punctuation.separator.decimal.d +// ^^ constant.numeric.value.d - punctuation +// ^ constant.numeric.suffix.d - punctuation imag = 23134723__742e1i; // ^^^^^^^^^^^^^^^^ meta.number.imaginary.decimal.d -// ^^^^^^^^^^^^^ constant.numeric.value.d -// ^^ constant.numeric.value.exponent.d +// ^^^^^^^^^^^^^^^ constant.numeric.value.d // ^ constant.numeric.suffix.d imag = 0x_3472389742f_i; // ^^^^^^^^^^^^^^^^ meta.number.imaginary.hexadecimal.d @@ -257,8 +255,7 @@ imag = 0x_34723897p-34i; // ^^^^^^^^^^^^^^^^ meta.number.imaginary.hexadecimal.d // ^^ constant.numeric.base.d // ^ invalid.illegal.numeric.d -// ^^^^^^^^ constant.numeric.value.d -// ^^^^ constant.numeric.value.exponent.d +// ^^^^^^^^^^^^ constant.numeric.value.d // ^ constant.numeric.suffix.d imag = 0x347._23897p-34i; // ^^^^^ meta.number.integer.hexadecimal.d @@ -277,17 +274,16 @@ imag = 0b_0100_010_00_i; auto f = 0_.0_; // ^^^^^ meta.number.float.decimal.d -// ^^ constant.numeric.value.d +// ^^^^^ constant.numeric.value.d // ^ punctuation.separator.decimal.d -// ^^ constant.numeric.value.d f = 0_.; // ^^^ meta.number.float.decimal.d -// ^^ constant.numeric.value.d -// ^ punctuation.separator.decimal.d +// ^^ constant.numeric.value.d - punctuation +// ^ constant.numeric.value.d punctuation.separator.decimal.d f = .123_1243; // ^^^^^^^^^ meta.number.float.decimal.d -// ^ punctuation.separator.decimal.d -// ^^^^^^^^ constant.numeric.value.d +// ^ constant.numeric.value.d punctuation.separator.decimal.d +// ^^^^^^^^ constant.numeric.value.d - punctuation f = ._123_1243 + 1._123; // ^ punctuation.accessor.dot.d // ^^^^^^^^^ variable.other.d @@ -297,20 +293,18 @@ f = ._123_1243 + 1._123; // ^^^^ variable.other.d f = 3423.2e-45; // ^^^^^^^^^^ meta.number.float.decimal.d -// ^^^^ constant.numeric.value.d -// ^ punctuation.separator.decimal.d -// ^ constant.numeric.value.d -// ^^^^ constant.numeric.value.exponent.d +// ^^^^ constant.numeric.value.d - punctuation +// ^ constant.numeric.value.d punctuation.separator.decimal.d +// ^^^^^ constant.numeric.value.d - punctuation f = 2.e-45; // ^^^^^^ meta.number.float.decimal.d -// ^ constant.numeric.value.d -// ^ punctuation.separator.decimal.d -// ^^^^ constant.numeric.value.exponent.d +// ^ constant.numeric.value.d - punctuation +// ^ constant.numeric.value.d punctuation.separator.decimal.d +// ^^^^ constant.numeric.value.d - punctuation f = .4E+4L; // ^^^^^^ meta.number.float.decimal.d -// ^ punctuation.separator.decimal.d -// ^ constant.numeric.value.d -// ^^^ constant.numeric.value.exponent.d +// ^ constant.numeric.value.d punctuation.separator.decimal.d +// ^^^^ constant.numeric.value.d - punctuation // ^ constant.numeric.suffix.d f = 1f; // ^^ meta.number.float.decimal.d @@ -319,8 +313,7 @@ f = 1f; f = 0x123p2f; // ^^^^^^^^ meta.number.float.hexadecimal.d // ^^ constant.numeric.base.d -// ^^^ constant.numeric.value.d -// ^^ constant.numeric.value.exponent.d +// ^^^^^ constant.numeric.value.d // ^ constant.numeric.suffix.d f = 0b10101101f; // ^^^^^^^^^^^ meta.number.float.binary.d @@ -330,17 +323,14 @@ f = 0b10101101f; f = 0x.1aFp2; // ^^^^^^^^ meta.number.float.hexadecimal.d // ^^ constant.numeric.base.d -// ^ punctuation.separator.decimal.d -// ^ constant.numeric.value.d -// ^^ constant.numeric.value.d -// ^^ constant.numeric.value.exponent.d +// ^ constant.numeric.value.d punctuation.separator.decimal.d +// ^^^^^ constant.numeric.value.d - punctuation f = 0xF.AP-2f; // ^^^^^^^^^ meta.number.float.hexadecimal.d // ^^ constant.numeric.base.d -// ^ constant.numeric.value.d -// ^ punctuation.separator.decimal.d -// ^ constant.numeric.value.d -// ^^^ constant.numeric.value.exponent.d +// ^ constant.numeric.value.d - punctuation +// ^ constant.numeric.value.d punctuation.separator.decimal.d +// ^^^^ constant.numeric.value.d - punctuation // ^ constant.numeric.suffix.d @foo: @@ -578,7 +568,7 @@ extern(1) // ^ variable.other.d // ^ punctuation.terminator.d foo[string] b = 123; -//^^^ variable.other.d +//^^^ storage.type.d // ^ punctuation.section.brackets.begin.d // ^^^^^^ storage.type.d // ^ punctuation.section.brackets.end.d @@ -587,10 +577,22 @@ extern(1) // ^^^ meta.number.integer.decimal.d // ^ punctuation.terminator.d bar* some_long_Name; -//^^^ variable.other.d +//^^^ storage.type.d // ^ keyword.operator.pointer.d // ^^^^^^^^^^^^^^ variable.other.d // ^ punctuation.terminator.d + bar *some_long_Name; +//^^^ storage.type.d +// ^ keyword.operator.pointer.d +// ^^^^^^^^^^^^^^ variable.other.d +// ^ punctuation.terminator.d + foo[BAR] baz; +//^^^ storage.type.d +// ^ punctuation.section.brackets.begin.d +// ^^^ variable.other.d +// ^ punctuation.section.brackets.end.d +// ^^^ variable.other.d +// ^ punctuation.terminator.d auto foo = 3; //^^^^ storage.modifier.d // ^^^ variable.other.d @@ -1091,7 +1093,7 @@ extern(1) } //^ meta.function.d meta.block.d punctuation.section.block.end.d T[] map(T, void fn)(T[] array) { - //^ variable.other.d + //^ storage.type.d // ^ punctuation.section.brackets.begin.d // ^ punctuation.section.brackets.end.d // ^^^ meta.function.d entity.name.function.d @@ -2107,6 +2109,32 @@ extern(1) // ^^^^^ string.quoted.double.d // ^ punctuation.terminator.d + foo* bar = foo* bar; +//^^^ storage.type.d +// ^ keyword.operator.pointer.d +// ^^^ variable.other.d +// ^ keyword.operator.assignment.d +// ^^^ variable.other.d +// ^ keyword.operator.arithmetic.d +// ^^^ variable.other.d +// ^ punctuation.terminator.d + + foo bar = (baz *var[foo* bar]); +//^^^ storage.type.d +// ^^^ variable.other.d +// ^ keyword.operator.assignment.d +// ^ punctuation.section.group.begin.d +// ^^^ variable.other.d +// ^ keyword.operator.arithmetic.d +// ^^^ variable.other.d +// ^ punctuation.section.brackets.begin.d +// ^^^ variable.other.d +// ^ keyword.operator.arithmetic.d +// ^^^ variable.other.d +// ^ punctuation.section.brackets.end.d +// ^ punctuation.section.group.end.d +// ^ punctuation.terminator.d + auto f = foo ? 12 : 15; //^^^^ storage.modifier.d // ^ variable.other.d @@ -2118,6 +2146,28 @@ extern(1) // ^^ meta.number.integer.decimal.d // ^ punctuation.terminator.d + int a = b ? c : d; +//^^^ storage.type.d +// ^ variable.other.d +// ^ keyword.operator.assignment.d +// ^ meta.path.d variable.other.d +// ^ keyword.operator.ternary.d +// ^ meta.path.d variable.other.d +// ^ keyword.operator.ternary.d +// ^ meta.path.d variable.other.d +// ^ punctuation.terminator.d + + int a=b?c:d; +//^^^ storage.type.d +// ^ variable.other.d +// ^ keyword.operator.assignment.d +// ^ meta.path.d variable.other.d +// ^ keyword.operator.ternary.d +// ^ meta.path.d variable.other.d +// ^ keyword.operator.ternary.d +// ^ meta.path.d variable.other.d +// ^ punctuation.terminator.d + foreach (ref a; foo) {} //^^^^^^^ keyword.control.loop.d // ^ punctuation.section.parens.begin.d @@ -2186,6 +2236,22 @@ extern(1) // ^^ keyword.operator.arithmetic.d // ^ meta.number.integer.decimal.d // ^ punctuation.separator.case-statement.d + case foo: + //^^^^ keyword.control.flow.d + // ^^^ meta.path.d variable.other.d + // ^ punctuation.separator.case-statement.d + baz(); + // ^^^^^ meta.block.d meta.function-call.d + // ^ punctuation.terminator.d + case foo, bar: + //^^^^ keyword.control.flow.d + // ^^^ meta.path.d variable.other.d + // ^ punctuation.separator.sequence.d + // ^^^ meta.path.d variable.other.d + // ^ punctuation.separator.case-statement.d + baz(); + // ^^^^^ meta.block.d meta.function-call.d + // ^ punctuation.terminator.d case 2, "foo": //^^^^ keyword.control.flow.d // ^ meta.number.integer.decimal.d @@ -2202,6 +2268,30 @@ extern(1) // ^^^^ keyword.control.flow.d // ^ meta.number.integer.decimal.d // ^ punctuation.separator.case-statement.d + case NO_KEY: + //^^^^ keyword.control.flow.d + // ^^^^^^ meta.path.d variable.other.d + // ^ punctuation.separator.case-statement.d + if (foo) { + // ^^ keyword.control.conditional.d + } + break; + // ^^^^^ keyword.control.flow.d + // ^ punctuation.terminator.d + case no_key: .. case NO_KEY: + //^^^^ keyword.control.flow.d + // ^^^^^^ meta.path.d variable.other.d + // ^ punctuation.separator.case-statement.d + // ^^ keyword.operator.d + // ^^^^ keyword.control.flow.d + // ^^^^^^ meta.path.d variable.other.d + // ^ punctuation.separator.case-statement.d + if (foo) { + // ^^ keyword.control.conditional.d + } + break; + // ^^^^^ keyword.control.flow.d + // ^ punctuation.terminator.d default: //^^^^^^^ keyword.control.flow.d // ^ punctuation.separator.case-statement.d diff --git a/Diff/Diff.sublime-settings b/Diff/Diff.sublime-settings new file mode 100644 index 0000000000..139b28603c --- /dev/null +++ b/Diff/Diff.sublime-settings @@ -0,0 +1,4 @@ +{ + "trim_trailing_white_space_on_save": false, + "translate_tabs_to_spaces": false, +} diff --git a/Git Formats/Git Attributes.sublime-syntax b/Git Formats/Git Attributes.sublime-syntax index 4bba0ccf6b..5c4f0349de 100644 --- a/Git Formats/Git Attributes.sublime-syntax +++ b/Git Formats/Git Attributes.sublime-syntax @@ -63,6 +63,7 @@ contexts: - include: Git Common.sublime-syntax#fnmatch-body pattern-attributes: + - meta_include_prototype: false - match: '' set: attributes-list @@ -103,36 +104,44 @@ contexts: scope: invalid.illegal.attribute-name.git.attributes meta-diff: + - meta_include_prototype: false - meta_scope: meta.attribute.builtin.diff.git.attributes - - include: else-pop + - include: immediately-pop meta-encoding: + - meta_include_prototype: false - meta_scope: meta.attribute.builtin.encoding.git.attributes - - include: else-pop + - include: immediately-pop meta-eol: + - meta_include_prototype: false - meta_scope: meta.attribute.builtin.eol.git.attributes - - include: else-pop + - include: immediately-pop meta-filter: + - meta_include_prototype: false - meta_scope: meta.attribute.builtin.filter.git.attributes - - include: else-pop + - include: immediately-pop meta-merge: + - meta_include_prototype: false - meta_scope: meta.attribute.builtin.merge.git.attributes - - include: else-pop + - include: immediately-pop meta-text: + - meta_include_prototype: false - meta_scope: meta.attribute.builtin.text.git.attributes - - include: else-pop + - include: immediately-pop meta-whitespace: + - meta_include_prototype: false - meta_scope: meta.attribute.builtin.whitespace.git.attributes - - include: else-pop + - include: immediately-pop meta-other: + - meta_include_prototype: false - meta_scope: meta.attribute.other.git.attributes - - include: else-pop + - include: immediately-pop ##[ ATTRIBUTE KEY VALUE ]############################################## @@ -140,7 +149,7 @@ contexts: - match: \w+[-\w]*\b scope: meta.mapping.key.git.attributes variable.language.attribute.git.attributes set: attribute-maybe-value-list - - include: else-pop + - include: immediately-pop attribute-maybe-value-list: - meta_content_scope: meta.mapping.git.attributes @@ -151,7 +160,7 @@ contexts: scope: punctuation.separator.mapping.key-value.git.attributes set: attribute-value-expected - include: attribute-separator - - include: else-pop + - include: immediately-pop attribute-value-list: - meta_content_scope: meta.mapping.value.git.attributes @@ -164,22 +173,18 @@ contexts: set: attribute-value-expected - match: \S scope: invalid.illegal.value.git.attributes - - include: else-pop + - include: immediately-pop attribute-value-content: # double quoted value - match: \" scope: punctuation.definition.string.begin.git.attributes - set: - - meta_scope: string.quoted.double.git.attributes - - include: string-end - - match: \\[\\\"\'fnrst] - scope: constant.character.escape.git.attributes + set: string-content # unquoted value is everything except , and whitespace - match: '[^,\s]*' - scope: string.unquoted.git.attributes + scope: meta.string.git.attributes string.unquoted.git.attributes pop: true - - include: else-pop + - include: immediately-pop attribute-value-expected: # Attributes are separated by whitespace @@ -197,14 +202,21 @@ contexts: ##[ PROTOTYPES ]####################################################### + string-content: + - meta_include_prototype: false + - meta_scope: meta.string.git.attributes string.quoted.double.git.attributes + - include: string-end + - match: \\[\\\"\'fnrst] + scope: constant.character.escape.git.attributes + string-end: - match: \" scope: punctuation.definition.string.end.git.attributes pop: true - - match: $\n? + - match: \n scope: invalid.illegal.unexpected.eol.git.attributes pop: true - else-pop: + immediately-pop: - match: '' pop: true diff --git a/Git Formats/Git Rebase.sublime-syntax b/Git Formats/Git Rebase.sublime-syntax index fa3c3a4f53..7d908c8573 100644 --- a/Git Formats/Git Rebase.sublime-syntax +++ b/Git Formats/Git Rebase.sublime-syntax @@ -3,10 +3,13 @@ # Highlight interactive rebase text (git rebase -i). name: Git Rebase Todo +scope: text.git.rebase +version: 2 + file_extensions: - git-rebase-todo -first_line_match: '^(?:drop|edit|exec|fixup|pick|reword|squash|[defprsx]) \h{7,} ' -scope: text.git.rebase + +first_line_match: '^(?:drop|edit|fixup|pick|reword|squash|[defprsx]) \h{7,} ' variables: comment_char: '[#;]' @@ -16,21 +19,24 @@ contexts: main: - include: comments - - include: commit + - include: shell-commands + - include: branch-commands + - include: commit-commands ##[ COMMENTS ]######################################################### comments: - - match: ^\s*({{comment_char}}) - captures: - 1: punctuation.definition.comment.git.rebase - push: - - meta_scope: comment.line.git.rebase - - match: ^(?!\s*{{comment_char}}) - pop: true - - include: heading - - include: commands-help - - include: rebase-msg + - match: '{{comment_char}}' + scope: punctuation.definition.comment.git.rebase + push: comment-content + + comment-content: + - meta_scope: comment.line.git.rebase + - match: ^(?!\s*{{comment_char}}) + pop: 1 + - include: heading + - include: commands-help + - include: rebase-msg heading: # all comments ending with colon are scoped as headlines @@ -108,61 +114,93 @@ contexts: 3: constant.other.hash.git.rebase 4: constant.other.hash.git.rebase -##[ COMMITS ]########################################################## +##[ COMMANDS ]######################################################### + + branch-commands: + - match: ^\s*(label)\s+(\S+) + captures: + 0: meta.branch.label.git.rebase + 1: keyword.other.label.git.rebase + 2: constant.language.branch-name.git.commit + - match: ^\s*(merge)\s+((-)C)\s+({{hash}})\s+(\S+) + captures: + 0: meta.branch.merge.git.rebase + 1: keyword.operator.branch.merge.git.rebase + 2: variable.parameter.option.git.rebase + 3: punctuation.definition.variable.git.rebase + 4: constant.other.hash.git.rebase + 5: constant.language.branch-name.git.commit + - match: ^\s*(reset)\s+(?:({{hash}})|(\S+)) + captures: + 0: meta.branch.reset.git.rebase + 1: keyword.operator.branch.reset.git.rebase + 2: constant.other.hash.git.rebase + 3: constant.language.branch-name.git.commit - commit: + commit-commands: # e.g. pick d284bb2 Initial commit - match: ^\s* - push: [commit-subject, commit-hash, commit-commands] + push: [commit-subject, commit-hash, commit-command] - commit-commands: + commit-command: - match: (?:d|drop)\b scope: keyword.operator.commit.drop.git.rebase - pop: true + pop: 1 - match: (?:e|edit)\b scope: keyword.operator.commit.edit.git.rebase - pop: true - - match: (?:x|exec)\b - scope: keyword.operator.commit.exec.git.rebase - pop: true + pop: 1 - match: (?:f|fixup)\b scope: keyword.operator.commit.fixup.git.rebase - pop: true + pop: 1 - match: (?:p|pick)\b scope: keyword.operator.commit.pick.git.rebase - pop: true + pop: 1 - match: (?:r|reword)\b scope: keyword.operator.commit.reword.git.rebase - pop: true + pop: 1 - match: (?:s|squash)\b scope: keyword.operator.commit.squash.git.rebase - pop: true + pop: 1 + - include: comments - include: line-end - match: \S+ scope: invalid.illegal.command-expected.git.rebase - pop: true + pop: 1 commit-hash: - match: '{{hash}}' # e.g. d284bb2 scope: constant.other.hash.git.rebase - pop: true + pop: 1 - include: line-end - match: \S+ scope: invalid.illegal.hash-expected.git.rebase - pop: true + pop: 1 commit-subject: - meta_scope: meta.commit.git.rebase - include: line-end - match: (?=\S) # subject beginns with first none whitespece - set: - - meta_scope: meta.commit.git.rebase - - meta_content_scope: meta.subject.git.commit - - include: Git Common.sublime-syntax#references - - include: line-end + set: commit-subject-content + + commit-subject-content: + - meta_scope: meta.commit.git.rebase + - meta_content_scope: meta.subject.git.commit + - include: Git Common.sublime-syntax#references + - include: line-end + + shell-commands: + - match: ^\s*(x|exec)\b + captures: + 0: meta.shell.git.rebase + 1: keyword.operator.exec.git.rebase + embed: scope:source.shell + embed_scope: meta.shell.git.rebase source.shell.embedded.git.rebase + escape: $\n? + escape_captures: + 0: meta.shell.git.rebase ##[ PROTOTYPES ]####################################################### line-end: - match: $\n? - pop: true + pop: 1 diff --git a/Git Formats/Snippets/Git Config - Section.sublime-snippet b/Git Formats/Snippets/Git Config - Section.sublime-snippet index bdf9f3c6cb..71c8603e47 100644 --- a/Git Formats/Snippets/Git Config - Section.sublime-snippet +++ b/Git Formats/Snippets/Git Config - Section.sublime-snippet @@ -4,6 +4,6 @@ $0 ]]> section - source.git.config + text.git.config [section] diff --git a/Git Formats/syntax_test_git_attributes b/Git Formats/tests/syntax_test_git_attributes similarity index 100% rename from Git Formats/syntax_test_git_attributes rename to Git Formats/tests/syntax_test_git_attributes diff --git a/Git Formats/syntax_test_git_commit b/Git Formats/tests/syntax_test_git_commit similarity index 100% rename from Git Formats/syntax_test_git_commit rename to Git Formats/tests/syntax_test_git_commit diff --git a/Git Formats/syntax_test_git_config b/Git Formats/tests/syntax_test_git_config similarity index 100% rename from Git Formats/syntax_test_git_config rename to Git Formats/tests/syntax_test_git_config diff --git a/Git Formats/syntax_test_git_ignore b/Git Formats/tests/syntax_test_git_ignore similarity index 100% rename from Git Formats/syntax_test_git_ignore rename to Git Formats/tests/syntax_test_git_ignore diff --git a/Git Formats/syntax_test_git_link b/Git Formats/tests/syntax_test_git_link similarity index 100% rename from Git Formats/syntax_test_git_link rename to Git Formats/tests/syntax_test_git_link diff --git a/Git Formats/syntax_test_git_log b/Git Formats/tests/syntax_test_git_log similarity index 100% rename from Git Formats/syntax_test_git_log rename to Git Formats/tests/syntax_test_git_log diff --git a/Git Formats/syntax_test_git_mailmap b/Git Formats/tests/syntax_test_git_mailmap similarity index 100% rename from Git Formats/syntax_test_git_mailmap rename to Git Formats/tests/syntax_test_git_mailmap diff --git a/Git Formats/syntax_test_git_merge b/Git Formats/tests/syntax_test_git_merge similarity index 100% rename from Git Formats/syntax_test_git_merge rename to Git Formats/tests/syntax_test_git_merge diff --git a/Git Formats/syntax_test_git_rebase b/Git Formats/tests/syntax_test_git_rebase similarity index 69% rename from Git Formats/syntax_test_git_rebase rename to Git Formats/tests/syntax_test_git_rebase index e9f60e38e9..18979756c6 100644 --- a/Git Formats/syntax_test_git_rebase +++ b/Git Formats/tests/syntax_test_git_rebase @@ -1,5 +1,18 @@ # SYNTAX TEST "Git Rebase.sublime-syntax" # <- text.git.rebase comment.line punctuation.definition.comment +label onto +# <- meta.branch.label.git.rebase keyword.other.label.git.rebase +#^^^^^^^^^ meta.branch.label.git.rebase +#^^^^ keyword.other.label.git.rebase +# ^^^^ constant.language.branch-name.git.commit +reset 9698953 # Fix form submission +# <- meta.branch.reset.git.rebase keyword.operator.branch.reset.git.rebase +#^^^^^^^^^^^^ meta.branch.reset.git.rebase +# ^ - meta.branch - comment +# ^^^^^^^^^^^^^^^^^^^^^^ comment.line.git.rebase +# ^ punctuation.definition.comment.git.rebase +#^^^^ keyword.operator.branch.reset.git.rebase +# ^^^^^^^ constant.other.hash.git.rebase pick d284bb2 Initial commit # <- meta.commit #^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.commit @@ -63,6 +76,28 @@ a 6746x20 Invalid command and hash # no comment (#403) # ^ punctuation.definition.reference.issue.git # ^^^^ meta.reference.issue.git constant.other.reference.issue.git # ^ - meta.subject.git.commit +label feature/branch-name +# <- meta.branch.label.git.rebase keyword.other.label.git.rebase +#^^^^^^^^^^^^^^^^^^^^^^^^ meta.branch.label.git.rebase +#^^^^ keyword.other.label.git.rebase +# ^^^^^^^^^^^^^^^^^^^ constant.language.branch-name.git.commit +reset onto +# <- meta.branch.reset.git.rebase keyword.operator.branch.reset.git.rebase +#^^^^^^^^^ meta.branch.reset.git.rebase +#^^^^ keyword.operator.branch.reset.git.rebase +# ^^^^ constant.language.branch-name.git.commit +merge -C c7cba2e feature/branch-name # Merge branch 'alicja/loyalty' +# <- meta.branch.merge.git.rebase keyword.operator.branch.merge.git.rebase +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.branch.merge.git.rebase +# ^ - meta.branch - comment +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.git.rebase +# ^ punctuation.definition.comment.git.rebase +#^^^^ keyword.operator.branch.merge.git.rebase +# ^^ variable.parameter.option.git.rebase +# ^ punctuation.definition.variable.git.rebase +# ^^^^^^^ constant.other.hash.git.rebase +# ^^^^^^^^^^^^^^^^^^^ constant.language.branch-name.git.commit + # p 6746220 Second pick commit # no comment # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.git.rebase d d284bb2 Drop commit @@ -73,10 +108,6 @@ a 6746x20 Invalid command and hash # no comment (#403) # ^ keyword.operator.commit.edit edit d284bb2 Edit commit # ^^^^ keyword.operator.commit.edit - x d284bb2 Execute command -# ^ keyword.operator.commit.exec - exec d284bb2 Execute command -# ^^^^ keyword.operator.commit.exec f d284bb2 Fixup commit # ^ keyword.operator.commit.fixup fixup d284bb2 Fixup commit @@ -85,6 +116,24 @@ a 6746x20 Invalid command and hash # no comment (#403) # ^ keyword.operator.commit.reword reword d284bb2 Reword commit # ^^^^^^ keyword.operator.commit.reword + x git tag -d 0.1.0 +# ^ meta.shell.git.rebase - source.shell +# ^^^^^^^^^^^^^^^^^ meta.shell.git.rebase source.shell.embedded.git.rebase +# ^^^ meta.function-call.identifier.shell +# ^^^^^^^^^^^^^ meta.function-call.arguments.shell +# ^ meta.shell.git.rebase - source +# ^ keyword.operator.exec.git.rebase +# ^^^ variable.function.shell +# ^^ variable.parameter.option.shell + exec git tag -d 0.1.0 +# ^^^^ meta.shell.git.rebase - source.shell +# ^^^^^^^^^^^^^^^^^ meta.shell.git.rebase source.shell.embedded.git.rebase +# ^^^ meta.function-call.identifier.shell +# ^^^^^^^^^^^^^ meta.function-call.arguments.shell +# ^^^^ keyword.operator.exec.git.rebase +# ^^^ variable.function.shell +# ^^ variable.parameter.option.shell +# ^ meta.shell.git.rebase - source # Rebase 9e73d21..6746220 onto 9e73d21 (2 commands) # <- comment.line punctuation.definition.comment diff --git a/Git Formats/syntax_test_git_tag b/Git Formats/tests/syntax_test_git_tag similarity index 100% rename from Git Formats/syntax_test_git_tag rename to Git Formats/tests/syntax_test_git_tag diff --git a/Go/Go.sublime-syntax b/Go/Go.sublime-syntax index 57505d4735..5710209839 100644 --- a/Go/Go.sublime-syntax +++ b/Go/Go.sublime-syntax @@ -2,7 +2,7 @@ --- # http://www.sublimetext.com/docs/3/syntax.html -# The structure and terminology of this syntax reflects the spec: +# The structure and lexicon of this syntax reflects the Go spec: # https://golang.org/ref/spec # The following is a simplified model of Sublime Text's syntax engine, reverse- @@ -126,7 +126,7 @@ contexts: 3: meta.punctuation.accessor.colon.go 4: meta.variable.function.go push: - - meta_scope: comment.line.go meta.annotation.go + - meta_scope: meta.annotation.go comment.line.go - match: \S+ scope: meta.variable.parameter.go # End the annotation scope at EOL, but stretch the comment scope @@ -161,6 +161,9 @@ contexts: pop: true # https://golang.org/ref/spec#Tokens + # + # Nominally, this should include `match-call-or-type-conversion`; instead, + # it's specified in `match-parens` to ensure proper ordering. match-tokens: - include: match-keywords - include: match-identifiers @@ -199,7 +202,7 @@ contexts: # See `match-selector` for field scoping. match-identifiers: - include: match-predeclared-constants - - include: match-call-or-cast + - include: match-call-or-type-conversion - include: match-short-variable-declarations - match: \b_\b scope: variable.language.blank.go @@ -218,12 +221,13 @@ contexts: - match: \b(?:true|false|nil)\b scope: constant.language.go - # Note: in Go, calls and casts are syntactically identical. Detecting casts - # and scoping them as types is beyond the capabilities of this syntax engine. + # Reference: https://golang.org/ref/spec#Predeclared_identifiers # - # https://golang.org/ref/spec#Predeclared_identifiers + # Note: in Go, calls and type conversions are syntactically identical. + # Detecting type conversions and scoping them as types is beyond the + # capabilities of this syntax engine. # - # Notes on built-in functions + # # 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 @@ -237,13 +241,14 @@ contexts: # built-in functions ONLY in a function call position. This helps minimize # false positives. # - # Notes on built-in types + # # 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: + # Unlike type conversions involving a user-defined type, type conversions + # involving built-in types could be scoped purely as types rather than + # function calls, hoping that they haven't been redefined as functions. + # 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-type-conversion: - match: \b(?:make|new)\b(?=(?:{{noise}}\))*{{noise}}\() scope: variable.function.go support.function.builtin.go push: pop-arguments-starting-with-type @@ -254,8 +259,8 @@ contexts: - match: '{{ident}}(?=(?:{{noise}}\))*{{noise}}\()' scope: variable.function.go - # See notes on `match-call-or-cast`. - pop-call-or-cast: + # See notes on `match-call-or-type-conversion`. + pop-call-or-type-conversion: - match: \b(?:make|new)\b(?=(?:{{noise}}\))*{{noise}}\() scope: variable.function.go support.function.builtin.go set: pop-arguments-starting-with-type @@ -340,13 +345,15 @@ contexts: - include: match-comments - include: pop-type-assertion - # Note: calls and casts are syntactically identical. + # Note: we can't syntactically distinguish calls from type conversions. + # It's also not always possible to distinguish function calls from + # method calls. - match: '{{ident}}(?=(?:{{noise}}\))*{{noise}}\()' scope: variable.function.go pop: true - include: pop-member - # Note: newlines between dot and assertion/field are ok + # Note: newlines between dot and assertion/field are ok. - include: pop-before-nonblank match-parens: @@ -356,7 +363,7 @@ contexts: - match: \) scope: punctuation.section.parens.end.go pop: true - - include: pop-call-or-cast + - include: pop-call-or-type-conversion - include: match-any - match: \) scope: punctuation.section.parens.end.go @@ -378,6 +385,15 @@ contexts: - include: pop-type-identifier - include: pop-before-nonblank + # TODO: consider detecting composite literals. In principle, it should allow + # us to drop the erroneous "meta.block" from composite literals, detect field + # names, and also detect labeled statements by disambiguating them from field + # names. + # + # For future reference: + # + # https://golang.org/ref/spec#Composite_literals + # https://golang.org/ref/spec#Labeled_statements match-braces: - match: \{ scope: punctuation.section.braces.begin.go @@ -399,24 +415,20 @@ contexts: match-imaginary: # Decimal imaginary numbers - - match: '({{dec_digits}})(?:(\.)({{dec_digits}})?)?({{dec_exponent}})?(i)' + - match: '({{dec_digits}}(?:(\.){{dec_digits}}?)?{{dec_exponent}}?)(i)' scope: meta.number.imaginary.decimal.go captures: 1: constant.numeric.value.go 2: punctuation.separator.decimal.go - 3: constant.numeric.value.go - 4: constant.numeric.value.exponent.go - 5: constant.numeric.suffix.go + 3: constant.numeric.suffix.go # Hexadecimal imaginary numbers - - match: (0[xX])({{hex_digits}})?(?:(\.)({{hex_digits}})?)?({{hex_exponent}})?(i) + - match: (0[xX])({{hex_digits}}?(?:(\.){{hex_digits}}?)?{{hex_exponent}}?)(i) scope: meta.number.imaginary.hexadecimal.go captures: 1: constant.numeric.base.go 2: constant.numeric.value.go 3: punctuation.separator.decimal.go - 4: constant.numeric.value.go - 5: constant.numeric.value.exponent.go - 6: constant.numeric.suffix.go + 4: constant.numeric.suffix.go # Octal imaginary numbers - match: (0[oO])({{oct_digits}})(i) scope: meta.number.imaginary.octal.go @@ -436,28 +448,24 @@ contexts: # Decimal float literal - match: |- (?x: - ({{dec_digits}})(?:(\.)({{dec_digits}})?({{dec_exponent}})?|({{dec_exponent}})) - | (\.)({{dec_digits}})({{dec_exponent}})? + # 1.1, 1., 1.1e1, 1.e1 + {{dec_digits}}(\.){{dec_digits}}?{{dec_exponent}}? + # 1e1 + | {{dec_digits}}{{dec_exponent}} + # .1, .1e1 + | (\.){{dec_digits}}{{dec_exponent}}? ) - scope: meta.number.float.decimal.go + scope: meta.number.float.decimal.go constant.numeric.value.go captures: - 1: constant.numeric.value.go + 1: punctuation.separator.decimal.go 2: punctuation.separator.decimal.go - 3: constant.numeric.value.go - 4: constant.numeric.value.exponent.go - 5: constant.numeric.value.exponent.go - 6: punctuation.separator.decimal.go - 7: constant.numeric.value.go - 8: constant.numeric.value.exponent.go # Hexadecimal float literal - - match: (0[xX])({{hex_digits}})?(?:(\.)({{hex_digits}})?)?({{hex_exponent}}) + - match: (0[xX])({{hex_digits}}?(?:(\.){{hex_digits}}?)?{{hex_exponent}}) scope: meta.number.float.hexadecimal.go captures: 1: constant.numeric.base.go 2: constant.numeric.value.go 3: punctuation.separator.decimal.go - 4: constant.numeric.value.go - 5: constant.numeric.value.exponent.go match-integers: - include: match-octal-integer @@ -598,7 +606,7 @@ contexts: match-keyword-const: - match: \bconst\b - scope: storage.type.keyword.const.go + scope: keyword.declaration.const.go push: - match: \( scope: punctuation.section.parens.begin.go @@ -664,7 +672,7 @@ contexts: match-keyword-func: - match: \bfunc\b - scope: storage.type.keyword.function.go + scope: keyword.declaration.function.go push: - include: match-comments @@ -705,7 +713,6 @@ contexts: match-keyword-interface: - match: (?=\binterface\b) - scope: storage.type.keyword.interface.go push: pop-interface match-keyword-map: @@ -744,7 +751,7 @@ contexts: match-keyword-type: - match: \btype\b - scope: storage.type.keyword.type.go + scope: keyword.declaration.type.go push: - include: match-comments @@ -779,7 +786,7 @@ contexts: match-keyword-var: - match: \bvar\b - scope: storage.type.keyword.var.go + scope: keyword.declaration.var.go push: - match: \( scope: punctuation.section.parens.begin.go @@ -969,7 +976,7 @@ contexts: - match: (?=\bstruct\b) set: pop-struct - match: \bfunc\b - scope: storage.type.keyword.function.go + scope: keyword.declaration.function.go set: pop-func-parameter-and-return-lists - match: (?={{ident}}) set: pop-named-type @@ -984,7 +991,7 @@ contexts: pop-struct: - match: \bstruct\b - scope: storage.type.keyword.struct.go + scope: keyword.declaration.struct.go set: - include: match-comments - match: \{ @@ -1026,7 +1033,7 @@ contexts: pop-interface: - match: \binterface\b - scope: storage.type.keyword.interface.go + scope: keyword.declaration.interface.go set: - include: match-comments - match: \{ @@ -1063,7 +1070,7 @@ contexts: # Note: newlines between `map` and `[` are ok, but newlines after `]` # terminate the type. - match: \bmap\b - scope: storage.type.keyword.map.go + scope: keyword.declaration.map.go set: - include: match-comments - include: pop-on-semicolon @@ -1087,7 +1094,7 @@ contexts: # perfectly ok. pop-chan: - match: \bchan\b - scope: storage.type.keyword.chan.go + scope: keyword.declaration.chan.go set: pop-type pop-named-type: @@ -1202,6 +1209,8 @@ contexts: pop-arguments-starting-with-type: - include: match-comments + # Go allows functions and types to be wrapped in an arbitrary number of + # parens. These are not part of the call. - match: \) scope: punctuation.section.parens.end.go - match: \( diff --git a/Go/Indention Rules.tmPreferences b/Go/Indention Rules.tmPreferences index 5e1c32852a..b3a7b31c2e 100644 --- a/Go/Indention Rules.tmPreferences +++ b/Go/Indention Rules.tmPreferences @@ -1,3 +1,4 @@ + - - scope diff --git a/Go/syntax_test_go.go b/Go/syntax_test_go.go index 30766e6362..991b2e68f0 100644 --- a/Go/syntax_test_go.go +++ b/Go/syntax_test_go.go @@ -61,13 +61,13 @@ You may have to disable Go-specific linters when working on this file. //go: // ^ -comment -meta -punctuation // ^^ punctuation.definition.comment.go -// ^^^^^ comment.line.go meta.annotation.go +// ^^^^^ meta.annotation.go comment.line.go // ^ comment.line.go -meta.annotation //go:generate one two three // ^ -comment -meta -punctuation // ^^ punctuation.definition.comment.go -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.go meta.annotation.go +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.annotation.go comment.line.go // ^ comment.line.go -meta.annotation @@ -121,32 +121,32 @@ Note: built-ins are tested separately. Search for "# Built-in Types". // ## chan chan _ -// ^^^^ storage.type.keyword.chan.go +// ^^^^ keyword.declaration.chan.go // ^ variable.language.blank.go chan typ -// ^^^^ storage.type.keyword.chan.go +// ^^^^ keyword.declaration.chan.go // ^^^ storage.type.go chan typ ident -// ^^^^ storage.type.keyword.chan.go +// ^^^^ keyword.declaration.chan.go // ^^^ storage.type.go // ^^^^^ variable.other.go chan ((typ)) -// ^^^^ storage.type.keyword.chan.go +// ^^^^ keyword.declaration.chan.go // ^^ punctuation.section.parens.begin.go // ^^^ storage.type.go // ^^ punctuation.section.parens.end.go chan ident.typ -// ^^^^ storage.type.keyword.chan.go +// ^^^^ keyword.declaration.chan.go // ^^^^^ variable.other.go // ^ punctuation.accessor.dot.go // ^^^ storage.type.go chan ident.ident.typ -// ^^^^ storage.type.keyword.chan.go +// ^^^^ keyword.declaration.chan.go // ^^^^^ variable.other.go // ^ punctuation.accessor.dot.go // ^^^^^ variable.other.go @@ -154,7 +154,7 @@ Note: built-ins are tested separately. Search for "# Built-in Types". // ^^^ storage.type.go chan ((ident.ident.typ)) -// ^^^^ storage.type.keyword.chan.go +// ^^^^ keyword.declaration.chan.go // ^^ punctuation.section.parens.begin.go // ^^^^^ variable.other.go // ^ punctuation.accessor.dot.go @@ -165,14 +165,14 @@ Note: built-ins are tested separately. Search for "# Built-in Types". <- chan ident.typ // ^^ keyword.operator.assignment.go -// ^^^^ storage.type.keyword.chan.go +// ^^^^ keyword.declaration.chan.go // ^^^^^ variable.other.go // ^ punctuation.accessor.dot.go // ^^^ storage.type.go <- chan ident.ident.typ // ^^ keyword.operator.assignment.go -// ^^^^ storage.type.keyword.chan.go +// ^^^^ keyword.declaration.chan.go // ^^^^^ variable.other.go // ^ punctuation.accessor.dot.go // ^^^^^ variable.other.go @@ -180,14 +180,14 @@ Note: built-ins are tested separately. Search for "# Built-in Types". // ^^^ storage.type.go chan <- ident.typ -// ^^^^ storage.type.keyword.chan.go +// ^^^^ keyword.declaration.chan.go // ^^ keyword.operator.assignment.go // ^^^^^ variable.other.go // ^ punctuation.accessor.dot.go // ^^^ storage.type.go chan <- ident.ident.typ -// ^^^^ storage.type.keyword.chan.go +// ^^^^ keyword.declaration.chan.go // ^^ keyword.operator.assignment.go // ^^^^^ variable.other.go // ^ punctuation.accessor.dot.go @@ -196,12 +196,12 @@ Note: built-ins are tested separately. Search for "# Built-in Types". // ^^^ storage.type.go chan -// ^^^^ storage.type.keyword.chan.go +// ^^^^ keyword.declaration.chan.go typ // ^^^ storage.type.go chan -// ^^^^ storage.type.keyword.chan.go +// ^^^^ keyword.declaration.chan.go ident /**/ . /**/ // ^^^^^ variable.other.go // ^^^^ comment.block.go @@ -213,7 +213,7 @@ Note: built-ins are tested separately. Search for "# Built-in Types". <- // ^^ keyword.operator.assignment.go chan -// ^^^^ storage.type.keyword.chan.go +// ^^^^ keyword.declaration.chan.go ident /**/ . /**/ // ^^^^^ variable.other.go // ^^^^ comment.block.go @@ -228,7 +228,7 @@ Note: built-ins are tested separately. Search for "# Built-in Types". // ^^^ storage.type.go chan -// ^^^^ storage.type.keyword.chan.go +// ^^^^ keyword.declaration.chan.go <- /**/ // ^^ keyword.operator.assignment.go // ^^^^ comment.block.go @@ -246,68 +246,68 @@ Note: built-ins are tested separately. Search for "# Built-in Types". // ^^^ storage.type.go chan chan chan typ -// ^^^^ storage.type.keyword.chan.go -// ^^^^ storage.type.keyword.chan.go -// ^^^^ storage.type.keyword.chan.go +// ^^^^ keyword.declaration.chan.go +// ^^^^ keyword.declaration.chan.go +// ^^^^ keyword.declaration.chan.go // ^^^ storage.type.go chan *chan **chan ***typ -// ^^^^ storage.type.keyword.chan.go +// ^^^^ keyword.declaration.chan.go // ^ keyword.operator.go -// ^^^^ storage.type.keyword.chan.go +// ^^^^ keyword.declaration.chan.go // ^^ keyword.operator.go -// ^^^^ storage.type.keyword.chan.go +// ^^^^ keyword.declaration.chan.go // ^^^ keyword.operator.go // ^^^ storage.type.go chan struct{} -// ^^^^ storage.type.keyword.chan.go -// ^^^^^^ storage.type.keyword.struct.go +// ^^^^ keyword.declaration.chan.go +// ^^^^^^ keyword.declaration.struct.go chan struct{} ident -// ^^^^ storage.type.keyword.chan.go -// ^^^^^^ storage.type.keyword.struct.go +// ^^^^ keyword.declaration.chan.go +// ^^^^^^ keyword.declaration.struct.go // ^^^^^ variable.other.go chan interface{} -// ^^^^ storage.type.keyword.chan.go -// ^^^^^^^^^ storage.type.keyword.interface.go +// ^^^^ keyword.declaration.chan.go +// ^^^^^^^^^ keyword.declaration.interface.go chan interface{} ident -// ^^^^ storage.type.keyword.chan.go -// ^^^^^^^^^ storage.type.keyword.interface.go +// ^^^^ keyword.declaration.chan.go +// ^^^^^^^^^ keyword.declaration.interface.go // ^^^^^ variable.other.go chan func() func() typ -// ^^^^ storage.type.keyword.chan.go -// ^^^^ storage.type.keyword.function.go -// ^^^^ storage.type.keyword.function.go +// ^^^^ keyword.declaration.chan.go +// ^^^^ keyword.declaration.function.go +// ^^^^ keyword.declaration.function.go // ^^^ storage.type.go chan func() func() typ ident -// ^^^^ storage.type.keyword.chan.go -// ^^^^ storage.type.keyword.function.go -// ^^^^ storage.type.keyword.function.go +// ^^^^ keyword.declaration.chan.go +// ^^^^ keyword.declaration.function.go +// ^^^^ keyword.declaration.function.go // ^^^ storage.type.go // ^^^^^ variable.other.go chan -// ^^^^ storage.type.keyword.chan.go +// ^^^^ keyword.declaration.chan.go func() typ -// ^^^^ storage.type.keyword.function.go +// ^^^^ keyword.declaration.function.go // ^^^ storage.type.go chan []typ -// ^^^^ storage.type.keyword.chan.go +// ^^^^ keyword.declaration.chan.go // ^^^ storage.type.go chan [][][]typ -// ^^^^ storage.type.keyword.chan.go +// ^^^^ keyword.declaration.chan.go // ^^^ storage.type.go chan map[typ]typ -// ^^^^ storage.type.keyword.chan.go -// ^^^ storage.type.keyword.map.go +// ^^^^ keyword.declaration.chan.go +// ^^^ keyword.declaration.map.go // ^^^ storage.type.go // ^^^ storage.type.go @@ -320,12 +320,12 @@ Note: built-ins are tested separately. Search for "# Built-in Types". // function types. func() -// ^^^^ storage.type.keyword.function.go +// ^^^^ keyword.declaration.function.go // ^ punctuation.section.parens.begin.go // ^ punctuation.section.parens.end.go func(typ, typ) -// ^^^^ storage.type.keyword.function.go +// ^^^^ keyword.declaration.function.go // ^ punctuation.section.parens.begin.go // ^^^ storage.type.go // ^ punctuation.separator.go @@ -341,12 +341,12 @@ Note: built-ins are tested separately. Search for "# Built-in Types". // ^^^ storage.type.go func() -// ^^^^ storage.type.keyword.function.go +// ^^^^ keyword.declaration.function.go ident // ^^^^^ variable.other.go -storage func(true false) (nil iota) -// ^^^^ storage.type.keyword.function.go +// ^^^^ keyword.declaration.function.go // ^^^^ variable.parameter.go // ^^^^^ storage.type.go // ^^^ variable.parameter.go @@ -358,7 +358,7 @@ Note: built-ins are tested separately. Search for "# Built-in Types". // ^^^ storage.type.go func(param /**/ ... /**/ typ) -// ^^^^ storage.type.keyword.function.go +// ^^^^ keyword.declaration.function.go // ^^^^^ variable.parameter.go // ^^^^ comment.block.go // ^^^ keyword.operator.variadic.go @@ -366,7 +366,7 @@ Note: built-ins are tested separately. Search for "# Built-in Types". // ^^^ storage.type.go func(param ((typ)), param ...typ) -// ^^^^ storage.type.keyword.function.go +// ^^^^ keyword.declaration.function.go // ^^^^^ variable.parameter.go // ^^^ storage.type.go // ^^^^^ variable.parameter.go @@ -374,7 +374,7 @@ Note: built-ins are tested separately. Search for "# Built-in Types". // ^^^ storage.type.go func(param, param ((typ)), param, param ...typ) -// ^^^^ storage.type.keyword.function.go +// ^^^^ keyword.declaration.function.go // ^^^^^ variable.parameter.go // ^^^^^ variable.parameter.go // ^^^ storage.type.go @@ -455,14 +455,14 @@ Note: built-ins are tested separately. Search for "# Built-in Types". // ^^^^ storage.type.go func(...ident.Type) -// ^^^^ storage.type.keyword.function.go +// ^^^^ keyword.declaration.function.go // ^^^ keyword.operator.variadic.go // ^^^^^ variable.other.go // ^ punctuation.accessor.dot.go // ^^^^ storage.type.go func(...*ident.Type) -// ^^^^ storage.type.keyword.function.go +// ^^^^ keyword.declaration.function.go // ^^^ keyword.operator.variadic.go // ^ keyword.operator.go // ^^^^^ variable.other.go @@ -479,13 +479,13 @@ Note: built-ins are tested separately. Search for "# Built-in Types". ) func(param...typ) -// ^^^^ storage.type.keyword.function.go +// ^^^^ keyword.declaration.function.go // ^^^^^ variable.parameter.go // ^^^ keyword.operator.variadic.go // ^^^ storage.type.go func(param...ident.Type) -// ^^^^ storage.type.keyword.function.go +// ^^^^ keyword.declaration.function.go // ^^^^^ variable.parameter.go // ^^^ keyword.operator.variadic.go // ^^^^^ variable.other.go @@ -493,7 +493,7 @@ Note: built-ins are tested separately. Search for "# Built-in Types". // ^^^^ storage.type.go func(param...*ident.Type) -// ^^^^ storage.type.keyword.function.go +// ^^^^ keyword.declaration.function.go // ^^^^^ variable.parameter.go // ^^^ keyword.operator.variadic.go // ^ keyword.operator.go @@ -539,7 +539,7 @@ Note: built-ins are tested separately. Search for "# Built-in Types". // Deranged case func /**/ ( -// ^^^^ storage.type.keyword.function.go +// ^^^^ keyword.declaration.function.go // ^^^^ comment.block.go // ^ punctuation.section.parens.begin.go /**/ @@ -611,9 +611,9 @@ Note: built-ins are tested separately. Search for "# Built-in Types". // ^^^ storage.type.go func() func() func() typ -// ^^^^ storage.type.keyword.function.go -// ^^^^ storage.type.keyword.function.go -// ^^^^ storage.type.keyword.function.go +// ^^^^ keyword.declaration.function.go +// ^^^^ keyword.declaration.function.go +// ^^^^ keyword.declaration.function.go // ^^^ storage.type.go func() func() func() ((typ)) @@ -621,25 +621,25 @@ Note: built-ins are tested separately. Search for "# Built-in Types". // Deranged case func(param func(param func(param ...typ) func() typ) ...func(param typ)) -// ^^^^ storage.type.keyword.function.go +// ^^^^ keyword.declaration.function.go // ^ punctuation.section.parens.begin.go // ^^^^^ variable.parameter.go -// ^^^^ storage.type.keyword.function.go +// ^^^^ keyword.declaration.function.go // ^ punctuation.section.parens.begin.go // ^^^^^ variable.parameter.go -// ^^^^ storage.type.keyword.function.go +// ^^^^ keyword.declaration.function.go // ^ punctuation.section.parens.begin.go // ^^^^^ variable.parameter.go // ^^^ keyword.operator.variadic.go // ^^^ storage.type.go // ^ punctuation.section.parens.end.go -// ^^^^ storage.type.keyword.function.go +// ^^^^ keyword.declaration.function.go // ^ punctuation.section.parens.begin.go // ^ punctuation.section.parens.end.go // ^^^ storage.type.go // ^ punctuation.section.parens.end.go // ^^^ keyword.operator.variadic.go -// ^^^^ storage.type.keyword.function.go +// ^^^^ keyword.declaration.function.go // ^ punctuation.section.parens.begin.go // ^^^^^ variable.parameter.go // ^^^ storage.type.go @@ -649,12 +649,12 @@ Note: built-ins are tested separately. Search for "# Built-in Types". // ## interface interface{} -// ^^^^^^^^^ storage.type.keyword.interface.go +// ^^^^^^^^^ keyword.declaration.interface.go // ^ meta.type.go punctuation.section.braces.begin.go // ^ meta.type.go punctuation.section.braces.end.go interface /**/ { -// ^^^^^^^^^ storage.type.keyword.interface.go +// ^^^^^^^^^ keyword.declaration.interface.go // ^^^^ comment.block.go // ^ meta.type.go punctuation.section.braces.begin.go @@ -722,7 +722,7 @@ Note: built-ins are tested separately. Search for "# Built-in Types". // ^ meta.type.go punctuation.section.braces.end.go interface -// ^^^^^^^^^ storage.type.keyword.interface.go +// ^^^^^^^^^ keyword.declaration.interface.go {Method(param typ) typ; Inherit; Method(param typ) typ;} // ^ meta.type.go punctuation.section.braces.begin.go // ^^^^^^ meta.type.go entity.name.function.go @@ -747,14 +747,14 @@ Note: built-ins are tested separately. Search for "# Built-in Types". // ## map map[typ]typ -// ^^^ storage.type.keyword.map.go +// ^^^ keyword.declaration.map.go // ^ punctuation.section.brackets.begin.go // ^^^ storage.type.go // ^ punctuation.section.brackets.end.go // ^^^ storage.type.go map[typ]typ ident -// ^^^ storage.type.keyword.map.go +// ^^^ keyword.declaration.map.go // ^ punctuation.section.brackets.begin.go // ^^^ storage.type.go // ^ punctuation.section.brackets.end.go @@ -762,13 +762,13 @@ Note: built-ins are tested separately. Search for "# Built-in Types". // ^^^^^ variable.other.go -storage map[typ] -// ^^^ storage.type.keyword.map.go +// ^^^ keyword.declaration.map.go // ^^^ storage.type.go ident // ^^^^^ variable.other.go map /**/ [/**/ typ /**/] /**/ typ -// ^^^ storage.type.keyword.map.go +// ^^^ keyword.declaration.map.go // ^^^^ comment.block.go // ^ punctuation.section.brackets.begin.go // ^^^^ comment.block.go @@ -779,7 +779,7 @@ Note: built-ins are tested separately. Search for "# Built-in Types". // ^^^ storage.type.go map /**/ -// ^^^ storage.type.keyword.map.go +// ^^^ keyword.declaration.map.go // ^^^^ comment.block.go /**/ [ /**/ // ^^^^ comment.block.go @@ -794,63 +794,63 @@ Note: built-ins are tested separately. Search for "# Built-in Types". // ^^^ storage.type.go map[typ]map[typ]map[typ]map[typ]typ -// ^^^ storage.type.keyword.map.go +// ^^^ keyword.declaration.map.go // ^^^ storage.type.go -// ^^^ storage.type.keyword.map.go +// ^^^ keyword.declaration.map.go // ^^^ storage.type.go -// ^^^ storage.type.keyword.map.go +// ^^^ keyword.declaration.map.go // ^^^ storage.type.go -// ^^^ storage.type.keyword.map.go +// ^^^ keyword.declaration.map.go // ^^^ storage.type.go // ^^^ storage.type.go map[chan chan typ]chan chan typ ident -// ^^^ storage.type.keyword.map.go -// ^^^^ storage.type.keyword.chan.go -// ^^^^ storage.type.keyword.chan.go +// ^^^ keyword.declaration.map.go +// ^^^^ keyword.declaration.chan.go +// ^^^^ keyword.declaration.chan.go // ^^^ storage.type.go -// ^^^^ storage.type.keyword.chan.go -// ^^^^ storage.type.keyword.chan.go +// ^^^^ keyword.declaration.chan.go +// ^^^^ keyword.declaration.chan.go // ^^^ storage.type.go // ^^^^^ variable.other.go map[<- chan typ] chan <- typ -// ^^^ storage.type.keyword.map.go +// ^^^ keyword.declaration.map.go // ^^ keyword.operator.assignment.go -// ^^^^ storage.type.keyword.chan.go +// ^^^^ keyword.declaration.chan.go // ^^^ storage.type.go -// ^^^^ storage.type.keyword.chan.go +// ^^^^ keyword.declaration.chan.go // ^^ keyword.operator.assignment.go // ^^^ storage.type.go map[func(param typ) typ]func(param typ) typ -// ^^^ storage.type.keyword.map.go -// ^^^^ storage.type.keyword.function.go +// ^^^ keyword.declaration.map.go +// ^^^^ keyword.declaration.function.go // ^^^^^ variable.parameter.go // ^^^ storage.type.go // ^^^ storage.type.go -// ^^^^ storage.type.keyword.function.go +// ^^^^ keyword.declaration.function.go // ^^^^^ variable.parameter.go // ^^^ storage.type.go // ^^^ storage.type.go map[map[typ]typ]map[typ]typ -// ^^^ storage.type.keyword.map.go -// ^^^ storage.type.keyword.map.go +// ^^^ keyword.declaration.map.go +// ^^^ keyword.declaration.map.go // ^^^ storage.type.go // ^^^ storage.type.go -// ^^^ storage.type.keyword.map.go +// ^^^ keyword.declaration.map.go // ^^^ storage.type.go // ^^^ storage.type.go map[struct{ -// ^^^ storage.type.keyword.map.go -// ^^^^^^ storage.type.keyword.struct.go +// ^^^ keyword.declaration.map.go +// ^^^^^^ keyword.declaration.struct.go field typ // ^^^^^ meta.type.go variable.other.member.declaration.go // ^^^ meta.type.go storage.type.go }] struct { -// ^^^^^^ storage.type.keyword.struct.go +// ^^^^^^ keyword.declaration.struct.go // ^ meta.type.go field typ // ^^^^^ meta.type.go variable.other.member.declaration.go @@ -859,14 +859,14 @@ Note: built-ins are tested separately. Search for "# Built-in Types". } map[*typ]*typ -// ^^^ storage.type.keyword.map.go +// ^^^ keyword.declaration.map.go // ^ keyword.operator.go // ^^^ storage.type.go // ^ keyword.operator.go // ^^^ storage.type.go map[ident.Type]ident.Type -// ^^^ storage.type.keyword.map.go +// ^^^ keyword.declaration.map.go // ^^^^^ variable.other.go // ^ punctuation.accessor.dot.go // ^^^^ storage.type.go @@ -875,7 +875,7 @@ Note: built-ins are tested separately. Search for "# Built-in Types". // ^^^^ storage.type.go map[*ident.Type]*ident.Type -// ^^^ storage.type.keyword.map.go +// ^^^ keyword.declaration.map.go // ^ keyword.operator.go // ^^^^^ variable.other.go // ^ punctuation.accessor.dot.go @@ -886,7 +886,7 @@ Note: built-ins are tested separately. Search for "# Built-in Types". // ^^^^ storage.type.go map[typ]ident /**/ . /**/ -// ^^^ storage.type.keyword.map.go +// ^^^ keyword.declaration.map.go // ^^^ storage.type.go // ^^^^^ variable.other.go // ^^^^ comment.block.go @@ -901,14 +901,14 @@ Note: built-ins are tested separately. Search for "# Built-in Types". // ^^^ storage.type.go map[[0]typ][0]typ -// ^^^ storage.type.keyword.map.go +// ^^^ keyword.declaration.map.go // ^ meta.number.integer.decimal.go constant.numeric.value.go // ^^^ storage.type.go // ^ meta.number.integer.decimal.go constant.numeric.value.go // ^^^ storage.type.go map[/**/ [0] /**/ typ /**/ ] /**/ [0] /**/ typ -// ^^^ storage.type.keyword.map.go +// ^^^ keyword.declaration.map.go // ^^^^ comment.block.go // ^ meta.number.integer.decimal.go constant.numeric.value.go // ^^^^ comment.block.go @@ -923,35 +923,35 @@ Note: built-ins are tested separately. Search for "# Built-in Types". // ## struct struct{} -// ^^^^^^ storage.type.keyword.struct.go +// ^^^^^^ keyword.declaration.struct.go // ^ meta.type.go punctuation.section.braces.begin.go // ^ meta.type.go punctuation.section.braces.end.go struct {field typ} -// ^^^^^^ storage.type.keyword.struct.go +// ^^^^^^ keyword.declaration.struct.go // ^^^^^ meta.type.go variable.other.member.declaration.go // ^^^ meta.type.go storage.type.go struct {field typ;} -// ^^^^^^ storage.type.keyword.struct.go +// ^^^^^^ keyword.declaration.struct.go // ^^^^^ meta.type.go variable.other.member.declaration.go // ^^^ meta.type.go storage.type.go struct {true nil} -// ^^^^^^ storage.type.keyword.struct.go +// ^^^^^^ keyword.declaration.struct.go // ^^^^ meta.type.go variable.other.member.declaration.go // ^^^ meta.type.go storage.type.go struct {embed} -// ^^^^^^ storage.type.keyword.struct.go +// ^^^^^^ keyword.declaration.struct.go // ^^^^^ meta.type.go entity.other.inherited-class.go struct {embed;} -// ^^^^^^ storage.type.keyword.struct.go +// ^^^^^^ keyword.declaration.struct.go // ^^^^^ meta.type.go entity.other.inherited-class.go struct {embed; field typ; *embed; field typ;} -// ^^^^^^ storage.type.keyword.struct.go +// ^^^^^^ keyword.declaration.struct.go // ^ meta.type.go punctuation.section.braces.begin.go // ^^^^^ meta.type.go entity.other.inherited-class.go // ^ meta.type.go punctuation.terminator.go @@ -967,7 +967,7 @@ Note: built-ins are tested separately. Search for "# Built-in Types". // ^ meta.type.go punctuation.section.braces.end.go struct { -// ^^^^^^ storage.type.keyword.struct.go +// ^^^^^^ keyword.declaration.struct.go field typ `json:"field"` // ^^^^^ meta.type.go variable.other.member.declaration.go // ^^^ meta.type.go storage.type.go @@ -998,7 +998,7 @@ Note: built-ins are tested separately. Search for "# Built-in Types". } struct -// ^^^^^^ storage.type.keyword.struct.go +// ^^^^^^ keyword.declaration.struct.go /**/ // ^^^^ comment.block.go { @@ -1062,7 +1062,7 @@ Note: built-ins are tested separately. Search for "# Built-in Types". } struct { -// ^^^^^^ storage.type.keyword.struct.go +// ^^^^^^ keyword.declaration.struct.go /**/ field /**/ typ /**/ // ^^^^ meta.type.go comment.block.go // ^^^^^ meta.type.go variable.other.member.declaration.go @@ -1078,7 +1078,7 @@ Note: built-ins are tested separately. Search for "# Built-in Types". } struct { -// ^^^^^^ storage.type.keyword.struct.go +// ^^^^^^ keyword.declaration.struct.go field, field typ // ^^^^^ meta.type.go variable.other.member.declaration.go // ^ meta.type.go punctuation.separator.go @@ -1095,10 +1095,10 @@ Note: built-ins are tested separately. Search for "# Built-in Types". } struct { -// ^^^^^^ storage.type.keyword.struct.go +// ^^^^^^ keyword.declaration.struct.go field chan typ // ^^^^^ meta.type.go variable.other.member.declaration.go -// ^^^^ meta.type.go storage.type.keyword.chan.go +// ^^^^ meta.type.go keyword.declaration.chan.go // ^^^ meta.type.go storage.type.go embed @@ -1107,7 +1107,7 @@ Note: built-ins are tested separately. Search for "# Built-in Types". field <- chan typ // ^^^^^ meta.type.go variable.other.member.declaration.go // ^^ meta.type.go keyword.operator.assignment.go -// ^^^^ meta.type.go storage.type.keyword.chan.go +// ^^^^ meta.type.go keyword.declaration.chan.go // ^^^ meta.type.go storage.type.go embed @@ -1115,7 +1115,7 @@ Note: built-ins are tested separately. Search for "# Built-in Types". field chan <- typ // ^^^^^ meta.type.go variable.other.member.declaration.go -// ^^^^ meta.type.go storage.type.keyword.chan.go +// ^^^^ meta.type.go keyword.declaration.chan.go // ^^ meta.type.go keyword.operator.assignment.go // ^^^ meta.type.go storage.type.go @@ -1124,7 +1124,7 @@ Note: built-ins are tested separately. Search for "# Built-in Types". field func(param typ) typ // ^^^^^ meta.type.go variable.other.member.declaration.go -// ^^^^ meta.type.go storage.type.keyword.function.go +// ^^^^ meta.type.go keyword.declaration.function.go // ^ meta.type.go punctuation.section.parens.begin.go // ^^^^^ meta.type.go variable.parameter.go // ^^^ meta.type.go storage.type.go @@ -1137,7 +1137,7 @@ Note: built-ins are tested separately. Search for "# Built-in Types". field func( // ^^^^^ meta.type.go variable.other.member.declaration.go -// ^^^^ meta.type.go storage.type.keyword.function.go +// ^^^^ meta.type.go keyword.declaration.function.go param typ // ^^^^^ meta.type.go variable.parameter.go // ^^^ meta.type.go storage.type.go @@ -1152,7 +1152,7 @@ Note: built-ins are tested separately. Search for "# Built-in Types". field map[ // ^^^^^ meta.type.go variable.other.member.declaration.go -// ^^^ meta.type.go storage.type.keyword.map.go +// ^^^ meta.type.go keyword.declaration.map.go typ // ^^^ meta.type.go storage.type.go ] typ @@ -1163,7 +1163,7 @@ Note: built-ins are tested separately. Search for "# Built-in Types". field interface{ // ^^^^^ meta.type.go variable.other.member.declaration.go -// ^^^^^^^^^ meta.type.go storage.type.keyword.interface.go +// ^^^^^^^^^ meta.type.go keyword.declaration.interface.go method() // ^^^^^^ meta.type.go meta.type.go entity.name.function.go } @@ -1173,7 +1173,7 @@ Note: built-ins are tested separately. Search for "# Built-in Types". field struct{ // ^^^^^ meta.type.go variable.other.member.declaration.go -// ^^^^^^ meta.type.go storage.type.keyword.struct.go +// ^^^^^^ meta.type.go keyword.declaration.struct.go field typ // ^^^^^ meta.type.go meta.type.go variable.other.member.declaration.go // ^^^ meta.type.go meta.type.go storage.type.go @@ -1262,7 +1262,7 @@ Note: built-ins are tested separately. Search for "# Built-in Types". // ^^^^^ variable.other.go -storage []func( -// ^^^^ storage.type.keyword.function.go +// ^^^^ keyword.declaration.function.go param typ // ^^^^^ variable.parameter.go // ^^^ storage.type.go @@ -1274,17 +1274,17 @@ Note: built-ins are tested separately. Search for "# Built-in Types". // ## type type _ typ -// ^^^^ storage.type.keyword.type.go +// ^^^^ keyword.declaration.type.go // ^ variable.language.blank.go // ^^^ storage.type.go type Type typ -// ^^^^ storage.type.keyword.type.go +// ^^^^ keyword.declaration.type.go // ^^^^ entity.name.type.go // ^^^ storage.type.go type -// ^^^^ storage.type.keyword.type.go +// ^^^^ keyword.declaration.type.go /**/ // ^^^^ comment.block.go Type /**/ * /**/ * /**/ ident /**/ . /**/ @@ -1309,46 +1309,46 @@ Note: built-ins are tested separately. Search for "# Built-in Types". // ^^^^ storage.type.go type Type -// ^^^^ storage.type.keyword.type.go +// ^^^^ keyword.declaration.type.go // ^^^^ entity.name.type.go ident // ^^^^^ variable.other.go type Type; ident -// ^^^^ storage.type.keyword.type.go +// ^^^^ keyword.declaration.type.go // ^^^^ entity.name.type.go // ^ punctuation.terminator.go // ^^^^^ variable.other.go type Type chan typ -// ^^^^ storage.type.keyword.type.go +// ^^^^ keyword.declaration.type.go // ^^^^ entity.name.type.go -// ^^^^ storage.type.keyword.chan.go +// ^^^^ keyword.declaration.chan.go // ^^^ storage.type.go type Type <- chan typ -// ^^^^ storage.type.keyword.type.go +// ^^^^ keyword.declaration.type.go // ^^^^ entity.name.type.go // ^^ keyword.operator.assignment.go -// ^^^^ storage.type.keyword.chan.go +// ^^^^ keyword.declaration.chan.go // ^^^ storage.type.go type Type chan <- typ -// ^^^^ storage.type.keyword.type.go +// ^^^^ keyword.declaration.type.go // ^^^^ entity.name.type.go -// ^^^^ storage.type.keyword.chan.go +// ^^^^ keyword.declaration.chan.go // ^^ keyword.operator.assignment.go // ^^^ storage.type.go type Type chan typ ident -// ^^^^ storage.type.keyword.type.go +// ^^^^ keyword.declaration.type.go // ^^^^ entity.name.type.go -// ^^^^ storage.type.keyword.chan.go +// ^^^^ keyword.declaration.chan.go // ^^^ storage.type.go // ^^^^^ variable.other.go type Type func( -// ^^^^ storage.type.keyword.function.go +// ^^^^ keyword.declaration.function.go param typ // ^^^^^ variable.parameter.go // ^^^ storage.type.go @@ -1357,21 +1357,21 @@ Note: built-ins are tested separately. Search for "# Built-in Types". // ^^^^^ variable.other.go type Type map[typ]typ ident -// ^^^^ storage.type.keyword.type.go +// ^^^^ keyword.declaration.type.go // ^^^^ entity.name.type.go -// ^^^ storage.type.keyword.map.go +// ^^^ keyword.declaration.map.go // ^^^ storage.type.go // ^^^ storage.type.go // ^^^^^ variable.other.go type Type []typ ident -// ^^^^ storage.type.keyword.type.go +// ^^^^ keyword.declaration.type.go // ^^^^ entity.name.type.go // ^^^ storage.type.go // ^^^^^ variable.other.go type Type interface { -// ^^^^^^^^^ storage.type.keyword.interface.go +// ^^^^^^^^^ keyword.declaration.interface.go Method() // ^^^^^^ meta.type.go entity.name.function.go Inherit @@ -1380,7 +1380,7 @@ Note: built-ins are tested separately. Search for "# Built-in Types". // ^^^^^ variable.other.go type Type struct { -// ^^^^^^ storage.type.keyword.struct.go +// ^^^^^^ keyword.declaration.struct.go field typ // ^^^^^ meta.type.go variable.other.member.declaration.go // ^^^ meta.type.go storage.type.go @@ -1406,12 +1406,12 @@ Note: built-ins are tested separately. Search for "# Built-in Types". Type func( // ^^^^ entity.name.type.go -// ^^^^ storage.type.keyword.function.go +// ^^^^ keyword.declaration.function.go ) Type map // ^^^^ entity.name.type.go -// ^^^ storage.type.keyword.map.go +// ^^^ keyword.declaration.map.go [typ]typ // ^^^ storage.type.go // ^^^ storage.type.go @@ -1422,14 +1422,14 @@ Note: built-ins are tested separately. Search for "# Built-in Types". Type interface { // ^^^^ entity.name.type.go -// ^^^^^^^^^ storage.type.keyword.interface.go +// ^^^^^^^^^ keyword.declaration.interface.go Method() // ^^^^^^ meta.type.go entity.name.function.go } Type struct { // ^^^^ entity.name.type.go -// ^^^^^^ storage.type.keyword.struct.go +// ^^^^^^ keyword.declaration.struct.go field typ // ^^^^^ meta.type.go variable.other.member.declaration.go // ^^^ meta.type.go storage.type.go @@ -1445,14 +1445,14 @@ Note: built-ins are tested separately. Search for "# Built-in Types". // or variables. const _ = 10 -// ^^^^^ storage.type.keyword.const.go +// ^^^^^ keyword.declaration.const.go // ^ variable.language.blank.go // ^ keyword.operator.assignment.go // ^^ meta.number.integer.decimal.go constant.numeric.value.go /**/ const // ^^^^ comment.block.go -// ^^^^^ storage.type.keyword.const.go +// ^^^^^ keyword.declaration.const.go /**/ ident /**/ typ /**/ = /**/ iota /**/ // ^^^^ comment.block.go // ^^^^^ variable.other.constant.declaration.go @@ -1465,27 +1465,27 @@ Note: built-ins are tested separately. Search for "# Built-in Types". // ^^^^ comment.block.go const ident, ident = 10, 20 -// ^^^^^ storage.type.keyword.const.go +// ^^^^^ keyword.declaration.const.go // ^^^^^ variable.other.constant.declaration.go // ^ punctuation.separator.go // ^^^^^ variable.other.constant.declaration.go const ident, ident typ -// ^^^^^ storage.type.keyword.const.go +// ^^^^^ keyword.declaration.const.go // ^^^^^ variable.other.constant.declaration.go // ^ punctuation.separator.go // ^^^^^ variable.other.constant.declaration.go // ^^^ storage.type.go const ident, -// ^^^^^ storage.type.keyword.const.go +// ^^^^^ keyword.declaration.const.go // ^^^^^ variable.other.constant.declaration.go // ^ punctuation.separator.go ident = 10, 20 // ^^^^^ variable.other.constant.declaration.go const ident, -// ^^^^^ storage.type.keyword.const.go +// ^^^^^ keyword.declaration.const.go // ^^^^^ variable.other.constant.declaration.go // ^ punctuation.separator.go ident typ @@ -1494,7 +1494,7 @@ Note: built-ins are tested separately. Search for "# Built-in Types". /**/ const // ^^^^ comment.block.go -// ^^^^^ storage.type.keyword.const.go +// ^^^^^ keyword.declaration.const.go ( // ^ punctuation.section.parens.begin.go /**/ ident /**/ typ /**/ = /**/ iota + iota /**/ @@ -1594,7 +1594,7 @@ Note: built-ins are tested separately. Search for "# Built-in Types". ) const ident typ = ident + -// ^^^^^ storage.type.keyword.const.go +// ^^^^^ keyword.declaration.const.go // ^^^^^ variable.other.constant.declaration.go // ^^^ storage.type.go // ^ keyword.operator.assignment.go @@ -1610,7 +1610,7 @@ Note: built-ins are tested separately. Search for "# Built-in Types". // ^^^^^ variable.other.go const ( -// ^^^^^ storage.type.keyword.const.go +// ^^^^^ keyword.declaration.const.go ident typ = ident + // ^^^^^ variable.other.constant.declaration.go // ^^^ storage.type.go @@ -1632,19 +1632,19 @@ Note: built-ins are tested separately. Search for "# Built-in Types". // iota is predefined only in constant declarations. It's not a reserved word. func _() { var iota = 0 -// ^^^ storage.type.keyword.var.go +// ^^^ keyword.declaration.var.go // ^^^^ variable.declaration.go // ^ keyword.operator.assignment.go // ^ meta.number.integer.decimal.go constant.numeric.value.go var _ = iota -// ^^^ storage.type.keyword.var.go +// ^^^ keyword.declaration.var.go // ^ variable.language.blank.go // ^ keyword.operator.assignment.go // ^^^^ variable.other.go -constant } var _ = log.Println -// ^^^ storage.type.keyword.var.go +// ^^^ keyword.declaration.var.go // ^ variable.language.blank.go // ^ keyword.operator.assignment.go // ^^^ variable.other.go @@ -1653,7 +1653,7 @@ Note: built-ins are tested separately. Search for "# Built-in Types". /**/ var // ^^^^ comment.block.go -// ^^^ storage.type.keyword.var.go +// ^^^ keyword.declaration.var.go /**/ ident /**/ typ /**/ = /**/ 10 /**/ // ^^^^ comment.block.go // ^^^^^ variable.declaration.go @@ -1666,27 +1666,27 @@ Note: built-ins are tested separately. Search for "# Built-in Types". // ^^^^ comment.block.go var ident, ident = 10, 20 -// ^^^ storage.type.keyword.var.go +// ^^^ keyword.declaration.var.go // ^^^^^ variable.declaration.go // ^ punctuation.separator.go // ^^^^^ variable.declaration.go var ident, ident typ -// ^^^ storage.type.keyword.var.go +// ^^^ keyword.declaration.var.go // ^^^^^ variable.declaration.go // ^ punctuation.separator.go // ^^^^^ variable.declaration.go // ^^^ storage.type.go var ident, -// ^^^ storage.type.keyword.var.go +// ^^^ keyword.declaration.var.go // ^^^^^ variable.declaration.go // ^ punctuation.separator.go ident = 10, 20 // ^^^^^ variable.declaration.go var ident, -// ^^^ storage.type.keyword.var.go +// ^^^ keyword.declaration.var.go // ^^^^^ variable.declaration.go // ^ punctuation.separator.go ident typ @@ -1695,7 +1695,7 @@ Note: built-ins are tested separately. Search for "# Built-in Types". /**/ var // ^^^^ comment.block.go -// ^^^ storage.type.keyword.var.go +// ^^^ keyword.declaration.var.go ( // ^ punctuation.section.parens.begin.go /**/ ident /**/ typ /**/ = /**/ ident /**/ + /**/ 20 /**/ @@ -1846,184 +1846,116 @@ Note: built-ins are tested separately. Search for "# Built-in Types". // ## Floats 000.000; 123.456; .0; 1.; -// ^^^^^^^ meta.number.float.decimal.go -// ^^^ constant.numeric.value.go +// ^^^^^^^ meta.number.float.decimal.go constant.numeric.value.go // ^ punctuation.separator.decimal.go -// ^^^ constant.numeric.value.go -// ^^^^^^^ meta.number.float.decimal.go -// ^^^ constant.numeric.value.go +// ^^^^^^^ meta.number.float.decimal.go constant.numeric.value.go // ^ punctuation.separator.decimal.go -// ^^^ constant.numeric.value.go -// ^^ meta.number.float.decimal.go +// ^^ meta.number.float.decimal.go constant.numeric.value.go // ^ punctuation.separator.decimal.go -// ^ constant.numeric.value.go -// ^^ meta.number.float.decimal.go -// ^ constant.numeric.value.go +// ^^ meta.number.float.decimal.go constant.numeric.value.go // ^ punctuation.separator.decimal.go 0_1.0_1; 1_23.4_6; -// ^^^^^^^ meta.number.float.decimal.go -// ^^^ constant.numeric.value.go +// ^^^^^^^ meta.number.float.decimal.go constant.numeric.value.go // ^ punctuation.separator.decimal.go -// ^^^ constant.numeric.value.go -// ^^^^^^^^ meta.number.float.decimal.go -// ^^^^ constant.numeric.value.go +// ^^^^^^^^ meta.number.float.decimal.go constant.numeric.value.go // ^ punctuation.separator.decimal.go -// ^^^ constant.numeric.value.go -000.000; -123.456; -.0; -1. -1.. ; // ^ keyword.operator.arithmetic.go -// ^^^^^^^ meta.number.float.decimal.go -// ^^^ constant.numeric.value.go +// ^^^^^^^ meta.number.float.decimal.go constant.numeric.value.go // ^ punctuation.separator.decimal.go -// ^^^ constant.numeric.value.go // ^ keyword.operator.arithmetic.go -// ^^^^^^^ meta.number.float.decimal.go -// ^^^ constant.numeric.value.go +// ^^^^^^^ meta.number.float.decimal.go constant.numeric.value.go // ^ punctuation.separator.decimal.go -// ^^^ constant.numeric.value.go // ^ keyword.operator.arithmetic.go -// ^^ meta.number.float.decimal.go +// ^^ meta.number.float.decimal.go constant.numeric.value.go // ^ punctuation.separator.decimal.go -// ^ constant.numeric.value.go // ^ keyword.operator.arithmetic.go -// ^^ meta.number.float.decimal.go -// ^ constant.numeric.value.go +// ^^ meta.number.float.decimal.go constant.numeric.value.go // ^ punctuation.separator.decimal.go // ^ keyword.operator.arithmetic.go -// ^^ meta.number.float.decimal.go -// ^ constant.numeric.value.go +// ^^ meta.number.float.decimal.go constant.numeric.value.go // ^ punctuation.separator.decimal.go // ^ punctuation.accessor.dot.go - meta.number 0e+0; 0E+0; 0.0e+0; 0.0E+0; 123.456e+789; -// ^^^^ meta.number.float.decimal.go -// ^ constant.numeric.value.go -// ^^^ constant.numeric.value.exponent.go -// ^^^^ meta.number.float.decimal.go -// ^ constant.numeric.value.go -// ^^^ constant.numeric.value.exponent.go -// ^^^^^^ meta.number.float.decimal.go -// ^ constant.numeric.value.go +// ^^^^ meta.number.float.decimal.go constant.numeric.value.go +// ^^^^ meta.number.float.decimal.go constant.numeric.value.go +// ^^^^^^ meta.number.float.decimal.go constant.numeric.value.go // ^ punctuation.separator.decimal.go -// ^ constant.numeric.value.go -// ^^^ constant.numeric.value.exponent.go -// ^^^^^^ meta.number.float.decimal.go -// ^ constant.numeric.value.go +// ^^^^^^ meta.number.float.decimal.go constant.numeric.value.go // ^ punctuation.separator.decimal.go -// ^ constant.numeric.value.go -// ^^^ constant.numeric.value.exponent.go -// ^^^^^^^^^^^^ meta.number.float.decimal.go -// ^^^ constant.numeric.value.go +// ^^^^^^^^^^^^ meta.number.float.decimal.go constant.numeric.value.go // ^ punctuation.separator.decimal.go -// ^^^ constant.numeric.value.go -// ^^^^^ constant.numeric.value.exponent.go 1_2e+0; 1E+0_1; 0.1_2e2; 1_23.4_56e+78_9; -// ^^^ meta.number.float.decimal.go constant.numeric.value.go -// ^^^ meta.number.float.decimal.go constant.numeric.value.exponent.go -// ^ meta.number.float.decimal.go constant.numeric.value.go -// ^^^^^ meta.number.float.decimal.go constant.numeric.value.exponent.go -// ^ meta.number.float.decimal.go constant.numeric.value.go -// ^ meta.number.float.decimal.go punctuation.separator.decimal.go -// ^^^ meta.number.float.decimal.go constant.numeric.value.go -// ^^ meta.number.float.decimal.go constant.numeric.value.exponent.go -// ^^^^ meta.number.float.decimal.go constant.numeric.value.go -// ^ meta.number.float.decimal.go punctuation.separator.decimal.go -// ^^^^ meta.number.float.decimal.go constant.numeric.value.go -// ^^^^^^ meta.number.float.decimal.go constant.numeric.value.exponent.go +// ^^^^^^ meta.number.float.decimal.go constant.numeric.value.go +// ^^^^^^ meta.number.float.decimal.go constant.numeric.value.go +// ^^^^^^^ meta.number.float.decimal.go constant.numeric.value.go +// ^ punctuation.separator.decimal.go +// ^^^^^^^^^^^^^^^ meta.number.float.decimal.go constant.numeric.value.go +// ^ punctuation.separator.decimal.go 0e-0; 0E-0; 0.0e-0; 0.0E-0; 123.456e-789; -// ^ meta.number.float.decimal.go constant.numeric.value.go -// ^^^ meta.number.float.decimal.go constant.numeric.value.exponent.go -// ^ meta.number.float.decimal.go constant.numeric.value.go -// ^^^ meta.number.float.decimal.go constant.numeric.value.exponent.go -// ^ meta.number.float.decimal.go constant.numeric.value.go -// ^ meta.number.float.decimal.go punctuation.separator.decimal.go -// ^ meta.number.float.decimal.go constant.numeric.value.go -// ^^^ meta.number.float.decimal.go constant.numeric.value.exponent.go -// ^ meta.number.float.decimal.go constant.numeric.value.go -// ^ meta.number.float.decimal.go punctuation.separator.decimal.go -// ^ meta.number.float.decimal.go constant.numeric.value.go -// ^^^ meta.number.float.decimal.go constant.numeric.value.exponent.go -// ^^^ meta.number.float.decimal.go constant.numeric.value.go -// ^ meta.number.float.decimal.go punctuation.separator.decimal.go -// ^^^ meta.number.float.decimal.go constant.numeric.value.go -// ^^^^^ meta.number.float.decimal.go constant.numeric.value.exponent.go +// ^^^^ meta.number.float.decimal.go constant.numeric.value.go +// ^^^^ meta.number.float.decimal.go constant.numeric.value.go +// ^^^^^^ meta.number.float.decimal.go constant.numeric.value.go +// ^ punctuation.separator.decimal.go +// ^^^^^^ meta.number.float.decimal.go constant.numeric.value.go +// ^ punctuation.separator.decimal.go +// ^^^^^^^^^^^^ meta.number.float.decimal.go constant.numeric.value.go +// ^ punctuation.separator.decimal.go 0.e+0; .0e+0; 0.e-0; .0e-0; -// ^^^^^ meta.number.float.decimal.go -// ^ constant.numeric.value.go +// ^^^^^ meta.number.float.decimal.go constant.numeric.value.go // ^ punctuation.separator.decimal.go -// ^^^ constant.numeric.value.exponent.go -// ^^^^^ meta.number.float.decimal.go +// ^^^^^ meta.number.float.decimal.go constant.numeric.value.go // ^ punctuation.separator.decimal.go -// ^ constant.numeric.value.go -// ^^^ constant.numeric.value.exponent.go -// ^^^^^ meta.number.float.decimal.go -// ^ constant.numeric.value.go +// ^^^^^ meta.number.float.decimal.go constant.numeric.value.go // ^ punctuation.separator.decimal.go -// ^^^ constant.numeric.value.exponent.go -// ^^^^^ meta.number.float.decimal.go +// ^^^^^ meta.number.float.decimal.go constant.numeric.value.go // ^ punctuation.separator.decimal.go -// ^ constant.numeric.value.go -// ^^^ constant.numeric.value.exponent.go 0x1p-2; 0X1P+2; 0x1p2; // ^^ meta.number.float.hexadecimal.go constant.numeric.base.go -// ^ meta.number.float.hexadecimal.go constant.numeric.value.go -// ^^^ meta.number.float.hexadecimal.go constant.numeric.value.exponent.go +// ^^^^ meta.number.float.hexadecimal.go constant.numeric.value.go // ^^ meta.number.float.hexadecimal.go constant.numeric.base.go -// ^ meta.number.float.hexadecimal.go constant.numeric.value.go -// ^^^ meta.number.float.hexadecimal.go constant.numeric.value.exponent.go +// ^^^^ meta.number.float.hexadecimal.go constant.numeric.value.go // ^^ meta.number.float.hexadecimal.go constant.numeric.base.go -// ^ meta.number.float.hexadecimal.go constant.numeric.value.go -// ^^ meta.number.float.hexadecimal.go constant.numeric.value.exponent.go +// ^^^ meta.number.float.hexadecimal.go constant.numeric.value.go 0x_1p-2; 0X1_1P+2; 0x_1p2_1; // ^^ meta.number.float.hexadecimal.go constant.numeric.base.go -// ^^ meta.number.float.hexadecimal.go constant.numeric.value.go -// ^^^ meta.number.float.hexadecimal.go constant.numeric.value.exponent.go +// ^^^^^ meta.number.float.hexadecimal.go constant.numeric.value.go // ^^ meta.number.float.hexadecimal.go constant.numeric.base.go -// ^^^ meta.number.float.hexadecimal.go constant.numeric.value.go -// ^^^ meta.number.float.hexadecimal.go constant.numeric.value.exponent.go +// ^^^^^^ meta.number.float.hexadecimal.go constant.numeric.value.go // ^^ meta.number.float.hexadecimal.go constant.numeric.base.go -// ^^ meta.number.float.hexadecimal.go constant.numeric.value.go -// ^^^^ meta.number.float.hexadecimal.go constant.numeric.value.exponent.go +// ^^^^^^ meta.number.float.hexadecimal.go constant.numeric.value.go 0x1.0P-1021; 0X1.0p-1021; // ^^ meta.number.float.hexadecimal.go constant.numeric.base.go -// ^ meta.number.float.hexadecimal.go constant.numeric.value.go -// ^ meta.number.float.hexadecimal.go punctuation.separator.decimal.go -// ^ meta.number.float.hexadecimal.go constant.numeric.value.go -// ^^^^^^ meta.number.float.hexadecimal.go constant.numeric.value.exponent.go +// ^^^^^^^^^ meta.number.float.hexadecimal.go constant.numeric.value.go +// ^ punctuation.separator.decimal.go // ^^ meta.number.float.hexadecimal.go constant.numeric.base.go -// ^ meta.number.float.hexadecimal.go constant.numeric.value.go -// ^ meta.number.float.hexadecimal.go punctuation.separator.decimal.go -// ^ meta.number.float.hexadecimal.go constant.numeric.value.go -// ^^^^^^ meta.number.float.hexadecimal.go constant.numeric.value.exponent.go +// ^^^^^^^^^ meta.number.float.hexadecimal.go constant.numeric.value.go +// ^ punctuation.separator.decimal.go 0x_1_1.0_7P-1_021; // ^^ meta.number.float.hexadecimal.go constant.numeric.base.go -// ^^^^ meta.number.float.hexadecimal.go constant.numeric.value.go -// ^ meta.number.float.hexadecimal.go punctuation.separator.decimal.go -// ^^^ meta.number.float.hexadecimal.go constant.numeric.value.go -// ^^^^^^^ meta.number.float.hexadecimal.go constant.numeric.value.exponent.go +// ^^^^^^^^^^^^^^^ meta.number.float.hexadecimal.go constant.numeric.value.go +// ^ punctuation.separator.decimal.go 0x2.p10; 0x1.Fp+0; 0X.8p-0; // ^^ meta.number.float.hexadecimal.go constant.numeric.base.go -// ^ meta.number.float.hexadecimal.go constant.numeric.value.go -// ^ meta.number.float.hexadecimal.go punctuation.separator.decimal.go -// ^^^ meta.number.float.hexadecimal.go constant.numeric.value.exponent.go +// ^^^^^ meta.number.float.hexadecimal.go constant.numeric.value.go +// ^ punctuation.separator.decimal.go // ^^ meta.number.float.hexadecimal.go constant.numeric.base.go -// ^ meta.number.float.hexadecimal.go constant.numeric.value.go -// ^ meta.number.float.hexadecimal.go punctuation.separator.decimal.go -// ^ meta.number.float.hexadecimal.go constant.numeric.value.go -// ^^^ meta.number.float.hexadecimal.go constant.numeric.value.exponent.go +// ^^^^^^ meta.number.float.hexadecimal.go constant.numeric.value.go +// ^ punctuation.separator.decimal.go // ^^ meta.number.float.hexadecimal.go constant.numeric.base.go -// ^ meta.number.float.hexadecimal.go punctuation.separator.decimal.go -// ^ meta.number.float.hexadecimal.go constant.numeric.value.go -// ^^^ meta.number.float.hexadecimal.go constant.numeric.value.exponent.go +// ^^^^^ meta.number.float.hexadecimal.go constant.numeric.value.go +// ^ punctuation.separator.decimal.go // ## Imaginary @@ -2044,72 +1976,54 @@ Note: built-ins are tested separately. Search for "# Built-in Types". 123.456i; -123.456i; 1_23.45_6i; // ^^^^^^^^ meta.number.imaginary.decimal.go -// ^^^ constant.numeric.value.go +// ^^^^^^^ constant.numeric.value.go // ^ punctuation.separator.decimal.go -// ^^^ constant.numeric.value.go // ^ constant.numeric.suffix.go // ^ keyword.operator.arithmetic.go // ^^^^^^^^ meta.number.imaginary.decimal.go -// ^^^ constant.numeric.value.go +// ^^^^^^^ constant.numeric.value.go // ^ punctuation.separator.decimal.go -// ^^^ constant.numeric.value.go // ^ constant.numeric.suffix.go // ^^^^^^^^^^ meta.number.imaginary.decimal.go -// ^^^^ constant.numeric.value.go +// ^^^^^^^^^ constant.numeric.value.go // ^ punctuation.separator.decimal.go -// ^^^^ constant.numeric.value.go // ^ constant.numeric.suffix.go 1e+2i; 1e-2i; 1.2e+3i; 1.2e-3i; 1E+2i; 1E-2i; 1.2E+3i; 1.2E-3i; -// ^ meta.number.imaginary.decimal.go constant.numeric.value.go -// ^^^ meta.number.imaginary.decimal.go constant.numeric.value.exponent.go +// ^^^^ meta.number.imaginary.decimal.go constant.numeric.value.go // ^ meta.number.imaginary.decimal.go constant.numeric.suffix.go // ^ punctuation.terminator.go -// ^ meta.number.imaginary.decimal.go constant.numeric.value.go -// ^^^ meta.number.imaginary.decimal.go constant.numeric.value.exponent.go +// ^^^^ meta.number.imaginary.decimal.go constant.numeric.value.go // ^ meta.number.imaginary.decimal.go constant.numeric.suffix.go // ^ punctuation.terminator.go -// ^ meta.number.imaginary.decimal.go constant.numeric.value.go -// ^ meta.number.imaginary.decimal.go punctuation.separator.decimal.go -// ^ meta.number.imaginary.decimal.go constant.numeric.value.go -// ^^^ meta.number.imaginary.decimal.go constant.numeric.value.exponent.go +// ^^^^^^ meta.number.imaginary.decimal.go constant.numeric.value.go +// ^ punctuation.separator.decimal.go // ^ meta.number.imaginary.decimal.go constant.numeric.suffix.go // ^ punctuation.terminator.go -// ^ meta.number.imaginary.decimal.go constant.numeric.value.go -// ^ meta.number.imaginary.decimal.go punctuation.separator.decimal.go -// ^ meta.number.imaginary.decimal.go constant.numeric.value.go -// ^^^ meta.number.imaginary.decimal.go constant.numeric.value.exponent.go +// ^^^^^^ meta.number.imaginary.decimal.go constant.numeric.value.go +// ^ punctuation.separator.decimal.go // ^ meta.number.imaginary.decimal.go constant.numeric.suffix.go // ^ punctuation.terminator.go -// ^ meta.number.imaginary.decimal.go constant.numeric.value.go -// ^^^ meta.number.imaginary.decimal.go constant.numeric.value.exponent.go +// ^^^^ meta.number.imaginary.decimal.go constant.numeric.value.go // ^ meta.number.imaginary.decimal.go constant.numeric.suffix.go // ^ punctuation.terminator.go -// ^ meta.number.imaginary.decimal.go constant.numeric.value.go -// ^^^ meta.number.imaginary.decimal.go constant.numeric.value.exponent.go +// ^^^^ meta.number.imaginary.decimal.go constant.numeric.value.go // ^ meta.number.imaginary.decimal.go constant.numeric.suffix.go // ^ punctuation.terminator.go -// ^ meta.number.imaginary.decimal.go constant.numeric.value.go -// ^ meta.number.imaginary.decimal.go punctuation.separator.decimal.go -// ^ meta.number.imaginary.decimal.go constant.numeric.value.go -// ^^^ meta.number.imaginary.decimal.go constant.numeric.value.exponent.go +// ^^^^^^ meta.number.imaginary.decimal.go constant.numeric.value.go +// ^ punctuation.separator.decimal.go // ^ meta.number.imaginary.decimal.go constant.numeric.suffix.go // ^ punctuation.terminator.go -// ^ meta.number.imaginary.decimal.go constant.numeric.value.go -// ^ meta.number.imaginary.decimal.go punctuation.separator.decimal.go -// ^ meta.number.imaginary.decimal.go constant.numeric.value.go -// ^^^ meta.number.imaginary.decimal.go constant.numeric.value.exponent.go +// ^^^^^^ meta.number.imaginary.decimal.go constant.numeric.value.go +// ^ punctuation.separator.decimal.go // ^ meta.number.imaginary.decimal.go constant.numeric.suffix.go // ^ punctuation.terminator.go 1_1e+2_1i; 1.2_1E-3_5i; -// ^^^ meta.number.imaginary.decimal.go constant.numeric.value.go -// ^^^^^ meta.number.imaginary.decimal.go constant.numeric.value.exponent.go +// ^^^^^^^^ meta.number.imaginary.decimal.go constant.numeric.value.go // ^ meta.number.imaginary.decimal.go constant.numeric.suffix.go -// ^ meta.number.imaginary.decimal.go constant.numeric.value.go -// ^ meta.number.imaginary.decimal.go punctuation.separator.decimal.go -// ^^^ meta.number.imaginary.decimal.go constant.numeric.value.go -// ^^^^^ meta.number.imaginary.decimal.go constant.numeric.value.exponent.go +// ^^^^^^^^^^ meta.number.imaginary.decimal.go constant.numeric.value.go +// ^ punctuation.separator.decimal.go // ^ meta.number.imaginary.decimal.go constant.numeric.suffix.go 0o6i; 0O35i; 0o_6i; 0O3_5i; @@ -2153,32 +2067,24 @@ Note: built-ins are tested separately. Search for "# Built-in Types". 0x1p-2i; 0x1.0P-1021i; 0x1.Fp+0i; // ^^ meta.number.imaginary.hexadecimal.go constant.numeric.base.go -// ^ meta.number.imaginary.hexadecimal.go constant.numeric.value.go -// ^^^ meta.number.imaginary.hexadecimal.go constant.numeric.value.exponent.go +// ^^^^ meta.number.imaginary.hexadecimal.go constant.numeric.value.go // ^ meta.number.imaginary.hexadecimal.go constant.numeric.suffix.go // ^^ meta.number.imaginary.hexadecimal.go constant.numeric.base.go -// ^ meta.number.imaginary.hexadecimal.go constant.numeric.value.go -// ^ meta.number.imaginary.hexadecimal.go punctuation.separator.decimal.go -// ^ meta.number.imaginary.hexadecimal.go constant.numeric.value.go -// ^^^^^^ meta.number.imaginary.hexadecimal.go constant.numeric.value.exponent.go +// ^^^^^^^^^ meta.number.imaginary.hexadecimal.go constant.numeric.value.go +// ^ punctuation.separator.decimal.go // ^ meta.number.imaginary.hexadecimal.go constant.numeric.suffix.go // ^^ meta.number.imaginary.hexadecimal.go constant.numeric.base.go -// ^ meta.number.imaginary.hexadecimal.go constant.numeric.value.go -// ^ meta.number.imaginary.hexadecimal.go punctuation.separator.decimal.go -// ^ meta.number.imaginary.hexadecimal.go constant.numeric.value.go -// ^^^ meta.number.imaginary.hexadecimal.go constant.numeric.value.exponent.go +// ^^^^^^ meta.number.imaginary.hexadecimal.go constant.numeric.value.go +// ^ punctuation.separator.decimal.go // ^ meta.number.imaginary.hexadecimal.go constant.numeric.suffix.go 0x_1p-2i; 0x1_4.0_5P-102_1i; // ^^ meta.number.imaginary.hexadecimal.go constant.numeric.base.go -// ^^ meta.number.imaginary.hexadecimal.go constant.numeric.value.go -// ^^^ meta.number.imaginary.hexadecimal.go constant.numeric.value.exponent.go +// ^^^^^ meta.number.imaginary.hexadecimal.go constant.numeric.value.go // ^ meta.number.imaginary.hexadecimal.go constant.numeric.suffix.go // ^^ meta.number.imaginary.hexadecimal.go constant.numeric.base.go -// ^^^ meta.number.imaginary.hexadecimal.go constant.numeric.value.go -// ^ meta.number.imaginary.hexadecimal.go punctuation.separator.decimal.go -// ^^^ meta.number.imaginary.hexadecimal.go constant.numeric.value.go -// ^^^^^^^ meta.number.imaginary.hexadecimal.go constant.numeric.value.exponent.go +// ^^^^^^^^^^^^^^ meta.number.imaginary.hexadecimal.go constant.numeric.value.go +// ^ punctuation.separator.decimal.go // ^ meta.number.imaginary.hexadecimal.go constant.numeric.suffix.go // ## Runes @@ -2501,7 +2407,7 @@ Note: built-ins are tested separately. Search for "# Built-in Types". ident.(chan typ) // ^^^^^ variable.other.go // ^ punctuation.accessor.dot.go -// ^^^^ storage.type.keyword.chan.go +// ^^^^ keyword.declaration.chan.go // ^^^ storage.type.go ident.(***ident) @@ -2562,7 +2468,7 @@ Note: built-ins are tested separately. Search for "# Built-in Types". // ## Parens -// Note: we can't syntactically disambiguate calls and casts. +// Note: we can't syntactically disambiguate calls and type conversions. ident() // ^^^^ variable.function.go @@ -2652,18 +2558,18 @@ Note: built-ins are tested separately. Search for "# Built-in Types". (*chan typ)(ident) // ^ keyword.operator.go -// ^^^^ storage.type.keyword.chan.go +// ^^^^ keyword.declaration.chan.go // ^^^ storage.type.go // ^^^^^ variable.other.go map[typ]typ(ident) -// ^^^ storage.type.keyword.map.go +// ^^^ keyword.declaration.map.go // ^^^ storage.type.go // ^^^ storage.type.go // ^^^^^ variable.other.go (map[typ]typ)(ident) -// ^^^ storage.type.keyword.map.go +// ^^^ keyword.declaration.map.go // ^^^ storage.type.go // ^^^ storage.type.go // ^^^^^ variable.other.go @@ -2720,14 +2626,14 @@ Note: built-ins are tested separately. Search for "# Built-in Types". // declarations, anonymous functions, and function types. func() {} -// ^^^^ storage.type.keyword.function.go +// ^^^^ keyword.declaration.function.go // ^ punctuation.section.parens.begin.go // ^ punctuation.section.parens.end.go // ^ meta.block.go punctuation.section.braces.begin.go // ^ meta.block.go punctuation.section.braces.end.go func ident() {} -// ^^^^ storage.type.keyword.function.go +// ^^^^ keyword.declaration.function.go // ^^^^^ entity.name.function.go // ^ punctuation.section.parens.begin.go // ^ punctuation.section.parens.end.go @@ -2735,17 +2641,17 @@ Note: built-ins are tested separately. Search for "# Built-in Types". // ^ meta.block.go punctuation.section.braces.end.go func ident /**/ () {} -// ^^^^ storage.type.keyword.function.go +// ^^^^ keyword.declaration.function.go // ^^^^^ entity.name.function.go // ^^^^ comment.block.go func ident /* * */ () {} -// ^^^^ storage.type.keyword.function.go +// ^^^^ keyword.declaration.function.go // ^^^^^ entity.name.function.go // ^^^^^^^ comment.block.go func ident( -// ^^^^ storage.type.keyword.function.go +// ^^^^ keyword.declaration.function.go // ^^^^^ entity.name.function.go param typ // ^^^^^ variable.parameter.go @@ -2765,7 +2671,7 @@ Note: built-ins are tested separately. Search for "# Built-in Types". // ^ punctuation.section.parens.end.go func (Type) Method() {} -// ^^^^ storage.type.keyword.function.go +// ^^^^ keyword.declaration.function.go // ^ meta.function.declaration.go punctuation.section.parens.begin.go // ^^^^ meta.function.declaration.go storage.type.go // ^ meta.function.declaration.go punctuation.section.parens.end.go @@ -2774,7 +2680,7 @@ Note: built-ins are tested separately. Search for "# Built-in Types". // ^ punctuation.section.parens.end.go func /**/ -// ^^^^ storage.type.keyword.function.go +// ^^^^ keyword.declaration.function.go // ^^^^ comment.block.go ( /**/ self /**/ * /**/ ident /**/ . /**/ Type /**/ ) /**/ Method /**/ ( // ^ meta.function.declaration.go punctuation.section.parens.begin.go @@ -2821,49 +2727,49 @@ every type individually. */ chan typ -// ^^^^ storage.type.keyword.chan.go +// ^^^^ keyword.declaration.chan.go // ^^^ storage.type.go -support chan int -// ^^^^ storage.type.keyword.chan.go +// ^^^^ keyword.declaration.chan.go // ^^^ storage.type.go support.type.builtin.go func(typ) -// ^^^^ storage.type.keyword.function.go +// ^^^^ keyword.declaration.function.go // ^^^ storage.type.go -support func(int) -// ^^^^ storage.type.keyword.function.go +// ^^^^ keyword.declaration.function.go // ^^^ storage.type.go support.type.builtin.go map[typ]typ -// ^^^ storage.type.keyword.map.go +// ^^^ keyword.declaration.map.go // ^^^ storage.type.go -support // ^^^ storage.type.go -support map[int]int -// ^^^ storage.type.keyword.map.go +// ^^^ keyword.declaration.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 +// ^^^^^^ keyword.declaration.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 +// ^^^^^^ keyword.declaration.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 +// ^^^^^^^^^ keyword.declaration.interface.go // ^^^ meta.type.go entity.other.inherited-class.go -support interface { error } -// ^^^^^^^^^ storage.type.keyword.interface.go +// ^^^^^^^^^ keyword.declaration.interface.go // ^^^^^ meta.type.go entity.other.inherited-class.go support.type.builtin.go [...]typ @@ -2881,32 +2787,32 @@ every type individually. // ^^^ storage.type.go support.type.builtin.go type _ typ -// ^^^^ storage.type.keyword.type.go +// ^^^^ keyword.declaration.type.go // ^ variable.language.blank.go // ^^^ storage.type.go -support type _ int -// ^^^^ storage.type.keyword.type.go +// ^^^^ keyword.declaration.type.go // ^ variable.language.blank.go // ^^^ storage.type.go support.type.builtin.go const ident typ -// ^^^^^ storage.type.keyword.const.go +// ^^^^^ keyword.declaration.const.go // ^^^^^ variable.other.constant.declaration.go // ^^^ storage.type.go -support const ident int -// ^^^^^ storage.type.keyword.const.go +// ^^^^^ keyword.declaration.const.go // ^^^^^ variable.other.constant.declaration.go // ^^^ storage.type.go support.type.builtin.go var ident typ -// ^^^ storage.type.keyword.var.go +// ^^^ keyword.declaration.var.go // ^^^^^ variable.declaration.go // ^^^ storage.type.go -support var ident int -// ^^^ storage.type.keyword.var.go +// ^^^ keyword.declaration.var.go // ^^^^^ variable.declaration.go // ^^^ storage.type.go support.type.builtin.go @@ -2969,7 +2875,7 @@ every type individually. // ^^^^ variable.other.go -support var make -// ^^^ storage.type.keyword.var.go +// ^^^ keyword.declaration.var.go // ^^^^ variable.declaration.go -support new(typ, ident) @@ -3014,7 +2920,7 @@ every type individually. // ^^^ variable.other.go -support var new -// ^^^ storage.type.keyword.var.go +// ^^^ keyword.declaration.var.go // ^^^ variable.declaration.go -support // ## Other Functions @@ -3047,7 +2953,7 @@ every function individually. // ^^^^^ variable.other.go -support var close -// ^^^ storage.type.keyword.var.go +// ^^^ keyword.declaration.var.go // ^^^^^ variable.declaration.go -support diff --git a/HTML/HTML (Plain).sublime-syntax b/HTML/HTML (Plain).sublime-syntax index 6ac6f381ed..59a4e11cd5 100644 --- a/HTML/HTML (Plain).sublime-syntax +++ b/HTML/HTML (Plain).sublime-syntax @@ -208,6 +208,10 @@ contexts: captures: 1: punctuation.definition.tag.begin.html 2: punctuation.definition.tag.end.html + - match: '<' + scope: meta.character.less-than.html + - match: '>' + scope: meta.character.greater-than.html tag-end: - match: '>' @@ -287,6 +291,7 @@ contexts: - include: else-pop tag-generic-attribute-value: + - meta_include_prototype: false - match: \" scope: meta.string.html string.quoted.double.html diff --git a/HTML/HTML.sublime-syntax b/HTML/HTML.sublime-syntax index f24c4b6e6e..46d9dbca91 100644 --- a/HTML/HTML.sublime-syntax +++ b/HTML/HTML.sublime-syntax @@ -43,25 +43,6 @@ variables: | text/livescript ) - custom_element_char: |- - (?x: - # https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements-core-concepts - [-._a-z0-9\x{00B7}] - | [\x{00C0}-\x{00D6}] - | [\x{00D8}-\x{00F6}] - | [\x{00F8}-\x{02FF}] - | [\x{0300}-\x{037D}] - | [\x{037F}-\x{1FFF}] - | [\x{200C}-\x{200D}] - | [\x{203F}-\x{2040}] - | [\x{2070}-\x{218F}] - | [\x{2C00}-\x{2FEF}] - | [\x{3001}-\x{D7FF}] - | [\x{F900}-\x{FDCF}] - | [\x{FDF0}-\x{FFFD}] - | [\x{10000}-\x{EFFFF}] - ) - script_close_lookahead: (?=(?:-->\s*)?) # sections that don't close themselves on the same line | <\%(?!.*?\%>) - # open curly braces that don't have close braces or string punctuation after them - | \{(?![}"']) + # open curly braces at the end of a line with comments allowed + | \{(?=\s*(?: + + <{{template}} {{attr}}={{value}} /> + ## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.tag + + <[[template]] [[attr]]=[[value]] /> + ## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.tag + + < attr="" /> + ## ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.tag
## ^ entity.name.tag.block.form.html @@ -711,12 +736,17 @@ ## ^^^^ - constant.character.entity - + + ## ^^^ punctuation.separator.path.html ## ^^^ constant.character.escape.url - ## ^^^^^ constant.character.entity - - ## ^ - constant.character.entity - ## ^ - invalid.illegal + ## ^^ punctuation.separator.path.html + ## ^^^^^ constant.character.entity - punctuation.separator + ## ^ punctuation.separator.path.html + + ## ^^^ punctuation.separator.path.html + ## ^^ punctuation.separator.path.html + ## ^ punctuation.separator.path.html - constant.character.entity + ## ^ punctuation.separator.path.html

## ^^ meta.tag.block.any punctuation.definition.tag.end @@ -731,9 +761,14 @@ <_notag> ##^^^^^ - entity.name.tag + ## <- meta.character.less-than.html <2notag> ##^^^^^ - entity.name.tag + ## <- meta.character.less-than.html + + < + ## <- meta.character.less-than.html <> < > ## <- meta.tag.incomplete.html invalid.illegal.incomplete.html punctuation.definition.tag.begin.html diff --git a/HTML/syntax_test_html_indentation.html b/HTML/syntax_test_html_indentation.html index f5c4d42fc3..9106379963 100644 --- a/HTML/syntax_test_html_indentation.html +++ b/HTML/syntax_test_html_indentation.html @@ -20,5 +20,18 @@ + + + foo { + bar { + baz + } + } + text + {

} + text + {{template}} + text + diff --git a/JSON/Default.sublime-keymap b/JSON/Default.sublime-keymap new file mode 100644 index 0000000000..e11d9bce5c --- /dev/null +++ b/JSON/Default.sublime-keymap @@ -0,0 +1,63 @@ +[ + // Auto-pair quotations: "key": '|', + { "keys": ["'"], "command": "insert_snippet", "args": {"contents": "'$0'"}, "context": + [ + { "key": "setting.auto_match_enabled" }, + { "key": "selector", "operand": "source.json" }, + { "key": "selection_empty", "match_all": true }, + { "key": "preceding_text", "operator": "not_regex_contains", "operand": "['\\w]$", "match_all": true }, + { "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |]|,|:|\\}|$)", "match_all": true } + ] + }, + + // Auto-pair quotations: "key": "|", + { "keys": ["\""], "command": "insert_snippet", "args": {"contents": "\"$0\""}, "context": + [ + { "key": "setting.auto_match_enabled" }, + { "key": "selector", "operand": "source.json" }, + { "key": "selection_empty", "match_all": true }, + { "key": "preceding_text", "operator": "not_regex_contains", "operand": "[\"\\w]$", "match_all": true }, + { "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |]|,|:|\\}|$)", "match_all": true } + ] + }, + + // Auto-pair braces: "key": {|}, + { "keys": ["{"], "command": "insert_snippet", "args": {"contents": "{$0}"}, "context": + [ + { "key": "setting.auto_match_enabled" }, + { "key": "selector", "operand": "source.json" }, + { "key": "selection_empty", "match_all": true }, + { "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |]|,|:|\\}|$)", "match_all": true } + ] + }, + + // Auto-pair square brackets: "key": [|], + { "keys": ["["], "command": "insert_snippet", "args": {"contents": "[$0]"}, "context": + [ + { "key": "setting.auto_match_enabled" }, + { "key": "selector", "operand": "source.json" }, + { "key": "selection_empty", "match_all": true }, + { "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |]|,|:|\\}|$)", "match_all": true } + ] + }, + + // Add indented line in square brackets + { "keys": ["enter"], "command": "insert_snippet", "args": {"contents": "\n\t$0\n"}, "context": + [ + { "key": "setting.auto_indent" }, + { "key": "selector", "operand": "source.json" }, + { "key": "selection_empty", "match_all": true }, + { "key": "preceding_text", "operator": "regex_contains", "operand": "\\[$", "match_all": true }, + { "key": "following_text", "operator": "regex_contains", "operand": "^\\]", "match_all": true } + ] + }, + { "keys": ["shift+enter"], "command": "insert_snippet", "args": {"contents": "\n\t$0\n"}, "context": + [ + { "key": "setting.auto_indent" }, + { "key": "selector", "operand": "source.json" }, + { "key": "selection_empty", "match_all": true }, + { "key": "preceding_text", "operator": "regex_contains", "operand": "\\[$", "match_all": true }, + { "key": "following_text", "operator": "regex_contains", "operand": "^\\]", "match_all": true } + ] + }, +] \ No newline at end of file diff --git a/JSON/JSON.sublime-syntax b/JSON/JSON.sublime-syntax index c82f91629d..28d8842a6d 100644 --- a/JSON/JSON.sublime-syntax +++ b/JSON/JSON.sublime-syntax @@ -3,17 +3,18 @@ name: JSON file_extensions: - json - - sublime-settings - - sublime-menu - - sublime-keymap - - sublime-mousemap - - sublime-theme - sublime-build - - sublime-project - - sublime-completions + - sublime-color-scheme - sublime-commands + - sublime-completions + - sublime-keymap - sublime-macro - - sublime-color-scheme + - sublime-menu + - sublime-mousemap + - sublime-project + - sublime-settings + - sublime-theme + - sublime-workspace - ipynb - Pipfile.lock scope: source.json @@ -64,8 +65,11 @@ contexts: captures: 1: punctuation.definition.comment.json constant: - - match: \b(?:true|false|null)\b - scope: constant.language.json + - match: \b(?:false|true)\b + scope: constant.language.boolean.json + - match: \bnull\b + scope: constant.language.null.json + number: # handles integer and decimal numbers - match: (-?)((?:0|[1-9]\d*)(?:(?:(\.)\d+)(?:[eE][-+]?\d+)?|(?:[eE][-+]?\d+))) diff --git a/JSON/syntax_test_json.json b/JSON/syntax_test_json.json index e5f5a06792..7771800771 100644 --- a/JSON/syntax_test_json.json +++ b/JSON/syntax_test_json.json @@ -5,7 +5,12 @@ "bool": false, //^^^^^^ meta.mapping.key.json //^^^^^^^^^^^^^^ - meta.mapping meta.mapping -// ^^^^^ constant.language.json +// ^^^^^ constant.language.boolean.json + + "null": null, +//^^^^^^ meta.mapping.key.json +//^^^^^^^^^^^^^ - meta.mapping meta.mapping +// ^^^^ constant.language.null.json "dict": { "key": "value" } // ^^^^^^^^^^^^^^^^^^ meta.mapping.value.json meta.mapping - meta.mapping meta.mapping meta.mapping diff --git a/JavaScript/Comments.tmPreferences b/JavaScript/Comments.tmPreferences index 939619f676..71a87cf1dc 100644 --- a/JavaScript/Comments.tmPreferences +++ b/JavaScript/Comments.tmPreferences @@ -2,7 +2,7 @@ scope - source.js, source.jsx, source.ts, source.tsx + source.js, source.jsx, source.ts, source.tsx, meta.jsx meta.tag.name, meta.jsx meta.tag.attributes settings shellVariables diff --git a/JavaScript/Indentation Rules.tmPreferences b/JavaScript/Indentation Rules.tmPreferences index e338dc6594..6acdd2a7e9 100644 --- a/JavaScript/Indentation Rules.tmPreferences +++ b/JavaScript/Indentation Rules.tmPreferences @@ -2,7 +2,7 @@ scope - source.js + source.js, source.ts, source.jsx, source.tsx settings decreaseIndentPattern diff --git a/JavaScript/JSX Comments.tmPreferences b/JavaScript/JSX Comments.tmPreferences index e62e1b10a4..f1239d3772 100644 --- a/JavaScript/JSX Comments.tmPreferences +++ b/JavaScript/JSX Comments.tmPreferences @@ -5,7 +5,7 @@ name JSX Comments scope - source.jsx meta.jsx - source.jsx.embedded.jsx, source.tsx meta.jsx - source.tsx.embedded.jsx + meta.jsx settings shellVariables diff --git a/JavaScript/JSX.sublime-settings b/JavaScript/JSX.sublime-settings new file mode 100644 index 0000000000..d9ced3f9ca --- /dev/null +++ b/JavaScript/JSX.sublime-settings @@ -0,0 +1,3 @@ +{ + "word_separators": "./\\()\"'-:,.;<>~!@#%^&*|+=[]{}`~?", +} diff --git a/JavaScript/JSX.sublime-syntax b/JavaScript/JSX.sublime-syntax index f9c694b24b..c900415b3c 100644 --- a/JavaScript/JSX.sublime-syntax +++ b/JavaScript/JSX.sublime-syntax @@ -18,9 +18,34 @@ contexts: - include: jsx-tag jsx-interpolation: + - match: (?={/\*) + branch_point: jsx-interpolation-comment + branch: + - jsx-interpolation-comment + - jsx-interpolation-plain + - match: (?={) + push: jsx-interpolation-plain + + jsx-interpolation-comment: + - match: '({)(/\*)' + captures: + 1: punctuation.definition.interpolation.begin.js + 2: punctuation.definition.comment.begin.js + set: + - meta_include_prototype: false + - meta_scope: meta.interpolation.js comment.block.js + - match: '(\*/)(})' + captures: + 1: punctuation.definition.comment.end.js + 2: punctuation.definition.interpolation.end.js + pop: true + - match: (?=\*/) + fail: jsx-interpolation-comment + + jsx-interpolation-plain: - match: '{' scope: punctuation.definition.interpolation.begin.js - push: + set: - - meta_scope: meta.interpolation.js - meta_content_scope: source.js.embedded.jsx - match: '}' @@ -36,6 +61,7 @@ contexts: - include: else-pop jsx-meta: + - meta_include_prototype: false - meta_scope: meta.jsx.js - include: immediately-pop @@ -62,7 +88,7 @@ contexts: - jsx-tag-name jsx-tag-attributes: - - meta_scope: meta.tag.js + - meta_scope: meta.tag.attributes.js - match: '>' scope: punctuation.definition.tag.end.js @@ -114,6 +140,7 @@ contexts: 2: punctuation.definition.entity.js jsx-tag-name: + - meta_include_prototype: false - match: '' set: - - clear_scopes: 1 diff --git a/JavaScript/JavaScript.sublime-settings b/JavaScript/JavaScript.sublime-settings new file mode 100644 index 0000000000..d9ced3f9ca --- /dev/null +++ b/JavaScript/JavaScript.sublime-settings @@ -0,0 +1,3 @@ +{ + "word_separators": "./\\()\"'-:,.;<>~!@#%^&*|+=[]{}`~?", +} diff --git a/JavaScript/JavaScript.sublime-syntax b/JavaScript/JavaScript.sublime-syntax index d87e998445..89738f8b88 100644 --- a/JavaScript/JavaScript.sublime-syntax +++ b/JavaScript/JavaScript.sublime-syntax @@ -22,7 +22,7 @@ variables: identifier_part: (?:[_$\p{L}\p{Nl}\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{200C}\x{200D}]|{{identifier_escape}}) identifier_break: (?!{{identifier_part}}) - identifier: (?:{{identifier_start}}{{identifier_part}}*{{identifier_break}}) + identifier_name: (?:{{identifier_start}}{{identifier_part}}*{{identifier_break}}) constant_identifier: (?:[[:upper:]]{{identifier_part}}*{{identifier_break}}) dollar_only_identifier: (?:\${{identifier_break}}) dollar_identifier: '(?:(\$){{identifier_part}}*{{identifier_break}})' @@ -42,17 +42,17 @@ variables: null|true|false ){{identifier_break}} - non_reserved_identifier: (?:(?!{{reserved_word}}){{identifier}}) + non_reserved_identifier: (?:(?!{{reserved_word}}){{identifier_name}}) either_func_lookahead: (?:{{func_lookahead}}|{{arrow_func_lookahead}}) - binding_pattern_lookahead: (?:{{identifier}}|\[|\{) + binding_pattern_lookahead: (?:{{identifier_name}}|\[|\{) left_expression_end_lookahead: (?!\s*[.\[\(]) dot_accessor: (?:\??\.) property_name: >- (?x: - {{identifier}} + {{identifier_name}} | [0-9]+ | '(?:[^\\']|\\.)*' | "(?:[^\\"]|\\.)*" @@ -62,9 +62,11 @@ variables: class_element_name: |- (?x: {{property_name}} - | \#{{identifier}} + | \#{{identifier_name}} ) + modifier: (?:static{{identifier_break}}) + # Newline not permitted between `async` and `function`. func_lookahead: |- (?x: @@ -76,7 +78,7 @@ variables: (?x: (?:async\s*)? (?: - {{identifier}} + {{identifier_name}} | \( ( [^()] | \( [^()]* \) )* \) ) \s* @@ -93,7 +95,7 @@ variables: ) )) - function_call_lookahead: (?={{identifier}}\s*(?:{{dot_accessor}})?\() + function_call_lookahead: (?={{identifier_name}}\s*(?:{{dot_accessor}})?\() function_assignment_lookahead: |- (?x:(?= @@ -222,7 +224,7 @@ contexts: - match: default{{identifier_break}} scope: keyword.control.import-export.js pop: true - - match: '{{identifier}}' + - match: '{{identifier_name}}' scope: variable.other.readwrite.js pop: true - include: else-pop @@ -269,7 +271,7 @@ contexts: - match: '\}' scope: punctuation.section.block.end.js pop: true - - match: '{{identifier}}' + - match: '{{identifier_name}}' scope: variable.other.readwrite.js push: import-export-alias - match: '\*' @@ -329,7 +331,7 @@ contexts: - match: '\}' scope: punctuation.section.block.end.js pop: true - - match: '{{identifier}}' + - match: '{{identifier_name}}' scope: variable.other.readwrite.js push: import-export-alias - match: '\*' @@ -396,12 +398,12 @@ contexts: expect-label: - meta_include_prototype: false - - match: '(?={{nothing}}{{identifier}})' + - match: '(?={{nothing}}{{identifier_name}})' set: - match: '{{non_reserved_identifier}}' scope: variable.label.js pop: true - - match: '{{identifier}}' + - match: '{{identifier_name}}' scope: invalid.illegal.identifier.js variable.label.js pop: true - include: else-pop @@ -426,8 +428,9 @@ contexts: variable-binding-name: - match: (?={{non_reserved_identifier}}) set: - - meta_scope: meta.binding.name.js - - include: literal-variable + - - meta_scope: meta.binding.name.js + - include: immediately-pop + - literal-variable variable-binding-array-destructuring: - match: '\[' @@ -449,7 +452,7 @@ contexts: scope: punctuation.section.block.end.js pop: true - include: variable-binding-spread - - match: (?={{identifier}}|\[|'|") + - match: (?={{identifier_start}}|\[|'|") push: - initializer - variable-binding-object-alias @@ -464,7 +467,7 @@ contexts: - include: else-pop variable-binding-object-key: - - match: '{{identifier}}(?=\s*:)' + - match: '{{identifier_name}}(?=\s*:)' pop: true - include: literal-string - include: computed-property-name @@ -485,11 +488,6 @@ contexts: - include: else-pop variable-binding-top: - - match: (?={{identifier}}{{function_assignment_lookahead}}) - set: - - initializer - - function-name-meta - - variable-binding-pattern - match: (?={{binding_pattern_lookahead}}) set: - initializer @@ -509,7 +507,7 @@ contexts: variable-declaration: - match: (?:const|let|var){{identifier_break}} - scope: storage.type.js + scope: keyword.declaration.js set: - expect-semicolon - variable-binding-list-top @@ -524,7 +522,7 @@ contexts: function-parameter-binding-name: - match: '{{non_reserved_identifier}}' scope: meta.binding.name.js variable.parameter.function.js - - match: '{{identifier}}' + - match: '{{identifier_name}}' scope: invalid.illegal.identifier.js meta.binding.name.js variable.parameter.function.js function-parameter-binding-array-destructuring: @@ -548,7 +546,7 @@ contexts: scope: punctuation.section.block.end.js pop: true - include: function-parameter-binding-spread - - match: (?={{identifier}}|\[|'|") + - match: (?={{identifier_start}}|\[|'|") push: - initializer - function-parameter-binding-object-alias @@ -562,7 +560,7 @@ contexts: - include: else-pop function-parameter-binding-object-key: - - match: '{{identifier}}(?=\s*:)' + - match: '{{identifier_name}}(?=\s*:)' pop: true - include: literal-string - include: computed-property-name @@ -572,17 +570,21 @@ contexts: function-parameter-binding-spread: - match: '\.\.\.' scope: keyword.operator.spread.js - push: function-parameter-binding-pattern + push: function-parameter function-parameter-binding-list: - match: ',' scope: punctuation.separator.parameter.function.js - include: function-parameter-binding-spread - match: (?={{binding_pattern_lookahead}}) - push: + push: function-parameter + - include: else-pop + + function-parameter: + - match: '' + set: - initializer - function-parameter-binding-pattern - - include: else-pop initializer: - match: '=' @@ -631,7 +633,7 @@ contexts: set: - do-while-meta - do-while-condition - - block-scope + - statement - match: for{{identifier_break}} scope: keyword.control.loop.for.js @@ -659,21 +661,21 @@ contexts: scope: keyword.control.conditional.if.js set: - conditional-meta - - block-scope + - statement - expect-parenthesized-expression - match: else\s+if{{identifier_break}} scope: keyword.control.conditional.elseif.js set: - conditional-meta - - block-scope + - statement - expect-parenthesized-expression - match: else{{identifier_break}} scope: keyword.control.conditional.else.js set: - conditional-meta - - block-scope + - statement - match: try{{identifier_break}} scope: keyword.control.exception.try.js @@ -767,7 +769,7 @@ contexts: for-condition-contents: # This could be either type of for loop. - match: (?:const|let|var){{identifier_break}} - scope: storage.type.js + scope: keyword.declaration.js set: - - include: for-of-rest - match: (?=\S) @@ -853,7 +855,7 @@ contexts: - include: immediately-pop decorator-name: - - match: '{{identifier}}{{left_expression_end_lookahead}}' + - match: '{{identifier_name}}{{left_expression_end_lookahead}}' scope: variable.annotation.js pop: true @@ -936,14 +938,18 @@ contexts: - include: import-meta-expression - include: class - - include: constants + - include: special-name + + - include: regular-function + + - match: (?={{reserved_word}}) + pop: true - - match: (?={{identifier}}{{function_assignment_lookahead}}) + - match: (?={{identifier_name}}{{function_assignment_lookahead}}) set: - function-name-meta - literal-variable - - include: regular-function - include: object-literal # Newline not allowed between `async` and parameters. @@ -1059,7 +1065,7 @@ contexts: - include: string-content tagged-template: - - match: '{{identifier}}(?=\s*`)' + - match: '{{identifier_name}}(?=\s*`)' scope: variable.function.tagged-template.js pop: true @@ -1153,7 +1159,7 @@ contexts: captures: 1: punctuation.dollar.js pop: true - - match: '{{identifier}}' + - match: '{{identifier_name}}' scope: variable.type.js pop: true - include: else-pop @@ -1194,9 +1200,6 @@ contexts: - match: in{{identifier_break}} scope: keyword.operator.js push: expression-begin - - match: '&&|\|\||\?\?' - scope: keyword.operator.logical.js - push: expression-begin - match: '=(?![=>])' scope: keyword.operator.assignment.js push: expression-begin @@ -1212,9 +1215,15 @@ contexts: \|= | # assignment right-to-left both <<= | # assignment right-to-left both >>= | # assignment right-to-left both - >>>= # assignment right-to-left both + >>>= | # assignment right-to-left both + &&= | + \|\|= | + \?\?= scope: keyword.operator.assignment.augmented.js push: expression-begin + - match: '&&|\|\||\?\?' + scope: keyword.operator.logical.js + push: expression-begin - match: |- (?x) << | # bitwise-shift left-to-right both @@ -1227,11 +1236,11 @@ contexts: push: expression-begin - match: |- (?x) - <= | # relational left-to-right both - >= | # relational left-to-right both - < | # relational left-to-right both - > # relational left-to-right both - scope: keyword.operator.relational.js + <= | # comparison left-to-right both + >= | # comparison left-to-right both + < | # comparison left-to-right both + > # comparison left-to-right both + scope: keyword.operator.comparison.js push: expression-begin - match: |- (?x) @@ -1291,7 +1300,7 @@ contexts: class: - match: class{{identifier_break}} - scope: storage.type.class.js + scope: keyword.declaration.class.js set: - class-meta - class-body @@ -1329,12 +1338,11 @@ contexts: - function-declaration-expect-body - function-declaration-expect-parameters - - match: static{{identifier_break}} - scope: storage.modifier.js + - include: class-element-modifiers - match: |- (?x)(?= - \#? {{identifier}} + \#? {{identifier_name}} \s* = \s* {{either_func_lookahead}} ) @@ -1355,6 +1363,22 @@ contexts: - match: (?={{class_element_name}}) push: class-element + class-element-modifiers: + - match: (?={{modifier}}) + branch_point: class-element-modifier + branch: + - class-element-modifier + - class-element + + class-element-modifier: + - match: '{{modifier}}' + scope: storage.modifier.js + set: + - match: (?={{class_element_name}}|\*) + pop: true + - match: (?=\S) + fail: class-element-modifier + class-extends: - match: extends{{identifier_break}} scope: storage.modifier.extends.js @@ -1443,7 +1467,7 @@ contexts: fail: class-field - include: else-pop - constants: + special-name: - match: true{{identifier_break}} scope: constant.language.boolean.true.js pop: true @@ -1453,6 +1477,12 @@ contexts: - match: null{{identifier_break}} scope: constant.language.null.js pop: true + - match: super{{identifier_break}} + scope: variable.language.super.js + pop: true + - match: this{{identifier_break}} + scope: variable.language.this.js + pop: true function-name-meta: - meta_include_prototype: false @@ -1539,7 +1569,7 @@ contexts: set: - clear_scopes: 1 - meta_scope: meta.function.parameters.js - - match: '{{identifier}}' + - match: '{{identifier_name}}' scope: variable.parameter.function.js pop: true - include: function-declaration-parameters @@ -1567,7 +1597,7 @@ contexts: - include: function-parameter-binding-list label: - - match: '({{identifier}})\s*(:)' + - match: '({{identifier_name}})\s*(:)' captures: 1: entity.name.label.js 2: punctuation.separator.js @@ -1600,9 +1630,6 @@ contexts: - match: (?=\*) push: method-declaration - - match: '{{identifier}}(?=\s*(?:[},]|$|//|/\*))' - scope: variable.other.readwrite.js - - match: (?=(?:get|set|async){{identifier_break}}) branch_point: prefixed-object-literal-method branch: @@ -1624,7 +1651,10 @@ contexts: push: expression-no-comma object-literal-element: - - match: '' + - match: '{{identifier_name}}(?=\s*(?:[},]|$|//|/\*))' + scope: variable.other.readwrite.js + pop: true + - match: (?=\S) pop: true branch_point: object-literal-property branch: @@ -1645,7 +1675,7 @@ contexts: - include: literal-string - include: literal-number - - match: '{{identifier}}' + - match: '{{identifier_name}}' pop: true - include: else-pop @@ -1675,10 +1705,10 @@ contexts: captures: 1: punctuation.dollar.js pop: true - - match: '{{identifier}}' + - match: '{{identifier_name}}' scope: entity.name.function.js pop: true - - match: '(#){{identifier}}' + - match: '(#){{identifier_name}}' scope: entity.name.function.js captures: 1: punctuation.definition.js @@ -1721,7 +1751,7 @@ contexts: captures: 1: punctuation.dollar.js pop: true - - match: '{{identifier}}' + - match: '{{identifier_name}}' scope: variable.other.readwrite.js pop: true - match: "'" @@ -1750,7 +1780,7 @@ contexts: scope: invalid.illegal.newline.js pop: true - include: string-content - - match: (#)({{identifier}}) + - match: (#)({{identifier_name}}) captures: 1: punctuation.definition.variable.js 2: variable.other.readwrite.js @@ -1768,14 +1798,11 @@ contexts: - function-declaration-expect-body - function-declaration-expect-parameters - method-name - - method-declaration-expect-prefix - - function-declaration-expect-async + - method-declaration-expect-asterisk - method-declaration-expect-prefix: + method-declaration-expect-asterisk: - match: \* scope: keyword.generator.asterisk.js - - match: (?:get|set){{identifier_break}}(?!\s*\() - scope: storage.type.accessor.js - include: else-pop parenthesized-expression: @@ -1827,7 +1854,7 @@ contexts: - match: '{{dot_accessor}}' scope: punctuation.accessor.js push: - - match: '(?={{identifier}}\s*(?:{{dot_accessor}})?\()' + - match: '(?={{identifier_name}}\s*(?:{{dot_accessor}})?\()' set: - call-method-meta - function-call-arguments @@ -1907,13 +1934,13 @@ contexts: pop: true literal-call: - - match: (?={{identifier}}\s*(?:{{dot_accessor}})?\() + - match: (?={{identifier_name}}\s*(?:{{dot_accessor}})?\() set: - call-function-meta - function-call-arguments - literal-variable - - match: (?={{identifier}}\s*(?:{{dot_accessor}}\s*#?{{identifier}}\s*)+(?:{{dot_accessor}})?\() + - match: (?={{identifier_name}}\s*(?:{{dot_accessor}}\s*#?{{identifier_name}}\s*)+(?:{{dot_accessor}})?\() set: - call-method-meta - function-call-arguments @@ -1940,17 +1967,17 @@ contexts: - match: '{{dollar_only_identifier}}' scope: variable.function.js variable.other.dollar.only.js punctuation.dollar.js pop: true - - match: '{{identifier}}' + - match: '{{identifier_name}}' scope: variable.function.js pop: true - include: else-pop call-method-name: - include: support-property - - match: '{{identifier}}' + - match: '{{identifier_name}}' scope: variable.function.js pop: true - - match: '(#){{identifier}}' + - match: '(#){{identifier_name}}' scope: variable.function.js captures: 1: punctuation.definition.js @@ -1958,9 +1985,14 @@ contexts: - include: else-pop literal-variable: - - include: language-identifiers + - include: special-identifier - include: support + - match: '(?={{identifier_name}}{{function_assignment_lookahead}})' + set: + - function-name-meta + - literal-variable-base + - match: '{{constant_identifier}}(?=\s*(?:{{dot_accessor}}|\[))' scope: support.class.js pop: true @@ -1982,33 +2014,26 @@ contexts: - match: '{{constant_identifier}}' scope: variable.other.constant.js pop: true - - match: '{{identifier}}' + - match: '{{identifier_name}}' scope: variable.other.readwrite.js pop: true - include: literal-private-variable literal-private-variable: - - match: (#)({{identifier}}) + - match: (#)({{identifier_name}}) captures: 1: punctuation.definition.variable.js 2: variable.other.readwrite.js pop: true - language-identifiers: + special-identifier: + # These are ordinary identifiers, not reserved words - match: arguments{{identifier_break}} scope: variable.language.arguments.js pop: true - - match: super{{identifier_break}} - scope: variable.language.super.js - pop: true - - match: this{{identifier_break}} - scope: variable.language.this.js - pop: true - match: globalThis{{identifier_break}} scope: variable.language.global.js pop: true - - # These three are ordinary variables, not literals! - match: undefined{{identifier_break}} scope: constant.language.undefined.js pop: true @@ -2314,7 +2339,7 @@ contexts: - match: (?:document|window|navigator){{identifier_break}} scope: support.type.object.dom.js pop: true - - match: (?:clearTimeout|setTimeout){{identifier_break}} + - match: (?:clearTimeout|clearInterval|setTimeout|setInterval){{identifier_break}} scope: support.function.dom.js pop: true @@ -2381,12 +2406,12 @@ contexts: object-property: - include: support-property - - match: (?=\#?{{identifier}}{{function_assignment_lookahead}}) + - match: (?=\#?{{identifier_name}}{{function_assignment_lookahead}}) set: - function-name-meta - object-property-base - - match: '(?=#?{{identifier}}\s*(?:{{dot_accessor}})?\()' + - match: '(?=#?{{identifier_name}}\s*(?:{{dot_accessor}})?\()' set: call-method-name - include: object-property-base @@ -2401,13 +2426,13 @@ contexts: captures: 1: punctuation.dollar.js pop: true - - match: '{{identifier}}' + - match: '{{identifier_name}}' scope: meta.property.object.js pop: true - match: '{{identifier_part}}+{{identifier_break}}' scope: invalid.illegal.illegal-identifier.js pop: true - - match: (#)({{identifier}}) + - match: (#)({{identifier_name}}) captures: 1: punctuation.definition.variable.js 2: meta.property.object.js diff --git a/JavaScript/Symbol List - Exports.tmPreferences b/JavaScript/Symbol List - Exports.tmPreferences new file mode 100644 index 0000000000..a3d10e83fc --- /dev/null +++ b/JavaScript/Symbol List - Exports.tmPreferences @@ -0,0 +1,14 @@ + + + + scope + + meta.export.js meta.binding.name - meta.export.js meta.function meta.binding.name + + settings + + showInIndexedSymbolList + 1 + + + diff --git a/JavaScript/Symbol List.tmPreferences b/JavaScript/Symbol List.tmPreferences index 78e7e74613..befd76168a 100644 --- a/JavaScript/Symbol List.tmPreferences +++ b/JavaScript/Symbol List.tmPreferences @@ -3,8 +3,7 @@ scope - source.js entity.name.function, - source.js meta.class entity.name.class + entity.name.interface.js settings diff --git a/JavaScript/TSX.sublime-settings b/JavaScript/TSX.sublime-settings new file mode 100644 index 0000000000..d9ced3f9ca --- /dev/null +++ b/JavaScript/TSX.sublime-settings @@ -0,0 +1,3 @@ +{ + "word_separators": "./\\()\"'-:,.;<>~!@#%^&*|+=[]{}`~?", +} diff --git a/JavaScript/TypeScript.sublime-settings b/JavaScript/TypeScript.sublime-settings new file mode 100644 index 0000000000..d9ced3f9ca --- /dev/null +++ b/JavaScript/TypeScript.sublime-settings @@ -0,0 +1,3 @@ +{ + "word_separators": "./\\()\"'-:,.;<>~!@#%^&*|+=[]{}`~?", +} diff --git a/JavaScript/TypeScript.sublime-syntax b/JavaScript/TypeScript.sublime-syntax index 5d43a4101e..62c63ce64b 100644 --- a/JavaScript/TypeScript.sublime-syntax +++ b/JavaScript/TypeScript.sublime-syntax @@ -12,7 +12,7 @@ variables: function_call_lookahead: >- (?x:(?= - {{identifier}} + {{identifier_name}} \s* (?: < @@ -24,6 +24,19 @@ variables: \( )) + arrow_func_lookahead: |- + (?x: + (?:async\s*)? + (?: + {{identifier_name}} + | \( ( [^()] | \( [^()]* \) )* \) + ) + \s* + (?:=>|:) + ) + + modifier: (?:(?:static|readonly|private|public|protected|abstract|declare|override){{identifier_break}}) + contexts: detect-parenthesized-arrow: - meta_prepend: true @@ -35,6 +48,7 @@ contexts: - immediately-pop-2 ts-detect-arrow-function-return-type: + - meta_include_prototype: false - match: '' push: - ts-detect-arrow-after-return-type @@ -48,7 +62,7 @@ contexts: async-arrow-function: - match: async{{identifier_break}} - scope: storage.type.js + scope: keyword.declaration.async.js set: - function-meta - arrow-function-expect-body @@ -65,7 +79,6 @@ contexts: - arrow-function-expect-arrow - ts-type-annotation - arrow-function-expect-parameters - - function-declaration-expect-async ts-import-type: - match: type{{identifier_break}} @@ -93,7 +106,7 @@ contexts: - match: \!\. scope: punctuation.accessor.js push: - - match: '(?={{identifier}}\s*(?:\.\?)?\()' + - match: '(?={{identifier_name}}\s*(?:\.\?)?\()' set: - call-method-meta - function-call-arguments @@ -118,7 +131,7 @@ contexts: - include: ts-namespace-declaration - match: const{{identifier_break}} - scope: storage.type.js + scope: keyword.declaration.js set: - include: ts-enum - match: (?=\S) @@ -141,7 +154,7 @@ contexts: class: - match: class{{identifier_break}} - scope: storage.type.class.js + scope: keyword.declaration.class.js set: - class-meta - class-body @@ -152,6 +165,18 @@ contexts: ts-class-implements: - match: implements{{identifier_break}} scope: storage.modifier.implements.js + set: ts-inherited-class-expression-list + - include: else-pop + + ts-interface-extends: + - match: extends{{identifier_break}} + scope: storage.modifier.extends.js + set: ts-inherited-class-expression-list + - include: else-pop + + ts-inherited-class-expression-list: + - meta_include_prototype: false + - match: '' set: - - match: \, scope: punctuation.separator.comma.js @@ -161,7 +186,6 @@ contexts: - include: else-pop - inherited-class-expression-end - inherited-class-expression-begin - - include: else-pop inherited-class-expression-end: - meta_prepend: true @@ -175,11 +199,11 @@ contexts: ts-interface-declaration: - match: interface{{identifier_break}} - scope: storage.type.js + scope: keyword.declaration.js set: - ts-interface-meta - ts-type-body - - class-extends + - ts-interface-extends - ts-type-parameter-list - ts-interface-name @@ -189,7 +213,7 @@ contexts: - include: immediately-pop ts-interface-name: - - match: '{{identifier}}' + - match: '{{identifier_name}}' scope: entity.name.interface.js pop: true - include: else-pop @@ -210,8 +234,7 @@ contexts: - match: '\+|-' scope: storage.modifier.js - - match: readonly{{identifier_break}} - scope: storage.modifier.js + - include: class-element-modifiers - match: (?=[<(]) push: @@ -233,7 +256,7 @@ contexts: - match: \] scope: punctuation.section.brackets.end.js pop: true - - match: '{{identifier}}' + - match: '{{identifier_name}}' scope: variable.other.readwrite.js push: - match: in{{identifier_break}} @@ -251,7 +274,7 @@ contexts: - function-declaration-expect-parameters - ts-type-parameter-list - - match: '{{identifier}}' + - match: '{{identifier_name}}' scope: variable.other.readwrite.js push: - - match: (?=[<(]) @@ -277,7 +300,7 @@ contexts: - include: immediately-pop ts-enum-name: - - match: '{{identifier}}' + - match: '{{identifier_name}}' scope: entity.name.enum.js pop: true - include: else-pop @@ -293,7 +316,7 @@ contexts: - include: comma-separator - match: (?=['"]) push: literal-string - - match: '{{identifier}}' + - match: '{{identifier_name}}' scope: variable.other.readwrite.js push: initializer @@ -303,7 +326,7 @@ contexts: - include: immediately-pop ts-type-alias-name: - - match: '{{identifier}}' + - match: '{{identifier_name}}' scope: entity.name.type.js pop: true - include: else-pop @@ -319,7 +342,7 @@ contexts: ts-namespace-declaration: - match: namespace{{identifier_break}} - scope: storage.type.js + scope: keyword.declaration.js set: - ts-namespace-meta - block @@ -331,21 +354,24 @@ contexts: - include: immediately-pop ts-namespace-name: - - match: '{{identifier}}' + - match: '{{identifier_name}}' scope: entity.name.namespace.js pop: true - include: else-pop variable-binding-pattern: + - meta_include_prototype: false - match: '' set: - - - include: immediately-pop - ts-type-annotation - ts-type-annotation-definite - - - include: variable-binding-name - - include: variable-binding-array-destructuring - - include: variable-binding-object-destructuring - - include: else-pop + - ts-variable-binding-pattern-name + + ts-variable-binding-pattern-name: + - include: variable-binding-name + - include: variable-binding-array-destructuring + - include: variable-binding-object-destructuring + - include: else-pop function-declaration: - meta_include_prototype: false @@ -369,7 +395,7 @@ contexts: - match: \> scope: punctuation.definition.generic.end.js pop: true - - match: '{{identifier}}' + - match: '{{identifier_name}}' scope: variable.parameter.generic.js push: - ts-type-parameter-default @@ -395,39 +421,50 @@ contexts: - ts-type-expression-begin - include: else-pop - function-parameter-binding-pattern: + function-parameter: + - meta_include_prototype: false - match: '' set: - - - include: ts-type-annotation - - - include: ts-type-annotation-optional - - - include: function-parameter-binding-name - - include: function-parameter-binding-array-destructuring - - include: function-parameter-binding-object-destructuring - - include: else-pop + - initializer + - ts-type-annotation + - ts-type-annotation-optional + - function-parameter-binding-pattern function-parameter-binding-list: - meta_prepend: true - include: decorator - - match: (?:private|public|protected|readonly){{identifier_break}} - scope: storage.modifier.js + - include: function-parameter-modifiers - match: this{{identifier_break}} scope: variable.language.this.js push: ts-type-annotation - class-body-contents: - - meta_prepend: true - - match: (?:private|public|protected|readonly|abstract|declare){{identifier_break}} + function-parameter-modifiers: + - match: (?={{modifier}}) + branch_point: function-parameter-modifier + branch: + - function-parameter-modifier + - function-parameter + + function-parameter-modifier: + - match: '{{modifier}}' scope: storage.modifier.js + set: + - match: (?={{binding_pattern_lookahead}}|\.\.\.) + pop: true + - match: (?=\S) + fail: function-parameter-modifier class-field: + - meta_include_prototype: false - match: '' set: - initializer - ts-type-annotation - ts-type-annotation-optional + - ts-type-annotation-definite - class-field-check - field-name @@ -446,16 +483,19 @@ contexts: - function-declaration-expect-parameters - ts-type-parameter-list - method-name - - method-declaration-expect-prefix - - function-declaration-expect-async + - method-declaration-expect-asterisk expression-end: - meta_prepend: true - include: ts-type-assertion - - match: '<<' - scope: keyword.operator.bitwise.js - push: expression-begin - - match: (?=<) + - include: ts-function-type-arguments-or-less-than + + decorator-expression-end: + - meta_prepend: true + - include: ts-function-type-arguments-or-less-than + + ts-function-type-arguments-or-less-than: + - match: (?=<(?![<=])) branch_point: ts-function-type-arguments branch: - ts-function-type-arguments @@ -465,6 +505,10 @@ contexts: - match: \<(?!<) scope: punctuation.definition.generic.begin.js set: + - - match: (?=[\]()};,`]) + pop: true + - match: (?=\S) + fail: ts-function-type-arguments - - meta_scope: meta.generic.js - match: \> scope: punctuation.definition.generic.end.js @@ -483,7 +527,7 @@ contexts: ts-less-than: - match: '<' - scope: keyword.operator.logical.js + scope: keyword.operator.comparison.js set: expression-begin expression-begin: @@ -501,7 +545,7 @@ contexts: - ts-type-expression-begin ts-type-assertion: - - match: '!(?!\.)' + - match: '!(?![.=])' scope: keyword.operator.type.js - match: as{{identifier_break}} @@ -556,10 +600,16 @@ contexts: - match: is{{identifier_break}} scope: keyword.operator.word.js push: [ts-type-expression-end-no-line-terminator, ts-type-expression-begin] + - match: as{{identifier_break}} + scope: keyword.operator.type.js + push: + - ts-type-expression-end + - ts-type-expression-end-no-line-terminator + - ts-type-expression-begin - match: \. - scope: punctuation.separator.accessor.js + scope: punctuation.accessor.js push: - - match: '{{identifier}}' + - match: '{{identifier_name}}' scope: support.class.js set: ts-type-expression-end-no-line-terminator @@ -639,6 +689,8 @@ contexts: scope: keyword.operator.type.js - match: infer{{identifier_break}} scope: keyword.operator.type.js + - match: new{{identifier_break}} + scope: keyword.operator.new.js - match: unique{{identifier_break}} scope: storage.modifier.unique.js @@ -646,6 +698,8 @@ contexts: scope: storage.modifier.readonly.js - match: asserts{{identifier_break}} scope: storage.modifier.asserts.js + - match: abstract{{identifier_break}} + scope: storage.modifier.abstract.js - match: import{{identifier_break}} scope: keyword.operator.type.js @@ -676,6 +730,10 @@ contexts: - include: literal-string - include: literal-number + - include: ts-type-template-string + + - match: '-' + scope: keyword.operator.arithmetic.js - include: else-pop @@ -708,7 +766,7 @@ contexts: - include: comma-separator - match: ; scope: punctuation.separator.semicolon.js - - match: '{{identifier}}' + - match: '{{identifier_name}}' scope: variable.other.readwrite.js push: - ts-type-annotation @@ -755,10 +813,35 @@ contexts: pop: true ts-type-basic: - - match: '{{identifier}}' + - match: '{{identifier_name}}' scope: support.class.js pop: true + ts-type-template-string: + - match: '`' + scope: punctuation.definition.string.begin.js + set: + - meta_include_prototype: false + - meta_scope: meta.string.js string.quoted.other.js + - match: "`" + scope: punctuation.definition.string.end.js + pop: true + - match: '\$\{' + scope: punctuation.section.interpolation.begin.js + push: + - clear_scopes: 1 + - meta_scope: meta.interpolation.js + - meta_content_scope: source.js.embedded + - match: '\}' + scope: punctuation.section.interpolation.end.js + pop: true + - match: (?=\S) + push: + - ts-type-expression-end + - ts-type-expression-end-no-line-terminator + - ts-type-expression-begin + - include: string-content + ts-type-parenthesized: - match: \( scope: punctuation.section.group.begin.js @@ -790,8 +873,28 @@ contexts: - ts-type-expression-begin - include: else-pop - include: comma-separator - - match: '{{identifier}}' - scope: variable.other.readwrite.js + - match: '\.\.\.' + scope: keyword.operator.spread.js + - match: '{{identifier_name}}' + scope: variable.parameter.js push: - ts-type-annotation - ts-type-annotation-optional + + object-literal-contents: + - meta_prepend: true + + - match: (?={{modifier}}) + branch_point: ts-object-literal-element-modifier + branch: + - ts-object-literal-element-modifier + - object-literal-element + + ts-object-literal-element-modifier: + - match: '{{modifier}}' + scope: storage.modifier.js + set: + - match: (?={{property_name}}) + pop: true + - match: (?=\S) + fail: ts-object-literal-element-modifier diff --git a/JavaScript/tests/syntax_test_js.js b/JavaScript/tests/syntax_test_js.js index d68ea64d78..036cdad49f 100644 --- a/JavaScript/tests/syntax_test_js.js +++ b/JavaScript/tests/syntax_test_js.js @@ -1,235 +1,5 @@ // SYNTAX TEST "Packages/JavaScript/JavaScript.sublime-syntax" -import TheirClass from "./mypath"; -//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.import.js -// ^ keyword.control.import-export -// ^ keyword.control.import-export - -import {identifier, otherIdentifier} from "somewhere"; -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.import -// ^ keyword.control.import-export -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block -// ^ punctuation.section.block.begin -// ^ punctuation.section.block.end -// ^ meta.import meta.block variable.other.readwrite - -import thing, {identifier as otherIdentifier}, * as otherName from "otherplace"; -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.import -// ^ keyword.control.import-export -// ^ variable.other.readwrite -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block -// ^ variable.other.readwrite -// ^ keyword.control.import-export -// ^ variable.other.readwrite -// ^ constant.other.js -// ^ keyword.control.import-export - -import 'module'; -// ^^^^^^^^^^^^^ meta.import - -// Better highlighting while typing. -import -import; -// <- keyword.control.import-export - -import;/**/ -// ^ - meta.import - -export { name1, name2 as name3 }; -//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.export -//^ keyword.control.import-export -// ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block -// ^ punctuation.separator.comma -// ^^ keyword.control.import-export - -export let name1, name2; -//^^^^^^^^^^^^^^^^^^^^^^ meta.export -//^ keyword.control.import-export -// ^^^ storage.type -// ^ punctuation.separator.comma - -export var name3; -//^^^^^^^^^^^^^^^ meta.export -//^ keyword.control.import-export -// ^^^ storage.type - -export const name1 = 5; -//^^^^^^^^^^^^^^^^^^^^^ meta.export -//^ keyword.control.import-export -// ^^^^^ storage.type -// ^ keyword.operator.assignment - -export let foo = 123 // No semicolon -export function bar() {} -// <- keyword.control.import-export - -export function foo() {}; -//^^^^^^^^^^^^^^^^^^^^^^ meta.export -//^^^^ keyword.control.import-export -// ^^^^^^^^^^^^^^^^^ meta.function -// ^ punctuation.terminator.statement.empty - -export function* foo() {}; -//^^^^^^^^^^^^^^^^^^^^^^^ meta.export -//^^^^ keyword.control.import-export -// ^^^^^^^^^^^^^^^^^^ meta.function -// ^ punctuation.terminator.statement.empty - -export async function foo() {}; -//^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.export -//^^^^ keyword.control.import-export -// ^^^^^^^^^^^^^^^^^^^^^^^ meta.function -// ^ punctuation.terminator.statement.empty - -export class Foo {}; -//^^^^^^^^^^^^^^^^^ meta.export -//^^^^ keyword.control.import-export -// ^^^^^^^^^^^^ meta.class -// ^ punctuation.terminator.statement.empty - -export default expression; -//^^^^^^^^^^^^^^^^^^^^^^^^ meta.export -//^ keyword.control.import-export -// ^ keyword.control.import-export - -export default function (a) { }; -//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.export -//^^^^ keyword.control.import-export -// ^^^^^^^ keyword.control.import-export -// ^^^^^^^^^^^^^^^^ meta.function -// ^ punctuation.terminator.statement.empty - meta.export - -export default function* (a) { }; -//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.export -//^^^^ keyword.control.import-export -// ^^^^^^^ keyword.control.import-export -// ^^^^^^^^^^^^^^^^^ meta.function -// ^ punctuation.terminator.statement.empty - meta.export - -export default function name1(b) { } -//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.export -//^ keyword.control.import-export -// ^ keyword.control.import-export -// ^^^^^^^^ keyword.declaration.function -// ^ entity.name.function - -export default class Foo {}; -//^^^^^^^^^^^^^^^^^ meta.export -//^^^^ keyword.control.import-export -// ^^^^^^^ keyword.control.import-export -// ^^^^^^^^^^^^ meta.class -// ^ punctuation.terminator.statement.empty - -export default +function (a) { }; -//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.export -//^^^^ keyword.control.import-export -// ^^^^^^^ keyword.control.import-export -// ^^^^^^^^^^^^^^^^ meta.function - -export { name1 as default }; -//^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.export -//^ keyword.control.import-export -// ^^^^^^^^^^^^^^^^^^^^ meta.block -// ^ keyword.control.import-export -// ^ keyword.control.import-export - -export * from "./othermod"; -//^^^^^^^^^^^^^^^^^^^^^^^^^ meta.export -//^ keyword.control.import-export -// ^ constant.other -// ^ keyword.control.import-export - -export { name1, name2 } from "./othermod"; -//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.export -//^ keyword.control.import-export -// ^^^^^^^^^^^^^^^^ meta.block -// ^ punctuation.section.block.begin -// ^ punctuation.section.block.end -// ^ keyword.control.import-export - -export { import1 as name1, import2 as name2, nameN } from "./othermod"; -//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.export -//^ keyword.control.import-export -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block -// ^ keyword.control.import-export -// ^ keyword.control.import-export -// ^ keyword.control.import-export - -// Better highlighting while typing. -export -export; -// <- keyword.control.import-export - -export;/**/ -// ^ - meta.export - -import * as - alias from "module"; -// ^^^^^^^^^^^^^^^^^^^^^ meta.import.js - -import { member as - alias } from "module"; -// ^^^^^^^^^^^^^^^^^^^^^^^ meta.import.js - -import { * as - alias } from "module"; -// ^^^^^^^^^^^^^^^^^^^^^^^ meta.import.js - -export { member as - alias } from "module"; -// ^^^^^^^^^^^^^^^^^^^^^^^ meta.export.js - -export { member as - default } from "module"; -// ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.export.js - -let from; -// ^^^^ variable.other.readwrite.js - -import from from "./othermod"; -// ^^^^ variable.other.readwrite.js - -import { from } from "./othermod"; -// ^^^^ variable.other.readwrite.js - -export from from "./othermod"; -// ^^^^ variable.other.readwrite.js - -export { from } from "./othermod"; -// ^^^^ variable.other.readwrite.js - -export default$ -// ^^^^^^^^ - keyword -; - -let x = import.meta; -// ^^^^^^^^^^^ - meta.import -// ^^^^^^ keyword.import -// ^ punctuation.accessor -// ^^^^ variable.language.import - - import.meta; -// ^^^^^^^^^^^ - meta.import -// ^^^^^^ keyword.import -// ^ punctuation.accessor -// ^^^^ variable.language.import - - import -// ^^^^^^ - meta.import - .meta; -// ^^^^^ - meta.import -// ^ punctuation.accessor -// ^^^^ variable.language.import - - import('foo'); -// ^^^^^^ keyword.import -// ^^^^^^^ meta.group - - import -// ^^^^^^ - meta.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 @@ -254,7 +24,7 @@ someFunction({ // ^ meta.function meta.block var bar = function() { -// ^^^ storage.type +// ^^^ keyword.declaration // ^^^ entity.name.function variable.other.readwrite // ^^^^^^^^^^^^ meta.function - meta.function meta.function // ^^^^^^^^ keyword.declaration.function @@ -280,12 +50,6 @@ function() {} function foo(){}/**/ // ^ - meta.function -if (true) -// <- keyword.control.conditional.if -{ - bar() -} - // This is a comment function() { } // <- punctuation.definition.comment // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.double-slash @@ -306,7 +70,7 @@ if (true) x --> y; //^^ keyword.operator.arithmetic.js -// ^ keyword.operator.relational.js +// ^ keyword.operator.comparison.js #! /usr/bin/env node // <- comment.line.shebang punctuation.definition.comment @@ -401,7 +165,7 @@ not_a_comment; var str = '\':'; var str2 = NaN; -// <- storage.type +// <- keyword.declaration // ^ variable.other.readwrite // ^ keyword.operator.assignment // ^^^ constant.language.nan @@ -470,6 +234,9 @@ var obj = { // ^^^^^^^^^^^^ meta.function }, + class: null, // Keys are IdentifierNames, not merely Identifiers +// ^^^^^ meta.mapping.key + [true==false ? 'one' : 'two']: false, // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.mapping.key // ^ punctuation.section.brackets.begin @@ -503,7 +270,7 @@ var obj = { // ^^^^^^^^ keyword.declaration.function objKey: new class Foo { -// ^^^^^ storage.type.class +// ^^^^^ keyword.declaration.class get baz() {} // ^^^ storage.type.accessor // ^^^ entity.name.function @@ -609,6 +376,16 @@ var obj = { get: 42, // ^^^ meta.mapping.key + + async() {} +// ^^^^^^^^^^ meta.function +// ^^^^^ entity.name.function +// ^^ meta.function.parameters +// ^ punctuation.section.group.begin +// ^ punctuation.section.group.end +// ^^ meta.block +// ^ punctuation.section.block.begin +// ^ punctuation.section.block.end } // <- meta.mapping - meta.block @@ -666,295 +443,12 @@ baz = ""; // ^^ meta.string string.quoted.double var qux = 100; -// <- storage.type +// <- keyword.declaration // ^ variable.other.readwrite // ^ constant.numeric -{}/**/ -//^ - meta.block - -if (Infinity > qux) { -// <- meta.conditional.js keyword.control.conditional.if -// ^^^^^^^^^^^^^^^ meta.conditional -// ^^^^^^^^ constant.language.infinity - a; -// ^ meta.conditional meta.block -} -// <- meta.conditional meta.block - -if (foo bar) - baz = "test" - -if(false){}/**/ -// ^ - meta.conditional - -do { -// <- 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.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 -// ^^^ storage.type.js -// ^ meta.block - i += 1; -// ^^^^^^^ meta.for meta.block -} -// <- meta.block - - for (; x in list;) {} -// ^^^^^^^^^^^^^^^^^^^^^ meta.for -// ^^^ keyword.control.loop.for -// ^^^^^^^^^^^^^^ meta.group -// ^ punctuation.separator.expression -// ^^ keyword.operator -// ^ punctuation.separator.expression - - for (a[x in list];;) {} -// ^^^^^^^^^^^^^^^^^^^^^^^ meta.for -// ^^^ keyword.control.loop.for -// ^^^^^^^^^^^^^^^^ meta.group -// ^^^^^^^^^^^ meta.brackets -// ^^ keyword.operator -// ^ punctuation.separator.expression -// ^ punctuation.separator.expression - - for (;function () {}/a/g;) {} -// ^ keyword.operator - - for (const x in list) {} -// ^^^^^^^^^^^^^^^^^^^^^^^^ meta.for -// ^^^ keyword.control.loop.for -// ^^^^^^^^^^^^^^^^^ meta.group -// ^^^^^ storage.type -// ^^ keyword.operator.word - - for (const x of list) {} -// ^^^^^^^^^^^^^^^^^^^^^^^^ meta.for -// ^^^ keyword.control.loop.for -// ^^^^^^^^^^^^^^^^^ meta.group -// ^^^^^ storage.type -// ^^ keyword.operator.word - - for (x in list) {} -// ^^^^^^^^^^^^^^^^^^ meta.for -// ^^^ keyword.control.loop.for -// ^^^^^^^^^^^ meta.group -// ^^ keyword.operator.word - - for (x of list) {} -// ^^^^^^^^^^^^^^^^^^ meta.for -// ^^^ keyword.control.loop.for -// ^^^^^^^^^^^ meta.group -// ^^ keyword.operator.word - - for await (const x of list) {} -// ^^^ 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.yield - - x = yield * 42; -// ^^^^^ keyword.control.flow.yield -// ^ keyword.generator.asterisk - - x = yield - function f() {} - []; -// ^^ meta.sequence - meta.brackets - - - x = yield* - function f() {} - []; -// ^^ meta.brackets - meta.sequence - - y = await 42; -// ^^^^^ keyword.control.flow.await - - y = yield await 42; -// ^^^^^ keyword.control.flow.yield -// ^^^^^ keyword.control.flow.await - - yield (parenthesized_expression); -// ^^^^^ keyword.control.flow.yield - - yield `template`; -// ^^^^^ keyword.control.flow.yield - - break; -// ^^^^^ keyword.control.flow.break - - break foo; -// ^^^^^ 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.flow.continue - - continue foo; -// ^^^^^^^^ 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 -} -// <- meta.block - -while // Incomplete statement - 42; -// ^^ constant.numeric - meta.while - -while(false){}/**/ -// ^ - meta.while - -with (undefined) { -// <- 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.conditional.case - // ^ - punctuation.separator.key-value - qux = 1; - break; - // ^ keyword.control.flow.break - case "baz": - // ^ keyword.control.conditional.case - // ^ - punctuation.separator.key-value string - qux = 2; - break; - // ^ keyword.control.flow.break - default: - // ^ meta.switch meta.block keyword.control.conditional.default - // ^ - punctuation.separator.key-value - qux = 3; - - case$ -// ^^^^^ - keyword - ; - - default$ -// ^^^^^^^^ - keyword - ; - - case 0: {} - case 1: -// ^^^^ keyword.control.conditional.case -} -// <- meta.block punctuation.section.block.end - -try { -// <- meta.try keyword.control.exception.try -// ^^ meta.try -// ^ meta.block - foobar = qux.bar(); -// ^^^^^^^^^^^^^^^^^^^ meta.try meta.block -} catch (e) { -// <- meta.block -//^^^^^^^^^^^^ meta.catch -//^^^^^ keyword.control.exception.catch -// ^ meta.group -// ^ meta.block - foobar = 0 -// ^^^^^^^^^^ meta.catch meta.block -} finally { -// <- meta.block -//^^^^^^^^^^ meta.finally -//^^^^^^^ keyword.control.exception.finally -// ^ meta.block - foobar += 1 -// ^^^^^^^^^^^ meta.finally meta.block -} -// <- meta.block - -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 +// <- keyword.declaration.class // ^^^^^^^ entity.name.class // ^^^^^^^ storage.modifier.extends // ^^^^^^^^^^ entity.other.inherited-class @@ -1211,17 +705,17 @@ class Foo extends getSomeClass() {} // ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class // ^^^^^^^ storage.modifier.extends // ^^^^^^^^ meta.class meta.class -// ^^^^^ storage.type.class +// ^^^^^ keyword.declaration.class // Better highlighting while typing. class class -// <- storage.type.class - entity.name.class +// <- keyword.declaration.class - entity.name.class class{}/**/ // ^ - meta.class - () => {} + () => {}; // ^^^^^^^^ meta.function - meta.function meta.function // ^^ meta.function.parameters // ^ punctuation.section.group.begin @@ -1231,25 +725,6 @@ class{}/**/ // ^ punctuation.section.block // ^ punctuation.section.block - @foo class Foo {} -// ^^^^ meta.annotation -// ^ punctuation.definition.annotation -// ^^^ variable.annotation -// ^^^^^ storage.type.class - - @foo.bar class Foo {} -// ^^^^^^^^ meta.annotation -// ^ punctuation.definition.annotation -// ^^^ variable.other.readwrite - variable.annotation -// ^^^ variable.annotation -// ^^^^^ storage.type.class - - @(whatever) class Foo {} -// ^^^^^^^^^^^ meta.annotation -// ^ punctuation.definition.annotation -// ^^^^^^^^^^ meta.group -// ^^^^^ storage.type.class - () => {}; // ^^^^^ meta.function // ^ punctuation.section.group.begin @@ -1470,7 +945,7 @@ var obj = new function() {}(); // ^^^^^^^^ keyword.declaration.function var obj2 = new class Foo{}(); -// ^^^^^ storage.type.class +// ^^^^^ keyword.declaration.class this.func() // <- variable.language.this @@ -1731,7 +1206,7 @@ new FooBar(function(){ { // <- meta.block punctuation.section.block.begin let foo = 1; -// ^^^ meta.block storage.type +// ^^^ meta.block keyword.declaration // ^^^ variable.other.readwrite } // <- meta.block punctuation.section.block.end @@ -1846,8 +1321,14 @@ return/* //^^^^^^ meta.block - meta.mapping const abc = new Set -if (true) {}; -// <- keyword.control.conditional + + const x = + const y = 1; // Better highlighting while typing. +// ^^^^^ keyword.declaration + + let x = + const y = 1; // Better highlighting while typing. +// ^^^^^ keyword.declaration var o = { a, @@ -2032,6 +1513,15 @@ debugger a ?? b; // ^^ keyword.operator.logical + a &&= b; +// ^^^ keyword.operator.assignment.augmented + + a ||= b; +// ^^^ keyword.operator.assignment.augmented + + a ??= b; +// ^^^ keyword.operator.assignment.augmented + a ?.5 : .7; // ^ keyword.operator.ternary // ^^ constant.numeric diff --git a/JavaScript/tests/syntax_test_js_bindings.js b/JavaScript/tests/syntax_test_js_bindings.js index 3d3d277602..f40b2676a7 100644 --- a/JavaScript/tests/syntax_test_js_bindings.js +++ b/JavaScript/tests/syntax_test_js_bindings.js @@ -57,7 +57,7 @@ const x; // ^ meta.binding.name variable.other.readwrite let -// <- storage.type +// <- keyword.declaration w // <- meta.binding.name variable.other.readwrite , @@ -82,7 +82,7 @@ let; const const x = 0; -// <- storage.type +// <- keyword.declaration // Function parameters diff --git a/JavaScript/tests/syntax_test_js_class.js b/JavaScript/tests/syntax_test_js_class.js new file mode 100644 index 0000000000..2d04d1ffff --- /dev/null +++ b/JavaScript/tests/syntax_test_js_class.js @@ -0,0 +1,320 @@ +// SYNTAX TEST "Packages/JavaScript/JavaScript.sublime-syntax" + +class MyClass extends TheirClass { +// <- keyword.declaration.class +// ^^^^^^^ entity.name.class +// ^^^^^^^ storage.modifier.extends +// ^^^^^^^^^^ entity.other.inherited-class +// ^ meta.block punctuation.section.block.begin + + x = 42; +// ^ variable.other.readwrite +// ^ keyword.operator.assignment +// ^^ constant.numeric + + 'y' = 42; +// ^^^ meta.string string.quoted.single +// ^ variable.other.readwrite +// ^ keyword.operator.assignment +// ^^ constant.numeric + + "z" = 42; +// ^^^ meta.string string.quoted.double +// ^ variable.other.readwrite +// ^ keyword.operator.assignment +// ^^ constant.numeric + + [w] = 42; +// ^ punctuation.section.brackets.begin +// ^ variable.other.readwrite +// ^ punctuation.section.brackets.end +// ^ keyword.operator.assignment +// ^^ constant.numeric + + #v = 42; +// ^ punctuation.definition.variable +// ^ variable.other.readwrite +// ^ keyword.operator.assignment +// ^^ constant.numeric + + f = a => b; +// ^ entity.name.function variable.other.readwrite +// ^^^^^^ meta.function +// ^ variable.parameter.function + + g = function() {}; +// ^ entity.name.function variable.other.readwrite +// ^^^^^^^^^^^^^ meta.function + + #h = function() {}; +// ^ punctuation.definition.variable +// ^ entity.name.function variable.other.readwrite +// ^^^^^^^^^^^^^ meta.function + + class = null; +// ^^^^^ variable.other.readwrite + + static x = 42; +// ^^^^^^ storage.modifier.js +// ^ variable.other.readwrite +// ^ keyword.operator.assignment +// ^^ constant.numeric + + static 'y' = 42; +// ^^^^^^ storage.modifier.js +// ^^^ meta.string string.quoted.single +// ^ variable.other.readwrite +// ^ keyword.operator.assignment +// ^^ constant.numeric + + static "z" = 42; +// ^^^^^^ storage.modifier.js +// ^^^ meta.string string.quoted.double +// ^ variable.other.readwrite +// ^ keyword.operator.assignment +// ^^ constant.numeric + + static [w] = 42; +// ^^^^^^ storage.modifier.js +// ^ punctuation.section.brackets.begin +// ^ variable.other.readwrite +// ^ punctuation.section.brackets.end +// ^ keyword.operator.assignment +// ^^ constant.numeric + + static #v = 42; +// ^ punctuation.definition.variable +// ^ variable.other.readwrite +// ^ keyword.operator.assignment +// ^^ constant.numeric + + static f = a => b; +// ^ entity.name.function variable.other.readwrite +// ^^^^^^ meta.function +// ^ variable.parameter.function + + static g = function() {}; +// ^ entity.name.function variable.other.readwrite +// ^^^^^^^^^^^^^ meta.function + + static = 42; +// ^^^^^^ variable.other.readwrite + + static() {} +// ^^^^^^^^^^^ meta.function +// ^^^^^^ entity.name.function + + foo // You thought I was a field... + () { return '...but was a method all along!'; } +// ^^ meta.class meta.block meta.function + + someMethod() { + return #e * 2; +// ^ punctuation.definition.variable +// ^ variable.other.readwrite +// ^ keyword.operator.arithmetic + + for (const param of this.#data.get('value')) {} +// ^ punctuation.definition.variable +// ^^^^ meta.property.object + } + + #privateMethod() {} +// ^^^^^^^^^^^^^^^^^^^ meta.function +// ^^^^^^^^^^^^^^ entity.name.function.js +// ^ punctuation.definition.js + + constructor(el) +// ^^^^^^^^^^^^^^^ meta.function + // ^ entity.name.function.constructor + { +// ^ meta.class meta.block meta.function meta.block punctuation.section.block + $.foo = ""; + super(el); + } +// ^ meta.class meta.block meta.function meta.block punctuation.section.block + + get foo() +// ^^^^^^^^^ meta.function + // <- storage.type.accessor + // ^ entity.name.function + { + return this._foo; + } + + get *foo() + + static foo(baz) { +// ^^^^^^ storage.modifier +// ^^^^^^^^^^ meta.function + // ^^^ entity.name.function + + } + + qux() +// ^^^^^ meta.function + { } +// ^ meta.class meta.block meta.block punctuation.section.block.begin + + get bar () { +// ^^^^^^^^^^^^ meta.function +// ^ meta.class meta.block meta.block punctuation.section.block.begin + // <- storage.type.accessor + // ^ entity.name.function + return false; + } + + baz() { return null } +// ^^^^^^^^^^^^^^^^^^^^^ meta.function + // <- entity.name.function + + get() { return "foobar"; } +// ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function +// ^^^ entity.name.function.js - storage.type.accessor + + set (value) { return value; } +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function +// ^^^^^ variable.parameter.function.js +// ^^^ entity.name.function.js - storage.type.accessor + + set abc(value1, value2) { return value1 + value2; } +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function +// ^^^ storage.type.accessor - entity.name.function.js +// ^^^ entity.name.function.js +// ^^^^^^ variable.parameter.function.js +// ^ punctuation.separator.parameter.function.js +// ^^^^^^ variable.parameter.function.js + + static$ +// ^^^^^^^ - storage + () {}; + + constructor$() {} +// ^^^^^^^^^^^^ entity.name.function - entity.name.function.constructor + + @foo bar() {} +// ^^^^ meta.annotation +// ^ punctuation.definition.annotation +// ^^^ variable.annotation +// ^^^ entity.name.function + + @foo.bar bar() {} +// ^^^^^^^^ meta.annotation +// ^ punctuation.definition.annotation +// ^^^ variable.other.readwrite - variable.annotation +// ^^^ variable.annotation +// ^^^ entity.name.function + + @(whatever) bar() {} +// ^^^^^^^^^^^ meta.annotation +// ^ punctuation.definition.annotation +// ^^^^^^^^^^ meta.group +// ^^^ entity.name.function + + ['foo']() {} +// ^^^^^^^^^^^^ meta.function + + static ['foo']() {} +// ^^^^^^^^^^^^ meta.function + + async foo() {} +// ^^^^^ keyword.declaration.async + + *foo() {} +// ^ keyword.generator.asterisk + + async *foo() {} +// ^^^^^ keyword.declaration.async +// ^ keyword.generator.asterisk + + static *foo() {} +// ^^^^^^ storage.modifier +// ^ keyword.generator.asterisk +// ^^^ entity.name.function + + static async foo() {} +// ^^^^^^ storage.modifier +// ^^^^^ keyword.declaration.async + + async() {} +// ^^^^^^^^^^ meta.function +// ^^^^^ entity.name.function +// ^^ meta.function.parameters +// ^ punctuation.section.group.begin +// ^ punctuation.section.group.end +// ^^ meta.block +// ^ punctuation.section.block.begin +// ^ punctuation.section.block.end + + static async() {} +// ^^^^^^ storage.modifier +// ^^^^^ entity.name.function +} +// <- meta.block punctuation.section.block.end + +class Foo extends React.Component { +// ^^^^^ - entity.other.inherited-class +// ^^^^^^^^^ entity.other.inherited-class + constructor() + {} + + [foo.bar](arg) { +// ^^^ variable.other +// ^^^ meta.property +// ^^^ variable.parameter + return this.a; + } +} + +class Foo extends (Foo).Bar {} +// ^^^ entity.other.inherited-class + +class Foo extends Bar +// ^^^ entity.other.inherited-class + .baz {} +// ^^^^^^^ meta.class +// ^ punctuation.accessor +// ^^^ entity.other.inherited-class + +class Foo extends +// ^^^^^^^ storage.modifier.extends +Bar {} + +class Foo extends getSomeClass() {} +// ^^^^^^^^^^^^ meta.function-call variable.function - entity.other.inherited-class + + (class extends Bar {}); +// ^^^^^^^ storage.modifier.extends - entity.name.class + + (class extends class {} {}); +// ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class +// ^^^^^^^ storage.modifier.extends +// ^^^^^^^^ meta.class meta.class +// ^^^^^ keyword.declaration.class + +// Better highlighting while typing. +class +class +// <- keyword.declaration.class - entity.name.class + +class{}/**/ +// ^ - meta.class + + @foo class Foo {} +// ^^^^ meta.annotation +// ^ punctuation.definition.annotation +// ^^^ variable.annotation +// ^^^^^ keyword.declaration.class + + @foo.bar class Foo {} +// ^^^^^^^^ meta.annotation +// ^ punctuation.definition.annotation +// ^^^ variable.other.readwrite - variable.annotation +// ^^^ variable.annotation +// ^^^^^ keyword.declaration.class + + @(whatever) class Foo {} +// ^^^^^^^^^^^ meta.annotation +// ^ punctuation.definition.annotation +// ^^^^^^^^^^ meta.group +// ^^^^^ keyword.declaration.class diff --git a/JavaScript/tests/syntax_test_js_control.js b/JavaScript/tests/syntax_test_js_control.js new file mode 100644 index 0000000000..fb216fe253 --- /dev/null +++ b/JavaScript/tests/syntax_test_js_control.js @@ -0,0 +1,365 @@ +// SYNTAX TEST "Packages/JavaScript/JavaScript.sublime-syntax" + + if ( true ) { } ; +// ^^^^^^^^^^^^^^^ meta.conditional +// ^^ keyword.control.conditional.if +// ^^^^^^^^ meta.group +// ^ punctuation.section.group.begin +// ^^^^ constant.language.boolean.true +// ^ punctuation.section.group.end +// ^^^ meta.block +// ^ punctuation.section.block.begin +// ^ punctuation.section.block.end +// ^ - meta.conditional +// ^ punctuation.terminator.statement.empty + + if ( true ) null ; +// ^^^^^^^^^^^^^^^^^^ meta.conditional +// ^^ keyword.control.conditional.if +// ^^^^^^^^ meta.group +// ^ punctuation.section.group.begin +// ^^^^ constant.language.boolean.true +// ^ punctuation.section.group.end +// ^^^^ constant.language.null +// ^ punctuation.terminator.statement - punctuation.terminator.statement.empty +// ^ - meta.conditional + + if (true) {}/**/ +// ^^^^ - meta.conditional + + if (true) ; +// ^^^^^^^^^^ meta.conditional +// ^ punctuation.terminator.statement.empty + + if (true) ; + else { } ; +// ^^^^^^^^ meta.conditional +// ^^^^ keyword.control.conditional.else +// ^^^ meta.block +// ^ punctuation.section.block.begin +// ^ punctuation.section.block.end +// ^ - meta.conditional +// ^ punctuation.terminator.statement.empty + + else if (true) { } ; +// ^^^^^^^^^^^^^^^^^^ meta.conditional +// ^^^^^^^ keyword.control.conditional.elseif +// ^^^^^^ meta.group +// ^ punctuation.section.group.begin +// ^^^^ constant.language.boolean.true +// ^ punctuation.section.group.end +// ^^^ meta.block +// ^ punctuation.section.block.begin +// ^ punctuation.section.block.end +// ^^^ - meta.conditional +// ^ punctuation.terminator.statement.empty + + do { } while ( true ) ; +// ^^^^^^^^^^^^^^^^^^^^^ meta.do-while +// ^^ keyword.control.loop.do-while +// ^^^ meta.block +// ^ punctuation.section.block.begin +// ^ punctuation.section.block.end +// ^^^^^ keyword.control.loop.while +// ^^^^^^^^ meta.group +// ^ punctuation.section.group.begin +// ^^^^ constant.language.boolean.true +// ^ punctuation.section.group.end +// ^ - meta.do-while +// ^ punctuation.terminator.statement.empty + + do 42 ; while ( true ) ; +// ^^^^^^^^^^^^^^^^^^^^^^ meta.do-while +// ^^ keyword.control.loop.do-while +// ^^ meta.number.integer.decimal constant.numeric.value +// ^ punctuation.terminator.statement +// ^^^^^ keyword.control.loop.while +// ^^^^^^^^ meta.group +// ^ punctuation.section.group.begin +// ^^^^ constant.language.boolean.true +// ^ punctuation.section.group.end +// ^ punctuation.terminator.statement.empty + + do {} while (false)/**/ +// ^ - meta.do-while + + for (var i = 0; i < 10; i++) { } ; +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.for +// ^^^ keyword.control.loop.for +// ^^^^^^^^^^^^^^^^^^^^^^^^ meta.group +// ^ punctuation.section.group +// ^^^ keyword.declaration +// ^ meta.binding.name variable.other.readwrite +// ^ keyword.operator.assignment +// ^ meta.number.integer.decimal constant.numeric.value +// ^ punctuation.separator.expression +// ^ variable.other.readwrite +// ^ keyword.operator.comparison +// ^^ meta.number.integer.decimal constant.numeric.value +// ^ punctuation.separator.expression +// ^ variable.other.readwrite +// ^^ keyword.operator.arithmetic +// ^ punctuation.section.group +// ^^^ meta.block +// ^ punctuation.section.block.begin +// ^ punctuation.section.block.end +// ^ - meta.for +// ^ punctuation.terminator.statement.empty + + for (;;) 42; +// ^^^^^^^^^ meta.for +// ^^^ keyword.control.loop.for +// ^^^^ meta.group +// ^ punctuation.section.group +// ^^ punctuation.separator.expression +// ^ punctuation.section.group +// ^^ meta.number.integer.decimal constant.numeric.value +// ^ punctuation.terminator.statement - punctuation.terminator.statement.empty +// ^ - meta.for + + for (; x in list;) {} +// ^^^^^^^^^^^^^^^^^^^^^ meta.for +// ^^^ keyword.control.loop.for +// ^^^^^^^^^^^^^^ meta.group +// ^ punctuation.separator.expression +// ^^ keyword.operator +// ^ punctuation.separator.expression + + for (a[x in list];;) {} +// ^^^^^^^^^^^^^^^^^^^^^^^ meta.for +// ^^^ keyword.control.loop.for +// ^^^^^^^^^^^^^^^^ meta.group +// ^^^^^^^^^^^ meta.brackets +// ^^ keyword.operator +// ^ punctuation.separator.expression +// ^ punctuation.separator.expression + + for (;function () {}/a/g;) {} +// ^ keyword.operator + + for (const x in list) {} +// ^^^^^^^^^^^^^^^^^^^^^^^^ meta.for +// ^^^ keyword.control.loop.for +// ^^^^^^^^^^^^^^^^^ meta.group +// ^^^^^ keyword.declaration +// ^^ keyword.operator.word + + for (const x of list) {} +// ^^^^^^^^^^^^^^^^^^^^^^^^ meta.for +// ^^^ keyword.control.loop.for +// ^^^^^^^^^^^^^^^^^ meta.group +// ^^^^^ keyword.declaration +// ^^ keyword.operator.word + + for (x in list) {} +// ^^^^^^^^^^^^^^^^^^ meta.for +// ^^^ keyword.control.loop.for +// ^^^^^^^^^^^ meta.group +// ^^ keyword.operator.word + + for (x of list) {} +// ^^^^^^^^^^^^^^^^^^ meta.for +// ^^^ keyword.control.loop.for +// ^^^^^^^^^^^ meta.group +// ^^ keyword.operator.word + + for await (const x of list) {} +// ^^^ keyword.control.loop.for +// ^^^^^ keyword.control.flow.await + +for + 42; +// ^^ constant.numeric - meta.for + +for(;;){}/**/ +// ^ - meta.for + +{}/**/ +//^ - meta.block + +while (true) +// ^^^^^^^^^ meta.while +// ^^^^ meta.group +{ +// <- meta.block + x = yield; +// ^^^^^ keyword.control.flow.yield + + x = yield * 42; +// ^^^^^ keyword.control.flow.yield +// ^ keyword.generator.asterisk + + x = yield + function f() {} + []; +// ^^ meta.sequence - meta.brackets + + + x = yield* + function f() {} + []; +// ^^ meta.brackets - meta.sequence + + y = await 42; +// ^^^^^ keyword.control.flow.await + + y = yield await 42; +// ^^^^^ keyword.control.flow.yield +// ^^^^^ keyword.control.flow.await + + yield (parenthesized_expression); +// ^^^^^ keyword.control.flow.yield + + yield `template`; +// ^^^^^ keyword.control.flow.yield + + break; +// ^^^^^ keyword.control.flow.break + + break foo; +// ^^^^^ 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.flow.continue + + continue foo; +// ^^^^^^^^ 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 +} +// <- meta.block + + while (true) 42 ; +// ^^^^^^^^^^^^^ meta.while +// ^^^^^ keyword.control.loop.while +// ^^^^^^ meta.group +// ^ punctuation.section.group.begin +// ^^^^ constant.language.boolean.true +// ^ punctuation.section.group.end +// ^^ meta.number.integer.decimal constant.numeric.value +// ^ punctuation.terminator.statement - punctuation.terminator.statement.empty + +while // Incomplete statement + 42; +// ^^ constant.numeric - meta.while + +while(false){}/**/ +// ^ - meta.while + +with (undefined) { +// <- 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.conditional.case + // ^ - punctuation.separator.key-value + qux = 1; + break; + // ^ keyword.control.flow.break + case "baz": + // ^ keyword.control.conditional.case + // ^ - punctuation.separator.key-value string + qux = 2; + break; + // ^ keyword.control.flow.break + default: + // ^ meta.switch meta.block keyword.control.conditional.default + // ^ - punctuation.separator.key-value + qux = 3; + + case$ +// ^^^^^ - keyword + ; + + default$ +// ^^^^^^^^ - keyword + ; + + case 0: {} + case 1: +// ^^^^ keyword.control.conditional.case +} +// <- meta.block punctuation.section.block.end + +try { +// <- meta.try keyword.control.exception.try +// ^^ meta.try +// ^ meta.block + foobar = qux.bar(); +// ^^^^^^^^^^^^^^^^^^^ meta.try meta.block +} catch (e) { +// <- meta.block +//^^^^^^^^^^^^ meta.catch +//^^^^^ keyword.control.exception.catch +// ^ meta.group +// ^ meta.block + foobar = 0 +// ^^^^^^^^^^ meta.catch meta.block +} finally { +// <- meta.block +//^^^^^^^^^^ meta.finally +//^^^^^^^ keyword.control.exception.finally +// ^ meta.block + foobar += 1 +// ^^^^^^^^^^^ meta.finally meta.block +} +// <- meta.block + +switch // Incomplete statement + 42; +// ^^ constant.numeric - meta.switch + +switch(x){}/**/ +// ^^ - meta.switch + +try{}/**/ +// ^ - meta.try +catch{}/**/ +// ^ - meta.catch +finally{}/**/ +// ^ - meta.finally diff --git a/JavaScript/tests/syntax_test_js_import_export.js b/JavaScript/tests/syntax_test_js_import_export.js new file mode 100644 index 0000000000..2b7686594c --- /dev/null +++ b/JavaScript/tests/syntax_test_js_import_export.js @@ -0,0 +1,231 @@ +// SYNTAX TEST "Packages/JavaScript/JavaScript.sublime-syntax" + +import TheirClass from "./mypath"; +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.import.js +// ^ keyword.control.import-export +// ^ keyword.control.import-export + +import {identifier, otherIdentifier} from "somewhere"; +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.import +// ^ keyword.control.import-export +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block +// ^ punctuation.section.block.begin +// ^ punctuation.section.block.end +// ^ meta.import meta.block variable.other.readwrite + +import thing, {identifier as otherIdentifier}, * as otherName from "otherplace"; +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.import +// ^ keyword.control.import-export +// ^ variable.other.readwrite +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block +// ^ variable.other.readwrite +// ^ keyword.control.import-export +// ^ variable.other.readwrite +// ^ constant.other.js +// ^ keyword.control.import-export + +import 'module'; +// ^^^^^^^^^^^^^ meta.import + +// Better highlighting while typing. +import +import; +// <- keyword.control.import-export + +import;/**/ +// ^ - meta.import + +export { name1, name2 as name3 }; +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.export +//^ keyword.control.import-export +// ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block +// ^ punctuation.separator.comma +// ^^ keyword.control.import-export + +export let name1, name2; +//^^^^^^^^^^^^^^^^^^^^^^ meta.export +//^ keyword.control.import-export +// ^^^ keyword.declaration +// ^ punctuation.separator.comma + +export var name3; +//^^^^^^^^^^^^^^^ meta.export +//^ keyword.control.import-export +// ^^^ keyword.declaration + +export const name1 = 5; +//^^^^^^^^^^^^^^^^^^^^^ meta.export +//^ keyword.control.import-export +// ^^^^^ keyword.declaration +// ^ keyword.operator.assignment + +export let foo = 123 // No semicolon +export function bar() {} +// <- keyword.control.import-export + +export function foo() {}; +//^^^^^^^^^^^^^^^^^^^^^^ meta.export +//^^^^ keyword.control.import-export +// ^^^^^^^^^^^^^^^^^ meta.function +// ^ punctuation.terminator.statement.empty + +export function* foo() {}; +//^^^^^^^^^^^^^^^^^^^^^^^ meta.export +//^^^^ keyword.control.import-export +// ^^^^^^^^^^^^^^^^^^ meta.function +// ^ punctuation.terminator.statement.empty + +export async function foo() {}; +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.export +//^^^^ keyword.control.import-export +// ^^^^^^^^^^^^^^^^^^^^^^^ meta.function +// ^ punctuation.terminator.statement.empty + +export class Foo {}; +//^^^^^^^^^^^^^^^^^ meta.export +//^^^^ keyword.control.import-export +// ^^^^^^^^^^^^ meta.class +// ^ punctuation.terminator.statement.empty + +export default expression; +//^^^^^^^^^^^^^^^^^^^^^^^^ meta.export +//^ keyword.control.import-export +// ^ keyword.control.import-export + +export default function (a) { }; +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.export +//^^^^ keyword.control.import-export +// ^^^^^^^ keyword.control.import-export +// ^^^^^^^^^^^^^^^^ meta.function +// ^ punctuation.terminator.statement.empty - meta.export + +export default function* (a) { }; +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.export +//^^^^ keyword.control.import-export +// ^^^^^^^ keyword.control.import-export +// ^^^^^^^^^^^^^^^^^ meta.function +// ^ punctuation.terminator.statement.empty - meta.export + +export default function name1(b) { } +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.export +//^ keyword.control.import-export +// ^ keyword.control.import-export +// ^^^^^^^^ keyword.declaration.function +// ^ entity.name.function + +export default class Foo {}; +//^^^^^^^^^^^^^^^^^ meta.export +//^^^^ keyword.control.import-export +// ^^^^^^^ keyword.control.import-export +// ^^^^^^^^^^^^ meta.class +// ^ punctuation.terminator.statement.empty + +export default +function (a) { }; +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.export +//^^^^ keyword.control.import-export +// ^^^^^^^ keyword.control.import-export +// ^^^^^^^^^^^^^^^^ meta.function + +export { name1 as default }; +//^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.export +//^ keyword.control.import-export +// ^^^^^^^^^^^^^^^^^^^^ meta.block +// ^ keyword.control.import-export +// ^ keyword.control.import-export + +export * from "./othermod"; +//^^^^^^^^^^^^^^^^^^^^^^^^^ meta.export +//^ keyword.control.import-export +// ^ constant.other +// ^ keyword.control.import-export + +export { name1, name2 } from "./othermod"; +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.export +//^ keyword.control.import-export +// ^^^^^^^^^^^^^^^^ meta.block +// ^ punctuation.section.block.begin +// ^ punctuation.section.block.end +// ^ keyword.control.import-export + +export { import1 as name1, import2 as name2, nameN } from "./othermod"; +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.export +//^ keyword.control.import-export +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block +// ^ keyword.control.import-export +// ^ keyword.control.import-export +// ^ keyword.control.import-export + +// Better highlighting while typing. +export +export; +// <- keyword.control.import-export + +export;/**/ +// ^ - meta.export + +import * as + alias from "module"; +// ^^^^^^^^^^^^^^^^^^^^^ meta.import.js + +import { member as + alias } from "module"; +// ^^^^^^^^^^^^^^^^^^^^^^^ meta.import.js + +import { * as + alias } from "module"; +// ^^^^^^^^^^^^^^^^^^^^^^^ meta.import.js + +export { member as + alias } from "module"; +// ^^^^^^^^^^^^^^^^^^^^^^^ meta.export.js + +export { member as + default } from "module"; +// ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.export.js + +let from; +// ^^^^ variable.other.readwrite.js + +import from from "./othermod"; +// ^^^^ variable.other.readwrite.js + +import { from } from "./othermod"; +// ^^^^ variable.other.readwrite.js + +export from from "./othermod"; +// ^^^^ variable.other.readwrite.js + +export { from } from "./othermod"; +// ^^^^ variable.other.readwrite.js + +export default$ +// ^^^^^^^^ - keyword +; + +let x = import.meta; +// ^^^^^^^^^^^ - meta.import +// ^^^^^^ keyword.import +// ^ punctuation.accessor +// ^^^^ variable.language.import + + import.meta; +// ^^^^^^^^^^^ - meta.import +// ^^^^^^ keyword.import +// ^ punctuation.accessor +// ^^^^ variable.language.import + + import +// ^^^^^^ - meta.import + .meta; +// ^^^^^ - meta.import +// ^ punctuation.accessor +// ^^^^ variable.language.import + + import('foo'); +// ^^^^^^ keyword.import +// ^^^^^^^ meta.group + + import +// ^^^^^^ - meta.import + ('foo'); +// ^^^^^^^ meta.group diff --git a/JavaScript/tests/syntax_test_js_support_dom.js b/JavaScript/tests/syntax_test_js_support_dom.js index 3fd4eb8273..2c170b11cb 100644 --- a/JavaScript/tests/syntax_test_js_support_dom.js +++ b/JavaScript/tests/syntax_test_js_support_dom.js @@ -11,4 +11,8 @@ clearTimeout; // ^^^^^^^^^^^^ support.function.dom setTimeout; +// ^^^^^^^^^^ support.function.dom + clearInterval; +// ^^^^^^^^^^^^ support.function.dom + setInterval; // ^^^^^^^^^^ support.function.dom diff --git a/JavaScript/tests/syntax_test_jsx.jsx b/JavaScript/tests/syntax_test_jsx.jsx index 01191ba6a7..c5a4e366d3 100644 --- a/JavaScript/tests/syntax_test_jsx.jsx +++ b/JavaScript/tests/syntax_test_jsx.jsx @@ -43,9 +43,9 @@ // ^^^^^^^^^^^ meta.jsx // ^^^^^ - meta.jsx -// ^ keyword.operator.relational +// ^ keyword.operator.comparison // ^^^ variable -// ^ keyword.operator.relational +// ^ keyword.operator.comparison 0; <>Hello!; @@ -61,9 +61,9 @@ // ^^^^^ - meta.jsx -// ^ keyword.operator.relational +// ^ keyword.operator.comparison // ^^^ variable -// ^ keyword.operator.relational +// ^ keyword.operator.comparison 0; ; @@ -71,7 +71,7 @@ \ No newline at end of file + + {/* foo */} +// ^^^^^^^^^^^ meta.jsx meta.interpolation comment.block - source.embedded +// ^ punctuation.definition.interpolation.begin +// ^^ punctuation.definition.comment.begin +// ^^ punctuation.definition.comment.end +// ^ punctuation.definition.interpolation.end + + {/* foo */ bar} +// ^^^^^^^^^^^^^^^ meta.jsx meta.interpolation +// ^^^^^^^^^^^^^ source.js.embedded +// ^ punctuation.definition.interpolation.begin - comment +// ^^ punctuation.definition.comment.begin +// ^^ punctuation.definition.comment.end +// ^^^^^ - comment +// ^^^ meta.jsx meta.interpolation variable.other.readwrite +// ^ punctuation.definition.interpolation.end + +; + + ; +// ^^^^^ entity.name.tag diff --git a/JavaScript/tests/syntax_test_tsx.tsx b/JavaScript/tests/syntax_test_tsx.tsx index 9c614f1823..521dbe85b9 100644 --- a/JavaScript/tests/syntax_test_tsx.tsx +++ b/JavaScript/tests/syntax_test_tsx.tsx @@ -22,7 +22,7 @@ let x : T.U; // ^^^^^^ meta.type // ^ support.class -// ^ punctuation.separator.accessor +// ^ punctuation.accessor // ^ support.class // ^^^ meta.generic // ^ support.class @@ -35,7 +35,7 @@ let strLength: number = (someValue).length; // ); var foo = 1 << 0; // ^^ keyword.operator.bitwise -if (a < b || c < d) {} -// ^ keyword.operator.logical +if (a < b || c <= d) {} +// ^ keyword.operator.comparison // ^^ keyword.operator.logical -// ^ keyword.operator.logical +// ^^ keyword.operator.comparison diff --git a/JavaScript/tests/syntax_test_typescript.ts b/JavaScript/tests/syntax_test_typescript.ts index 2cf32ee755..e84794c4a5 100644 --- a/JavaScript/tests/syntax_test_typescript.ts +++ b/JavaScript/tests/syntax_test_typescript.ts @@ -31,7 +31,7 @@ // ^^^^^^^^^^^^^^^^^^^^^^^ meta.export // ^^^^^^ keyword.control.import-export // ^^^^^^^^^^^^^^^^ meta.interface -// ^^^^^^^^^ storage.type +// ^^^^^^^^^ keyword.declaration // ^^^ entity.name.interface // ^^ meta.block @@ -39,7 +39,7 @@ // ^^^^^^^^^^^^^^^^^^^^^^^ meta.export // ^^^^^^ keyword.control.import-export // ^^^^^^^^^^^^^^^^ meta.namespace -// ^^^^^^^^^ storage.type +// ^^^^^^^^^ keyword.declaration // ^^^ entity.name.namespace // ^^ meta.block @@ -47,7 +47,7 @@ interface Foo { // ^^^^^^^^^^^^^^^^ meta.interface -// ^^^^^^^^^ storage.type +// ^^^^^^^^^ keyword.declaration // ^^^ entity.name.interface // ^ meta.block punctuation.section.block.begin foo: any; @@ -68,7 +68,7 @@ interface Foo < T > extends Bar < T > {} // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.interface -// ^^^^^^^^^ storage.type +// ^^^^^^^^^ keyword.declaration // ^^^ entity.name.interface // ^^^^^ meta.generic // ^ punctuation.definition.generic.begin @@ -81,6 +81,13 @@ // ^ support.class // ^ punctuation.definition.generic.end + interface Foo extends Bar, Baz {} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.interface +// ^^^^^^^ storage.modifier.extends +// ^^^ entity.other.inherited-class +// ^ punctuation.separator.comma +// ^^^ entity.other.inherited-class + enum Foo { // ^^^^^^^^^^^ meta.enum // ^^^^ storage.type @@ -103,7 +110,7 @@ // ^ meta.enum meta.block punctuation.section.block.end const enum Foo {} -// ^^^^^ storage.type +// ^^^^^ keyword.declaration // ^^^^^^^^^^^ meta.enum // ^^^^ storage.type // ^^^ entity.name.enum @@ -149,6 +156,12 @@ // ^^^ variable.other.readwrite // ^ storage.modifier.optional // ^ punctuation.separator.type +// ^^^ meta.type support.type.any + + foo!: any; +// ^^^ variable.other.readwrite +// ^ storage.modifier.definite +// ^ punctuation.separator.type // ^^^ meta.type support.type.any declare foo; @@ -173,11 +186,26 @@ readonly foo; // ^^^^^^^^ storage.modifier // ^^^ variable.other.readwrite + override foo() {} +// ^^^^^^^^ storage.modifier +// ^^^^^^^^ meta.function +// ^^^ entity.name.function + + readonly; +// ^^^^^^^^ variable.other.readwrite + + readonly() {} +// ^^^^^^^^^^ meta.function +// ^^^^^^^^ entity.name.function - private static foo; + private static readonly abstract declare override public; // ^^^^^^^ storage.modifier // ^^^^^^ storage.modifier -// ^^^ variable.other.readwrite +// ^^^^^^^^ storage.modifier +// ^^^^^^^^ storage.modifier +// ^^^^^^^ storage.modifier +// ^^^^^^^^ storage.modifier +// ^^^^^^ variable.other.readwrite foo(): any {} // ^^^^^^^^^^^^^ meta.function @@ -193,21 +221,70 @@ // ^ punctuation.separator.type // ^^^ meta.type support.type.any // ^^ meta.function meta.block + + @decorator() +// ^^^^^^^^^^^^^^^ meta.annotation +// ^ punctuation.definition.annotation +// ^^^^^^^^^ variable.annotation +// ^^^ meta.generic +// ^ punctuation.definition.generic.begin +// ^ support.class +// ^ punctuation.definition.generic.end +// ^^ meta.group +// ^ punctuation.section.group.begin +// ^ punctuation.section.group.end + + foo() {} +// ^^^^^^^^ meta.function +// ^^^ entity.name.function +// ^^ meta.function.parameters +// ^ punctuation.section.group.begin +// ^ punctuation.section.group.end +// ^^ meta.block +// ^ punctuation.section.block.begin +// ^ punctuation.section.block.end } abstract class Foo { // ^^^^^^^^ storage.modifier -// ^^^^^ meta.class storage.type.class +// ^^^^^ meta.class keyword.declaration.class abstract foo; // ^^^^^^^^ storage.modifier // ^^^ variable.other.readwrite + abstract foo(); +// ^^^^^^^^ storage.modifier +// ^^^ entity.name.function + + abstract *foo(); +// ^^^^^^^^ storage.modifier +// ^ keyword.generator.asterisk +// ^^^ entity.name.function + + abstract async foo(); +// ^^^^^^^^ storage.modifier +// ^^^^^ keyword.declaration.async +// ^^^ entity.name.function + + abstract async() {} +// ^^^^^^^^ storage.modifier +// ^^^^^ entity.name.function + + abstract get foo() {} +// ^^^^^^^^ storage.modifier +// ^^^ storage.type.accessor +// ^^^ entity.name.function + + abstract get() {} +// ^^^^^^^^ storage.modifier +// ^^^ entity.name.function + } class Foo < T > extends Bar implements Baz, Xyzzy { } // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class -// ^^^^^ storage.type.class +// ^^^^^ keyword.declaration.class // ^^^ entity.name.class // ^^^^^ meta.generic // ^ punctuation.definition.generic.begin @@ -237,7 +314,7 @@ namespace Foo { // ^^^^^^^^^^^^^^^^ meta.namespace -// ^^^^^^^^^ storage.type +// ^^^^^^^^^ keyword.declaration // ^^^ entity.name.namespace // ^ meta.block punctuation.section.block.begin } @@ -287,6 +364,14 @@ function f(readonly x) {} // ^^^^^^^^ storage.modifier // ^ meta.binding.name variable.parameter.function +function f(readonly ...x) {} +// ^^^^^^^^ storage.modifier +// ^^^keyword.operator.spread +// ^ meta.binding.name variable.parameter.function + +function f(readonly) {} +// ^^^^^^^^ meta.binding.name variable.parameter.function + function f(x?: any) {} // ^ storage.modifier.optional // ^ punctuation.separator.type @@ -380,7 +465,7 @@ function f(this : any) {} async (x): T => y; // ^^^^^^^^^^^^^^^^^ meta.function -// ^^^^^ storage.type +// ^^^^^ keyword.declaration.async // ^ meta.binding.name variable.parameter.function // ^ punctuation.separator.type // ^ meta.type support.class @@ -414,11 +499,6 @@ x as const; // ^ keyword.operator.type // ^ punctuation.terminator.statement -// This is a type assertion that is incompatible with JSX -let strLength: number = (someValue).length; // -// ^^^^^^^^ meta.assertion - meta.tag -// ^^^^^^^^^ comment - meta.tag - /* Types */ let x: any; @@ -543,8 +623,32 @@ let x: "a string"; let x: 'a string'; // ^ meta.type meta.string string.quoted.single +let x: `a string${any}`; +// ^^^^^^^^^^^^^^^^ meta.type meta.string +// ^^^^^^^^^ string.quoted.other +// ^ punctuation.definition.string.begin +// ^^^^^^ meta.interpolation - string +// ^^ punctuation.section.interpolation.begin +// ^^^ source.js.embedded support.type.any +// ^ punctuation.section.interpolation.end +// ^ string.quoted.other punctuation.definition.string.end + let x: 42; -// ^^ meta.number.integer.decimal.js constant.numeric.value.js +// ^^ meta.type meta.number.integer.decimal constant.numeric.value + +let x: -42; +// ^^^ meta.type +// ^ keyword.operator.arithmetic +// ^^ meta.number.integer.decimal constant.numeric.value + +let x: 1.5; +// ^^^ meta.type meta.number.float.decimal constant.numeric.value + +let x: 1e10; +// ^^^^ meta.type meta.number.float.decimal constant.numeric.value + +let x: 0xabc; +// ^^^^^ meta.type meta.number.integer.hexadecimal let x: typeof Foo; // ^^^^^^^^^^ meta.type @@ -558,7 +662,7 @@ let x: keyof Foo; let x: Foo.bar; // ^^^^^^^ meta.type // ^^^ support.class -// ^ punctuation.separator.accessor +// ^ punctuation.accessor // ^^^ support.class let x: { @@ -698,6 +802,17 @@ let x: { // ^ punctuation.section.brackets.end // ^ punctuation.separator + [ P in keyof T as U ] : any ; +// ^^^^^^^^^^^^^^^^^^^^^ meta.brackets +// ^ punctuation.section.brackets.begin +// ^ variable.other.readwrite +// ^^ keyword.operator.type +// ^^^^^ keyword.operator.type +// ^ meta.brackets support.class +// ^^ keyword.operator.type +// ^ meta.brackets support.class +// ^ punctuation.section.brackets.end + - readonly [ P in keyof T ] - ? : T [ P ] ; // ^ storage.modifier // ^^^^^^^^ storage.modifier @@ -725,7 +840,7 @@ let x: ( foo ? : any ) => bar; // ^^^^^^^^^^^^^^^^^^^^^^ meta.type // ^^^^^^^^^^^^^^^ meta.group // ^ punctuation.section.group.begin -// ^^^ variable.other.readwrite - support.class +// ^^^ variable.parameter - support.class // ^ storage.modifier.optional // ^ punctuation.separator.type // ^^^ support.type.any @@ -733,10 +848,33 @@ let x: ( foo ? : any ) => bar; // ^^ keyword.declaration.function // ^^^ support.class +let x: ( ... foo : any ) => any; +// ^^^^^^^^^^^^^^^^^^^^^^^^ meta.type +// ^^^^^^^^^^^^^^^^^ meta.group +// ^^^ keyword.operator.spread +// ^^^ variable.parameter +// ^ punctuation.separator.type +// ^^^ support.type.any + let x: () => T U // ^ variable.other.constant - meta.type +let x: new () => T; +// ^^^^^^^^^^^ meta.type +// ^^^ keyword.operator.new +// ^^ meta.group +// ^^ keyword.declaration.function +// ^ support.class + +let x: abstract new () => T; +// ^^^^^^^^^^^^^^^^^^^^ meta.type +// ^^^^^^^^ storage.modifier.abstract +// ^^^ keyword.operator.new +// ^^ meta.group +// ^^ keyword.declaration.function +// ^ support.class + let x: ( foo ); // ^^^^^^^ meta.type meta.group // ^ punctuation.section.group.begin @@ -771,7 +909,7 @@ let x: import ( "foo" ) . Bar ; // ^ punctuation.section.group.begin // ^^^^^ meta.string string.quoted.double // ^ punctuation.section.group.end -// ^ punctuation.separator.accessor +// ^ punctuation.accessor // ^^^ support.class foo < bar > (); @@ -784,7 +922,7 @@ let x: import ( "foo" ) . Bar ; foo < bar // ^^^ variable.other.readwrite -// ^ keyword.operator.logical +// ^ keyword.operator.comparison // ^^^ variable.other.readwrite ; @@ -805,7 +943,42 @@ var foo = 1 << 0 /x/g; // ^ keyword.operator.arithmetic // ^ variable.other.readwrite -if (a < b || c < d) {} -// ^ keyword.operator.logical +if (a < b || c <= d) {} +// ^ keyword.operator.comparison // ^^ keyword.operator.logical -// ^ keyword.operator.logical +// ^^ keyword.operator.comparison + +const f = (): any => {}; +// ^ meta.binding.name entity.name.function variable.other.readwrite +// ^^^^^^^^^^^^^^^^^^ - entity.name.function + + a != b; +// ^^ keyword.operator.comparison + +const x = { + readonly: true, +// ^^^^^^^^ meta.mapping.key + readonly readonly: true, +// ^^^^^^^^ storage.modifier +// ^^^^^^^^ meta.mapping.key + + readonly, +// ^^^^^^^^ variable.other.readwrite + + readonly get() {}, +// ^^^^^^^^ storage.modifier +// ^^^ entity.name.function + + readonly get foo() {}, +// ^^^^^^^^ storage.modifier +// ^^^ storage.type.accessor +// ^^^ entity.name.function + + readonly get: 42, +// ^^^^^^^^ storage.modifier +// ^^^ meta.mapping.key + + readonly get, +// ^^^^^^^^ storage.modifier +// ^^^ variable.other.readwrite +} diff --git a/JavaScript/tests/syntax_test_typescript_not_tsx.ts b/JavaScript/tests/syntax_test_typescript_not_tsx.ts new file mode 100644 index 0000000000..c90bfab443 --- /dev/null +++ b/JavaScript/tests/syntax_test_typescript_not_tsx.ts @@ -0,0 +1,27 @@ +// SYNTAX TEST "Packages/JavaScript/TypeScript.sublime-syntax" + + < T > foo; +// ^^^^^ meta.assertion +// ^ punctuation.definition.assertion.begin +// ^ support.class +// ^ punctuation.definition.assertion.end +// ^^^ variable.other.readwrite + + foo < T > bar; +// ^^^ variable.other.readwrite +// ^ keyword.operator.comparison +// ^ variable.other.constant +// ^ keyword.operator.comparison +// ^^^ variable.other.readwrite + + foo + < T > bar; +// ^ keyword.operator.comparison +// ^ variable.other.constant +// ^ keyword.operator.comparison +// ^^^ variable.other.readwrite + +// This is a type assertion that is incompatible with JSX +let strLength: number = (someValue).length; // +// ^^^^^^^^ meta.assertion - meta.tag +// ^^^^^^^^^ comment - meta.tag diff --git a/Lua/Lua.sublime-syntax b/Lua/Lua.sublime-syntax index 44a3f3ebda..314d2ce367 100644 --- a/Lua/Lua.sublime-syntax +++ b/Lua/Lua.sublime-syntax @@ -3,6 +3,11 @@ file_extensions: - lua scope: source.lua +version: 2 +first_line_match: |- + (?x: + ^\#! .* \blua\b # shebang + ) variables: reserved_word: |- (?x:(?: @@ -45,15 +50,16 @@ variables: contexts: main: - - include: statements + - match: '' + push: [statements, shebang] else-pop: - match: (?=\S) - pop: true + pop: 1 immediately-pop: - match: '' - pop: true + pop: 1 prototype: - match: --\[(=*)\[ @@ -63,25 +69,39 @@ contexts: - meta_scope: comment.block.lua - match: \]\1\] scope: punctuation.definition.comment.end.lua - pop: true + pop: 1 - match: -- scope: punctuation.definition.comment.lua push: - meta_include_prototype: false - meta_scope: comment.line.lua - match: \n - pop: true + pop: 1 end: - match: end{{identifier_break}} scope: keyword.control.end.lua - pop: true + pop: 1 block-contents: - meta_scope: meta.block.lua - include: end - include: statements + shebang: + - match: ^\#! + scope: punctuation.definition.comment.lua + set: shebang-body + - match: ^|(?=\S) + pop: 1 + + shebang-body: + - meta_scope: comment.line.shebang.lua + - match: \blua\b + scope: constant.language.shebang.lua + - match: \n + pop: 1 + statements: - match: ; scope: punctuation.terminator.statement.lua @@ -120,7 +140,7 @@ contexts: - meta_scope: meta.group.lua - match: \) scope: punctuation.section.group.end.lua - pop: true + pop: 1 - match: ',' scope: punctuation.separator.comma.lua - include: reserved-word-pop @@ -144,22 +164,22 @@ contexts: function-name-begin: - match: '{{identifier}}(?=\s*[.:])' scope: variable.other.lua - pop: true + pop: 1 - match: '{{identifier}}' scope: entity.name.function.lua - pop: true + pop: 1 - include: else-pop function-name-property: - match: '{{identifier}}(?=\s*[.:])' scope: meta.property.lua - pop: true + pop: 1 - match: '{{metamethod}}' scope: meta.property.lua entity.name.function.lua support.function.metamethod.lua - pop: true + pop: 1 - match: '{{identifier}}' scope: meta.property.lua entity.name.function.lua - pop: true + pop: 1 - include: else-pop control-statements: @@ -190,7 +210,7 @@ contexts: set: expression - - meta_scope: meta.block.lua - match: (?=until{{identifier_break}}) - pop: true + pop: 1 - include: statements - match: for{{identifier_break}} @@ -220,7 +240,7 @@ contexts: set: - match: '::' scope: punctuation.definition.label.end.lua - pop: true + pop: 1 - include: else-pop - include: else-pop @@ -229,7 +249,7 @@ contexts: push: - match: '{{identifier}}' scope: variable.label.lua - pop: true + pop: 1 - include: else-pop if-then: @@ -265,7 +285,10 @@ contexts: expression-end: - match: (?=;) - pop: true + pop: 1 + + - match: (?=::) + pop: 1 - match: (?={{function_args_begin}}) push: @@ -285,11 +308,16 @@ contexts: - match: ',' scope: punctuation.separator.comma.lua push: expression-begin + - match: (?=<(?![<=])) + branch_point: left-angle + branch: + - left-angle-is-variable-modifier + - left-angle-is-less-than - include: expression-end expression-begin: - match: (?=;) - pop: true + pop: 1 - include: prefix-operator - include: builtin @@ -303,6 +331,26 @@ contexts: - include: else-pop + left-angle-is-less-than: + - match: '<' + scope: keyword.operator.comparison.lua + pop: 1 + + left-angle-is-variable-modifier: + - match: '<' + scope: punctuation.definition.modifier.begin.lua + set: variable-modifier-body + + variable-modifier-body: + - meta_scope: meta.modifier.lua + - match: '>' + scope: punctuation.definition.modifier.end.lua + pop: 1 + - match: (?:const|close){{identifier_break}} + scope: storage.modifier.lua + - match: (?=\S) + fail: left-angle + infix-operator: - match: (?:[=<>~]=) scope: keyword.operator.comparison.lua @@ -337,7 +385,7 @@ contexts: - meta_scope: meta.brackets.lua - match: \] scope: punctuation.section.brackets.end.lua - pop: true + pop: 1 - include: reserved-word-expression-pop - match: (?=\S) push: expression @@ -345,19 +393,19 @@ contexts: property: - match: '{{metamethod}}{{function_assignment_ahead}}' scope: meta.property.lua entity.name.function.lua support.function.metamethod.lua - pop: true + pop: 1 - match: '{{identifier}}{{function_assignment_ahead}}' scope: meta.property.lua entity.name.function.lua - pop: true + pop: 1 - match: '{{identifier}}{{function_call_ahead}}' scope: meta.property.lua meta.function-call.lua variable.function.lua - pop: true + pop: 1 - match: '{{metaproperty}}' scope: meta.property.lua support.other.metaproperty.lua - pop: true + pop: 1 - match: '{{identifier}}' scope: meta.property.lua - pop: true + pop: 1 - include: reserved-word-pop - include: else-pop @@ -375,7 +423,7 @@ contexts: - meta_scope: meta.group.lua - match: \) scope: punctuation.section.group.end.lua - pop: true + pop: 1 - include: reserved-word-expression-pop - match: (?=\S) push: expression-list @@ -393,35 +441,32 @@ contexts: reserved-word-pop: - match: '{{reserved_word}}' scope: invalid.unexpected-keyword.lua - pop: true + pop: 1 reserved-word-expression-pop: - match: '{{reserved_word_statement}}' scope: invalid.unexpected-keyword.lua - pop: true + pop: 1 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: (?:true|false){{identifier_break}} + scope: constant.language.boolean.lua + pop: 1 - match: nil{{identifier_break}} scope: constant.language.null.lua - pop: true + pop: 1 - match: \.\.\. scope: constant.language.lua - pop: true + pop: 1 - match: self{{identifier_break}} scope: variable.language.this.lua - pop: true + pop: 1 support: - match: |- (?x:_G|_VERSION){{identifier_break}} scope: support.constant.builtin.lua - pop: true + pop: 1 - match: |- (?x: @@ -431,22 +476,22 @@ contexts: |require|getfenv|module|setfenv|unpack ){{function_call_ahead}} scope: meta.function-call.lua support.function.builtin.lua - pop: true + pop: 1 - include: builtin-modules variable: - match: '{{identifier}}{{function_assignment_ahead}}' scope: entity.name.function.lua - pop: true + pop: 1 - match: '{{identifier}}{{function_call_ahead}}' scope: meta.function-call.lua variable.function.lua - pop: true + pop: 1 - match: '{{identifier}}' scope: variable.other.lua - pop: true + pop: 1 number: - match: (0[Xx])(\h*(?:(\.)\h*{{hex_exponent}}?|{{hex_exponent}})) @@ -455,55 +500,68 @@ contexts: 1: constant.numeric.base.lua 2: constant.numeric.value.lua 3: punctuation.separator.decimal.lua - pop: true + pop: 1 - match: (0[Xx])(\h+) scope: meta.number.integer.hexadecimal.lua captures: 1: constant.numeric.base.lua 2: constant.numeric.value.lua - pop: true + pop: 1 - match: \d+(?:(\.)\d*{{dec_exponent}}?|{{dec_exponent}})|(\.)\d+{{dec_exponent}}? scope: meta.number.float.decimal.lua constant.numeric.value.lua captures: 1: punctuation.separator.decimal.lua 2: punctuation.separator.decimal.lua - pop: true + pop: 1 - match: \d+ scope: meta.number.integer.decimal.lua constant.numeric.value.lua - pop: true + pop: 1 string: + - include: single-quoted-string + - include: double-quoted-string + - include: multiline-string + + single-quoted-string: - match: \' scope: punctuation.definition.string.begin.lua - set: - - meta_include_prototype: false - - meta_scope: string.quoted.single.lua - - include: string-content - - match: \' - scope: punctuation.definition.string.end.lua - pop: true + set: single-quoted-string-body + + single-quoted-string-body: + - meta_include_prototype: false + - meta_scope: meta.string.lua string.quoted.single.lua + - include: string-content + - match: \' + scope: punctuation.definition.string.end.lua + pop: 1 + double-quoted-string: - match: \" scope: punctuation.definition.string.begin.lua - set: - - meta_include_prototype: false - - meta_scope: string.quoted.double.lua - - include: string-content - - match: \" - scope: punctuation.definition.string.end.lua - pop: true + set: double-quoted-string-body + double-quoted-string-body: + - meta_include_prototype: false + - meta_scope: meta.string.lua string.quoted.double.lua + - include: string-content + - match: \" + scope: punctuation.definition.string.end.lua + pop: 1 + + multiline-string: - match: \[(=*)\[ scope: punctuation.definition.string.begin.lua - set: - - meta_scope: string.quoted.multiline.lua - - meta_include_prototype: false - - match: \]\1\] - scope: punctuation.definition.string.end.lua - pop: true + set: multiline-string-body + + multiline-string-body: + - meta_scope: meta.string.lua string.quoted.multiline.lua + - meta_include_prototype: false + - match: \]\1\] + scope: punctuation.definition.string.end.lua + pop: 1 string-content: - match: \\[abfnrtv\\'"\[\]\n] @@ -525,7 +583,7 @@ contexts: - match: \n scope: invalid.illegal.unclosed-string.lua - pop: true + pop: 1 - match: \\. scope: invalid.illegal.invalid-escape.lua @@ -536,7 +594,7 @@ contexts: - meta_scope: meta.group.lua - match: \) scope: punctuation.section.group.end.lua - pop: true + pop: 1 - include: reserved-word-expression-pop - match: (?=\S) push: expression @@ -548,7 +606,7 @@ contexts: - meta_scope: meta.mapping.lua - match: \} scope: punctuation.section.block.end.lua - pop: true + pop: 1 - match: '[,;]' scope: punctuation.separator.field.lua @@ -560,7 +618,7 @@ contexts: - meta_scope: meta.mapping.key.lua meta.brackets.lua - match: \] scope: punctuation.section.brackets.end.lua - pop: true + pop: 1 - match: (?=\S) push: expression @@ -572,16 +630,16 @@ contexts: scope: entity.name.function.lua captures: 1: support.function.metamethod.lua - pop: true + pop: 1 - match: '{{metamethod}}' scope: entity.name.function.lua support.function.metamethod.lua - pop: true + pop: 1 - match: '{{metaproperty}}' scope: string.unquoted.key.lua support.other.metaproperty.lua - pop: true + pop: 1 - match: '{{identifier}}' scope: string.unquoted.key.lua - pop: true + pop: 1 - match: =(?!=) scope: meta.mapping.lua punctuation.separator.key-value.lua @@ -615,10 +673,10 @@ contexts: set: - match: |- (?x: - create|isyieldable|resume|running|status|wrap|yield + create|isyieldable|resume|running|status|wrap|yield|close ){{identifier_break}} scope: meta.property.lua support.function.builtin.lua - pop: true + pop: 1 - include: property - include: else-pop @@ -633,13 +691,13 @@ contexts: config|cpath|loaded|path|preload|searchers|loaders ){{identifier_break}} scope: meta.property.lua support.constant.builtin.lua - pop: true + pop: 1 - match: |- (?x: loadlib|searchpath|seeall ){{identifier_break}} scope: meta.property.lua support.function.builtin.lua - pop: true + pop: 1 - include: property - include: else-pop @@ -655,7 +713,7 @@ contexts: |packsize|rep|reverse|sub|unpack|upper ){{identifier_break}} scope: meta.property.lua support.function.builtin.lua - pop: true + pop: 1 - include: property - include: else-pop @@ -670,13 +728,13 @@ contexts: charpattern ){{identifier_break}} scope: meta.property.lua support.constant.builtin.lua - pop: true + pop: 1 - match: |- (?x: char|codes|codepoint|len|offset ){{identifier_break}} scope: meta.property.lua support.function.builtin.lua - pop: true + pop: 1 - include: property - include: else-pop @@ -691,7 +749,7 @@ contexts: concat|insert|move|pack|remove|sort|unpack|maxn ){{identifier_break}} scope: meta.property.lua support.function.builtin.lua - pop: true + pop: 1 - include: property - include: else-pop @@ -706,7 +764,7 @@ contexts: huge|maxinteger|mininteger|pi ){{identifier_break}} scope: meta.property.lua support.constant.builtin.lua - pop: true + pop: 1 - match: |- (?x: abs|acos|asin|atan|ceil|cos|deg|exp|floor|fmod|log|max|min @@ -714,7 +772,7 @@ contexts: |atan2|cosh|frexp|ldexp|log10|pow|sinh|tanh ){{identifier_break}} scope: meta.property.lua support.function.builtin.lua - pop: true + pop: 1 - include: property - include: else-pop @@ -729,13 +787,13 @@ contexts: stderr|stdin|stdout ){{identifier_break}} scope: meta.property.lua support.constant.builtin.lua - pop: true + pop: 1 - match: |- (?x: close|flush|input|lines|open|output|popen|read|tmpfile|type|write ){{identifier_break}} scope: meta.property.lua support.function.builtin.lua - pop: true + pop: 1 - include: property - include: else-pop @@ -751,7 +809,7 @@ contexts: |setlocale|time|tmpname ){{identifier_break}} scope: meta.property.lua support.function.builtin.lua - pop: true + pop: 1 - include: property - include: else-pop @@ -769,7 +827,7 @@ contexts: |getfenv|setfenv ){{identifier_break}} scope: meta.property.lua support.function.builtin.lua - pop: true + pop: 1 - include: property - include: else-pop @@ -785,6 +843,6 @@ contexts: |replace|rrotate|rshift ){{identifier_break}} scope: meta.property.lua support.function.builtin.lua - pop: true + pop: 1 - include: property - include: else-pop diff --git a/Lua/Snippets/for-i-v-in-ipairs().sublime-snippet b/Lua/Snippets/for-i-v-in-ipairs().sublime-snippet index fb008a3374..66d0df57f4 100644 --- a/Lua/Snippets/for-i-v-in-ipairs().sublime-snippet +++ b/Lua/Snippets/for-i-v-in-ipairs().sublime-snippet @@ -3,6 +3,6 @@ ${0:print(i,v)} end]]> fori - source.lua + source.lua - comment - string for i,v in ipairs() diff --git a/Lua/Snippets/for-i=1-10.sublime-snippet b/Lua/Snippets/for-i=1-10.sublime-snippet index 1ae02edd5c..69c718b292 100644 --- a/Lua/Snippets/for-i=1-10.sublime-snippet +++ b/Lua/Snippets/for-i=1-10.sublime-snippet @@ -3,6 +3,6 @@ ${0:print(i)} end]]> for - source.lua + source.lua - comment - string for i=1,10 diff --git a/Lua/Snippets/for-k-v-in-pairs().sublime-snippet b/Lua/Snippets/for-k-v-in-pairs().sublime-snippet index b6b2d99077..5aac0c220b 100644 --- a/Lua/Snippets/for-k-v-in-pairs().sublime-snippet +++ b/Lua/Snippets/for-k-v-in-pairs().sublime-snippet @@ -3,6 +3,6 @@ ${0:print(k,v)} end]]> forp - source.lua + source.lua - comment - string for k,v in pairs() diff --git a/Lua/Snippets/function-(fun).sublime-snippet b/Lua/Snippets/function-(fun).sublime-snippet index 7a9b33cb47..62bc0bf2d5 100644 --- a/Lua/Snippets/function-(fun).sublime-snippet +++ b/Lua/Snippets/function-(fun).sublime-snippet @@ -3,6 +3,6 @@ ${0:-- body} end]]> fun - source.lua + source.lua - comment - string function diff --git a/Lua/Snippets/function-(function).sublime-snippet b/Lua/Snippets/function-(function).sublime-snippet index 987fead8f6..72439acd4b 100644 --- a/Lua/Snippets/function-(function).sublime-snippet +++ b/Lua/Snippets/function-(function).sublime-snippet @@ -3,6 +3,6 @@ ${0:-- body} end]]> function - source.lua + source.lua - comment - string function diff --git a/Lua/Snippets/local-x-=-1.sublime-snippet b/Lua/Snippets/local-x-=-1.sublime-snippet index a255e60f6d..b240974f73 100644 --- a/Lua/Snippets/local-x-=-1.sublime-snippet +++ b/Lua/Snippets/local-x-=-1.sublime-snippet @@ -1,6 +1,6 @@ local - source.lua + source.lua - comment - string local x = 1 diff --git a/Lua/Snippets/table.concat.sublime-snippet b/Lua/Snippets/table.concat.sublime-snippet index 0763b2f334..2b3a3c88b2 100644 --- a/Lua/Snippets/table.concat.sublime-snippet +++ b/Lua/Snippets/table.concat.sublime-snippet @@ -1,6 +1,6 @@ table.concat - source.lua + source.lua - comment - string table.concat diff --git a/Lua/Snippets/table.sort.sublime-snippet b/Lua/Snippets/table.sort.sublime-snippet index 8b27003f18..fb194469e1 100644 --- a/Lua/Snippets/table.sort.sublime-snippet +++ b/Lua/Snippets/table.sort.sublime-snippet @@ -1,6 +1,6 @@ table.sort - source.lua + source.lua - comment - string table.sort diff --git a/Lua/tests/syntax_test_lua.lua b/Lua/tests/syntax_test_lua.lua index c394087f4b..f5eb1ae27d 100644 --- a/Lua/tests/syntax_test_lua.lua +++ b/Lua/tests/syntax_test_lua.lua @@ -49,10 +49,10 @@ --CONSTANTS true; --- ^^^^ constant.language.boolean.true +-- ^^^^ constant.language.boolean.lua false; --- ^^^^^ constant.language.boolean.true +-- ^^^^^ constant.language.boolean.lua nil; -- ^^^ constant.language.null @@ -131,34 +131,34 @@ -- ^ punctuation.separator.decimal 'foo'; --- ^^^^^ string.quoted.single +-- ^^^^^ meta.string string.quoted.single -- ^ punctuation.definition.string.begin -- ^ punctuation.definition.string.end --STRINGS 'foo'; --- ^^^^^ string.quoted.single +-- ^^^^^ meta.string string.quoted.single -- ^ punctuation.definition.string.begin -- ^ punctuation.definition.string.end '-- [['; --- ^^^^^^^ string.quoted.single - comment +-- ^^^^^^^ meta.string string.quoted.single - comment "foo"; --- ^^^^^ string.quoted.double +-- ^^^^^ meta.string string.quoted.double -- ^ punctuation.definition.string.begin -- ^ punctuation.definition.string.end "-- [["; --- ^^^^^^^ string.quoted.double - comment +-- ^^^^^^^ meta.string string.quoted.double - comment '\a\b\f\n\r\t\v\\\'\"\[\]'; --- ^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.single +-- ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string string.quoted.single -- ^^^^^^^^^^^^^^^^^^^^^^^^ constant.character.escape '\x1ff'; --- ^^^^ constant.character.escape.hexadecimal +-- ^^^^ meta.string constant.character.escape.hexadecimal -- ^ - constant '\0 \123 \1234'; @@ -196,39 +196,39 @@ -- ^ invalid.illegal.unclosed-string "foo\"\'"; --- ^^^^^^^^^ string.quoted.double +-- ^^^^^^^^^ meta.string string.quoted.double -- ^ punctuation.definition.string.begin -- ^^^^ constant.character.escape -- ^ punctuation.definition.string.end [[ Foo! ]]; --- ^^^^^^^^^^ string.quoted.multiline +-- ^^^^^^^^^^ meta.string string.quoted.multiline -- ^^ punctuation.definition.string.begin -- ^^ punctuation.definition.string.end [[ -- [[ ]]; --- ^^^^^^^^^^^ string.quoted.multiline - comment +-- ^^^^^^^^^^^ meta.string string.quoted.multiline - comment [[ Foo! \a \]]; --- ^^^^^^^^^^^^^^ string.quoted.multiline +-- ^^^^^^^^^^^^^^ meta.string string.quoted.multiline -- ^^ punctuation.definition.string.begin -- ^^^^ - constant -- ^^ punctuation.definition.string.end [=[ Foo! ]] ]=]; --- ^^^^^^^^^^^^^^^ string.quoted.multiline +-- ^^^^^^^^^^^^^^^ meta.string string.quoted.multiline -- ^^^ punctuation.definition.string.begin -- ^^ - punctuation -- ^^^ punctuation.definition.string.end [=[ --- ^^^ string.quoted.multiline punctuation.definition.string.begin +-- ^^^ meta.string string.quoted.multiline punctuation.definition.string.begin ]] --- ^^^ string.quoted.multiline - punctuation +-- ^^^ meta.string string.quoted.multiline - punctuation ]==] --- ^^^^ string.quoted.multiline - punctuation +-- ^^^^ meta.string string.quoted.multiline - punctuation ]=]; --- ^^^ string.quoted.multiline punctuation.definition.string.end +-- ^^^ meta.string string.quoted.multiline punctuation.definition.string.end --OPERATORS @@ -245,7 +245,7 @@ not true; -- ^^^ keyword.operator.logical --- ^^^^ constant.language.boolean.true +-- ^^^^ constant.language.boolean.lua 2 + 2 - 2 * 2 / 2 // 2 % 2 ^ 2; -- ^ keyword.operator.arithmetic @@ -313,7 +313,7 @@ -- ^ meta.mapping variable.other {[[actually a string]], [=[this too]=]} --- ^^ meta.mapping.lua string.quoted.multiline.lua punctuation.definition.string.begin.lua +-- ^^ meta.mapping.lua meta.string 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} @@ -393,7 +393,7 @@ foo[return] foo[false] -- ^^^^^^ invalid.unexpected-keyword.lua -- ^ - meta.brackets --- ^^^^^ constant.language.boolean.true.lua +-- ^^^^^ constant.language.boolean.lua some.return -- ^^^^^^ invalid.unexpected-keyword.lua @@ -408,15 +408,15 @@ f "argument"; -- ^ meta.function-call variable.function --- ^^^^^^^^^^ meta.function-call.arguments string.quoted.double +-- ^^^^^^^^^^ meta.function-call.arguments meta.string string.quoted.double f 'argument'; --- ^^^^^^^^^^ meta.function-call.arguments string.quoted.single +-- ^^^^^^^^^^ meta.function-call.arguments meta.string string.quoted.single f [[ foo ]]; -- ^ meta.function-call variable.function --- ^^^^^^^^^ meta.function-call.arguments string.quoted.multiline +-- ^^^^^^^^^ meta.function-call.arguments meta.string string.quoted.multiline f {}; -- ^ meta.function-call variable.function @@ -551,7 +551,7 @@ -- ^^^ invalid.illegal.unexpected-end until true; -- ^^^^^ keyword.control.loop --- ^^^^ constant.language.boolean.true +-- ^^^^ constant.language.boolean.lua for x = 1, y, z do end -- ^^^ keyword.control.loop @@ -588,6 +588,10 @@ -- ^^^ entity.name.label -- ^^ punctuation.definition.label.end + local x = 1 + ::foo:: +-- ^^ punctuation.definition.label.begin + goto foo; -- ^^^^ keyword.control.goto -- ^^^ variable.label @@ -598,9 +602,16 @@ return; -- ^^^^^^ keyword.control.return - return foo; + return foo or a < b and a <= b; -- ^^^^^^ keyword.control.return -- ^^^ variable.other +-- ^^ keyword.operator.logical.lua +-- ^ keyword.operator.comparison.lua +-- ^^^ keyword.operator.logical.lua +-- ^^ keyword.operator.comparison.lua + + return a << b; +-- ^^ keyword.operator.bitwise.lua local x = 1, y = 2; -- ^^^^^ storage.modifier @@ -612,3 +623,55 @@ -- ^ keyword.operator.assignment -- ^ meta.number.integer.decimal constant.numeric.value -- ^ punctuation.terminator.statement + + local x , y < const > = 1, 2; +-- ^^^^^ storage.modifier.lua +-- ^ variable.other.lua +-- ^^^^^^^ meta.modifier.lua +-- ^ punctuation.definition.modifier.begin.lua +-- ^ punctuation.definition.modifier.end.lua +-- ^^^^^ storage.modifier.lua +-- ^ keyword.operator.assignment.lua +-- ^ meta.number.integer.decimal.lua constant.numeric.value.lua +-- ^ punctuation.separator.comma.lua +-- ^ variable.other.lua +-- ^^^^^^^^^^^ meta.modifier.lua +-- ^ punctuation.definition.modifier.begin.lua +-- ^^^^^ storage.modifier.lua +-- ^ punctuation.definition.modifier.end.lua +-- ^ keyword.operator.assignment.lua +-- ^ meta.number.integer.decimal.lua constant.numeric.value.lua + + local t = a >= b and b <= a +-- ^^^^^ storage.modifier.lua +-- ^ keyword.operator.assignment.lua +-- ^^ keyword.operator.comparison.lua +-- ^^^ keyword.operator.logical.lua +-- ^^ keyword.operator.comparison.lua + + local text = io.open("/etc/fstab", "r") +-- ^^^^^ storage.modifier.lua +-- ^ variable.other.lua +-- ^^^^^^^ meta.modifier.lua +-- ^ punctuation.definition.modifier.begin.lua +-- ^^^^^ storage.modifier.lua +-- ^ punctuation.definition.modifier.end.lua +-- ^ keyword.operator.assignment.lua +-- ^^ support.constant.builtin.lua +-- ^ punctuation.accessor.lua +-- ^^^^ meta.property.lua support.function.builtin.lua +-- ^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.lua meta.group.lua +-- ^ punctuation.section.group.begin.lua +-- ^^^^^^^^^^^^ meta.string string.quoted.double.lua +-- ^ punctuation.separator.comma.lua +-- ^ punctuation.section.group.end.lua diff --git a/Lua/tests/syntax_test_lua_support.lua b/Lua/tests/syntax_test_lua_support.lua index 62296c5867..0d5d01758f 100644 --- a/Lua/tests/syntax_test_lua_support.lua +++ b/Lua/tests/syntax_test_lua_support.lua @@ -123,6 +123,11 @@ coroutine.yield(); -- ^^^^^^^^^ support.constant.builtin -- ^ punctuation.accessor +-- ^^^^^ meta.property support.function.builtin + + coroutine.close(); +-- ^^^^^^^^^ support.constant.builtin +-- ^ punctuation.accessor -- ^^^^^ meta.property support.function.builtin package; diff --git a/Markdown/Code Block Syntaxes.sublime-completions b/Markdown/Code Block Syntaxes.sublime-completions new file mode 100644 index 0000000000..493e3d95ae --- /dev/null +++ b/Markdown/Code Block Syntaxes.sublime-completions @@ -0,0 +1,317 @@ +{ + "scope": "text.html.markdown meta.code-fence.definition.begin", + "completions": [ + { + "trigger": "bash", + "annotation": "Bourne Against Shell", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies ShellScript code highlighting" + }, + { + "trigger": "c", + "annotation": "C", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies C code highlighting" + }, + { + "trigger": "c#", + "annotation": "C#", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies C# code highlighting" + }, + { + "trigger": "c++", + "annotation": "C++", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies C++ code highlighting" + }, + { + "trigger": "clj", + "annotation": "Clojure", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies Clojure code highlighting" + }, + { + "trigger": "clojure", + "annotation": "Clojure", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies Clojure code highlighting" + }, + { + "trigger": "cpp", + "annotation": "C++", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies C++ code highlighting" + }, + { + "trigger": "cs", + "annotation": "C#", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies C# code highlighting" + }, + { + "trigger": "csharp", + "annotation": "C#", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies C# code highlighting" + }, + { + "trigger": "erlang", + "annotation": "Erlang", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies Erlang code highlighting" + }, + { + "trigger": "escript", + "annotation": "Erlang Script", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies Erlang code highlighting" + }, + { + "trigger": "golang", + "annotation": "Go", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies Go code highlighting" + }, + { + "trigger": "graphviz", + "annotation": "GraphViz", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies GraphViz code highlighting" + }, + { + "trigger": "html+php", + "annotation": "PHP", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies PHP code highlighting" + }, + { + "trigger": "inc", + "annotation": "PHP", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies PHP code highlighting" + }, + { + "trigger": "java", + "annotation": "Java", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies Java code highlighting" + }, + { + "trigger": "javascript", + "annotation": "JavaScript", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies JavaScript code highlighting" + }, + { + "trigger": "js", + "annotation": "JavaScript", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies JavaScript code highlighting" + }, + { + "trigger": "json", + "annotation": "JSON", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies JSON code highlighting" + }, + { + "trigger": "jsonc", + "annotation": "JSON with Comments", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies JSON with Comments code highlighting" + }, + { + "trigger": "jsp", + "annotation": "Java Server Pages", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies Java Server Pages code highlighting" + }, + { + "trigger": "jspx", + "annotation": "Java Server Pages", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies Java Server Pages code highlighting" + }, + { + "trigger": "obj-c", + "annotation": "Objective-C", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies Objective-C code highlighting" + }, + { + "trigger": "obj-c++", + "annotation": "Objective-C++", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies Objective-C++ code highlighting" + }, + { + "trigger": "objc", + "annotation": "Objective-C", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies Objective-C code highlighting" + }, + { + "trigger": "objc++", + "annotation": "Objective-C++", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies Objective-C++ code highlighting" + }, + { + "trigger": "objective-c", + "annotation": "Objective-C", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies code highlighting" + }, + { + "trigger": "objective-c++", + "annotation": "Objective-C++", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies Objective-C++ code highlighting" + }, + { + "trigger": "objectivec", + "annotation": "Objective-C", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies Objective-C++ code highlighting" + }, + { + "trigger": "objectivec++", + "annotation": "Objective-C++", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies Objective-C++ code highlighting" + }, + { + "trigger": "perl", + "annotation": "Perl 5", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies Perl 5 code highlighting" + }, + { + "trigger": "php", + "annotation": "PHP", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies PHP code highlighting" + }, + { + "trigger": "py", + "annotation": "Python", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies Python code highlighting" + }, + { + "trigger": "python", + "annotation": "Python", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies Python code highlighting" + }, + { + "trigger": "r", + "annotation": "R", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies R code highlighting" + }, + { + "trigger": "rb", + "annotation": "Ruby", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies Ruby code highlighting" + }, + { + "trigger": "rbx", + "annotation": "Ruby on Rails", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies Ruby on Rails code highlighting" + }, + { + "trigger": "regex", + "annotation": "Regular Expressions", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies Regular Expressions code highlighting" + }, + { + "trigger": "regexp", + "annotation": "Regular Expressions", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies Regular Expressions code highlighting" + }, + { + "trigger": "rs", + "annotation": "Rust", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies Rust code highlighting" + }, + { + "trigger": "rscript", + "annotation": "R Script", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies R Script code highlighting" + }, + { + "trigger": "ruby", + "annotation": "Ruby", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies Ruby code highlighting" + }, + { + "trigger": "rust", + "annotation": "Rust", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies Rust code highlighting" + }, + { + "trigger": "sh", + "annotation": "ShellScript", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies ShellScript code highlighting" + }, + { + "trigger": "shell-script", + "annotation": "ShellScript", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies ShellScript code highlighting" + }, + { + "trigger": "splus", + "annotation": "R", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies R code highlighting" + }, + { + "trigger": "sql", + "annotation": "SQL", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies SQL code highlighting" + }, + { + "trigger": "ts", + "annotation": "TypeScript", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies TypeScript code highlighting" + }, + { + "trigger": "typescript", + "annotation": "TypeScript", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies TypeScript code highlighting" + }, + { + "trigger": "xml", + "annotation": "XML", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies XML code highlighting" + }, + { + "trigger": "yaml", + "annotation": "YAML", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies YAML code highlighting" + }, + { + "trigger": "zsh", + "annotation": "ShellScript", + "kind": ["markup", "s", "Syntax"], + "details": "Specifies ShellScript code highlighting" + }, + ], +} \ No newline at end of file diff --git a/Markdown/Default.sublime-keymap b/Markdown/Default.sublime-keymap new file mode 100644 index 0000000000..1e107990a3 --- /dev/null +++ b/Markdown/Default.sublime-keymap @@ -0,0 +1,95 @@ +[ + // Auto-pair asterisks + { + "keys": ["*"], + "command": "insert_snippet", + "args": {"contents": "*${0:$SELECTION}*"}, + "context": [ + { "key": "setting.auto_match_enabled"}, + { "key": "selection_empty", "operand": false, "match_all": true }, + { "key": "selector", "operand": "text.html.markdown - markup.raw" } + ] + }, + { + "keys": ["backspace"], + "command": "run_macro_file", + "args": {"file": "res://Packages/Default/Delete Left Right.sublime-macro"}, + "context": [ + { "key": "setting.auto_match_enabled" }, + { "key": "selection_empty", "match_all": true }, + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - markup.raw" }, + { "key": "preceding_text", "operator": "regex_contains", "operand": "\\*$", "match_all": true }, + { "key": "following_text", "operator": "regex_contains", "operand": "^\\*", "match_all": true } + ] + }, + + // Auto-pair underscore + { + "keys": ["_"], + "command": "insert_snippet", + "args": {"contents": "_${0:$SELECTION}_"}, + "context": [ + { "key": "setting.auto_match_enabled"}, + { "key": "selection_empty", "operand": false, "match_all": true }, + { "key": "selector", "operand": "text.html.markdown - markup.raw" } + ] + }, + { + "keys": ["backspace"], + "command": "run_macro_file", + "args": {"file": "res://Packages/Default/Delete Left Right.sublime-macro"}, + "context": [ + { "key": "setting.auto_match_enabled" }, + { "key": "selection_empty", "match_all": true }, + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - markup.raw" }, + { "key": "preceding_text", "operator": "regex_contains", "operand": "_$", "match_all": true }, + { "key": "following_text", "operator": "regex_contains", "operand": "^_", "match_all": true } + ] + }, + + // Auto-pair backticks + { + "keys": ["`"], + "command": "insert_snippet", + "args": {"contents": "`$0`"}, + "context": [ + { "key": "setting.auto_match_enabled"}, + { "key": "selection_empty", "match_all": true }, + { "key": "selector", "operand": "text.html.markdown - markup.raw - meta.code-fence" }, + { "key": "preceding_text", "operator": "regex_contains", "operand": "(?(?:.|$)) # 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 + 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: (?:[ ]{,3}[#]{1,6}(?:[ \t]|$)) # between 0 and 3 spaces, followed 1 to 6 hashes, followed by at least one space or tab or by end of the line + atx_heading_space: (?:(?=[ \t]+#+[ \t]*$)|[ \t]+|$) # consume spaces only if heading is not empty to ensure `atx_heading_end` can fully match closing hashes + atx_heading_end: (?:[ \t]+(#+))?[ \t]*($\n?) # \n is optional so ## is matched as end punctuation in new document (at eof) indented_code_block: (?:[ ]{4}|\t) # 4 spaces or a tab list_item: (?:[ ]{,3}(?=\d+\.|[*+-])\d*([*+.-])\s) # between 0 and 3 spaces, followed by either: at least one integer and a full stop, or (a star, plus or dash), followed by whitespace escape: '\\[-`*_#+.!(){}\[\]\\>|~<]' @@ -91,8 +93,12 @@ variables: ) table_first_row: |- (?x: - (?:{{balanced_table_cell}}?\|){2} # at least 2 non-escaped pipe chars on the line - | (?!\s+\|){{balanced_table_cell}}\|(?!\s+$) # something other than whitespace followed by a pipe char, followed by something other than whitespace and the end of the line + # at least 2 non-escaped pipe chars on the line + (?:{{balanced_table_cell}}?\|){2} + + # something other than whitespace followed by a pipe char or hyphon, + # followed by something other than whitespace and the end of the line + | (?! \s*\-\s+ | \s+\|){{balanced_table_cell}}\|(?!\s+$) ) fenced_code_block_start: |- (?x: @@ -115,9 +121,9 @@ variables: ) $\n? # ... until EOL ) - code_fence_escape: |- + code_fence_escape: ^{{code_fence_end}} + code_fence_end: |- (?x: - ^ # the beginning of the line [ \t]* ( \2 # the backtick/tilde combination that opened the code fence @@ -172,13 +178,7 @@ variables: 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 - # [ ]{0,3} # up to 3 spaces - # (\1) # the backtick/tilde combination that opened the code fence - # \s*$ # any amount of whitespace until EOL - # ) + contexts: file-start: - match: (---)\s* @@ -187,7 +187,7 @@ contexts: 1: punctuation.section.block.begin.frontmatter.yaml.markdown embed: scope:source.yaml embed_scope: meta.frontmatter.markdown source.yaml.embedded - escape: ^(---)\s*$ # pandoc requires the remainder of the line to be blank + escape: ^(---|\.{3})\s*$ # pandoc requires the remainder of the line to be blank escape_captures: 1: meta.frontmatter.markdown punctuation.section.block.end.frontmatter.yaml.markdown @@ -274,26 +274,7 @@ contexts: - match: ^(?![ ]{4}|$) pop: true - include: inline-bold-italic - - match: |- - (?x: - \s* # Leading whitespace - (\[)([^]]*)(\])(:) # Reference name - [ \t]* # Optional whitespace - (?: - (<)([^>]+)(>) # The url - | (\S+) # The url - ) - ) - captures: - 1: punctuation.definition.constant.begin.markdown - 2: entity.name.reference.link.markdown - 3: punctuation.definition.constant.end.markdown - 4: punctuation.separator.key-value.markdown - 5: punctuation.definition.link.begin.markdown - 6: markup.underline.link.markdown - 7: punctuation.definition.link.end.markdown - 8: markup.underline.link.markdown - push: [link-ref-def-expect-end, link-title] + - include: reference-link-definition - match: '^(?=\S)(?![=-]{3,}\s*$)' branch_point: heading2-branch branch: @@ -436,11 +417,40 @@ contexts: - match: ^ pop: true - include: list-paragraph + - include: block-quote-code-blocks - match: '' push: - - match: $|^ + - match: ^ pop: true - include: inline-bold-italic-linebreak + + block-quote-code-blocks: + - match: |- + (?x) + {{fenced_code_block_start}} + ([\w-]*) # any number of word characters or dashes + .*$\n? # all characters until EOL + captures: + 0: meta.code-fence.definition.begin.text.markdown-gfm + 2: punctuation.definition.raw.code-fence.begin.markdown + 5: constant.other.language-name.markdown + push: block-quote-code-block-content + + block-quote-code-block-content: + - match: '{{code_fence_end}}' + captures: + 0: meta.code-fence.definition.end.text.markdown-gfm + 1: punctuation.definition.raw.code-fence.end.markdown + pop: true + - match: '[ ]{,3}(>)[ ]?' + captures: + 1: punctuation.definition.blockquote.markdown + - match: '' + push: + - meta_content_scope: markup.raw.code-fence.markdown-gfm + - match: ^ + pop: true + indented-code-block: - match: '{{indented_code_block}}.*$\n?' scope: markup.raw.block.markdown @@ -595,61 +605,77 @@ contexts: escape: - match: '{{escape}}' scope: constant.character.escape.markdown - atx-heading-terminator: - - match: '[ ]*(#*)[ ]*($\n?)' # \n is optional so ## is matched as end punctuation in new document (at eof) - captures: - 1: punctuation.definition.heading.end.markdown - 2: meta.whitespace.newline.markdown - pop: true + atx-heading: - - match: '(#)(?!#)\s*(?=\S)' + # https://spec.commonmark.org/0.30/#atx-headings + # Note: + # Consume spaces and tabs after opening hashes so entity.name + # starts with first non-whitespace character, + # but don't do so if directly followed by closing hashes + # as terminator pattern requires them to match then. + - match: '[ ]{,3}(#{1}){{atx_heading_space}}' captures: 1: punctuation.definition.heading.begin.markdown - push: - - meta_scope: markup.heading.1.markdown - - meta_content_scope: entity.name.section.markdown - - include: atx-heading-terminator - - include: inline-bold-italic - - match: '(#{2})(?!#)\s*(?=\S)' + push: atx-heading1-content + - match: '[ ]{,3}(#{2}){{atx_heading_space}}' captures: 1: punctuation.definition.heading.begin.markdown - push: - - meta_scope: markup.heading.2.markdown - - meta_content_scope: entity.name.section.markdown - - include: atx-heading-terminator - - include: inline-bold-italic - - match: '(#{3})(?!#)\s*(?=\S)' + push: atx-heading2-content + - match: '[ ]{,3}(#{3}){{atx_heading_space}}' captures: 1: punctuation.definition.heading.begin.markdown - push: - - meta_scope: markup.heading.3.markdown - - meta_content_scope: entity.name.section.markdown - - include: atx-heading-terminator - - include: inline-bold-italic - - match: '(#{4})(?!#)\s*(?=\S)' + push: atx-heading3-content + - match: '[ ]{,3}(#{4}){{atx_heading_space}}' captures: 1: punctuation.definition.heading.begin.markdown - push: - - meta_scope: markup.heading.4.markdown - - meta_content_scope: entity.name.section.markdown - - include: atx-heading-terminator - - include: inline-bold-italic - - match: '(#{5})(?!#)\s*(?=\S)' + push: atx-heading4-content + - match: '[ ]{,3}(#{5}){{atx_heading_space}}' captures: 1: punctuation.definition.heading.begin.markdown - push: - - meta_scope: markup.heading.5.markdown - - meta_content_scope: entity.name.section.markdown - - include: atx-heading-terminator - - include: inline-bold-italic - - match: '(#{6})(?!#)\s*(?=\S)' + push: atx-heading5-content + - match: '[ ]{,3}(#{6}){{atx_heading_space}}' captures: 1: punctuation.definition.heading.begin.markdown - push: - - meta_scope: markup.heading.6.markdown - - meta_content_scope: entity.name.section.markdown - - include: atx-heading-terminator - - include: inline-bold-italic + push: atx-heading6-content + + atx-heading1-content: + - meta_scope: markup.heading.1.markdown + - meta_content_scope: entity.name.section.markdown + - include: atx-heading-content + + atx-heading2-content: + - meta_scope: markup.heading.2.markdown + - meta_content_scope: entity.name.section.markdown + - include: atx-heading-content + + atx-heading3-content: + - meta_scope: markup.heading.3.markdown + - meta_content_scope: entity.name.section.markdown + - include: atx-heading-content + + atx-heading4-content: + - meta_scope: markup.heading.4.markdown + - meta_content_scope: entity.name.section.markdown + - include: atx-heading-content + + atx-heading5-content: + - meta_scope: markup.heading.5.markdown + - meta_content_scope: entity.name.section.markdown + - include: atx-heading-content + + atx-heading6-content: + - meta_scope: markup.heading.6.markdown + - meta_content_scope: entity.name.section.markdown + - include: atx-heading-content + + atx-heading-content: + - match: '{{atx_heading_end}}' + captures: + 1: punctuation.definition.heading.end.markdown + 2: meta.whitespace.newline.markdown + pop: true + - include: inline-bold-italic + image-inline: - match: |- (?x: @@ -854,7 +880,7 @@ contexts: - match: (((https|http|ftp)://)|www\.)[\w-]+(\.[\w-]+)+ scope: markup.underline.link.markdown-gfm push: # After a valid domain, zero or more non-space non-< characters may follow - - match: (?=[?!.,:*_~]*[\s<]) # Trailing punctuation (specifically, ?, !, ., ,, :, *, _, and ~) will not be considered part of the autolink, though they may be included in the interior of the link + - match: (?=[?!.,:*_~]*(?:[\s<]|$)) # Trailing punctuation (specifically, ?, !, ., ,, :, *, _, and ~) will not be considered part of the autolink, though they may be included in the interior of the link pop: true - match: (?={{html_entity}}[?!.,:*_~]*[\s<]) # If an autolink ends in a semicolon (;), we check to see if it appears to resemble an entity reference; if the preceding text is & followed by one or more alphanumeric characters. If so, it is excluded from the autolink pop: true @@ -942,6 +968,16 @@ contexts: captures: 1: meta.link.reference.markdown punctuation.definition.link.begin.markdown push: [link-ref-attr, link-ref-after-text, link-ref-link-text] + - match: |- + (?x: + (\[)(?!\^) + (?= {{balance_square_brackets}}? # balanced square brackets, backticks, taking into account escapes etc. + \] + ) + ) + captures: + 1: meta.link.reference.markdown punctuation.definition.link.begin.markdown + push: link-ref-link-text link-ref-link-text: - meta_content_scope: meta.link.reference.description.markdown - include: link-text-allow-image @@ -1014,6 +1050,27 @@ contexts: 1: punctuation.definition.link.begin.markdown 2: meta.link.reference.literal.footnote-id.markdown 3: punctuation.definition.link.end.markdown + reference-link-definition: + - match: |- + (?x: + [ ]{0,3} # Leading whitespace + (\[)(|(?:\\\]|[^]])+)(\])(:) # Reference name + [ \t]* # Optional whitespace + (?: + (<)([^>]*)(>) # The url + | (\S+) # The url + ) + ) + captures: + 1: punctuation.definition.constant.begin.markdown + 2: entity.name.reference.link.markdown + 3: punctuation.definition.constant.end.markdown + 4: punctuation.separator.key-value.markdown + 5: punctuation.definition.link.begin.markdown + 6: markup.underline.link.markdown + 7: punctuation.definition.link.end.markdown + 8: markup.underline.link.markdown + push: [link-ref-def-expect-end, link-title] list-paragraph: - match: '^(?=(?:[ ]{4}|\t){2,}(?![>+*\s-]))(?={{indented_code_block}})' push: @@ -1030,6 +1087,7 @@ contexts: - include: fenced-code-block - match: '' pop: true + - include: reference-link-definition - match: \s+(?=\S) push: - match: ^\s*$ @@ -1215,6 +1273,21 @@ contexts: escape_captures: 0: meta.code-fence.definition.end.java.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown + - match: |- + (?x) + {{fenced_code_block_start}} + ((?i:jspx?)) + {{fenced_code_block_trailing_infostring_characters}} + captures: + 0: meta.code-fence.definition.begin.jsp.markdown-gfm + 2: punctuation.definition.raw.code-fence.begin.markdown + 5: constant.other.language-name.markdown + embed: scope:text.html.jsp + embed_scope: markup.raw.code-fence.jsp.markdown-gfm + escape: '{{code_fence_escape}}' + escape_captures: + 0: meta.code-fence.definition.end.jsp.markdown-gfm + 1: punctuation.definition.raw.code-fence.end.markdown - match: |- (?x) {{fenced_code_block_start}} @@ -1248,7 +1321,7 @@ contexts: - match: |- (?x) {{fenced_code_block_start}} - ((?i:rust)) + ((?i:rust|rs)) {{fenced_code_block_trailing_infostring_characters}} captures: 0: meta.code-fence.definition.begin.rust.markdown-gfm diff --git a/Markdown/syntax_test_markdown.md b/Markdown/syntax_test_markdown.md index a5b66a8d9e..f16473e068 100644 --- a/Markdown/syntax_test_markdown.md +++ b/Markdown/syntax_test_markdown.md @@ -2,23 +2,107 @@ # Heading | <- markup.heading.1 punctuation.definition.heading -|^^^^^^^^ markup.heading -| ^ meta.whitespace.newline.markdown +|^^^^^^^^^ markup.heading.1.markdown +|^ - entity.name.section +| ^^^^^^ entity.name.section +| ^ meta.whitespace.newline.markdown - entity.name.section ## Second Heading # | <- markup.heading.2 punctuation.definition.heading -|^^^^^^^^^^^^^^^^ markup.heading +|^^^^^^^^^^^^^^^^^^^ markup.heading.2.markdown +|^^ - entity.name.section | ^^^^^^^^^^^^^^ entity.name.section -| ^ - entity.name.section +| ^^ - entity.name.section | ^ punctuation.definition.heading.end.markdown -http://spec.commonmark.org/0.28/#example-43 -## Example 43 (trailing spaces!) ##### + +https://spec.commonmark.org/0.30/#example-71 + + ## Heading ## +|^^^^^^^^^^^^^^^ meta.block-level.markdown markup.heading.2.markdown +|^ - punctuation +| ^^ punctuation.definition.heading.begin.markdown +| ^^^^^^^^^ - punctuation +| ^^ punctuation.definition.heading.end.markdown +| ^ - punctuation +|^^^^ - entity.name.section +| ^^^^^^^ entity.name.section.markdown +| ^^^^ - entity.name.section + +https://spec.commonmark.org/0.30/#example-73 +## Example 73 (trailing spaces!) ##### | ^ punctuation.definition.heading.end.markdown | ^ meta.whitespace.newline.markdown -http://spec.commonmark.org/0.28/#example-44 -## Example 44 #### > -|^^^^^^^^^^^^^^^^^^^^^^ markup.heading -| ^ - punctuation.definition.heading.end.markdown + +https://spec.commonmark.org/0.30/#example-74 +## Example 74 #### > +|^^^^^^^^^^^^^^^^^^^^^^^ markup.heading.2.markdown +|^^ - entity.name.section +| ^^^^^^^^^^^^^^^^^^^^ entity.name.section.markdown +| ^ - entity.name.section + +https://spec.commonmark.org/0.30/#example-75 +# #heading# # +| <- markup.heading.1.markdown punctuation.definition.heading.begin.markdown +|^^^^^^^^^^^^^ meta.block-level.markdown markup.heading.1.markdown +|^ - entity.name.section +| ^^^^^^^^^ entity.name.section.markdown +| ^^ - entity.name.section +| ^ punctuation.definition.heading.end.markdown + +https://spec.commonmark.org/0.30/#example-76 +## heading \## +| <- markup.heading.2.markdown punctuation.definition.heading.begin.markdown +|^^^^^^^^^^^^^^ meta.block-level.markdown markup.heading.2.markdown +|^^ - entity +| ^^^^^^^^^^^ entity.name.section.markdown +| ^^ constant.character.escape.markdown +| ^^^ - punctuation +| ^ - entity.name.section + +https://spec.commonmark.org/0.30/#example-79 +# +| <- markup.heading.1.markdown punctuation.definition.heading.begin.markdown + +# # +| <- markup.heading.1.markdown punctuation.definition.heading.begin.markdown +|^^^ meta.block-level.markdown markup.heading.1.markdown - entity.name.section +| ^ punctuation.definition.heading.end.markdown + +## +| <- markup.heading.2.markdown punctuation.definition.heading.begin.markdown - entity.name.section +|^ markup.heading.2.markdown punctuation.definition.heading.begin.markdown - entity.name.section + +## ## +| <- markup.heading.2.markdown punctuation.definition.heading.begin.markdown - entity.name.section +|^^^^^ meta.block-level.markdown markup.heading.2.markdown - entity.name.section +|^ punctuation.definition.heading.begin.markdown +| ^^ punctuation.definition.heading.end.markdown + +### ### +| <- meta.block-level.markdown markup.heading.3.markdown - entity.name.sectionpunctuation.definition.heading.begin.markdown +|^^^^^^^ meta.block-level.markdown markup.heading.3.markdown - entity.name.section +|^^ punctuation.definition.heading.begin.markdown +| ^^^ punctuation.definition.heading.end.markdown + +# #### # +| <- markup.heading.1.markdown punctuation.definition.heading.begin.markdown +|^^^^^^^^ meta.block-level.markdown markup.heading.1.markdown +|^ - entity.name.section +| ^^^^ entity.name.section.markdown +| ^^ - entity.name.section +| ^ punctuation.definition.heading.end.markdown + +## #### ## +| <- markup.heading.2.markdown punctuation.definition.heading.begin.markdown +|^^^^^^^^^^ meta.block-level.markdown markup.heading.2.markdown +|^ - entity.name.section +| ^^^^ entity.name.section.markdown +| ^^^ - entity.name.section +| ^^ punctuation.definition.heading.end.markdown + +#NotAHeading +| <- - markup.heading +|^^^^^^^^^^^^ - markup.heading Alternate Heading | <- markup.heading.1 @@ -251,6 +335,13 @@ Paragraph break. | ^^^^^^^^^^^^^^^^^^^^^^^ markup.list.unnumbered - markup.list.unnumbered markup.list.unnumbered | ^ markup.list.unnumbered.bullet punctuation.definition.list_item +Paragraph break. + +- `` | `` (components/Logo.vue) +- `` | `` | (components/my-component.vue) +| <- markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.list.unnumbered.markdown meta.paragraph.list.markdown + Paragraph break. * Unordered list item @@ -399,6 +490,31 @@ paragraph | <- punctuation.definition.blockquote | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.raw.block - markup.quote markup.quote +> Here are fenced code blocks +> ``` +| <- meta.block-level.markdown markup.quote.markdown punctuation.definition.blockquote.markdown +|^ meta.block-level.markdown markup.quote.markdown - meta.code-fence +| ^^^^ meta.block-level.markdown markup.quote.markdown meta.code-fence.definition.begin.text.markdown-gfm +| ^^^ punctuation.definition.raw.code-fence.begin.markdown +> code block +| <- meta.block-level.markdown markup.quote.markdown punctuation.definition.blockquote.markdown +|^ meta.block-level.markdown markup.quote.markdown - meta.code-fence +| ^^^^^^^^^^^ meta.block-level.markdown markup.quote.markdown markup.raw.code-fence.markdown-gfm +> ``` +| <- meta.block-level.markdown markup.quote.markdown punctuation.definition.blockquote.markdown +|^ meta.block-level.markdown markup.quote.markdown - meta.code-fence +| ^^^^ meta.block-level.markdown markup.quote.markdown meta.code-fence.definition.end.text.markdown-gfm +| ^^^ punctuation.definition.raw.code-fence.end.markdown +> > 2nd level +> > +> > ``` +> > code block ``` +| ^^^ - punctuation +> > ``` +| <- meta.block-level.markdown markup.quote.markdown markup.quote.markdown punctuation.definition.blockquote.markdown +|^^^ meta.block-level.markdown markup.quote.markdown markup.quote.markdown - meta.code-fence +| ^^^^ meta.block-level.markdown markup.quote.markdown markup.quote.markdown meta.code-fence.definition.end.text.markdown-gfm + >= | <- punctuation.definition.blockquote.markdown >= @@ -1731,6 +1847,25 @@ not a table | --- | --- | ^^^^ meta.block-level meta.table - meta.table.header + a | b + - | - +|^^^^^^ meta.block-level.markdown meta.table.header-separator.markdown-gfm +|^ punctuation.section.table-header.markdown +| ^ punctuation.separator.table-cell.markdown +| ^ punctuation.section.table-header.markdown + - | - +|^^^^^^ meta.block-level.markdown meta.table.markdown-gfm + + a | b + -:| - +|^^^^^^ meta.block-level.markdown meta.table.header-separator.markdown-gfm +|^ punctuation.section.table-header.markdown +| ^ punctuation.definition.table-cell-alignment.markdown +| ^ punctuation.separator.table-cell.markdown +| ^ punctuation.section.table-header.markdown + - | - +|^^^^^^ meta.block-level.markdown meta.table.markdown-gfm + | test | me | |------|----| |^^^^^^ punctuation.section.table-header @@ -2160,3 +2295,38 @@ link with a single underscore inside the text : [@_test](http://example.com) ### h3 |^^ punctuation.definition.heading.begin +1. list [001]blah +| ^^^^^ meta.link.reference +| ^ punctuation.definition.link.begin +| ^ punctuation.definition.link.end +| ^^^^^ - meta.link + + [001]: https://en.wikipedia.org/wiki/Root-mean-square_deviation "Wikipedia - RMSE" +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.list.numbered meta.link.reference.def +1. another list item + +[foo]: /url "title" +|^^^^^^^^^^^^^^^^^^ meta.link.reference.def +| ^ punctuation.separator.key-value +| ^^^^ markup.underline.link +| ^^^^^^^ string.other.link.description.title + +[foo] +|<- meta.link.reference punctuation.definition.link.begin +|^^^ meta.paragraph meta.link.reference +| ^ meta.link.reference punctuation.definition.link.end + + [Foo*bar\]]:my_(url) 'title (with parens)' +|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.reference.def +|^ punctuation.definition.constant.begin +| ^^^^^^^^^ entity.name.reference.link - punctuation +| ^ punctuation.definition.constant.end +| ^ punctuation.separator.key-value +| ^^^^^^^^ markup.underline.link +| ^^^^^^^^^^^^^^^^^^^^^ string.other.link.description.title + + [foo]: <> +|^^^^^^^^^ meta.link.reference.def +| ^ punctuation.separator.key-value +| ^ punctuation.definition.link.begin +| ^ punctuation.definition.link.end diff --git a/OCaml/OCaml.sublime-syntax b/OCaml/OCaml.sublime-syntax index 7c52c9b0d6..882a0e849d 100644 --- a/OCaml/OCaml.sublime-syntax +++ b/OCaml/OCaml.sublime-syntax @@ -414,36 +414,30 @@ contexts: # http://caml.inria.fr/pub/docs/manual-ocaml/lex.html # hexadecimal floats - - match: ({{sign}})(0[xX])(_*)({{hex_integer}})(?:(\.)({{hex_digit}}*)({{hex_exponent}})?|({{hex_exponent}})) + - match: ({{sign}})(0[xX])((_*){{hex_integer}}(?:(\.){{hex_digit}}*{{hex_exponent}}?|{{hex_exponent}})) scope: meta.number.float.hexadecimal.ocaml captures: - 1: punctuation.definition.numeric.sign.ocaml + 1: keyword.operator.arithmetic.ocaml 2: constant.numeric.base.ocaml - 3: invalid.illegal.numeric.ocaml - 4: constant.numeric.value.ocaml + 3: constant.numeric.value.ocaml + 4: invalid.illegal.numeric.ocaml 5: punctuation.separator.decimal.ocaml - 6: constant.numeric.value.ocaml - 7: constant.numeric.value.exponent.ocaml - 8: invalid.illegal.numeric.ocaml - 9: constant.numeric.value.exponent.ocaml - 10: invalid.illegal.numeric.ocaml + 6: invalid.illegal.numeric.ocaml + 7: invalid.illegal.numeric.ocaml # decimal floats - - match: ({{sign}})({{dec_integer}})(?:(\.)({{dec_digit}}*)({{dec_exponent}})?|({{dec_exponent}})) + - match: ({{sign}})({{dec_integer}}(?:(\.){{dec_digit}}*{{dec_exponent}}?|{{dec_exponent}})) scope: meta.number.float.decimal.ocaml captures: - 1: punctuation.definition.numeric.sign.ocaml + 1: keyword.operator.arithmetic.ocaml 2: constant.numeric.value.ocaml 3: punctuation.separator.decimal.ocaml - 4: constant.numeric.value.ocaml - 5: constant.numeric.value.exponent.ocaml - 6: invalid.illegal.numeric.ocaml - 7: constant.numeric.value.exponent.ocaml - 8: invalid.illegal.numeric.ocaml + 4: invalid.illegal.numeric.ocaml + 5: invalid.illegal.numeric.ocaml # hexadecimal integers - match: ({{sign}})(0[xX])(_*)({{hex_integer}}*)({{suffix}}) scope: meta.number.integer.hexadecimal.ocaml captures: - 1: punctuation.definition.numeric.sign.ocaml + 1: keyword.operator.arithmetic.ocaml 2: constant.numeric.base.ocaml 3: invalid.illegal.numeric.ocaml 4: constant.numeric.value.ocaml @@ -452,7 +446,7 @@ contexts: - match: ({{sign}})(0[oO])(_*)({{oct_integer}}*)({{suffix}}) scope: meta.number.integer.octal.ocaml captures: - 1: punctuation.definition.numeric.sign.ocaml + 1: keyword.operator.arithmetic.ocaml 2: constant.numeric.base.ocaml 3: invalid.illegal.numeric.ocaml 4: constant.numeric.value.ocaml @@ -461,7 +455,7 @@ contexts: - match: ({{sign}})(0[bB])(_*)({{bin_integer}}*)({{suffix}}) scope: meta.number.integer.binary.ocaml captures: - 1: punctuation.definition.numeric.sign.ocaml + 1: keyword.operator.arithmetic.ocaml 2: constant.numeric.base.ocaml 3: invalid.illegal.numeric.ocaml 4: constant.numeric.value.ocaml @@ -470,7 +464,7 @@ contexts: - match: ({{sign}})({{dec_integer}})({{suffix}}) scope: meta.number.integer.decimal.ocaml captures: - 1: punctuation.definition.numeric.sign.ocaml + 1: keyword.operator.arithmetic.ocaml 2: constant.numeric.value.ocaml 3: constant.numeric.suffix.ocaml # invalid numbers diff --git a/OCaml/syntax_test_ml.ml b/OCaml/syntax_test_ml.ml index 43ed219128..e687498bcc 100644 --- a/OCaml/syntax_test_ml.ml +++ b/OCaml/syntax_test_ml.ml @@ -48,7 +48,7 @@ -123 (* ^^^^ meta.number.integer.decimal.ocaml - keyword.ocaml *) -(* ^ punctuation.definition.numeric.sign *) +(* ^ keyword.operator.arithmetic.ocaml *) (* ^^^ constant.numeric.value.ocaml *) 0123456789 @@ -104,27 +104,21 @@ 0xa. 0xa.b 0xa.ep1 0xa.ep-_1 (* ^^^^ meta.number.float.hexadecimal.ocaml *) (* ^^ constant.numeric.base.ocaml *) -(* ^ constant.numeric.value.ocaml *) +(* ^^ constant.numeric.value.ocaml *) (* ^ punctuation.separator.decimal *) (* ^^^^^ meta.number.float.hexadecimal.ocaml *) (* ^^ constant.numeric.base.ocaml *) -(* ^ constant.numeric.value.ocaml *) +(* ^^^ constant.numeric.value.ocaml *) (* ^ punctuation.separator.decimal *) -(* ^ constant.numeric.value.ocaml *) (* ^^^^^^^ meta.number.float.hexadecimal.ocaml *) (* ^^ constant.numeric.base.ocaml *) -(* ^ constant.numeric.value.ocaml *) +(* ^^^^^ constant.numeric.value.ocaml *) (* ^ punctuation.separator.decimal *) -(* ^ constant.numeric.value.ocaml *) -(* ^^ constant.numeric.value.exponent.ocaml *) (* ^^^^^^^^^ meta.number.float.hexadecimal.ocaml *) (* ^^ constant.numeric.base.ocaml *) -(* ^ constant.numeric.value.ocaml *) +(* ^^^^^^^ constant.numeric.value.ocaml *) (* ^ punctuation.separator.decimal *) -(* ^ constant.numeric.value.ocaml *) -(* ^^ constant.numeric.value.exponent.ocaml *) (* ^ invalid.illegal.numeric *) -(* ^ constant.numeric.value.exponent.ocaml *) 0b1.foo (* ^^^^^^^ invalid.illegal.numeric *) @@ -146,12 +140,9 @@ 12345e6_7_8 (* ^^^^^^^^^^^ meta.number.float.decimal.ocaml *) -(* ^^^^^ constant.numeric.value.ocaml *) -(* ^^^^^^ constant.numeric.value.exponent.ocaml *) +(* ^^^^^^^^^^^ constant.numeric.value.ocaml *) 123.456e+789 (* ^^^^^^^^^^^^ meta.number.float.decimal.ocaml *) -(* ^^^ constant.numeric.value.ocaml *) +(* ^^^^^^^^^^^^ constant.numeric.value.ocaml *) (* ^ punctuation.separator.decimal *) -(* ^^^ constant.numeric.value.ocaml *) -(* ^^^^^ constant.numeric.value.exponent.ocaml *) diff --git a/Objective-C/Objective-C++.sublime-syntax b/Objective-C/Objective-C++.sublime-syntax index 62a0ed5102..94d20a701b 100644 --- a/Objective-C/Objective-C++.sublime-syntax +++ b/Objective-C/Objective-C++.sublime-syntax @@ -21,11 +21,12 @@ variables: before_tag: 'struct|union|enum\s+class|enum\s+struct|enum|class' declspec: '__declspec\(\s*\w+(?:\([^)]+\))?\s*\)' storage_classes: 'static|export|extern|friend|explicit|virtual|register|thread_local' - type_qualifier: 'const|constexpr|mutable|typename|volatile' + type_qualifier: 'const|mutable|typename|volatile' + constant_expression_specifiers: 'consteval|constexpr|constinit' compiler_directive: 'inline|restrict|__restrict__|__restrict' visibility_modifiers: 'private|protected|public' other_keywords: 'typedef|nullptr|{{visibility_modifiers}}|static_assert|sizeof|using|typeid|alignof|alignas|namespace|template' - modifiers: '{{storage_classes}}|{{type_qualifier}}|{{compiler_directive}}' + modifiers: '{{storage_classes}}|{{type_qualifier}}|{{compiler_directive}}|{{constant_expression_specifiers}}' non_angle_brackets: '(?=<<|<=)' regular: '[^(){}&;*^%=<>-]*' @@ -360,6 +361,7 @@ contexts: - include: scope:source.objc#protocol_type_qualifier - include: expressions - include: comments + - include: attribute - match: '(,)\s+(\.\.\.)\s*' captures: 1: punctuation.separator.objc++ @@ -453,18 +455,7 @@ contexts: scope: meta.group.objc++ punctuation.section.group.end.objc++ pop: true - include: expressions - - match: \b(__attribute__)\s*(\(\() - captures: - 1: storage.modifier.objc++ - 2: meta.group.objc++ punctuation.section.group.begin.objc++ - push : - - meta_scope: meta.attribute.objc++ - - meta_content_scope: meta.group.objc++ - - include: parens - - include: strings - - match: \)\) - scope: meta.group.objc++ punctuation.section.group.end.objc++ - pop: true + - include: attribute - match: \b(__declspec)(\() captures: 1: storage.modifier.objc++ @@ -494,6 +485,20 @@ contexts: - match: '\b(appdomain|deprecated|dllimport|dllexport|jintrinsic|naked|noalias|noinline|noreturn|nothrow|novtable|process|restrict|safebuffers|selectany|thread)\b' scope: constant.other.objc++ + attribute: + - match: \b(__attribute__)\s*(\(\() + captures: + 1: storage.modifier.objc++ + 2: meta.group.objc++ punctuation.section.group.begin.objc++ + push : + - meta_scope: meta.attribute.objc++ + - meta_content_scope: meta.group.objc++ + - include: parens + - include: strings + - match: \)\) + scope: meta.group.objc++ punctuation.section.group.end.objc++ + pop: true + types-parens: - match: '\b(decltype)\b\s*(\()' captures: diff --git a/Objective-C/Objective-C.sublime-syntax b/Objective-C/Objective-C.sublime-syntax index e25e4e60c1..15d57f65ec 100644 --- a/Objective-C/Objective-C.sublime-syntax +++ b/Objective-C/Objective-C.sublime-syntax @@ -457,6 +457,7 @@ contexts: - include: protocol_type_qualifier - include: expressions - include: comments + - include: attribute - match: '(,)\s+(\.\.\.)\s*' captures: 1: punctuation.separator.objc @@ -818,18 +819,7 @@ contexts: - include: expressions modifiers-parens: - - match: \b(__attribute__)\s*(\(\() - captures: - 1: storage.modifier.objc - 2: meta.group.objc punctuation.section.group.begin.objc - push : - - meta_scope: meta.attribute.objc - - meta_content_scope: meta.group.objc - - include: parens - - include: strings - - match: \)\) - scope: meta.group.objc punctuation.section.group.end.objc - pop: true + - include: attribute - match: \b(__declspec)(\() captures: 1: storage.modifier.objc @@ -859,6 +849,20 @@ contexts: - match: '\b(appdomain|deprecated|dllimport|dllexport|jintrinsic|naked|noalias|noinline|noreturn|nothrow|novtable|process|restrict|safebuffers|selectany|thread)\b' scope: constant.other.objc + attribute: + - match: \b(__attribute__)\s*(\(\() + captures: + 1: storage.modifier.objc + 2: meta.group.objc punctuation.section.group.begin.objc + push : + - meta_scope: meta.attribute.objc + - meta_content_scope: meta.group.objc + - include: parens + - include: strings + - match: \)\) + scope: meta.group.objc punctuation.section.group.end.objc + pop: true + keywords-parens: - match: '\b(sizeof)\b\s*(\()' captures: diff --git a/Objective-C/syntax_test_objc++.mm b/Objective-C/syntax_test_objc++.mm index 9056c9377b..6dcc9168cd 100644 --- a/Objective-C/syntax_test_objc++.mm +++ b/Objective-C/syntax_test_objc++.mm @@ -269,10 +269,10 @@ bool foo (bool run=true) {} /* ^ string.quoted.double */ /* ^ punctuation.definition.string.end */ -char str2[] = u8"abc"; -/* ^ storage.type.string */ -/* ^ punctuation.definition.string.begin */ -/* ^ string.quoted.double */ +char8_t str2[] = u8"abc"; +/* ^ storage.type.string */ +/* ^ punctuation.definition.string.begin */ +/* ^ string.quoted.double */ char16_t str3[] = u"abc"; /* ^ storage.type.string */ @@ -312,13 +312,16 @@ bool foo (bool run=true) {} /* ^^^ constant.character.escape */ /* ^^^^^^^^ constant.character.escape */ -char16_t str9[] = u"\u0063"; +char8_t str9[] = u8"\u0063"; /* ^^^^^^ constant.character.escape */ -char32_t str10[] = U"\U00000063"; +char16_t str10[] = u"\u0063"; +/* ^^^^^^ constant.character.escape */ + +char32_t str11[] = U"\U00000063"; /* ^^^^^^^^^^ constant.character.escape */ -char str11[] = "\q"; +char str12[] = "\q"; /* ^^ invalid.illegal.unknown-escape */ scanf("%ms %as %*[, ]", &buf); @@ -811,6 +814,12 @@ int main() { constexpr int ABC = 3 + 5; /* <- storage.modifier */ +consteval int f() { return 42; } +/* <- storage.modifier */ + +constinit const int i = f(); +/* <- storage.modifier */ + thread_local int x; /* <- storage.modifier */ @@ -1057,13 +1066,12 @@ int main() { hex2 = 0xc1.01AbFp-1+0x1.45c778p+7f; /* ^^^^^^^^^^^^^ meta.number.float.hexadecimal.c++ */ /* ^^ constant.numeric.base.c++ */ -/* ^^ constant.numeric.value.c++ */ +/* ^^^^^^^^^^^ constant.numeric.value.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^^^^^ constant.numeric.value.c++ */ -/* ^^^ constant.numeric.value.exponent.c++ */ /* ^ keyword.operator.arithmetic - constant.c++ */ /* ^^^^^^^^^^^^^^ meta.number.float.hexadecimal.c++ */ /* ^^ constant.numeric.base.c++ */ +/* ^^^^^^^^^^^ constant.numeric.value.c++ */ /* ^ punctuation.separator.decimal.c++ */ /* ^ constant.numeric.suffix.c++ */ /* ^ punctuation.terminator - constant */ @@ -1088,181 +1096,151 @@ int main() { f = 1.1+1.1e1+1.1e-1+1.1f+1.1e1f+1.1e-1f+1.1L+1.1e1L+1.1e-1L; /* ^^^ meta.number.float.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ +/* ^^^ constant.numeric.value.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^^^ meta.number.float.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ +/* ^^^^^ constant.numeric.value.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ -/* ^^ constant.numeric.value.exponent.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^^^^ meta.number.float.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ +/* ^^^^^^ constant.numeric.value.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ -/* ^^^ constant.numeric.value.exponent.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^^ meta.number.float.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ +/* ^^^ constant.numeric.value.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ /* ^ constant.numeric.suffix.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^^^^ meta.number.float.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ +/* ^^^^^ constant.numeric.value.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ -/* ^^ constant.numeric.value.exponent.c++ */ /* ^ constant.numeric.suffix.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^^^^^ meta.number.float.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ +/* ^^^^^^ constant.numeric.value.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ -/* ^^^ constant.numeric.value.exponent.c++ */ /* ^ constant.numeric.suffix.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^^ meta.number.float.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ +/* ^^^ constant.numeric.value.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ /* ^ constant.numeric.suffix.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^^^^ meta.number.float.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ +/* ^^^^^ constant.numeric.value.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ -/* ^^ constant.numeric.value.exponent.c++ */ /* ^ constant.numeric.suffix.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^^^^^ meta.number.float.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ +/* ^^^^^^ constant.numeric.value.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ -/* ^^^ constant.numeric.value.exponent.c++ */ /* ^ constant.numeric.suffix.c++ */ /* ^ punctuation.terminator - constant */ f = 1.e1+1.e-1+1.e1f+1.e-1f+1.e1L+1.e-1L; /* ^^^^ meta.number.float.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ +/* ^^^^ constant.numeric.value.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^^ constant.numeric.value.exponent.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^^^ meta.number.float.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ +/* ^^^^^ constant.numeric.value.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^^^ constant.numeric.value.exponent.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^^^ meta.number.float.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ +/* ^^^^ constant.numeric.value.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^^ constant.numeric.value.exponent.c++ */ /* ^ constant.numeric.suffix.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^^^^ meta.number.float.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ +/* ^^^^^ constant.numeric.value.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^^^ constant.numeric.value.exponent.c++ */ /* ^ constant.numeric.suffix.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^^^ meta.number.float.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ +/* ^^^^ constant.numeric.value.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^^ constant.numeric.value.exponent.c++ */ /* ^ constant.numeric.suffix.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^^^^ meta.number.float.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ +/* ^^^^^ constant.numeric.value.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^^^ constant.numeric.value.exponent.c++ */ /* ^ constant.numeric.suffix.c++ */ /* ^ punctuation.terminator - constant */ f = 1.+1.f+1.L+1..; /* ^^ meta.number.float.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ +/* ^^ constant.numeric.value.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^ meta.number.float.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ +/* ^^ constant.numeric.value.c++ */ /* ^ punctuation.separator.decimal.c++ */ /* ^ constant.numeric.suffix.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^ meta.number.float.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ +/* ^^ constant.numeric.value.c++ */ /* ^ punctuation.separator.decimal.c++ */ /* ^ constant.numeric.suffix.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^ keyword.operator.arithmetic.c */ /* ^ meta.number.integer.decimal.c++ */ /* ^ constant.numeric.value.c++ */ -/* ^^ invalid.illegal.syntax */ +/* ^^ invalid.illegal.syntax.c */ /* ^ punctuation.terminator - constant */ f = 1e1+1e1f+1e1L; /* ^^^ meta.number.float.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ -/* ^^ constant.numeric.value.exponent.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^^^ constant.numeric.value.c++ */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^^ meta.number.float.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ -/* ^^ constant.numeric.value.exponent.c++ */ +/* ^^^ constant.numeric.value.c++ */ /* ^ constant.numeric.suffix.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^^ meta.number.float.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ -/* ^^ constant.numeric.value.exponent.c++ */ +/* ^^^ constant.numeric.value.c++ */ /* ^ constant.numeric.suffix.c++ */ /* ^ punctuation.terminator - constant */ f = .1+.1e1+.1e-1+.1f+.1e1f+.1e-1f+.1L+.1e1L+.1e-1L; /* ^^ meta.number.float.decimal.c++ */ +/* ^^ constant.numeric.value.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^^ meta.number.float.decimal.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ -/* ^^ constant.numeric.value.exponent.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^^^^ constant.numeric.value.c++ */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^^^ meta.number.float.decimal.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ -/* ^^^ constant.numeric.value.exponent.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^^^^^ constant.numeric.value.c++ */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^ meta.number.float.decimal.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ +/* ^^ constant.numeric.value.c++ */ /* ^ constant.numeric.suffix.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^^^ meta.number.float.decimal.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ -/* ^^ constant.numeric.value.exponent.c++ */ +/* ^^^^ constant.numeric.value.c++ */ /* ^ constant.numeric.suffix.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^^^^ meta.number.float.decimal.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ -/* ^^^ constant.numeric.value.exponent.c++ */ +/* ^^^^^ constant.numeric.value.c++ */ /* ^ constant.numeric.suffix.c++ */ /* ^^^ meta.number.float.decimal.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ +/* ^^ constant.numeric.value.c++ */ /* ^ constant.numeric.suffix.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^^^ meta.number.float.decimal.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ -/* ^^ constant.numeric.value.exponent.c++ */ +/* ^^^^ constant.numeric.value.c++ */ /* ^ constant.numeric.suffix.c++ */ -/* ^ keyword.operator.arithmetic */ +/* ^ keyword.operator.arithmetic.c */ /* ^^^^^^ meta.number.float.decimal.c++ */ /* ^ punctuation.separator.decimal.c++ */ -/* ^ constant.numeric.value.c++ */ -/* ^^^ constant.numeric.value.exponent.c++ */ +/* ^^^^^ constant.numeric.value.c++ */ /* ^ constant.numeric.suffix.c++ */ /* ^ punctuation.terminator - constant */ @@ -1279,6 +1257,22 @@ int main() { /* ^^^^^^^^^ meta.number.float.decimal */ /* ^ punctuation.terminator - constant */ +units0 = 1.0suff+1.suff*.0suff/{1suff} +/* ^^^^^^^ meta.number.float.decimal */ +/* ^^^^ constant.numeric.suffix */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ meta.number.float.decimal */ +/* ^^^^ constant.numeric.suffix */ +/* ^ keyword.operator */ +/* ^^^^^^ meta.number.float.decimal */ +/* ^^^^ constant.numeric.suffix */ +/* ^ keyword.operator.arithmetic */ +/* ^ punctuation.section.block.begin */ +/* ^^^^^ meta.number.integer.decimal */ +/* ^ constant.numeric.value */ +/* ^^^^ constant.numeric.suffix */ +/* ^ punctuation.section.block.end */ + units1 = 134h + 123.45h; /* ^^^^ meta.number.integer.decimal */ /* ^ constant.numeric.suffix */ @@ -2707,6 +2701,10 @@ @interface Person : NSObject /* ^ punctuation.separator.objc */ /* ^ keyword.other.property.attribute. */ /* ^ punctuation.section.scope.end */ +- (NSString*)formatWithPattern:(NSString*)pattern __attribute__((swift_name("format(pattern:)"))); +/* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute.objc++*/ +/* ^^^^^^^^^^^^^ storage.modifier.objc++*/ +/* ^^^^^^^^^^^^^^^^^^ string.quoted.double.c*/ @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 306ebcd01d..a2ae9fbc41 100644 --- a/Objective-C/syntax_test_objc.m +++ b/Objective-C/syntax_test_objc.m @@ -622,6 +622,10 @@ @interface Person : NSObject /* ^ punctuation.separator.objc */ /* ^ keyword.other.property.attribute. */ /* ^ punctuation.section.scope.end */ +- (NSString*)formatWithPattern:(NSString*)pattern __attribute__((swift_name("format(pattern:)"))); +/* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute.objc*/ +/* ^^^^^^^^^^^^^ storage.modifier.objc*/ +/* ^^^^^^^^^^^^^^^^^^ string.quoted.double.c*/ @end /* <- storage.type punctuation.definition.storage.type */ /*^ storage.type */ @@ -766,11 +770,7 @@ - (void)debugOutput:(NSString *)format, ... NS_FORMAT_FUNCTION(1,2) /* ^^^^^^^^^^^ meta.number.integer.octal.c */ /* ^ constant.numeric.base.c */ /* ^^ constant.numeric.value.c */ -/* ^ invalid.illegal.numeric.digit.c */ -/* ^ constant.numeric.value.c */ -/* ^ invalid.illegal.numeric.digit.c */ -/* ^^ constant.numeric.value.c */ -/* ^^^ invalid.illegal.numeric.suffix.c */ +/* ^^^^^^^^ invalid.illegal.numeric.suffix.c */ /* ^ punctuation.terminator - constant */ hex1 = 0x0+0xFL+0xaull+0xallu+0xfu+0x'f'12_4uz; @@ -806,125 +806,102 @@ - (void)debugOutput:(NSString *)format, ... NS_FORMAT_FUNCTION(1,2) /* ^^ constant.numeric.base.c */ /* ^^ constant.numeric.value.c */ /* ^ punctuation.separator.decimal.c */ -/* ^^^^^ constant.numeric.value.c */ -/* ^^^ constant.numeric.value.exponent.c */ +/* ^^^^^^^^ constant.numeric.value.c */ /* ^ keyword.operator.arithmetic - constant.c */ /* ^^^^^^^^^^^^^^ meta.number.float.hexadecimal.c */ /* ^^ constant.numeric.base.c */ /* ^ constant.numeric.value.c */ /* ^ punctuation.separator.decimal.c */ -/* ^^^^^^ constant.numeric.value.c */ -/* ^^^ constant.numeric.value.exponent.c */ +/* ^^^^^^^^^ constant.numeric.value.c */ /* ^ constant.numeric.suffix.c */ /* ^ 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; /* ^^^ meta.number.float.decimal.c */ -/* ^ constant.numeric.value.c */ +/* ^^^ constant.numeric.value.c */ /* ^ punctuation.separator.decimal.c */ -/* ^ constant.numeric.value.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^^^ meta.number.float.decimal.c */ -/* ^ constant.numeric.value.c */ +/* ^^^^^ constant.numeric.value.c */ /* ^ punctuation.separator.decimal.c */ -/* ^ constant.numeric.value.c */ -/* ^^ constant.numeric.value.exponent.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^^^^ meta.number.float.decimal.c */ -/* ^ constant.numeric.value.c */ +/* ^^^^^^ constant.numeric.value.c */ /* ^ punctuation.separator.decimal.c */ -/* ^ constant.numeric.value.c */ -/* ^^^ constant.numeric.value.exponent.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^^ meta.number.float.decimal.c */ -/* ^ constant.numeric.value.c */ +/* ^^^ constant.numeric.value.c */ /* ^ punctuation.separator.decimal.c */ -/* ^ constant.numeric.value.c */ /* ^ constant.numeric.suffix.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^^^^ meta.number.float.decimal.c */ -/* ^ constant.numeric.value.c */ +/* ^^^^^ constant.numeric.value.c */ /* ^ punctuation.separator.decimal.c */ -/* ^ constant.numeric.value.c */ -/* ^^ constant.numeric.value.exponent.c */ /* ^ constant.numeric.suffix.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^^^^^ meta.number.float.decimal.c */ -/* ^ constant.numeric.value.c */ +/* ^^^^^^ constant.numeric.value.c */ /* ^ punctuation.separator.decimal.c */ -/* ^ constant.numeric.value.c */ -/* ^^^ constant.numeric.value.exponent.c */ /* ^ constant.numeric.suffix.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^^ meta.number.float.decimal.c */ -/* ^ constant.numeric.value.c */ +/* ^^^ constant.numeric.value.c */ /* ^ punctuation.separator.decimal.c */ -/* ^ constant.numeric.value.c */ /* ^ constant.numeric.suffix.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^^^^ meta.number.float.decimal.c */ -/* ^ constant.numeric.value.c */ +/* ^^^^^ constant.numeric.value.c */ /* ^ punctuation.separator.decimal.c */ -/* ^ constant.numeric.value.c */ -/* ^^ constant.numeric.value.exponent.c */ /* ^ constant.numeric.suffix.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^^^^^ meta.number.float.decimal.c */ -/* ^ constant.numeric.value.c */ +/* ^^^^^^ constant.numeric.value.c */ /* ^ punctuation.separator.decimal.c */ -/* ^ constant.numeric.value.c */ -/* ^^^ constant.numeric.value.exponent.c */ /* ^ constant.numeric.suffix.c */ /* ^ punctuation.terminator - constant */ f = 1.e1+1.e-1+1.e1f+1.e-1f+1.e1L+1.e-1L; /* ^^^^ meta.number.float.decimal.c */ -/* ^ constant.numeric.value.c */ +/* ^^^^ constant.numeric.value.c */ /* ^ punctuation.separator.decimal.c */ -/* ^^ constant.numeric.value.exponent.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^^^ meta.number.float.decimal.c */ -/* ^ constant.numeric.value.c */ +/* ^^^^^ constant.numeric.value.c */ /* ^ punctuation.separator.decimal.c */ -/* ^^^ constant.numeric.value.exponent.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^^^ meta.number.float.decimal.c */ -/* ^ constant.numeric.value.c */ +/* ^^^^ constant.numeric.value.c */ /* ^ punctuation.separator.decimal.c */ -/* ^^ constant.numeric.value.exponent.c */ /* ^ constant.numeric.suffix.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^^^^ meta.number.float.decimal.c */ -/* ^ constant.numeric.value.c */ +/* ^^^^^ constant.numeric.value.c */ /* ^ punctuation.separator.decimal.c */ -/* ^^^ constant.numeric.value.exponent.c */ /* ^ constant.numeric.suffix.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^^^ meta.number.float.decimal.c */ -/* ^ constant.numeric.value.c */ +/* ^^^^ constant.numeric.value.c */ /* ^ punctuation.separator.decimal.c */ -/* ^^ constant.numeric.value.exponent.c */ /* ^ constant.numeric.suffix.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^^^^ meta.number.float.decimal.c */ -/* ^ constant.numeric.value.c */ +/* ^^^^^ constant.numeric.value.c */ /* ^ punctuation.separator.decimal.c */ -/* ^^^ constant.numeric.value.exponent.c */ /* ^ constant.numeric.suffix.c */ /* ^ punctuation.terminator - constant */ f = 1.+1.f+1.L+1..; /* ^^ meta.number.float.decimal.c */ -/* ^ constant.numeric.value.c */ +/* ^^ constant.numeric.value.c */ /* ^ punctuation.separator.decimal.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^ meta.number.float.decimal.c */ -/* ^ constant.numeric.value.c */ +/* ^^ constant.numeric.value.c */ /* ^ punctuation.separator.decimal.c */ /* ^ constant.numeric.suffix.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^ meta.number.float.decimal.c */ -/* ^ constant.numeric.value.c */ +/* ^^ constant.numeric.value.c */ /* ^ punctuation.separator.decimal.c */ /* ^ constant.numeric.suffix.c */ /* ^ keyword.operator.arithmetic.c */ @@ -935,83 +912,111 @@ - (void)debugOutput:(NSString *)format, ... NS_FORMAT_FUNCTION(1,2) f = 1e1+1e1f+1e1L; /* ^^^ meta.number.float.decimal.c */ -/* ^ constant.numeric.value.c */ -/* ^^ constant.numeric.value.exponent.c */ +/* ^^^ constant.numeric.value.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^^ meta.number.float.decimal.c */ -/* ^ constant.numeric.value.c */ -/* ^^ constant.numeric.value.exponent.c */ +/* ^^^ constant.numeric.value.c */ /* ^ constant.numeric.suffix.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^^ meta.number.float.decimal.c */ -/* ^ constant.numeric.value.c */ -/* ^^ constant.numeric.value.exponent.c */ +/* ^^^ constant.numeric.value.c */ /* ^ constant.numeric.suffix.c */ /* ^ punctuation.terminator - constant */ f = .1+.1e1+.1e-1+.1f+.1e1f+.1e-1f+.1L+.1e1L+.1e-1L; /* ^^ meta.number.float.decimal.c */ +/* ^^ constant.numeric.value.c */ /* ^ punctuation.separator.decimal.c */ -/* ^ constant.numeric.value.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^^ meta.number.float.decimal.c */ /* ^ punctuation.separator.decimal.c */ -/* ^ constant.numeric.value.c */ -/* ^^ constant.numeric.value.exponent.c */ +/* ^^^^ constant.numeric.value.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^^^ meta.number.float.decimal.c */ /* ^ punctuation.separator.decimal.c */ -/* ^ constant.numeric.value.c */ -/* ^^^ constant.numeric.value.exponent.c */ +/* ^^^^^ constant.numeric.value.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^ meta.number.float.decimal.c */ /* ^ punctuation.separator.decimal.c */ -/* ^ constant.numeric.value.c */ +/* ^^ constant.numeric.value.c */ /* ^ constant.numeric.suffix.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^^^ meta.number.float.decimal.c */ /* ^ punctuation.separator.decimal.c */ -/* ^ constant.numeric.value.c */ -/* ^^ constant.numeric.value.exponent.c */ +/* ^^^^ constant.numeric.value.c */ /* ^ constant.numeric.suffix.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^^^^ meta.number.float.decimal.c */ /* ^ punctuation.separator.decimal.c */ -/* ^ constant.numeric.value.c */ -/* ^^^ constant.numeric.value.exponent.c */ +/* ^^^^^ constant.numeric.value.c */ /* ^ constant.numeric.suffix.c */ /* ^^^ meta.number.float.decimal.c */ /* ^ punctuation.separator.decimal.c */ -/* ^ constant.numeric.value.c */ +/* ^^ constant.numeric.value.c */ /* ^ constant.numeric.suffix.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^^^ meta.number.float.decimal.c */ /* ^ punctuation.separator.decimal.c */ -/* ^ constant.numeric.value.c */ -/* ^^ constant.numeric.value.exponent.c */ +/* ^^^^ constant.numeric.value.c */ /* ^ constant.numeric.suffix.c */ /* ^ keyword.operator.arithmetic.c */ /* ^^^^^^ meta.number.float.decimal.c */ /* ^ punctuation.separator.decimal.c */ -/* ^ constant.numeric.value.c */ -/* ^^^ constant.numeric.value.exponent.c */ +/* ^^^^^ constant.numeric.value.c */ /* ^ constant.numeric.suffix.c */ /* ^ punctuation.terminator - constant */ -f = 1.0suff+1.suff*.0suff/{1suff} -/* ^^^ meta.number.float.decimal - invalid */ -/* ^^^^ meta.number.float.decimal invalid.illegal.numeric.suffix */ -/* ^ keyword.operator.arithmetic */ -/* ^^ meta.number.float.decimal - invalid */ -/* ^^^^ meta.number.float.decimal invalid.illegal.numeric.suffix */ -/* ^ keyword.operator */ -/* ^^ meta.number.float.decimal - invalid */ -/* ^^^^ meta.number.float.decimal invalid.illegal.numeric.suffix */ -/* ^ keyword.operator.arithmetic */ -/* ^ punctuation.section.block.begin */ -/* ^ meta.number.integer.decimal - invalid */ -/* ^^^^ meta.number.integer.decimal invalid.illegal.numeric.suffix */ -/* ^ punctuation.section.block.end */ +units0 = 1.0suff+1.suff*.0suff/{1suff} +/* ^^^^^^^ meta.number.float.decimal */ +/* ^^^^ invalid.illegal.numeric.suffix */ +/* ^ keyword.operator.arithmetic */ +/* ^^^^^^ meta.number.float.decimal */ +/* ^^^^ invalid.illegal.numeric.suffix */ +/* ^ keyword.operator */ +/* ^^^^^^ meta.number.float.decimal */ +/* ^^^^ invalid.illegal.numeric.suffix */ +/* ^ keyword.operator.arithmetic */ +/* ^ punctuation.section.block.begin */ +/* ^^^^^ meta.number.integer.decimal */ +/* ^ constant.numeric.value */ +/* ^^^^ invalid.illegal.numeric.suffix */ +/* ^ punctuation.section.block.end */ + +units1 = 134h + 123.45h; +/* ^^^^ meta.number.integer.decimal */ +/* ^ invalid.illegal.numeric.suffix */ +/* ^^^ - constant */ +/* ^^^^^^^ meta.number.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ invalid.illegal.numeric.suffix */ +/* ^ punctuation.terminator - constant */ + +units2 = 147min + 147.min; +/* ^^^^^^ meta.number.integer.decimal */ +/* ^^^ invalid.illegal.numeric.suffix */ +/* ^^^ - constant */ +/* ^^^^^^^ meta.number.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^^^ invalid.illegal.numeric.suffix */ +/* ^ punctuation.terminator - constant */ + +units3 = 357s + 34.7s; +/* ^^^^ meta.number.integer.decimal */ +/* ^ invalid.illegal.numeric.suffix */ +/* ^^^ - constant */ +/* ^^^^^ meta.number.float.decimal */ +/* ^ punctuation.separator.decimal */ +/* ^ invalid.illegal.numeric.suffix */ +/* ^ punctuation.terminator - constant */ + +units4 = 234_custom + 10e-1_custom; +/* ^^^^^^^^^^ meta.number.integer.decimal */ +/* ^^^ constant.numeric.value */ +/* ^^^^^^^ invalid.illegal.numeric.suffix */ +/* ^^^ - constant */ +/* ^^^^^^^^^^^^ meta.number.float.decimal */ +/* ^^^^^^^ invalid.illegal.numeric.suffix */ +/* ^ punctuation.terminator - constant */ scanf("%ms %as %*[, ]", &buf); /* ^^^ constant.other.placeholder */ diff --git a/PHP/Indentation Rules.tmPreferences b/PHP/Indentation Rules.tmPreferences index d525530f15..d0582b2274 100644 --- a/PHP/Indentation Rules.tmPreferences +++ b/PHP/Indentation Rules.tmPreferences @@ -60,7 +60,7 @@ bracketIndentNextLinePattern (?x) ^ \s* \b(if|while|else|elseif|foreach)\b [^;]* $ - | ^ \s* \b(for)\b .* $ + | ^ \s* \b(for)\b .* [^;]\s*$ diff --git a/PHP/PHP Source.sublime-syntax b/PHP/PHP Source.sublime-syntax index 6cc27e6b0f..83fe4c30fc 100644 --- a/PHP/PHP Source.sublime-syntax +++ b/PHP/PHP Source.sublime-syntax @@ -1551,7 +1551,7 @@ contexts: captures: 1: keyword.other.phpdoc.php 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 + - 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))?|m(ethod|ixin)|source)\b scope: keyword.other.phpdoc.php - match: \{(@inheritdoc)\} captures: @@ -2165,7 +2165,7 @@ contexts: scope: support.function.overload.php - match: |- \b(?xi: - pcntl_alarm | pcntl_exec | pcntl_fork | pcntl_getpriority | pcntl_setpriority | pcntl_signal | pcntl_signal_dispatch | pcntl_sigprocmask | + pcntl_alarm | pcntl_async_signals | 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 diff --git a/PHP/PHP.sublime-completions b/PHP/PHP.sublime-completions index 0ddd2a29a0..bd204e56ca 100644 --- a/PHP/PHP.sublime-completions +++ b/PHP/PHP.sublime-completions @@ -1,10 +1,8 @@ { - "scope": "source.php - variable.other.php - source.php meta.embedded.html", - + "scope": "source.php - string - comment - variable.other.php - meta.embedded.html", "completions": [ "php", - { "trigger": "abs()", "contents": "abs(${1:number})", @@ -16095,6 +16093,12 @@ "kind": "function", "details": "Set an alarm clock for delivery of a signal" }, + { + "trigger": "pcntl_async_signals()", + "contents": "pcntl_async_signals(${1:on})", + "kind": "function", + "details": "Enable/disable asynchronous signal handling or return the old setting" + }, { "trigger": "pcntl_exec()", "contents": "pcntl_exec(${1:path})", diff --git a/PHP/Snippets/new-array(-).sublime-snippet b/PHP/Snippets/new-array(-).sublime-snippet index 2882a7fea5..8f72244786 100644 --- a/PHP/Snippets/new-array(-).sublime-snippet +++ b/PHP/Snippets/new-array(-).sublime-snippet @@ -1,6 +1,6 @@ $3${4:,} $0);]]> array - source.php - variable.other.php + source.php - string - comment - variable.other.php $… = array (…) diff --git a/PHP/tests/syntax_test_indentation.php b/PHP/tests/syntax_test_indentation.php index b57b01806d..aedf61266a 100644 --- a/PHP/tests/syntax_test_indentation.php +++ b/PHP/tests/syntax_test_indentation.php @@ -5,6 +5,8 @@ asdfadf asdf + + qwfpg 'Kalle', 'salt' => 856412), + array('name' => 'Pierre', 'salt' => 215863) +); + +for($i = 0, $size = count($people); $i < $size; ++$i) { + $people[$i]['salt'] = mt_rand(000000, 999999); +} + +for (expr1; expr2; expr3): + statement; + statement; +endfor; + ?> diff --git a/PHP/tests/syntax_test_php.php b/PHP/tests/syntax_test_php.php index ca4dfda218..8c13d4d620 100644 --- a/PHP/tests/syntax_test_php.php +++ b/PHP/tests/syntax_test_php.php @@ -1755,7 +1755,7 @@ function generate2() // ^^^^^^^^^^ keyword.operator.heredoc var foo = 1; //^^^^^^^^^^ meta.embedded.js source.js -// <- storage.type +// <- keyword.declaration // ^^^ variable.other.readwrite // ^ constant.numeric $var @@ -1785,7 +1785,7 @@ function generate2() SELECT * FROM users WHERE first_name = 'John' LIMIT $limit //^^^^^^^^^^^^^^^^^^^^^^^^ meta.embedded.sql source.sql // <- keyword.other.DML -// ^ variable.language.star +// ^ variable.language.wildcard.asterisk // ^^^^^^ string.quoted.single // ^^^^^^ variable.other.php SQL; @@ -1798,7 +1798,7 @@ function generate2() SELECT * FROM users WHERE first_name = 'John'\n //^^^^^^^^^^^^^^^^^^^^^^^^ meta.embedded.sql source.sql // <- keyword.other.DML -// ^ variable.language.star +// ^ variable.language.wildcard.asterisk // ^^^^^^ string.quoted.single // ^^ - constant.character.escape.php SQL; @@ -1993,9 +1993,9 @@ public function __test() // ^^ punctuation.section.embedded.end name attrib=false /> -//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.custom.html +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.other.html //^ punctuation.definition.tag.begin.html -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ entity.name.tag.custom.html +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ entity.name.tag.other.html // ^^^^^ punctuation.section.embedded.begin.php // ^^^^^^^^^^^^^ meta.embedded.line.php // ^^ punctuation.section.embedded.end @@ -2041,7 +2041,7 @@ public function __test()