Skip to content

Commit

Permalink
Fix compile errors
Browse files Browse the repository at this point in the history
  • Loading branch information
duckdoom4 committed Aug 14, 2024
1 parent c16be13 commit 046314a
Show file tree
Hide file tree
Showing 7 changed files with 112 additions and 37 deletions.
54 changes: 39 additions & 15 deletions src/tokenizer/debug-decorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ ${(decoration.hoverMessage as MarkdownString).value}`,
case KeywordTokenType.Camera:
case KeywordTokenType.Show:
case KeywordTokenType.Image:
case KeywordTokenType.LayeredImage:
case KeywordTokenType.Layeredimage:
case KeywordTokenType.Window:
case KeywordTokenType.Frame:
case KeywordTokenType.Transform:
Expand All @@ -328,12 +328,17 @@ ${(decoration.hoverMessage as MarkdownString).value}`,
case KeywordTokenType.OtherPython:
case KeywordTokenType.OtherAudio:
case KeywordTokenType.Layer:
case KeywordTokenType.Always:
case KeywordTokenType.Group:
case KeywordTokenType.Attribute:
case KeywordTokenType.Nopredict:
case KeywordTokenType.Take: // Renpy style sub-expression keywords
case KeywordTokenType.Del:
case KeywordTokenType.Clear:
case KeywordTokenType.Variant:
case KeywordTokenType.Vbox: // Renpy screen sub-expression keywords
case KeywordTokenType.Hbox:
case KeywordTokenType.Fixed: // [52-73] Are control flow keywords
case KeywordTokenType.Warp: // ATL keywords
case KeywordTokenType.Circles:
case KeywordTokenType.Clockwise:
Expand All @@ -359,6 +364,12 @@ ${(decoration.hoverMessage as MarkdownString).value}`,
keywords.push(decoration);
break;

case KeywordTokenType.At: // Renpy control flow keywords
case KeywordTokenType.As:
case KeywordTokenType.With:
case KeywordTokenType.Onlayer:
case KeywordTokenType.Zorder:
case KeywordTokenType.Behind:
case KeywordTokenType.If: // Conditional control flow keywords
case KeywordTokenType.Elif:
case KeywordTokenType.Else:
Expand All @@ -373,12 +384,6 @@ ${(decoration.hoverMessage as MarkdownString).value}`,
case KeywordTokenType.Parallel:
case KeywordTokenType.Block:
case KeywordTokenType.Choice:
case KeywordTokenType.At: // Renpy control flow keywords
case KeywordTokenType.As:
case KeywordTokenType.With:
case KeywordTokenType.Onlayer:
case KeywordTokenType.Zorder:
case KeywordTokenType.Behind:
controlKeywords.push(decoration);
break;

