diff --git a/shirelang/src/main/grammar/ShireParser.bnf b/shirelang/src/main/grammar/ShireParser.bnf index 785387a9..bbf4cfdd 100644 --- a/shirelang/src/main/grammar/ShireParser.bnf +++ b/shirelang/src/main/grammar/ShireParser.bnf @@ -201,11 +201,18 @@ code ::= CODE_BLOCK_START (languageId | variableStart expr)? NEWLINE? code_conte code_contents ::= (NEWLINE | CODE_CONTENT)* velocityExpr ::= - '#' 'if' '('variableStart? expr ')' - | '#' 'else' - | '#' 'elseif' '(' variableStart? expr ')' - | '#' 'end' - | '#' 'endif' + ifExpr NEWLINE* + +velocityBlock ::= (used | code | velocityExpr | markdownHeader | TEXT_SEGMENT | NEWLINE | CONTENT_COMMENTS)* + +ifExpr ::= ifClause elseifClause* elseClause? '#' 'end' + +ifClause ::= '#' 'if' '(' expr ')' velocityBlock + +elseifClause ::= '#' 'elseif' '(' expr ')' velocityBlock + +elseClause ::= '#' 'else' velocityBlock + // for example, the commit id will be #$storyId markdownHeader ::= SHARP SHARP* TEXT_SEGMENT diff --git a/shirelang/src/main/kotlin/com/phodal/shirelang/compiler/parser/ShireSyntaxAnalyzer.kt b/shirelang/src/main/kotlin/com/phodal/shirelang/compiler/parser/ShireSyntaxAnalyzer.kt index e392867e..ad70710f 100644 --- a/shirelang/src/main/kotlin/com/phodal/shirelang/compiler/parser/ShireSyntaxAnalyzer.kt +++ b/shirelang/src/main/kotlin/com/phodal/shirelang/compiler/parser/ShireSyntaxAnalyzer.kt @@ -102,6 +102,7 @@ class ShireSyntaxAnalyzer( WHITE_SPACE, DUMMY_BLOCK -> output.append(psiElement.text) ShireTypes.VELOCITY_EXPR -> { + output.append(psiElement.text) logger.info("Velocity expression found: ${psiElement.text}") } diff --git a/shirelang/src/test/kotlin/com/phodal/shirelang/ParsingNormalTest.kt b/shirelang/src/test/kotlin/com/phodal/shirelang/ParsingNormalTest.kt index 0db98606..97c1b10b 100644 --- a/shirelang/src/test/kotlin/com/phodal/shirelang/ParsingNormalTest.kt +++ b/shirelang/src/test/kotlin/com/phodal/shirelang/ParsingNormalTest.kt @@ -95,4 +95,8 @@ class ParsingNormalTest : ParsingTestCase("parser", "shire", ShireParserDefiniti fun testCustomFunctions() { doTest(true) } + + fun testIfExpression() { + doTest(true) + } } diff --git a/shirelang/src/test/testData/parser/IfExpression.shire b/shirelang/src/test/testData/parser/IfExpression.shire new file mode 100644 index 00000000..ed48aad4 --- /dev/null +++ b/shirelang/src/test/testData/parser/IfExpression.shire @@ -0,0 +1,59 @@ +This is an expression that includes an if. +#if(1 > 0) + ${language} if +#end + + +This is an expression that includes if and elseif. +#if($language.length() > 1) + ${language} if +#elseif($language.length() > 5) + ${language} elseif +#end + + +This is an expression that includes if and else. +#if($language.length() > 1 ) + ${language} if +#else + ${language} else +#end + + +This is an expression that includes if,elseif and else. +#if($language.length() > 10 ) + ${language} if +#elseif($language.length() > 2 ) + ${language} elseif +#else + ${language} else +#end + + +This is an expression that includes multiple if and elseif. +#if($language.length() > 1 ) + ${language} if + #if($language.length() > 2 ) + ${language} if_if + #elseif($language.length() > 20 ) + ${language} if_elseif + #end +#elseif($language.length() > 10 ) + ${language} elseif +#end + + +This is an expression that includes multiple if and else. +#if($language.length() > 10 ) + ${language} if +#else + ${language} else + #if($language.length() > 2 ) + ${language} else_if + #else + ${language} else_else + #end +#end + + +Please ignore the content and don't reply to me. \ No newline at end of file diff --git a/shirelang/src/test/testData/parser/IfExpression.txt b/shirelang/src/test/testData/parser/IfExpression.txt new file mode 100644 index 00000000..ff4b03e8 --- /dev/null +++ b/shirelang/src/test/testData/parser/IfExpression.txt @@ -0,0 +1,546 @@ +ShireFile + PsiElement(ShireTokenType.TEXT_SEGMENT)('This is an expression that includes an if.') + PsiElement(ShireTokenType.NEWLINE)('\n') + ShireVelocityExprImpl(VELOCITY_EXPR) + ShireIfExprImpl(IF_EXPR) + ShireIfClauseImpl(IF_CLAUSE) + PsiElement(ShireTokenType.#)('#') + PsiElement(ShireTokenType.if)('if') + PsiElement(ShireTokenType.()('(') + ShireIneqComparisonExprImpl(INEQ_COMPARISON_EXPR) + ShireLiteralExprImpl(LITERAL_EXPR) + PsiElement(ShireTokenType.NUMBER)('1') + PsiWhiteSpace(' ') + ShireIneqComparisonOpImpl(INEQ_COMPARISON_OP) + PsiElement(ShireTokenType.>)('>') + PsiWhiteSpace(' ') + ShireLiteralExprImpl(LITERAL_EXPR) + PsiElement(ShireTokenType.NUMBER)('0') + PsiElement(ShireTokenType.))(')') + ShireVelocityBlockImpl(VELOCITY_BLOCK) + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.TEXT_SEGMENT)(' ') + ShireUsedImpl(USED) + ShireVariableStartImpl(VARIABLE_START) + PsiElement(VARIABLE_START)('$') + ShireVarAccessImpl(VAR_ACCESS) + PsiElement(ShireTokenType.{)('{') + ShireVariableIdImpl(VARIABLE_ID) + PsiElement(ShireTokenType.IDENTIFIER)('language') + PsiElement(ShireTokenType.})('}') + PsiElement(ShireTokenType.TEXT_SEGMENT)(' if') + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.#)('#') + PsiElement(ShireTokenType.end)('end') + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.TEXT_SEGMENT)('This is an expression that includes if and elseif.') + PsiElement(ShireTokenType.NEWLINE)('\n') + ShireVelocityExprImpl(VELOCITY_EXPR) + ShireIfExprImpl(IF_EXPR) + ShireIfClauseImpl(IF_CLAUSE) + PsiElement(ShireTokenType.#)('#') + PsiElement(ShireTokenType.if)('if') + PsiElement(ShireTokenType.()('(') + ShireIneqComparisonExprImpl(INEQ_COMPARISON_EXPR) + ShireCallExprImpl(CALL_EXPR) + ShireRefExprImpl(REF_EXPR) + ShireLiteralExprImpl(LITERAL_EXPR) + PsiElement(VARIABLE_START)('$') + PsiElement(ShireTokenType.IDENTIFIER)('language') + PsiElement(ShireTokenType..)('.') + PsiElement(ShireTokenType.IDENTIFIER)('length') + PsiElement(ShireTokenType.()('(') + PsiElement(ShireTokenType.))(')') + PsiWhiteSpace(' ') + ShireIneqComparisonOpImpl(INEQ_COMPARISON_OP) + PsiElement(ShireTokenType.>)('>') + PsiWhiteSpace(' ') + ShireLiteralExprImpl(LITERAL_EXPR) + PsiElement(ShireTokenType.NUMBER)('1') + PsiElement(ShireTokenType.))(')') + ShireVelocityBlockImpl(VELOCITY_BLOCK) + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.TEXT_SEGMENT)(' ') + ShireUsedImpl(USED) + ShireVariableStartImpl(VARIABLE_START) + PsiElement(VARIABLE_START)('$') + ShireVarAccessImpl(VAR_ACCESS) + PsiElement(ShireTokenType.{)('{') + ShireVariableIdImpl(VARIABLE_ID) + PsiElement(ShireTokenType.IDENTIFIER)('language') + PsiElement(ShireTokenType.})('}') + PsiElement(ShireTokenType.TEXT_SEGMENT)(' if') + PsiElement(ShireTokenType.NEWLINE)('\n') + ShireElseifClauseImpl(ELSEIF_CLAUSE) + PsiElement(ShireTokenType.#)('#') + PsiElement(ShireTokenType.elseif)('elseif') + PsiElement(ShireTokenType.()('(') + ShireIneqComparisonExprImpl(INEQ_COMPARISON_EXPR) + ShireCallExprImpl(CALL_EXPR) + ShireRefExprImpl(REF_EXPR) + ShireLiteralExprImpl(LITERAL_EXPR) + PsiElement(VARIABLE_START)('$') + PsiElement(ShireTokenType.IDENTIFIER)('language') + PsiElement(ShireTokenType..)('.') + PsiElement(ShireTokenType.IDENTIFIER)('length') + PsiElement(ShireTokenType.()('(') + PsiElement(ShireTokenType.))(')') + PsiWhiteSpace(' ') + ShireIneqComparisonOpImpl(INEQ_COMPARISON_OP) + PsiElement(ShireTokenType.>)('>') + PsiWhiteSpace(' ') + ShireLiteralExprImpl(LITERAL_EXPR) + PsiElement(ShireTokenType.NUMBER)('5') + PsiElement(ShireTokenType.))(')') + ShireVelocityBlockImpl(VELOCITY_BLOCK) + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.TEXT_SEGMENT)(' ') + ShireUsedImpl(USED) + ShireVariableStartImpl(VARIABLE_START) + PsiElement(VARIABLE_START)('$') + ShireVarAccessImpl(VAR_ACCESS) + PsiElement(ShireTokenType.{)('{') + ShireVariableIdImpl(VARIABLE_ID) + PsiElement(ShireTokenType.IDENTIFIER)('language') + PsiElement(ShireTokenType.})('}') + PsiElement(ShireTokenType.TEXT_SEGMENT)(' elseif') + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.#)('#') + PsiElement(ShireTokenType.end)('end') + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.TEXT_SEGMENT)('This is an expression that includes if and else.') + PsiElement(ShireTokenType.NEWLINE)('\n') + ShireVelocityExprImpl(VELOCITY_EXPR) + ShireIfExprImpl(IF_EXPR) + ShireIfClauseImpl(IF_CLAUSE) + PsiElement(ShireTokenType.#)('#') + PsiElement(ShireTokenType.if)('if') + PsiElement(ShireTokenType.()('(') + ShireIneqComparisonExprImpl(INEQ_COMPARISON_EXPR) + ShireCallExprImpl(CALL_EXPR) + ShireRefExprImpl(REF_EXPR) + ShireLiteralExprImpl(LITERAL_EXPR) + PsiElement(VARIABLE_START)('$') + PsiElement(ShireTokenType.IDENTIFIER)('language') + PsiElement(ShireTokenType..)('.') + PsiElement(ShireTokenType.IDENTIFIER)('length') + PsiElement(ShireTokenType.()('(') + PsiElement(ShireTokenType.))(')') + PsiWhiteSpace(' ') + ShireIneqComparisonOpImpl(INEQ_COMPARISON_OP) + PsiElement(ShireTokenType.>)('>') + PsiWhiteSpace(' ') + ShireLiteralExprImpl(LITERAL_EXPR) + PsiElement(ShireTokenType.NUMBER)('1') + PsiWhiteSpace(' ') + PsiElement(ShireTokenType.))(')') + ShireVelocityBlockImpl(VELOCITY_BLOCK) + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.TEXT_SEGMENT)(' ') + ShireUsedImpl(USED) + ShireVariableStartImpl(VARIABLE_START) + PsiElement(VARIABLE_START)('$') + ShireVarAccessImpl(VAR_ACCESS) + PsiElement(ShireTokenType.{)('{') + ShireVariableIdImpl(VARIABLE_ID) + PsiElement(ShireTokenType.IDENTIFIER)('language') + PsiElement(ShireTokenType.})('}') + PsiElement(ShireTokenType.TEXT_SEGMENT)(' if') + PsiElement(ShireTokenType.NEWLINE)('\n') + ShireElseClauseImpl(ELSE_CLAUSE) + PsiElement(ShireTokenType.#)('#') + PsiElement(ShireTokenType.else)('else') + ShireVelocityBlockImpl(VELOCITY_BLOCK) + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.TEXT_SEGMENT)(' ') + ShireUsedImpl(USED) + ShireVariableStartImpl(VARIABLE_START) + PsiElement(VARIABLE_START)('$') + ShireVarAccessImpl(VAR_ACCESS) + PsiElement(ShireTokenType.{)('{') + ShireVariableIdImpl(VARIABLE_ID) + PsiElement(ShireTokenType.IDENTIFIER)('language') + PsiElement(ShireTokenType.})('}') + PsiElement(ShireTokenType.TEXT_SEGMENT)(' else') + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.#)('#') + PsiElement(ShireTokenType.end)('end') + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.TEXT_SEGMENT)('This is an expression that includes if,elseif and else.') + PsiElement(ShireTokenType.NEWLINE)('\n') + ShireVelocityExprImpl(VELOCITY_EXPR) + ShireIfExprImpl(IF_EXPR) + ShireIfClauseImpl(IF_CLAUSE) + PsiElement(ShireTokenType.#)('#') + PsiElement(ShireTokenType.if)('if') + PsiElement(ShireTokenType.()('(') + ShireIneqComparisonExprImpl(INEQ_COMPARISON_EXPR) + ShireCallExprImpl(CALL_EXPR) + ShireRefExprImpl(REF_EXPR) + ShireLiteralExprImpl(LITERAL_EXPR) + PsiElement(VARIABLE_START)('$') + PsiElement(ShireTokenType.IDENTIFIER)('language') + PsiElement(ShireTokenType..)('.') + PsiElement(ShireTokenType.IDENTIFIER)('length') + PsiElement(ShireTokenType.()('(') + PsiElement(ShireTokenType.))(')') + PsiWhiteSpace(' ') + ShireIneqComparisonOpImpl(INEQ_COMPARISON_OP) + PsiElement(ShireTokenType.>)('>') + PsiWhiteSpace(' ') + ShireLiteralExprImpl(LITERAL_EXPR) + PsiElement(ShireTokenType.NUMBER)('10') + PsiWhiteSpace(' ') + PsiElement(ShireTokenType.))(')') + ShireVelocityBlockImpl(VELOCITY_BLOCK) + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.TEXT_SEGMENT)(' ') + ShireUsedImpl(USED) + ShireVariableStartImpl(VARIABLE_START) + PsiElement(VARIABLE_START)('$') + ShireVarAccessImpl(VAR_ACCESS) + PsiElement(ShireTokenType.{)('{') + ShireVariableIdImpl(VARIABLE_ID) + PsiElement(ShireTokenType.IDENTIFIER)('language') + PsiElement(ShireTokenType.})('}') + PsiElement(ShireTokenType.TEXT_SEGMENT)(' if') + PsiElement(ShireTokenType.NEWLINE)('\n') + ShireElseifClauseImpl(ELSEIF_CLAUSE) + PsiElement(ShireTokenType.#)('#') + PsiElement(ShireTokenType.elseif)('elseif') + PsiElement(ShireTokenType.()('(') + ShireIneqComparisonExprImpl(INEQ_COMPARISON_EXPR) + ShireCallExprImpl(CALL_EXPR) + ShireRefExprImpl(REF_EXPR) + ShireLiteralExprImpl(LITERAL_EXPR) + PsiElement(VARIABLE_START)('$') + PsiElement(ShireTokenType.IDENTIFIER)('language') + PsiElement(ShireTokenType..)('.') + PsiElement(ShireTokenType.IDENTIFIER)('length') + PsiElement(ShireTokenType.()('(') + PsiElement(ShireTokenType.))(')') + PsiWhiteSpace(' ') + ShireIneqComparisonOpImpl(INEQ_COMPARISON_OP) + PsiElement(ShireTokenType.>)('>') + PsiWhiteSpace(' ') + ShireLiteralExprImpl(LITERAL_EXPR) + PsiElement(ShireTokenType.NUMBER)('2') + PsiWhiteSpace(' ') + PsiElement(ShireTokenType.))(')') + ShireVelocityBlockImpl(VELOCITY_BLOCK) + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.TEXT_SEGMENT)(' ') + ShireUsedImpl(USED) + ShireVariableStartImpl(VARIABLE_START) + PsiElement(VARIABLE_START)('$') + ShireVarAccessImpl(VAR_ACCESS) + PsiElement(ShireTokenType.{)('{') + ShireVariableIdImpl(VARIABLE_ID) + PsiElement(ShireTokenType.IDENTIFIER)('language') + PsiElement(ShireTokenType.})('}') + PsiElement(ShireTokenType.TEXT_SEGMENT)(' elseif') + PsiElement(ShireTokenType.NEWLINE)('\n') + ShireElseClauseImpl(ELSE_CLAUSE) + PsiElement(ShireTokenType.#)('#') + PsiElement(ShireTokenType.else)('else') + ShireVelocityBlockImpl(VELOCITY_BLOCK) + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.TEXT_SEGMENT)(' ') + ShireUsedImpl(USED) + ShireVariableStartImpl(VARIABLE_START) + PsiElement(VARIABLE_START)('$') + ShireVarAccessImpl(VAR_ACCESS) + PsiElement(ShireTokenType.{)('{') + ShireVariableIdImpl(VARIABLE_ID) + PsiElement(ShireTokenType.IDENTIFIER)('language') + PsiElement(ShireTokenType.})('}') + PsiElement(ShireTokenType.TEXT_SEGMENT)(' else') + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.#)('#') + PsiElement(ShireTokenType.end)('end') + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.TEXT_SEGMENT)('This is an expression that includes multiple if and elseif.') + PsiElement(ShireTokenType.NEWLINE)('\n') + ShireVelocityExprImpl(VELOCITY_EXPR) + ShireIfExprImpl(IF_EXPR) + ShireIfClauseImpl(IF_CLAUSE) + PsiElement(ShireTokenType.#)('#') + PsiElement(ShireTokenType.if)('if') + PsiElement(ShireTokenType.()('(') + ShireIneqComparisonExprImpl(INEQ_COMPARISON_EXPR) + ShireCallExprImpl(CALL_EXPR) + ShireRefExprImpl(REF_EXPR) + ShireLiteralExprImpl(LITERAL_EXPR) + PsiElement(VARIABLE_START)('$') + PsiElement(ShireTokenType.IDENTIFIER)('language') + PsiElement(ShireTokenType..)('.') + PsiElement(ShireTokenType.IDENTIFIER)('length') + PsiElement(ShireTokenType.()('(') + PsiElement(ShireTokenType.))(')') + PsiWhiteSpace(' ') + ShireIneqComparisonOpImpl(INEQ_COMPARISON_OP) + PsiElement(ShireTokenType.>)('>') + PsiWhiteSpace(' ') + ShireLiteralExprImpl(LITERAL_EXPR) + PsiElement(ShireTokenType.NUMBER)('1') + PsiWhiteSpace(' ') + PsiElement(ShireTokenType.))(')') + ShireVelocityBlockImpl(VELOCITY_BLOCK) + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.TEXT_SEGMENT)(' ') + ShireUsedImpl(USED) + ShireVariableStartImpl(VARIABLE_START) + PsiElement(VARIABLE_START)('$') + ShireVarAccessImpl(VAR_ACCESS) + PsiElement(ShireTokenType.{)('{') + ShireVariableIdImpl(VARIABLE_ID) + PsiElement(ShireTokenType.IDENTIFIER)('language') + PsiElement(ShireTokenType.})('}') + PsiElement(ShireTokenType.TEXT_SEGMENT)(' if') + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.TEXT_SEGMENT)(' ') + ShireVelocityExprImpl(VELOCITY_EXPR) + ShireIfExprImpl(IF_EXPR) + ShireIfClauseImpl(IF_CLAUSE) + PsiElement(ShireTokenType.#)('#') + PsiElement(ShireTokenType.if)('if') + PsiElement(ShireTokenType.()('(') + ShireIneqComparisonExprImpl(INEQ_COMPARISON_EXPR) + ShireCallExprImpl(CALL_EXPR) + ShireRefExprImpl(REF_EXPR) + ShireLiteralExprImpl(LITERAL_EXPR) + PsiElement(VARIABLE_START)('$') + PsiElement(ShireTokenType.IDENTIFIER)('language') + PsiElement(ShireTokenType..)('.') + PsiElement(ShireTokenType.IDENTIFIER)('length') + PsiElement(ShireTokenType.()('(') + PsiElement(ShireTokenType.))(')') + PsiWhiteSpace(' ') + ShireIneqComparisonOpImpl(INEQ_COMPARISON_OP) + PsiElement(ShireTokenType.>)('>') + PsiWhiteSpace(' ') + ShireLiteralExprImpl(LITERAL_EXPR) + PsiElement(ShireTokenType.NUMBER)('2') + PsiWhiteSpace(' ') + PsiElement(ShireTokenType.))(')') + ShireVelocityBlockImpl(VELOCITY_BLOCK) + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.TEXT_SEGMENT)(' ') + ShireUsedImpl(USED) + ShireVariableStartImpl(VARIABLE_START) + PsiElement(VARIABLE_START)('$') + ShireVarAccessImpl(VAR_ACCESS) + PsiElement(ShireTokenType.{)('{') + ShireVariableIdImpl(VARIABLE_ID) + PsiElement(ShireTokenType.IDENTIFIER)('language') + PsiElement(ShireTokenType.})('}') + PsiElement(ShireTokenType.TEXT_SEGMENT)(' if_if') + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.TEXT_SEGMENT)(' ') + ShireElseifClauseImpl(ELSEIF_CLAUSE) + PsiElement(ShireTokenType.#)('#') + PsiElement(ShireTokenType.elseif)('elseif') + PsiElement(ShireTokenType.()('(') + ShireIneqComparisonExprImpl(INEQ_COMPARISON_EXPR) + ShireCallExprImpl(CALL_EXPR) + ShireRefExprImpl(REF_EXPR) + ShireLiteralExprImpl(LITERAL_EXPR) + PsiElement(VARIABLE_START)('$') + PsiElement(ShireTokenType.IDENTIFIER)('language') + PsiElement(ShireTokenType..)('.') + PsiElement(ShireTokenType.IDENTIFIER)('length') + PsiElement(ShireTokenType.()('(') + PsiElement(ShireTokenType.))(')') + PsiWhiteSpace(' ') + ShireIneqComparisonOpImpl(INEQ_COMPARISON_OP) + PsiElement(ShireTokenType.>)('>') + PsiWhiteSpace(' ') + ShireLiteralExprImpl(LITERAL_EXPR) + PsiElement(ShireTokenType.NUMBER)('20') + PsiWhiteSpace(' ') + PsiElement(ShireTokenType.))(')') + ShireVelocityBlockImpl(VELOCITY_BLOCK) + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.TEXT_SEGMENT)(' ') + ShireUsedImpl(USED) + ShireVariableStartImpl(VARIABLE_START) + PsiElement(VARIABLE_START)('$') + ShireVarAccessImpl(VAR_ACCESS) + PsiElement(ShireTokenType.{)('{') + ShireVariableIdImpl(VARIABLE_ID) + PsiElement(ShireTokenType.IDENTIFIER)('language') + PsiElement(ShireTokenType.})('}') + PsiElement(ShireTokenType.TEXT_SEGMENT)(' if_elseif') + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.TEXT_SEGMENT)(' ') + PsiElement(ShireTokenType.#)('#') + PsiElement(ShireTokenType.end)('end') + PsiElement(ShireTokenType.NEWLINE)('\n') + ShireElseifClauseImpl(ELSEIF_CLAUSE) + PsiElement(ShireTokenType.#)('#') + PsiElement(ShireTokenType.elseif)('elseif') + PsiElement(ShireTokenType.()('(') + ShireIneqComparisonExprImpl(INEQ_COMPARISON_EXPR) + ShireCallExprImpl(CALL_EXPR) + ShireRefExprImpl(REF_EXPR) + ShireLiteralExprImpl(LITERAL_EXPR) + PsiElement(VARIABLE_START)('$') + PsiElement(ShireTokenType.IDENTIFIER)('language') + PsiElement(ShireTokenType..)('.') + PsiElement(ShireTokenType.IDENTIFIER)('length') + PsiElement(ShireTokenType.()('(') + PsiElement(ShireTokenType.))(')') + PsiWhiteSpace(' ') + ShireIneqComparisonOpImpl(INEQ_COMPARISON_OP) + PsiElement(ShireTokenType.>)('>') + PsiWhiteSpace(' ') + ShireLiteralExprImpl(LITERAL_EXPR) + PsiElement(ShireTokenType.NUMBER)('10') + PsiWhiteSpace(' ') + PsiElement(ShireTokenType.))(')') + ShireVelocityBlockImpl(VELOCITY_BLOCK) + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.TEXT_SEGMENT)(' ') + ShireUsedImpl(USED) + ShireVariableStartImpl(VARIABLE_START) + PsiElement(VARIABLE_START)('$') + ShireVarAccessImpl(VAR_ACCESS) + PsiElement(ShireTokenType.{)('{') + ShireVariableIdImpl(VARIABLE_ID) + PsiElement(ShireTokenType.IDENTIFIER)('language') + PsiElement(ShireTokenType.})('}') + PsiElement(ShireTokenType.TEXT_SEGMENT)(' elseif') + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.#)('#') + PsiElement(ShireTokenType.end)('end') + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.TEXT_SEGMENT)('This is an expression that includes multiple if and else.') + PsiElement(ShireTokenType.NEWLINE)('\n') + ShireVelocityExprImpl(VELOCITY_EXPR) + ShireIfExprImpl(IF_EXPR) + ShireIfClauseImpl(IF_CLAUSE) + PsiElement(ShireTokenType.#)('#') + PsiElement(ShireTokenType.if)('if') + PsiElement(ShireTokenType.()('(') + ShireIneqComparisonExprImpl(INEQ_COMPARISON_EXPR) + ShireCallExprImpl(CALL_EXPR) + ShireRefExprImpl(REF_EXPR) + ShireLiteralExprImpl(LITERAL_EXPR) + PsiElement(VARIABLE_START)('$') + PsiElement(ShireTokenType.IDENTIFIER)('language') + PsiElement(ShireTokenType..)('.') + PsiElement(ShireTokenType.IDENTIFIER)('length') + PsiElement(ShireTokenType.()('(') + PsiElement(ShireTokenType.))(')') + PsiWhiteSpace(' ') + ShireIneqComparisonOpImpl(INEQ_COMPARISON_OP) + PsiElement(ShireTokenType.>)('>') + PsiWhiteSpace(' ') + ShireLiteralExprImpl(LITERAL_EXPR) + PsiElement(ShireTokenType.NUMBER)('10') + PsiWhiteSpace(' ') + PsiElement(ShireTokenType.))(')') + ShireVelocityBlockImpl(VELOCITY_BLOCK) + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.TEXT_SEGMENT)(' ') + ShireUsedImpl(USED) + ShireVariableStartImpl(VARIABLE_START) + PsiElement(VARIABLE_START)('$') + ShireVarAccessImpl(VAR_ACCESS) + PsiElement(ShireTokenType.{)('{') + ShireVariableIdImpl(VARIABLE_ID) + PsiElement(ShireTokenType.IDENTIFIER)('language') + PsiElement(ShireTokenType.})('}') + PsiElement(ShireTokenType.TEXT_SEGMENT)(' if') + PsiElement(ShireTokenType.NEWLINE)('\n') + ShireElseClauseImpl(ELSE_CLAUSE) + PsiElement(ShireTokenType.#)('#') + PsiElement(ShireTokenType.else)('else') + ShireVelocityBlockImpl(VELOCITY_BLOCK) + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.TEXT_SEGMENT)(' ') + ShireUsedImpl(USED) + ShireVariableStartImpl(VARIABLE_START) + PsiElement(VARIABLE_START)('$') + ShireVarAccessImpl(VAR_ACCESS) + PsiElement(ShireTokenType.{)('{') + ShireVariableIdImpl(VARIABLE_ID) + PsiElement(ShireTokenType.IDENTIFIER)('language') + PsiElement(ShireTokenType.})('}') + PsiElement(ShireTokenType.TEXT_SEGMENT)(' else') + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.TEXT_SEGMENT)(' ') + ShireVelocityExprImpl(VELOCITY_EXPR) + ShireIfExprImpl(IF_EXPR) + ShireIfClauseImpl(IF_CLAUSE) + PsiElement(ShireTokenType.#)('#') + PsiElement(ShireTokenType.if)('if') + PsiElement(ShireTokenType.()('(') + ShireIneqComparisonExprImpl(INEQ_COMPARISON_EXPR) + ShireCallExprImpl(CALL_EXPR) + ShireRefExprImpl(REF_EXPR) + ShireLiteralExprImpl(LITERAL_EXPR) + PsiElement(VARIABLE_START)('$') + PsiElement(ShireTokenType.IDENTIFIER)('language') + PsiElement(ShireTokenType..)('.') + PsiElement(ShireTokenType.IDENTIFIER)('length') + PsiElement(ShireTokenType.()('(') + PsiElement(ShireTokenType.))(')') + PsiWhiteSpace(' ') + ShireIneqComparisonOpImpl(INEQ_COMPARISON_OP) + PsiElement(ShireTokenType.>)('>') + PsiWhiteSpace(' ') + ShireLiteralExprImpl(LITERAL_EXPR) + PsiElement(ShireTokenType.NUMBER)('2') + PsiWhiteSpace(' ') + PsiElement(ShireTokenType.))(')') + ShireVelocityBlockImpl(VELOCITY_BLOCK) + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.TEXT_SEGMENT)(' ') + ShireUsedImpl(USED) + ShireVariableStartImpl(VARIABLE_START) + PsiElement(VARIABLE_START)('$') + ShireVarAccessImpl(VAR_ACCESS) + PsiElement(ShireTokenType.{)('{') + ShireVariableIdImpl(VARIABLE_ID) + PsiElement(ShireTokenType.IDENTIFIER)('language') + PsiElement(ShireTokenType.})('}') + PsiElement(ShireTokenType.TEXT_SEGMENT)(' else_if') + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.TEXT_SEGMENT)(' ') + ShireElseClauseImpl(ELSE_CLAUSE) + PsiElement(ShireTokenType.#)('#') + PsiElement(ShireTokenType.else)('else') + ShireVelocityBlockImpl(VELOCITY_BLOCK) + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.TEXT_SEGMENT)(' ') + ShireUsedImpl(USED) + ShireVariableStartImpl(VARIABLE_START) + PsiElement(VARIABLE_START)('$') + ShireVarAccessImpl(VAR_ACCESS) + PsiElement(ShireTokenType.{)('{') + ShireVariableIdImpl(VARIABLE_ID) + PsiElement(ShireTokenType.IDENTIFIER)('language') + PsiElement(ShireTokenType.})('}') + PsiElement(ShireTokenType.TEXT_SEGMENT)(' else_else') + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.TEXT_SEGMENT)(' ') + PsiElement(ShireTokenType.#)('#') + PsiElement(ShireTokenType.end)('end') + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.#)('#') + PsiElement(ShireTokenType.end)('end') + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.TEXT_SEGMENT)('Please ignore the content and don't reply to me.') \ No newline at end of file diff --git a/shirelang/src/test/testData/parser/VariableAccess.txt b/shirelang/src/test/testData/parser/VariableAccess.txt index 65ca9718..83e91c16 100644 --- a/shirelang/src/test/testData/parser/VariableAccess.txt +++ b/shirelang/src/test/testData/parser/VariableAccess.txt @@ -72,51 +72,52 @@ ShireFile PsiElement(ShireTokenType.NEWLINE)('\n') PsiElement(ShireTokenType.NEWLINE)('\n') ShireVelocityExprImpl(VELOCITY_EXPR) - PsiElement(ShireTokenType.#)('#') - PsiElement(ShireTokenType.if)('if') - PsiElement(ShireTokenType.()('(') - ShireVariableStartImpl(VARIABLE_START) - PsiElement(VARIABLE_START)('$') - ShireIneqComparisonExprImpl(INEQ_COMPARISON_EXPR) - ShireCallExprImpl(CALL_EXPR) - ShireRefExprImpl(REF_EXPR) - ShireRefExprImpl(REF_EXPR) - ShireRefExprImpl(REF_EXPR) - PsiElement(ShireTokenType.IDENTIFIER)('context') - PsiElement(ShireTokenType..)('.') - PsiElement(ShireTokenType.IDENTIFIER)('relatedClasses') - PsiElement(ShireTokenType..)('.') - PsiElement(ShireTokenType.IDENTIFIER)('length') + ShireIfExprImpl(IF_EXPR) + ShireIfClauseImpl(IF_CLAUSE) + PsiElement(ShireTokenType.#)('#') + PsiElement(ShireTokenType.if)('if') PsiElement(ShireTokenType.()('(') + ShireIneqComparisonExprImpl(INEQ_COMPARISON_EXPR) + ShireCallExprImpl(CALL_EXPR) + ShireRefExprImpl(REF_EXPR) + ShireRefExprImpl(REF_EXPR) + ShireLiteralExprImpl(LITERAL_EXPR) + PsiElement(VARIABLE_START)('$') + PsiElement(ShireTokenType.IDENTIFIER)('context') + PsiElement(ShireTokenType..)('.') + PsiElement(ShireTokenType.IDENTIFIER)('relatedClasses') + PsiElement(ShireTokenType..)('.') + PsiElement(ShireTokenType.IDENTIFIER)('length') + PsiElement(ShireTokenType.()('(') + PsiElement(ShireTokenType.))(')') + PsiWhiteSpace(' ') + ShireIneqComparisonOpImpl(INEQ_COMPARISON_OP) + PsiElement(ShireTokenType.>)('>') + PsiWhiteSpace(' ') + ShireLiteralExprImpl(LITERAL_EXPR) + PsiElement(ShireTokenType.NUMBER)('0') + PsiWhiteSpace(' ') PsiElement(ShireTokenType.))(')') - PsiWhiteSpace(' ') - ShireIneqComparisonOpImpl(INEQ_COMPARISON_OP) - PsiElement(ShireTokenType.>)('>') - PsiWhiteSpace(' ') - ShireLiteralExprImpl(LITERAL_EXPR) - PsiElement(ShireTokenType.NUMBER)('0') - PsiWhiteSpace(' ') - PsiElement(ShireTokenType.))(')') - PsiElement(ShireTokenType.NEWLINE)('\n') - PsiElement(ShireTokenType.TEXT_SEGMENT)('Here is the relate code maybe you can use') - PsiElement(ShireTokenType.NEWLINE)('\n') - ShireUsedImpl(USED) - ShireVariableStartImpl(VARIABLE_START) - PsiElement(VARIABLE_START)('$') - ShireVarAccessImpl(VAR_ACCESS) - PsiElement(ShireTokenType.{)('{') - ShireVariableIdImpl(VARIABLE_ID) - PsiElement(ShireTokenType.IDENTIFIER)('context') - PsiElement(ShireTokenType..)('.') - ShireVariableIdImpl(VARIABLE_ID) - PsiElement(ShireTokenType.IDENTIFIER)('relatedClasses') - PsiElement(ShireTokenType.})('}') - PsiElement(ShireTokenType.NEWLINE)('\n') - ShireVelocityExprImpl(VELOCITY_EXPR) - PsiElement(ShireTokenType.#)('#') - PsiElement(ShireTokenType.end)('end') - PsiElement(ShireTokenType.NEWLINE)('\n') - PsiElement(ShireTokenType.NEWLINE)('\n') + ShireVelocityBlockImpl(VELOCITY_BLOCK) + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.TEXT_SEGMENT)('Here is the relate code maybe you can use') + PsiElement(ShireTokenType.NEWLINE)('\n') + ShireUsedImpl(USED) + ShireVariableStartImpl(VARIABLE_START) + PsiElement(VARIABLE_START)('$') + ShireVarAccessImpl(VAR_ACCESS) + PsiElement(ShireTokenType.{)('{') + ShireVariableIdImpl(VARIABLE_ID) + PsiElement(ShireTokenType.IDENTIFIER)('context') + PsiElement(ShireTokenType..)('.') + ShireVariableIdImpl(VARIABLE_ID) + PsiElement(ShireTokenType.IDENTIFIER)('relatedClasses') + PsiElement(ShireTokenType.})('}') + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.#)('#') + PsiElement(ShireTokenType.end)('end') + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.NEWLINE)('\n') CodeBlockElement(CODE) PsiElement(ShireTokenType.CODE_BLOCK_START)('```') ShireVariableStartImpl(VARIABLE_START) diff --git a/shirelang/src/test/testData/realworld/Autotest.txt b/shirelang/src/test/testData/realworld/Autotest.txt index 99c34366..7e85767b 100644 --- a/shirelang/src/test/testData/realworld/Autotest.txt +++ b/shirelang/src/test/testData/realworld/Autotest.txt @@ -351,97 +351,99 @@ ShireFile PsiElement(ShireTokenType.NEWLINE)('\n') PsiElement(ShireTokenType.NEWLINE)('\n') ShireVelocityExprImpl(VELOCITY_EXPR) - PsiElement(ShireTokenType.#)('#') - PsiElement(ShireTokenType.if)('if') - PsiElement(ShireTokenType.()('(') - ShireVariableStartImpl(VARIABLE_START) - PsiElement(VARIABLE_START)('$') - ShireIneqComparisonExprImpl(INEQ_COMPARISON_EXPR) - ShireCallExprImpl(CALL_EXPR) - ShireRefExprImpl(REF_EXPR) - ShireRefExprImpl(REF_EXPR) - ShireRefExprImpl(REF_EXPR) - PsiElement(ShireTokenType.IDENTIFIER)('context') - PsiElement(ShireTokenType..)('.') - PsiElement(ShireTokenType.IDENTIFIER)('relatedClasses') - PsiElement(ShireTokenType..)('.') - PsiElement(ShireTokenType.IDENTIFIER)('length') + ShireIfExprImpl(IF_EXPR) + ShireIfClauseImpl(IF_CLAUSE) + PsiElement(ShireTokenType.#)('#') + PsiElement(ShireTokenType.if)('if') PsiElement(ShireTokenType.()('(') + ShireIneqComparisonExprImpl(INEQ_COMPARISON_EXPR) + ShireCallExprImpl(CALL_EXPR) + ShireRefExprImpl(REF_EXPR) + ShireRefExprImpl(REF_EXPR) + ShireLiteralExprImpl(LITERAL_EXPR) + PsiElement(VARIABLE_START)('$') + PsiElement(ShireTokenType.IDENTIFIER)('context') + PsiElement(ShireTokenType..)('.') + PsiElement(ShireTokenType.IDENTIFIER)('relatedClasses') + PsiElement(ShireTokenType..)('.') + PsiElement(ShireTokenType.IDENTIFIER)('length') + PsiElement(ShireTokenType.()('(') + PsiElement(ShireTokenType.))(')') + PsiWhiteSpace(' ') + ShireIneqComparisonOpImpl(INEQ_COMPARISON_OP) + PsiElement(ShireTokenType.>)('>') + PsiWhiteSpace(' ') + ShireLiteralExprImpl(LITERAL_EXPR) + PsiElement(ShireTokenType.NUMBER)('0') + PsiWhiteSpace(' ') PsiElement(ShireTokenType.))(')') - PsiWhiteSpace(' ') - ShireIneqComparisonOpImpl(INEQ_COMPARISON_OP) - PsiElement(ShireTokenType.>)('>') - PsiWhiteSpace(' ') - ShireLiteralExprImpl(LITERAL_EXPR) - PsiElement(ShireTokenType.NUMBER)('0') - PsiWhiteSpace(' ') - PsiElement(ShireTokenType.))(')') - PsiElement(ShireTokenType.NEWLINE)('\n') - PsiElement(ShireTokenType.TEXT_SEGMENT)('Here is the relate code maybe you can use') - PsiElement(ShireTokenType.NEWLINE)('\n') - ShireUsedImpl(USED) - ShireVariableStartImpl(VARIABLE_START) - PsiElement(VARIABLE_START)('$') - ShireVarAccessImpl(VAR_ACCESS) - PsiElement(ShireTokenType.{)('{') - ShireVariableIdImpl(VARIABLE_ID) - PsiElement(ShireTokenType.IDENTIFIER)('context') - PsiElement(ShireTokenType..)('.') - ShireVariableIdImpl(VARIABLE_ID) - PsiElement(ShireTokenType.IDENTIFIER)('relatedClasses') - PsiElement(ShireTokenType.})('}') - PsiElement(ShireTokenType.NEWLINE)('\n') - ShireVelocityExprImpl(VELOCITY_EXPR) - PsiElement(ShireTokenType.#)('#') - PsiElement(ShireTokenType.end)('end') - PsiElement(ShireTokenType.NEWLINE)('\n') - PsiElement(ShireTokenType.NEWLINE)('\n') + ShireVelocityBlockImpl(VELOCITY_BLOCK) + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.TEXT_SEGMENT)('Here is the relate code maybe you can use') + PsiElement(ShireTokenType.NEWLINE)('\n') + ShireUsedImpl(USED) + ShireVariableStartImpl(VARIABLE_START) + PsiElement(VARIABLE_START)('$') + ShireVarAccessImpl(VAR_ACCESS) + PsiElement(ShireTokenType.{)('{') + ShireVariableIdImpl(VARIABLE_ID) + PsiElement(ShireTokenType.IDENTIFIER)('context') + PsiElement(ShireTokenType..)('.') + ShireVariableIdImpl(VARIABLE_ID) + PsiElement(ShireTokenType.IDENTIFIER)('relatedClasses') + PsiElement(ShireTokenType.})('}') + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.#)('#') + PsiElement(ShireTokenType.end)('end') + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.NEWLINE)('\n') ShireVelocityExprImpl(VELOCITY_EXPR) - PsiElement(ShireTokenType.#)('#') - PsiElement(ShireTokenType.if)('if') - PsiElement(ShireTokenType.()('(') - ShireVariableStartImpl(VARIABLE_START) - PsiElement(VARIABLE_START)('$') - ShireIneqComparisonExprImpl(INEQ_COMPARISON_EXPR) - ShireCallExprImpl(CALL_EXPR) - ShireRefExprImpl(REF_EXPR) - ShireRefExprImpl(REF_EXPR) - ShireRefExprImpl(REF_EXPR) - PsiElement(ShireTokenType.IDENTIFIER)('context') - PsiElement(ShireTokenType..)('.') - PsiElement(ShireTokenType.IDENTIFIER)('currentClassName') - PsiElement(ShireTokenType..)('.') - PsiElement(ShireTokenType.IDENTIFIER)('length') + ShireIfExprImpl(IF_EXPR) + ShireIfClauseImpl(IF_CLAUSE) + PsiElement(ShireTokenType.#)('#') + PsiElement(ShireTokenType.if)('if') PsiElement(ShireTokenType.()('(') + ShireIneqComparisonExprImpl(INEQ_COMPARISON_EXPR) + ShireCallExprImpl(CALL_EXPR) + ShireRefExprImpl(REF_EXPR) + ShireRefExprImpl(REF_EXPR) + ShireLiteralExprImpl(LITERAL_EXPR) + PsiElement(VARIABLE_START)('$') + PsiElement(ShireTokenType.IDENTIFIER)('context') + PsiElement(ShireTokenType..)('.') + PsiElement(ShireTokenType.IDENTIFIER)('currentClassName') + PsiElement(ShireTokenType..)('.') + PsiElement(ShireTokenType.IDENTIFIER)('length') + PsiElement(ShireTokenType.()('(') + PsiElement(ShireTokenType.))(')') + PsiWhiteSpace(' ') + ShireIneqComparisonOpImpl(INEQ_COMPARISON_OP) + PsiElement(ShireTokenType.>)('>') + PsiWhiteSpace(' ') + ShireLiteralExprImpl(LITERAL_EXPR) + PsiElement(ShireTokenType.NUMBER)('0') + PsiWhiteSpace(' ') PsiElement(ShireTokenType.))(')') - PsiWhiteSpace(' ') - ShireIneqComparisonOpImpl(INEQ_COMPARISON_OP) - PsiElement(ShireTokenType.>)('>') - PsiWhiteSpace(' ') - ShireLiteralExprImpl(LITERAL_EXPR) - PsiElement(ShireTokenType.NUMBER)('0') - PsiWhiteSpace(' ') - PsiElement(ShireTokenType.))(')') - PsiElement(ShireTokenType.NEWLINE)('\n') - PsiElement(ShireTokenType.TEXT_SEGMENT)('This is the class where the source code resides:') - PsiElement(ShireTokenType.NEWLINE)('\n') - ShireUsedImpl(USED) - ShireVariableStartImpl(VARIABLE_START) - PsiElement(VARIABLE_START)('$') - ShireVarAccessImpl(VAR_ACCESS) - PsiElement(ShireTokenType.{)('{') - ShireVariableIdImpl(VARIABLE_ID) - PsiElement(ShireTokenType.IDENTIFIER)('context') - PsiElement(ShireTokenType..)('.') - ShireVariableIdImpl(VARIABLE_ID) - PsiElement(ShireTokenType.IDENTIFIER)('currentClassCode') - PsiElement(ShireTokenType.})('}') - PsiElement(ShireTokenType.NEWLINE)('\n') - ShireVelocityExprImpl(VELOCITY_EXPR) - PsiElement(ShireTokenType.#)('#') - PsiElement(ShireTokenType.end)('end') - PsiElement(ShireTokenType.NEWLINE)('\n') - PsiElement(ShireTokenType.NEWLINE)('\n') + ShireVelocityBlockImpl(VELOCITY_BLOCK) + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.TEXT_SEGMENT)('This is the class where the source code resides:') + PsiElement(ShireTokenType.NEWLINE)('\n') + ShireUsedImpl(USED) + ShireVariableStartImpl(VARIABLE_START) + PsiElement(VARIABLE_START)('$') + ShireVarAccessImpl(VAR_ACCESS) + PsiElement(ShireTokenType.{)('{') + ShireVariableIdImpl(VARIABLE_ID) + PsiElement(ShireTokenType.IDENTIFIER)('context') + PsiElement(ShireTokenType..)('.') + ShireVariableIdImpl(VARIABLE_ID) + PsiElement(ShireTokenType.IDENTIFIER)('currentClassCode') + PsiElement(ShireTokenType.})('}') + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.#)('#') + PsiElement(ShireTokenType.end)('end') + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.NEWLINE)('\n') ShireUsedImpl(USED) ShireVariableStartImpl(VARIABLE_START) PsiElement(VARIABLE_START)('$') @@ -493,43 +495,45 @@ ShireFile PsiElement(ShireTokenType.NEWLINE)('\n') PsiElement(ShireTokenType.NEWLINE)('\n') ShireVelocityExprImpl(VELOCITY_EXPR) - PsiElement(ShireTokenType.#)('#') - PsiElement(ShireTokenType.if)('if') - PsiElement(ShireTokenType.()('(') - ShireVariableStartImpl(VARIABLE_START) - PsiElement(VARIABLE_START)('$') - ShireRefExprImpl(REF_EXPR) - ShireRefExprImpl(REF_EXPR) - PsiElement(ShireTokenType.IDENTIFIER)('context') - PsiElement(ShireTokenType..)('.') - PsiElement(ShireTokenType.IDENTIFIER)('isNewFile') - PsiElement(ShireTokenType.))(')') - PsiElement(ShireTokenType.NEWLINE)('\n') - PsiElement(ShireTokenType.TEXT_SEGMENT)('Should include package and imports. Start method test code with Markdown code block here:') - PsiElement(ShireTokenType.NEWLINE)('\n') - ShireVelocityExprImpl(VELOCITY_EXPR) - PsiElement(ShireTokenType.#)('#') - PsiElement(ShireTokenType.else)('else') - PsiElement(ShireTokenType.NEWLINE)('\n') - PsiElement(ShireTokenType.TEXT_SEGMENT)('Should include package and imports. Start ') - ShireUsedImpl(USED) - ShireVariableStartImpl(VARIABLE_START) - PsiElement(VARIABLE_START)('$') - ShireVarAccessImpl(VAR_ACCESS) - PsiElement(ShireTokenType.{)('{') - ShireVariableIdImpl(VARIABLE_ID) - PsiElement(ShireTokenType.IDENTIFIER)('context') - PsiElement(ShireTokenType..)('.') - ShireVariableIdImpl(VARIABLE_ID) - PsiElement(ShireTokenType.IDENTIFIER)('targetTestFileName') - PsiElement(ShireTokenType.})('}') - PsiElement(ShireTokenType.TEXT_SEGMENT)(' test code with Markdown code block here:') - PsiElement(ShireTokenType.NEWLINE)('\n') - ShireVelocityExprImpl(VELOCITY_EXPR) - PsiElement(ShireTokenType.#)('#') - PsiElement(ShireTokenType.end)('end') - PsiElement(ShireTokenType.NEWLINE)('\n') - PsiElement(ShireTokenType.NEWLINE)('\n') + ShireIfExprImpl(IF_EXPR) + ShireIfClauseImpl(IF_CLAUSE) + PsiElement(ShireTokenType.#)('#') + PsiElement(ShireTokenType.if)('if') + PsiElement(ShireTokenType.()('(') + ShireRefExprImpl(REF_EXPR) + ShireLiteralExprImpl(LITERAL_EXPR) + PsiElement(VARIABLE_START)('$') + PsiElement(ShireTokenType.IDENTIFIER)('context') + PsiElement(ShireTokenType..)('.') + PsiElement(ShireTokenType.IDENTIFIER)('isNewFile') + PsiElement(ShireTokenType.))(')') + ShireVelocityBlockImpl(VELOCITY_BLOCK) + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.TEXT_SEGMENT)('Should include package and imports. Start method test code with Markdown code block here:') + PsiElement(ShireTokenType.NEWLINE)('\n') + ShireElseClauseImpl(ELSE_CLAUSE) + PsiElement(ShireTokenType.#)('#') + PsiElement(ShireTokenType.else)('else') + ShireVelocityBlockImpl(VELOCITY_BLOCK) + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.TEXT_SEGMENT)('Should include package and imports. Start ') + ShireUsedImpl(USED) + ShireVariableStartImpl(VARIABLE_START) + PsiElement(VARIABLE_START)('$') + ShireVarAccessImpl(VAR_ACCESS) + PsiElement(ShireTokenType.{)('{') + ShireVariableIdImpl(VARIABLE_ID) + PsiElement(ShireTokenType.IDENTIFIER)('context') + PsiElement(ShireTokenType..)('.') + ShireVariableIdImpl(VARIABLE_ID) + PsiElement(ShireTokenType.IDENTIFIER)('targetTestFileName') + PsiElement(ShireTokenType.})('}') + PsiElement(ShireTokenType.TEXT_SEGMENT)(' test code with Markdown code block here:') + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.#)('#') + PsiElement(ShireTokenType.end)('end') + PsiElement(ShireTokenType.NEWLINE)('\n') + PsiElement(ShireTokenType.NEWLINE)('\n') ShireUsedImpl(USED) ShireVariableStartImpl(VARIABLE_START) PsiElement(VARIABLE_START)('$')