Hi all,
Help me to look at what is wrong with my if rule: ifStatement : IF parExpression stmt=statement (ELSE thenstmt=statement)? ; statement returns [String out] : (blockStatement ->^(STATEMENT blockStatement) | useNamespaceStatement ->^(STATEMENT useNamespaceStatement) | namespaceStatement ->^(STATEMENT namespaceStatement) | constantVarStatement ->^(STATEMENT constantVarStatement) | tryStatement ->^(STATEMENT tryStatement) | labelledStatement ->^(STATEMENT labelledStatement ) | switchStatement ->^(STATEMENT switchStatement) | withStatement ->^(STATEMENT withStatement ) | returnStatement ->^(STATEMENT returnStatement ) | breakStatement ->^(STATEMENT breakStatement ) | continueStatement ->^(STATEMENT continueStatement ) | forStatement ->^(STATEMENT forStatement ) | forInStatement ->^(STATEMENT forInStatement) | doWhileStatement ->^(STATEMENT doWhileStatement ) | whileStatement ->^(STATEMENT whileStatement) | ifStatement ->^(STATEMENT ifStatement) | emptyStatement ->^(STATEMENT emptyStatement ) | variableStatement ->^(STATEMENT variableStatement ) | functionDeclaration ->^(STATEMENT functionDeclaration ) | expression semic ->^(STATEMENT expression semic ) | expressionNoIn semic ->^(STATEMENT expressionNoIn semic ) ; Question1 : When I use: if ( a==2) { b=1; } else {b=2; } I got line 9:39 mismatched character '{' expecting 'i' . The reason for the that is the space between else and the {, if I delete the space ,the error would not show.But I dont know how to fix it. Question 2: And the other problem is "else if" can not pass, if I use if ( a==2) { b=1; } else if( a== 3) { b=2; } I got line 10:32 mismatched input 'else if' expecting RCURLY line 10:48 no viable alternative at input '{' I am lost here! Thanks in advance. Annie _________________________________________________________________ MSN 表情魔法书,改变你的对话时代! http://im.live.cn/emoticons/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to il-antlr-interest@googlegroups.com To unsubscribe from this group, send email to il-antlr-interest+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en -~----------~----~----~----~------~----~------~--~---
List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address