Skip to content

Commit

Permalink
Merge pull request #432 from renpy/improved-syntax-highlighting
Browse files Browse the repository at this point in the history
Improved syntax highlighting
  • Loading branch information
duckdoom4 authored Aug 7, 2024
2 parents 12c3817 + 1f76268 commit d241589
Show file tree
Hide file tree
Showing 6 changed files with 334 additions and 140 deletions.
45 changes: 23 additions & 22 deletions examples/unit_test.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@
show eileen
with dissolve

"Without window auto show, the window would have been shown here."
"Without window auto show, the window would have been shown here." (what_color="#8c8")

$ e("Hello, world.", interact=True)
define character.e = Character("Eileen")
Expand Down Expand Up @@ -922,7 +922,7 @@
voice "l02.ogg"
l "Wait... that means they can mute me as well! Really?"

config.auto_voice = "voice/{id}.ogg"
$ config.auto_voice = "voice/{id}.ogg"
#endregion Voice

#endregion
Expand Down Expand Up @@ -1209,14 +1209,15 @@
This line will be separate. Bork bork bork.
""")

screen my_screen:
frame:
style_prefix "pref"
has vbox

frame:
style_prefix "pref"
has vbox

label _("Language")
textbutton "English" action Language(None)
textbutton "Igpay Atinlay" action Language("piglatin")
label _("Language")
textbutton "English" action Language(None)
textbutton "Igpay Atinlay" action Language("piglatin")

define config.about = _p("""
These two lines will be combined together
Expand Down Expand Up @@ -1866,7 +1867,7 @@
image big hello world = Text("Hello, World", size=40)

screen big_hello_world:
text "Hello, World" size 40
text "Hello, World" size 40

image big hello world = Text("Hello World", style="big")

Expand Down Expand Up @@ -3359,27 +3360,27 @@
on "replaced" action Play("music", "track1.ogg")
textbutton "Music Room" action ShowMenu("music_room")

"And finally, I met the wizard himself."
"And finally, I met the wizard himself."

label meaning_of_life:
label meaning_of_life:

scene
scene

"Mage" "What is the meaning of life, you say?"
"Mage" "What is the meaning of life, you say?"

"Mage" "I've thought about it long and hard. A long time, I've
spent pondering that very thing."
"Mage" "I've thought about it long and hard. A long time, I've
spent pondering that very thing."

"Mage" "And I'll say - the answer - the meaning of life
itself..."
"Mage" "And I'll say - the answer - the meaning of life
itself..."

"Mage" "Is forty-three."
"Mage" "Is forty-three."

$ renpy.end_replay()
$ renpy.end_replay()

"Mage" "Something like that, anyway."
"Mage" "Something like that, anyway."

textbutton "The meaning of life" action Replay("meaning_of_life")
textbutton "The meaning of life" action Replay("meaning_of_life")

#endregion Image Gallery, Music Room, and Replay Actions