Expand All @@ -398,10 +403,13 @@ ${(decoration.hoverMessage as MarkdownString).value}`,
// Variables
case EntityTokenType.Identifier:
case EntityTokenType.StyleName:
case EntityTokenType.TransformName:
case EntityTokenType.ImageName:
case EntityTokenType.TextName:
case EntityTokenType.AudioName:
case EntityTokenType.CharacterName:
case EntityTokenType.LayeredimageName:
case EntityTokenType.LanguageName:
case EntityTokenType.PropertyName:
variables.push(decoration);
break;
Expand All @@ -428,6 +436,18 @@ ${(decoration.hoverMessage as MarkdownString).value}`,
case MetaTokenType.StringBegin:
case MetaTokenType.StringEnd:
case MetaTokenType.SimpleExpression:
case MetaTokenType.LayeredimageBlock:
case MetaTokenType.LayeredimageStatement:
case MetaTokenType.LayeredimageParameters:
case MetaTokenType.LayeredimageGroupStatement:
case MetaTokenType.LayeredimageGroupParameters:
case MetaTokenType.LayeredimageAttributeStatement:
case MetaTokenType.LayeredimageAttributeParameters:
case MetaTokenType.TranslateBlock:
case MetaTokenType.TranslateStatement:
case MetaTokenType.TranslateParameters:
case MetaTokenType.ScreenCall:
case MetaTokenType.RenpyBlock:
case MetaTokenType.CodeBlock:
case MetaTokenType.PythonLine:
case MetaTokenType.PythonBlock:
Expand All @@ -442,13 +462,20 @@ ${(decoration.hoverMessage as MarkdownString).value}`,
case MetaTokenType.MenuBlock:
case MetaTokenType.MenuOption:
case MetaTokenType.MenuOptionBlock:
case MetaTokenType.LabelStatement:
case MetaTokenType.LabelCall:
case MetaTokenType.LabelAccess:
case MetaTokenType.BehindStatement:
case MetaTokenType.OnlayerStatement:
case MetaTokenType.ZorderStatement:
case MetaTokenType.AtStatement:
case MetaTokenType.AsStatement:
case MetaTokenType.WithStatement:
case MetaTokenType.ImageStatement:
case MetaTokenType.CameraStatement:
case MetaTokenType.SceneStatement:
case MetaTokenType.ShowStatement:
case MetaTokenType.HideStatement:
case MetaTokenType.ImageStatement:
case MetaTokenType.CallStatement:
case MetaTokenType.CallArguments:
case MetaTokenType.FromClause:
Expand All @@ -457,16 +484,12 @@ ${(decoration.hoverMessage as MarkdownString).value}`,
case MetaTokenType.PlayAudioStatement:
case MetaTokenType.QueueAudioStatement:
case MetaTokenType.StopAudioStatement:
case MetaTokenType.LabelStatement:
case MetaTokenType.LabelCall:
case MetaTokenType.LabelAccess:
case MetaTokenType.AtStatement:
case MetaTokenType.AsStatement:
case MetaTokenType.WithStatement:
case MetaTokenType.ScreenStatement:
case MetaTokenType.ScreenSensitive:
case MetaTokenType.ScreenFrame:
case MetaTokenType.ScreenFrameStatement:
case MetaTokenType.ScreenFixed:
case MetaTokenType.ScreenFixedStatement:
case MetaTokenType.ScreenWindow:
case MetaTokenType.ScreenWindowStatement:
case MetaTokenType.ScreenText:
Expand Down Expand Up @@ -509,7 +532,7 @@ ${(decoration.hoverMessage as MarkdownString).value}`,
case MetaTokenType.MemberAccess:
case MetaTokenType.ItemAccess:
case MetaTokenType.IndexedName:
case MetaTokenType.Attribute:
case MetaTokenType.DataAttribute:
case MetaTokenType.ClassDefinition:
case MetaTokenType.ClassInheritance:
case MetaTokenType.FunctionDefinition:
Expand Down Expand Up @@ -648,6 +671,7 @@ ${(decoration.hoverMessage as MarkdownString).value}`,
case EscapedCharacterTokenType.EscBackslash:
case EscapedCharacterTokenType.EscOpenSquareBracket:
case EscapedCharacterTokenType.EscOpenBracket:
case EscapedCharacterTokenType.EscPercent:
escCharacters.push(decoration);
break;

Expand Down
4 changes: 2 additions & 2 deletions src/tokenizer/python-token-patterns.g.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// 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: 07/08/2024 16:42:09 (UTC+0)
// Last generated: 14/08/2024 09:13:39 (UTC+0)

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

// Highlight attribute access in otherwise non-specialized cases.
token: MetaTokenType.Attribute, /*variable.name.python meta.attribute.python*/
token: MetaTokenType.DataAttribute, /*variable.name.python meta.data.attribute.python*/
match: /\b([a-zA-Z_]\w*)\b/g,
};

Expand Down
8 changes: 4 additions & 4 deletions src/tokenizer/renpy-token-patterns.g.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// 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: 07/08/2024 16:42:09 (UTC+0)
// Last generated: 14/08/2024 09:13:39 (UTC+0)

