From b26ca15a27e61b3140444a0a68494c4781c80c33 Mon Sep 17 00:00:00 2001 From: R-Koubou Date: Sat, 24 Mar 2018 05:31:40 +0900 Subject: [PATCH] temporary fixes of #6 (WIP) --- .classpath | 2 +- .gitignore | 2 +- .vscode/launch.json | 14 +- data/lang/message.properties | 4 +- data/lang/message_ja.properties | 4 +- rebuild.sh | 3 + .../kspparser/analyzer/MessageManager.java | 4 +- .../kspparser/analyzer/SemanticAnalyzer.java | 303 +- .../javacc/generated/ASTArrayInitializer.java | 4 + .../generated/ASTPrimitiveInititalizer.java | 4 + .../javacc/generated/ASTUIInitializer.java | 23 - .../kspparser/javacc/generated/KSPParser.java | 3575 ++++++++--------- .../kspparser/javacc/generated/KSPParser.jj | 110 +- .../generated/KSPParserDefaultVisitor.java | 9 +- .../generated/KSPParserTreeConstants.java | 88 +- .../javacc/generated/KSPParserVisitor.java | 5 +- .../kspparser/obfuscator/Obfuscator.java | 163 +- src/javacc/KSPParser.jjt | 54 +- 18 files changed, 2092 insertions(+), 2279 deletions(-) create mode 100755 rebuild.sh delete mode 100644 src/java/net/rkoubou/kspparser/javacc/generated/ASTUIInitializer.java diff --git a/.classpath b/.classpath index 52f90cc..6b573b9 100755 --- a/.classpath +++ b/.classpath @@ -2,6 +2,6 @@ - + diff --git a/.gitignore b/.gitignore index 41e3a28..b130da3 100755 --- a/.gitignore +++ b/.gitignore @@ -17,4 +17,4 @@ target/ .temp/ .org .java.org -eclipse_compiled/ +classes/ diff --git a/.vscode/launch.json b/.vscode/launch.json index 15670c9..7dc4444 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -6,7 +6,7 @@ "configurations": [ { "type": "java", - "name": "Debug (Launch) with test.ksp", + "name": "Debug with test.ksp", "projectName": "KSPSyntaxParser", "request": "launch", "cwd": "${workspaceFolder}", @@ -14,14 +14,14 @@ "stopOnEntry": false, "classPaths": [ "./lib/args4j.jar", - "./eclipse_compiled/" + "./classes/" ], "mainClass": "net.rkoubou.kspparser.KSPSyntaxParser", "args": "--source ./.temp/test.ksp" }, { "type": "java", - "name": "Debug (Launch) with test.ksp (Parse)", + "name": "Debug with test.ksp (+Obfuscate)", "projectName": "KSPSyntaxParser", "request": "launch", "cwd": "${workspaceFolder}", @@ -29,10 +29,10 @@ "stopOnEntry": false, "classPaths": [ "./lib/args4j.jar", - "./eclipse_compiled/" + "./classes/" ], "mainClass": "net.rkoubou.kspparser.KSPSyntaxParser", - "args": "--source ./.temp/test.ksp --parseonly" + "args": "--source ./.temp/test.ksp --obfuscate" }, { "type": "java", @@ -44,10 +44,10 @@ "stopOnEntry": false, "classPaths": [ "./lib/args4j.jar", - "./eclipse_compiled/" + "./classes/" ], "mainClass": "net.rkoubou.kspparser.KSPSyntaxParser", "args": "${command:SpecifyProgramArgs}" } ] -} \ No newline at end of file +} diff --git a/data/lang/message.properties b/data/lang/message.properties index 66e4bad..769228a 100644 --- a/data/lang/message.properties +++ b/data/lang/message.properties @@ -11,9 +11,9 @@ # #------------------------------------------------------------------------------- -# Lexical Error +# Syntax Error #------------------------------------------------------------------------------- -error.lexical = ${level} ${line} Syntax Error +error.syntax = ${level} ${line} Syntax Error #------------------------------------------------------------------------------- # General diff --git a/data/lang/message_ja.properties b/data/lang/message_ja.properties index eb61db0..594e631 100644 --- a/data/lang/message_ja.properties +++ b/data/lang/message_ja.properties @@ -11,9 +11,9 @@ # #------------------------------------------------------------------------------- -# Lexical Error +# Syntax Error #------------------------------------------------------------------------------- -error.lexical = ${level} ${line} 文法エラー +error.syntax = ${level} ${line} 文法エラー #------------------------------------------------------------------------------- # General diff --git a/rebuild.sh b/rebuild.sh new file mode 100755 index 0000000..134d892 --- /dev/null +++ b/rebuild.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +./clean.sh && ./build.sh diff --git a/src/java/net/rkoubou/kspparser/analyzer/MessageManager.java b/src/java/net/rkoubou/kspparser/analyzer/MessageManager.java index e31dc26..76944a7 100644 --- a/src/java/net/rkoubou/kspparser/analyzer/MessageManager.java +++ b/src/java/net/rkoubou/kspparser/analyzer/MessageManager.java @@ -26,7 +26,7 @@ public class MessageManager implements AnalyzerConstants //-------------------------------------------------------------------------- // Lexical //-------------------------------------------------------------------------- - static public final String PROPERTY_ERROR_LEXICAL = "error.lexical"; + static public final String PROPERTY_ERROR_SYNTAX = "error.syntax"; //-------------------------------------------------------------------------- // General @@ -207,7 +207,7 @@ private MessageManager(){} static public String expand( ParseException src ) { return expand( - PROPERTY_ERROR_LEXICAL, + PROPERTY_ERROR_SYNTAX, Level.ERROR, src.currentToken.beginLine, src.currentToken.beginColumn, diff --git a/src/java/net/rkoubou/kspparser/analyzer/SemanticAnalyzer.java b/src/java/net/rkoubou/kspparser/analyzer/SemanticAnalyzer.java index 691cadb..a190a70 100644 --- a/src/java/net/rkoubou/kspparser/analyzer/SemanticAnalyzer.java +++ b/src/java/net/rkoubou/kspparser/analyzer/SemanticAnalyzer.java @@ -23,7 +23,6 @@ import net.rkoubou.kspparser.javacc.generated.ASTPrimitiveInititalizer; import net.rkoubou.kspparser.javacc.generated.ASTRefVariable; import net.rkoubou.kspparser.javacc.generated.ASTSelectStatement; -import net.rkoubou.kspparser.javacc.generated.ASTUIInitializer; import net.rkoubou.kspparser.javacc.generated.ASTUserFunctionDeclaration; import net.rkoubou.kspparser.javacc.generated.ASTVariableDeclaration; import net.rkoubou.kspparser.javacc.generated.ASTVariableInitializer; @@ -455,7 +454,34 @@ public Object visit( ASTVariableDeclaration node, Object data) | PrimitiveInititalizer ] */ - return node.jjtGetChild( 0 ).jjtAccept( this, node ); + + // 初期化式なし + if( node.jjtGetNumChildren() == 0 ) + { + final Variable v = variableTable.search( node.symbol ); + final UIType uiType = uiTypeTable.search( v.uiTypeName ); + + // UI型変数の初期値代入必須の検証 + if( v.isUIVariable() ) + { + if( uiType == null ) + { + // KSP(data/symbol/uitypes.txt)で未定義のUIタイプ + // シンボル収集フェーズで警告出力済みなので何もしない + v.state = SymbolState.INITIALIZED; + } + else if( uiType.initializerRequired ) + { + // 変数宣言時に初期化式が必須 + MessageManager.printlnE( MessageManager.PROPERTY_ERROR_SEMANTIC_VARIABLE_REQUIRED_INITIALIZER, v ); + AnalyzeErrorCounter.e(); + } + } + + return node; + } + node.childrenAccept( this, node ); + return node; } /** @@ -490,6 +516,114 @@ public Object visit( ASTVariableInitializer node, Object data ) return node; } + /** + * プリミティブ型宣言の実装 + */ + @Override + public Object visit( ASTPrimitiveInititalizer node, Object data ) + { +/* + VariableDeclaration + -> ASTVariableInitializer + -> [ + ArrayInitializer + | UIInitializer + | PrimitiveInititalizer //NOW + -> [Expression] + ] +*/ + final Variable v = variableTable.search( ((SimpleNode)node.jjtGetParent().jjtGetParent()).symbol ); + + if( node.hasAssign ) + { + if( v.isUIVariable() ) + { + /* + プリミティブ型変数なのに ui_#### 修飾子がある状態、かつ := がある状態 + 文保解析フェーズでは解決不可能な言語仕様のためここで判定を行っている + + e.g.: + declare ui_label %a := ( 0, 0 ) + */ + MessageManager.printlnE( MessageManager.PROPERTY_ERROR_SYNTAX, v ); + AnalyzeErrorCounter.e(); + return node; + } + } + else + { + if( !v.isUIVariable() ) + { + /* + ui_#### 修飾子が無い、且つ := が無く、UI初期化子である状態 + 文法解析フェーズでは解決不可能な言語仕様のためここで判定を行っている + + e.g.: + declare %a( 0, 0 ) + */ + MessageManager.printlnE( MessageManager.PROPERTY_ERROR_SYNTAX, v ); + AnalyzeErrorCounter.e(); + return node; + } + uiInitializerImpl( node, v, data ); + return node; + } + + if( node.jjtGetNumChildren() == 0 ) + { + if( v.isConstant() ) + { + // 定数宣言している場合は初期値代入が必須 + MessageManager.printlnE( MessageManager.PROPERTY_ERROR_SEMANTIC_VARIABLE_REQUIRED_INITIALIZER, v ) ; + AnalyzeErrorCounter.e(); + return node; + } + // 初期値代入なし + return node; + } + + final SimpleNode expr = (SimpleNode)node.jjtGetChild( 0 ).jjtAccept( this, data ); + SymbolDefinition eval = (SymbolDefinition)expr.symbol; + + // 型の不一致 + if( ( v.type & eval.type ) == 0 ) + { + MessageManager.printlnE( MessageManager.PROPERTY_ERROR_SEMANTIC_VARIABLE_INVALID_INITIALIZER_TYPE, v, SymbolDefinition.getTypeName( eval.type ), SymbolDefinition.getTypeName( v.type ) ) ; + AnalyzeErrorCounter.e(); + return node; + } + + // 文字列型は初期値代入不可 + if( v.isString() ) + { + MessageManager.printlnE( MessageManager.PROPERTY_ERROR_SEMANTIC_VARIABLE_INVALID_STRING_INITIALIZER, v ); + AnalyzeErrorCounter.e(); + return node; + } + + // 初期値代入。畳み込みで有効な値が格納される + if( expr.symbol.symbolType != SymbolType.Command ) + { + Object value = null; + if( v.isInt() ) + { + value = evalConstantIntValue( expr, 0 ); + } + else if( v.isReal() ) + { + value = evalConstantRealValue( expr, 0 ); + } + else if( v.isString() ) + { + // 文字列は初期値代入不可 + value = null; + } + v.setValue( value ); + } + v.state = SymbolState.INITIALIZED; + return node; + } + /** * 配列型宣言の実装 */ @@ -508,7 +642,35 @@ public Object visit( ASTArrayInitializer node, Object data ) | PrimitiveInititalizer ] */ - arrayInitializerImpl( node, data, false ); + final Variable v = variableTable.search( ((SimpleNode)node.jjtGetParent().jjtGetParent()).symbol ); + if( node.hasAssign ) + { + if( v.isUIVariable() ) + { + /* + 配列型変数なのに ui_#### 修飾子がある状態、かつ := で初期値代入をしている + 文保解析フェーズでは解決不可能な言語仕様のためここで判定を行っている + + e.g.: + declare ui_table %t[ 3 ] := ( 0, 0, 0 ) + */ + MessageManager.printlnE( MessageManager.PROPERTY_ERROR_SYNTAX, v ); + AnalyzeErrorCounter.e(); + return node; + } + arrayInitializerImpl( node, data, false ); + } + else + { + if( v.isUIVariable() ) + { + uiInitializerImpl( node, v, data ); + } + else + { + arrayInitializerImpl( node, data, false ); + } + } return node; } @@ -526,7 +688,6 @@ protected boolean arrayInitializerImpl( SimpleNode node, Object data, boolean fo -> ArrayIndex -> Expression -> (,Expression)* - | UIInitializer | PrimitiveInititalizer ] */ @@ -609,7 +770,7 @@ protected boolean arrayInitializerImpl( SimpleNode node, Object data, boolean fo { // 初期値代入なし v.state = SymbolState.UNLOADED; - return false; + return true; } if( v.isString() ) @@ -625,10 +786,6 @@ protected boolean arrayInitializerImpl( SimpleNode node, Object data, boolean fo final SimpleNode expr = (SimpleNode)node.jjtGetChild( i ).jjtAccept( this, data ); SymbolDefinition eval = (SymbolDefinition) expr.symbol; - if( expr.getId() == JJTNEG ) - { - eval = ( (Variable)expr.jjtAccept( this, node ) ); - } if( ( v.type & eval.type ) == 0 ) { MessageManager.printlnE( MessageManager.PROPERTY_ERROR_SEMANTIC_VARIABLE_INVALID_ARRAYINITILIZER, v, String.valueOf( i ) ); @@ -642,22 +799,23 @@ protected boolean arrayInitializerImpl( SimpleNode node, Object data, boolean fo /** * UI型宣言の実装 */ - @Override - public Object visit( ASTUIInitializer node, Object data ) + protected void uiInitializerImpl( SimpleNode initializer, Variable v, Object jjtVisitorData ) { /* VariableDeclaration -> ASTVariableInitializer -> [ - ArrayInitializer - | UIInitializer // NOW - -> [ArrayIndex] - -> Expression - -> (,Expression)* + ArrayInitializer + -> ArrayIndex + -> Expression + -> (,Expression)* + | UIInitializer //NOW + -> [ ArrayIndex ] + -> Expressiom + -> (,Expression)* | PrimitiveInititalizer ] */ - final Variable v = variableTable.search( ((SimpleNode)node.jjtGetParent().jjtGetParent()).symbol ); final UIType uiType = uiTypeTable.search( v.uiTypeName ); if( uiType == null ) @@ -665,7 +823,7 @@ public Object visit( ASTUIInitializer node, Object data ) // KSP(data/symbol/uitypes.txt)で未定義のUIタイプ // シンボル収集フェーズで警告出力済みなので何もしない v.state = SymbolState.INITIALIZED; - return false; + return; } //-------------------------------------------------------------------------- @@ -675,7 +833,7 @@ public Object visit( ASTUIInitializer node, Object data ) { MessageManager.printlnE( MessageManager.PROPERTY_ERROR_SEMANTIC_VARIABLE_INVALID_UITYPE, v, SymbolDefinition.getTypeName( uiType.uiValueType ), uiType.name ); AnalyzeErrorCounter.e(); - return node; + return; } //-------------------------------------------------------------------------- @@ -686,7 +844,7 @@ public Object visit( ASTUIInitializer node, Object data ) // ui_#### const 修飾子を付与できない MessageManager.printlnE( MessageManager.PROPERTY_ERROR_SEMANTIC_VARIABLE_DECLARE_CONST, v ); AnalyzeErrorCounter.e(); - return node; + return; } //-------------------------------------------------------------------------- @@ -694,9 +852,9 @@ public Object visit( ASTUIInitializer node, Object data ) //-------------------------------------------------------------------------- if( SymbolDefinition.isArray( uiType.uiValueType ) ) { - if( !arrayInitializerImpl( node, data, true ) ) + if( !arrayInitializerImpl( initializer, jjtVisitorData, true ) ) { - return node; + return; } } @@ -707,20 +865,20 @@ public Object visit( ASTUIInitializer node, Object data ) { // 初期化不要 v.state = SymbolState.INITIALIZED; - return node; + return; } - if( node.jjtGetNumChildren() < 1 ) + if( initializer.jjtGetNumChildren() < 1 ) { // 配列型なら子は2以上 (ArrayIndex, Expression, ...) // そうでない場合なら子1は以上(Expression, ...) MessageManager.printlnE( MessageManager.PROPERTY_ERROR_SEMANTIC_VARIABLE_REQUIRED_INITIALIZER, v ); AnalyzeErrorCounter.e(); - return node; + return; } // for のカウンタ初期値の設定 int i; - if( node.jjtGetChild( 0 ).getId() == JJTARRAYINDEX ) + if( initializer.jjtGetChild( 0 ).getId() == JJTARRAYINDEX ) { // 変数配列型の場合 // node[ 0 ] : ArrayIndex @@ -735,21 +893,21 @@ public Object visit( ASTUIInitializer node, Object data ) } // UI初期化式の引数チェック - if( node.jjtGetNumChildren() - i != uiType.initilzerTypeList.length ) + if( initializer.jjtGetNumChildren() - i != uiType.initilzerTypeList.length ) { // 引数の数が一致していない - String cnt = String.valueOf( node.jjtGetNumChildren() - i ); + String cnt = String.valueOf( initializer.jjtGetNumChildren() - i ); String req = String.valueOf( uiType.initilzerTypeList.length ); MessageManager.printlnE( MessageManager.PROPERTY_ERROR_SEMANTIC_VARIABLE_INVALID_UIINITIALIZER_COUNT, v, uiType.name, cnt, req ); AnalyzeErrorCounter.e(); - return false; + return; } // i は上記で初期化済み - for( ; i < node.jjtGetNumChildren(); i++ ) + for( ; i < initializer.jjtGetNumChildren(); i++ ) { boolean found = false; - SimpleNode n = (SimpleNode)node.jjtGetChild( i ); + SimpleNode n = (SimpleNode)initializer.jjtGetChild( i ); SymbolDefinition param = n.symbol; int nid = n.getId(); int argT = 0; @@ -836,86 +994,9 @@ public Object visit( ASTUIInitializer node, Object data ) break; } } - - return node; - } - - /** - * プリミティブ型宣言の実装 - */ - @Override - public Object visit( ASTPrimitiveInititalizer node, Object data ) - { -/* - VariableDeclaration - -> ASTVariableInitializer - -> [ - ArrayInitializer - | UIInitializer - | PrimitiveInititalizer //NOW - -> [Expression] - ] -*/ - final Variable v = variableTable.search( ((SimpleNode)node.jjtGetParent().jjtGetParent()).symbol ); - - if( node.jjtGetNumChildren() == 0 ) - { - if( v.isConstant() ) - { - // 定数宣言している場合は初期値代入が必須 - MessageManager.printlnE( MessageManager.PROPERTY_ERROR_SEMANTIC_VARIABLE_REQUIRED_INITIALIZER, v ) ; - AnalyzeErrorCounter.e(); - return node; - } - // 初期値代入なし - return node; - } - - final SimpleNode expr = (SimpleNode)node.jjtGetChild( 0 ).jjtAccept( this, data ); - SymbolDefinition eval = (SymbolDefinition)expr.symbol; - - if( expr.getId() == JJTNEG ) - { - eval = (SymbolDefinition)expr.jjtAccept( this, data ); - } - - // 型の不一致 - if( ( v.type & eval.type ) == 0 ) - { - MessageManager.printlnE( MessageManager.PROPERTY_ERROR_SEMANTIC_VARIABLE_INVALID_INITIALIZER_TYPE, v, SymbolDefinition.getTypeName( eval.type ), SymbolDefinition.getTypeName( v.type ) ) ; - AnalyzeErrorCounter.e(); - return node; - } - - // 文字列型は初期値代入不可 - if( v.isString() ) - { - MessageManager.printlnE( MessageManager.PROPERTY_ERROR_SEMANTIC_VARIABLE_INVALID_STRING_INITIALIZER, v ); - AnalyzeErrorCounter.e(); - return node; - } - - // 初期値代入。畳み込みで有効な値が格納される - if( expr.symbol.symbolType != SymbolType.Command ) - { - Object value = null; - if( v.isInt() ) - { - value = evalConstantIntValue( expr, 0 ); - } - else if( v.isReal() ) - { - value = evalConstantRealValue( expr, 0 ); - } - else if( v.isString() ) - { - // 文字列は初期値代入不可 - value = null; - } - v.setValue( value ); - } - v.state = SymbolState.INITIALIZED; - return node; + // コールバックから参照されるので意図的に参照フラグON + v.state = SymbolState.LOADED; + v.referenced = true; } //-------------------------------------------------------------------------- diff --git a/src/java/net/rkoubou/kspparser/javacc/generated/ASTArrayInitializer.java b/src/java/net/rkoubou/kspparser/javacc/generated/ASTArrayInitializer.java index 0204ed5..3d2734f 100644 --- a/src/java/net/rkoubou/kspparser/javacc/generated/ASTArrayInitializer.java +++ b/src/java/net/rkoubou/kspparser/javacc/generated/ASTArrayInitializer.java @@ -4,6 +4,10 @@ public class ASTArrayInitializer extends SimpleNode { + + /** トークン ":="" を含んでいたかどうか。UIの初期化子の場合分け用 */ + public boolean hasAssign; + public ASTArrayInitializer(int id) { super(id); } diff --git a/src/java/net/rkoubou/kspparser/javacc/generated/ASTPrimitiveInititalizer.java b/src/java/net/rkoubou/kspparser/javacc/generated/ASTPrimitiveInititalizer.java index 0abdb55..dbee66b 100644 --- a/src/java/net/rkoubou/kspparser/javacc/generated/ASTPrimitiveInititalizer.java +++ b/src/java/net/rkoubou/kspparser/javacc/generated/ASTPrimitiveInititalizer.java @@ -4,6 +4,10 @@ public class ASTPrimitiveInititalizer extends SimpleNode { + + /** トークン ":="" を含んでいたかどうか。UIの初期化子の場合分け用 */ + public boolean hasAssign; + public ASTPrimitiveInititalizer(int id) { super(id); } diff --git a/src/java/net/rkoubou/kspparser/javacc/generated/ASTUIInitializer.java b/src/java/net/rkoubou/kspparser/javacc/generated/ASTUIInitializer.java deleted file mode 100644 index e5b8194..0000000 --- a/src/java/net/rkoubou/kspparser/javacc/generated/ASTUIInitializer.java +++ /dev/null @@ -1,23 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ASTUIInitializer.java Version 6.0 */ -/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=true,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=net.rkoubou.kspparser.javacc.ASTKSPNode,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ -package net.rkoubou.kspparser.javacc.generated; - -public -class ASTUIInitializer extends SimpleNode { - public ASTUIInitializer(int id) { - super(id); - } - - public ASTUIInitializer(KSPParser p, int id) { - super(p, id); - } - - - /** Accept the visitor. **/ - public Object jjtAccept(KSPParserVisitor visitor, Object data) { - - return - visitor.visit(this, data); - } -} -/* JavaCC - OriginalChecksum=1fad0f47667b52dca097b7c9f9e5f146 (do not edit this line) */ diff --git a/src/java/net/rkoubou/kspparser/javacc/generated/KSPParser.java b/src/java/net/rkoubou/kspparser/javacc/generated/KSPParser.java index 0335b58..8fdfc7a 100644 --- a/src/java/net/rkoubou/kspparser/javacc/generated/KSPParser.java +++ b/src/java/net/rkoubou/kspparser/javacc/generated/KSPParser.java @@ -208,59 +208,57 @@ void errorSkipTo( ParseException e ) // // プログラム全体 // - final public ASTRootNode KSPScript() throws ParseException { - trace_call("KSPScript"); - try {/*@bgen(jjtree) RootNode */ + final public ASTRootNode KSPScript() throws ParseException {/*@bgen(jjtree) RootNode */ ASTRootNode jjtn000 = new ASTRootNode(this, JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); + try { try { - try { - label_1: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case EOL: - case MULTI_LINE_DELIMITER: - case ON: - case FUNCTION:{ - ; - break; - } - default: - jj_la1[0] = jj_gen; - break label_1; + label_1: + while (true) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case EOL: + case MULTI_LINE_DELIMITER: + case ON: + case FUNCTION:{ + ; + break; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case ON:{ - CallbackDeclaration(); - break; - } - case FUNCTION:{ - UserFunctionDeclaration(); - break; - } - case EOL:{ - jj_consume_token(EOL); - break; - } - case MULTI_LINE_DELIMITER:{ - jj_consume_token(MULTI_LINE_DELIMITER); - break; - } - default: - jj_la1[1] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); + default: + jj_la1[0] = jj_gen; + break label_1; + } + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case ON:{ + CallbackDeclaration(); + break; + } + case FUNCTION:{ + UserFunctionDeclaration(); + break; + } + case EOL:{ + jj_consume_token(EOL); + break; + } + case MULTI_LINE_DELIMITER:{ + jj_consume_token(MULTI_LINE_DELIMITER); + break; } + default: + jj_la1[1] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); } - } catch (ParseException e) { -errorSkipTo( e ); } - jj_consume_token(0); + } catch (ParseException e) { +errorSkipTo( e ); + } + jj_consume_token(0); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; {if ("" != null) return jjtn000;} - } catch (Throwable jjte000) { + } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; @@ -274,128 +272,118 @@ final public ASTRootNode KSPScript() throws ParseException { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} - } finally { + } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } - } - throw new Error("Missing return statement in function"); - } finally { - trace_return("KSPScript"); } + throw new Error("Missing return statement in function"); } // // 変数の定義 // - final public Token Variable() throws ParseException { - trace_call("Variable"); - try {Token var; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case VARIABLE_INT:{ - var = jj_consume_token(VARIABLE_INT); - break; - } - case VARIABLE_INT_ARRAY:{ - var = jj_consume_token(VARIABLE_INT_ARRAY); - break; - } - case VARIABLE_REAL:{ - var = jj_consume_token(VARIABLE_REAL); - break; - } - case VARIABLE_REAL_ARRAY:{ - var = jj_consume_token(VARIABLE_REAL_ARRAY); - break; - } - case VARIABLE_STRING:{ - var = jj_consume_token(VARIABLE_STRING); - break; - } - case VARIABLE_STRING_ARRAY:{ - var = jj_consume_token(VARIABLE_STRING_ARRAY); - break; - } - default: - jj_la1[2] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); + final public Token Variable() throws ParseException {Token var; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case VARIABLE_INT:{ + var = jj_consume_token(VARIABLE_INT); + break; + } + case VARIABLE_INT_ARRAY:{ + var = jj_consume_token(VARIABLE_INT_ARRAY); + break; + } + case VARIABLE_REAL:{ + var = jj_consume_token(VARIABLE_REAL); + break; } + case VARIABLE_REAL_ARRAY:{ + var = jj_consume_token(VARIABLE_REAL_ARRAY); + break; + } + case VARIABLE_STRING:{ + var = jj_consume_token(VARIABLE_STRING); + break; + } + case VARIABLE_STRING_ARRAY:{ + var = jj_consume_token(VARIABLE_STRING_ARRAY); + break; + } + default: + jj_la1[2] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } {if ("" != null) return var;} throw new Error("Missing return statement in function"); - } finally { - trace_return("Variable"); - } } // // 変数宣言 // - final public void VariableDeclaration() throws ParseException { - trace_call("VariableDeclaration"); - try {/*@bgen(jjtree) VariableDeclaration */ + final public void VariableDeclaration() throws ParseException {/*@bgen(jjtree) VariableDeclaration */ ASTVariableDeclaration jjtn000 = new ASTVariableDeclaration(this, JJTVARIABLEDECLARATION); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000);Token name; Token symbol; Token uiType = null; - try { - symbol = jj_consume_token(DECLARE); - label_2: - while (true) { - if (jj_2_1(2)) { - ; - } else { - break label_2; - } - jj_consume_token(MULTI_LINE_DELIMITER); + try { + symbol = jj_consume_token(DECLARE); + label_2: + while (true) { + if (jj_2_1(2)) { + ; + } else { + break label_2; } + jj_consume_token(MULTI_LINE_DELIMITER); + } + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case CONST: + case POLYPHONIC: + case IDENTIFIER:{ switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case CONST: - case POLYPHONIC: - case IDENTIFIER:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case CONST:{ - jj_consume_token(CONST); + case CONST:{ + jj_consume_token(CONST); jjtn000.symbol.accessFlag = ACCESS_ATTR_CONST; - break; - } - case POLYPHONIC:{ - jj_consume_token(POLYPHONIC); + break; + } + case POLYPHONIC:{ + jj_consume_token(POLYPHONIC); jjtn000.symbol.accessFlag = ACCESS_ATTR_POLY; - break; - } - case IDENTIFIER:{ - uiType = jj_consume_token(IDENTIFIER); -jjtn000.symbol.accessFlag = ACCESS_ATTR_UI; - break; - } - default: - jj_la1[3] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); + break; } + case IDENTIFIER:{ + uiType = jj_consume_token(IDENTIFIER); +jjtn000.symbol.accessFlag = ACCESS_ATTR_UI; break; } default: - jj_la1[4] = jj_gen; - ; + jj_la1[3] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); } - label_3: - while (true) { - if (jj_2_2(2)) { - ; - } else { - break label_3; - } - jj_consume_token(MULTI_LINE_DELIMITER); + break; } - name = Variable(); - if (jj_2_3(2)) { - VariableInitializer(); - } else { + default: + jj_la1[4] = jj_gen; + ; + } + label_3: + while (true) { + if (jj_2_2(2)) { ; + } else { + break label_3; } + jj_consume_token(MULTI_LINE_DELIMITER); + } + name = Variable(); + if (jj_2_3(2)) { + VariableInitializer(); + } else { + ; + } jjtn000.symbol.setName( name.image ); jjtn000.symbol.type = Variable.getKSPTypeFromVariableName( name.image ); jjtree.closeNodeScope(jjtn000, true); @@ -406,7 +394,7 @@ final public void VariableDeclaration() throws ParseException { } jjtn000.symbol.position.copy( symbol ); jjtn000.symbol.symbolType = SymbolDefinition.SymbolType.Variable; - } catch (Throwable jjte000) { + } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; @@ -420,46 +408,37 @@ final public void VariableDeclaration() throws ParseException { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} - } finally { + } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } - } - } finally { - trace_return("VariableDeclaration"); } } // // 初期値代入 // - final public void VariableInitializer() throws ParseException { - trace_call("VariableInitializer"); - try {/*@bgen(jjtree) VariableInitializer */ + final public void VariableInitializer() throws ParseException {/*@bgen(jjtree) VariableInitializer */ ASTVariableInitializer jjtn000 = new ASTVariableInitializer(this, JJTVARIABLEINITIALIZER); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); - try { - if (jj_2_4(2)) { - ArrayInitializer(); - } else { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LPAREN: - case LBRACKET:{ - UIInitializer(); - break; - } - case ASSIGN:{ - PrimitiveInititalizer(); - break; - } - default: - jj_la1[5] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } + try { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case LBRACKET:{ + ArrayInitializer(); + break; + } + case ASSIGN: + case LPAREN:{ + PrimitiveInititalizer(); + break; } - } catch (Throwable jjte000) { + default: + jj_la1[5] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; @@ -473,68 +452,73 @@ final public void VariableInitializer() throws ParseException { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} - } finally { + } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } - } - } finally { - trace_return("VariableInitializer"); } } // -// 配列変数初期値代入 +// プリミティブ型変数初期値代入 // - final public void ArrayInitializer() throws ParseException { - trace_call("ArrayInitializer"); - try {/*@bgen(jjtree) ArrayInitializer */ - ASTArrayInitializer jjtn000 = new ASTArrayInitializer(this, JJTARRAYINITIALIZER); + final public void PrimitiveInititalizer() throws ParseException {/*@bgen(jjtree) PrimitiveInititalizer */ + ASTPrimitiveInititalizer jjtn000 = new ASTPrimitiveInititalizer(this, JJTPRIMITIVEINITITALIZER); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); - try { - ArrayIndex(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case ASSIGN:{ - jj_consume_token(ASSIGN); - jj_consume_token(LPAREN); - Expression(); - label_4: + try { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case ASSIGN:{ + jj_consume_token(ASSIGN); + Expression(); +jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; +jjtn000.hasAssign = true; + break; + } + case LPAREN:{ + jj_consume_token(LPAREN); + Expression(); + label_4: + while (true) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case MULTI_LINE_DELIMITER: + case COMMA:{ + ; + break; + } + default: + jj_la1[6] = jj_gen; + break label_4; + } + label_5: while (true) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case MULTI_LINE_DELIMITER: - case COMMA:{ + case MULTI_LINE_DELIMITER:{ ; break; } default: - jj_la1[6] = jj_gen; - break label_4; - } - label_5: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case MULTI_LINE_DELIMITER:{ - ; - break; - } - default: - jj_la1[7] = jj_gen; - break label_5; - } - jj_consume_token(MULTI_LINE_DELIMITER); + jj_la1[7] = jj_gen; + break label_5; } - jj_consume_token(COMMA); - Expression(); - } - jj_consume_token(RPAREN); - break; + jj_consume_token(MULTI_LINE_DELIMITER); } - default: - jj_la1[8] = jj_gen; - ; + jj_consume_token(COMMA); + Expression(); } - } catch (Throwable jjte000) { + jj_consume_token(RPAREN); +jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; +jjtn000.hasAssign = false; + break; + } + default: + jj_la1[8] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; @@ -548,29 +532,26 @@ final public void ArrayInitializer() throws ParseException { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} - } finally { + } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } - } - } finally { - trace_return("ArrayInitializer"); } } // -// UI変数初期値代入 +// 配列変数初期値代入 // - final public void UIInitializer() throws ParseException { - trace_call("UIInitializer"); - try {/*@bgen(jjtree) UIInitializer */ - ASTUIInitializer jjtn000 = new ASTUIInitializer(this, JJTUIINITIALIZER); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - try { + final public void ArrayInitializer() throws ParseException {/*@bgen(jjtree) ArrayInitializer */ + ASTArrayInitializer jjtn000 = new ASTArrayInitializer(this, JJTARRAYINITIALIZER); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000);Token assign = null; + try { + ArrayIndex(); + if (jj_2_4(2)) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LBRACKET:{ - ArrayIndex(); + case ASSIGN:{ + assign = jj_consume_token(ASSIGN); break; } default: @@ -608,43 +589,13 @@ final public void UIInitializer() throws ParseException { Expression(); } jj_consume_token(RPAREN); - } catch (Throwable jjte000) { -if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - {if (true) throw (RuntimeException)jjte000;} - } - if (jjte000 instanceof ParseException) { - {if (true) throw (ParseException)jjte000;} - } - {if (true) throw (Error)jjte000;} - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - } + ; } - } finally { - trace_return("UIInitializer"); - } - } - -// -// プリミティブ型変数初期値代入 -// - final public void PrimitiveInititalizer() throws ParseException { - trace_call("PrimitiveInititalizer"); - try {/*@bgen(jjtree) PrimitiveInititalizer */ - ASTPrimitiveInititalizer jjtn000 = new ASTPrimitiveInititalizer(this, JJTPRIMITIVEINITITALIZER); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - try { - jj_consume_token(ASSIGN); - Expression(); - } catch (Throwable jjte000) { +jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; +jjtn000.hasAssign = assign != null; + } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; @@ -658,83 +609,78 @@ final public void PrimitiveInititalizer() throws ParseException { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} - } finally { + } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } - } - } finally { - trace_return("PrimitiveInititalizer"); } } // // コールバック本体 // - final public void CallbackDeclaration() throws ParseException { - trace_call("CallbackDeclaration"); - try {/*@bgen(jjtree) CallbackDeclaration */ + final public void CallbackDeclaration() throws ParseException {/*@bgen(jjtree) CallbackDeclaration */ ASTCallbackDeclaration jjtn000 = new ASTCallbackDeclaration(this, JJTCALLBACKDECLARATION); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000);Token symbol; Token end; this.currentScopeLineCounter = 0; - try { - jj_consume_token(ON); - label_8: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case MULTI_LINE_DELIMITER:{ - ; - break; - } - default: - jj_la1[12] = jj_gen; - break label_8; - } - jj_consume_token(MULTI_LINE_DELIMITER); - } - symbol = jj_consume_token(IDENTIFIER); - label_9: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case MULTI_LINE_DELIMITER:{ - ; - break; - } - default: - jj_la1[13] = jj_gen; - break label_9; + try { + jj_consume_token(ON); + label_8: + while (true) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case MULTI_LINE_DELIMITER:{ + ; + break; } - jj_consume_token(MULTI_LINE_DELIMITER); + default: + jj_la1[12] = jj_gen; + break label_8; } + jj_consume_token(MULTI_LINE_DELIMITER); + } + symbol = jj_consume_token(IDENTIFIER); + label_9: + while (true) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LPAREN:{ - CallbackArgument(); + case MULTI_LINE_DELIMITER:{ + ; break; } default: - jj_la1[14] = jj_gen; - ; + jj_la1[13] = jj_gen; + break label_9; } - jj_consume_token(EOL); + jj_consume_token(MULTI_LINE_DELIMITER); + } + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case LPAREN:{ + CallbackArgument(); + break; + } + default: + jj_la1[14] = jj_gen; + ; + } + jj_consume_token(EOL); this.currentScopeLineCounter++; - Block(); - jj_consume_token(END); - label_10: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case MULTI_LINE_DELIMITER:{ - ; - break; - } - default: - jj_la1[15] = jj_gen; - break label_10; + Block(); + jj_consume_token(END); + label_10: + while (true) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case MULTI_LINE_DELIMITER:{ + ; + break; } - jj_consume_token(MULTI_LINE_DELIMITER); + default: + jj_la1[15] = jj_gen; + break label_10; } - end = jj_consume_token(ON); + jj_consume_token(MULTI_LINE_DELIMITER); + } + end = jj_consume_token(ON); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.symbol.setName( symbol.image ); @@ -751,7 +697,7 @@ final public void CallbackDeclaration() throws ParseException { String.valueOf( jjtn000.symbol.position.lineCount() ) ); } - } catch (Throwable jjte000) { + } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; @@ -765,13 +711,10 @@ final public void CallbackDeclaration() throws ParseException { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} - } finally { + } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } - } - } finally { - trace_return("CallbackDeclaration"); } } @@ -779,57 +722,50 @@ final public void CallbackDeclaration() throws ParseException { // コールバック・引数宣言 // final public void CallbackArgument() throws ParseException { - trace_call("CallbackArgument"); - try { - jj_consume_token(LPAREN); - label_11: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case MULTI_LINE_DELIMITER:{ - ; - break; - } - default: - jj_la1[16] = jj_gen; - break label_11; + jj_consume_token(LPAREN); + label_11: + while (true) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case MULTI_LINE_DELIMITER:{ + ; + break; } - jj_consume_token(MULTI_LINE_DELIMITER); + default: + jj_la1[16] = jj_gen; + break label_11; } - CallbackArgumentList(); - jj_consume_token(RPAREN); - } finally { - trace_return("CallbackArgument"); + jj_consume_token(MULTI_LINE_DELIMITER); } + CallbackArgumentList(); + jj_consume_token(RPAREN); } // // コールバック・引数リスト // - final public void CallbackArgumentList() throws ParseException { - trace_call("CallbackArgumentList"); - try {/*@bgen(jjtree) CallbackArgumentList */ + final public void CallbackArgumentList() throws ParseException {/*@bgen(jjtree) CallbackArgumentList */ ASTCallbackArgumentList jjtn000 = new ASTCallbackArgumentList(this, JJTCALLBACKARGUMENTLIST); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000);Token arg1, argN ; - try { - arg1 = Variable(); + try { + arg1 = Variable(); jjtn000.args.add( arg1.image ); - label_12: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ - ; - break; - } - default: - jj_la1[17] = jj_gen; - break label_12; + label_12: + while (true) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case COMMA:{ + ; + break; } - jj_consume_token(COMMA); - argN = Variable(); -jjtn000.args.add( argN.image ); + default: + jj_la1[17] = jj_gen; + break label_12; } - } catch (Throwable jjte000) { + jj_consume_token(COMMA); + argN = Variable(); +jjtn000.args.add( argN.image ); + } + } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; @@ -843,61 +779,56 @@ final public void CallbackArgumentList() throws ParseException { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} - } finally { + } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } - } - } finally { - trace_return("CallbackArgumentList"); } } // // ユーザー定義関数本体 // - final public void UserFunctionDeclaration() throws ParseException { - trace_call("UserFunctionDeclaration"); - try {/*@bgen(jjtree) UserFunctionDeclaration */ + final public void UserFunctionDeclaration() throws ParseException {/*@bgen(jjtree) UserFunctionDeclaration */ ASTUserFunctionDeclaration jjtn000 = new ASTUserFunctionDeclaration(this, JJTUSERFUNCTIONDECLARATION); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000);Token symbol; Token end; this.currentScopeLineCounter = 0; - try { - jj_consume_token(FUNCTION); - label_13: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case MULTI_LINE_DELIMITER:{ - ; - break; - } - default: - jj_la1[18] = jj_gen; - break label_13; + try { + jj_consume_token(FUNCTION); + label_13: + while (true) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case MULTI_LINE_DELIMITER:{ + ; + break; } - jj_consume_token(MULTI_LINE_DELIMITER); + default: + jj_la1[18] = jj_gen; + break label_13; } - symbol = jj_consume_token(IDENTIFIER); - jj_consume_token(EOL); + jj_consume_token(MULTI_LINE_DELIMITER); + } + symbol = jj_consume_token(IDENTIFIER); + jj_consume_token(EOL); this.currentScopeLineCounter++; - Block(); - jj_consume_token(END); - label_14: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case MULTI_LINE_DELIMITER:{ - ; - break; - } - default: - jj_la1[19] = jj_gen; - break label_14; + Block(); + jj_consume_token(END); + label_14: + while (true) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case MULTI_LINE_DELIMITER:{ + ; + break; } - jj_consume_token(MULTI_LINE_DELIMITER); + default: + jj_la1[19] = jj_gen; + break label_14; } - end = jj_consume_token(FUNCTION); + jj_consume_token(MULTI_LINE_DELIMITER); + } + end = jj_consume_token(FUNCTION); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.symbol.setName( symbol.image ); @@ -914,7 +845,7 @@ final public void UserFunctionDeclaration() throws ParseException { String.valueOf( jjtn000.symbol.position.lineCount() ) ); } - } catch (Throwable jjte000) { + } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; @@ -928,40 +859,35 @@ final public void UserFunctionDeclaration() throws ParseException { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} - } finally { + } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } - } - } finally { - trace_return("UserFunctionDeclaration"); } } // // コールバック本体 / ユーザー定義関数本体のスコープ本体 // - final public void Block() throws ParseException { - trace_call("Block"); - try {/*@bgen(jjtree) Block */ + final public void Block() throws ParseException {/*@bgen(jjtree) Block */ ASTBlock jjtn000 = new ASTBlock(this, JJTBLOCK); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); + try { try { - try { - label_15: - while (true) { - if (jj_2_5(2)) { - ; - } else { - break label_15; - } - BlockStatement(); + label_15: + while (true) { + if (jj_2_5(2)) { + ; + } else { + break label_15; } - } catch (ParseException e) { -errorSkipTo( e ); + BlockStatement(); } - } catch (Throwable jjte000) { + } catch (ParseException e) { +errorSkipTo( e ); + } + } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; @@ -975,13 +901,10 @@ final public void Block() throws ParseException { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} - } finally { + } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } - } - } finally { - trace_return("Block"); } } @@ -989,23 +912,52 @@ final public void Block() throws ParseException { // スコープ中の式 // final public void BlockStatement() throws ParseException { - trace_call("BlockStatement"); + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case DECLARE:{ + VariableDeclaration(); + break; + } + case EOL: + case MULTI_LINE_DELIMITER: + case IF: + case SELECT: + case WHILE: + case CALL: + case PREPROCESSOR_SET_COND: + case PREPROCESSOR_RESET_COND: + case PREPROCESSOR_CODE_IF: + case PREPROCESSOR_CODE_IF_NOT: + case VARIABLE_INT: + case VARIABLE_INT_ARRAY: + case VARIABLE_REAL: + case VARIABLE_REAL_ARRAY: + case VARIABLE_STRING: + case VARIABLE_STRING_ARRAY: + case LPAREN: + case IDENTIFIER:{ + Statement(); + break; + } + default: + jj_la1[20] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + +// +// 各種ステートメントの定義 +// + final public void Statement() throws ParseException { try { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DECLARE:{ - VariableDeclaration(); - break; - } - case EOL: - case MULTI_LINE_DELIMITER: - case IF: - case SELECT: - case WHILE: - case CALL: case PREPROCESSOR_SET_COND: case PREPROCESSOR_RESET_COND: case PREPROCESSOR_CODE_IF: - case PREPROCESSOR_CODE_IF_NOT: + case PREPROCESSOR_CODE_IF_NOT:{ + PreProcessorStatement(); + break; + } case VARIABLE_INT: case VARIABLE_INT_ARRAY: case VARIABLE_REAL: @@ -1014,313 +966,257 @@ final public void BlockStatement() throws ParseException { case VARIABLE_STRING_ARRAY: case LPAREN: case IDENTIFIER:{ - Statement(); + StatementExpression(); + break; + } + case IF:{ + IfStatement(); + break; + } + case SELECT:{ + SelectStatement(); + break; + } + case WHILE:{ + WhileStatement(); + break; + } + case CALL:{ + CallUserFunctionStatement(); + break; + } + case MULTI_LINE_DELIMITER:{ + jj_consume_token(MULTI_LINE_DELIMITER); + break; + } + case EOL:{ + jj_consume_token(EOL); +this.currentScopeLineCounter++; break; } default: - jj_la1[20] = jj_gen; + jj_la1[21] = jj_gen; jj_consume_token(-1); throw new ParseException(); } - } finally { - trace_return("BlockStatement"); + } catch (ParseException e) { +errorSkipTo( e ); } } // -// 各種ステートメントの定義 +// プリプロセッサ // - final public void Statement() throws ParseException { - trace_call("Statement"); + final public void PreProcessorStatement() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case PREPROCESSOR_SET_COND:{ + PreProcessorDefine(); + break; + } + case PREPROCESSOR_RESET_COND:{ + PreProcessorUnDefine(); + break; + } + case PREPROCESSOR_CODE_IF:{ + PreProcessorIfDefined(); + break; + } + case PREPROCESSOR_CODE_IF_NOT:{ + PreProcessorIfUnDefined(); + break; + } + default: + jj_la1[22] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + +// +// プリプロセッサ:シンボル定義 +// + final public void PreProcessorDefine() throws ParseException {/*@bgen(jjtree) PreProcessorDefine */ + ASTPreProcessorDefine jjtn000 = new ASTPreProcessorDefine(this, JJTPREPROCESSORDEFINE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000);Token symbol; try { - try { + jj_consume_token(PREPROCESSOR_SET_COND); + label_16: + while (true) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case PREPROCESSOR_SET_COND: - case PREPROCESSOR_RESET_COND: - case PREPROCESSOR_CODE_IF: - case PREPROCESSOR_CODE_IF_NOT:{ - PreProcessorStatement(); - break; - } - case VARIABLE_INT: - case VARIABLE_INT_ARRAY: - case VARIABLE_REAL: - case VARIABLE_REAL_ARRAY: - case VARIABLE_STRING: - case VARIABLE_STRING_ARRAY: - case LPAREN: - case IDENTIFIER:{ - StatementExpression(); - break; - } - case IF:{ - IfStatement(); - break; - } - case SELECT:{ - SelectStatement(); - break; - } - case WHILE:{ - WhileStatement(); - break; - } - case CALL:{ - CallUserFunctionStatement(); + case MULTI_LINE_DELIMITER:{ + ; break; } + default: + jj_la1[23] = jj_gen; + break label_16; + } + jj_consume_token(MULTI_LINE_DELIMITER); + } + jj_consume_token(LPAREN); + label_17: + while (true) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case MULTI_LINE_DELIMITER:{ - jj_consume_token(MULTI_LINE_DELIMITER); + ; break; } - case EOL:{ - jj_consume_token(EOL); -this.currentScopeLineCounter++; + default: + jj_la1[24] = jj_gen; + break label_17; + } + jj_consume_token(MULTI_LINE_DELIMITER); + } + symbol = jj_consume_token(IDENTIFIER); + label_18: + while (true) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case MULTI_LINE_DELIMITER:{ + ; break; } default: - jj_la1[21] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); + jj_la1[25] = jj_gen; + break label_18; } - } catch (ParseException e) { -errorSkipTo( e ); + jj_consume_token(MULTI_LINE_DELIMITER); } + jj_consume_token(RPAREN); +jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; +jjtn000.symbol.setName( symbol.image ); + jjtn000.symbol.position.copy( symbol ); + jjtn000.symbol.symbolType = SymbolDefinition.SymbolType.PreprocessorSymbol; } finally { - trace_return("Statement"); +if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } } } // -// プリプロセッサ +// プリプロセッサ:シンボル破棄 // - final public void PreProcessorStatement() throws ParseException { - trace_call("PreProcessorStatement"); + final public void PreProcessorUnDefine() throws ParseException {/*@bgen(jjtree) PreProcessorUnDefine */ + ASTPreProcessorUnDefine jjtn000 = new ASTPreProcessorUnDefine(this, JJTPREPROCESSORUNDEFINE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000);Token symbol; try { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case PREPROCESSOR_SET_COND:{ - PreProcessorDefine(); - break; - } - case PREPROCESSOR_RESET_COND:{ - PreProcessorUnDefine(); - break; - } - case PREPROCESSOR_CODE_IF:{ - PreProcessorIfDefined(); - break; - } - case PREPROCESSOR_CODE_IF_NOT:{ - PreProcessorIfUnDefined(); - break; - } - default: - jj_la1[22] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } finally { - trace_return("PreProcessorStatement"); - } - } - -// -// プリプロセッサ:シンボル定義 -// - final public void PreProcessorDefine() throws ParseException { - trace_call("PreProcessorDefine"); - try {/*@bgen(jjtree) PreProcessorDefine */ - ASTPreProcessorDefine jjtn000 = new ASTPreProcessorDefine(this, JJTPREPROCESSORDEFINE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000);Token symbol; - try { - jj_consume_token(PREPROCESSOR_SET_COND); - label_16: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case MULTI_LINE_DELIMITER:{ - ; - break; - } - default: - jj_la1[23] = jj_gen; - break label_16; - } - jj_consume_token(MULTI_LINE_DELIMITER); - } - jj_consume_token(LPAREN); - label_17: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case MULTI_LINE_DELIMITER:{ - ; - break; - } - default: - jj_la1[24] = jj_gen; - break label_17; - } - jj_consume_token(MULTI_LINE_DELIMITER); - } - symbol = jj_consume_token(IDENTIFIER); - label_18: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case MULTI_LINE_DELIMITER:{ - ; - break; - } - default: - jj_la1[25] = jj_gen; - break label_18; + jj_consume_token(PREPROCESSOR_RESET_COND); + label_19: + while (true) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case MULTI_LINE_DELIMITER:{ + ; + break; } - jj_consume_token(MULTI_LINE_DELIMITER); + default: + jj_la1[26] = jj_gen; + break label_19; } - jj_consume_token(RPAREN); -jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; -jjtn000.symbol.setName( symbol.image ); - jjtn000.symbol.position.copy( symbol ); - jjtn000.symbol.symbolType = SymbolDefinition.SymbolType.PreprocessorSymbol; - } finally { -if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - } + jj_consume_token(MULTI_LINE_DELIMITER); } - } finally { - trace_return("PreProcessorDefine"); - } - } - -// -// プリプロセッサ:シンボル破棄 -// - final public void PreProcessorUnDefine() throws ParseException { - trace_call("PreProcessorUnDefine"); - try {/*@bgen(jjtree) PreProcessorUnDefine */ - ASTPreProcessorUnDefine jjtn000 = new ASTPreProcessorUnDefine(this, JJTPREPROCESSORUNDEFINE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000);Token symbol; - try { - jj_consume_token(PREPROCESSOR_RESET_COND); - label_19: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case MULTI_LINE_DELIMITER:{ - ; - break; - } - default: - jj_la1[26] = jj_gen; - break label_19; - } - jj_consume_token(MULTI_LINE_DELIMITER); - } - jj_consume_token(LPAREN); - label_20: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case MULTI_LINE_DELIMITER:{ - ; - break; - } - default: - jj_la1[27] = jj_gen; - break label_20; + jj_consume_token(LPAREN); + label_20: + while (true) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case MULTI_LINE_DELIMITER:{ + ; + break; } - jj_consume_token(MULTI_LINE_DELIMITER); + default: + jj_la1[27] = jj_gen; + break label_20; } - symbol = jj_consume_token(IDENTIFIER); - label_21: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case MULTI_LINE_DELIMITER:{ - ; - break; - } - default: - jj_la1[28] = jj_gen; - break label_21; + jj_consume_token(MULTI_LINE_DELIMITER); + } + symbol = jj_consume_token(IDENTIFIER); + label_21: + while (true) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case MULTI_LINE_DELIMITER:{ + ; + break; } - jj_consume_token(MULTI_LINE_DELIMITER); + default: + jj_la1[28] = jj_gen; + break label_21; } - jj_consume_token(RPAREN); + jj_consume_token(MULTI_LINE_DELIMITER); + } + jj_consume_token(RPAREN); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.symbol.setName( symbol.image ); jjtn000.symbol.position.copy( symbol ); jjtn000.symbol.symbolType = SymbolDefinition.SymbolType.PreprocessorSymbol; - } finally { + } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } - } - } finally { - trace_return("PreProcessorUnDefine"); } } // // プリプロセッサ:シンボル定義分岐(=ifdef) // - final public void PreProcessorIfDefined() throws ParseException { - trace_call("PreProcessorIfDefined"); - try {/*@bgen(jjtree) PreProcessorIfDefined */ + final public void PreProcessorIfDefined() throws ParseException {/*@bgen(jjtree) PreProcessorIfDefined */ ASTPreProcessorIfDefined jjtn000 = new ASTPreProcessorIfDefined(this, JJTPREPROCESSORIFDEFINED); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000);Token symbol; - try { - jj_consume_token(PREPROCESSOR_CODE_IF); - label_22: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case MULTI_LINE_DELIMITER:{ - ; - break; - } - default: - jj_la1[29] = jj_gen; - break label_22; + try { + jj_consume_token(PREPROCESSOR_CODE_IF); + label_22: + while (true) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case MULTI_LINE_DELIMITER:{ + ; + break; } - jj_consume_token(MULTI_LINE_DELIMITER); + default: + jj_la1[29] = jj_gen; + break label_22; } - jj_consume_token(LPAREN); - label_23: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case MULTI_LINE_DELIMITER:{ - ; - break; - } - default: - jj_la1[30] = jj_gen; - break label_23; + jj_consume_token(MULTI_LINE_DELIMITER); + } + jj_consume_token(LPAREN); + label_23: + while (true) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case MULTI_LINE_DELIMITER:{ + ; + break; } - jj_consume_token(MULTI_LINE_DELIMITER); + default: + jj_la1[30] = jj_gen; + break label_23; } - symbol = jj_consume_token(IDENTIFIER); - label_24: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case MULTI_LINE_DELIMITER:{ - ; - break; - } - default: - jj_la1[31] = jj_gen; - break label_24; + jj_consume_token(MULTI_LINE_DELIMITER); + } + symbol = jj_consume_token(IDENTIFIER); + label_24: + while (true) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case MULTI_LINE_DELIMITER:{ + ; + break; } - jj_consume_token(MULTI_LINE_DELIMITER); + default: + jj_la1[31] = jj_gen; + break label_24; } - jj_consume_token(RPAREN); - Block(); - jj_consume_token(PREPROCESSOR_CODE_END_IF); + jj_consume_token(MULTI_LINE_DELIMITER); + } + jj_consume_token(RPAREN); + Block(); + jj_consume_token(PREPROCESSOR_CODE_END_IF); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.symbol.setName( symbol.image ); jjtn000.symbol.position.copy( symbol ); jjtn000.symbol.symbolType = SymbolDefinition.SymbolType.PreprocessorSymbol; - } catch (Throwable jjte000) { + } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; @@ -1334,77 +1230,72 @@ final public void PreProcessorIfDefined() throws ParseException { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} - } finally { + } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } - } - } finally { - trace_return("PreProcessorIfDefined"); } } // // プリプロセッサ:シンボル定義分岐(=ifndef) // - final public void PreProcessorIfUnDefined() throws ParseException { - trace_call("PreProcessorIfUnDefined"); - try {/*@bgen(jjtree) PreProcessorIfUnDefined */ + final public void PreProcessorIfUnDefined() throws ParseException {/*@bgen(jjtree) PreProcessorIfUnDefined */ ASTPreProcessorIfUnDefined jjtn000 = new ASTPreProcessorIfUnDefined(this, JJTPREPROCESSORIFUNDEFINED); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000);Token symbol; - try { - jj_consume_token(PREPROCESSOR_CODE_IF_NOT); - label_25: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case MULTI_LINE_DELIMITER:{ - ; - break; - } - default: - jj_la1[32] = jj_gen; - break label_25; + try { + jj_consume_token(PREPROCESSOR_CODE_IF_NOT); + label_25: + while (true) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case MULTI_LINE_DELIMITER:{ + ; + break; } - jj_consume_token(MULTI_LINE_DELIMITER); + default: + jj_la1[32] = jj_gen; + break label_25; } - jj_consume_token(LPAREN); - label_26: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case MULTI_LINE_DELIMITER:{ - ; - break; - } - default: - jj_la1[33] = jj_gen; - break label_26; + jj_consume_token(MULTI_LINE_DELIMITER); + } + jj_consume_token(LPAREN); + label_26: + while (true) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case MULTI_LINE_DELIMITER:{ + ; + break; } - jj_consume_token(MULTI_LINE_DELIMITER); + default: + jj_la1[33] = jj_gen; + break label_26; } - symbol = jj_consume_token(IDENTIFIER); - label_27: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case MULTI_LINE_DELIMITER:{ - ; - break; - } - default: - jj_la1[34] = jj_gen; - break label_27; + jj_consume_token(MULTI_LINE_DELIMITER); + } + symbol = jj_consume_token(IDENTIFIER); + label_27: + while (true) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case MULTI_LINE_DELIMITER:{ + ; + break; } - jj_consume_token(MULTI_LINE_DELIMITER); + default: + jj_la1[34] = jj_gen; + break label_27; } - jj_consume_token(RPAREN); - Block(); - jj_consume_token(PREPROCESSOR_CODE_END_IF); + jj_consume_token(MULTI_LINE_DELIMITER); + } + jj_consume_token(RPAREN); + Block(); + jj_consume_token(PREPROCESSOR_CODE_END_IF); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.symbol.setName( symbol.image ); jjtn000.symbol.position.copy( symbol ); jjtn000.symbol.symbolType = SymbolDefinition.SymbolType.PreprocessorSymbol; - } catch (Throwable jjte000) { + } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; @@ -1418,99 +1309,89 @@ final public void PreProcessorIfUnDefined() throws ParseException { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} - } finally { + } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } - } - } finally { - trace_return("PreProcessorIfUnDefined"); } } final public void StatementExpression() throws ParseException { - trace_call("StatementExpression"); - try { - if (jj_2_6(3)) { - Assignment(); - } else { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case VARIABLE_INT: - case VARIABLE_INT_ARRAY: - case VARIABLE_REAL: - case VARIABLE_REAL_ARRAY: - case VARIABLE_STRING: - case VARIABLE_STRING_ARRAY: - case LPAREN: - case IDENTIFIER:{ - PrimaryExpression(); - break; - } - default: - jj_la1[35] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); + if (jj_2_6(3)) { + Assignment(); + } else { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case VARIABLE_INT: + case VARIABLE_INT_ARRAY: + case VARIABLE_REAL: + case VARIABLE_REAL_ARRAY: + case VARIABLE_STRING: + case VARIABLE_STRING_ARRAY: + case LPAREN: + case IDENTIFIER:{ + PrimaryExpression(); + break; } + default: + jj_la1[35] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); } - } finally { - trace_return("StatementExpression"); } } // // if // - final public void IfStatement() throws ParseException { - trace_call("IfStatement"); - try {/*@bgen(jjtree) IfStatement */ + final public void IfStatement() throws ParseException {/*@bgen(jjtree) IfStatement */ ASTIfStatement jjtn000 = new ASTIfStatement(this, JJTIFSTATEMENT); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); - try { - jj_consume_token(IF); - label_28: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case MULTI_LINE_DELIMITER:{ - ; - break; - } - default: - jj_la1[36] = jj_gen; - break label_28; + try { + jj_consume_token(IF); + label_28: + while (true) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case MULTI_LINE_DELIMITER:{ + ; + break; } - jj_consume_token(MULTI_LINE_DELIMITER); + default: + jj_la1[36] = jj_gen; + break label_28; } - jj_consume_token(LPAREN); - Expression(); - jj_consume_token(RPAREN); + jj_consume_token(MULTI_LINE_DELIMITER); + } + jj_consume_token(LPAREN); + Expression(); + jj_consume_token(RPAREN); + Block(); + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case ELSE:{ + jj_consume_token(ELSE); Block(); + break; + } + default: + jj_la1[37] = jj_gen; + ; + } + jj_consume_token(END); + label_29: + while (true) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case ELSE:{ - jj_consume_token(ELSE); - Block(); + case MULTI_LINE_DELIMITER:{ + ; break; } default: - jj_la1[37] = jj_gen; - ; + jj_la1[38] = jj_gen; + break label_29; } - jj_consume_token(END); - label_29: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case MULTI_LINE_DELIMITER:{ - ; - break; - } - default: - jj_la1[38] = jj_gen; - break label_29; - } - jj_consume_token(MULTI_LINE_DELIMITER); - } - jj_consume_token(IF); - } catch (Throwable jjte000) { + jj_consume_token(MULTI_LINE_DELIMITER); + } + jj_consume_token(IF); + } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; @@ -1524,111 +1405,106 @@ final public void IfStatement() throws ParseException { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} - } finally { + } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } - } - } finally { - trace_return("IfStatement"); } } // // select // - final public void SelectStatement() throws ParseException { - trace_call("SelectStatement"); - try {/*@bgen(jjtree) SelectStatement */ + final public void SelectStatement() throws ParseException {/*@bgen(jjtree) SelectStatement */ ASTSelectStatement jjtn000 = new ASTSelectStatement(this, JJTSELECTSTATEMENT); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); - try { - jj_consume_token(SELECT); - label_30: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case MULTI_LINE_DELIMITER:{ - ; - break; - } - default: - jj_la1[39] = jj_gen; - break label_30; - } - jj_consume_token(MULTI_LINE_DELIMITER); - } - jj_consume_token(LPAREN); - Expression(); - label_31: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case MULTI_LINE_DELIMITER:{ - ; - break; - } - default: - jj_la1[40] = jj_gen; - break label_31; + try { + jj_consume_token(SELECT); + label_30: + while (true) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case MULTI_LINE_DELIMITER:{ + ; + break; } - jj_consume_token(MULTI_LINE_DELIMITER); + default: + jj_la1[39] = jj_gen; + break label_30; } - jj_consume_token(RPAREN); - label_32: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case MULTI_LINE_DELIMITER:{ - ; - break; - } - default: - jj_la1[41] = jj_gen; - break label_32; + jj_consume_token(MULTI_LINE_DELIMITER); + } + jj_consume_token(LPAREN); + Expression(); + label_31: + while (true) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case MULTI_LINE_DELIMITER:{ + ; + break; } - jj_consume_token(MULTI_LINE_DELIMITER); + default: + jj_la1[40] = jj_gen; + break label_31; } - label_33: - while (true) { - jj_consume_token(EOL); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case EOL:{ - ; - break; - } - default: - jj_la1[42] = jj_gen; - break label_33; + jj_consume_token(MULTI_LINE_DELIMITER); + } + jj_consume_token(RPAREN); + label_32: + while (true) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case MULTI_LINE_DELIMITER:{ + ; + break; } + default: + jj_la1[41] = jj_gen; + break label_32; } - label_34: - while (true) { - CaseStatement(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case CASE:{ - ; - break; - } - default: - jj_la1[43] = jj_gen; - break label_34; + jj_consume_token(MULTI_LINE_DELIMITER); + } + label_33: + while (true) { + jj_consume_token(EOL); + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case EOL:{ + ; + break; } + default: + jj_la1[42] = jj_gen; + break label_33; } - jj_consume_token(END); - label_35: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case MULTI_LINE_DELIMITER:{ - ; - break; - } - default: - jj_la1[44] = jj_gen; - break label_35; + } + label_34: + while (true) { + CaseStatement(); + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case CASE:{ + ; + break; } - jj_consume_token(MULTI_LINE_DELIMITER); + default: + jj_la1[43] = jj_gen; + break label_34; + } + } + jj_consume_token(END); + label_35: + while (true) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case MULTI_LINE_DELIMITER:{ + ; + break; + } + default: + jj_la1[44] = jj_gen; + break label_35; } - jj_consume_token(SELECT); - } catch (Throwable jjte000) { + jj_consume_token(MULTI_LINE_DELIMITER); + } + jj_consume_token(SELECT); + } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; @@ -1642,71 +1518,66 @@ final public void SelectStatement() throws ParseException { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} - } finally { + } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } - } - } finally { - trace_return("SelectStatement"); } } // // case @select // - final public void CaseStatement() throws ParseException { - trace_call("CaseStatement"); - try {/*@bgen(jjtree) CaseStatement */ + final public void CaseStatement() throws ParseException {/*@bgen(jjtree) CaseStatement */ ASTCaseStatement jjtn000 = new ASTCaseStatement(this, JJTCASESTATEMENT); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); - try { - jj_consume_token(CASE); - label_36: + try { + jj_consume_token(CASE); + label_36: + while (true) { + if (jj_2_7(2)) { + ; + } else { + break label_36; + } + jj_consume_token(MULTI_LINE_DELIMITER); + } + CaseCondition(); + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case TO:{ + jj_consume_token(TO); + label_37: while (true) { - if (jj_2_7(2)) { + if (jj_2_8(2)) { ; } else { - break label_36; + break label_37; } jj_consume_token(MULTI_LINE_DELIMITER); } CaseCondition(); + break; + } + default: + jj_la1[45] = jj_gen; + ; + } + Block(); + label_38: + while (true) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case TO:{ - jj_consume_token(TO); - label_37: - while (true) { - if (jj_2_8(2)) { - ; - } else { - break label_37; - } - jj_consume_token(MULTI_LINE_DELIMITER); - } - CaseCondition(); + case MULTI_LINE_DELIMITER:{ + ; break; } default: - jj_la1[45] = jj_gen; - ; - } - Block(); - label_38: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case MULTI_LINE_DELIMITER:{ - ; - break; - } - default: - jj_la1[46] = jj_gen; - break label_38; - } - jj_consume_token(MULTI_LINE_DELIMITER); + jj_la1[46] = jj_gen; + break label_38; } - } catch (Throwable jjte000) { + jj_consume_token(MULTI_LINE_DELIMITER); + } + } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; @@ -1720,25 +1591,20 @@ final public void CaseStatement() throws ParseException { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} - } finally { + } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } - } - } finally { - trace_return("CaseStatement"); } } - final public void CaseCondition() throws ParseException { - trace_call("CaseCondition"); - try {/*@bgen(jjtree) CaseCondition */ + final public void CaseCondition() throws ParseException {/*@bgen(jjtree) CaseCondition */ ASTCaseCondition jjtn000 = new ASTCaseCondition(this, JJTCASECONDITION); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); - try { - Expression(); - } catch (Throwable jjte000) { + try { + Expression(); + } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; @@ -1752,60 +1618,55 @@ final public void CaseCondition() throws ParseException { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} - } finally { + } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } - } - } finally { - trace_return("CaseCondition"); } } // // while // - final public void WhileStatement() throws ParseException { - trace_call("WhileStatement"); - try {/*@bgen(jjtree) WhileStatement */ + final public void WhileStatement() throws ParseException {/*@bgen(jjtree) WhileStatement */ ASTWhileStatement jjtn000 = new ASTWhileStatement(this, JJTWHILESTATEMENT); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); - try { - jj_consume_token(WHILE); - label_39: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case MULTI_LINE_DELIMITER:{ - ; - break; - } - default: - jj_la1[47] = jj_gen; - break label_39; + try { + jj_consume_token(WHILE); + label_39: + while (true) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case MULTI_LINE_DELIMITER:{ + ; + break; } - jj_consume_token(MULTI_LINE_DELIMITER); + default: + jj_la1[47] = jj_gen; + break label_39; } - jj_consume_token(LPAREN); - Expression(); - jj_consume_token(RPAREN); - Block(); - jj_consume_token(END); - label_40: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case MULTI_LINE_DELIMITER:{ - ; - break; - } - default: - jj_la1[48] = jj_gen; - break label_40; + jj_consume_token(MULTI_LINE_DELIMITER); + } + jj_consume_token(LPAREN); + Expression(); + jj_consume_token(RPAREN); + Block(); + jj_consume_token(END); + label_40: + while (true) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case MULTI_LINE_DELIMITER:{ + ; + break; } - jj_consume_token(MULTI_LINE_DELIMITER); + default: + jj_la1[48] = jj_gen; + break label_40; } - jj_consume_token(WHILE); - } catch (Throwable jjte000) { + jj_consume_token(MULTI_LINE_DELIMITER); + } + jj_consume_token(WHILE); + } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; @@ -1819,53 +1680,45 @@ final public void WhileStatement() throws ParseException { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} - } finally { + } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } - } - } finally { - trace_return("WhileStatement"); } } // // ユーザー定義関数呼び出し // - final public void CallUserFunctionStatement() throws ParseException { - trace_call("CallUserFunctionStatement"); - try {/*@bgen(jjtree) CallUserFunctionStatement */ + final public void CallUserFunctionStatement() throws ParseException {/*@bgen(jjtree) CallUserFunctionStatement */ ASTCallUserFunctionStatement jjtn000 = new ASTCallUserFunctionStatement(this, JJTCALLUSERFUNCTIONSTATEMENT); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000);Token symbol; - try { - jj_consume_token(CALL); - label_41: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case MULTI_LINE_DELIMITER:{ - ; - break; - } - default: - jj_la1[49] = jj_gen; - break label_41; + try { + jj_consume_token(CALL); + label_41: + while (true) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case MULTI_LINE_DELIMITER:{ + ; + break; } - jj_consume_token(MULTI_LINE_DELIMITER); + default: + jj_la1[49] = jj_gen; + break label_41; } - symbol = jj_consume_token(IDENTIFIER); + jj_consume_token(MULTI_LINE_DELIMITER); + } + symbol = jj_consume_token(IDENTIFIER); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.symbol.setName( symbol.image ); jjtn000.symbol.position.copy( symbol ); jjtn000.symbol.symbolType = SymbolDefinition.SymbolType.UserFunction; - } finally { + } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } - } - } finally { - trace_return("CallUserFunctionStatement"); } } @@ -1873,31 +1726,24 @@ final public void CallUserFunctionStatement() throws ParseException { // 式 //------------------------------------------------------------------------------ final public void Expression() throws ParseException { - trace_call("Expression"); - try { - ConditionalOrExpression(); - } finally { - trace_return("Expression"); - } + ConditionalOrExpression(); } // // 代入式 // - final public void Assignment() throws ParseException { - trace_call("Assignment"); - try {/*@bgen(jjtree) Assignment */ + final public void Assignment() throws ParseException {/*@bgen(jjtree) Assignment */ ASTAssignment jjtn000 = new ASTAssignment(this, JJTASSIGNMENT); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000);Token token; - try { - RefVariable(); - token = jj_consume_token(ASSIGN); - Expression(); + try { + RefVariable(); + token = jj_consume_token(ASSIGN); + Expression(); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; applyToSymbol( token, jjtn000, TYPE_VOID, SymbolType.Expression ); - } catch (Throwable jjte000) { + } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; @@ -1911,701 +1757,648 @@ final public void Assignment() throws ParseException { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} - } finally { + } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } - } - } finally { - trace_return("Assignment"); } } // // 条件式OR // - final public void ConditionalOrExpression() throws ParseException { - trace_call("ConditionalOrExpression"); - try {Token token; - label_42: - while (true) { - if (jj_2_9(2)) { - ; - } else { - break label_42; + final public void ConditionalOrExpression() throws ParseException {Token token; + label_42: + while (true) { + if (jj_2_9(2)) { + ; + } else { + break label_42; + } + jj_consume_token(MULTI_LINE_DELIMITER); + } + ConditionalAndExpression(); + label_43: + while (true) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case BOOL_OR:{ + ; + break; } - jj_consume_token(MULTI_LINE_DELIMITER); + default: + jj_la1[50] = jj_gen; + break label_43; } + token = jj_consume_token(BOOL_OR); ConditionalAndExpression(); - label_43: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case BOOL_OR:{ - ; - break; - } - default: - jj_la1[50] = jj_gen; - break label_43; - } - token = jj_consume_token(BOOL_OR); - ConditionalAndExpression(); ASTConditionalOr jjtn001 = new ASTConditionalOr(this, JJTCONDITIONALOR); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); - try { + try { jjtree.closeNodeScope(jjtn001, 2); jjtc001 = false; jjtn001.symbol.position.copy( token ); jjtn001.symbol.type = TYPE_BOOL; - } finally { + } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, 2); } - } } - } finally { - trace_return("ConditionalOrExpression"); } } // // 条件式AND // - final public void ConditionalAndExpression() throws ParseException { - trace_call("ConditionalAndExpression"); - try {Token token; - label_44: - while (true) { - if (jj_2_10(2)) { - ; - } else { - break label_44; + final public void ConditionalAndExpression() throws ParseException {Token token; + label_44: + while (true) { + if (jj_2_10(2)) { + ; + } else { + break label_44; + } + jj_consume_token(MULTI_LINE_DELIMITER); + } + InclusiveOrExpression(); + label_45: + while (true) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case BOOL_AND:{ + ; + break; } - jj_consume_token(MULTI_LINE_DELIMITER); + default: + jj_la1[51] = jj_gen; + break label_45; } + token = jj_consume_token(BOOL_AND); InclusiveOrExpression(); - label_45: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case BOOL_AND:{ - ; - break; - } - default: - jj_la1[51] = jj_gen; - break label_45; - } - token = jj_consume_token(BOOL_AND); - InclusiveOrExpression(); ASTConditionalAnd jjtn001 = new ASTConditionalAnd(this, JJTCONDITIONALAND); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); - try { + try { jjtree.closeNodeScope(jjtn001, 2); jjtc001 = false; applyToSymbol( token, jjtn001, TYPE_BOOL, SymbolType.Expression ); - } finally { + } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, 2); } - } } - } finally { - trace_return("ConditionalAndExpression"); } } // // 論理積 // - final public void InclusiveOrExpression() throws ParseException { - trace_call("InclusiveOrExpression"); - try {Token token; - label_46: - while (true) { - if (jj_2_11(2)) { - ; - } else { - break label_46; + final public void InclusiveOrExpression() throws ParseException {Token token; + label_46: + while (true) { + if (jj_2_11(2)) { + ; + } else { + break label_46; + } + jj_consume_token(MULTI_LINE_DELIMITER); + } + AndExpression(); + label_47: + while (true) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case BIT_OR:{ + ; + break; } - jj_consume_token(MULTI_LINE_DELIMITER); + default: + jj_la1[52] = jj_gen; + break label_47; } + token = jj_consume_token(BIT_OR); AndExpression(); - label_47: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case BIT_OR:{ - ; - break; - } - default: - jj_la1[52] = jj_gen; - break label_47; - } - token = jj_consume_token(BIT_OR); - AndExpression(); ASTInclusiveOr jjtn001 = new ASTInclusiveOr(this, JJTINCLUSIVEOR); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); - try { + try { jjtree.closeNodeScope(jjtn001, 2); jjtc001 = false; applyToSymbol( token, jjtn001, TYPE_INT, SymbolType.Expression ); - } finally { + } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, 2); } - } } - } finally { - trace_return("InclusiveOrExpression"); } } // // 論理和 // - final public void AndExpression() throws ParseException { - trace_call("AndExpression"); - try {Token token; - label_48: - while (true) { - if (jj_2_12(2)) { - ; - } else { - break label_48; + final public void AndExpression() throws ParseException {Token token; + label_48: + while (true) { + if (jj_2_12(2)) { + ; + } else { + break label_48; + } + jj_consume_token(MULTI_LINE_DELIMITER); + } + EqualityExpression(); + label_49: + while (true) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case BIT_AND:{ + ; + break; } - jj_consume_token(MULTI_LINE_DELIMITER); + default: + jj_la1[53] = jj_gen; + break label_49; } + token = jj_consume_token(BIT_AND); EqualityExpression(); - label_49: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case BIT_AND:{ - ; - break; - } - default: - jj_la1[53] = jj_gen; - break label_49; - } - token = jj_consume_token(BIT_AND); - EqualityExpression(); ASTAnd jjtn001 = new ASTAnd(this, JJTAND); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); - try { + try { jjtree.closeNodeScope(jjtn001, 2); jjtc001 = false; applyToSymbol( token, jjtn001, TYPE_INT, SymbolType.Expression ); - } finally { + } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, 2); } - } } - } finally { - trace_return("AndExpression"); } } // // 比較 // - final public void EqualityExpression() throws ParseException { - trace_call("EqualityExpression"); - try {Token token; - label_50: - while (true) { - if (jj_2_13(2)) { - ; - } else { - break label_50; - } - jj_consume_token(MULTI_LINE_DELIMITER); + final public void EqualityExpression() throws ParseException {Token token; + label_50: + while (true) { + if (jj_2_13(2)) { + ; + } else { + break label_50; } - RelationalExpression(); - label_51: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case BOOL_EQ: - case BOOL_NE:{ - ; - break; - } - default: - jj_la1[54] = jj_gen; - break label_51; + jj_consume_token(MULTI_LINE_DELIMITER); + } + RelationalExpression(); + label_51: + while (true) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case BOOL_EQ: + case BOOL_NE:{ + ; + break; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case BOOL_EQ:{ - token = jj_consume_token(BOOL_EQ); - RelationalExpression(); + default: + jj_la1[54] = jj_gen; + break label_51; + } + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case BOOL_EQ:{ + token = jj_consume_token(BOOL_EQ); + RelationalExpression(); ASTEqual jjtn001 = new ASTEqual(this, JJTEQUAL); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); - try { + try { jjtree.closeNodeScope(jjtn001, 2); jjtc001 = false; applyToSymbol( token, jjtn001, TYPE_BOOL, SymbolType.Expression ); - } finally { + } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, 2); } - } - break; - } - case BOOL_NE:{ - token = jj_consume_token(BOOL_NE); - RelationalExpression(); + } + break; + } + case BOOL_NE:{ + token = jj_consume_token(BOOL_NE); + RelationalExpression(); ASTNotEqual jjtn002 = new ASTNotEqual(this, JJTNOTEQUAL); boolean jjtc002 = true; jjtree.openNodeScope(jjtn002); - try { + try { jjtree.closeNodeScope(jjtn002, 2); jjtc002 = false; applyToSymbol( token, jjtn002, TYPE_BOOL, SymbolType.Expression ); - } finally { + } finally { if (jjtc002) { jjtree.closeNodeScope(jjtn002, 2); } - } - break; - } - default: - jj_la1[55] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); } + break; + } + default: + jj_la1[55] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); } - } finally { - trace_return("EqualityExpression"); } } // // 比較(不等号) // - final public void RelationalExpression() throws ParseException { - trace_call("RelationalExpression"); - try {Token token; - label_52: - while (true) { - if (jj_2_14(2)) { - ; - } else { - break label_52; - } - jj_consume_token(MULTI_LINE_DELIMITER); + final public void RelationalExpression() throws ParseException {Token token; + label_52: + while (true) { + if (jj_2_14(2)) { + ; + } else { + break label_52; } - AdditiveExpression(); - label_53: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case BOOL_GT: - case BOOL_LT: - case BOOL_GE: - case BOOL_LE:{ - ; - break; - } - default: - jj_la1[56] = jj_gen; - break label_53; + jj_consume_token(MULTI_LINE_DELIMITER); + } + AdditiveExpression(); + label_53: + while (true) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case BOOL_GT: + case BOOL_LT: + case BOOL_GE: + case BOOL_LE:{ + ; + break; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case BOOL_LT:{ - token = jj_consume_token(BOOL_LT); - AdditiveExpression(); + default: + jj_la1[56] = jj_gen; + break label_53; + } + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case BOOL_LT:{ + token = jj_consume_token(BOOL_LT); + AdditiveExpression(); ASTLT jjtn001 = new ASTLT(this, JJTLT); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); - try { + try { jjtree.closeNodeScope(jjtn001, 2); jjtc001 = false; applyToSymbol( token, jjtn001, TYPE_BOOL, SymbolType.Expression ); - } finally { + } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, 2); } - } - break; - } - case BOOL_GT:{ - token = jj_consume_token(BOOL_GT); - AdditiveExpression(); + } + break; + } + case BOOL_GT:{ + token = jj_consume_token(BOOL_GT); + AdditiveExpression(); ASTGT jjtn002 = new ASTGT(this, JJTGT); boolean jjtc002 = true; jjtree.openNodeScope(jjtn002); - try { + try { jjtree.closeNodeScope(jjtn002, 2); jjtc002 = false; applyToSymbol( token, jjtn002, TYPE_BOOL, SymbolType.Expression ); - } finally { + } finally { if (jjtc002) { jjtree.closeNodeScope(jjtn002, 2); } - } - break; - } - case BOOL_LE:{ - token = jj_consume_token(BOOL_LE); - AdditiveExpression(); + } + break; + } + case BOOL_LE:{ + token = jj_consume_token(BOOL_LE); + AdditiveExpression(); ASTLE jjtn003 = new ASTLE(this, JJTLE); boolean jjtc003 = true; jjtree.openNodeScope(jjtn003); - try { + try { jjtree.closeNodeScope(jjtn003, 2); jjtc003 = false; applyToSymbol( token, jjtn003, TYPE_BOOL, SymbolType.Expression ); - } finally { + } finally { if (jjtc003) { jjtree.closeNodeScope(jjtn003, 2); } - } - break; - } - case BOOL_GE:{ - token = jj_consume_token(BOOL_GE); - AdditiveExpression(); + } + break; + } + case BOOL_GE:{ + token = jj_consume_token(BOOL_GE); + AdditiveExpression(); ASTGE jjtn004 = new ASTGE(this, JJTGE); boolean jjtc004 = true; jjtree.openNodeScope(jjtn004); - try { + try { jjtree.closeNodeScope(jjtn004, 2); jjtc004 = false; applyToSymbol( token, jjtn004, TYPE_BOOL, SymbolType.Expression ); - } finally { + } finally { if (jjtc004) { jjtree.closeNodeScope(jjtn004, 2); } - } - break; - } - default: - jj_la1[57] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); } + break; + } + default: + jj_la1[57] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); } - } finally { - trace_return("RelationalExpression"); } } // // 加算 // - final public void AdditiveExpression() throws ParseException { - trace_call("AdditiveExpression"); - try {Token token; - label_54: - while (true) { - if (jj_2_15(2)) { - ; - } else { - break label_54; - } - jj_consume_token(MULTI_LINE_DELIMITER); + final public void AdditiveExpression() throws ParseException {Token token; + label_54: + while (true) { + if (jj_2_15(2)) { + ; + } else { + break label_54; } - MultiplicativeExpression(); - label_55: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case PLUS: - case MINUS: - case STRING_ADD:{ - ; - break; - } - default: - jj_la1[58] = jj_gen; - break label_55; + jj_consume_token(MULTI_LINE_DELIMITER); + } + MultiplicativeExpression(); + label_55: + while (true) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case PLUS: + case MINUS: + case STRING_ADD:{ + ; + break; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case PLUS:{ - token = jj_consume_token(PLUS); - MultiplicativeExpression(); + default: + jj_la1[58] = jj_gen; + break label_55; + } + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case PLUS:{ + token = jj_consume_token(PLUS); + MultiplicativeExpression(); ASTAdd jjtn001 = new ASTAdd(this, JJTADD); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); - try { + try { jjtree.closeNodeScope(jjtn001, 2); jjtc001 = false; applyToSymbol( token, jjtn001, TYPE_INT, SymbolType.Expression ); - } finally { + } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, 2); } - } - break; - } - case MINUS:{ - token = jj_consume_token(MINUS); - MultiplicativeExpression(); + } + break; + } + case MINUS:{ + token = jj_consume_token(MINUS); + MultiplicativeExpression(); ASTSub jjtn002 = new ASTSub(this, JJTSUB); boolean jjtc002 = true; jjtree.openNodeScope(jjtn002); - try { + try { jjtree.closeNodeScope(jjtn002, 2); jjtc002 = false; applyToSymbol( token, jjtn002, TYPE_INT, SymbolType.Expression ); - } finally { + } finally { if (jjtc002) { jjtree.closeNodeScope(jjtn002, 2); } - } - break; - } - case STRING_ADD:{ - token = jj_consume_token(STRING_ADD); - MultiplicativeExpression(); + } + break; + } + case STRING_ADD:{ + token = jj_consume_token(STRING_ADD); + MultiplicativeExpression(); ASTStrAdd jjtn003 = new ASTStrAdd(this, JJTSTRADD); boolean jjtc003 = true; jjtree.openNodeScope(jjtn003); - try { + try { jjtree.closeNodeScope(jjtn003, 2); jjtc003 = false; applyToSymbol( token, jjtn003, TYPE_STRING, SymbolType.Expression ); - } finally { + } finally { if (jjtc003) { jjtree.closeNodeScope(jjtn003, 2); } - } - break; - } - default: - jj_la1[59] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); } + break; + } + default: + jj_la1[59] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); } - } finally { - trace_return("AdditiveExpression"); } } // // 乗算 // - final public void MultiplicativeExpression() throws ParseException { - trace_call("MultiplicativeExpression"); - try {Token token; - label_56: - while (true) { - if (jj_2_16(2)) { - ; - } else { - break label_56; - } - jj_consume_token(MULTI_LINE_DELIMITER); + final public void MultiplicativeExpression() throws ParseException {Token token; + label_56: + while (true) { + if (jj_2_16(2)) { + ; + } else { + break label_56; } - UnaryExpression(); - label_57: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case MUL: - case DIV: - case MOD:{ - ; - break; - } - default: - jj_la1[60] = jj_gen; - break label_57; + jj_consume_token(MULTI_LINE_DELIMITER); + } + UnaryExpression(); + label_57: + while (true) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case MUL: + case DIV: + case MOD:{ + ; + break; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case MUL:{ - token = jj_consume_token(MUL); - UnaryExpression(); + default: + jj_la1[60] = jj_gen; + break label_57; + } + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case MUL:{ + token = jj_consume_token(MUL); + UnaryExpression(); ASTMul jjtn001 = new ASTMul(this, JJTMUL); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); - try { + try { jjtree.closeNodeScope(jjtn001, 2); jjtc001 = false; applyToSymbol( token, jjtn001, TYPE_INT, SymbolType.Expression ); - } finally { + } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, 2); } - } - break; - } - case DIV:{ - token = jj_consume_token(DIV); - UnaryExpression(); + } + break; + } + case DIV:{ + token = jj_consume_token(DIV); + UnaryExpression(); ASTDiv jjtn002 = new ASTDiv(this, JJTDIV); boolean jjtc002 = true; jjtree.openNodeScope(jjtn002); - try { + try { jjtree.closeNodeScope(jjtn002, 2); jjtc002 = false; applyToSymbol( token, jjtn002, TYPE_INT, SymbolType.Expression ); - } finally { + } finally { if (jjtc002) { jjtree.closeNodeScope(jjtn002, 2); } - } - break; - } - case MOD:{ - token = jj_consume_token(MOD); - UnaryExpression(); + } + break; + } + case MOD:{ + token = jj_consume_token(MOD); + UnaryExpression(); ASTMod jjtn003 = new ASTMod(this, JJTMOD); boolean jjtc003 = true; jjtree.openNodeScope(jjtn003); - try { + try { jjtree.closeNodeScope(jjtn003, 2); jjtc003 = false; applyToSymbol( token, jjtn003, TYPE_INT, SymbolType.Expression ); - } finally { + } finally { if (jjtc003) { jjtree.closeNodeScope(jjtn003, 2); } - } - break; - } - default: - jj_la1[61] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); } + break; + } + default: + jj_la1[61] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); } - } finally { - trace_return("MultiplicativeExpression"); } } // // 単項 // - final public void UnaryExpression() throws ParseException { - trace_call("UnaryExpression"); - try {Token token; + final public void UnaryExpression() throws ParseException {Token token; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case MULTI_LINE_DELIMITER: + case MINUS:{ + label_58: + while (true) { + if (jj_2_17(2)) { + ; + } else { + break label_58; + } + jj_consume_token(MULTI_LINE_DELIMITER); + } switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case MULTI_LINE_DELIMITER: - case MINUS:{ - label_58: - while (true) { - if (jj_2_17(2)) { - ; - } else { - break label_58; - } - jj_consume_token(MULTI_LINE_DELIMITER); + case MULTI_LINE_DELIMITER:{ + jj_consume_token(MULTI_LINE_DELIMITER); + UnaryExpression(); + break; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case MULTI_LINE_DELIMITER:{ - jj_consume_token(MULTI_LINE_DELIMITER); - UnaryExpression(); - break; - } - case MINUS:{ - token = jj_consume_token(MINUS); - UnaryExpression(); + case MINUS:{ + token = jj_consume_token(MINUS); + UnaryExpression(); ASTNeg jjtn001 = new ASTNeg(this, JJTNEG); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); - try { + try { jjtree.closeNodeScope(jjtn001, 1); jjtc001 = false; applyToSymbol( token, jjtn001, TYPE_INT | TYPE_REAL, SymbolType.Expression ); - } finally { + } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, 1); } - } - break; - } - default: - jj_la1[62] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - break; - } - case BOOL_NOT: - case BIT_NOT:{ - UnaryExpressionNot(); - break; - } - case VARIABLE_INT: - case VARIABLE_INT_ARRAY: - case VARIABLE_REAL: - case VARIABLE_REAL_ARRAY: - case VARIABLE_STRING: - case VARIABLE_STRING_ARRAY: - case LPAREN: - case IDENTIFIER:{ - PrimaryExpression(); - break; } - case INTEGER_LITERAL: - case REAL_LITERAL: - case STRING_LITERAL:{ - Literal(); break; } default: - jj_la1[63] = jj_gen; + jj_la1[62] = jj_gen; jj_consume_token(-1); throw new ParseException(); } - } finally { - trace_return("UnaryExpression"); + break; + } + case BOOL_NOT: + case BIT_NOT:{ + UnaryExpressionNot(); + break; + } + case VARIABLE_INT: + case VARIABLE_INT_ARRAY: + case VARIABLE_REAL: + case VARIABLE_REAL_ARRAY: + case VARIABLE_STRING: + case VARIABLE_STRING_ARRAY: + case LPAREN: + case IDENTIFIER:{ + PrimaryExpression(); + break; + } + case INTEGER_LITERAL: + case REAL_LITERAL: + case STRING_LITERAL:{ + Literal(); + break; + } + default: + jj_la1[63] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); } } // // 単項NOT // - final public void UnaryExpressionNot() throws ParseException { - trace_call("UnaryExpressionNot"); - try {Token token; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case BIT_NOT:{ - token = jj_consume_token(BIT_NOT); - UnaryExpression(); + final public void UnaryExpressionNot() throws ParseException {Token token; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case BIT_NOT:{ + token = jj_consume_token(BIT_NOT); + UnaryExpression(); ASTNot jjtn001 = new ASTNot(this, JJTNOT); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); - try { + try { jjtree.closeNodeScope(jjtn001, 1); jjtc001 = false; applyToSymbol( token, jjtn001, TYPE_INT, SymbolType.Expression ); - } finally { + } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, 1); } - } - break; - } - case BOOL_NOT:{ - token = jj_consume_token(BOOL_NOT); - UnaryExpression(); + } + break; + } + case BOOL_NOT:{ + token = jj_consume_token(BOOL_NOT); + UnaryExpression(); ASTLogicalNot jjtn002 = new ASTLogicalNot(this, JJTLOGICALNOT); boolean jjtc002 = true; jjtree.openNodeScope(jjtn002); - try { + try { jjtree.closeNodeScope(jjtn002, 1); jjtc002 = false; applyToSymbol( token, jjtn002, TYPE_INT, SymbolType.Expression ); - } finally { + } finally { if (jjtc002) { jjtree.closeNodeScope(jjtn002, 1); } - } - break; - } - default: - jj_la1[64] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); } - } finally { - trace_return("UnaryExpressionNot"); + break; + } + default: + jj_la1[64] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); } } @@ -2613,54 +2406,49 @@ final public void UnaryExpressionNot() throws ParseException { // その他演算子・式・コマンドコール・リテラル // final public void PrimaryExpression() throws ParseException { - trace_call("PrimaryExpression"); - try { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case VARIABLE_INT: - case VARIABLE_INT_ARRAY: - case VARIABLE_REAL: - case VARIABLE_REAL_ARRAY: - case VARIABLE_STRING: - case VARIABLE_STRING_ARRAY: - case IDENTIFIER:{ - PrimaryPrefix(); - break; - } - case LPAREN:{ - try { - jj_consume_token(LPAREN); - label_59: - while (true) { - if (jj_2_18(2)) { - ; - } else { - break label_59; - } - jj_consume_token(MULTI_LINE_DELIMITER); - } - Expression(); - label_60: - while (true) { - if (jj_2_19(2)) { - ; - } else { - break label_60; - } - jj_consume_token(MULTI_LINE_DELIMITER); + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case VARIABLE_INT: + case VARIABLE_INT_ARRAY: + case VARIABLE_REAL: + case VARIABLE_REAL_ARRAY: + case VARIABLE_STRING: + case VARIABLE_STRING_ARRAY: + case IDENTIFIER:{ + PrimaryPrefix(); + break; + } + case LPAREN:{ + try { + jj_consume_token(LPAREN); + label_59: + while (true) { + if (jj_2_18(2)) { + ; + } else { + break label_59; } - jj_consume_token(RPAREN); - } catch (ParseException e) { -errorSkipTo( e ); + jj_consume_token(MULTI_LINE_DELIMITER); } - break; + Expression(); + label_60: + while (true) { + if (jj_2_19(2)) { + ; + } else { + break label_60; + } + jj_consume_token(MULTI_LINE_DELIMITER); } - default: - jj_la1[65] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); + jj_consume_token(RPAREN); + } catch (ParseException e) { +errorSkipTo( e ); } - } finally { - trace_return("PrimaryExpression"); + break; + } + default: + jj_la1[65] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); } } @@ -2668,115 +2456,103 @@ final public void PrimaryExpression() throws ParseException { // コマンド / 変数参照 // final public void PrimaryPrefix() throws ParseException { - trace_call("PrimaryPrefix"); - try { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case VARIABLE_INT: - case VARIABLE_INT_ARRAY: - case VARIABLE_REAL: - case VARIABLE_REAL_ARRAY: - case VARIABLE_STRING: - case VARIABLE_STRING_ARRAY:{ - RefVariable(); - break; - } - case IDENTIFIER:{ - CallCommand(); - label_61: - while (true) { - if (jj_2_20(2)) { - ; - } else { - break label_61; - } - jj_consume_token(MULTI_LINE_DELIMITER); - } - break; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case VARIABLE_INT: + case VARIABLE_INT_ARRAY: + case VARIABLE_REAL: + case VARIABLE_REAL_ARRAY: + case VARIABLE_STRING: + case VARIABLE_STRING_ARRAY:{ + RefVariable(); + break; + } + case IDENTIFIER:{ + CallCommand(); + label_61: + while (true) { + if (jj_2_20(2)) { + ; + } else { + break label_61; } - default: - jj_la1[66] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); + jj_consume_token(MULTI_LINE_DELIMITER); } - } finally { - trace_return("PrimaryPrefix"); + break; + } + default: + jj_la1[66] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); } } // // リテラル // - final public void Literal() throws ParseException { - trace_call("Literal"); - try {/*@bgen(jjtree) Literal */ + final public void Literal() throws ParseException {/*@bgen(jjtree) Literal */ ASTLiteral jjtn000 = new ASTLiteral(this, JJTLITERAL); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000);Token token; - try { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case INTEGER_LITERAL:{ - token = jj_consume_token(INTEGER_LITERAL); + try { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case INTEGER_LITERAL:{ + token = jj_consume_token(INTEGER_LITERAL); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; applyIntLiteral( token, jjtn000 ); - break; - } - case REAL_LITERAL:{ - token = jj_consume_token(REAL_LITERAL); + break; + } + case REAL_LITERAL:{ + token = jj_consume_token(REAL_LITERAL); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; applyRealLiteral( token, jjtn000 ); - break; - } - case STRING_LITERAL:{ - token = jj_consume_token(STRING_LITERAL); + break; + } + case STRING_LITERAL:{ + token = jj_consume_token(STRING_LITERAL); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; applyStringLiteral( token, jjtn000 ); - break; - } - default: - jj_la1[67] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); + break; } - } finally { + default: + jj_la1[67] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } - } - } finally { - trace_return("Literal"); } } // // 変数参照 // - final public void RefVariable() throws ParseException { - trace_call("RefVariable"); - try {/*@bgen(jjtree) RefVariable */ + final public void RefVariable() throws ParseException {/*@bgen(jjtree) RefVariable */ ASTRefVariable jjtn000 = new ASTRefVariable(this, JJTREFVARIABLE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000);Token symbol; - try { - symbol = Variable(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LBRACKET:{ - ArrayIndex(); - break; - } - default: - jj_la1[68] = jj_gen; - ; + try { + symbol = Variable(); + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case LBRACKET:{ + ArrayIndex(); + break; } + default: + jj_la1[68] = jj_gen; + ; + } jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.symbol.setName( symbol.image ); jjtn000.symbol.type = Variable.getKSPTypeFromVariableName( symbol.image ); jjtn000.symbol.position.copy( symbol ); jjtn000.symbol.symbolType = SymbolDefinition.SymbolType.Variable; - } catch (Throwable jjte000) { + } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; @@ -2790,30 +2566,25 @@ final public void RefVariable() throws ParseException { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} - } finally { + } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } - } - } finally { - trace_return("RefVariable"); } } // // 配列の添字 // - final public void ArrayIndex() throws ParseException { - trace_call("ArrayIndex"); - try {/*@bgen(jjtree) ArrayIndex */ + final public void ArrayIndex() throws ParseException {/*@bgen(jjtree) ArrayIndex */ ASTArrayIndex jjtn000 = new ASTArrayIndex(this, JJTARRAYINDEX); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); - try { - jj_consume_token(LBRACKET); - Expression(); - jj_consume_token(RBRACKET); - } catch (Throwable jjte000) { + try { + jj_consume_token(LBRACKET); + Expression(); + jj_consume_token(RBRACKET); + } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; @@ -2827,36 +2598,31 @@ final public void ArrayIndex() throws ParseException { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} - } finally { + } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } - } - } finally { - trace_return("ArrayIndex"); } } // // コマンド呼び出し // - final public void CallCommand() throws ParseException { - trace_call("CallCommand"); - try {/*@bgen(jjtree) CallCommand */ + final public void CallCommand() throws ParseException {/*@bgen(jjtree) CallCommand */ ASTCallCommand jjtn000 = new ASTCallCommand(this, JJTCALLCOMMAND); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000);Token symbol; - try { - symbol = jj_consume_token(IDENTIFIER); + try { + symbol = jj_consume_token(IDENTIFIER); jjtn000.symbol.setName( symbol.image ); jjtn000.symbol.position.copy( symbol ); jjtn000.symbol.symbolType = SymbolDefinition.SymbolType.Command; - if (jj_2_21(2)) { - CommandArguments(jjtn000); - } else { - ; - } - } catch (Throwable jjte000) { + if (jj_2_21(2)) { + CommandArguments(jjtn000); + } else { + ; + } + } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; @@ -2870,13 +2636,10 @@ final public void CallCommand() throws ParseException { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} - } finally { + } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } - } - } finally { - trace_return("CallCommand"); } } @@ -2884,76 +2647,69 @@ final public void CallCommand() throws ParseException { // コマンド呼び出し時の引数 // final public void CommandArguments(ASTCallCommand cmd) throws ParseException { - trace_call("CommandArguments"); - try { - jj_consume_token(LPAREN); - if (jj_2_22(2)) { - CommandArgumentList(cmd); - } else { + jj_consume_token(LPAREN); + if (jj_2_22(2)) { + CommandArgumentList(cmd); + } else { + ; + } + label_62: + while (true) { + if (jj_2_23(2)) { ; + } else { + break label_62; } - label_62: - while (true) { - if (jj_2_23(2)) { - ; - } else { - break label_62; - } - jj_consume_token(MULTI_LINE_DELIMITER); - } - jj_consume_token(RPAREN); - } finally { - trace_return("CommandArguments"); + jj_consume_token(MULTI_LINE_DELIMITER); } + jj_consume_token(RPAREN); } // // コマンド引数リスト // - final public void CommandArgumentList(ASTCallCommand cmd) throws ParseException { - trace_call("CommandArgumentList"); - try {/*@bgen(jjtree) CommandArgumentList */ - ASTCommandArgumentList jjtn000 = new ASTCommandArgumentList(this, JJTCOMMANDARGUMENTLIST); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - try { - label_63: - while (true) { - if (jj_2_24(2)) { - ; - } else { - break label_63; - } - jj_consume_token(MULTI_LINE_DELIMITER); + final public void CommandArgumentList(ASTCallCommand cmd) throws ParseException {/*@bgen(jjtree) CommandArgumentList */ + ASTCommandArgumentList jjtn000 = new ASTCommandArgumentList(this, JJTCOMMANDARGUMENTLIST); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + label_63: + while (true) { + if (jj_2_24(2)) { + ; + } else { + break label_63; } - Expression(); - label_64: + jj_consume_token(MULTI_LINE_DELIMITER); + } + Expression(); + label_64: + while (true) { + if (jj_2_25(2)) { + ; + } else { + break label_64; + } + label_65: while (true) { - if (jj_2_25(2)) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case MULTI_LINE_DELIMITER:{ ; - } else { - break label_64; - } - label_65: - while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case MULTI_LINE_DELIMITER:{ - ; - break; - } - default: - jj_la1[69] = jj_gen; - break label_65; + break; } - jj_consume_token(MULTI_LINE_DELIMITER); + default: + jj_la1[69] = jj_gen; + break label_65; } - jj_consume_token(COMMA); - Expression(); + jj_consume_token(MULTI_LINE_DELIMITER); } + jj_consume_token(COMMA); + Expression(); + } jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; SymbolDefinition.copy( cmd.symbol, jjtn000.symbol ); - } catch (Throwable jjte000) { + } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; @@ -2967,13 +2723,10 @@ final public void CommandArgumentList(ASTCallCommand cmd) throws ParseException {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} - } finally { + } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } - } - } finally { - trace_return("CommandArgumentList"); } } @@ -3177,20 +2930,7 @@ private boolean jj_2_25(int xla) finally { jj_save(24, xla); } } - private boolean jj_3R_107() - { - if (jj_scan_token(BOOL_AND)) return true; - return false; - } - - private boolean jj_3R_156() - { - if (jj_scan_token(BIT_NOT)) return true; - if (jj_3R_139()) return true; - return false; - } - - private boolean jj_3R_154() + private boolean jj_3R_151() { Token xsp; xsp = jj_scanpos; @@ -3207,22 +2947,22 @@ private boolean jj_3_10() return false; } - private boolean jj_3R_86() + private boolean jj_3R_80() { Token xsp; while (true) { xsp = jj_scanpos; if (jj_3_10()) { jj_scanpos = xsp; break; } } - if (jj_3R_97()) return true; + if (jj_3R_88()) return true; while (true) { xsp = jj_scanpos; - if (jj_3R_107()) { jj_scanpos = xsp; break; } + if (jj_3R_108()) { jj_scanpos = xsp; break; } } return false; } - private boolean jj_3R_118() + private boolean jj_3R_119() { if (jj_scan_token(PREPROCESSOR_CODE_IF)) return true; Token xsp; @@ -3234,34 +2974,34 @@ private boolean jj_3R_118() return false; } - private boolean jj_3R_148() + private boolean jj_3R_143() { - if (jj_3R_155()) return true; + if (jj_3R_152()) return true; return false; } - private boolean jj_3R_96() + private boolean jj_3R_97() { if (jj_scan_token(BOOL_OR)) return true; return false; } - private boolean jj_3R_147() + private boolean jj_3R_142() { - if (jj_3R_120()) return true; + if (jj_3R_121()) return true; return false; } - private boolean jj_3R_146() + private boolean jj_3R_141() { - if (jj_3R_154()) return true; + if (jj_3R_151()) return true; return false; } - private boolean jj_3R_153() + private boolean jj_3R_150() { if (jj_scan_token(MINUS)) return true; - if (jj_3R_139()) return true; + if (jj_3R_132()) return true; return false; } @@ -3271,24 +3011,24 @@ private boolean jj_3_9() return false; } - private boolean jj_3R_152() + private boolean jj_3R_149() { if (jj_scan_token(MULTI_LINE_DELIMITER)) return true; - if (jj_3R_139()) return true; + if (jj_3R_132()) return true; return false; } - private boolean jj_3R_79() + private boolean jj_3R_74() { Token xsp; while (true) { xsp = jj_scanpos; if (jj_3_9()) { jj_scanpos = xsp; break; } } - if (jj_3R_86()) return true; + if (jj_3R_80()) return true; while (true) { xsp = jj_scanpos; - if (jj_3R_96()) { jj_scanpos = xsp; break; } + if (jj_3R_97()) { jj_scanpos = xsp; break; } } return false; } @@ -3299,7 +3039,7 @@ private boolean jj_3_17() return false; } - private boolean jj_3R_145() + private boolean jj_3R_140() { Token xsp; while (true) { @@ -3307,31 +3047,31 @@ private boolean jj_3R_145() if (jj_3_17()) { jj_scanpos = xsp; break; } } xsp = jj_scanpos; - if (jj_3R_152()) { + if (jj_3R_149()) { jj_scanpos = xsp; - if (jj_3R_153()) return true; + if (jj_3R_150()) return true; } return false; } - private boolean jj_3R_139() + private boolean jj_3R_132() { Token xsp; xsp = jj_scanpos; - if (jj_3R_145()) { + if (jj_3R_140()) { jj_scanpos = xsp; - if (jj_3R_146()) { + if (jj_3R_141()) { jj_scanpos = xsp; - if (jj_3R_147()) { + if (jj_3R_142()) { jj_scanpos = xsp; - if (jj_3R_148()) return true; + if (jj_3R_143()) return true; } } } return false; } - private boolean jj_3R_117() + private boolean jj_3R_118() { if (jj_scan_token(PREPROCESSOR_RESET_COND)) return true; Token xsp; @@ -3345,25 +3085,18 @@ private boolean jj_3R_117() private boolean jj_3R_69() { - if (jj_3R_78()) return true; + if (jj_3R_77()) return true; if (jj_scan_token(ASSIGN)) return true; - if (jj_3R_72()) return true; + if (jj_3R_67()) return true; return false; } - private boolean jj_3R_151() + private boolean jj_3R_155() { if (jj_scan_token(MOD)) return true; return false; } - private boolean jj_3R_81() - { - if (jj_scan_token(ASSIGN)) return true; - if (jj_3R_72()) return true; - return false; - } - private boolean jj_3_25() { Token xsp; @@ -3372,45 +3105,55 @@ private boolean jj_3_25() if (jj_scan_token(15)) { jj_scanpos = xsp; break; } } if (jj_scan_token(COMMA)) return true; - if (jj_3R_72()) return true; + if (jj_3R_67()) return true; return false; } - private boolean jj_3R_150() + private boolean jj_3R_154() { if (jj_scan_token(DIV)) return true; return false; } - private boolean jj_3R_72() + private boolean jj_3_4() { - if (jj_3R_79()) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(49)) jj_scanpos = xsp; + if (jj_scan_token(LPAREN)) return true; + if (jj_3R_67()) return true; return false; } - private boolean jj_3R_149() + private boolean jj_3R_67() + { + if (jj_3R_74()) return true; + return false; + } + + private boolean jj_3R_153() { if (jj_scan_token(MUL)) return true; return false; } - private boolean jj_3R_141() + private boolean jj_3R_145() { Token xsp; xsp = jj_scanpos; - if (jj_3R_149()) { + if (jj_3R_153()) { jj_scanpos = xsp; - if (jj_3R_150()) { + if (jj_3R_154()) { jj_scanpos = xsp; - if (jj_3R_151()) return true; + if (jj_3R_155()) return true; } } return false; } - private boolean jj_3R_87() + private boolean jj_3R_78() { - if (jj_3R_75()) return true; + if (jj_3R_85()) return true; return false; } @@ -3420,16 +3163,6 @@ private boolean jj_3_24() return false; } - private boolean jj_3R_80() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_87()) jj_scanpos = xsp; - if (jj_scan_token(LPAREN)) return true; - if (jj_3R_72()) return true; - return false; - } - private boolean jj_3R_71() { Token xsp; @@ -3437,7 +3170,7 @@ private boolean jj_3R_71() xsp = jj_scanpos; if (jj_3_24()) { jj_scanpos = xsp; break; } } - if (jj_3R_72()) return true; + if (jj_3R_67()) return true; while (true) { xsp = jj_scanpos; if (jj_3_25()) { jj_scanpos = xsp; break; } @@ -3445,7 +3178,7 @@ private boolean jj_3R_71() return false; } - private boolean jj_3R_116() + private boolean jj_3R_117() { if (jj_scan_token(PREPROCESSOR_SET_COND)) return true; Token xsp; @@ -3463,17 +3196,17 @@ private boolean jj_3_16() return false; } - private boolean jj_3R_131() + private boolean jj_3R_127() { Token xsp; while (true) { xsp = jj_scanpos; if (jj_3_16()) { jj_scanpos = xsp; break; } } - if (jj_3R_139()) return true; + if (jj_3R_132()) return true; while (true) { xsp = jj_scanpos; - if (jj_3R_141()) { jj_scanpos = xsp; break; } + if (jj_3R_145()) { jj_scanpos = xsp; break; } } return false; } @@ -3490,7 +3223,7 @@ private boolean jj_3_22() return false; } - private boolean jj_3R_106() + private boolean jj_3R_107() { if (jj_scan_token(CALL)) return true; Token xsp; @@ -3502,21 +3235,21 @@ private boolean jj_3R_106() return false; } - private boolean jj_3R_112() + private boolean jj_3R_113() { - if (jj_3R_119()) return true; + if (jj_3R_120()) return true; return false; } - private boolean jj_3R_111() + private boolean jj_3R_112() { - if (jj_3R_118()) return true; + if (jj_3R_119()) return true; return false; } - private boolean jj_3R_110() + private boolean jj_3R_111() { - if (jj_3R_117()) return true; + if (jj_3R_118()) return true; return false; } @@ -3534,38 +3267,39 @@ private boolean jj_3R_70() return false; } - private boolean jj_3R_144() + private boolean jj_3R_148() { if (jj_scan_token(STRING_ADD)) return true; return false; } - private boolean jj_3R_101() + private boolean jj_3R_102() { Token xsp; xsp = jj_scanpos; - if (jj_3R_109()) { - jj_scanpos = xsp; if (jj_3R_110()) { jj_scanpos = xsp; if (jj_3R_111()) { jj_scanpos = xsp; - if (jj_3R_112()) return true; + if (jj_3R_112()) { + jj_scanpos = xsp; + if (jj_3R_113()) return true; } } } return false; } - private boolean jj_3R_109() + private boolean jj_3R_110() { - if (jj_3R_116()) return true; + if (jj_3R_117()) return true; return false; } - private boolean jj_3R_67() + private boolean jj_3R_87() { - if (jj_3R_75()) return true; + if (jj_scan_token(LPAREN)) return true; + if (jj_3R_67()) return true; return false; } @@ -3575,67 +3309,59 @@ private boolean jj_3_21() return false; } - private boolean jj_3R_143() + private boolean jj_3R_147() { if (jj_scan_token(MINUS)) return true; return false; } - private boolean jj_3R_74() + private boolean jj_3R_79() { - if (jj_3R_81()) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_86()) { + jj_scanpos = xsp; + if (jj_3R_87()) return true; + } return false; } - private boolean jj_3R_73() + private boolean jj_3R_86() { - if (jj_3R_80()) return true; + if (jj_scan_token(ASSIGN)) return true; + if (jj_3R_67()) return true; return false; } - private boolean jj_3R_142() + private boolean jj_3R_146() { if (jj_scan_token(PLUS)) return true; return false; } - private boolean jj_3R_134() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_142()) { - jj_scanpos = xsp; - if (jj_3R_143()) { - jj_scanpos = xsp; - if (jj_3R_144()) return true; - } - } - return false; - } - - private boolean jj_3R_66() + private boolean jj_3R_135() { Token xsp; xsp = jj_scanpos; - if (jj_3_4()) { + if (jj_3R_146()) { jj_scanpos = xsp; - if (jj_3R_73()) { + if (jj_3R_147()) { jj_scanpos = xsp; - if (jj_3R_74()) return true; + if (jj_3R_148()) return true; } } return false; } - private boolean jj_3_4() + private boolean jj_3R_96() { - if (jj_3R_67()) return true; + if (jj_scan_token(EOL)) return true; return false; } private boolean jj_3R_95() { - if (jj_scan_token(EOL)) return true; + if (jj_3R_107()) return true; return false; } @@ -3645,13 +3371,7 @@ private boolean jj_3R_94() return false; } - private boolean jj_3R_93() - { - if (jj_3R_105()) return true; - return false; - } - - private boolean jj_3R_105() + private boolean jj_3R_106() { if (jj_scan_token(WHILE)) return true; Token xsp; @@ -3663,19 +3383,19 @@ private boolean jj_3R_105() return false; } - private boolean jj_3R_92() + private boolean jj_3R_93() { - if (jj_3R_104()) return true; + if (jj_3R_105()) return true; return false; } - private boolean jj_3R_91() + private boolean jj_3R_92() { - if (jj_3R_103()) return true; + if (jj_3R_104()) return true; return false; } - private boolean jj_3R_140() + private boolean jj_3R_144() { if (jj_scan_token(IDENTIFIER)) return true; Token xsp; @@ -3684,9 +3404,15 @@ private boolean jj_3R_140() return false; } - private boolean jj_3R_90() + private boolean jj_3R_73() { - if (jj_3R_102()) return true; + if (jj_3R_79()) return true; + return false; + } + + private boolean jj_3R_91() + { + if (jj_3R_103()) return true; return false; } @@ -3696,24 +3422,41 @@ private boolean jj_3_15() return false; } - private boolean jj_3R_126() + private boolean jj_3R_123() { Token xsp; while (true) { xsp = jj_scanpos; if (jj_3_15()) { jj_scanpos = xsp; break; } } - if (jj_3R_131()) return true; + if (jj_3R_127()) return true; while (true) { xsp = jj_scanpos; - if (jj_3R_134()) { jj_scanpos = xsp; break; } + if (jj_3R_135()) { jj_scanpos = xsp; break; } } return false; } - private boolean jj_3R_89() + private boolean jj_3R_72() { - if (jj_3R_101()) return true; + if (jj_3R_78()) return true; + return false; + } + + private boolean jj_3R_66() + { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_72()) { + jj_scanpos = xsp; + if (jj_3R_73()) return true; + } + return false; + } + + private boolean jj_3R_90() + { + if (jj_3R_102()) return true; return false; } @@ -3723,15 +3466,9 @@ private boolean jj_3_8() return false; } - private boolean jj_3R_85() - { - if (jj_3R_75()) return true; - return false; - } - - private boolean jj_3_1() + private boolean jj_3R_84() { - if (jj_scan_token(MULTI_LINE_DELIMITER)) return true; + if (jj_3R_85()) return true; return false; } @@ -3741,12 +3478,10 @@ private boolean jj_3_7() return false; } - private boolean jj_3R_83() + private boolean jj_3R_82() { Token xsp; xsp = jj_scanpos; - if (jj_3R_89()) { - jj_scanpos = xsp; if (jj_3R_90()) { jj_scanpos = xsp; if (jj_3R_91()) { @@ -3757,9 +3492,11 @@ private boolean jj_3R_83() jj_scanpos = xsp; if (jj_3R_94()) { jj_scanpos = xsp; + if (jj_3R_95()) { + jj_scanpos = xsp; if (jj_scan_token(15)) { jj_scanpos = xsp; - if (jj_3R_95()) return true; + if (jj_3R_96()) return true; } } } @@ -3770,115 +3507,121 @@ private boolean jj_3R_83() return false; } - private boolean jj_3_3() + private boolean jj_3_1() { - if (jj_3R_66()) return true; + if (jj_scan_token(MULTI_LINE_DELIMITER)) return true; return false; } - private boolean jj_3R_75() + private boolean jj_3R_85() { if (jj_scan_token(LBRACKET)) return true; - if (jj_3R_72()) return true; + if (jj_3R_67()) return true; return false; } - private boolean jj_3R_138() + private boolean jj_3R_139() { if (jj_scan_token(BOOL_GE)) return true; return false; } - private boolean jj_3R_100() - { - if (jj_scan_token(IDENTIFIER)) return true; - return false; - } - - private boolean jj_3_2() + private boolean jj_3R_76() { - if (jj_scan_token(MULTI_LINE_DELIMITER)) return true; + if (jj_3R_82()) return true; return false; } - private boolean jj_3R_99() + private boolean jj_3_3() { - if (jj_scan_token(POLYPHONIC)) return true; + if (jj_3R_66()) return true; return false; } - private boolean jj_3R_77() + private boolean jj_3R_75() { - if (jj_3R_83()) return true; + if (jj_3R_81()) return true; return false; } - private boolean jj_3R_88() + private boolean jj_3R_68() { Token xsp; xsp = jj_scanpos; - if (jj_3R_98()) { - jj_scanpos = xsp; - if (jj_3R_99()) { + if (jj_3R_75()) { jj_scanpos = xsp; - if (jj_3R_100()) return true; - } + if (jj_3R_76()) return true; } return false; } - private boolean jj_3R_98() + private boolean jj_3R_138() { - if (jj_scan_token(CONST)) return true; + if (jj_scan_token(BOOL_LE)) return true; return false; } - private boolean jj_3R_68() + private boolean jj_3R_101() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_76()) { - jj_scanpos = xsp; - if (jj_3R_77()) return true; - } + if (jj_scan_token(IDENTIFIER)) return true; return false; } - private boolean jj_3R_76() + private boolean jj_3R_137() { - if (jj_3R_82()) return true; + if (jj_scan_token(BOOL_GT)) return true; return false; } - private boolean jj_3R_137() + private boolean jj_3_2() { - if (jj_scan_token(BOOL_LE)) return true; + if (jj_scan_token(MULTI_LINE_DELIMITER)) return true; return false; } - private boolean jj_3R_136() + private boolean jj_3R_100() { - if (jj_scan_token(BOOL_GT)) return true; + if (jj_scan_token(POLYPHONIC)) return true; return false; } - private boolean jj_3R_135() + private boolean jj_3R_89() + { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_99()) { + jj_scanpos = xsp; + if (jj_3R_100()) { + jj_scanpos = xsp; + if (jj_3R_101()) return true; + } + } + return false; + } + + private boolean jj_3R_99() + { + if (jj_scan_token(CONST)) return true; + return false; + } + + private boolean jj_3R_136() { if (jj_scan_token(BOOL_LT)) return true; return false; } - private boolean jj_3R_128() + private boolean jj_3R_129() { Token xsp; xsp = jj_scanpos; - if (jj_3R_135()) { - jj_scanpos = xsp; if (jj_3R_136()) { jj_scanpos = xsp; if (jj_3R_137()) { jj_scanpos = xsp; - if (jj_3R_138()) return true; + if (jj_3R_138()) { + jj_scanpos = xsp; + if (jj_3R_139()) return true; } } } @@ -3891,34 +3634,16 @@ private boolean jj_3_5() return false; } - private boolean jj_3R_78() - { - if (jj_3R_84()) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_85()) jj_scanpos = xsp; - return false; - } - - private boolean jj_3R_82() + private boolean jj_3R_77() { - if (jj_scan_token(DECLARE)) return true; + if (jj_3R_83()) return true; Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3_1()) { jj_scanpos = xsp; break; } - } xsp = jj_scanpos; - if (jj_3R_88()) jj_scanpos = xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3_2()) { jj_scanpos = xsp; break; } - } - if (jj_3R_84()) return true; + if (jj_3R_84()) jj_scanpos = xsp; return false; } - private boolean jj_3R_104() + private boolean jj_3R_105() { if (jj_scan_token(SELECT)) return true; Token xsp; @@ -3936,18 +3661,36 @@ private boolean jj_3_14() return false; } - private boolean jj_3R_122() + private boolean jj_3R_116() { Token xsp; while (true) { xsp = jj_scanpos; if (jj_3_14()) { jj_scanpos = xsp; break; } } - if (jj_3R_126()) return true; + if (jj_3R_123()) return true; + while (true) { + xsp = jj_scanpos; + if (jj_3R_129()) { jj_scanpos = xsp; break; } + } + return false; + } + + private boolean jj_3R_81() + { + if (jj_scan_token(DECLARE)) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3_1()) { jj_scanpos = xsp; break; } + } + xsp = jj_scanpos; + if (jj_3R_89()) jj_scanpos = xsp; while (true) { xsp = jj_scanpos; - if (jj_3R_128()) { jj_scanpos = xsp; break; } + if (jj_3_2()) { jj_scanpos = xsp; break; } } + if (jj_3R_83()) return true; return false; } @@ -3963,7 +3706,7 @@ private boolean jj_3R_159() return false; } - private boolean jj_3R_130() + private boolean jj_3R_131() { if (jj_scan_token(BOOL_NE)) return true; return false; @@ -3975,47 +3718,24 @@ private boolean jj_3R_158() return false; } - private boolean jj_3R_129() + private boolean jj_3R_130() { if (jj_scan_token(BOOL_EQ)) return true; return false; } - private boolean jj_3R_125() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_129()) { - jj_scanpos = xsp; - if (jj_3R_130()) return true; - } - return false; - } - - private boolean jj_3R_84() + private boolean jj_3R_126() { Token xsp; xsp = jj_scanpos; - if (jj_scan_token(34)) { - jj_scanpos = xsp; - if (jj_scan_token(35)) { - jj_scanpos = xsp; - if (jj_scan_token(36)) { - jj_scanpos = xsp; - if (jj_scan_token(37)) { - jj_scanpos = xsp; - if (jj_scan_token(38)) { + if (jj_3R_130()) { jj_scanpos = xsp; - if (jj_scan_token(39)) return true; - } - } - } - } + if (jj_3R_131()) return true; } return false; } - private boolean jj_3R_155() + private boolean jj_3R_152() { Token xsp; xsp = jj_scanpos; @@ -4035,22 +3755,22 @@ private boolean jj_3_13() return false; } - private boolean jj_3R_115() + private boolean jj_3R_109() { Token xsp; while (true) { xsp = jj_scanpos; if (jj_3_13()) { jj_scanpos = xsp; break; } } - if (jj_3R_122()) return true; + if (jj_3R_116()) return true; while (true) { xsp = jj_scanpos; - if (jj_3R_125()) { jj_scanpos = xsp; break; } + if (jj_3R_126()) { jj_scanpos = xsp; break; } } return false; } - private boolean jj_3R_103() + private boolean jj_3R_104() { if (jj_scan_token(IF)) return true; Token xsp; @@ -4062,9 +3782,32 @@ private boolean jj_3R_103() return false; } - private boolean jj_3R_113() + private boolean jj_3R_83() { - if (jj_3R_120()) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(34)) { + jj_scanpos = xsp; + if (jj_scan_token(35)) { + jj_scanpos = xsp; + if (jj_scan_token(36)) { + jj_scanpos = xsp; + if (jj_scan_token(37)) { + jj_scanpos = xsp; + if (jj_scan_token(38)) { + jj_scanpos = xsp; + if (jj_scan_token(39)) return true; + } + } + } + } + } + return false; + } + + private boolean jj_3R_114() + { + if (jj_3R_121()) return true; return false; } @@ -4074,9 +3817,9 @@ private boolean jj_3_20() return false; } - private boolean jj_3R_133() + private boolean jj_3R_134() { - if (jj_3R_140()) return true; + if (jj_3R_144()) return true; Token xsp; while (true) { xsp = jj_scanpos; @@ -4091,35 +3834,35 @@ private boolean jj_3_6() return false; } - private boolean jj_3R_102() + private boolean jj_3R_103() { Token xsp; xsp = jj_scanpos; if (jj_3_6()) { jj_scanpos = xsp; - if (jj_3R_113()) return true; + if (jj_3R_114()) return true; } return false; } - private boolean jj_3R_132() + private boolean jj_3R_133() { - if (jj_3R_78()) return true; + if (jj_3R_77()) return true; return false; } - private boolean jj_3R_127() + private boolean jj_3R_128() { Token xsp; xsp = jj_scanpos; - if (jj_3R_132()) { + if (jj_3R_133()) { jj_scanpos = xsp; - if (jj_3R_133()) return true; + if (jj_3R_134()) return true; } return false; } - private boolean jj_3R_121() + private boolean jj_3R_122() { if (jj_scan_token(BIT_AND)) return true; return false; @@ -4131,17 +3874,17 @@ private boolean jj_3_12() return false; } - private boolean jj_3R_108() + private boolean jj_3R_98() { Token xsp; while (true) { xsp = jj_scanpos; if (jj_3_12()) { jj_scanpos = xsp; break; } } - if (jj_3R_115()) return true; + if (jj_3R_109()) return true; while (true) { xsp = jj_scanpos; - if (jj_3R_121()) { jj_scanpos = xsp; break; } + if (jj_3R_122()) { jj_scanpos = xsp; break; } } return false; } @@ -4158,13 +3901,13 @@ private boolean jj_3_18() return false; } - private boolean jj_3R_114() + private boolean jj_3R_115() { if (jj_scan_token(BIT_OR)) return true; return false; } - private boolean jj_3R_124() + private boolean jj_3R_125() { if (jj_scan_token(LPAREN)) return true; Token xsp; @@ -4172,11 +3915,11 @@ private boolean jj_3R_124() xsp = jj_scanpos; if (jj_3_18()) { jj_scanpos = xsp; break; } } - if (jj_3R_72()) return true; + if (jj_3R_67()) return true; return false; } - private boolean jj_3R_119() + private boolean jj_3R_120() { if (jj_scan_token(PREPROCESSOR_CODE_IF_NOT)) return true; Token xsp; @@ -4188,19 +3931,19 @@ private boolean jj_3R_119() return false; } - private boolean jj_3R_123() + private boolean jj_3R_124() { - if (jj_3R_127()) return true; + if (jj_3R_128()) return true; return false; } - private boolean jj_3R_120() + private boolean jj_3R_121() { Token xsp; xsp = jj_scanpos; - if (jj_3R_123()) { + if (jj_3R_124()) { jj_scanpos = xsp; - if (jj_3R_124()) return true; + if (jj_3R_125()) return true; } return false; } @@ -4211,17 +3954,17 @@ private boolean jj_3_11() return false; } - private boolean jj_3R_97() + private boolean jj_3R_88() { Token xsp; while (true) { xsp = jj_scanpos; if (jj_3_11()) { jj_scanpos = xsp; break; } } - if (jj_3R_108()) return true; + if (jj_3R_98()) return true; while (true) { xsp = jj_scanpos; - if (jj_3R_114()) { jj_scanpos = xsp; break; } + if (jj_3R_115()) { jj_scanpos = xsp; break; } } return false; } @@ -4229,7 +3972,20 @@ private boolean jj_3R_97() private boolean jj_3R_157() { if (jj_scan_token(BOOL_NOT)) return true; - if (jj_3R_139()) return true; + if (jj_3R_132()) return true; + return false; + } + + private boolean jj_3R_108() + { + if (jj_scan_token(BOOL_AND)) return true; + return false; + } + + private boolean jj_3R_156() + { + if (jj_scan_token(BIT_NOT)) return true; + if (jj_3R_132()) return true; return false; } @@ -4257,7 +4013,7 @@ private static void jj_la1_init_0() { jj_la1_0 = new int[] {0x289000,0x289000,0x0,0x60000,0x60000,0x0,0x8000,0x8000,0x0,0x0,0x8000,0x8000,0x8000,0x8000,0x0,0x8000,0x8000,0x0,0x8000,0x8000,0xf9419000,0xf9409000,0xe0000000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x0,0x8000,0x800000,0x8000,0x8000,0x8000,0x8000,0x1000,0x2000000,0x8000,0x4000000,0x8000,0x8000,0x8000,0x8000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8000,0x8c80,0x0,0x0,0x0,0xc80,0x0,0x8000,}; } private static void jj_la1_init_1() { - jj_la1_1 = new int[] {0x0,0x0,0xfc,0x0,0x0,0x28020000,0x80000000,0x0,0x20000,0x20000000,0x80000000,0x0,0x0,0x0,0x8000000,0x0,0x0,0x80000000,0x0,0x0,0x80000fd,0x80000fd,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80000fc,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10000,0x8000,0x1000000,0x800000,0x3000,0x3000,0xf00,0xf00,0x40c0000,0x40c0000,0x700000,0x700000,0x80000,0xa0840fc,0x2004000,0x80000fc,0xfc,0x0,0x20000000,0x0,}; + jj_la1_1 = new int[] {0x0,0x0,0xfc,0x0,0x0,0x28020000,0x80000000,0x0,0x8020000,0x20000,0x80000000,0x0,0x0,0x0,0x8000000,0x0,0x0,0x80000000,0x0,0x0,0x80000fd,0x80000fd,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80000fc,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10000,0x8000,0x1000000,0x800000,0x3000,0x3000,0xf00,0xf00,0x40c0000,0x40c0000,0x700000,0x700000,0x80000,0xa0840fc,0x2004000,0x80000fc,0xfc,0x0,0x20000000,0x0,}; } private static void jj_la1_init_2() { jj_la1_2 = new int[] {0x0,0x0,0x0,0x1,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x1,0x1,0x0,0x0,0x0,}; @@ -4358,7 +4114,6 @@ private Token jj_consume_token(int kind) throws ParseException { } } } - trace_token(token, ""); return token; } token = oldToken; @@ -4397,7 +4152,6 @@ final public Token getNextToken() { else token = token.next = token_source.getNextToken(); jj_ntk = -1; jj_gen++; - trace_token(token, " (in getNextToken)"); return token; } @@ -4489,55 +4243,12 @@ public ParseException generateParseException() { return new ParseException(token, exptokseq, tokenImage); } - private int trace_indent = 0; - private boolean trace_enabled = true; - -/** Enable tracing. */ + /** Enable tracing. */ final public void enable_tracing() { - trace_enabled = true; } -/** Disable tracing. */ + /** Disable tracing. */ final public void disable_tracing() { - trace_enabled = false; - } - - private void trace_call(String s) { - if (trace_enabled) { - for (int i = 0; i < trace_indent; i++) { System.out.print(" "); } - System.out.println("Call: " + s); - } - trace_indent = trace_indent + 2; - } - - private void trace_return(String s) { - trace_indent = trace_indent - 2; - if (trace_enabled) { - for (int i = 0; i < trace_indent; i++) { System.out.print(" "); } - System.out.println("Return: " + s); - } - } - - private void trace_token(Token t, String where) { - if (trace_enabled) { - for (int i = 0; i < trace_indent; i++) { System.out.print(" "); } - System.out.print("Consumed token: <" + tokenImage[t.kind]); - if (t.kind != 0 && !tokenImage[t.kind].equals("\"" + t.image + "\"")) { - System.out.print(": \"" + t.image + "\""); - } - System.out.println(" at line " + t.beginLine + " column " + t.beginColumn + ">" + where); - } - } - - private void trace_scan(Token t1, int t2) { - if (trace_enabled) { - for (int i = 0; i < trace_indent; i++) { System.out.print(" "); } - System.out.print("Visited token: <" + tokenImage[t1.kind]); - if (t1.kind != 0 && !tokenImage[t1.kind].equals("\"" + t1.image + "\"")) { - System.out.print(": \"" + t1.image + "\""); - } - System.out.println(" at line " + t1.beginLine + " column " + t1.beginColumn + ">; Expected token: <" + tokenImage[t2] + ">"); - } } private void jj_rescan_token() { diff --git a/src/java/net/rkoubou/kspparser/javacc/generated/KSPParser.jj b/src/java/net/rkoubou/kspparser/javacc/generated/KSPParser.jj index 3d20749..19112f2 100644 --- a/src/java/net/rkoubou/kspparser/javacc/generated/KSPParser.jj +++ b/src/java/net/rkoubou/kspparser/javacc/generated/KSPParser.jj @@ -1,7 +1,7 @@ /*@bgen(jjtree) Generated By:JJTree: Do not edit this line. KSPParser.jj */ /*@egen*/options { - DEBUG_PARSER = true; + DEBUG_PARSER = false; DEBUG_TOKEN_MANAGER = false; STATIC = false; UNICODE_INPUT = true; @@ -551,8 +551,7 @@ void VariableInitializer() : {/*@bgen(jjtree) VariableInitializer */ try { /*@egen*/ - LOOKAHEAD( 2 ) ArrayInitializer() - | UIInitializer() + ArrayInitializer() | PrimitiveInititalizer()/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { @@ -577,62 +576,43 @@ void VariableInitializer() : } // -// \u914d\u5217\u5909\u6570\u521d\u671f\u5024\u4ee3\u5165 +// \u30d7\u30ea\u30df\u30c6\u30a3\u30d6\u578b\u5909\u6570\u521d\u671f\u5024\u4ee3\u5165 // -void ArrayInitializer() : -{/*@bgen(jjtree) ArrayInitializer */ - ASTArrayInitializer jjtn000 = new ASTArrayInitializer(this, JJTARRAYINITIALIZER); +void PrimitiveInititalizer() : +{/*@bgen(jjtree) PrimitiveInititalizer */ + ASTPrimitiveInititalizer jjtn000 = new ASTPrimitiveInititalizer(this, JJTPRIMITIVEINITITALIZER); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) ArrayInitializer */ +/*@egen*/ +} +{/*@bgen(jjtree) PrimitiveInititalizer */ try { /*@egen*/ - ArrayIndex() ( - + Expression() + )/*@bgen(jjtree)*/ + { + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + } +/*@egen*/ + { + jjtn000.hasAssign = true; + } +| + ( Expression() ( ()* Expression() )* - )?/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - } + )/*@bgen(jjtree)*/ + { + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; } /*@egen*/ -} - -// -// UI\u5909\u6570\u521d\u671f\u5024\u4ee3\u5165 -// -void UIInitializer() : -{/*@bgen(jjtree) UIInitializer */ - ASTUIInitializer jjtn000 = new ASTUIInitializer(this, JJTUIINITIALIZER); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) UIInitializer */ - try { -/*@egen*/ - [ ArrayIndex() ] - - Expression() ( ()* Expression() )* - /*@bgen(jjtree)*/ + { + jjtn000.hasAssign = false; + }/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); @@ -656,18 +636,34 @@ void UIInitializer() : } // -// \u30d7\u30ea\u30df\u30c6\u30a3\u30d6\u578b\u5909\u6570\u521d\u671f\u5024\u4ee3\u5165 +// \u914d\u5217\u5909\u6570\u521d\u671f\u5024\u4ee3\u5165 // -void PrimitiveInititalizer() : -{/*@bgen(jjtree) PrimitiveInititalizer */ - ASTPrimitiveInititalizer jjtn000 = new ASTPrimitiveInititalizer(this, JJTPRIMITIVEINITITALIZER); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) PrimitiveInititalizer */ +void ArrayInitializer() : +{/*@bgen(jjtree) ArrayInitializer */ + ASTArrayInitializer jjtn000 = new ASTArrayInitializer(this, JJTARRAYINITIALIZER); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ + Token assign = null; +} +{/*@bgen(jjtree) ArrayInitializer */ try { /*@egen*/ - Expression()/*@bgen(jjtree)*/ + ArrayIndex() + ( + LOOKAHEAD(2) [ assign = ] + + Expression() ( ()* Expression() )* + + )?/*@bgen(jjtree)*/ + { + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + } +/*@egen*/ + { + jjtn000.hasAssign = assign != null; + }/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); diff --git a/src/java/net/rkoubou/kspparser/javacc/generated/KSPParserDefaultVisitor.java b/src/java/net/rkoubou/kspparser/javacc/generated/KSPParserDefaultVisitor.java index 321695a..ba66b58 100644 --- a/src/java/net/rkoubou/kspparser/javacc/generated/KSPParserDefaultVisitor.java +++ b/src/java/net/rkoubou/kspparser/javacc/generated/KSPParserDefaultVisitor.java @@ -18,13 +18,10 @@ public Object visit(ASTVariableDeclaration node, Object data){ public Object visit(ASTVariableInitializer node, Object data){ return defaultVisit(node, data); } - public Object visit(ASTArrayInitializer node, Object data){ - return defaultVisit(node, data); - } - public Object visit(ASTUIInitializer node, Object data){ + public Object visit(ASTPrimitiveInititalizer node, Object data){ return defaultVisit(node, data); } - public Object visit(ASTPrimitiveInititalizer node, Object data){ + public Object visit(ASTArrayInitializer node, Object data){ return defaultVisit(node, data); } public Object visit(ASTCallbackDeclaration node, Object data){ @@ -145,4 +142,4 @@ public Object visit(ASTCommandArgumentList node, Object data){ return defaultVisit(node, data); } } -/* JavaCC - OriginalChecksum=9552a9ab074f879fcba7a802973e6112 (do not edit this line) */ +/* JavaCC - OriginalChecksum=de5194f8f83f19c5a006fb7c95ace1c2 (do not edit this line) */ diff --git a/src/java/net/rkoubou/kspparser/javacc/generated/KSPParserTreeConstants.java b/src/java/net/rkoubou/kspparser/javacc/generated/KSPParserTreeConstants.java index 2d0a669..7ff3960 100644 --- a/src/java/net/rkoubou/kspparser/javacc/generated/KSPParserTreeConstants.java +++ b/src/java/net/rkoubou/kspparser/javacc/generated/KSPParserTreeConstants.java @@ -7,48 +7,47 @@ public interface KSPParserTreeConstants public int JJTVOID = 1; public int JJTVARIABLEDECLARATION = 2; public int JJTVARIABLEINITIALIZER = 3; - public int JJTARRAYINITIALIZER = 4; - public int JJTUIINITIALIZER = 5; - public int JJTPRIMITIVEINITITALIZER = 6; - public int JJTCALLBACKDECLARATION = 7; - public int JJTCALLBACKARGUMENTLIST = 8; - public int JJTUSERFUNCTIONDECLARATION = 9; - public int JJTBLOCK = 10; - public int JJTPREPROCESSORDEFINE = 11; - public int JJTPREPROCESSORUNDEFINE = 12; - public int JJTPREPROCESSORIFDEFINED = 13; - public int JJTPREPROCESSORIFUNDEFINED = 14; - public int JJTIFSTATEMENT = 15; - public int JJTSELECTSTATEMENT = 16; - public int JJTCASESTATEMENT = 17; - public int JJTCASECONDITION = 18; - public int JJTWHILESTATEMENT = 19; - public int JJTCALLUSERFUNCTIONSTATEMENT = 20; - public int JJTASSIGNMENT = 21; - public int JJTCONDITIONALOR = 22; - public int JJTCONDITIONALAND = 23; - public int JJTINCLUSIVEOR = 24; - public int JJTAND = 25; - public int JJTEQUAL = 26; - public int JJTNOTEQUAL = 27; - public int JJTLT = 28; - public int JJTGT = 29; - public int JJTLE = 30; - public int JJTGE = 31; - public int JJTADD = 32; - public int JJTSUB = 33; - public int JJTSTRADD = 34; - public int JJTMUL = 35; - public int JJTDIV = 36; - public int JJTMOD = 37; - public int JJTNEG = 38; - public int JJTNOT = 39; - public int JJTLOGICALNOT = 40; - public int JJTLITERAL = 41; - public int JJTREFVARIABLE = 42; - public int JJTARRAYINDEX = 43; - public int JJTCALLCOMMAND = 44; - public int JJTCOMMANDARGUMENTLIST = 45; + public int JJTPRIMITIVEINITITALIZER = 4; + public int JJTARRAYINITIALIZER = 5; + public int JJTCALLBACKDECLARATION = 6; + public int JJTCALLBACKARGUMENTLIST = 7; + public int JJTUSERFUNCTIONDECLARATION = 8; + public int JJTBLOCK = 9; + public int JJTPREPROCESSORDEFINE = 10; + public int JJTPREPROCESSORUNDEFINE = 11; + public int JJTPREPROCESSORIFDEFINED = 12; + public int JJTPREPROCESSORIFUNDEFINED = 13; + public int JJTIFSTATEMENT = 14; + public int JJTSELECTSTATEMENT = 15; + public int JJTCASESTATEMENT = 16; + public int JJTCASECONDITION = 17; + public int JJTWHILESTATEMENT = 18; + public int JJTCALLUSERFUNCTIONSTATEMENT = 19; + public int JJTASSIGNMENT = 20; + public int JJTCONDITIONALOR = 21; + public int JJTCONDITIONALAND = 22; + public int JJTINCLUSIVEOR = 23; + public int JJTAND = 24; + public int JJTEQUAL = 25; + public int JJTNOTEQUAL = 26; + public int JJTLT = 27; + public int JJTGT = 28; + public int JJTLE = 29; + public int JJTGE = 30; + public int JJTADD = 31; + public int JJTSUB = 32; + public int JJTSTRADD = 33; + public int JJTMUL = 34; + public int JJTDIV = 35; + public int JJTMOD = 36; + public int JJTNEG = 37; + public int JJTNOT = 38; + public int JJTLOGICALNOT = 39; + public int JJTLITERAL = 40; + public int JJTREFVARIABLE = 41; + public int JJTARRAYINDEX = 42; + public int JJTCALLCOMMAND = 43; + public int JJTCOMMANDARGUMENTLIST = 44; public String[] jjtNodeName = { @@ -56,9 +55,8 @@ public interface KSPParserTreeConstants "void", "VariableDeclaration", "VariableInitializer", - "ArrayInitializer", - "UIInitializer", "PrimitiveInititalizer", + "ArrayInitializer", "CallbackDeclaration", "CallbackArgumentList", "UserFunctionDeclaration", @@ -100,4 +98,4 @@ public interface KSPParserTreeConstants "CommandArgumentList", }; } -/* JavaCC - OriginalChecksum=2d3680c5b44ee188fa68c77ce9a02195 (do not edit this line) */ +/* JavaCC - OriginalChecksum=8eb99d30756b5b771197b687cb332c93 (do not edit this line) */ diff --git a/src/java/net/rkoubou/kspparser/javacc/generated/KSPParserVisitor.java b/src/java/net/rkoubou/kspparser/javacc/generated/KSPParserVisitor.java index 250b7d7..f705274 100644 --- a/src/java/net/rkoubou/kspparser/javacc/generated/KSPParserVisitor.java +++ b/src/java/net/rkoubou/kspparser/javacc/generated/KSPParserVisitor.java @@ -7,9 +7,8 @@ public interface KSPParserVisitor public Object visit(ASTRootNode node, Object data); public Object visit(ASTVariableDeclaration node, Object data); public Object visit(ASTVariableInitializer node, Object data); - public Object visit(ASTArrayInitializer node, Object data); - public Object visit(ASTUIInitializer node, Object data); public Object visit(ASTPrimitiveInititalizer node, Object data); + public Object visit(ASTArrayInitializer node, Object data); public Object visit(ASTCallbackDeclaration node, Object data); public Object visit(ASTCallbackArgumentList node, Object data); public Object visit(ASTUserFunctionDeclaration node, Object data); @@ -50,4 +49,4 @@ public interface KSPParserVisitor public Object visit(ASTCallCommand node, Object data); public Object visit(ASTCommandArgumentList node, Object data); } -/* JavaCC - OriginalChecksum=48eb6024f4f878f2daced73c39cba5b9 (do not edit this line) */ +/* JavaCC - OriginalChecksum=2ac49eda055d564544d801d7bf5ec245 (do not edit this line) */ diff --git a/src/java/net/rkoubou/kspparser/obfuscator/Obfuscator.java b/src/java/net/rkoubou/kspparser/obfuscator/Obfuscator.java index dd42a12..f27383f 100644 --- a/src/java/net/rkoubou/kspparser/obfuscator/Obfuscator.java +++ b/src/java/net/rkoubou/kspparser/obfuscator/Obfuscator.java @@ -53,7 +53,6 @@ import net.rkoubou.kspparser.javacc.generated.ASTSelectStatement; import net.rkoubou.kspparser.javacc.generated.ASTStrAdd; import net.rkoubou.kspparser.javacc.generated.ASTSub; -import net.rkoubou.kspparser.javacc.generated.ASTUIInitializer; import net.rkoubou.kspparser.javacc.generated.ASTUserFunctionDeclaration; import net.rkoubou.kspparser.javacc.generated.ASTVariableDeclaration; import net.rkoubou.kspparser.javacc.generated.ASTVariableInitializer; @@ -149,14 +148,16 @@ public Object visit( ASTVariableDeclaration node, Object data) { // 宣言のみ // const も付与されないので変数参照時の値は変数名 + if( v.isUIVariable() ) + { + outputCode.append( v.uiTypeName ).append( " " ); + } v.value = v.getVariableName(); outputCode.append( v.getVariableName() ); appendEOL(); return node; } - outputCode.append( v.getVariableName() ); - node.jjtGetChild( 0 ).jjtAccept( this, node ); appendEOL(); @@ -182,6 +183,51 @@ public Object visit( ASTVariableInitializer node, Object data ) return node; } + /** + * プリミティブ型宣言の実装 + */ + @Override + public Object visit( ASTPrimitiveInititalizer node, Object data ) + { +/* + VariableDeclaration + -> ASTVariableInitializer + -> [ + ArrayInitializer + | UIInitializer + | PrimitiveInititalizer //NOW + -> [Expression] + ] +*/ + final Variable v = variableTable.search( ((SimpleNode)node.jjtGetParent().jjtGetParent()).symbol ); + + if( node.jjtGetNumChildren() == 0 ) + { + // 初期値代入なし + return node; + } + + final SimpleNode expr = (SimpleNode)node.jjtGetChild( 0 ); + final String varName = v.getVariableName(); + + // UI型変数+初期化子 + if( v.isUIVariable() ) + { + uiInitializerImpl( node, v, data ); + } + else + { + // プリミティブ初期値代入。畳み込みで有効な値が格納される + if( expr.symbol.symbolType != SymbolType.Command ) + { + outputCode.append( varName ).append( ":=" ); + expr.jjtAccept( this, data ); + } + } + + return node; + } + /** * 配列型宣言の実装 */ @@ -200,7 +246,23 @@ public Object visit( ASTArrayInitializer node, Object data ) | PrimitiveInititalizer ] */ - arrayInitializerImpl( node, data, false ); + final Variable v = variableTable.search( ((SimpleNode)node.jjtGetParent().jjtGetParent()).symbol ); + + if( node.hasAssign ) + { + arrayInitializerImpl( node, data, false ); + } + else + { + if( v.isUIVariable() ) + { + uiInitializerImpl( node, v, data ); + } + else + { + arrayInitializerImpl( node, data, false ); + } + } return node; } @@ -224,7 +286,9 @@ protected void arrayInitializerImpl( SimpleNode node, Object data, boolean force */ final Variable v = variableTable.search( ((SimpleNode)node.jjtGetParent().jjtGetParent()).symbol ); - outputCode.append( "[" ) + outputCode + .append( v.getVariableName() ) + .append( "[" ) .append( v.arraySize ) .append( "]" ); @@ -256,47 +320,53 @@ protected void arrayInitializerImpl( SimpleNode node, Object data, boolean force /** * UI型宣言の実装 */ - @Override - public Object visit( ASTUIInitializer node, Object data ) + protected void uiInitializerImpl( SimpleNode initializer, Variable v, Object jjtVisitorData ) { /* VariableDeclaration -> ASTVariableInitializer -> [ - ArrayInitializer - | UIInitializer // NOW - -> [ArrayIndex] - -> Expression - -> (,Expression)* + ArrayInitializer + -> ArrayIndex + -> Expression + -> (,Expression)* + | UIInitializer //NOW + -> [ ArrayIndex ] + -> Expressiom + -> (,Expression)* | PrimitiveInititalizer ] */ - final Variable v = variableTable.search( ((SimpleNode)node.jjtGetParent().jjtGetParent()).symbol ); final UIType uiType = uiTypeTable.search( v.uiTypeName ); - outputCode.append( uiType.name ).append( " " ); + outputCode + .append( uiType.name ) + .append( " " ); //-------------------------------------------------------------------------- // ui_#### が配列型の場合、要素数宣言までのコード生成 //-------------------------------------------------------------------------- if( Variable.isArray( uiType.uiValueType ) ) { - arrayInitializerImpl( node, data, true ); - return node; + arrayInitializerImpl( initializer, jjtVisitorData, true ); + } + else + { + outputCode.append( v.getVariableName() ); } //-------------------------------------------------------------------------- // 初期値代入 //-------------------------------------------------------------------------- - if( node.jjtGetNumChildren() == 0 ) + if( initializer.jjtGetNumChildren() == 0 ) { // 初期値代入なし - return node; + return; } // for のカウンタ初期値の設定 int i; - if( node.jjtGetChild( 0 ).getId() == JJTARRAYINDEX ) + if( initializer.jjtGetChild( 0 ).getId() == JJTARRAYINDEX ) { // 変数配列型の場合 // node[ 0 ] : ArrayIndex @@ -310,15 +380,15 @@ public Object visit( ASTUIInitializer node, Object data ) i = 0; } - final int length = node.jjtGetNumChildren() - i; + final int length = initializer.jjtGetNumChildren(); outputCode.append( "("); // i は上記で初期化済み for( ; i < length; i++ ) { - Node n = node.jjtGetChild( i ); - n.jjtAccept( this, data ); + Node n = initializer.jjtGetChild( i ); + n.jjtAccept( this, jjtVisitorData ); if( i < length - 1 ) { outputCode.append( "," ); @@ -326,44 +396,7 @@ public Object visit( ASTUIInitializer node, Object data ) } outputCode.append( ")" ); - - return node; - } - - /** - * プリミティブ型宣言の実装 - */ - @Override - public Object visit( ASTPrimitiveInititalizer node, Object data ) - { -/* - VariableDeclaration - -> ASTVariableInitializer - -> [ - ArrayInitializer - | UIInitializer - | PrimitiveInititalizer //NOW - -> [Expression] - ] -*/ - final Variable v = variableTable.search( ((SimpleNode)node.jjtGetParent().jjtGetParent()).symbol ); - - if( node.jjtGetNumChildren() == 0 ) - { - // 初期値代入なし - return node; - } - - final SimpleNode expr = (SimpleNode)node.jjtGetChild( 0 ); - - // 初期値代入。畳み込みで有効な値が格納される - if( expr.symbol.symbolType != SymbolType.Command ) - { - outputCode.append( v.getVariableName() ).append( ":=" ); - expr.jjtAccept( this, data ); - } - - return node; + return; } //-------------------------------------------------------------------------- @@ -786,9 +819,13 @@ public Object visit( ASTCallCommand node, Object data ) cmd = new Command( node ); } - outputCode.append( cmd.getName() ).append( "(" ); - node.childrenAccept( this, data ); - outputCode.append( ")" ); + outputCode.append( cmd.getName() ); + if( cmd.hasParenthesis ) + { + outputCode.append( "(" ); + node.childrenAccept( this, data ); + outputCode.append( ")" ); + } // このコマンド呼び出しが上位ノードのコマンド引数 // としてコールされている場合は改行出来ないためチェックをしている diff --git a/src/javacc/KSPParser.jjt b/src/javacc/KSPParser.jjt index 3d8cb64..875bfe6 100755 --- a/src/javacc/KSPParser.jjt +++ b/src/javacc/KSPParser.jjt @@ -1,6 +1,6 @@ options { - DEBUG_PARSER = true; + DEBUG_PARSER = false; DEBUG_TOKEN_MANAGER = false; STATIC = false; UNICODE_INPUT = true; @@ -445,7 +445,6 @@ void VariableDeclaration() #VariableDeclaration: Token uiType = null; } { -TODO このBNFではUI配列変数と通常の配列変数の区別が出来ない ( symbol = (LOOKAHEAD(2) )* ( @@ -480,45 +479,52 @@ TODO このBNFではUI配列変数と通常の配列変数の区別が出来な void VariableInitializer() #VariableInitializer: {} { - LOOKAHEAD( 3 ) ArrayInitializer() - | UIInitializer() + ArrayInitializer() | PrimitiveInititalizer() } // -// 配列変数初期値代入 +// プリミティブ型変数初期値代入 // -void ArrayInitializer() #ArrayInitializer: -{} +void PrimitiveInititalizer() #PrimitiveInititalizer: { - ArrayIndex() +} +{ + ( + Expression() + ) + { + jjtThis.hasAssign = true; + } +| ( - Expression() ( ()* Expression() )* - )? + ) + { + jjtThis.hasAssign = false; + } } // -// UI変数初期値代入 +// 配列変数初期値代入 // -void UIInitializer() #UIInitializer: -{} +void ArrayInitializer() #ArrayInitializer: { - [ ArrayIndex() ] - - Expression() ( ()* Expression() )* - + Token assign = null; } - -// -// プリミティブ型変数初期値代入 -// -void PrimitiveInititalizer() #PrimitiveInititalizer: -{} { - Expression() + ArrayIndex() + ( + LOOKAHEAD(2) [ assign = ] + + Expression() ( ()* Expression() )* + + )? + { + jjtThis.hasAssign = assign != null; + } } //