Skip to content

Commit ed970ee

Browse files
Reordering triple quotes string to be evaluated first for groovy syntax (zyedidia#3858)
1 parent 4d95f5f commit ed970ee

File tree

1 file changed

+19
-21
lines changed

1 file changed

+19
-21
lines changed

runtime/syntax/groovy.yaml

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -43,27 +43,6 @@ rules:
4343
# Annotations
4444
- identifier: "@[A-Za-z_$][A-Za-z0-9_$]*\\b"
4545

46-
# Single-quoted strings
47-
- constant.string:
48-
start: "'"
49-
end: "'"
50-
skip: "\\\\."
51-
rules:
52-
- constant.specialChar: "\\\\([\"'bfnrst\\x24\\\\]|u[a-fA-F0-9]{4})"
53-
54-
# This also matches the Triple-double-quoted strings region, but I can't really find a way to mitigate it, all the while still matching "" as a string correctly
55-
# Also, nesting ${} are never going to be matched correctly with just regex either, so highlighting will break if one is to nest interpolation
56-
# These two problems combined mean slight mistakes in highlighing that the user is just going to have to deal with
57-
# Double-quoted strings
58-
- constant.string:
59-
start: "\""
60-
end: "\""
61-
skip: "\\\\."
62-
rules:
63-
- constant.specialChar: "\\\\([\"'bfnrst\\x24\\\\]|u[a-fA-F0-9]{4})"
64-
- identifier.var: "\\x24[\\w\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF\u0100-\uFFFE]+([.][a-zA-Z0-9_\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF\u0100-\uFFFE]+)*"
65-
- identifier: "\\x24[{].*[}]"
66-
6746
# Triple-double-quoted strings
6847
- constant.string:
6948
start: "\"\"\""
@@ -85,6 +64,25 @@ rules:
8564
rules:
8665
- constant.specialChar: "\\\\([\"'bfnrst\\x24\\\\]|u[a-fA-F0-9]{4})"
8766

67+
# Nesting ${} are never going to be matched correctly with just regex either, so highlighting will break if one is to nest interpolation
68+
# Double-quoted strings
69+
- constant.string:
70+
start: "\""
71+
end: "\""
72+
skip: "\\\\."
73+
rules:
74+
- constant.specialChar: "\\\\([\"'bfnrst\\x24\\\\]|u[a-fA-F0-9]{4})"
75+
- identifier.var: "\\x24[\\w\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF\u0100-\uFFFE]+([.][a-zA-Z0-9_\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF\u0100-\uFFFE]+)*"
76+
- identifier: "\\x24[{].*[}]"
77+
78+
# Single-quoted strings
79+
- constant.string:
80+
start: "'"
81+
end: "'"
82+
skip: "\\\\."
83+
rules:
84+
- constant.specialChar: "\\\\([\"'bfnrst\\x24\\\\]|u[a-fA-F0-9]{4})"
85+
8886
# Slashy strings are left out, because they match in unwanted places pretty much all the time
8987
# Dollar-slashy strings
9088
- constant.string:

0 commit comments

Comments
 (0)