@@ -3,6 +3,7 @@ def generateTaggedRawString(name, tag_pattern, inner_pattern, tag_as_meta:false)
3
3
# (because they're part of another language or syntax)
4
4
meta = ""
5
5
meta = "meta." if tag_as_meta
6
+ name = ".#{ name } " if name
6
7
return PatternRange . new (
7
8
start_pattern : Pattern . new (
8
9
match : Pattern . new (
@@ -15,7 +16,7 @@ def generateTaggedRawString(name, tag_pattern, inner_pattern, tag_as_meta:false)
15
16
match : Pattern . new ( ")" ) . then ( tag_pattern ) . then ( /\" / ) ,
16
17
tag_as : "punctuation.definition.string.end"
17
18
) ,
18
- tag_as : meta +"string.quoted.double.raw. #{ name } " ,
19
+ tag_as : meta +"string.quoted.double.raw#{ name } " ,
19
20
includes : [
20
21
inner_pattern ,
21
22
]
@@ -28,7 +29,7 @@ def getRawStringPatterns()
28
29
begin : "((?:u|u8|U|L)?R)\" (?:([^ ()\\ \\ \\ t]{0,16})|([^ ()\\ \\ \\ t]*))\\ (" ,
29
30
beginCaptures : {
30
31
"0" => {
31
- name : "punctuation.definition.string.begin"
32
+ name : "punctuation.definition.string.$2. begin"
32
33
} ,
33
34
"1" => {
34
35
name : "meta.encoding"
@@ -37,30 +38,32 @@ def getRawStringPatterns()
37
38
name : "invalid.illegal.delimiter-too-long"
38
39
}
39
40
} ,
40
- end : "(\\ )\\ 2(\\ 3)\" )(?:((?:[a-zA-Z]|(?:\\ \\ u[0-9a-fA-F]{4}|\\ \\ U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\ \\ u[0-9a-fA-F]{4}|\\ \\ U[0-9a-fA-F]{8}))*)|(_(?:[a-zA-Z0-9_]|(?:\\ \\ u[0-9a-fA-F]{4}|\\ \\ U[0-9a-fA-F]{8}))*))?" ,
41
+ end : "(\\ )( \\ 2) (\\ 3)\" )(?:((?:[a-zA-Z]|(?:\\ \\ u[0-9a-fA-F]{4}|\\ \\ U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\ \\ u[0-9a-fA-F]{4}|\\ \\ U[0-9a-fA-F]{8}))*)|(_(?:[a-zA-Z0-9_]|(?:\\ \\ u[0-9a-fA-F]{4}|\\ \\ U[0-9a-fA-F]{8}))*))?" ,
41
42
endCaptures : {
42
43
"1" => {
43
- name : "punctuation.definition.string.end"
44
+ name : "punctuation.definition.string.$2. end"
44
45
} ,
45
- "2 " => {
46
+ "3 " => {
46
47
name : "invalid.illegal.delimiter-too-long"
47
48
} ,
48
- "3 " => {
49
+ "4 " => {
49
50
name : "keyword.other.suffix.literal.user-defined.reserved.string.cpp"
50
51
} ,
51
- "4 " => {
52
+ "5 " => {
52
53
name : "keyword.other.suffix.literal.user-defined.string.cpp"
53
54
} ,
54
55
} ,
55
- name : "string.quoted.double.raw"
56
+ name : "string.quoted.double.raw.$2 "
56
57
)
57
58
regex = generateTaggedRawString ( "regex" , Pattern . new ( /_r/ ) . or ( /re/ ) . or ( /regex/ ) , "source.regexp.python" )
58
59
sql = generateTaggedRawString ( "sql" , Pattern . new ( /[pP]?(?:sql|SQL)/ ) . or ( /d[dm]l/ ) , "source.sql" , tag_as_meta : true )
59
60
glsl = generateTaggedRawString ( "glsl" , Pattern . new ( /glsl/ ) . or ( /GLSL/ ) , "source.glsl" , tag_as_meta : true )
61
+ plain = generateTaggedRawString ( nil , Pattern . new ( // ) , "" , tag_as_meta : false )
60
62
return [
61
63
regex ,
62
64
glsl ,
63
65
sql ,
66
+ plain ,
64
67
default ,
65
68
]
66
69
end
0 commit comments