Skip to content

Commit

Permalink
Merge pull request #422 from renpy/various-bug-fixes
Browse files Browse the repository at this point in the history
Fix style statement and other changes
  • Loading branch information
duckdoom4 authored Jul 12, 2024
2 parents 6a95202 + 7e927a6 commit 1005afa
Show file tree
Hide file tree
Showing 16 changed files with 437 additions and 355 deletions.
72 changes: 0 additions & 72 deletions Visual Studio Code.edit.py

This file was deleted.

2 changes: 1 addition & 1 deletion grammars/renpy.grammar.ebnf
Original file line number Diff line number Diff line change
Expand Up @@ -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 ?;
Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions src/tokenizer/atl-token-patterns.g.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
// @ts-nocheck: Generated file
/* eslint-disable no-useless-escape */
/* eslint-disable no-useless-backreference */
/* eslint-disable @typescript-eslint/no-non-null-assertion */

// THIS FILE HAS BEEN GENERATED BY THE `syntax-to-token-pattern.py` GENERATOR
// DO NOT EDIT THIS FILE DIRECTLY! INSTEAD RUN THE PYTHON SCRIPT.
// ANY MANUAL EDITS MADE TO THIS FILE WILL BE OVERWRITTEN. YOU HAVE BEEN WARNED.
// Last generated: 10/07/2024 12:47:55 (UTC+0)
// Last generated: 12/07/2024 09:35:29 (UTC+0)

