From 91b03940a706a4394569a4dcb2758c91911b12e0 Mon Sep 17 00:00:00 2001 From: JaDoggx86 Date: Sat, 24 Jun 2023 13:55:43 +0100 Subject: [PATCH] feat(editors,tests): utilize struct keyword --- .../compiler_tests/on_stack_test.yaka | 7 +- .../output/on_stack_test.tokens | 370 ++++++++------- .../output/on_stack_test.yaka.output.c | 8 +- editor/intellij/gradle.properties | 2 +- .../intellij/sdk/language/YakshaLexer.java | 427 +++++++++--------- .../sdk/language/parser/YakshaParser.java | 25 +- .../sdk/language/psi/YakshaTypes.java | 1 + .../java/org/intellij/sdk/language/Yaksha.bnf | 4 +- .../org/intellij/sdk/language/Yaksha.flex | 1 + .../sdk/language/YakshaSyntaxHighlighter.java | 1 + editor/notepadplusplus/yaksha.xml | 2 +- editor/vscode/syntaxes/yaksha.json | 4 +- 12 files changed, 460 insertions(+), 392 deletions(-) diff --git a/compiler/test_data/compiler_tests/on_stack_test.yaka b/compiler/test_data/compiler_tests/on_stack_test.yaka index 19ccbbf7..2109d6fd 100644 --- a/compiler/test_data/compiler_tests/on_stack_test.yaka +++ b/compiler/test_data/compiler_tests/on_stack_test.yaka @@ -4,11 +4,16 @@ class Enemy: y: int hp: int +struct Friend: + x: int + def main() -> int: enemies: Array[Enemy] = arrnew("Enemy", 2) enemies[0].x = 1 enemies[1].x = 2 + good_person: Friend + good_person.x = 0 big_enemy: Enemy big_enemy.x = 4 - println(enemies[0].x + enemies[1].x + big_enemy.x) + println(enemies[0].x + enemies[1].x + big_enemy.x + good_person.x) return 0 diff --git a/compiler/test_data/compiler_tests/output/on_stack_test.tokens b/compiler/test_data/compiler_tests/output/on_stack_test.tokens index 2b5e92fc..41cfedb4 100644 --- a/compiler/test_data/compiler_tests/output/on_stack_test.tokens +++ b/compiler/test_data/compiler_tests/output/on_stack_test.tokens @@ -15,184 +15,218 @@ ["output.c",3,1,"struct","KEYWORD_STRUCT"], ["output.c",3,8,"yy__Enemy","NAME"], ["output.c",3,18,"\n","NEW_LINE"], - ["output.c",4,1,"int32_t","NAME"], - ["output.c",4,9,"yy__main","NAME"], - ["output.c",4,17,"(","PAREN_OPEN"], - ["output.c",4,18,")","PAREN_CLOSE"], - ["output.c",4,20,"\n","NEW_LINE"], - ["output.c",5,1,"//","INT_DIV"], - ["output.c",5,4,"-","SUB"], - ["output.c",5,5,"-","SUB"], - ["output.c",5,6,"structs","NAME"], - ["output.c",5,13,"-","SUB"], - ["output.c",5,14,"-","SUB"], - ["output.c",5,16,"\n","NEW_LINE"], - ["output.c",6,1,"struct","KEYWORD_STRUCT"], - ["output.c",6,8,"yy__Enemy","NAME"], - ["output.c",6,18,"{","CURLY_BRACKET_OPEN"], - ["output.c",6,19,"\n","NEW_LINE"], - ["output.c",7,1," ","INDENT"], - ["output.c",7,5,"int32_t","NAME"], - ["output.c",7,13,"yy__x","NAME"], + ["output.c",4,1,"struct","KEYWORD_STRUCT"], + ["output.c",4,8,"yy__Friend","NAME"], + ["output.c",4,19,"\n","NEW_LINE"], + ["output.c",5,1,"int32_t","NAME"], + ["output.c",5,9,"yy__main","NAME"], + ["output.c",5,17,"(","PAREN_OPEN"], + ["output.c",5,18,")","PAREN_CLOSE"], + ["output.c",5,20,"\n","NEW_LINE"], + ["output.c",6,1,"//","INT_DIV"], + ["output.c",6,4,"-","SUB"], + ["output.c",6,5,"-","SUB"], + ["output.c",6,6,"structs","NAME"], + ["output.c",6,13,"-","SUB"], + ["output.c",6,14,"-","SUB"], + ["output.c",6,16,"\n","NEW_LINE"], + ["output.c",7,1,"struct","KEYWORD_STRUCT"], + ["output.c",7,8,"yy__Enemy","NAME"], + ["output.c",7,18,"{","CURLY_BRACKET_OPEN"], ["output.c",7,19,"\n","NEW_LINE"], ["output.c",8,1," ","INDENT"], ["output.c",8,5,"int32_t","NAME"], - ["output.c",8,13,"yy__y","NAME"], + ["output.c",8,13,"yy__x","NAME"], ["output.c",8,19,"\n","NEW_LINE"], ["output.c",9,1," ","INDENT"], ["output.c",9,5,"int32_t","NAME"], - ["output.c",9,13,"yy__hp","NAME"], - ["output.c",9,20,"\n","NEW_LINE"], - ["output.c",10,1,"}","CURLY_BRACKET_CLOSE"], - ["output.c",10,3,"\n","NEW_LINE"], - ["output.c",11,1,"//","INT_DIV"], - ["output.c",11,4,"-","SUB"], - ["output.c",11,5,"-","SUB"], - ["output.c",11,6,"functions","NAME"], - ["output.c",11,15,"-","SUB"], - ["output.c",11,16,"-","SUB"], - ["output.c",11,18,"\n","NEW_LINE"], - ["output.c",12,1,"int32_t","NAME"], - ["output.c",12,9,"yy__main","NAME"], - ["output.c",12,17,"(","PAREN_OPEN"], - ["output.c",12,18,")","PAREN_CLOSE"], + ["output.c",9,13,"yy__y","NAME"], + ["output.c",9,19,"\n","NEW_LINE"], + ["output.c",10,1," ","INDENT"], + ["output.c",10,5,"int32_t","NAME"], + ["output.c",10,13,"yy__hp","NAME"], + ["output.c",10,20,"\n","NEW_LINE"], + ["output.c",11,1,"}","CURLY_BRACKET_CLOSE"], + ["output.c",11,3,"\n","NEW_LINE"], + ["output.c",12,1,"struct","KEYWORD_STRUCT"], + ["output.c",12,8,"yy__Friend","NAME"], + ["output.c",12,19,"{","CURLY_BRACKET_OPEN"], ["output.c",12,20,"\n","NEW_LINE"], - ["output.c",13,1,"{","CURLY_BRACKET_OPEN"], - ["output.c",13,2,"\n","NEW_LINE"], - ["output.c",14,1," ","INDENT"], - ["output.c",14,5,"struct","KEYWORD_STRUCT"], - ["output.c",14,12,"yy__Enemy","NAME"], - ["output.c",14,21,"*","MUL"], - ["output.c",14,23,"t__0","NAME"], - ["output.c",14,28,"=","EQ"], - ["output.c",14,30,"NULL","NAME"], - ["output.c",14,35,"\n","NEW_LINE"], - ["output.c",15,1," ","INDENT"], - ["output.c",15,5,"yk__arrsetlen","NAME"], - ["output.c",15,18,"(","PAREN_OPEN"], - ["output.c",15,19,"t__0","NAME"], - ["output.c",15,23,",","COMMA"], - ["output.c",15,25,"INT32_C","NAME"], - ["output.c",15,32,"(","PAREN_OPEN"], - ["output.c",15,33,"2","INTEGER_DECIMAL"], - ["output.c",15,34,")","PAREN_CLOSE"], - ["output.c",15,35,")","PAREN_CLOSE"], - ["output.c",15,37,"\n","NEW_LINE"], - ["output.c",16,1," ","INDENT"], - ["output.c",16,5,"struct","KEYWORD_STRUCT"], - ["output.c",16,12,"yy__Enemy","NAME"], - ["output.c",16,21,"*","MUL"], - ["output.c",16,23,"yy__enemies","NAME"], - ["output.c",16,35,"=","EQ"], - ["output.c",16,37,"t__0","NAME"], - ["output.c",16,42,"\n","NEW_LINE"], - ["output.c",17,1," ","INDENT"], - ["output.c",17,5,"yy__enemies","NAME"], - ["output.c",17,16,"[","SQUARE_BRACKET_OPEN"], - ["output.c",17,17,"INT32_C","NAME"], - ["output.c",17,24,"(","PAREN_OPEN"], - ["output.c",17,25,"0","INTEGER_DECIMAL"], - ["output.c",17,26,")","PAREN_CLOSE"], - ["output.c",17,27,"]","SQUARE_BRACKET_CLOSE"], - ["output.c",17,28,".","DOT"], - ["output.c",17,29,"yy__x","NAME"], - ["output.c",17,35,"=","EQ"], - ["output.c",17,37,"INT32_C","NAME"], - ["output.c",17,44,"(","PAREN_OPEN"], - ["output.c",17,45,"1","INTEGER_DECIMAL"], - ["output.c",17,46,")","PAREN_CLOSE"], - ["output.c",17,48,"\n","NEW_LINE"], + ["output.c",13,1," ","INDENT"], + ["output.c",13,5,"int32_t","NAME"], + ["output.c",13,13,"yy__x","NAME"], + ["output.c",13,19,"\n","NEW_LINE"], + ["output.c",14,1,"}","CURLY_BRACKET_CLOSE"], + ["output.c",14,3,"\n","NEW_LINE"], + ["output.c",15,1,"//","INT_DIV"], + ["output.c",15,4,"-","SUB"], + ["output.c",15,5,"-","SUB"], + ["output.c",15,6,"functions","NAME"], + ["output.c",15,15,"-","SUB"], + ["output.c",15,16,"-","SUB"], + ["output.c",15,18,"\n","NEW_LINE"], + ["output.c",16,1,"int32_t","NAME"], + ["output.c",16,9,"yy__main","NAME"], + ["output.c",16,17,"(","PAREN_OPEN"], + ["output.c",16,18,")","PAREN_CLOSE"], + ["output.c",16,20,"\n","NEW_LINE"], + ["output.c",17,1,"{","CURLY_BRACKET_OPEN"], + ["output.c",17,2,"\n","NEW_LINE"], ["output.c",18,1," ","INDENT"], - ["output.c",18,5,"yy__enemies","NAME"], - ["output.c",18,16,"[","SQUARE_BRACKET_OPEN"], - ["output.c",18,17,"INT32_C","NAME"], - ["output.c",18,24,"(","PAREN_OPEN"], - ["output.c",18,25,"1","INTEGER_DECIMAL"], - ["output.c",18,26,")","PAREN_CLOSE"], - ["output.c",18,27,"]","SQUARE_BRACKET_CLOSE"], - ["output.c",18,28,".","DOT"], - ["output.c",18,29,"yy__x","NAME"], - ["output.c",18,35,"=","EQ"], - ["output.c",18,37,"INT32_C","NAME"], - ["output.c",18,44,"(","PAREN_OPEN"], - ["output.c",18,45,"2","INTEGER_DECIMAL"], - ["output.c",18,46,")","PAREN_CLOSE"], - ["output.c",18,48,"\n","NEW_LINE"], + ["output.c",18,5,"struct","KEYWORD_STRUCT"], + ["output.c",18,12,"yy__Enemy","NAME"], + ["output.c",18,21,"*","MUL"], + ["output.c",18,23,"t__0","NAME"], + ["output.c",18,28,"=","EQ"], + ["output.c",18,30,"NULL","NAME"], + ["output.c",18,35,"\n","NEW_LINE"], ["output.c",19,1," ","INDENT"], - ["output.c",19,5,"struct","KEYWORD_STRUCT"], - ["output.c",19,12,"yy__Enemy","NAME"], - ["output.c",19,22,"yy__big_enemy","NAME"], - ["output.c",19,36,"\n","NEW_LINE"], + ["output.c",19,5,"yk__arrsetlen","NAME"], + ["output.c",19,18,"(","PAREN_OPEN"], + ["output.c",19,19,"t__0","NAME"], + ["output.c",19,23,",","COMMA"], + ["output.c",19,25,"INT32_C","NAME"], + ["output.c",19,32,"(","PAREN_OPEN"], + ["output.c",19,33,"2","INTEGER_DECIMAL"], + ["output.c",19,34,")","PAREN_CLOSE"], + ["output.c",19,35,")","PAREN_CLOSE"], + ["output.c",19,37,"\n","NEW_LINE"], ["output.c",20,1," ","INDENT"], - ["output.c",20,5,"yy__big_enemy","NAME"], - ["output.c",20,18,".","DOT"], - ["output.c",20,19,"yy__x","NAME"], - ["output.c",20,25,"=","EQ"], - ["output.c",20,27,"INT32_C","NAME"], - ["output.c",20,34,"(","PAREN_OPEN"], - ["output.c",20,35,"4","INTEGER_DECIMAL"], - ["output.c",20,36,")","PAREN_CLOSE"], - ["output.c",20,38,"\n","NEW_LINE"], + ["output.c",20,5,"struct","KEYWORD_STRUCT"], + ["output.c",20,12,"yy__Enemy","NAME"], + ["output.c",20,21,"*","MUL"], + ["output.c",20,23,"yy__enemies","NAME"], + ["output.c",20,35,"=","EQ"], + ["output.c",20,37,"t__0","NAME"], + ["output.c",20,42,"\n","NEW_LINE"], ["output.c",21,1," ","INDENT"], - ["output.c",21,5,"yk__printlnint","NAME"], - ["output.c",21,19,"(","PAREN_OPEN"], - ["output.c",21,20,"(","PAREN_OPEN"], - ["output.c",21,21,"(","PAREN_OPEN"], - ["output.c",21,22,"intmax_t","NAME"], - ["output.c",21,30,")","PAREN_CLOSE"], - ["output.c",21,31,"(","PAREN_OPEN"], - ["output.c",21,32,"(","PAREN_OPEN"], - ["output.c",21,33,"yy__enemies","NAME"], - ["output.c",21,44,"[","SQUARE_BRACKET_OPEN"], - ["output.c",21,45,"INT32_C","NAME"], - ["output.c",21,52,"(","PAREN_OPEN"], - ["output.c",21,53,"0","INTEGER_DECIMAL"], - ["output.c",21,54,")","PAREN_CLOSE"], - ["output.c",21,55,"]","SQUARE_BRACKET_CLOSE"], - ["output.c",21,56,".","DOT"], - ["output.c",21,57,"yy__x","NAME"], - ["output.c",21,63,"+","PLUS"], - ["output.c",21,65,"yy__enemies","NAME"], - ["output.c",21,76,"[","SQUARE_BRACKET_OPEN"], - ["output.c",21,77,"INT32_C","NAME"], - ["output.c",21,84,"(","PAREN_OPEN"], - ["output.c",21,85,"1","INTEGER_DECIMAL"], - ["output.c",21,86,")","PAREN_CLOSE"], - ["output.c",21,87,"]","SQUARE_BRACKET_CLOSE"], - ["output.c",21,88,".","DOT"], - ["output.c",21,89,"yy__x","NAME"], - ["output.c",21,94,")","PAREN_CLOSE"], - ["output.c",21,96,"+","PLUS"], - ["output.c",21,98,"yy__big_enemy","NAME"], - ["output.c",21,111,".","DOT"], - ["output.c",21,112,"yy__x","NAME"], - ["output.c",21,117,")","PAREN_CLOSE"], - ["output.c",21,118,")","PAREN_CLOSE"], - ["output.c",21,119,")","PAREN_CLOSE"], - ["output.c",21,121,"\n","NEW_LINE"], + ["output.c",21,5,"yy__enemies","NAME"], + ["output.c",21,16,"[","SQUARE_BRACKET_OPEN"], + ["output.c",21,17,"INT32_C","NAME"], + ["output.c",21,24,"(","PAREN_OPEN"], + ["output.c",21,25,"0","INTEGER_DECIMAL"], + ["output.c",21,26,")","PAREN_CLOSE"], + ["output.c",21,27,"]","SQUARE_BRACKET_CLOSE"], + ["output.c",21,28,".","DOT"], + ["output.c",21,29,"yy__x","NAME"], + ["output.c",21,35,"=","EQ"], + ["output.c",21,37,"INT32_C","NAME"], + ["output.c",21,44,"(","PAREN_OPEN"], + ["output.c",21,45,"1","INTEGER_DECIMAL"], + ["output.c",21,46,")","PAREN_CLOSE"], + ["output.c",21,48,"\n","NEW_LINE"], ["output.c",22,1," ","INDENT"], - ["output.c",22,5,"return","KEYWORD_RETURN"], - ["output.c",22,12,"INT32_C","NAME"], - ["output.c",22,19,"(","PAREN_OPEN"], - ["output.c",22,20,"0","INTEGER_DECIMAL"], - ["output.c",22,21,")","PAREN_CLOSE"], - ["output.c",22,23,"\n","NEW_LINE"], - ["output.c",23,1,"}","CURLY_BRACKET_CLOSE"], - ["output.c",23,2,"\n","NEW_LINE"], - ["output.c",24,1,"if defined(YK__MINIMAL_MAIN)","COMMENT"], - ["output.c",24,30,"\n","NEW_LINE"], - ["output.c",25,1,"int","NAME"], - ["output.c",25,5,"main","NAME"], - ["output.c",25,9,"(","PAREN_OPEN"], - ["output.c",25,10,"void","NAME"], - ["output.c",25,14,")","PAREN_CLOSE"], - ["output.c",25,16,"{","CURLY_BRACKET_OPEN"], - ["output.c",25,18,"return","KEYWORD_RETURN"], - ["output.c",25,25,"yy__main","NAME"], - ["output.c",25,33,"(","PAREN_OPEN"], - ["output.c",25,34,")","PAREN_CLOSE"], - ["output.c",25,37,"}","CURLY_BRACKET_CLOSE"], - ["output.c",25,38,"\n","NEW_LINE"], - ["output.c",26,1,"endif","COMMENT"], - ["output.c",26,8,"","END_OF_FILE"] + ["output.c",22,5,"yy__enemies","NAME"], + ["output.c",22,16,"[","SQUARE_BRACKET_OPEN"], + ["output.c",22,17,"INT32_C","NAME"], + ["output.c",22,24,"(","PAREN_OPEN"], + ["output.c",22,25,"1","INTEGER_DECIMAL"], + ["output.c",22,26,")","PAREN_CLOSE"], + ["output.c",22,27,"]","SQUARE_BRACKET_CLOSE"], + ["output.c",22,28,".","DOT"], + ["output.c",22,29,"yy__x","NAME"], + ["output.c",22,35,"=","EQ"], + ["output.c",22,37,"INT32_C","NAME"], + ["output.c",22,44,"(","PAREN_OPEN"], + ["output.c",22,45,"2","INTEGER_DECIMAL"], + ["output.c",22,46,")","PAREN_CLOSE"], + ["output.c",22,48,"\n","NEW_LINE"], + ["output.c",23,1," ","INDENT"], + ["output.c",23,5,"struct","KEYWORD_STRUCT"], + ["output.c",23,12,"yy__Friend","NAME"], + ["output.c",23,23,"yy__good_person","NAME"], + ["output.c",23,39,"\n","NEW_LINE"], + ["output.c",24,1," ","INDENT"], + ["output.c",24,5,"yy__good_person","NAME"], + ["output.c",24,20,".","DOT"], + ["output.c",24,21,"yy__x","NAME"], + ["output.c",24,27,"=","EQ"], + ["output.c",24,29,"INT32_C","NAME"], + ["output.c",24,36,"(","PAREN_OPEN"], + ["output.c",24,37,"0","INTEGER_DECIMAL"], + ["output.c",24,38,")","PAREN_CLOSE"], + ["output.c",24,40,"\n","NEW_LINE"], + ["output.c",25,1," ","INDENT"], + ["output.c",25,5,"struct","KEYWORD_STRUCT"], + ["output.c",25,12,"yy__Enemy","NAME"], + ["output.c",25,22,"yy__big_enemy","NAME"], + ["output.c",25,36,"\n","NEW_LINE"], + ["output.c",26,1," ","INDENT"], + ["output.c",26,5,"yy__big_enemy","NAME"], + ["output.c",26,18,".","DOT"], + ["output.c",26,19,"yy__x","NAME"], + ["output.c",26,25,"=","EQ"], + ["output.c",26,27,"INT32_C","NAME"], + ["output.c",26,34,"(","PAREN_OPEN"], + ["output.c",26,35,"4","INTEGER_DECIMAL"], + ["output.c",26,36,")","PAREN_CLOSE"], + ["output.c",26,38,"\n","NEW_LINE"], + ["output.c",27,1," ","INDENT"], + ["output.c",27,5,"yk__printlnint","NAME"], + ["output.c",27,19,"(","PAREN_OPEN"], + ["output.c",27,20,"(","PAREN_OPEN"], + ["output.c",27,21,"(","PAREN_OPEN"], + ["output.c",27,22,"intmax_t","NAME"], + ["output.c",27,30,")","PAREN_CLOSE"], + ["output.c",27,31,"(","PAREN_OPEN"], + ["output.c",27,32,"(","PAREN_OPEN"], + ["output.c",27,33,"(","PAREN_OPEN"], + ["output.c",27,34,"yy__enemies","NAME"], + ["output.c",27,45,"[","SQUARE_BRACKET_OPEN"], + ["output.c",27,46,"INT32_C","NAME"], + ["output.c",27,53,"(","PAREN_OPEN"], + ["output.c",27,54,"0","INTEGER_DECIMAL"], + ["output.c",27,55,")","PAREN_CLOSE"], + ["output.c",27,56,"]","SQUARE_BRACKET_CLOSE"], + ["output.c",27,57,".","DOT"], + ["output.c",27,58,"yy__x","NAME"], + ["output.c",27,64,"+","PLUS"], + ["output.c",27,66,"yy__enemies","NAME"], + ["output.c",27,77,"[","SQUARE_BRACKET_OPEN"], + ["output.c",27,78,"INT32_C","NAME"], + ["output.c",27,85,"(","PAREN_OPEN"], + ["output.c",27,86,"1","INTEGER_DECIMAL"], + ["output.c",27,87,")","PAREN_CLOSE"], + ["output.c",27,88,"]","SQUARE_BRACKET_CLOSE"], + ["output.c",27,89,".","DOT"], + ["output.c",27,90,"yy__x","NAME"], + ["output.c",27,95,")","PAREN_CLOSE"], + ["output.c",27,97,"+","PLUS"], + ["output.c",27,99,"yy__big_enemy","NAME"], + ["output.c",27,112,".","DOT"], + ["output.c",27,113,"yy__x","NAME"], + ["output.c",27,118,")","PAREN_CLOSE"], + ["output.c",27,120,"+","PLUS"], + ["output.c",27,122,"yy__good_person","NAME"], + ["output.c",27,137,".","DOT"], + ["output.c",27,138,"yy__x","NAME"], + ["output.c",27,143,")","PAREN_CLOSE"], + ["output.c",27,144,")","PAREN_CLOSE"], + ["output.c",27,145,")","PAREN_CLOSE"], + ["output.c",27,147,"\n","NEW_LINE"], + ["output.c",28,1," ","INDENT"], + ["output.c",28,5,"return","KEYWORD_RETURN"], + ["output.c",28,12,"INT32_C","NAME"], + ["output.c",28,19,"(","PAREN_OPEN"], + ["output.c",28,20,"0","INTEGER_DECIMAL"], + ["output.c",28,21,")","PAREN_CLOSE"], + ["output.c",28,23,"\n","NEW_LINE"], + ["output.c",29,1,"}","CURLY_BRACKET_CLOSE"], + ["output.c",29,2,"\n","NEW_LINE"], + ["output.c",30,1,"if defined(YK__MINIMAL_MAIN)","COMMENT"], + ["output.c",30,30,"\n","NEW_LINE"], + ["output.c",31,1,"int","NAME"], + ["output.c",31,5,"main","NAME"], + ["output.c",31,9,"(","PAREN_OPEN"], + ["output.c",31,10,"void","NAME"], + ["output.c",31,14,")","PAREN_CLOSE"], + ["output.c",31,16,"{","CURLY_BRACKET_OPEN"], + ["output.c",31,18,"return","KEYWORD_RETURN"], + ["output.c",31,25,"yy__main","NAME"], + ["output.c",31,33,"(","PAREN_OPEN"], + ["output.c",31,34,")","PAREN_CLOSE"], + ["output.c",31,37,"}","CURLY_BRACKET_CLOSE"], + ["output.c",31,38,"\n","NEW_LINE"], + ["output.c",32,1,"endif","COMMENT"], + ["output.c",32,8,"","END_OF_FILE"] ] \ No newline at end of file diff --git a/compiler/test_data/compiler_tests/output/on_stack_test.yaka.output.c b/compiler/test_data/compiler_tests/output/on_stack_test.yaka.output.c index 66afeb85..db8541e9 100644 --- a/compiler/test_data/compiler_tests/output/on_stack_test.yaka.output.c +++ b/compiler/test_data/compiler_tests/output/on_stack_test.yaka.output.c @@ -2,6 +2,7 @@ #include "yk__lib.h" // --forward declarations-- struct yy__Enemy; +struct yy__Friend; int32_t yy__main(); // --structs-- struct yy__Enemy { @@ -9,6 +10,9 @@ struct yy__Enemy { int32_t yy__y; int32_t yy__hp; }; +struct yy__Friend { + int32_t yy__x; +}; // --functions-- int32_t yy__main() { @@ -17,9 +21,11 @@ int32_t yy__main() struct yy__Enemy* yy__enemies = t__0; yy__enemies[INT32_C(0)].yy__x = INT32_C(1); yy__enemies[INT32_C(1)].yy__x = INT32_C(2); + struct yy__Friend yy__good_person; + yy__good_person.yy__x = INT32_C(0); struct yy__Enemy yy__big_enemy; yy__big_enemy.yy__x = INT32_C(4); - yk__printlnint(((intmax_t)((yy__enemies[INT32_C(0)].yy__x + yy__enemies[INT32_C(1)].yy__x) + yy__big_enemy.yy__x))); + yk__printlnint(((intmax_t)(((yy__enemies[INT32_C(0)].yy__x + yy__enemies[INT32_C(1)].yy__x) + yy__big_enemy.yy__x) + yy__good_person.yy__x))); return INT32_C(0); } #if defined(YK__MINIMAL_MAIN) diff --git a/editor/intellij/gradle.properties b/editor/intellij/gradle.properties index fb083283..4b750fbd 100644 --- a/editor/intellij/gradle.properties +++ b/editor/intellij/gradle.properties @@ -3,7 +3,7 @@ pluginGroup = com.github.jadogg.yakshaintellij pluginName = YakshaIntelliJ # SemVer format -> https://semver.org -pluginVersion = 0.0.8 +pluginVersion = 0.0.9 # Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html pluginSinceBuild = 213 diff --git a/editor/intellij/src/main/gen/org/intellij/sdk/language/YakshaLexer.java b/editor/intellij/src/main/gen/org/intellij/sdk/language/YakshaLexer.java index ec0d6316..aaa27f27 100644 --- a/editor/intellij/src/main/gen/org/intellij/sdk/language/YakshaLexer.java +++ b/editor/intellij/src/main/gen/org/intellij/sdk/language/YakshaLexer.java @@ -57,9 +57,9 @@ public static int ZZ_CMAP(int ch) { "\11\0\1\3\1\2\2\0\1\1\22\0\1\4\1\76\1\35\1\5\1\0\1\70\1\72\1\33\1\60\1\61"+ "\1\66\1\32\1\101\1\64\1\30\1\67\1\10\1\14\1\17\1\16\1\20\1\24\1\15\1\24\1"+ "\13\1\11\1\100\1\0\1\71\1\75\1\65\1\0\1\77\4\22\1\31\1\27\7\6\1\57\1\23\4"+ - "\6\1\56\3\6\1\21\2\6\1\62\1\34\1\63\1\74\1\7\1\0\1\36\1\25\1\43\1\45\1\41"+ - "\1\51\1\6\1\55\1\50\1\6\1\42\1\44\1\52\1\46\1\26\1\53\1\6\1\40\1\37\1\47\1"+ - "\12\1\6\1\54\1\21\2\6\1\0\1\73\1\0\1\102\201\0"); + "\6\1\56\3\6\1\21\2\6\1\62\1\34\1\63\1\74\1\7\1\0\1\36\1\25\1\43\1\47\1\41"+ + "\1\51\1\6\1\55\1\12\1\6\1\42\1\44\1\52\1\50\1\26\1\53\1\6\1\40\1\37\1\45\1"+ + "\46\1\6\1\54\1\21\2\6\1\0\1\73\1\0\1\102\201\0"); /** * Translates DFA states to action switch labels. @@ -71,18 +71,18 @@ public static int ZZ_CMAP(int ch) { "\1\7\1\10\2\11\15\5\1\12\1\13\1\14\1\15"+ "\1\16\1\17\1\20\1\21\1\22\1\17\1\23\1\24"+ "\1\25\1\26\1\1\1\27\1\30\1\31\1\32\1\3"+ - "\2\4\1\6\4\0\2\6\1\0\1\33\5\5\1\34"+ - "\1\5\1\35\6\11\1\36\12\5\1\37\1\40\7\5"+ + "\2\4\1\6\4\0\2\6\1\0\1\33\3\5\1\34"+ + "\1\35\3\5\1\36\1\5\1\37\6\11\1\40\20\5"+ "\1\41\1\42\1\43\1\17\1\44\1\45\1\46\1\47"+ - "\1\50\1\51\1\52\1\3\3\0\4\6\1\0\3\5"+ - "\3\11\1\53\7\5\1\54\1\55\1\56\1\5\1\57"+ - "\5\5\1\60\1\61\1\62\2\5\4\0\2\5\1\63"+ - "\1\64\6\5\1\65\1\5\1\66\1\67\1\70\1\71"+ - "\2\0\3\5\1\72\1\73\1\74\1\5\1\75\1\5"+ - "\1\76\1\5\1\77\3\5\1\100\5\5\1\101"; + "\1\50\1\51\1\52\1\3\3\0\4\6\1\0\4\5"+ + "\3\11\1\53\1\33\7\5\1\54\1\55\1\56\1\57"+ + "\5\5\1\60\1\61\1\62\3\5\4\0\3\5\1\63"+ + "\1\64\5\5\1\65\1\5\1\66\1\67\1\5\1\70"+ + "\1\71\2\0\4\5\1\72\1\73\1\74\1\75\1\76"+ + "\1\77\1\100\5\5\1\101\5\5\1\102"; private static int [] zzUnpackAction() { - int [] result = new int[189]; + int [] result = new int[193]; int offset = 0; offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result); return result; @@ -115,25 +115,26 @@ private static int zzUnpackAction(String packed, int offset, int [] result) { "\0\u0929\0\u096c\0\u09af\0\u09f2\0\u0a35\0\u0a35\0\103\0\103"+ "\0\103\0\103\0\u0a78\0\u0abb\0\103\0\u0afe\0\u0b41\0\u0b84"+ "\0\u0bc7\0\u0c0a\0\103\0\u0c4d\0\u0c90\0\u0192\0\u0cd3\0\u0d16"+ - "\0\u0d59\0\u0d9c\0\u0ddf\0\u0192\0\u0e22\0\103\0\u0e65\0\u0ea8"+ - "\0\u0eeb\0\u0f2e\0\u0f71\0\u0fb4\0\u0192\0\u0ff7\0\u103a\0\u107d"+ - "\0\u10c0\0\u1103\0\u1146\0\u1189\0\u11cc\0\u120f\0\u1252\0\u1295"+ - "\0\u0192\0\u12d8\0\u131b\0\u135e\0\u13a1\0\u13e4\0\u1427\0\u146a"+ + "\0\u0d59\0\u0d9c\0\u0192\0\u0ddf\0\u0e22\0\u0e65\0\u0192\0\u0ea8"+ + "\0\103\0\u0eeb\0\u0f2e\0\u0f71\0\u0fb4\0\u0ff7\0\u103a\0\u0192"+ + "\0\u107d\0\u10c0\0\u1103\0\u1146\0\u1189\0\u11cc\0\u120f\0\u1252"+ + "\0\u1295\0\u12d8\0\u131b\0\u135e\0\u13a1\0\u13e4\0\u1427\0\u146a"+ "\0\103\0\103\0\u14ad\0\103\0\103\0\103\0\103\0\u14f0"+ "\0\103\0\103\0\103\0\u1533\0\u1576\0\u15b9\0\u15fc\0\u163f"+ - "\0\u1682\0\u16c5\0\u1708\0\u174b\0\u178e\0\u17d1\0\u1814\0\103"+ - "\0\u1857\0\u189a\0\u0192\0\u18dd\0\u1920\0\u1963\0\u19a6\0\u19e9"+ - "\0\u1a2c\0\u1a6f\0\u0192\0\u1ab2\0\u0192\0\u1af5\0\u0192\0\u1b38"+ - "\0\u1b7b\0\u1bbe\0\u1c01\0\u1c44\0\103\0\103\0\u1c87\0\u1cca"+ - "\0\u1d0d\0\u1d50\0\u1d93\0\u1dd6\0\u1e19\0\u1e5c\0\u1e9f\0\u0192"+ - "\0\u0192\0\u1ee2\0\u1f25\0\u1f68\0\u1fab\0\u1fee\0\u1295\0\u0192"+ - "\0\u2031\0\u0192\0\u0192\0\u0192\0\u0192\0\u2074\0\u20b7\0\u20fa"+ - "\0\u213d\0\u2180\0\u0192\0\u0192\0\u0192\0\u21c3\0\u0192\0\u2206"+ - "\0\u0192\0\u2249\0\u0192\0\u228c\0\u22cf\0\u2312\0\u0192\0\u2355"+ - "\0\u2398\0\u23db\0\u241e\0\u2461\0\u0192"; + "\0\u1682\0\u16c5\0\u1708\0\u174b\0\u178e\0\u17d1\0\u1814\0\u1857"+ + "\0\103\0\u189a\0\u18dd\0\u0192\0\u1920\0\u1963\0\u19a6\0\u19e9"+ + "\0\u1a2c\0\u1a6f\0\u1ab2\0\u1af5\0\u0192\0\u1b38\0\u0192\0\u0192"+ + "\0\u1b7b\0\u1bbe\0\u1c01\0\u1c44\0\u1c87\0\103\0\103\0\u1cca"+ + "\0\u1d0d\0\u1d50\0\u1d93\0\u1dd6\0\u1e19\0\u1e5c\0\u1e9f\0\u1ee2"+ + "\0\u1f25\0\u1f68\0\u0192\0\u0192\0\u1fab\0\u1fee\0\u2031\0\u2074"+ + "\0\u0d9c\0\u0192\0\u20b7\0\u0192\0\u0192\0\u20fa\0\u0192\0\u0192"+ + "\0\u213d\0\u2180\0\u21c3\0\u2206\0\u2249\0\u228c\0\u0192\0\u0192"+ + "\0\u0192\0\u0192\0\u0192\0\u0192\0\u0192\0\u22cf\0\u2312\0\u2355"+ + "\0\u2398\0\u23db\0\u0192\0\u241e\0\u2461\0\u24a4\0\u24e7\0\u252a"+ + "\0\u0192"; private static int [] zzUnpackRowMap() { - int [] result = new int[189]; + int [] result = new int[193]; int offset = 0; offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result); return result; @@ -159,35 +160,35 @@ private static int zzUnpackRowMap(String packed, int offset, int [] result) { "\1\2\1\3\1\4\1\5\1\6\1\7\1\10\1\2"+ "\1\11\1\12\1\13\6\12\3\10\1\12\1\14\1\15"+ "\1\16\1\17\1\10\1\20\1\21\1\2\1\22\1\23"+ - "\1\24\1\25\1\26\1\10\1\27\1\10\1\30\1\31"+ - "\1\10\1\32\1\33\1\10\1\34\1\35\1\10\1\36"+ - "\1\37\1\40\1\41\1\42\1\43\1\44\1\45\1\46"+ - "\1\47\1\50\1\51\1\52\1\53\1\54\1\55\1\56"+ - "\1\57\1\60\1\61\1\62\105\0\1\4\103\0\2\5"+ - "\1\7\100\0\1\5\1\63\1\7\75\0\1\7\1\64"+ - "\1\65\100\7\6\0\22\10\1\0\1\10\4\0\22\10"+ - "\33\0\2\66\1\67\6\66\1\70\1\0\1\71\1\66"+ - "\1\72\1\71\1\73\1\74\1\75\7\0\1\75\6\0"+ - "\1\67\1\73\41\0\2\12\1\67\6\12\3\0\1\12"+ - "\2\0\1\73\1\74\1\75\7\0\1\75\6\0\1\67"+ - "\1\73\37\0\5\10\1\76\1\77\1\100\1\101\11\10"+ - "\1\0\1\10\4\0\22\10\31\0\20\10\1\102\1\10"+ - "\1\0\1\10\4\0\2\10\1\103\17\10\31\0\22\10"+ - "\1\0\1\10\4\0\2\10\1\104\17\10\31\0\22\10"+ - "\1\0\1\10\4\0\1\105\21\10\33\0\2\74\1\0"+ - "\6\74\3\0\1\74\153\0\1\106\5\0\1\107\2\0"+ - "\30\107\1\110\1\111\46\107\1\112\2\0\31\112\1\113"+ - "\1\114\45\112\6\0\22\10\1\0\1\10\4\0\1\10"+ - "\1\115\6\10\1\116\11\10\31\0\22\10\1\0\1\10"+ - "\4\0\11\10\1\117\10\10\31\0\4\10\1\120\15\10"+ - "\1\0\1\10\4\0\3\10\1\121\16\10\31\0\22\10"+ - "\1\0\1\10\4\0\6\10\1\122\13\10\31\0\20\10"+ - "\1\123\1\10\1\0\1\10\4\0\5\10\1\124\1\125"+ - "\13\10\31\0\22\10\1\0\1\10\4\0\3\10\1\126"+ - "\16\10\31\0\20\10\1\127\1\10\1\0\1\10\4\0"+ - "\22\10\31\0\5\10\1\76\1\77\1\100\1\101\11\10"+ - "\1\0\1\10\4\0\10\10\1\130\2\10\1\131\1\132"+ - "\5\10\31\0\7\10\1\100\1\101\7\10\1\133\1\10"+ + "\1\24\1\25\1\26\1\10\1\27\2\10\1\30\1\31"+ + "\1\32\1\33\1\10\1\34\1\35\1\10\1\36\1\37"+ + "\1\40\1\41\1\42\1\43\1\44\1\45\1\46\1\47"+ + "\1\50\1\51\1\52\1\53\1\54\1\55\1\56\1\57"+ + "\1\60\1\61\1\62\105\0\1\4\103\0\2\5\1\7"+ + "\100\0\1\5\1\63\1\7\75\0\1\7\1\64\1\65"+ + "\100\7\6\0\22\10\1\0\1\10\4\0\22\10\33\0"+ + "\2\66\1\67\6\66\1\70\1\0\1\71\1\66\1\72"+ + "\1\71\1\73\1\74\1\75\7\0\1\75\4\0\1\67"+ + "\2\0\1\73\41\0\2\12\1\67\6\12\3\0\1\12"+ + "\2\0\1\73\1\74\1\75\7\0\1\75\4\0\1\67"+ + "\2\0\1\73\37\0\5\10\1\76\1\77\1\100\1\101"+ + "\11\10\1\0\1\10\4\0\12\10\1\102\1\103\1\104"+ + "\5\10\31\0\20\10\1\105\1\10\1\0\1\10\4\0"+ + "\2\10\1\106\17\10\31\0\22\10\1\0\1\10\4\0"+ + "\2\10\1\107\17\10\31\0\22\10\1\0\1\10\4\0"+ + "\1\110\21\10\33\0\2\74\1\0\6\74\3\0\1\74"+ + "\153\0\1\111\5\0\1\112\2\0\30\112\1\113\1\114"+ + "\46\112\1\115\2\0\31\115\1\116\1\117\45\115\6\0"+ + "\22\10\1\0\1\10\4\0\1\10\1\120\10\10\1\121"+ + "\7\10\31\0\22\10\1\0\1\10\4\0\7\10\1\122"+ + "\12\10\31\0\22\10\1\0\1\10\4\0\3\10\1\123"+ + "\4\10\1\124\11\10\31\0\22\10\1\0\1\10\4\0"+ + "\6\10\1\125\13\10\31\0\20\10\1\126\1\10\1\0"+ + "\1\10\4\0\5\10\1\127\1\130\13\10\31\0\5\10"+ + "\1\76\1\77\1\100\1\101\11\10\1\0\1\10\4\0"+ + "\22\10\31\0\22\10\1\0\1\10\4\0\3\10\1\131"+ + "\16\10\31\0\20\10\1\132\1\10\1\0\1\10\4\0"+ + "\22\10\31\0\7\10\1\100\1\101\7\10\1\133\1\10"+ "\1\0\1\10\4\0\6\10\1\134\13\10\31\0\22\10"+ "\1\0\1\10\4\0\1\135\21\10\31\0\22\10\1\0"+ "\1\10\4\0\17\10\1\136\2\10\31\0\22\10\1\0"+ @@ -201,7 +202,7 @@ private static int zzUnpackRowMap(String packed, int offset, int [] result) { "\1\75\7\0\1\73\44\0\1\73\1\155\1\156\1\157"+ "\74\0\2\160\1\0\6\160\1\0\1\160\1\0\2\160"+ "\1\0\1\160\1\0\1\160\4\0\1\160\2\0\1\160"+ - "\1\0\1\160\1\0\1\160\3\0\1\160\41\0\1\161"+ + "\1\0\1\160\3\0\1\160\1\0\1\160\41\0\1\161"+ "\3\0\5\161\3\0\1\161\66\0\1\162\3\0\1\162"+ "\76\0\2\74\1\0\6\74\3\0\1\74\2\0\1\73"+ "\1\0\1\75\7\0\1\75\7\0\1\73\41\0\2\163"+ @@ -209,87 +210,90 @@ private static int zzUnpackRowMap(String packed, int offset, int [] result) { "\24\0\7\10\1\76\12\10\1\0\1\10\4\0\22\10"+ "\31\0\12\10\1\76\7\10\1\0\1\10\4\0\22\10"+ "\31\0\11\10\1\76\10\10\1\0\1\10\4\0\22\10"+ - "\31\0\20\10\1\165\1\10\1\0\1\10\4\0\22\10"+ - "\31\0\22\10\1\0\1\10\4\0\3\10\1\166\16\10"+ - "\31\0\22\10\1\0\1\10\4\0\6\10\1\167\13\10"+ - "\23\0\1\107\2\0\30\107\1\170\1\111\46\107\33\0"+ - "\1\171\47\0\103\107\1\112\2\0\31\112\1\113\1\170"+ - "\150\112\35\0\1\172\53\0\22\10\1\0\1\10\4\0"+ - "\7\10\1\173\12\10\31\0\22\10\1\0\1\10\4\0"+ - "\2\10\1\76\17\10\31\0\22\10\1\0\1\10\4\0"+ - "\10\10\1\174\11\10\31\0\22\10\1\0\1\10\4\0"+ - "\11\10\1\175\10\10\31\0\22\10\1\0\1\10\4\0"+ - "\1\10\1\176\10\10\1\177\7\10\31\0\22\10\1\0"+ - "\1\10\4\0\10\10\1\200\11\10\31\0\20\10\1\201"+ + "\31\0\22\10\1\0\1\10\4\0\7\10\1\76\12\10"+ + "\31\0\22\10\1\0\1\10\4\0\15\10\1\165\4\10"+ + "\31\0\20\10\1\166\1\10\1\0\1\10\4\0\22\10"+ + "\31\0\22\10\1\0\1\10\4\0\3\10\1\167\16\10"+ + "\31\0\22\10\1\0\1\10\4\0\6\10\1\170\13\10"+ + "\23\0\1\112\2\0\30\112\1\171\1\114\46\112\33\0"+ + "\1\172\47\0\103\112\1\115\2\0\31\115\1\116\1\171"+ + "\150\115\35\0\1\173\53\0\22\10\1\0\1\10\4\0"+ + "\11\10\1\174\10\10\31\0\22\10\1\0\1\10\4\0"+ + "\2\10\1\175\17\10\31\0\22\10\1\0\1\10\4\0"+ + "\7\10\1\176\12\10\31\0\22\10\1\0\1\10\4\0"+ + "\12\10\1\177\7\10\31\0\4\10\1\200\15\10\1\0"+ + "\1\10\4\0\1\10\1\201\20\10\31\0\22\10\1\0"+ + "\1\10\4\0\12\10\1\202\7\10\31\0\20\10\1\203"+ "\1\10\1\0\1\10\4\0\22\10\31\0\22\10\1\0"+ - "\1\10\4\0\1\202\21\10\31\0\22\10\1\0\1\10"+ - "\4\0\6\10\1\203\4\10\1\204\6\10\31\0\22\10"+ - "\1\0\1\10\4\0\11\10\1\205\10\10\31\0\22\10"+ - "\1\0\1\10\4\0\11\10\1\76\10\10\31\0\22\10"+ - "\1\0\1\10\4\0\15\10\1\206\4\10\31\0\22\10"+ - "\1\0\1\10\4\0\2\10\1\207\17\10\31\0\20\10"+ - "\1\210\1\10\1\0\1\10\4\0\22\10\31\0\22\10"+ - "\1\0\1\10\4\0\1\10\1\211\20\10\31\0\22\10"+ - "\1\0\1\10\4\0\12\10\1\212\7\10\31\0\4\10"+ + "\1\10\4\0\1\204\21\10\31\0\22\10\1\0\1\10"+ + "\4\0\6\10\1\205\4\10\1\206\6\10\31\0\22\10"+ + "\1\0\1\10\4\0\7\10\1\207\12\10\31\0\22\10"+ + "\1\0\1\10\4\0\2\10\1\210\17\10\31\0\20\10"+ + "\1\211\1\10\1\0\1\10\4\0\22\10\31\0\22\10"+ + "\1\0\1\10\4\0\1\10\1\212\20\10\31\0\4\10"+ "\1\213\15\10\1\0\1\10\4\0\22\10\31\0\22\10"+ - "\1\0\1\10\4\0\10\10\1\214\11\10\120\0\1\215"+ - "\102\0\1\216\10\0\1\5\1\217\1\7\112\0\1\73"+ + "\1\0\1\10\4\0\10\10\1\214\11\10\31\0\22\10"+ + "\1\0\1\10\4\0\12\10\1\215\7\10\120\0\1\216"+ + "\102\0\1\217\10\0\1\5\1\220\1\7\112\0\1\73"+ "\105\0\1\73\101\0\1\73\73\0\2\160\1\67\6\160"+ "\1\0\1\160\1\0\2\160\1\0\1\160\1\0\1\160"+ - "\4\0\1\160\2\0\1\160\1\0\1\160\1\0\1\160"+ - "\2\0\1\67\1\160\41\0\1\161\1\0\1\67\1\0"+ - "\5\161\3\0\1\161\23\0\1\67\42\0\1\162\1\0"+ - "\1\67\1\0\1\162\33\0\1\67\42\0\2\163\1\0"+ + "\4\0\1\160\2\0\1\160\1\0\1\160\2\0\1\67"+ + "\1\160\1\0\1\160\41\0\1\161\1\0\1\67\1\0"+ + "\5\161\3\0\1\161\21\0\1\67\44\0\1\162\1\0"+ + "\1\67\1\0\1\162\31\0\1\67\44\0\2\163\1\0"+ "\6\163\3\0\1\163\2\0\1\73\21\0\1\73\41\0"+ - "\2\163\1\0\6\163\3\0\1\163\64\0\22\10\1\0"+ - "\1\10\4\0\6\10\1\76\13\10\31\0\22\10\1\0"+ - "\1\10\4\0\1\220\21\10\31\0\22\10\1\0\1\10"+ - "\4\0\1\10\1\221\20\10\23\0\33\171\1\222\1\223"+ - "\46\171\34\172\1\224\1\225\45\172\6\0\22\10\1\0"+ - "\1\10\4\0\11\10\1\226\10\10\31\0\4\10\1\227"+ - "\15\10\1\0\1\10\4\0\22\10\31\0\22\10\1\0"+ - "\1\10\4\0\3\10\1\230\16\10\31\0\22\10\1\0"+ - "\1\10\4\0\13\10\1\231\6\10\31\0\22\10\1\0"+ - "\1\10\4\0\11\10\1\232\10\10\31\0\22\10\1\0"+ - "\1\10\4\0\7\10\1\233\12\10\31\0\22\10\1\0"+ - "\1\10\4\0\1\10\1\234\20\10\31\0\22\10\1\0"+ - "\1\10\4\0\3\10\1\235\16\10\31\0\20\10\1\236"+ + "\2\163\1\0\6\163\3\0\1\163\64\0\20\10\1\221"+ "\1\10\1\0\1\10\4\0\22\10\31\0\22\10\1\0"+ - "\1\10\4\0\1\237\21\10\31\0\22\10\1\0\1\10"+ - "\4\0\1\10\1\240\20\10\31\0\22\10\1\0\1\10"+ - "\4\0\6\10\1\241\13\10\31\0\22\10\1\0\1\10"+ - "\4\0\3\10\1\242\16\10\31\0\22\10\1\0\1\10"+ - "\4\0\3\10\1\243\16\10\26\0\1\5\1\6\1\7"+ - "\103\0\22\10\1\0\1\10\4\0\4\10\1\244\15\10"+ - "\31\0\22\10\1\0\1\10\4\0\3\10\1\245\16\10"+ - "\23\0\33\171\1\246\1\223\151\171\137\172\1\224\1\247"+ - "\45\172\6\0\22\10\1\0\1\10\4\0\12\10\1\250"+ - "\7\10\31\0\22\10\1\0\1\10\4\0\2\10\1\251"+ - "\17\10\31\0\22\10\1\0\1\10\4\0\12\10\1\252"+ - "\7\10\31\0\22\10\1\0\1\10\4\0\3\10\1\253"+ - "\16\10\31\0\22\10\1\0\1\10\4\0\1\10\1\254"+ - "\20\10\31\0\22\10\1\0\1\10\4\0\2\10\1\255"+ - "\17\10\31\0\22\10\1\0\1\10\4\0\2\10\1\256"+ - "\17\10\31\0\22\10\1\0\1\10\4\0\3\10\1\257"+ - "\16\10\23\0\33\171\1\170\1\223\46\171\34\172\1\224"+ - "\1\170\45\172\6\0\22\10\1\0\1\10\4\0\14\10"+ - "\1\260\5\10\31\0\22\10\1\0\1\10\4\0\10\10"+ - "\1\261\11\10\31\0\22\10\1\0\1\10\4\0\10\10"+ - "\1\262\11\10\31\0\22\10\1\0\1\10\4\0\11\10"+ - "\1\263\10\10\31\0\22\10\1\0\1\10\4\0\3\10"+ - "\1\264\16\10\31\0\4\10\1\265\15\10\1\0\1\10"+ - "\4\0\22\10\31\0\22\10\1\0\1\10\4\0\13\10"+ - "\1\266\6\10\31\0\22\10\1\0\1\10\4\0\3\10"+ - "\1\267\16\10\31\0\22\10\1\0\1\10\4\0\3\10"+ - "\1\270\16\10\31\0\22\10\1\0\1\10\4\0\1\271"+ - "\21\10\31\0\22\10\1\0\1\10\4\0\11\10\1\272"+ - "\10\10\31\0\4\10\1\273\15\10\1\0\1\10\4\0"+ - "\22\10\31\0\22\10\1\0\1\10\4\0\2\10\1\274"+ - "\17\10\31\0\22\10\1\0\1\10\4\0\3\10\1\275"+ + "\1\10\4\0\6\10\1\76\13\10\31\0\22\10\1\0"+ + "\1\10\4\0\1\222\21\10\31\0\22\10\1\0\1\10"+ + "\4\0\1\10\1\223\20\10\23\0\33\172\1\224\1\225"+ + "\46\172\34\173\1\226\1\227\45\173\6\0\22\10\1\0"+ + "\1\10\4\0\10\10\1\230\11\10\31\0\22\10\1\0"+ + "\1\10\4\0\10\10\1\231\11\10\31\0\22\10\1\0"+ + "\1\10\4\0\7\10\1\232\12\10\31\0\22\10\1\0"+ + "\1\10\4\0\13\10\1\233\6\10\31\0\22\10\1\0"+ + "\1\10\4\0\3\10\1\234\16\10\31\0\22\10\1\0"+ + "\1\10\4\0\7\10\1\235\12\10\31\0\22\10\1\0"+ + "\1\10\4\0\11\10\1\236\10\10\31\0\22\10\1\0"+ + "\1\10\4\0\1\10\1\237\20\10\31\0\22\10\1\0"+ + "\1\10\4\0\3\10\1\240\16\10\31\0\22\10\1\0"+ + "\1\10\4\0\1\241\21\10\31\0\22\10\1\0\1\10"+ + "\4\0\1\10\1\242\20\10\31\0\22\10\1\0\1\10"+ + "\4\0\6\10\1\243\13\10\31\0\22\10\1\0\1\10"+ + "\4\0\3\10\1\244\16\10\31\0\22\10\1\0\1\10"+ + "\4\0\3\10\1\245\16\10\26\0\1\5\1\6\1\7"+ + "\103\0\22\10\1\0\1\10\4\0\2\10\1\246\17\10"+ + "\31\0\22\10\1\0\1\10\4\0\4\10\1\247\15\10"+ + "\31\0\22\10\1\0\1\10\4\0\3\10\1\250\16\10"+ + "\23\0\33\172\1\251\1\225\151\172\137\173\1\226\1\252"+ + "\45\173\6\0\22\10\1\0\1\10\4\0\5\10\1\253"+ + "\14\10\31\0\22\10\1\0\1\10\4\0\2\10\1\254"+ + "\17\10\31\0\4\10\1\255\15\10\1\0\1\10\4\0"+ + "\22\10\31\0\4\10\1\256\15\10\1\0\1\10\4\0"+ + "\22\10\31\0\22\10\1\0\1\10\4\0\3\10\1\257"+ + "\16\10\31\0\22\10\1\0\1\10\4\0\1\10\1\260"+ + "\20\10\31\0\22\10\1\0\1\10\4\0\2\10\1\261"+ + "\17\10\31\0\22\10\1\0\1\10\4\0\3\10\1\262"+ + "\16\10\31\0\22\10\1\0\1\10\4\0\7\10\1\263"+ + "\12\10\23\0\33\172\1\171\1\225\46\172\34\173\1\226"+ + "\1\171\45\173\6\0\22\10\1\0\1\10\4\0\7\10"+ + "\1\264\12\10\31\0\22\10\1\0\1\10\4\0\12\10"+ + "\1\265\7\10\31\0\22\10\1\0\1\10\4\0\14\10"+ + "\1\266\5\10\31\0\22\10\1\0\1\10\4\0\12\10"+ + "\1\267\7\10\31\0\22\10\1\0\1\10\4\0\3\10"+ + "\1\270\16\10\31\0\22\10\1\0\1\10\4\0\10\10"+ + "\1\271\11\10\31\0\22\10\1\0\1\10\4\0\13\10"+ + "\1\272\6\10\31\0\22\10\1\0\1\10\4\0\3\10"+ + "\1\273\16\10\31\0\22\10\1\0\1\10\4\0\3\10"+ + "\1\274\16\10\31\0\22\10\1\0\1\10\4\0\1\275"+ + "\21\10\31\0\22\10\1\0\1\10\4\0\7\10\1\276"+ + "\12\10\31\0\22\10\1\0\1\10\4\0\10\10\1\277"+ + "\11\10\31\0\22\10\1\0\1\10\4\0\2\10\1\300"+ + "\17\10\31\0\22\10\1\0\1\10\4\0\3\10\1\301"+ "\16\10\23\0"; private static int [] zzUnpackTrans() { - int [] result = new int[9380]; + int [] result = new int[9581]; int offset = 0; offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result); return result; @@ -328,13 +332,13 @@ private static int zzUnpackTrans(String packed, int offset, int [] result) { private static final String ZZ_ATTRIBUTE_PACKED_0 = "\1\0\1\11\1\1\1\11\33\1\4\11\13\1\4\11"+ - "\2\1\1\11\1\1\4\0\1\11\1\1\1\0\10\1"+ - "\1\11\32\1\2\11\1\1\4\11\1\1\3\11\1\1"+ - "\3\0\4\1\1\0\3\1\1\11\24\1\2\11\3\1"+ - "\4\0\20\1\2\0\26\1"; + "\2\1\1\11\1\1\4\0\1\11\1\1\1\0\13\1"+ + "\1\11\27\1\2\11\1\1\4\11\1\1\3\11\1\1"+ + "\3\0\4\1\1\0\4\1\1\11\24\1\2\11\4\1"+ + "\4\0\21\1\2\0\27\1"; private static int [] zzUnpackAttribute() { - int [] result = new int[189]; + int [] result = new int[193]; int offset = 0; offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result); return result; @@ -638,327 +642,332 @@ else if (zzAtEOF) { { return TokenType.BAD_CHARACTER; } // fall through - case 66: break; + case 67: break; case 2: { return YakshaTypes.NL; } // fall through - case 67: break; + case 68: break; case 3: { return YakshaTypes.S; } // fall through - case 68: break; + case 69: break; case 4: { return YakshaTypes.COMMENT; } // fall through - case 69: break; + case 70: break; case 5: { return YakshaTypes.IDENTIFIER; } // fall through - case 70: break; + case 71: break; case 6: { return YakshaTypes.NUMBER; } // fall through - case 71: break; + case 72: break; case 7: { return YakshaTypes.OPERATOR_DOT; } // fall through - case 72: break; + case 73: break; case 8: { return YakshaTypes.OPERATOR_PLUS; } // fall through - case 73: break; + case 74: break; case 9: { return YakshaTypes.STRING; } // fall through - case 74: break; + case 75: break; case 10: { return YakshaTypes.OPERATOR_OPEN_P; } // fall through - case 75: break; + case 76: break; case 11: { return YakshaTypes.OPERATOR_CLOSE_P; } // fall through - case 76: break; + case 77: break; case 12: { return YakshaTypes.OPERATOR_OPEN_SQB; } // fall through - case 77: break; + case 78: break; case 13: { return YakshaTypes.OPERATOR_CLOSE_SQB; } // fall through - case 78: break; + case 79: break; case 14: { return YakshaTypes.OPERATOR_MINUS; } // fall through - case 79: break; + case 80: break; case 15: { return YakshaTypes.OPERATOR_COMPARISON; } // fall through - case 80: break; + case 81: break; case 16: { return YakshaTypes.OPERATOR_MUL; } // fall through - case 81: break; + case 82: break; case 17: { return YakshaTypes.OPERATOR_DIV; } // fall through - case 82: break; + case 83: break; case 18: { return YakshaTypes.OPERATOR_REMAINDER; } // fall through - case 83: break; + case 84: break; case 19: { return YakshaTypes.OPERATOR_B_AND; } // fall through - case 84: break; + case 85: break; case 20: { return YakshaTypes.OPERATOR_B_OR; } // fall through - case 85: break; + case 86: break; case 21: { return YakshaTypes.OPERATOR_B_XOR; } // fall through - case 86: break; + case 87: break; case 22: { return YakshaTypes.OPERATOR_EQ; } // fall through - case 87: break; + case 88: break; case 23: { return YakshaTypes.OPERATOR_AT; } // fall through - case 88: break; + case 89: break; case 24: { return YakshaTypes.OPERATOR_COLON; } // fall through - case 89: break; + case 90: break; case 25: { return YakshaTypes.OPERATOR_COMMA; } // fall through - case 90: break; + case 91: break; case 26: { return YakshaTypes.OPERATOR_B_NOT; } // fall through - case 91: break; + case 92: break; case 27: { return YakshaTypes.PRIMITIVE_DATA_TYPE; } // fall through - case 92: break; + case 93: break; case 28: - { return YakshaTypes.OPERATOR_OR; + { return YakshaTypes.KW_IN; } // fall through - case 93: break; + case 94: break; case 29: - { return YakshaTypes.OPERATOR_PLUS_EQ; + { return YakshaTypes.KW_IF; } // fall through - case 94: break; + case 95: break; case 30: - { return YakshaTypes.KW_AS; + { return YakshaTypes.OPERATOR_OR; } // fall through - case 95: break; + case 96: break; case 31: - { return YakshaTypes.KW_IN; + { return YakshaTypes.OPERATOR_PLUS_EQ; } // fall through - case 96: break; + case 97: break; case 32: - { return YakshaTypes.KW_IF; + { return YakshaTypes.KW_AS; } // fall through - case 97: break; + case 98: break; case 33: { return YakshaTypes.OPERATOR_ARROW; } // fall through - case 98: break; + case 99: break; case 34: { return YakshaTypes.OPERATOR_MINUS_EQ; } // fall through - case 99: break; + case 100: break; case 35: { return YakshaTypes.OPERATOR_SHR; } // fall through - case 100: break; + case 101: break; case 36: { return YakshaTypes.OPERATOR_MUL_EQ; } // fall through - case 101: break; + case 102: break; case 37: { return YakshaTypes.OPERATOR_DIV_EQ; } // fall through - case 102: break; + case 103: break; case 38: { return YakshaTypes.OPERATOR_REMAINDER_EQ; } // fall through - case 103: break; + case 104: break; case 39: { return YakshaTypes.OPERATOR_SHL; } // fall through - case 104: break; + case 105: break; case 40: { return YakshaTypes.OPERATOR_B_AND_EQ; } // fall through - case 105: break; + case 106: break; case 41: { return YakshaTypes.OPERATOR_B_OR_EQ; } // fall through - case 106: break; + case 107: break; case 42: { return YakshaTypes.OPERATOR_B_XOR_EQ; } // fall through - case 107: break; + case 108: break; case 43: { return YakshaTypes.OPERATOR_AND; } // fall through - case 108: break; + case 109: break; case 44: { return YakshaTypes.KW_DEL; } // fall through - case 109: break; + case 110: break; case 45: { return YakshaTypes.KW_DEF; } // fall through - case 110: break; + case 111: break; case 46: { return YakshaTypes.OPERATOR_NOT; } // fall through - case 111: break; + case 112: break; case 47: { return YakshaTypes.KW_FOR; } // fall through - case 112: break; + case 113: break; case 48: { return YakshaTypes.OPERATOR_SHR_EQ; } // fall through - case 113: break; + case 114: break; case 49: { return YakshaTypes.OPERATOR_SHL_EQ; } // fall through - case 114: break; + case 115: break; case 50: { return YakshaTypes.I; } // fall through - case 115: break; + case 116: break; case 51: - { return YakshaTypes.KW_ELSE; + { return YakshaTypes.KW_ELIF; } // fall through - case 116: break; + case 117: break; case 52: - { return YakshaTypes.KW_ELIF; + { return YakshaTypes.KW_ELSE; } // fall through - case 117: break; + case 118: break; case 53: { return YakshaTypes.KW_PASS; } // fall through - case 118: break; + case 119: break; case 54: { return YakshaTypes.KW_TRUE; } // fall through - case 119: break; + case 120: break; case 55: { return YakshaTypes.KW_NONE; } // fall through - case 120: break; + case 121: break; case 56: { return YakshaTypes.KW_BREAK; } // fall through - case 121: break; + case 122: break; case 57: { return YakshaTypes.KW_FALSE; } // fall through - case 122: break; + case 123: break; case 58: { return YakshaTypes.KW_CCODE; } // fall through - case 123: break; + case 124: break; case 59: { return YakshaTypes.KW_CLASS; } // fall through - case 124: break; + case 125: break; case 60: { return YakshaTypes.KW_DEFER; } // fall through - case 125: break; + case 126: break; case 61: { return YakshaTypes.KW_WHILE; } // fall through - case 126: break; + case 127: break; case 62: - { return YakshaTypes.KW_RETURN; + { return YakshaTypes.KW_IMPORT; } // fall through - case 127: break; + case 128: break; case 63: - { return YakshaTypes.KW_IMPORT; + { return YakshaTypes.KW_STRUCT; } // fall through - case 128: break; + case 129: break; case 64: - { return YakshaTypes.KW_CONTINUE; + { return YakshaTypes.KW_RETURN; } // fall through - case 129: break; + case 130: break; case 65: + { return YakshaTypes.KW_CONTINUE; + } + // fall through + case 131: break; + case 66: { return YakshaTypes.KW_RUNTIMEFEATURE; } // fall through - case 130: break; + case 132: break; default: zzScanError(ZZ_NO_MATCH); } diff --git a/editor/intellij/src/main/gen/org/intellij/sdk/language/parser/YakshaParser.java b/editor/intellij/src/main/gen/org/intellij/sdk/language/parser/YakshaParser.java index 7c291c0e..2436aba9 100644 --- a/editor/intellij/src/main/gen/org/intellij/sdk/language/parser/YakshaParser.java +++ b/editor/intellij/src/main/gen/org/intellij/sdk/language/parser/YakshaParser.java @@ -465,18 +465,28 @@ private static boolean class_field_wo_indent_5(PsiBuilder b, int l) { } /* ********************************************************** */ - // KW_CLASS S IDENTIFIER S? OPERATOR_COLON S? class_block + // (KW_CLASS | KW_STRUCT) S IDENTIFIER S? OPERATOR_COLON S? class_block public static boolean class_statement(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "class_statement")) return false; - if (!nextTokenIs(b, KW_CLASS)) return false; + if (!nextTokenIs(b, "", KW_CLASS, KW_STRUCT)) return false; boolean r; - Marker m = enter_section_(b); - r = consumeTokens(b, 0, KW_CLASS, S, IDENTIFIER); + Marker m = enter_section_(b, l, _NONE_, CLASS_STATEMENT, ""); + r = class_statement_0(b, l + 1); + r = r && consumeTokens(b, 0, S, IDENTIFIER); r = r && class_statement_3(b, l + 1); r = r && consumeToken(b, OPERATOR_COLON); r = r && class_statement_5(b, l + 1); r = r && class_block(b, l + 1); - exit_section_(b, m, CLASS_STATEMENT, r); + exit_section_(b, l, m, r, false, null); + return r; + } + + // KW_CLASS | KW_STRUCT + private static boolean class_statement_0(PsiBuilder b, int l) { + if (!recursion_guard_(b, l, "class_statement_0")) return false; + boolean r; + r = consumeToken(b, KW_CLASS); + if (!r) r = consumeToken(b, KW_STRUCT); return r; } @@ -2217,7 +2227,7 @@ private static boolean term_0_1_0_2(PsiBuilder b, int l) { } /* ********************************************************** */ - // !('@' | 'class' | 'def' | 'import' | 'runtimefeature') + // !('@' | 'class' | 'struct' | 'def' | 'import' | 'runtimefeature') static boolean top_level_recover(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "top_level_recover")) return false; boolean r; @@ -2227,12 +2237,13 @@ static boolean top_level_recover(PsiBuilder b, int l) { return r; } - // '@' | 'class' | 'def' | 'import' | 'runtimefeature' + // '@' | 'class' | 'struct' | 'def' | 'import' | 'runtimefeature' private static boolean top_level_recover_0(PsiBuilder b, int l) { if (!recursion_guard_(b, l, "top_level_recover_0")) return false; boolean r; r = consumeToken(b, "@"); if (!r) r = consumeToken(b, "class"); + if (!r) r = consumeToken(b, "struct"); if (!r) r = consumeToken(b, "def"); if (!r) r = consumeToken(b, "import"); if (!r) r = consumeToken(b, "runtimefeature"); diff --git a/editor/intellij/src/main/gen/org/intellij/sdk/language/psi/YakshaTypes.java b/editor/intellij/src/main/gen/org/intellij/sdk/language/psi/YakshaTypes.java index db3cb385..2dd3703f 100644 --- a/editor/intellij/src/main/gen/org/intellij/sdk/language/psi/YakshaTypes.java +++ b/editor/intellij/src/main/gen/org/intellij/sdk/language/psi/YakshaTypes.java @@ -91,6 +91,7 @@ public interface YakshaTypes { IElementType KW_PASS = new YakshaTokenType("KW_PASS"); IElementType KW_RETURN = new YakshaTokenType("KW_RETURN"); IElementType KW_RUNTIMEFEATURE = new YakshaTokenType("KW_RUNTIMEFEATURE"); + IElementType KW_STRUCT = new YakshaTokenType("KW_STRUCT"); IElementType KW_TRUE = new YakshaTokenType("KW_TRUE"); IElementType KW_WHILE = new YakshaTokenType("KW_WHILE"); IElementType NL = new YakshaTokenType("NL"); diff --git a/editor/intellij/src/main/java/org/intellij/sdk/language/Yaksha.bnf b/editor/intellij/src/main/java/org/intellij/sdk/language/Yaksha.bnf index 18398828..d72b9cbe 100644 --- a/editor/intellij/src/main/java/org/intellij/sdk/language/Yaksha.bnf +++ b/editor/intellij/src/main/java/org/intellij/sdk/language/Yaksha.bnf @@ -17,7 +17,7 @@ } yakshaFile ::= item_* {pin=1 recoverWhile="top_level_recover" name="import, def, class"} -private top_level_recover ::= !('@' | 'class' | 'def' | 'import' | 'runtimefeature') +private top_level_recover ::= !('@' | 'class' | 'struct' | 'def' | 'import' | 'runtimefeature') private item_ ::= (outer_statement | COMMENT | empty_line) @@ -39,7 +39,7 @@ const_statement ::= IDENTIFIER S? OPERATOR_COLON S? data_type S? OPERATOR_EQ S? } literal ::= NUMBER | KW_TRUE | KW_FALSE -class_statement ::= KW_CLASS S IDENTIFIER S? OPERATOR_COLON S? class_block { +class_statement ::= (KW_CLASS | KW_STRUCT) S IDENTIFIER S? OPERATOR_COLON S? class_block { mixin="org.intellij.sdk.language.psi.impl.YakshaNamedElementImpl" implements="org.intellij.sdk.language.psi.YakshaNamedElement" methods=[getName setName getNameIdentifier getPresentation] diff --git a/editor/intellij/src/main/java/org/intellij/sdk/language/Yaksha.flex b/editor/intellij/src/main/java/org/intellij/sdk/language/Yaksha.flex index 34751304..def510d5 100644 --- a/editor/intellij/src/main/java/org/intellij/sdk/language/Yaksha.flex +++ b/editor/intellij/src/main/java/org/intellij/sdk/language/Yaksha.flex @@ -83,6 +83,7 @@ TRIPLE_APOS_LITERAL = {THREE_APOS} {APOS_STRING_CHAR}* {THREE_APOS}? "as" { return YakshaTypes.KW_AS; } "break" { return YakshaTypes.KW_BREAK; } "class" { return YakshaTypes.KW_CLASS; } + "struct" { return YakshaTypes.KW_STRUCT; } "ccode" { return YakshaTypes.KW_CCODE; } "continue" { return YakshaTypes.KW_CONTINUE; } "def" { return YakshaTypes.KW_DEF; } diff --git a/editor/intellij/src/main/java/org/intellij/sdk/language/YakshaSyntaxHighlighter.java b/editor/intellij/src/main/java/org/intellij/sdk/language/YakshaSyntaxHighlighter.java index 818e6060..311d32ec 100644 --- a/editor/intellij/src/main/java/org/intellij/sdk/language/YakshaSyntaxHighlighter.java +++ b/editor/intellij/src/main/java/org/intellij/sdk/language/YakshaSyntaxHighlighter.java @@ -86,6 +86,7 @@ public class YakshaSyntaxHighlighter extends SyntaxHighlighterBase { .add(YakshaTypes.KW_AS) .add(YakshaTypes.KW_BREAK) .add(YakshaTypes.KW_CLASS) + .add(YakshaTypes.KW_STRUCT) .add(YakshaTypes.KW_CCODE) .add(YakshaTypes.KW_CONTINUE) .add(YakshaTypes.KW_DEF) diff --git a/editor/notepadplusplus/yaksha.xml b/editor/notepadplusplus/yaksha.xml index 2267b24b..6bc462f8 100644 --- a/editor/notepadplusplus/yaksha.xml +++ b/editor/notepadplusplus/yaksha.xml @@ -24,7 +24,7 @@ - while def import continue break if elif else class return ccode pass defer del as for in + while def import continue break if elif else class struct return ccode pass defer del as for in @nativedefine @varargs @onstack @nativemacro @native int float i8 i16 i32 i64 u8 u16 u32 u64 float f32 f64 Array Function In Const AnyPtr Out SMEntry MEntry str bool Ptr Tuple AnyPtrToConst print println len arrput arrpop arrnew array getref unref charat shnew shput shget shgeti hmnew hmput hmget hmgeti cast qsort iif foreach countif filter map binarydata arrsetlen arrsetcap diff --git a/editor/vscode/syntaxes/yaksha.json b/editor/vscode/syntaxes/yaksha.json index c73bf74c..0356b03f 100644 --- a/editor/vscode/syntaxes/yaksha.json +++ b/editor/vscode/syntaxes/yaksha.json @@ -33,7 +33,7 @@ }, { "name": "keyword.language.yaksha", - "match": "\\b(while|def|import|continue|break|if|elif|else|class|return|pass|as|for|in)\\b" + "match": "\\b(while|def|import|continue|break|if|elif|else|class|struct|return|pass|as|for|in)\\b" }, { "name": "invalid.spaces.yaksha", @@ -64,7 +64,7 @@ "match": "\\.|\\+|\\-|\\*|\\\/|\\:|\\[|\\]|\\(|\\)|,|>|<|<\\=|>\\=|\\=\\=|\\=|\\bnot\\b|\\bor\\b|\\band\\b|!\\=|\\->" }, { - "match": "^(class)\\s+([a-zA-Z_][a-zA-Z0-9_]+)\\s*", + "match": "^(class|struct)\\s+([a-zA-Z_][a-zA-Z0-9_]+)\\s*", "captures": { "1": { "name": "keyword.language.yaksha"