diff --git a/grammars/renpy.grammar.ebnf b/grammars/renpy.grammar.ebnf index a1a587ee..40df8e9b 100644 --- a/grammars/renpy.grammar.ebnf +++ b/grammars/renpy.grammar.ebnf @@ -83,7 +83,7 @@ STYLE_PROPERTY = "activate_sound" | "adjust_spacing" | "aft_bar" | "aft_gutter" | "thumb" | "thumb_offset" | "thumb_shadow" | "time_policy" | "top_bar" | "top_gutter" | "top_margin" | "top_padding" | "underline" | "unscrollable" | "vertical" | "xalign" | "xanchor" | "xcenter" | "xfill" | "xfit" | "xmargin" | "xmaximum" | "xminimum" | "xoffset" | "xpadding" | "xpos" | "xsize" | "xspacing" | "xysize" | "yalign" | "yanchor" | "ycenter" | "yfill" | "yfit" | "ymargin" | "ymaximum" | "yminimum" | "yoffset" | "ypadding" | "ypos" | "ysize" | "yspacing"; -STYLE_PROPERTY_NAME = STYLE_PROPERTY_PREFIX?, STYLE_PROPERTY; +STYLE_PROPERTY_NAME = "properties" | (STYLE_PROPERTY_PREFIX?, STYLE_PROPERTY); PYTHON_EXPRESSION = ? any valid Python expression ?; PYTHON_STRING = ? python string ?; diff --git a/package.json b/package.json index f2effc40..c3119ccb 100644 --- a/package.json +++ b/package.json @@ -74,6 +74,10 @@ "scopeName": "source.renpy.screen", "path": "./syntaxes/renpy.screen.tmLanguage.json" }, + { + "scopeName": "source.renpy.style", + "path": "./syntaxes/renpy.style.tmLanguage.json" + }, { "scopeName": "source.renpy.atl", "path": "./syntaxes/renpy.atl.tmLanguage.json" diff --git a/syntaxes/renpy.style.tmLanguage.json b/syntaxes/renpy.style.tmLanguage.json new file mode 100644 index 00000000..97cab44b --- /dev/null +++ b/syntaxes/renpy.style.tmLanguage.json @@ -0,0 +1,112 @@ +{ + "information_for_contributors": [ "Please remember to regenerate the ts token patterns using the 'syntax-to-token-pattern.py' python script" ], + "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", + "name": "Ren'Py Style", + "scopeName": "source.renpy.style", + "patterns": [ { "include": "#style" } ], + "repository": { + "style-block-tester": { + "patterns": [ + { + "contentName": "meta.style-block.renpy", + "begin": "(?<=(^[ \\t]*)(?:style)\\b.*?)(:)", + "beginCaptures": { + "2": { "name": "punctuation.section.style.begin.renpy" } + }, + "end": "^(?=(?!\\1)[ \\t]*[^\\s#]|\\1[^\\s#])", + "patterns": [ + { "include": "#style-clause" }, + { "include": "source.renpy#fallback-patterns" } + ] + } + ] + }, + + "style-property": { + "patterns": [ + { + "comment": "ON EDIT: If you update this list, also update it in style-clause", + "name": "support.constant.property-key.test.renpy entity.name.tag.css.style.renpy", + "match": "\\b(?