diff --git a/IDEA/build.gradle.kts b/IDEA/build.gradle.kts index f93ff00..60ddae3 100644 --- a/IDEA/build.gradle.kts +++ b/IDEA/build.gradle.kts @@ -41,7 +41,7 @@ kotlin { dependencies { intellijPlatform { - intellijIdeaCommunity("2025.1.1.1") + intellijIdeaCommunity("2024.3.4.1") bundledPlugins(listOf("com.intellij.java")) @@ -68,10 +68,10 @@ intellijPlatform { pluginConfiguration { // ... - version = "1.4.0.2" + version = "1.4.0.3" ideaVersion { - sinceBuild = "251.25410.129" + sinceBuild = "243.25659.59" untilBuild = provider { null } } } diff --git a/IDEA/src/main/grammar/KerboScript.bnf b/IDEA/src/main/grammar/KerboScript.bnf index eb03e12..a56bf6d 100644 --- a/IDEA/src/main/grammar/KerboScript.bnf +++ b/IDEA/src/main/grammar/KerboScript.bnf @@ -134,7 +134,7 @@ instruction ::= !(CURLYCLOSE | <>) instruction_inner { pin = 1 recoverWhile = instruction_recover } -private instruction_first ::= ADD | BREAK | CLEARSCREEN | COMPILE | COPY | DECLARE | DELETE | EDIT | FOR | FROM +private instruction_first ::= ADD | BREAK | CLEARSCREEN | COMPILE | COPY | CURLYOPEN | DECLARE | DELETE | EDIT | FOR | FROM | FUNCTION | GLOBAL | IF | LIST | LOCAL | LOCK | LOG | ON | PARAMETER | PRESERVE | PRINT | REBOOT | REMOVE | RENAME | RETURN | RUN | RUNONCEPATH | RUNPATH | SET | SHUTDOWN | STAGE | SWITCH | TOGGLE | UNLOCK | UNSET | UNTIL | WAIT | WHEN | COMMENTLINE | ident diff --git a/IDEA/src/test/testData/parsing/ErrorRecovery.ks b/IDEA/src/test/testData/parsing/ErrorRecovery.ks index eecdeaa..ef9a8e9 100644 --- a/IDEA/src/test/testData/parsing/ErrorRecovery.ks +++ b/IDEA/src/test/testData/parsing/ErrorRecovery.ks @@ -9,3 +9,11 @@ IF foo { PRINT } LOCAL baz TO 0. + +function test{ + print "begin". + { // Error highlighted here: '{' Unexpected + print "inside a code block". + } + print "end". +} \ No newline at end of file diff --git a/IDEA/src/test/testData/parsing/ErrorRecovery.txt b/IDEA/src/test/testData/parsing/ErrorRecovery.txt index bf89bdd..b92f2d1 100644 --- a/IDEA/src/test/testData/parsing/ErrorRecovery.txt +++ b/IDEA/src/test/testData/parsing/ErrorRecovery.txt @@ -1,4 +1,4 @@ -FILE(0,195) +FILE(0,340) PsiComment(COMMENTLINE)('// Testing instruction recovery')(0,31) PsiWhiteSpace('\n')(31,32) KerboScriptInstructionImpl(INSTRUCTION)(32,32) @@ -152,4 +152,47 @@ FILE(0,195) KerboScriptAtomImpl(ATOM)(193,194) KerboScriptNumberImpl(NUMBER)(193,194) PsiElement(INTEGER)('0')(193,194) - PsiElement(.)('.')(194,195) \ No newline at end of file + PsiElement(.)('.')(194,195) + PsiWhiteSpace('\n\n')(195,197) + KerboScriptDeclareStmtImpl(DECLARE_STMT)(197,340) + KerboScriptDeclareFunctionClauseImpl(DECLARE_FUNCTION_CLAUSE)(197,340) + PsiElement(FUNCTION)('function')(197,205) + PsiWhiteSpace(' ')(205,206) + KerboScriptIdentImpl(IDENT)(206,210) + PsiElement(IDENTIFIER)('test')(206,210) + KerboScriptInstructionBlockImpl(INSTRUCTION_BLOCK)(210,340) + PsiElement({)('{')(210,211) + PsiWhiteSpace('\n ')(211,216) + KerboScriptPrintStmtImpl(PRINT_STMT)(216,230) + PsiElement(PRINT)('print')(216,221) + PsiWhiteSpace(' ')(221,222) + KerboScriptSuffixtermImpl(SUFFIXTERM)(222,229) + KerboScriptAtomImpl(ATOM)(222,229) + PsiElement(STRING)('"begin"')(222,229) + PsiElement(.)('.')(229,230) + PsiWhiteSpace('\n ')(230,235) + KerboScriptInstructionImpl(INSTRUCTION)(235,321) + KerboScriptInstructionBlockImpl(INSTRUCTION_BLOCK)(235,321) + PsiElement({)('{')(235,236) + PsiWhiteSpace(' ')(236,237) + PsiComment(COMMENTLINE)('// Error highlighted here: '{' Unexpected')(237,278) + PsiWhiteSpace('\n ')(278,287) + KerboScriptPrintStmtImpl(PRINT_STMT)(287,315) + PsiElement(PRINT)('print')(287,292) + PsiWhiteSpace(' ')(292,293) + KerboScriptSuffixtermImpl(SUFFIXTERM)(293,314) + KerboScriptAtomImpl(ATOM)(293,314) + PsiElement(STRING)('"inside a code block"')(293,314) + PsiElement(.)('.')(314,315) + PsiWhiteSpace('\n ')(315,320) + PsiElement(})('}')(320,321) + PsiWhiteSpace('\n ')(321,326) + KerboScriptPrintStmtImpl(PRINT_STMT)(326,338) + PsiElement(PRINT)('print')(326,331) + PsiWhiteSpace(' ')(331,332) + KerboScriptSuffixtermImpl(SUFFIXTERM)(332,337) + KerboScriptAtomImpl(ATOM)(332,337) + PsiElement(STRING)('"end"')(332,337) + PsiElement(.)('.')(337,338) + PsiWhiteSpace('\n')(338,339) + PsiElement(})('}')(339,340) \ No newline at end of file