Expand Down
41 changes: 21 additions & 20 deletions syntaxes/renpy.atl.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,67 +33,67 @@
},
{
"comment": "position props (int, absolute, or a float)",
"name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy",
"name": "entity.other.attribute-name.atl.renpy support.type.property-name.atl.renpy entity.name.tag.css.atl.renpy",
"match": "\\b(?<!\\.)(?:xpos|ypos|xanchor|yanchor|xcenter|ycenter|radius)\\b"
},
{
"comment": "position pair props",
"name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy",
"name": "entity.other.attribute-name.atl.renpy support.type.property-name.atl.renpy entity.name.tag.css.atl.renpy",
"match": "\\b(?<!\\.)(?:pos|anchor|xycenter|around|alignaround|matrixanchor)\\b"
},
{
"comment": "float props",
"name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy",
"name": "entity.other.attribute-name.atl.renpy support.type.property-name.atl.renpy entity.name.tag.css.atl.renpy",
"match": "\\b(?<!\\.)(?:xalign|yalign|zoom|xzoom|yzoom|alpha|additive|angle|delay|events|zpos)\\b"
},
{
"comment": "float pair props",
"name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy",
"name": "entity.other.attribute-name.atl.renpy support.type.property-name.atl.renpy entity.name.tag.css.atl.renpy",
"match": "\\b(?<!\\.)(?:align|knot)\\b"
},
{
"comment": "int props",
"name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy",
"name": "entity.other.attribute-name.atl.renpy support.type.property-name.atl.renpy entity.name.tag.css.atl.renpy",
"match": "\\b(?<!\\.)(?:xoffset|yoffset|xtile|ytile)\\b"
},
{
"comment": "int pair props",
"name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy",
"name": "entity.other.attribute-name.atl.renpy support.type.property-name.atl.renpy entity.name.tag.css.atl.renpy",
"match": "\\b(?<!\\.)(?:offset)\\b"
},
{
"comment": "boolean props",
"name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy",
"name": "entity.other.attribute-name.atl.renpy support.type.property-name.atl.renpy entity.name.tag.css.atl.renpy",
"match": "\\b(?<!\\.)(?:rotate_pad|transform_anchor|nearest|crop_relative|subpixel|zzoom)\\b"
},
{
"comment": "('#float' | None)",
"name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy",
"name": "entity.other.attribute-name.atl.renpy support.type.property-name.atl.renpy entity.name.tag.css.atl.renpy",
"match": "\\b(?<!\\.)(?:rotate|xpan|ypan|blur)\\b"
},
{
"comment": "('#position' | None)",
"name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy",
"name": "entity.other.attribute-name.atl.renpy support.type.property-name.atl.renpy entity.name.tag.css.atl.renpy",
"match": "\\b(?<!\\.)(?:xsize|ysize)\\b"
},
{
"comment": "('\\(int, int, int, int\\)' | '\\(float, float, float, float\\)' | None)",
"name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy",
"name": "entity.other.attribute-name.atl.renpy support.type.property-name.atl.renpy entity.name.tag.css.atl.renpy",
"match": "\\b(?<!\\.)(?:crop)\\b"
},
{
"comment": "('\\(int, int\\)' | None)",
"name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy",
"name": "entity.other.attribute-name.atl.renpy support.type.property-name.atl.renpy entity.name.tag.css.atl.renpy",
"match": "\\b(?<!\\.)(?:corner1|corner2)\\b"
},
{
"comment": "('\\(position, position\\)' | None)",
"name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy",
"name": "entity.other.attribute-name.atl.renpy support.type.property-name.atl.renpy entity.name.tag.css.atl.renpy",
"match": "\\b(?<!\\.)(?:xysize)\\b"
},
{
"comment": "('#string' | None)",
"name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy",
"name": "entity.other.attribute-name.atl.renpy support.type.property-name.atl.renpy entity.name.tag.css.atl.renpy",
"match": "\\b(?<!\\.)(?:fit)\\b"
},
{
Expand All @@ -103,17 +103,17 @@
},
{
"comment": "('#Matrix' | '#MatrixColor' | None)",
"name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy",
"name": "entity.other.attribute-name.atl.renpy support.type.property-name.atl.renpy entity.name.tag.css.atl.renpy",
"match": "\\b(?<!\\.)(?:matrixcolor)\\b"
},
{
"comment": "('#Matrix' | '#TransformMatrix' | None)",
"name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy",
"name": "entity.other.attribute-name.atl.renpy support.type.property-name.atl.renpy entity.name.tag.css.atl.renpy",
"match": "\\b(?<!\\.)(?:matrixtransform)\\b"
},
{
"comment": "('#bool' | '#float' | '\\(float, float, float\\)')",
"name": "support.type.property-name.transform.renpy entity.name.tag.css.transform.renpy",
"name": "entity.other.attribute-name.atl.renpy support.type.property-name.atl.renpy entity.name.tag.css.atl.renpy",
"match": "\\b(?<!\\.)(?:perspective)\\b"
}
]
Expand Down Expand Up @@ -258,7 +258,7 @@
"contentName": "meta.atl.on.parameters.renpy",
"begin": "(?<=^[ \\t]*)(on)\\b[ \\t]*",
"beginCaptures": {
"1": { "name": "keyword.on.renpy" }
"1": { "name": "keyword.control.flow.on.renpy" }
},
"end": "(?=#|:)|$",

Expand Down Expand Up @@ -390,17 +390,18 @@
"transform": {
"name": "meta.transform.statement.renpy",
"contentName": "meta.transform.parameters.renpy",
"begin": "(?<=^[ \\t]*)(transform)\\b[ \\t]*",
"begin": "(?<=^[ \\t]*)(transform)\\b",
"beginCaptures": {
"1": { "name": "keyword.transform.renpy" }
},
"end": "(?=#|:)|$",

"patterns": [
{
"name": "variable.name.transform.renpy",
"name": "entity.name.type.transform.renpy",
"match": "\\b([[:alpha:]_]\\w*)\\b"
}
},
{ "include": "source.renpy#whitespace" }
]
}
}
Expand Down
4 changes: 2 additions & 2 deletions syntaxes/renpy.python.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@
"end": "(,)|(?=:|$)",
"beginCaptures": {
"1": { "name": "variable.parameter.function.language.python" },
"2": { "name": "keyword.operator.python" }
"2": { "name": "keyword.operator.assignment.python" }
},
"endCaptures": {
"1": { "name": "punctuation.separator.parameters.python" }
Expand Down Expand Up @@ -836,7 +836,7 @@
"begin": "(=)",
"end": "(,)|(?=\\))",
"beginCaptures": {
"1": { "name": "keyword.operator.python" }
"1": { "name": "keyword.operator.assignment.python" }
},
"endCaptures": {
"1": { "name": "punctuation.separator.parameters.python" }
Expand Down
Loading

0 comments on commit d241589

Please sign in to comment.