Skip to content

Commit e33f321

Browse files
authored
Added style statement + other fixes (#337)
- Added low level patterns based on the official grammar specification - Added style statement support with all the currently known properties - Fixed python functions being parsed as variables - Improved parsing of the following statements: - pause - conditionals (if/elif/else) - at - as - with - behind - onlayer - zorder - Improved screen language support slightly (WIP!)
1 parent 7021943 commit e33f321

File tree

5 files changed

+224
-51
lines changed

5 files changed

+224
-51
lines changed

examples/unit_test.rpy

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,6 +1199,14 @@
11991199
translate piglatin python:
12001200
style.default.font = "stonecutter.ttf"
12011201

1202+
old "These two lines will be combined together to form a long line.\n\nThis line will be separate."
1203+
new _p("""
1204+
These two lines will be combined together
1205+
to form a long line. Bork bork bork.
1206+
1207+
This line will be separate. Bork bork bork.
1208+
""")
1209+
12021210
frame:
12031211
style_prefix "pref"
12041212
has vbox
@@ -1214,13 +1222,7 @@
12141222
This line will be separate.
12151223
""")
12161224

1217-
old "These two lines will be combined together to form a long line.\n\nThis line will be separate."
1218-
new _p("""
1219-
These two lines will be combined together
1220-
to form a long line. Bork bork bork.
1221-
1222-
This line will be separate. Bork bork bork.
1223-
""")
1225+
12241226

12251227
#endregion Translation
12261228

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "languague-renpy",
33
"displayName": "Ren'Py Language",
44
"description": "Adds rich support for the Ren'Py programming language to Visual Studio Code.",
5-
"version": "2.3.2",
5+
"version": "2.3.3",
66
"publisher": "LuqueDaniel",
77
"license": "MIT",
88
"homepage": "https://github.com/LuqueDaniel/vscode-language-renpy",

syntaxes/renpy.python.tmLanguage.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -260,20 +260,19 @@
260260
},
261261
"member-access": {
262262
"name": "meta.member.access.python",
263-
"contentName": "variable.name.python",
264263
"begin": "(\\.)\\s*(?!\\.)",
265-
"end": "(?<=\\S)(?=\\W)|(^|(?<=\\s))(?=[^\\\\\\w\\s])|$",
266264
"beginCaptures": {
267265
"1": { "name": "punctuation.separator.period.python" }
268266
},
267+
"end": "(?<=\\S)(?=\\W)|(^|(?<=\\s))(?=[^\\\\\\w\\s])|$",
269268
"patterns": [{ "include": "#function-call" }, { "include": "#member-access-base" }, { "include": "#member-access-attribute" }]
270269
},
271270
"member-access-base": {
272271
"patterns": [{ "include": "#magic-names" }, { "include": "#illegal-names" }, { "include": "#illegal-object-name" }, { "include": "#special-names" }, { "include": "#line-continuation" }, { "include": "#item-access" }]
273272
},
274273
"member-access-attribute": {
275274
"comment": "Highlight attribute access in otherwise non-specialized cases.",
276-
"name": "meta.attribute.python",
275+
"name": "variable.name.python meta.attribute.python",
277276
"match": "\\b([[:alpha:]_]\\w*)\\b"
278277
},
279278
"special-names": {
@@ -868,7 +867,7 @@
868867
"item-access": {
869868
"patterns": [
870869
{
871-
"name": "meta.item-access.python",
870+
"name": "variable.name.python meta.item-access.python",
872871
"begin": "\\b(?=[[:alpha:]_]\\w*\\s*\\[)",
873872
"end": "(\\])",
874873
"endCaptures": {
@@ -967,7 +966,7 @@
967966
{ "include": "#builtin-possible-callables" },
968967
{
969968
"comment": "Some color schemas support meta.function-call.generic scope",
970-
"name": "meta.function-call.generic.python",
969+
"name": "entity.name.function.call.python meta.function-call.generic.python",
971970
"match": "\\b([[:alpha:]_]\\w*)\\b"
972971
}
973972
]

syntaxes/renpy.screen.tmLanguage.json

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
]
2626
},
2727
"screen-build-in-properties": {
28-
"comment": "https://www.renpy.org/doc/html/atl.html#list-of-transform-properties",
28+
"comment": "These are the ATL keywords, will need to fix this later",
2929
"patterns": [
3030
{
3131
"comment": "Special manipulation keywords",
@@ -37,6 +37,18 @@
3737
"4": { "name": "keyword.counterclockwise.renpy" }
3838
}
3939
},
40+
{
41+
"comment": "Special manipulation keywords",
42+
"match": "\\b(?<!\\.)(key|input|(image)?button|grid|auto|mousearea|side|timer|[vh]?bar|viewport|scrollbars|mousewheel|vpgrid|imagemap)\\b",
43+
"captures": {
44+
"1": { "name": "keyword.other.screen.renpy" }
45+
}
46+
},
47+
{
48+
"comment": "Random props",
49+
"name": "entity.name.tag.css.transform.renpy",
50+
"match": "\\b(?<!\\.)(?:[xy]padding|area|(un)?hovered|draggable|cols|spacing|side_[xy]align)\\b"
51+
},
4052
{
4153
"comment": "position props (int, absolute, or a float)",
4254
"name": "entity.name.tag.css.transform.renpy",
@@ -248,7 +260,7 @@
248260
"3": { "name": "punctuation.section.block.begin.renpy" }
249261
},
250262
"end": "^(?=(?!\\1)[ \\t]*[^\\s#]|\\1[^\\s#])",
251-
"patterns": [{ "include": "source.renpy.atl#atl" }]
263+
"patterns": [{ "include": "#screen-language" }]
252264
},
253265
"screen": {
254266
"patterns": [
@@ -278,6 +290,7 @@
278290
"screen-language": {
279291
"comment": "https://www.renpy.org/doc/html/screens.html#screen-language",
280292
"patterns": [
293+
{ "include": "source.renpy#conditionals" },
281294
{ "include": "#screen-frame" },
282295
{ "include": "#screen-window" },
283296
{ "include": "#screen-box" },

0 commit comments

Comments
 (0)