import { MetaTokenType, CharacterTokenType, LiteralTokenType, EntityTokenType, KeywordTokenType, EscapedCharacterTokenType, OperatorTokenType } from "./renpy-tokens";
import { TokenPattern } from "./token-pattern-types";
Expand Down Expand Up @@ -394,7 +394,7 @@ export const escapedChar: TokenPattern = {
5: { token: EscapedCharacterTokenType.EscBackslash, /*constant.character.escape.backslash.python.renpy*/ },
6: { token: EscapedCharacterTokenType.EscOpenBracket, /*constant.character.escape.open.bracket.python.renpy*/ },
7: { token: EscapedCharacterTokenType.EscOpenSquareBracket, /*constant.character.escape.open.square-bracket.python.renpy*/ },
8: { token: EscapedCharacterTokenType.EscAmpersand, /*constant.character.escape.ampersand.python.renpy*/ },
8: { token: EscapedCharacterTokenType.EscPercent, /*constant.character.escape.percent.python.renpy*/ },
},
};

Expand Down Expand Up @@ -788,7 +788,7 @@ export const stringTags: TokenPattern = {
match: /\b(jump)\b(:)([a-zA-Z_]\w*)/dg,
captures: {
1: { token: KeywordTokenType.Jump, /*keyword.control.flow.jump.renpy*/ },
2: { token: OperatorTokenType.Jump, /*punctuation.definition.jump.begin.renpy keyword.operator.jump.renpy*/ },
2: { token: CharacterTokenType.Colon, /*keyword.operator.jump.renpy punctuation.colon.renpy*/ },
3: { patterns: [fallbackPatterns] },
},
},
Expand Down Expand Up @@ -1411,7 +1411,7 @@ export const translate: TokenPattern = {
debugName: "translate.patterns![0].patterns![2]",

// Only the first word is the language name
token: EntityTokenType.TranslateName, /*entity.name.type.translate.language.renpy*/
token: EntityTokenType.LanguageName, /*entity.name.type.language.translate.renpy*/
match: /(?<=translate[ \t]+)\b([a-zA-Z_]\w*)\b/g,
},
fallbackPatterns,
Expand Down
31 changes: 28 additions & 3 deletions src/tokenizer/renpy-tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const enum KeywordTokenType {
Camera,
Show,
Image,
LayeredImage,
Layeredimage,
Window,
Frame,
Transform,
Expand Down Expand Up @@ -65,6 +65,10 @@ export const enum KeywordTokenType {
OtherPython,
OtherAudio,
Layer,
Always,
Group,
Attribute,
Nopredict,

// Renpy style sub-expression keywords
Take,
Expand All @@ -75,6 +79,7 @@ export const enum KeywordTokenType {
// Renpy screen sub-expression keywords
Vbox,
Hbox,
Fixed,

// Renpy control flow keywords
At,
Expand Down Expand Up @@ -130,13 +135,16 @@ export const enum EntityTokenType {
FunctionName,
TagName,
Identifier,
StyleName,

// Renpy entities
StyleName,
TransformName,
ImageName,
TextName,
AudioName,
CharacterName,
LayeredimageName,
LanguageName,

// ATL entities
EventName,
Expand Down Expand Up @@ -265,6 +273,7 @@ export const enum EscapedCharacterTokenType {
EscBackslash, // \\
EscOpenSquareBracket, // [[
EscOpenBracket, // {{
EscPercent, // %%
}

export const enum MetaTokenType {
Expand All @@ -287,6 +296,20 @@ export const enum MetaTokenType {

SimpleExpression,

LayeredimageBlock,
LayeredimageStatement,
LayeredimageParameters,
LayeredimageGroupStatement,
LayeredimageGroupParameters,
LayeredimageAttributeStatement,
LayeredimageAttributeParameters,

TranslateBlock,
TranslateStatement,
TranslateParameters,

ScreenCall,

RenpyBlock,
CodeBlock,
PythonLine,
Expand Down Expand Up @@ -336,6 +359,8 @@ export const enum MetaTokenType {
ScreenSensitive,
ScreenFrame,
ScreenFrameStatement,
ScreenFixed,
ScreenFixedStatement,
ScreenWindow,
ScreenWindowStatement,
ScreenText,
Expand Down Expand Up @@ -383,7 +408,7 @@ export const enum MetaTokenType {
MemberAccess,
ItemAccess,
IndexedName,
Attribute,
DataAttribute,
ClassDefinition,
ClassInheritance,
FunctionDefinition,
Expand Down
Loading

0 comments on commit 046314a

Please sign in to comment.