|
7 | 7 | "repository": {
|
8 | 8 | "atl": {
|
9 | 9 | "comment": "https://www.renpy.org/doc/html/atl.html#atl-syntax-and-semantics",
|
10 |
| - "patterns": [{ "include": "#atl-keywords" }, { "include": "#atl-blocks" }, { "include": "#atl-simple-expression" }, { "include": "#atl-warper" }, { "include": "#atl-event" }, { "include": "#atl-on" }, { "include": "#atl-function" }] |
| 10 | + "patterns": [ |
| 11 | + { "include": "source.renpy#conditionals" }, |
| 12 | + { "include": "#atl-keywords" }, |
| 13 | + { "include": "#atl-warper" }, |
| 14 | + { "include": "#atl-blocks" }, |
| 15 | + { "include": "#atl-simple-expression" }, |
| 16 | + { "include": "#atl-event" }, |
| 17 | + { "include": "#atl-on" }, |
| 18 | + { "include": "#atl-function" }, |
| 19 | + { "include": "#atl-fallback" } |
| 20 | + ] |
11 | 21 | },
|
12 | 22 | "atl-build-in-properties": {
|
13 | 23 | "comment": "https://www.renpy.org/doc/html/atl.html#list-of-transform-properties",
|
|
24 | 34 | },
|
25 | 35 | {
|
26 | 36 | "comment": "position props (int, absolute, or a float)",
|
27 |
| - "name": "support.type.property-name.transform.renpy", |
| 37 | + "name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy", |
28 | 38 | "match": "\\b(?<!\\.)(?:xpos|ypos|xanchor|yanchor|xcenter|ycenter|radius)\\b"
|
29 | 39 | },
|
30 | 40 | {
|
31 | 41 | "comment": "position pair props",
|
32 |
| - "name": "support.type.property-name.transform.renpy", |
| 42 | + "name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy", |
33 | 43 | "match": "\\b(?<!\\.)(?:pos|anchor|xycenter|around|alignaround|matrixanchor)\\b"
|
34 | 44 | },
|
35 | 45 | {
|
36 | 46 | "comment": "float props",
|
37 |
| - "name": "support.type.property-name.transform.renpy", |
| 47 | + "name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy", |
38 | 48 | "match": "\\b(?<!\\.)(?:xalign|yalign|zoom|xzoom|yzoom|alpha|additive|angle|delay|events|zpos)\\b"
|
39 | 49 | },
|
40 | 50 | {
|
41 | 51 | "comment": "float pair props",
|
42 |
| - "name": "support.type.property-name.transform.renpy", |
| 52 | + "name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy", |
43 | 53 | "match": "\\b(?<!\\.)(?:align|knot)\\b"
|
44 | 54 | },
|
45 | 55 | {
|
46 | 56 | "comment": "int props",
|
47 |
| - "name": "support.type.property-name.transform.renpy", |
| 57 | + "name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy", |
48 | 58 | "match": "\\b(?<!\\.)(?:xoffset|yoffset|xtile|ytile)\\b"
|
49 | 59 | },
|
50 | 60 | {
|
51 | 61 | "comment": "int pair props",
|
52 |
| - "name": "support.type.property-name.transform.renpy", |
| 62 | + "name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy", |
53 | 63 | "match": "\\b(?<!\\.)(?:offset)\\b"
|
54 | 64 | },
|
55 | 65 | {
|
56 | 66 | "comment": "boolean props",
|
57 |
| - "name": "support.type.property-name.transform.renpy", |
| 67 | + "name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy", |
58 | 68 | "match": "\\b(?<!\\.)(?:rotate_pad|transform_anchor|nearest|crop_relative|subpixel|zzoom)\\b"
|
59 | 69 | },
|
60 | 70 | {
|
61 | 71 | "comment": "('#float' | None)",
|
62 |
| - "name": "support.type.property-name.transform.renpy", |
| 72 | + "name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy", |
63 | 73 | "match": "\\b(?<!\\.)(?:rotate|xpan|ypan|blur)\\b"
|
64 | 74 | },
|
65 | 75 | {
|
66 | 76 | "comment": "('#position' | None)",
|
67 |
| - "name": "support.type.property-name.transform.renpy", |
| 77 | + "name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy", |
68 | 78 | "match": "\\b(?<!\\.)(?:xsize|ysize)\\b"
|
69 | 79 | },
|
70 | 80 | {
|
71 | 81 | "comment": "('\\(int, int, int, int\\)' | '\\(float, float, float, float\\)' | None)",
|
72 |
| - "name": "support.type.property-name.transform.renpy", |
| 82 | + "name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy", |
73 | 83 | "match": "\\b(?<!\\.)(?:crop)\\b"
|
74 | 84 | },
|
75 | 85 | {
|
76 | 86 | "comment": "('\\(int, int\\)' | None)",
|
77 |
| - "name": "support.type.property-name.transform.renpy", |
| 87 | + "name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy", |
78 | 88 | "match": "\\b(?<!\\.)(?:corner1|corner2)\\b"
|
79 | 89 | },
|
80 | 90 | {
|
81 | 91 | "comment": "('\\(position, position\\)' | None)",
|
82 |
| - "name": "support.type.property-name.transform.renpy", |
| 92 | + "name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy", |
83 | 93 | "match": "\\b(?<!\\.)(?:xysize)\\b"
|
84 | 94 | },
|
85 | 95 | {
|
86 | 96 | "comment": "('#string' | None)",
|
87 |
| - "name": "support.type.property-name.transform.renpy", |
| 97 | + "name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy", |
88 | 98 | "match": "\\b(?<!\\.)(?:fit)\\b"
|
89 | 99 | },
|
90 | 100 | {
|
|
94 | 104 | },
|
95 | 105 | {
|
96 | 106 | "comment": "('#Matrix' | '#MatrixColor' | None)",
|
97 |
| - "name": "support.type.property-name.transform.renpy", |
| 107 | + "name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy", |
98 | 108 | "match": "\\b(?<!\\.)(?:matrixcolor)\\b"
|
99 | 109 | },
|
100 | 110 | {
|
101 | 111 | "comment": "('#Matrix' | '#TransformMatrix' | None)",
|
102 |
| - "name": "support.type.property-name.transform.renpy", |
| 112 | + "name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy", |
103 | 113 | "match": "\\b(?<!\\.)(?:matrixtransform)\\b"
|
104 | 114 | },
|
105 | 115 | {
|
106 | 116 | "comment": "('#bool' | '#float' | '\\(float, float, float\\)')",
|
107 |
| - "name": "support.type.property-name.transform.renpy", |
| 117 | + "name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy", |
108 | 118 | "match": "\\b(?<!\\.)(?:perspective)\\b"
|
109 | 119 | }
|
110 | 120 | ]
|
111 | 121 | },
|
112 | 122 | "atl-simple-expression": {
|
113 | 123 | "patterns": [
|
114 |
| - { "include": "source.renpy#expressions" }, |
| 124 | + { "include": "source.renpy#renpy-only-expressions" }, |
115 | 125 | { "include": "#atl-build-in-properties" },
|
116 |
| - { "include": "source.renpy.python#literal" }, |
117 | 126 | { "include": "source.renpy.python#member-access" },
|
118 | 127 | { "include": "source.renpy.python#illegal-operator" },
|
119 | 128 | { "include": "source.renpy.python#operator" },
|
|
132 | 141 | { "include": "source.renpy.python#special-variables" },
|
133 | 142 | { "include": "source.renpy.python#ellipsis" },
|
134 | 143 | { "include": "source.renpy.python#punctuation" },
|
135 |
| - { "include": "source.renpy.python#line-continuation" } |
| 144 | + { "include": "source.renpy.python#line-continuation" }, |
| 145 | + { |
| 146 | + "comment": "Tokenize identifiers", |
| 147 | + "name": "variable.name.python", |
| 148 | + "match": "\\b([[:alpha:]_]\\w*)\\b" |
| 149 | + }, |
| 150 | + { "include": "source.renpy#whitespace" } |
136 | 151 | ]
|
137 | 152 | },
|
138 | 153 | "atl-expression": {
|
|
196 | 211 | },
|
197 | 212 | "end": "$",
|
198 | 213 | "patterns": [{ "include": "#atl-expression" }]
|
| 214 | + }, |
| 215 | + { |
| 216 | + "comment": "TODO: This is a temporary include until we have proper support for all ATL keywords", |
| 217 | + "include": "source.renpy#keywords" |
199 | 218 | }
|
200 | 219 | ]
|
201 | 220 | },
|
|
240 | 259 | { "include": "source.renpy.python#builtin-possible-callables" },
|
241 | 260 | { "include": "#atl-build-in-events" },
|
242 | 261 | {
|
243 |
| - "name": "entity.name.function.renpy meta.function-call.generic.renpy", |
| 262 | + "name": "entity.name.function.event.renpy meta.function-call.generic.renpy", |
244 | 263 | "match": "\\b([[:alpha:]_]\\w*)\\b"
|
245 | 264 | }
|
246 | 265 | ]
|
|
250 | 269 | { "include": "source.renpy.python#builtin-possible-callables" },
|
251 | 270 | { "include": "#atl-build-in-events" },
|
252 | 271 | {
|
253 |
| - "name": "entity.name.function.renpy", |
| 272 | + "name": "entity.name.function.event.def.renpy", |
254 | 273 | "match": "\\b([[:alpha:]_]\\w*)\\b"
|
255 | 274 | }
|
256 | 275 | ]
|
|
296 | 315 | "patterns": [
|
297 | 316 | { "include": "source.renpy.python#builtin-possible-callables" },
|
298 | 317 | {
|
299 |
| - "name": "entity.name.function.renpy meta.function-call.generic.renpy", |
| 318 | + "name": "entity.name.function.atl-function.renpy meta.function-call.generic.renpy", |
300 | 319 | "match": "\\b([[:alpha:]_]\\w*)\\b"
|
301 | 320 | }
|
302 | 321 | ]
|
|
314 | 333 | { "include": "#atl-build-in-warpers" },
|
315 | 334 | { "include": "#atl-build-in-properties" },
|
316 | 335 | {
|
317 |
| - "name": "entity.name.function.renpy meta.function-call.generic.renpy", |
| 336 | + "name": "entity.name.function.warper.renpy meta.function-call.generic.renpy", |
318 | 337 | "match": "\\b([[:alpha:]_]\\w*)\\b"
|
319 | 338 | }
|
320 | 339 | ]
|
321 | 340 | },
|
| 341 | + "atl-warper-broken": { |
| 342 | + "comment": "TODO: This doesn't work right now, we can't assume all identifiers are warpers", |
| 343 | + "name": "meta.atl.warper.renpy", |
| 344 | + "begin": "(?<=^[ \\t]*)([[:alpha:]_]\\w*)\\b", |
| 345 | + "beginCaptures": { |
| 346 | + "1": { "patterns": [{ "include": "#atl-warper-name" }] } |
| 347 | + }, |
| 348 | + "end": "(?=[ \\t]*#)|$", |
| 349 | + "patterns": [{ "include": "#atl-simple-expression" }] |
| 350 | + }, |
| 351 | + |
322 | 352 | "atl-warper": {
|
323 |
| - "comment": "https://www.renpy.org/doc/html/atl.html#warpers", |
| 353 | + "comment": "(TODO: For now we only support build-in warper highlighting) https://www.renpy.org/doc/html/atl.html#warpers", |
324 | 354 | "name": "meta.atl.warper.renpy",
|
325 |
| - "begin": "\\b(?<!\\.)([[:alpha:]_]\\w*)\\b[ \\t]*", |
| 355 | + "begin": "(?<=^[ \\t]*)(linear|ease|easein|easeout|ease_back|ease_bounce|ease_circ|ease_cubic|ease_elastic|ease_expo|ease_quad|ease_quart|ease_quint|easein_back|easein_bounce|easein_circ|easein_cubic|easein_elastic|easein_expo|easein_quad|easein_quart|easein_quint|easeout_back|easeout_bounce|easeout_circ|easeout_cubic|easeout_elastic|easeout_expo|easeout_quad|easeout_quart|easeout_quint)\\b", |
326 | 356 | "beginCaptures": {
|
327 | 357 | "1": { "patterns": [{ "include": "#atl-warper-name" }] }
|
328 | 358 | },
|
329 |
| - "end": "(?!\\G)", |
| 359 | + "end": "(?=[ \\t]*#)|$", |
330 | 360 | "patterns": [{ "include": "#atl-simple-expression" }]
|
| 361 | + }, |
| 362 | + |
| 363 | + "atl-fallback": { |
| 364 | + "comment": "TODO: This is a temp fix for missing pattern references", |
| 365 | + "patterns": [{ "include": "source.renpy" }] |
| 366 | + }, |
| 367 | + |
| 368 | + "transform": { |
| 369 | + "contentName": "meta.transform.block.renpy", |
| 370 | + "begin": "^([ \\t]+)?(transform)\\b[ \\t]*(.*)?(:)", |
| 371 | + "beginCaptures": { |
| 372 | + "1": { "name": "punctuation.whitespace.leading.renpy" }, |
| 373 | + "2": { "name": "keyword.transform.renpy" }, |
| 374 | + "3": { |
| 375 | + "patterns": [ |
| 376 | + { |
| 377 | + "name": "variable.name.transform.renpy", |
| 378 | + "match": "\\b([[:alpha:]_]\\w*)\\b" |
| 379 | + } |
| 380 | + ] |
| 381 | + }, |
| 382 | + "4": { "name": "punctuation.section.atl.begin.renpy" } |
| 383 | + }, |
| 384 | + "end": "^(?=(?!\\1)[ \\t]*[^\\s#]|\\1[^\\s#])", |
| 385 | + "patterns": [{ "include": "#atl" }] |
331 | 386 | }
|
332 | 387 | }
|
333 | 388 | }
|
0 commit comments