import { KeywordTokenType, EntityTokenType, MetaTokenType, CharacterTokenType } from "./renpy-tokens";
import { TokenPattern } from "./token-pattern-types";
Expand Down Expand Up @@ -442,6 +441,7 @@ export const atlBlockTester: TokenPattern = {
beginCaptures: {
2: { token: CharacterTokenType.Colon, /*punctuation.section.atl.begin.renpy*/ },
},
// @ts-ignore: Back references in end patterns are replaced by begin matches at runtime
end: /^(?=(?!\1)[ \t]*[^\s#]|\1[^\s#])/gm,
patterns: []
}]
Expand Down
17 changes: 16 additions & 1 deletion src/tokenizer/debug-decorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -461,10 +461,15 @@ ${(decoration.hoverMessage as MarkdownString).value}`,
case MetaTokenType.ScreenStatement:
case MetaTokenType.ScreenSensitive:
case MetaTokenType.ScreenFrame:
case MetaTokenType.ScreenFrameStatement:
case MetaTokenType.ScreenWindow:
case MetaTokenType.ScreenWindowStatement:
case MetaTokenType.ScreenText:
case MetaTokenType.ScreenBlock:
case MetaTokenType.ScreenVboxStatement:
case MetaTokenType.ScreenHboxStatement:
case MetaTokenType.StyleStatement:
case MetaTokenType.StyleParameters:
case MetaTokenType.StyleBlock:
case MetaTokenType.NarratorSayStatement:
case MetaTokenType.SayStatement:
Expand All @@ -486,7 +491,15 @@ ${(decoration.hoverMessage as MarkdownString).value}`,
case MetaTokenType.ATLEvent:
case MetaTokenType.ATLFunction:
case MetaTokenType.ATLWarper:
case MetaTokenType.ATLOn:
case MetaTokenType.ATLOnStatement:
case MetaTokenType.ATLOnParameters:
case MetaTokenType.ATLChoiceStatement:
case MetaTokenType.ATLChoiceParameters:
case MetaTokenType.ATLBlockStatement:
case MetaTokenType.ATLParallelStatement:
case MetaTokenType.ATLContainsStatement:
case MetaTokenType.TransformStatement:
case MetaTokenType.TransformParameters:
case MetaTokenType.MemberAccess:
case MetaTokenType.ItemAccess:
case MetaTokenType.IndexedName:
Expand All @@ -501,6 +514,7 @@ ${(decoration.hoverMessage as MarkdownString).value}`,
case MetaTokenType.FunctionCall:
case MetaTokenType.FunctionCallGeneric:
case MetaTokenType.Fstring:
case MetaTokenType.InterpolateFlags:
case MetaTokenType.ControlFlowKeyword:
case MetaTokenType.LogicalOperatorKeyword:
case MetaTokenType.Operator:
Expand Down Expand Up @@ -603,6 +617,7 @@ ${(decoration.hoverMessage as MarkdownString).value}`,
case CharacterTokenType.DollarSymbol:
case CharacterTokenType.AtSymbol:
case CharacterTokenType.EqualsSymbol:
case CharacterTokenType.ExclamationMark:
case CharacterTokenType.Quote:
case CharacterTokenType.DoubleQuote:
case CharacterTokenType.BackQuote:
Expand Down
22 changes: 20 additions & 2 deletions src/tokenizer/python-token-patterns.g.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
// @ts-nocheck: Generated file
/* eslint-disable no-useless-escape */
/* eslint-disable no-useless-backreference */
/* eslint-disable @typescript-eslint/no-non-null-assertion */

// THIS FILE HAS BEEN GENERATED BY THE `syntax-to-token-pattern.py` GENERATOR
// DO NOT EDIT THIS FILE DIRECTLY! INSTEAD RUN THE PYTHON SCRIPT.
// ANY MANUAL EDITS MADE TO THIS FILE WILL BE OVERWRITTEN. YOU HAVE BEEN WARNED.
// Last generated: 10/07/2024 13:49:44 (UTC+0)
// Last generated: 12/07/2024 09:35:29 (UTC+0)

import { MetaTokenType, KeywordTokenType, EntityTokenType, CharacterTokenType, OperatorTokenType, LiteralTokenType } from "./renpy-tokens";
import { TokenPattern } from "./token-pattern-types";
Expand Down Expand Up @@ -96,6 +95,7 @@ export const docstringStatement: TokenPattern = {

// the string either terminates correctly or by the beginning of a new line (this is for single line docstrings that aren't terminated) AND it's not followed by another docstring
begin: /^(?=\s*[rR]?(\'\'\'|\"\"\"|\'|\"))/gm,
// @ts-ignore: Back references in end patterns are replaced by begin matches at runtime
end: /((?<=\1)|^)(?!\s*[rR]?(\'\'\'|\"\"\"|\'|\"))/gm,
patterns: [
]
Expand All @@ -111,6 +111,7 @@ export const docstring: TokenPattern = {
beginCaptures: {
1: { token: MetaTokenType.StringBegin, /*punctuation.definition.string.begin.python*/ },
},
// @ts-ignore: Back references in end patterns are replaced by begin matches at runtime
end: /(\1)/dg,
endCaptures: {
1: { token: MetaTokenType.StringEnd, /*punctuation.definition.string.end.python*/ },
Expand All @@ -127,6 +128,7 @@ export const docstring: TokenPattern = {
1: { token: MetaTokenType.StringStorageType, /*storage.type.string.python*/ },
2: { token: MetaTokenType.StringBegin, /*punctuation.definition.string.begin.python*/ },
},
// @ts-ignore: Back references in end patterns are replaced by begin matches at runtime
end: /(\2)/dg,
endCaptures: {
1: { token: MetaTokenType.StringEnd, /*punctuation.definition.string.end.python*/ },
Expand All @@ -142,6 +144,7 @@ export const docstring: TokenPattern = {
beginCaptures: {
1: { token: MetaTokenType.StringBegin, /*punctuation.definition.string.begin.python*/ },
},
// @ts-ignore: Back references in end patterns are replaced by begin matches at runtime
end: /(\1)|(\n)/dg,
endCaptures: {
1: { token: MetaTokenType.StringEnd, /*punctuation.definition.string.end.python*/ },
Expand All @@ -159,6 +162,7 @@ export const docstring: TokenPattern = {
1: { token: MetaTokenType.StringStorageType, /*storage.type.string.python*/ },
2: { token: MetaTokenType.StringBegin, /*punctuation.definition.string.begin.python*/ },
},
// @ts-ignore: Back references in end patterns are replaced by begin matches at runtime
end: /(\2)|(\n)/dg,
endCaptures: {
1: { token: MetaTokenType.StringEnd, /*punctuation.definition.string.end.python*/ },
Expand Down Expand Up @@ -2466,6 +2470,7 @@ export const stringRawQuotedSingleLine: TokenPattern = {
2: { token: MetaTokenType.StringStorageType, /*storage.type.string.python*/ },
3: { token: MetaTokenType.StringBegin, /*punctuation.definition.string.begin.python*/ },
},
// @ts-ignore: Back references in end patterns are replaced by begin matches at runtime
end: /(\4)|((?<!\\)\n)/dg,
endCaptures: {
1: { token: MetaTokenType.StringEnd, /*punctuation.definition.string.end.python*/ },
Expand All @@ -2483,6 +2488,7 @@ export const stringBinQuotedSingleLine: TokenPattern = {
1: { token: MetaTokenType.StringStorageType, /*storage.type.string.python*/ },
2: { token: MetaTokenType.StringBegin, /*punctuation.definition.string.begin.python*/ },
},
// @ts-ignore: Back references in end patterns are replaced by begin matches at runtime
end: /(\2)|((?<!\\)\n)/dg,
endCaptures: {
1: { token: MetaTokenType.StringEnd, /*punctuation.definition.string.end.python*/ },
Expand All @@ -2500,6 +2506,7 @@ export const stringRawBinQuotedSingleLine: TokenPattern = {
1: { token: MetaTokenType.StringStorageType, /*storage.type.string.python*/ },
2: { token: MetaTokenType.StringBegin, /*punctuation.definition.string.begin.python*/ },
},
// @ts-ignore: Back references in end patterns are replaced by begin matches at runtime
end: /(\2)|((?<!\\)\n)/dg,
endCaptures: {
1: { token: MetaTokenType.StringEnd, /*punctuation.definition.string.end.python*/ },
Expand All @@ -2518,6 +2525,7 @@ export const stringQuotedSingleLine: TokenPattern = {
2: { token: MetaTokenType.StringStorageType, /*storage.type.string.python*/ },
3: { token: MetaTokenType.StringBegin, /*punctuation.definition.string.begin.python*/ },
},
// @ts-ignore: Back references in end patterns are replaced by begin matches at runtime
end: /(\3)|((?<!\\)\n)/dg,
endCaptures: {
1: { token: MetaTokenType.StringEnd, /*punctuation.definition.string.end.python*/ },
Expand Down Expand Up @@ -2582,6 +2590,7 @@ export const stringRawQuotedMultiLine: TokenPattern = {
2: { token: MetaTokenType.StringStorageType, /*storage.type.string.python*/ },
3: { token: MetaTokenType.StringBegin, /*punctuation.definition.string.begin.python*/ },
},
// @ts-ignore: Back references in end patterns are replaced by begin matches at runtime
end: /(\4)/dg,
endCaptures: {
1: { token: MetaTokenType.StringEnd, /*punctuation.definition.string.end.python*/ },
Expand All @@ -2599,6 +2608,7 @@ export const stringBinQuotedMultiLine: TokenPattern = {
1: { token: MetaTokenType.StringStorageType, /*storage.type.string.python*/ },
2: { token: MetaTokenType.StringBegin, /*punctuation.definition.string.begin.python*/ },
},
// @ts-ignore: Back references in end patterns are replaced by begin matches at runtime
end: /(\2)/dg,
endCaptures: {
1: { token: MetaTokenType.StringEnd, /*punctuation.definition.string.end.python*/ },
Expand All @@ -2616,6 +2626,7 @@ export const stringRawBinQuotedMultiLine: TokenPattern = {
1: { token: MetaTokenType.StringStorageType, /*storage.type.string.python*/ },
2: { token: MetaTokenType.StringBegin, /*punctuation.definition.string.begin.python*/ },
},
// @ts-ignore: Back references in end patterns are replaced by begin matches at runtime
end: /(\2)/dg,
endCaptures: {
1: { token: MetaTokenType.StringEnd, /*punctuation.definition.string.end.python*/ },
Expand All @@ -2634,6 +2645,7 @@ export const stringQuotedMultiLine: TokenPattern = {
2: { token: MetaTokenType.StringStorageType, /*storage.type.string.python*/ },
3: { token: MetaTokenType.StringBegin, /*punctuation.definition.string.begin.python*/ },
},
// @ts-ignore: Back references in end patterns are replaced by begin matches at runtime
end: /(\3)/dg,
endCaptures: {
1: { token: MetaTokenType.StringEnd, /*punctuation.definition.string.end.python*/ },
Expand Down Expand Up @@ -2698,6 +2710,7 @@ export const fstringFnormQuotedSingleLine: TokenPattern = {
2: { token: MetaTokenType.Invalid, /*invalid.illegal.prefix.python*/ },
3: { token: LiteralTokenType.String, /*punctuation.definition.string.begin.python string.interpolated.python string.quoted.single.python*/ },
},
// @ts-ignore: Back references in end patterns are replaced by begin matches at runtime
end: /(\3)|((?<!\\)\n)/dg,
endCaptures: {
1: { token: LiteralTokenType.String, /*punctuation.definition.string.end.python string.interpolated.python string.quoted.single.python*/ },
Expand All @@ -2719,6 +2732,7 @@ export const fstringNormfQuotedSingleLine: TokenPattern = {
2: { token: MetaTokenType.StringStorageType, /*string.interpolated.python string.quoted.single.python storage.type.string.python*/ },
3: { token: MetaTokenType.StringBegin, /*string.quoted.single.python punctuation.definition.string.begin.python*/ },
},
// @ts-ignore: Back references in end patterns are replaced by begin matches at runtime
end: /(\3)|((?<!\\)\n)/dg,
endCaptures: {
1: { token: LiteralTokenType.String, /*punctuation.definition.string.end.python string.interpolated.python string.quoted.single.python*/ },
Expand All @@ -2739,6 +2753,7 @@ export const fstringRawQuotedSingleLine: TokenPattern = {
1: { token: MetaTokenType.StringStorageType, /*string.interpolated.python string.quoted.raw.single.python storage.type.string.python*/ },
2: { token: MetaTokenType.StringBegin, /*string.quoted.raw.single.python punctuation.definition.string.begin.python*/ },
},
// @ts-ignore: Back references in end patterns are replaced by begin matches at runtime
end: /(\2)|((?<!\\)\n)/dg,
endCaptures: {
1: { token: LiteralTokenType.String, /*punctuation.definition.string.end.python string.interpolated.python string.quoted.raw.single.python*/ },
Expand Down Expand Up @@ -2878,6 +2893,7 @@ export const fstringFnormQuotedMultiLine: TokenPattern = {
2: { token: MetaTokenType.Invalid, /*invalid.illegal.prefix.python*/ },
3: { token: LiteralTokenType.String, /*punctuation.definition.string.begin.python string.interpolated.python string.quoted.multi.python*/ },
},
// @ts-ignore: Back references in end patterns are replaced by begin matches at runtime
end: /(\3)/dg,
endCaptures: {
1: { token: LiteralTokenType.String, /*punctuation.definition.string.end.python string.interpolated.python string.quoted.multi.python*/ },
Expand All @@ -2899,6 +2915,7 @@ export const fstringNormfQuotedMultiLine: TokenPattern = {
2: { token: MetaTokenType.StringStorageType, /*string.interpolated.python string.quoted.multi.python storage.type.string.python*/ },
3: { token: MetaTokenType.StringBegin, /*string.quoted.multi.python punctuation.definition.string.begin.python*/ },
},
// @ts-ignore: Back references in end patterns are replaced by begin matches at runtime
end: /(\3)/dg,
endCaptures: {
1: { token: LiteralTokenType.String, /*punctuation.definition.string.end.python string.interpolated.python string.quoted.multi.python*/ },
Expand All @@ -2919,6 +2936,7 @@ export const fstringRawQuotedMultiLine: TokenPattern = {
1: { token: MetaTokenType.StringStorageType, /*string.interpolated.python string.quoted.raw.multi.python storage.type.string.python*/ },
2: { token: MetaTokenType.StringBegin, /*string.quoted.raw.multi.python punctuation.definition.string.begin.python*/ },
},
// @ts-ignore: Back references in end patterns are replaced by begin matches at runtime
end: /(\2)/dg,
endCaptures: {
1: { token: LiteralTokenType.String, /*punctuation.definition.string.end.python string.interpolated.python string.quoted.raw.multi.python*/ },
Expand Down
Loading

0 comments on commit 1005afa

Please sign in to comment.