Skip to content

Commit

Permalink
Merge branch 'master' into pr/haskell/rewrite-syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
deathaxe committed Aug 19, 2021
2 parents c6f01ca + 6c1c3bc commit c4c0f53
Show file tree
Hide file tree
Showing 131 changed files with 6,352 additions and 3,413 deletions.
16 changes: 15 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
2 changes: 1 addition & 1 deletion ASP/ASP.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -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: "'"
Expand Down
1 change: 1 addition & 0 deletions ASP/HTML (ASP).sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ extends: Packages/HTML/HTML.sublime-syntax

file_extensions:
- asp
- asa

contexts:

Expand Down
2 changes: 1 addition & 1 deletion AppleScript/AppleScript.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion AppleScript/Comments.tmPreferences
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>name</key>
<string>TM_COMMENT_START_2</string>
<key>value</key>
<string>#!</string>
<string>#</string>
</dict>
<dict>
<key>name</key>
Expand Down
141 changes: 92 additions & 49 deletions C#/C#.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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: ''
Expand Down Expand Up @@ -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
Expand All @@ -445,7 +476,7 @@ contexts:
set: type_constraint
- match: (?=where\b)
set: type_constraint
- match: (?=\{)
- match: (?=[{;(])
pop: true

type_constraint:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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: '(?=;)'
Expand All @@ -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: '(?=;)'
Expand Down Expand Up @@ -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:
Expand All @@ -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: ''
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
22 changes: 19 additions & 3 deletions C#/tests/syntax_test_C#7.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<int> Beta) example = (a, b);
/// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.group.tuple
/// ^ punctuation.section.group.begin
Expand Down Expand Up @@ -564,7 +580,7 @@ private static (int Max, int Min) Range(IEnumerable<int> 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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions C#/tests/syntax_test_C#8.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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) =>
Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit c4c0f53

Please sign in to comment.