Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
wise0704 committed Aug 14, 2023
1 parent 0fce073 commit 56a1d58
Show file tree
Hide file tree
Showing 4 changed files with 435 additions and 48 deletions.
54 changes: 42 additions & 12 deletions grammars/csharp.tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,10 @@
<key>include</key>
<string>#conditional-operator</string>
</dict>
<dict>
<key>include</key>
<string>#assignment-expression</string>
</dict>
<dict>
<key>include</key>
<string>#expression-operators</string>
Expand Down Expand Up @@ -3311,7 +3315,7 @@
</dict>
</dict>
<key>end</key>
<string>(?=[)}\];:?=&amp;|^]|!=)</string>
<string>(?=[)}\],;:?=&amp;|^]|!=)</string>
<key>patterns</key>
<array>
<dict>
Expand Down Expand Up @@ -3431,7 +3435,7 @@
</dict>
</dict>
<key>end</key>
<string>(?=[)}\];:?=&amp;|^]|!=|\b(and|or|when)\b)</string>
<string>(?=[)}\],;:?=&amp;|^]|!=|\b(and|or|when)\b)</string>
<key>patterns</key>
<array>
<dict>
Expand All @@ -3453,7 +3457,7 @@
</dict>
</dict>
<key>end</key>
<string>(?=[)}\];:?=&amp;|^]|!=|\b(and|or|when)\b)</string>
<string>(?=[)}\],;:?=&amp;|^]|!=|\b(and|or|when)\b)</string>
<key>patterns</key>
<array>
<dict>
Expand Down Expand Up @@ -3530,14 +3534,14 @@
<key>begin</key>
<string>(?=@?[_[:alpha:]][_[:alnum:]]*)</string>
<key>end</key>
<string>(?=[)}\];:?=&amp;|^]|!=|\b(and|or|when)\b)</string>
<string>(?=[)}\],;:?=&amp;|^]|!=|\b(and|or|when)\b)</string>
<key>patterns</key>
<array>
<dict>
<key>begin</key>
<string>\G</string>
<key>end</key>
<string>(?=\s|[)}\];:?=&amp;|^]|!=|\b(and|or|when)\b)</string>
<string>(?=\s|[)}\],;:?=&amp;|^]|!=|\b(and|or|when)\b)</string>
<key>patterns</key>
<array>
<dict>
Expand Down Expand Up @@ -3566,7 +3570,7 @@
<key>begin</key>
<string>(?=\s)</string>
<key>end</key>
<string>(?=[)}\];:?=&amp;|^]|!=|\b(and|or|when)\b)</string>
<string>(?=[)}\],;:?=&amp;|^]|!=|\b(and|or|when)\b)</string>
<key>patterns</key>
<array>
<dict>
Expand Down Expand Up @@ -3594,7 +3598,7 @@
<key>begin</key>
<string>(?=\()</string>
<key>end</key>
<string>(?=[)}\];:?=&amp;|^]|!=|\b(and|or|when)\b)</string>
<string>(?=[)}\],;:?=&amp;|^]|!=|\b(and|or|when)\b)</string>
<key>patterns</key>
<array>
<dict>
Expand Down Expand Up @@ -3634,7 +3638,7 @@
<key>begin</key>
<string>(?&lt;=\))</string>
<key>end</key>
<string>(?=[)}\];:?=&amp;|^]|!=|\b(and|or|when)\b)</string>
<string>(?=[)}\],;:?=&amp;|^]|!=|\b(and|or|when)\b)</string>
<key>patterns</key>
<array>
<dict>
Expand All @@ -3658,7 +3662,7 @@
<key>begin</key>
<string>(?={)</string>
<key>end</key>
<string>(?=[)}\];:?=&amp;|^]|!=|\b(and|or|when)\b)</string>
<string>(?=[)}\],;:?=&amp;|^]|!=|\b(and|or|when)\b)</string>
<key>patterns</key>
<array>
<dict>
Expand Down Expand Up @@ -3698,7 +3702,7 @@
<key>begin</key>
<string>(?&lt;=\})</string>
<key>end</key>
<string>(?=[)}\];:?=&amp;|^]|!=|\b(and|or|when)\b)</string>
<string>(?=[)}\],;:?=&amp;|^]|!=|\b(and|or|when)\b)</string>
<key>patterns</key>
<array>
<dict>
Expand Down Expand Up @@ -3756,7 +3760,7 @@
<key>begin</key>
<string>(?=\[)</string>
<key>end</key>
<string>(?=[)}\];:?=&amp;|^]|!=|\b(and|or|when)\b)</string>
<string>(?=[)}\],;:?=&amp;|^]|!=|\b(and|or|when)\b)</string>
<key>patterns</key>
<array>
<dict>
Expand Down Expand Up @@ -3796,7 +3800,7 @@
<key>begin</key>
<string>(?&lt;=\])</string>
<key>end</key>
<string>(?=[)}\];:?=&amp;|^]|!=|\b(and|or|when)\b)</string>
<string>(?=[)}\],;:?=&amp;|^]|!=|\b(and|or|when)\b)</string>
<key>patterns</key>
<array>
<dict>
Expand Down Expand Up @@ -6156,6 +6160,32 @@
</dict>
</dict>
</dict>
<key>assignment-expression</key>
<dict>
<key>begin</key>
<string>(=)(?!=|&gt;)</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>keyword.operator.assignment.cs</string>
</dict>
</dict>
<key>end</key>
<string>(?=[,\)\];}])</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#ref-modifier</string>
</dict>
<dict>
<key>include</key>
<string>#expression</string>
</dict>
</array>
</dict>
<key>expression-operators</key>
<dict>
<key>patterns</key>
Expand Down
41 changes: 29 additions & 12 deletions grammars/csharp.tmLanguage.cson
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,9 @@ repository:
{
include: "#conditional-operator"
}
{
include: "#assignment-expression"
}
{
include: "#expression-operators"
}
Expand Down Expand Up @@ -2042,7 +2045,7 @@ repository:
beginCaptures:
"1":
name: "keyword.other.is.cs"
end: "(?=[)}\\];:?=&|^]|!=)"
end: "(?=[)}\\],;:?=&|^]|!=)"
patterns: [
{
include: "#pattern"
Expand Down Expand Up @@ -2119,7 +2122,7 @@ repository:
beginCaptures:
"0":
name: "keyword.operator.relational.cs"
end: "(?=[)}\\];:?=&|^]|!=|\\b(and|or|when)\\b)"
end: "(?=[)}\\],;:?=&|^]|!=|\\b(and|or|when)\\b)"
patterns: [
{
include: "#expression"
Expand All @@ -2130,7 +2133,7 @@ repository:
beginCaptures:
"1":
name: "keyword.other.var.cs"
end: "(?=[)}\\];:?=&|^]|!=|\\b(and|or|when)\\b)"
end: "(?=[)}\\],;:?=&|^]|!=|\\b(and|or|when)\\b)"
patterns: [
{
include: "#designation-pattern"
Expand Down Expand Up @@ -2175,11 +2178,11 @@ repository:
]
"type-pattern":
begin: "(?=@?[_[:alpha:]][_[:alnum:]]*)"
end: "(?=[)}\\];:?=&|^]|!=|\\b(and|or|when)\\b)"
end: "(?=[)}\\],;:?=&|^]|!=|\\b(and|or|when)\\b)"
patterns: [
{
begin: "\\G"
end: "(?=\\s|[)}\\];:?=&|^]|!=|\\b(and|or|when)\\b)"
end: "(?=\\s|[)}\\],;:?=&|^]|!=|\\b(and|or|when)\\b)"
patterns: [
{
include: "#type-builtin"
Expand All @@ -2200,7 +2203,7 @@ repository:
}
{
begin: "(?=\\s)"
end: "(?=[)}\\];:?=&|^]|!=|\\b(and|or|when)\\b)"
end: "(?=[)}\\],;:?=&|^]|!=|\\b(and|or|when)\\b)"
patterns: [
{
include: "#intrusive"
Expand All @@ -2219,7 +2222,7 @@ repository:
]
"positional-pattern":
begin: "(?=\\()"
end: "(?=[)}\\];:?=&|^]|!=|\\b(and|or|when)\\b)"
end: "(?=[)}\\],;:?=&|^]|!=|\\b(and|or|when)\\b)"
patterns: [
{
begin: "\\("
Expand All @@ -2241,7 +2244,7 @@ repository:
}
{
begin: "(?<=\\))"
end: "(?=[)}\\];:?=&|^]|!=|\\b(and|or|when)\\b)"
end: "(?=[)}\\],;:?=&|^]|!=|\\b(and|or|when)\\b)"
patterns: [
{
include: "#intrusive"
Expand All @@ -2257,7 +2260,7 @@ repository:
]
"property-pattern":
begin: "(?={)"
end: "(?=[)}\\];:?=&|^]|!=|\\b(and|or|when)\\b)"
end: "(?=[)}\\],;:?=&|^]|!=|\\b(and|or|when)\\b)"
patterns: [
{
begin: "\\{"
Expand All @@ -2279,7 +2282,7 @@ repository:
}
{
begin: "(?<=\\})"
end: "(?=[)}\\];:?=&|^]|!=|\\b(and|or|when)\\b)"
end: "(?=[)}\\],;:?=&|^]|!=|\\b(and|or|when)\\b)"
patterns: [
{
include: "#intrusive"
Expand Down Expand Up @@ -2314,7 +2317,7 @@ repository:
]
"list-pattern":
begin: "(?=\\[)"
end: "(?=[)}\\];:?=&|^]|!=|\\b(and|or|when)\\b)"
end: "(?=[)}\\],;:?=&|^]|!=|\\b(and|or|when)\\b)"
patterns: [
{
begin: "\\["
Expand All @@ -2336,7 +2339,7 @@ repository:
}
{
begin: "(?<=\\])"
end: "(?=[)}\\];:?=&|^]|!=|\\b(and|or|when)\\b)"
end: "(?=[)}\\],;:?=&|^]|!=|\\b(and|or|when)\\b)"
patterns: [
{
include: "#intrusive"
Expand Down Expand Up @@ -3660,6 +3663,20 @@ repository:
endCaptures:
"0":
name: "punctuation.separator.colon.cs"
"assignment-expression":
begin: "(=)(?!=|>)"
beginCaptures:
"1":
name: "keyword.operator.assignment.cs"
end: "(?=[,\\)\\];}])"
patterns: [
{
include: "#ref-modifier"
}
{
include: "#expression"
}
]
"expression-operators":
patterns: [
{
Expand Down
Loading

0 comments on commit 56a1d58

Please sign in to comment.