Index: BstParser.java =================================================================== --- a/src/java/net/sf/jabref/bst/BstParser.java (revision 2214) +++ b/src/java/net/sf/jabref/bst/BstParser.java (working copy) @@ -1,52 +1,62 @@ package net.sf.jabref.bst; -// $ANTLR 3.0b5 Bst.g 2006-11-23 23:20:24 +// $ANTLR 3.2 debian-4 Bst.g 2010-08-02 19:59:10 +import org.antlr.runtime.*; +import java.util.Stack; +import java.util.List; import java.util.ArrayList; -import java.util.List; -import org.antlr.runtime.BitSet; -import org.antlr.runtime.EarlyExitException; -import org.antlr.runtime.NoViableAltException; -import org.antlr.runtime.Parser; -import org.antlr.runtime.ParserRuleReturnScope; -import org.antlr.runtime.RecognitionException; -import org.antlr.runtime.Token; -import org.antlr.runtime.TokenStream; -import org.antlr.runtime.tree.CommonTreeAdaptor; -import org.antlr.runtime.tree.TreeAdaptor; -@SuppressWarnings({"unused", "unchecked"}) +import org.antlr.runtime.tree.*; + public class BstParser extends Parser { public static final String[] tokenNames = new String[] { "", "", "", "", "IDLIST", "STACK", "ENTRY", "COMMANDS", "STRINGS", "INTEGERS", "FUNCTION", "MACRO", "STRING", "READ", "EXECUTE", "ITERATE", "REVERSE", "SORT", "IDENTIFIER", "INTEGER", "QUOTED", "LETTER", "NUMERAL", "WS", "LINE_COMMENT", "'{'", "'}'", "'<'", "'>'", "'='", "'+'", "'-'", "':='", "'*'" }; + public static final int INTEGER=19; + public static final int FUNCTION=10; + public static final int T__29=29; + public static final int T__28=28; + public static final int T__27=27; + public static final int T__26=26; + public static final int LINE_COMMENT=24; + public static final int QUOTED=20; + public static final int T__25=25; public static final int LETTER=21; + public static final int EXECUTE=14; + public static final int STRINGS=8; + public static final int SORT=17; public static final int ENTRY=6; + public static final int EOF=-1; public static final int INTEGERS=9; + public static final int T__30=30; + public static final int ITERATE=15; + public static final int T__31=31; + public static final int T__32=32; public static final int WS=23; + public static final int T__33=33; public static final int COMMANDS=7; - public static final int STRING=12; - public static final int EXECUTE=14; - public static final int LINE_COMMENT=24; - public static final int SORT=17; + public static final int READ=13; + public static final int IDENTIFIER=18; + public static final int IDLIST=4; + public static final int NUMERAL=22; public static final int STACK=5; public static final int REVERSE=16; - public static final int QUOTED=20; - public static final int INTEGER=19; - public static final int ITERATE=15; - public static final int FUNCTION=10; - public static final int EOF=-1; - public static final int STRINGS=8; - public static final int IDENTIFIER=18; public static final int MACRO=11; - public static final int IDLIST=4; - public static final int NUMERAL=22; - public static final int READ=13; + public static final int STRING=12; + // delegates + // delegators + + public BstParser(TokenStream input) { - super(input); + this(input, new RecognizerSharedState()); } + public BstParser(TokenStream input, RecognizerSharedState state) { + super(input, state); + + } protected TreeAdaptor adaptor = new CommonTreeAdaptor(); @@ -57,29 +67,29 @@ return adaptor; } - public String[] getTokenNames() { return tokenNames; } + public String[] getTokenNames() { return BstParser.tokenNames; } public String getGrammarFileName() { return "Bst.g"; } public static class program_return extends ParserRuleReturnScope { Object tree; public Object getTree() { return tree; } - } + }; - // $ANTLR start program + // $ANTLR start "program" // Bst.g:14:1: program : ( commands )+ -> ^( COMMANDS ( commands )+ ) ; - public program_return program() throws RecognitionException { - program_return retval = new program_return(); + public final BstParser.program_return program() throws RecognitionException { + BstParser.program_return retval = new BstParser.program_return(); retval.start = input.LT(1); Object root_0 = null; - commands_return commands1 = null; + BstParser.commands_return commands1 = null; - List list_commands=new ArrayList(); + RewriteRuleSubtreeStream stream_commands=new RewriteRuleSubtreeStream(adaptor,"rule commands"); try { - // Bst.g:14:11: ( ( commands )+ -> ^( COMMANDS ( commands )+ ) ) + // Bst.g:14:9: ( ( commands )+ -> ^( COMMANDS ( commands )+ ) ) // Bst.g:14:11: ( commands )+ { // Bst.g:14:11: ( commands )+ @@ -88,6 +98,7 @@ do { int alt1=2; int LA1_0 = input.LA(1); + if ( (LA1_0==ENTRY||(LA1_0>=STRINGS && LA1_0<=MACRO)||(LA1_0>=READ && LA1_0<=SORT)) ) { alt1=1; } @@ -99,10 +110,11 @@ { pushFollow(FOLLOW_commands_in_program45); commands1=commands(); - _fsp--; - list_commands.add(commands1.tree); + state._fsp--; + stream_commands.add(commands1.getTree()); + } break; @@ -116,65 +128,69 @@ } while (true); + // AST REWRITE - - int i_0 = 0; + // elements: commands + // token labels: + // rule labels: retval + // token list labels: + // rule list labels: + // wildcard labels: retval.tree = root_0; - root_0 = adaptor.nil(); + RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null); + + root_0 = (Object)adaptor.nil(); // 14:21: -> ^( COMMANDS ( commands )+ ) { // Bst.g:14:24: ^( COMMANDS ( commands )+ ) { - Object root_1 = adaptor.nil(); - root_1 = adaptor.becomeRoot(adaptor.create(COMMANDS, "COMMANDS"), root_1); + Object root_1 = (Object)adaptor.nil(); + root_1 = (Object)adaptor.becomeRoot((Object)adaptor.create(COMMANDS, "COMMANDS"), root_1); - // Bst.g:14:35: ( commands )+ - { - int n_1 = list_commands == null ? 0 : list_commands.size(); - + if ( !(stream_commands.hasNext()) ) { + throw new RewriteEarlyExitException(); + } + while ( stream_commands.hasNext() ) { + adaptor.addChild(root_1, stream_commands.nextTree()); - - if ( n_1==0 ) throw new RuntimeException("Must have more than one element for (...)+ loops"); - for (int i_1=0; i_1 ^( IDLIST ( identifier )+ ) ; - - public idList_return idList() throws RecognitionException { - idList_return retval = new idList_return(); + public final BstParser.idList_return idList() throws RecognitionException { + BstParser.idList_return retval = new BstParser.idList_return(); retval.start = input.LT(1); Object root_0 = null; Token char_literal36=null; Token char_literal38=null; - identifier_return identifier37 = null; + BstParser.identifier_return identifier37 = null; - List list_identifier=new ArrayList(); - List list_26=new ArrayList(); - List list_25=new ArrayList(); + Object char_literal36_tree=null; Object char_literal38_tree=null; - + RewriteRuleTokenStream stream_25=new RewriteRuleTokenStream(adaptor,"token 25"); + RewriteRuleTokenStream stream_26=new RewriteRuleTokenStream(adaptor,"token 26"); + RewriteRuleSubtreeStream stream_identifier=new RewriteRuleSubtreeStream(adaptor,"rule identifier"); try { - // Bst.g:35:4: ( '{' ( identifier )+ '}' -> ^( IDLIST ( identifier )+ ) ) + // Bst.g:35:2: ( '{' ( identifier )+ '}' -> ^( IDLIST ( identifier )+ ) ) // Bst.g:35:4: '{' ( identifier )+ '}' { - char_literal36=input.LT(1); - match(input,25,FOLLOW_25_in_idList205); - list_25.add(char_literal36); + char_literal36=(Token)match(input,25,FOLLOW_25_in_idList205); + stream_25.add(char_literal36); // Bst.g:35:8: ( identifier )+ int cnt3=0; @@ -647,6 +677,7 @@ do { int alt3=2; int LA3_0 = input.LA(1); + if ( (LA3_0==IDENTIFIER) ) { alt3=1; } @@ -658,10 +689,11 @@ { pushFollow(FOLLOW_identifier_in_idList207); identifier37=identifier(); - _fsp--; - list_identifier.add(identifier37.tree); + state._fsp--; + stream_identifier.add(identifier37.getTree()); + } break; @@ -674,96 +706,100 @@ cnt3++; } while (true); - char_literal38=input.LT(1); - match(input,26,FOLLOW_26_in_idList210); - list_26.add(char_literal38); + char_literal38=(Token)match(input,26,FOLLOW_26_in_idList210); + stream_26.add(char_literal38); + // AST REWRITE - int i_0 = 0; + // elements: identifier + // token labels: + // rule labels: retval + // token list labels: + // rule list labels: + // wildcard labels: retval.tree = root_0; - root_0 = adaptor.nil(); + RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null); + + root_0 = (Object)adaptor.nil(); // 35:24: -> ^( IDLIST ( identifier )+ ) { // Bst.g:35:27: ^( IDLIST ( identifier )+ ) { - Object root_1 = adaptor.nil(); - root_1 = adaptor.becomeRoot(adaptor.create(IDLIST, "IDLIST"), root_1); + Object root_1 = (Object)adaptor.nil(); + root_1 = (Object)adaptor.becomeRoot((Object)adaptor.create(IDLIST, "IDLIST"), root_1); - // Bst.g:35:36: ( identifier )+ - { - int n_1 = list_identifier == null ? 0 : list_identifier.size(); - + if ( !(stream_identifier.hasNext()) ) { + throw new RewriteEarlyExitException(); + } + while ( stream_identifier.hasNext() ) { + adaptor.addChild(root_1, stream_identifier.nextTree()); - - if ( n_1==0 ) throw new RuntimeException("Must have more than one element for (...)+ loops"); - for (int i_1=0; i_1 ^( IDLIST ( identifier )* ) ; - public idList0_return idList0() throws RecognitionException { - idList0_return retval = new idList0_return(); + public final BstParser.idList0_return idList0() throws RecognitionException { + BstParser.idList0_return retval = new BstParser.idList0_return(); retval.start = input.LT(1); Object root_0 = null; Token char_literal39=null; Token char_literal41=null; - identifier_return identifier40 = null; + BstParser.identifier_return identifier40 = null; - List list_identifier=new ArrayList(); - List list_26=new ArrayList(); - List list_25=new ArrayList(); + Object char_literal39_tree=null; Object char_literal41_tree=null; - + RewriteRuleTokenStream stream_25=new RewriteRuleTokenStream(adaptor,"token 25"); + RewriteRuleTokenStream stream_26=new RewriteRuleTokenStream(adaptor,"token 26"); + RewriteRuleSubtreeStream stream_identifier=new RewriteRuleSubtreeStream(adaptor,"rule identifier"); try { - // Bst.g:38:4: ( '{' ( identifier )* '}' -> ^( IDLIST ( identifier )* ) ) + // Bst.g:38:2: ( '{' ( identifier )* '}' -> ^( IDLIST ( identifier )* ) ) // Bst.g:38:4: '{' ( identifier )* '}' { - char_literal39=input.LT(1); - match(input,25,FOLLOW_25_in_idList0230); - list_25.add(char_literal39); + char_literal39=(Token)match(input,25,FOLLOW_25_in_idList0230); + stream_25.add(char_literal39); // Bst.g:38:8: ( identifier )* loop4: do { int alt4=2; int LA4_0 = input.LA(1); + if ( (LA4_0==IDENTIFIER) ) { alt4=1; } @@ -775,10 +811,11 @@ { pushFollow(FOLLOW_identifier_in_idList0232); identifier40=identifier(); - _fsp--; - list_identifier.add(identifier40.tree); + state._fsp--; + stream_identifier.add(identifier40.getTree()); + } break; @@ -787,68 +824,71 @@ } } while (true); - char_literal41=input.LT(1); - match(input,26,FOLLOW_26_in_idList0235); - list_26.add(char_literal41); + char_literal41=(Token)match(input,26,FOLLOW_26_in_idList0235); + stream_26.add(char_literal41); + // AST REWRITE - int i_0 = 0; + // elements: identifier + // token labels: + // rule labels: retval + // token list labels: + // rule list labels: + // wildcard labels: retval.tree = root_0; - root_0 = adaptor.nil(); + RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null); + + root_0 = (Object)adaptor.nil(); // 38:24: -> ^( IDLIST ( identifier )* ) { // Bst.g:38:27: ^( IDLIST ( identifier )* ) { - Object root_1 = adaptor.nil(); - root_1 = adaptor.becomeRoot(adaptor.create(IDLIST, "IDLIST"), root_1); + Object root_1 = (Object)adaptor.nil(); + root_1 = (Object)adaptor.becomeRoot((Object)adaptor.create(IDLIST, "IDLIST"), root_1); // Bst.g:38:36: ( identifier )* - { - int n_1 = list_identifier == null ? 0 : list_identifier.size(); - + while ( stream_identifier.hasNext() ) { + adaptor.addChild(root_1, stream_identifier.nextTree()); - - for (int i_1=0; i_1' | '=' | '+' | '-' | ':=' | '*' | identifier ); - public function_return function() throws RecognitionException { - function_return retval = new function_return(); + public final BstParser.function_return function() throws RecognitionException { + BstParser.function_return retval = new BstParser.function_return(); retval.start = input.LT(1); Object root_0 = null; @@ -860,7 +900,7 @@ Token char_literal46=null; Token string_literal47=null; Token char_literal48=null; - identifier_return identifier49 = null; + BstParser.identifier_return identifier49 = null; Object char_literal42_tree=null; @@ -872,36 +912,52 @@ Object char_literal48_tree=null; try { - // Bst.g:41:4: ( '<' | '>' | '=' | '+' | '-' | ':=' | '*' | identifier ) + // Bst.g:41:2: ( '<' | '>' | '=' | '+' | '-' | ':=' | '*' | identifier ) int alt5=8; switch ( input.LA(1) ) { case 27: + { alt5=1; + } break; case 28: + { alt5=2; + } break; case 29: + { alt5=3; + } break; case 30: + { alt5=4; + } break; case 31: + { alt5=5; + } break; case 32: + { alt5=6; + } break; case 33: + { alt5=7; + } break; case IDENTIFIER: + { alt5=8; + } break; default: NoViableAltException nvae = - new NoViableAltException("40:1: function : ( '<' | '>' | '=' | '+' | '-' | ':=' | '*' | identifier );", 5, 0, input); + new NoViableAltException("", 5, 0, input); throw nvae; } @@ -910,11 +966,10 @@ case 1 : // Bst.g:41:4: '<' { - root_0 = adaptor.nil(); + root_0 = (Object)adaptor.nil(); - char_literal42=input.LT(1); - match(input,27,FOLLOW_27_in_function254); - char_literal42_tree = adaptor.create(char_literal42); + char_literal42=(Token)match(input,27,FOLLOW_27_in_function254); + char_literal42_tree = (Object)adaptor.create(char_literal42); adaptor.addChild(root_0, char_literal42_tree); @@ -923,11 +978,10 @@ case 2 : // Bst.g:41:10: '>' { - root_0 = adaptor.nil(); + root_0 = (Object)adaptor.nil(); - char_literal43=input.LT(1); - match(input,28,FOLLOW_28_in_function258); - char_literal43_tree = adaptor.create(char_literal43); + char_literal43=(Token)match(input,28,FOLLOW_28_in_function258); + char_literal43_tree = (Object)adaptor.create(char_literal43); adaptor.addChild(root_0, char_literal43_tree); @@ -936,11 +990,10 @@ case 3 : // Bst.g:41:16: '=' { - root_0 = adaptor.nil(); + root_0 = (Object)adaptor.nil(); - char_literal44=input.LT(1); - match(input,29,FOLLOW_29_in_function262); - char_literal44_tree = adaptor.create(char_literal44); + char_literal44=(Token)match(input,29,FOLLOW_29_in_function262); + char_literal44_tree = (Object)adaptor.create(char_literal44); adaptor.addChild(root_0, char_literal44_tree); @@ -949,11 +1002,10 @@ case 4 : // Bst.g:41:22: '+' { - root_0 = adaptor.nil(); + root_0 = (Object)adaptor.nil(); - char_literal45=input.LT(1); - match(input,30,FOLLOW_30_in_function266); - char_literal45_tree = adaptor.create(char_literal45); + char_literal45=(Token)match(input,30,FOLLOW_30_in_function266); + char_literal45_tree = (Object)adaptor.create(char_literal45); adaptor.addChild(root_0, char_literal45_tree); @@ -962,11 +1014,10 @@ case 5 : // Bst.g:41:28: '-' { - root_0 = adaptor.nil(); + root_0 = (Object)adaptor.nil(); - char_literal46=input.LT(1); - match(input,31,FOLLOW_31_in_function270); - char_literal46_tree = adaptor.create(char_literal46); + char_literal46=(Token)match(input,31,FOLLOW_31_in_function270); + char_literal46_tree = (Object)adaptor.create(char_literal46); adaptor.addChild(root_0, char_literal46_tree); @@ -975,11 +1026,10 @@ case 6 : // Bst.g:41:34: ':=' { - root_0 = adaptor.nil(); + root_0 = (Object)adaptor.nil(); - string_literal47=input.LT(1); - match(input,32,FOLLOW_32_in_function274); - string_literal47_tree = adaptor.create(string_literal47); + string_literal47=(Token)match(input,32,FOLLOW_32_in_function274); + string_literal47_tree = (Object)adaptor.create(string_literal47); adaptor.addChild(root_0, string_literal47_tree); @@ -988,11 +1038,10 @@ case 7 : // Bst.g:41:41: '*' { - root_0 = adaptor.nil(); + root_0 = (Object)adaptor.nil(); - char_literal48=input.LT(1); - match(input,33,FOLLOW_33_in_function278); - char_literal48_tree = adaptor.create(char_literal48); + char_literal48=(Token)match(input,33,FOLLOW_33_in_function278); + char_literal48_tree = (Object)adaptor.create(char_literal48); adaptor.addChild(root_0, char_literal48_tree); @@ -1001,64 +1050,66 @@ case 8 : // Bst.g:41:47: identifier { - root_0 = adaptor.nil(); + root_0 = (Object)adaptor.nil(); pushFollow(FOLLOW_identifier_in_function282); identifier49=identifier(); - _fsp--; - adaptor.addChild(root_0, identifier49.tree); + state._fsp--; + adaptor.addChild(root_0, identifier49.getTree()); + } break; } + retval.stop = input.LT(-1); + + retval.tree = (Object)adaptor.rulePostProcessing(root_0); + adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); + } catch (RecognitionException re) { reportError(re); recover(input,re); + retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re); + } finally { - retval.stop = input.LT(-1); - - retval.tree = adaptor.rulePostProcessing(root_0); - adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); - - } + } return retval; } - // $ANTLR end function + // $ANTLR end "function" public static class stack_return extends ParserRuleReturnScope { Object tree; public Object getTree() { return tree; } - } + }; - // $ANTLR start stack + // $ANTLR start "stack" // Bst.g:43:1: stack : '{' ( stackitem )+ '}' -> ^( STACK ( stackitem )+ ) ; - public stack_return stack() throws RecognitionException { - stack_return retval = new stack_return(); + public final BstParser.stack_return stack() throws RecognitionException { + BstParser.stack_return retval = new BstParser.stack_return(); retval.start = input.LT(1); Object root_0 = null; Token char_literal50=null; Token char_literal52=null; - stackitem_return stackitem51 = null; + BstParser.stackitem_return stackitem51 = null; - List list_stackitem=new ArrayList(); - List list_26=new ArrayList(); - List list_25=new ArrayList(); + Object char_literal50_tree=null; Object char_literal52_tree=null; - + RewriteRuleTokenStream stream_25=new RewriteRuleTokenStream(adaptor,"token 25"); + RewriteRuleTokenStream stream_26=new RewriteRuleTokenStream(adaptor,"token 26"); + RewriteRuleSubtreeStream stream_stackitem=new RewriteRuleSubtreeStream(adaptor,"rule stackitem"); try { - // Bst.g:44:4: ( '{' ( stackitem )+ '}' -> ^( STACK ( stackitem )+ ) ) + // Bst.g:44:2: ( '{' ( stackitem )+ '}' -> ^( STACK ( stackitem )+ ) ) // Bst.g:44:4: '{' ( stackitem )+ '}' { - char_literal50=input.LT(1); - match(input,25,FOLLOW_25_in_stack293); - list_25.add(char_literal50); + char_literal50=(Token)match(input,25,FOLLOW_25_in_stack293); + stream_25.add(char_literal50); // Bst.g:44:8: ( stackitem )+ int cnt6=0; @@ -1066,6 +1117,7 @@ do { int alt6=2; int LA6_0 = input.LA(1); + if ( (LA6_0==STRING||(LA6_0>=IDENTIFIER && LA6_0<=QUOTED)||LA6_0==25||(LA6_0>=27 && LA6_0<=33)) ) { alt6=1; } @@ -1077,10 +1129,11 @@ { pushFollow(FOLLOW_stackitem_in_stack295); stackitem51=stackitem(); - _fsp--; - list_stackitem.add(stackitem51.tree); + state._fsp--; + stream_stackitem.add(stackitem51.getTree()); + } break; @@ -1093,69 +1146,73 @@ cnt6++; } while (true); - char_literal52=input.LT(1); - match(input,26,FOLLOW_26_in_stack298); - list_26.add(char_literal52); + char_literal52=(Token)match(input,26,FOLLOW_26_in_stack298); + stream_26.add(char_literal52); + // AST REWRITE - int i_0 = 0; + // elements: stackitem + // token labels: + // rule labels: retval + // token list labels: + // rule list labels: + // wildcard labels: retval.tree = root_0; - root_0 = adaptor.nil(); + RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null); + + root_0 = (Object)adaptor.nil(); // 44:23: -> ^( STACK ( stackitem )+ ) { // Bst.g:44:26: ^( STACK ( stackitem )+ ) { - Object root_1 = adaptor.nil(); - root_1 = adaptor.becomeRoot(adaptor.create(STACK, "STACK"), root_1); + Object root_1 = (Object)adaptor.nil(); + root_1 = (Object)adaptor.becomeRoot((Object)adaptor.create(STACK, "STACK"), root_1); - // Bst.g:44:34: ( stackitem )+ - { - int n_1 = list_stackitem == null ? 0 : list_stackitem.size(); - + if ( !(stream_stackitem.hasNext()) ) { + throw new RewriteEarlyExitException(); + } + while ( stream_stackitem.hasNext() ) { + adaptor.addChild(root_1, stream_stackitem.nextTree()); - - if ( n_1==0 ) throw new RuntimeException("Must have more than one element for (...)+ loops"); - for (int i_1=0; i_1' ) - // Bst.g:6:7: '>' + // Bst.g:6:9: '>' { match('>'); } - - - if ( token==null && ruleNestingLevel==1 ) { - emit(_type,_line,_charPosition,_channel,_start,getCharIndex()-1); - } - - } + state.type = _type; + state.channel = _channel; + } finally { - ruleNestingLevel--; } } - // $ANTLR end T28 + // $ANTLR end "T__28" - // $ANTLR start T29 - public void mT29() throws RecognitionException { + // $ANTLR start "T__29" + public final void mT__29() throws RecognitionException { try { - ruleNestingLevel++; - int _type = T29; - int _start = getCharIndex(); - int _line = getLine(); - int _charPosition = getCharPositionInLine(); - int _channel = Token.DEFAULT_CHANNEL; + int _type = T__29; + int _channel = DEFAULT_TOKEN_CHANNEL; // Bst.g:7:7: ( '=' ) - // Bst.g:7:7: '=' + // Bst.g:7:9: '=' { match('='); } - - - if ( token==null && ruleNestingLevel==1 ) { - emit(_type,_line,_charPosition,_channel,_start,getCharIndex()-1); - } - - } + state.type = _type; + state.channel = _channel; + } finally { - ruleNestingLevel--; } } - // $ANTLR end T29 + // $ANTLR end "T__29" - // $ANTLR start T30 - public void mT30() throws RecognitionException { + // $ANTLR start "T__30" + public final void mT__30() throws RecognitionException { try { - ruleNestingLevel++; - int _type = T30; - int _start = getCharIndex(); - int _line = getLine(); - int _charPosition = getCharPositionInLine(); - int _channel = Token.DEFAULT_CHANNEL; + int _type = T__30; + int _channel = DEFAULT_TOKEN_CHANNEL; // Bst.g:8:7: ( '+' ) - // Bst.g:8:7: '+' + // Bst.g:8:9: '+' { match('+'); } - - - if ( token==null && ruleNestingLevel==1 ) { - emit(_type,_line,_charPosition,_channel,_start,getCharIndex()-1); - } - - } + state.type = _type; + state.channel = _channel; + } finally { - ruleNestingLevel--; } } - // $ANTLR end T30 + // $ANTLR end "T__30" - // $ANTLR start T31 - public void mT31() throws RecognitionException { + // $ANTLR start "T__31" + public final void mT__31() throws RecognitionException { try { - ruleNestingLevel++; - int _type = T31; - int _start = getCharIndex(); - int _line = getLine(); - int _charPosition = getCharPositionInLine(); - int _channel = Token.DEFAULT_CHANNEL; + int _type = T__31; + int _channel = DEFAULT_TOKEN_CHANNEL; // Bst.g:9:7: ( '-' ) - // Bst.g:9:7: '-' + // Bst.g:9:9: '-' { match('-'); } - - - if ( token==null && ruleNestingLevel==1 ) { - emit(_type,_line,_charPosition,_channel,_start,getCharIndex()-1); - } - - } + state.type = _type; + state.channel = _channel; + } finally { - ruleNestingLevel--; } } - // $ANTLR end T31 + // $ANTLR end "T__31" - // $ANTLR start T32 - public void mT32() throws RecognitionException { + // $ANTLR start "T__32" + public final void mT__32() throws RecognitionException { try { - ruleNestingLevel++; - int _type = T32; - int _start = getCharIndex(); - int _line = getLine(); - int _charPosition = getCharPositionInLine(); - int _channel = Token.DEFAULT_CHANNEL; + int _type = T__32; + int _channel = DEFAULT_TOKEN_CHANNEL; // Bst.g:10:7: ( ':=' ) - // Bst.g:10:7: ':=' + // Bst.g:10:9: ':=' { match(":="); } - - - if ( token==null && ruleNestingLevel==1 ) { - emit(_type,_line,_charPosition,_channel,_start,getCharIndex()-1); - } - - } + state.type = _type; + state.channel = _channel; + } finally { - ruleNestingLevel--; } } - // $ANTLR end T32 + // $ANTLR end "T__32" - // $ANTLR start T33 - public void mT33() throws RecognitionException { + // $ANTLR start "T__33" + public final void mT__33() throws RecognitionException { try { - ruleNestingLevel++; - int _type = T33; - int _start = getCharIndex(); - int _line = getLine(); - int _charPosition = getCharPositionInLine(); - int _channel = Token.DEFAULT_CHANNEL; + int _type = T__33; + int _channel = DEFAULT_TOKEN_CHANNEL; // Bst.g:11:7: ( '*' ) - // Bst.g:11:7: '*' + // Bst.g:11:9: '*' { match('*'); } - - - if ( token==null && ruleNestingLevel==1 ) { - emit(_type,_line,_charPosition,_channel,_start,getCharIndex()-1); - } - - } + state.type = _type; + state.channel = _channel; + } finally { - ruleNestingLevel--; } } - // $ANTLR end T33 + // $ANTLR end "T__33" - // $ANTLR start STRINGS - public void mSTRINGS() throws RecognitionException { + // $ANTLR start "STRINGS" + public final void mSTRINGS() throws RecognitionException { try { - ruleNestingLevel++; int _type = STRINGS; - int _start = getCharIndex(); - int _line = getLine(); - int _charPosition = getCharPositionInLine(); - int _channel = Token.DEFAULT_CHANNEL; - // Bst.g:53:11: ( 'STRINGS' ) + int _channel = DEFAULT_TOKEN_CHANNEL; + // Bst.g:53:9: ( 'STRINGS' ) // Bst.g:53:11: 'STRINGS' { match("STRINGS"); @@ -330,29 +247,20 @@ } - - - if ( token==null && ruleNestingLevel==1 ) { - emit(_type,_line,_charPosition,_channel,_start,getCharIndex()-1); - } - - } + state.type = _type; + state.channel = _channel; + } finally { - ruleNestingLevel--; } } - // $ANTLR end STRINGS + // $ANTLR end "STRINGS" - // $ANTLR start INTEGERS - public void mINTEGERS() throws RecognitionException { + // $ANTLR start "INTEGERS" + public final void mINTEGERS() throws RecognitionException { try { - ruleNestingLevel++; int _type = INTEGERS; - int _start = getCharIndex(); - int _line = getLine(); - int _charPosition = getCharPositionInLine(); - int _channel = Token.DEFAULT_CHANNEL; - // Bst.g:54:12: ( 'INTEGERS' ) + int _channel = DEFAULT_TOKEN_CHANNEL; + // Bst.g:54:10: ( 'INTEGERS' ) // Bst.g:54:12: 'INTEGERS' { match("INTEGERS"); @@ -360,29 +268,20 @@ } - - - if ( token==null && ruleNestingLevel==1 ) { - emit(_type,_line,_charPosition,_channel,_start,getCharIndex()-1); - } - - } + state.type = _type; + state.channel = _channel; + } finally { - ruleNestingLevel--; } } - // $ANTLR end INTEGERS + // $ANTLR end "INTEGERS" - // $ANTLR start FUNCTION - public void mFUNCTION() throws RecognitionException { + // $ANTLR start "FUNCTION" + public final void mFUNCTION() throws RecognitionException { try { - ruleNestingLevel++; int _type = FUNCTION; - int _start = getCharIndex(); - int _line = getLine(); - int _charPosition = getCharPositionInLine(); - int _channel = Token.DEFAULT_CHANNEL; - // Bst.g:55:12: ( 'FUNCTION' ) + int _channel = DEFAULT_TOKEN_CHANNEL; + // Bst.g:55:10: ( 'FUNCTION' ) // Bst.g:55:12: 'FUNCTION' { match("FUNCTION"); @@ -390,29 +289,20 @@ } - - - if ( token==null && ruleNestingLevel==1 ) { - emit(_type,_line,_charPosition,_channel,_start,getCharIndex()-1); - } - - } + state.type = _type; + state.channel = _channel; + } finally { - ruleNestingLevel--; } } - // $ANTLR end FUNCTION + // $ANTLR end "FUNCTION" - // $ANTLR start EXECUTE - public void mEXECUTE() throws RecognitionException { + // $ANTLR start "EXECUTE" + public final void mEXECUTE() throws RecognitionException { try { - ruleNestingLevel++; int _type = EXECUTE; - int _start = getCharIndex(); - int _line = getLine(); - int _charPosition = getCharPositionInLine(); - int _channel = Token.DEFAULT_CHANNEL; - // Bst.g:56:11: ( 'EXECUTE' ) + int _channel = DEFAULT_TOKEN_CHANNEL; + // Bst.g:56:9: ( 'EXECUTE' ) // Bst.g:56:11: 'EXECUTE' { match("EXECUTE"); @@ -420,29 +310,20 @@ } - - - if ( token==null && ruleNestingLevel==1 ) { - emit(_type,_line,_charPosition,_channel,_start,getCharIndex()-1); - } - - } + state.type = _type; + state.channel = _channel; + } finally { - ruleNestingLevel--; } } - // $ANTLR end EXECUTE + // $ANTLR end "EXECUTE" - // $ANTLR start SORT - public void mSORT() throws RecognitionException { + // $ANTLR start "SORT" + public final void mSORT() throws RecognitionException { try { - ruleNestingLevel++; int _type = SORT; - int _start = getCharIndex(); - int _line = getLine(); - int _charPosition = getCharPositionInLine(); - int _channel = Token.DEFAULT_CHANNEL; - // Bst.g:57:8: ( 'SORT' ) + int _channel = DEFAULT_TOKEN_CHANNEL; + // Bst.g:57:6: ( 'SORT' ) // Bst.g:57:8: 'SORT' { match("SORT"); @@ -450,29 +331,20 @@ } - - - if ( token==null && ruleNestingLevel==1 ) { - emit(_type,_line,_charPosition,_channel,_start,getCharIndex()-1); - } - - } + state.type = _type; + state.channel = _channel; + } finally { - ruleNestingLevel--; } } - // $ANTLR end SORT + // $ANTLR end "SORT" - // $ANTLR start ITERATE - public void mITERATE() throws RecognitionException { + // $ANTLR start "ITERATE" + public final void mITERATE() throws RecognitionException { try { - ruleNestingLevel++; int _type = ITERATE; - int _start = getCharIndex(); - int _line = getLine(); - int _charPosition = getCharPositionInLine(); - int _channel = Token.DEFAULT_CHANNEL; - // Bst.g:58:11: ( 'ITERATE' ) + int _channel = DEFAULT_TOKEN_CHANNEL; + // Bst.g:58:9: ( 'ITERATE' ) // Bst.g:58:11: 'ITERATE' { match("ITERATE"); @@ -480,29 +352,20 @@ } - - - if ( token==null && ruleNestingLevel==1 ) { - emit(_type,_line,_charPosition,_channel,_start,getCharIndex()-1); - } - - } + state.type = _type; + state.channel = _channel; + } finally { - ruleNestingLevel--; } } - // $ANTLR end ITERATE + // $ANTLR end "ITERATE" - // $ANTLR start REVERSE - public void mREVERSE() throws RecognitionException { + // $ANTLR start "REVERSE" + public final void mREVERSE() throws RecognitionException { try { - ruleNestingLevel++; int _type = REVERSE; - int _start = getCharIndex(); - int _line = getLine(); - int _charPosition = getCharPositionInLine(); - int _channel = Token.DEFAULT_CHANNEL; - // Bst.g:59:11: ( 'REVERSE' ) + int _channel = DEFAULT_TOKEN_CHANNEL; + // Bst.g:59:9: ( 'REVERSE' ) // Bst.g:59:11: 'REVERSE' { match("REVERSE"); @@ -510,29 +373,20 @@ } - - - if ( token==null && ruleNestingLevel==1 ) { - emit(_type,_line,_charPosition,_channel,_start,getCharIndex()-1); - } - - } + state.type = _type; + state.channel = _channel; + } finally { - ruleNestingLevel--; } } - // $ANTLR end REVERSE + // $ANTLR end "REVERSE" - // $ANTLR start ENTRY - public void mENTRY() throws RecognitionException { + // $ANTLR start "ENTRY" + public final void mENTRY() throws RecognitionException { try { - ruleNestingLevel++; int _type = ENTRY; - int _start = getCharIndex(); - int _line = getLine(); - int _charPosition = getCharPositionInLine(); - int _channel = Token.DEFAULT_CHANNEL; - // Bst.g:60:9: ( 'ENTRY' ) + int _channel = DEFAULT_TOKEN_CHANNEL; + // Bst.g:60:7: ( 'ENTRY' ) // Bst.g:60:9: 'ENTRY' { match("ENTRY"); @@ -540,29 +394,20 @@ } - - - if ( token==null && ruleNestingLevel==1 ) { - emit(_type,_line,_charPosition,_channel,_start,getCharIndex()-1); - } - - } + state.type = _type; + state.channel = _channel; + } finally { - ruleNestingLevel--; } } - // $ANTLR end ENTRY + // $ANTLR end "ENTRY" - // $ANTLR start READ - public void mREAD() throws RecognitionException { + // $ANTLR start "READ" + public final void mREAD() throws RecognitionException { try { - ruleNestingLevel++; int _type = READ; - int _start = getCharIndex(); - int _line = getLine(); - int _charPosition = getCharPositionInLine(); - int _channel = Token.DEFAULT_CHANNEL; - // Bst.g:61:8: ( 'READ' ) + int _channel = DEFAULT_TOKEN_CHANNEL; + // Bst.g:61:6: ( 'READ' ) // Bst.g:61:8: 'READ' { match("READ"); @@ -570,29 +415,20 @@ } - - - if ( token==null && ruleNestingLevel==1 ) { - emit(_type,_line,_charPosition,_channel,_start,getCharIndex()-1); - } - - } + state.type = _type; + state.channel = _channel; + } finally { - ruleNestingLevel--; } } - // $ANTLR end READ + // $ANTLR end "READ" - // $ANTLR start MACRO - public void mMACRO() throws RecognitionException { + // $ANTLR start "MACRO" + public final void mMACRO() throws RecognitionException { try { - ruleNestingLevel++; int _type = MACRO; - int _start = getCharIndex(); - int _line = getLine(); - int _charPosition = getCharPositionInLine(); - int _channel = Token.DEFAULT_CHANNEL; - // Bst.g:62:9: ( 'MACRO' ) + int _channel = DEFAULT_TOKEN_CHANNEL; + // Bst.g:62:7: ( 'MACRO' ) // Bst.g:62:9: 'MACRO' { match("MACRO"); @@ -600,29 +436,20 @@ } - - - if ( token==null && ruleNestingLevel==1 ) { - emit(_type,_line,_charPosition,_channel,_start,getCharIndex()-1); - } - - } + state.type = _type; + state.channel = _channel; + } finally { - ruleNestingLevel--; } } - // $ANTLR end MACRO + // $ANTLR end "MACRO" - // $ANTLR start QUOTED - public void mQUOTED() throws RecognitionException { + // $ANTLR start "QUOTED" + public final void mQUOTED() throws RecognitionException { try { - ruleNestingLevel++; int _type = QUOTED; - int _start = getCharIndex(); - int _line = getLine(); - int _charPosition = getCharPositionInLine(); - int _channel = Token.DEFAULT_CHANNEL; - // Bst.g:65:4: ( '\\'' IDENTIFIER ) + int _channel = DEFAULT_TOKEN_CHANNEL; + // Bst.g:65:2: ( '\\'' IDENTIFIER ) // Bst.g:65:4: '\\'' IDENTIFIER { match('\''); @@ -630,29 +457,20 @@ } - - - if ( token==null && ruleNestingLevel==1 ) { - emit(_type,_line,_charPosition,_channel,_start,getCharIndex()-1); - } - - } + state.type = _type; + state.channel = _channel; + } finally { - ruleNestingLevel--; } } - // $ANTLR end QUOTED + // $ANTLR end "QUOTED" - // $ANTLR start IDENTIFIER - public void mIDENTIFIER() throws RecognitionException { + // $ANTLR start "IDENTIFIER" + public final void mIDENTIFIER() throws RecognitionException { try { - ruleNestingLevel++; int _type = IDENTIFIER; - int _start = getCharIndex(); - int _line = getLine(); - int _charPosition = getCharPositionInLine(); - int _channel = Token.DEFAULT_CHANNEL; - // Bst.g:68:4: ( LETTER ( LETTER | NUMERAL )* ) + int _channel = DEFAULT_TOKEN_CHANNEL; + // Bst.g:68:2: ( LETTER ( LETTER | NUMERAL )* ) // Bst.g:68:4: LETTER ( LETTER | NUMERAL )* { mLETTER(); @@ -661,6 +479,7 @@ do { int alt1=3; int LA1_0 = input.LA(1); + if ( (LA1_0=='$'||LA1_0=='.'||(LA1_0>='A' && LA1_0<='Z')||(LA1_0>='a' && LA1_0<='z')) ) { alt1=1; } @@ -693,82 +512,70 @@ } - - - if ( token==null && ruleNestingLevel==1 ) { - emit(_type,_line,_charPosition,_channel,_start,getCharIndex()-1); - } - - } + state.type = _type; + state.channel = _channel; + } finally { - ruleNestingLevel--; } } - // $ANTLR end IDENTIFIER + // $ANTLR end "IDENTIFIER" - // $ANTLR start LETTER - public void mLETTER() throws RecognitionException { + // $ANTLR start "LETTER" + public final void mLETTER() throws RecognitionException { try { - ruleNestingLevel++; - // Bst.g:71:4: ( ('a'..'z'|'A'..'Z'|'.'|'$')) - // Bst.g:71:4: ('a'..'z'|'A'..'Z'|'.'|'$') + // Bst.g:71:2: ( ( 'a' .. 'z' | 'A' .. 'Z' | '.' | '$' ) ) + // Bst.g:71:4: ( 'a' .. 'z' | 'A' .. 'Z' | '.' | '$' ) { if ( input.LA(1)=='$'||input.LA(1)=='.'||(input.LA(1)>='A' && input.LA(1)<='Z')||(input.LA(1)>='a' && input.LA(1)<='z') ) { input.consume(); } else { - MismatchedSetException mse = - new MismatchedSetException(null,input); - recover(mse); throw mse; - } + MismatchedSetException mse = new MismatchedSetException(null,input); + recover(mse); + throw mse;} } } finally { - ruleNestingLevel--; } } - // $ANTLR end LETTER + // $ANTLR end "LETTER" - // $ANTLR start STRING - public void mSTRING() throws RecognitionException { + // $ANTLR start "STRING" + public final void mSTRING() throws RecognitionException { try { - ruleNestingLevel++; int _type = STRING; - int _start = getCharIndex(); - int _line = getLine(); - int _charPosition = getCharPositionInLine(); - int _channel = Token.DEFAULT_CHANNEL; - // Bst.g:74:4: ( '\"' (~ '\"' )* '\"' ) - // Bst.g:74:4: '\"' (~ '\"' )* '\"' + int _channel = DEFAULT_TOKEN_CHANNEL; + // Bst.g:74:2: ( '\"' (~ ( '\"' ) )* '\"' ) + // Bst.g:74:4: '\"' (~ ( '\"' ) )* '\"' { match('\"'); - // Bst.g:74:8: (~ '\"' )* + // Bst.g:74:8: (~ ( '\"' ) )* loop2: do { int alt2=2; int LA2_0 = input.LA(1); - if ( ((LA2_0>='\u0000' && LA2_0<='!')||(LA2_0>='#' && LA2_0<='\uFFFE')) ) { + + if ( ((LA2_0>='\u0000' && LA2_0<='!')||(LA2_0>='#' && LA2_0<='\uFFFF')) ) { alt2=1; } switch (alt2) { case 1 : - // Bst.g:74:9: ~ '\"' + // Bst.g:74:9: ~ ( '\"' ) { - if ( (input.LA(1)>='\u0000' && input.LA(1)<='!')||(input.LA(1)>='#' && input.LA(1)<='\uFFFE') ) { + if ( (input.LA(1)>='\u0000' && input.LA(1)<='!')||(input.LA(1)>='#' && input.LA(1)<='\uFFFF') ) { input.consume(); } else { - MismatchedSetException mse = - new MismatchedSetException(null,input); - recover(mse); throw mse; - } + MismatchedSetException mse = new MismatchedSetException(null,input); + recover(mse); + throw mse;} } @@ -783,51 +590,42 @@ } - - - if ( token==null && ruleNestingLevel==1 ) { - emit(_type,_line,_charPosition,_channel,_start,getCharIndex()-1); - } - - } + state.type = _type; + state.channel = _channel; + } finally { - ruleNestingLevel--; } } - // $ANTLR end STRING + // $ANTLR end "STRING" - // $ANTLR start INTEGER - public void mINTEGER() throws RecognitionException { + // $ANTLR start "INTEGER" + public final void mINTEGER() throws RecognitionException { try { - ruleNestingLevel++; int _type = INTEGER; - int _start = getCharIndex(); - int _line = getLine(); - int _charPosition = getCharPositionInLine(); - int _channel = Token.DEFAULT_CHANNEL; - // Bst.g:77:4: ( '#' ( ('+'|'-'))? ( NUMERAL )+ ) - // Bst.g:77:4: '#' ( ('+'|'-'))? ( NUMERAL )+ + int _channel = DEFAULT_TOKEN_CHANNEL; + // Bst.g:77:2: ( '#' ( '+' | '-' )? ( NUMERAL )+ ) + // Bst.g:77:4: '#' ( '+' | '-' )? ( NUMERAL )+ { match('#'); - // Bst.g:77:8: ( ('+'|'-'))? + // Bst.g:77:8: ( '+' | '-' )? int alt3=2; int LA3_0 = input.LA(1); + if ( (LA3_0=='+'||LA3_0=='-') ) { alt3=1; } switch (alt3) { case 1 : - // Bst.g:77:9: ('+'|'-') + // Bst.g: { if ( input.LA(1)=='+'||input.LA(1)=='-' ) { input.consume(); } else { - MismatchedSetException mse = - new MismatchedSetException(null,input); - recover(mse); throw mse; - } + MismatchedSetException mse = new MismatchedSetException(null,input); + recover(mse); + throw mse;} } @@ -841,6 +639,7 @@ do { int alt4=2; int LA4_0 = input.LA(1); + if ( ((LA4_0>='0' && LA4_0<='9')) ) { alt4=1; } @@ -867,24 +666,18 @@ } - - - if ( token==null && ruleNestingLevel==1 ) { - emit(_type,_line,_charPosition,_channel,_start,getCharIndex()-1); - } - - } + state.type = _type; + state.channel = _channel; + } finally { - ruleNestingLevel--; } } - // $ANTLR end INTEGER + // $ANTLR end "INTEGER" - // $ANTLR start NUMERAL - public void mNUMERAL() throws RecognitionException { + // $ANTLR start "NUMERAL" + public final void mNUMERAL() throws RecognitionException { try { - ruleNestingLevel++; - // Bst.g:80:4: ( ( '0' .. '9' ) ) + // Bst.g:80:2: ( ( '0' .. '9' ) ) // Bst.g:80:4: ( '0' .. '9' ) { // Bst.g:80:4: ( '0' .. '9' ) @@ -899,47 +692,42 @@ } finally { - ruleNestingLevel--; } } - // $ANTLR end NUMERAL + // $ANTLR end "NUMERAL" - // $ANTLR start WS - public void mWS() throws RecognitionException { + // $ANTLR start "WS" + public final void mWS() throws RecognitionException { try { - ruleNestingLevel++; int _type = WS; - int _start = getCharIndex(); - int _line = getLine(); - int _charPosition = getCharPositionInLine(); - int _channel = Token.DEFAULT_CHANNEL; - // Bst.g:82:9: ( ( (' '|'\\t'|'\\r'|'\\n'))+ ) - // Bst.g:82:9: ( (' '|'\\t'|'\\r'|'\\n'))+ + int _channel = DEFAULT_TOKEN_CHANNEL; + // Bst.g:83:2: ( ( ' ' | '\\t' | '\\n' )+ ) + // Bst.g:83:4: ( ' ' | '\\t' | '\\n' )+ { - // Bst.g:82:9: ( (' '|'\\t'|'\\r'|'\\n'))+ + // Bst.g:83:4: ( ' ' | '\\t' | '\\n' )+ int cnt5=0; loop5: do { int alt5=2; int LA5_0 = input.LA(1); - if ( ((LA5_0>='\t' && LA5_0<='\n')||LA5_0=='\r'||LA5_0==' ') ) { + + if ( ((LA5_0>='\t' && LA5_0<='\n')||LA5_0==' ') ) { alt5=1; } switch (alt5) { case 1 : - // Bst.g:82:13: (' '|'\\t'|'\\r'|'\\n') + // Bst.g: { - if ( (input.LA(1)>='\t' && input.LA(1)<='\n')||input.LA(1)=='\r'||input.LA(1)==' ' ) { + if ( (input.LA(1)>='\t' && input.LA(1)<='\n')||input.LA(1)==' ' ) { input.consume(); } else { - MismatchedSetException mse = - new MismatchedSetException(null,input); - recover(mse); throw mse; - } + MismatchedSetException mse = new MismatchedSetException(null,input); + recover(mse); + throw mse;} } @@ -954,59 +742,50 @@ cnt5++; } while (true); - _channel=HIDDEN; + _channel=99; } - - - if ( token==null && ruleNestingLevel==1 ) { - emit(_type,_line,_charPosition,_channel,_start,getCharIndex()-1); - } - - } + state.type = _type; + state.channel = _channel; + } finally { - ruleNestingLevel--; } } - // $ANTLR end WS + // $ANTLR end "WS" - // $ANTLR start LINE_COMMENT - public void mLINE_COMMENT() throws RecognitionException { + // $ANTLR start "LINE_COMMENT" + public final void mLINE_COMMENT() throws RecognitionException { try { - ruleNestingLevel++; int _type = LINE_COMMENT; - int _start = getCharIndex(); - int _line = getLine(); - int _charPosition = getCharPositionInLine(); - int _channel = Token.DEFAULT_CHANNEL; - // Bst.g:90:7: ( '%' (~ ('\\n'|'\\r'))* ( '\\r' )? '\\n' ) - // Bst.g:90:7: '%' (~ ('\\n'|'\\r'))* ( '\\r' )? '\\n' + int _channel = DEFAULT_TOKEN_CHANNEL; + // Bst.g:86:5: ( '%' (~ ( '\\n' | '\\r' ) )* ( '\\r' )? '\\n' ) + // Bst.g:86:7: '%' (~ ( '\\n' | '\\r' ) )* ( '\\r' )? '\\n' { match('%'); - // Bst.g:90:11: (~ ('\\n'|'\\r'))* + // Bst.g:86:11: (~ ( '\\n' | '\\r' ) )* loop6: do { int alt6=2; int LA6_0 = input.LA(1); - if ( ((LA6_0>='\u0000' && LA6_0<='\t')||(LA6_0>='\u000B' && LA6_0<='\f')||(LA6_0>='\u000E' && LA6_0<='\uFFFE')) ) { + + if ( ((LA6_0>='\u0000' && LA6_0<='\t')||(LA6_0>='\u000B' && LA6_0<='\f')||(LA6_0>='\u000E' && LA6_0<='\uFFFF')) ) { alt6=1; } switch (alt6) { case 1 : - // Bst.g:90:11: ~ ('\\n'|'\\r') + // Bst.g:86:11: ~ ( '\\n' | '\\r' ) { - if ( (input.LA(1)>='\u0000' && input.LA(1)<='\t')||(input.LA(1)>='\u000B' && input.LA(1)<='\f')||(input.LA(1)>='\u000E' && input.LA(1)<='\uFFFE') ) { + if ( (input.LA(1)>='\u0000' && input.LA(1)<='\t')||(input.LA(1)>='\u000B' && input.LA(1)<='\f')||(input.LA(1)>='\u000E' && input.LA(1)<='\uFFFF') ) { input.consume(); } else { - MismatchedSetException mse = - new MismatchedSetException(null,input); - recover(mse); throw mse; - } + MismatchedSetException mse = new MismatchedSetException(null,input); + recover(mse); + throw mse;} } @@ -1017,15 +796,16 @@ } } while (true); - // Bst.g:90:25: ( '\\r' )? + // Bst.g:86:25: ( '\\r' )? int alt7=2; int LA7_0 = input.LA(1); + if ( (LA7_0=='\r') ) { alt7=1; } switch (alt7) { case 1 : - // Bst.g:90:25: '\\r' + // Bst.g:86:25: '\\r' { match('\r'); @@ -1035,619 +815,193 @@ } match('\n'); - _channel=HIDDEN; + _channel=99; } - - - if ( token==null && ruleNestingLevel==1 ) { - emit(_type,_line,_charPosition,_channel,_start,getCharIndex()-1); - } - - } + state.type = _type; + state.channel = _channel; + } finally { - ruleNestingLevel--; } } - // $ANTLR end LINE_COMMENT + // $ANTLR end "LINE_COMMENT" public void mTokens() throws RecognitionException { - // Bst.g:1:10: ( T25 | T26 | T27 | T28 | T29 | T30 | T31 | T32 | T33 | STRINGS | INTEGERS | FUNCTION | EXECUTE | SORT | ITERATE | REVERSE | ENTRY | READ | MACRO | QUOTED | IDENTIFIER | STRING | INTEGER | WS | LINE_COMMENT ) + // Bst.g:1:8: ( T__25 | T__26 | T__27 | T__28 | T__29 | T__30 | T__31 | T__32 | T__33 | STRINGS | INTEGERS | FUNCTION | EXECUTE | SORT | ITERATE | REVERSE | ENTRY | READ | MACRO | QUOTED | IDENTIFIER | STRING | INTEGER | WS | LINE_COMMENT ) int alt8=25; - switch ( input.LA(1) ) { - case '{': - alt8=1; - break; - case '}': - alt8=2; - break; - case '<': - alt8=3; - break; - case '>': - alt8=4; - break; - case '=': - alt8=5; - break; - case '+': - alt8=6; - break; - case '-': - alt8=7; - break; - case ':': - alt8=8; - break; - case '*': - alt8=9; - break; - case 'S': - switch ( input.LA(2) ) { - case 'T': - int LA8_22 = input.LA(3); - if ( (LA8_22=='R') ) { - int LA8_31 = input.LA(4); - if ( (LA8_31=='I') ) { - int LA8_41 = input.LA(5); - if ( (LA8_41=='N') ) { - int LA8_51 = input.LA(6); - if ( (LA8_51=='G') ) { - int LA8_61 = input.LA(7); - if ( (LA8_61=='S') ) { - int LA8_69 = input.LA(8); - if ( (LA8_69=='$'||LA8_69=='.'||(LA8_69>='0' && LA8_69<='9')||(LA8_69>='A' && LA8_69<='Z')||(LA8_69>='a' && LA8_69<='z')) ) { - alt8=21; - } - else { - alt8=10;} - } - else { - alt8=21;} - } - else { - alt8=21;} - } - else { - alt8=21;} - } - else { - alt8=21;} - } - else { - alt8=21;} - break; - case 'O': - int LA8_23 = input.LA(3); - if ( (LA8_23=='R') ) { - int LA8_32 = input.LA(4); - if ( (LA8_32=='T') ) { - int LA8_42 = input.LA(5); - if ( (LA8_42=='$'||LA8_42=='.'||(LA8_42>='0' && LA8_42<='9')||(LA8_42>='A' && LA8_42<='Z')||(LA8_42>='a' && LA8_42<='z')) ) { - alt8=21; - } - else { - alt8=14;} - } - else { - alt8=21;} - } - else { - alt8=21;} - break; - default: - alt8=21;} - - break; - case 'I': - switch ( input.LA(2) ) { - case 'T': - int LA8_24 = input.LA(3); - if ( (LA8_24=='E') ) { - int LA8_33 = input.LA(4); - if ( (LA8_33=='R') ) { - int LA8_43 = input.LA(5); - if ( (LA8_43=='A') ) { - int LA8_53 = input.LA(6); - if ( (LA8_53=='T') ) { - int LA8_62 = input.LA(7); - if ( (LA8_62=='E') ) { - int LA8_70 = input.LA(8); - if ( (LA8_70=='$'||LA8_70=='.'||(LA8_70>='0' && LA8_70<='9')||(LA8_70>='A' && LA8_70<='Z')||(LA8_70>='a' && LA8_70<='z')) ) { - alt8=21; - } - else { - alt8=15;} - } - else { - alt8=21;} - } - else { - alt8=21;} - } - else { - alt8=21;} - } - else { - alt8=21;} - } - else { - alt8=21;} - break; - case 'N': - int LA8_25 = input.LA(3); - if ( (LA8_25=='T') ) { - int LA8_34 = input.LA(4); - if ( (LA8_34=='E') ) { - int LA8_44 = input.LA(5); - if ( (LA8_44=='G') ) { - int LA8_54 = input.LA(6); - if ( (LA8_54=='E') ) { - int LA8_63 = input.LA(7); - if ( (LA8_63=='R') ) { - int LA8_71 = input.LA(8); - if ( (LA8_71=='S') ) { - int LA8_77 = input.LA(9); - if ( (LA8_77=='$'||LA8_77=='.'||(LA8_77>='0' && LA8_77<='9')||(LA8_77>='A' && LA8_77<='Z')||(LA8_77>='a' && LA8_77<='z')) ) { - alt8=21; - } - else { - alt8=11;} - } - else { - alt8=21;} - } - else { - alt8=21;} - } - else { - alt8=21;} - } - else { - alt8=21;} - } - else { - alt8=21;} - } - else { - alt8=21;} - break; - default: - alt8=21;} - - break; - case 'F': - int LA8_12 = input.LA(2); - if ( (LA8_12=='U') ) { - int LA8_26 = input.LA(3); - if ( (LA8_26=='N') ) { - int LA8_35 = input.LA(4); - if ( (LA8_35=='C') ) { - int LA8_45 = input.LA(5); - if ( (LA8_45=='T') ) { - int LA8_55 = input.LA(6); - if ( (LA8_55=='I') ) { - int LA8_64 = input.LA(7); - if ( (LA8_64=='O') ) { - int LA8_72 = input.LA(8); - if ( (LA8_72=='N') ) { - int LA8_78 = input.LA(9); - if ( (LA8_78=='$'||LA8_78=='.'||(LA8_78>='0' && LA8_78<='9')||(LA8_78>='A' && LA8_78<='Z')||(LA8_78>='a' && LA8_78<='z')) ) { - alt8=21; - } - else { - alt8=12;} - } - else { - alt8=21;} - } - else { - alt8=21;} - } - else { - alt8=21;} - } - else { - alt8=21;} - } - else { - alt8=21;} - } - else { - alt8=21;} - } - else { - alt8=21;} - break; - case 'E': - switch ( input.LA(2) ) { - case 'N': - int LA8_27 = input.LA(3); - if ( (LA8_27=='T') ) { - int LA8_36 = input.LA(4); - if ( (LA8_36=='R') ) { - int LA8_46 = input.LA(5); - if ( (LA8_46=='Y') ) { - int LA8_56 = input.LA(6); - if ( (LA8_56=='$'||LA8_56=='.'||(LA8_56>='0' && LA8_56<='9')||(LA8_56>='A' && LA8_56<='Z')||(LA8_56>='a' && LA8_56<='z')) ) { - alt8=21; - } - else { - alt8=17;} - } - else { - alt8=21;} - } - else { - alt8=21;} - } - else { - alt8=21;} - break; - case 'X': - int LA8_28 = input.LA(3); - if ( (LA8_28=='E') ) { - int LA8_37 = input.LA(4); - if ( (LA8_37=='C') ) { - int LA8_47 = input.LA(5); - if ( (LA8_47=='U') ) { - int LA8_57 = input.LA(6); - if ( (LA8_57=='T') ) { - int LA8_66 = input.LA(7); - if ( (LA8_66=='E') ) { - int LA8_73 = input.LA(8); - if ( (LA8_73=='$'||LA8_73=='.'||(LA8_73>='0' && LA8_73<='9')||(LA8_73>='A' && LA8_73<='Z')||(LA8_73>='a' && LA8_73<='z')) ) { - alt8=21; - } - else { - alt8=13;} - } - else { - alt8=21;} - } - else { - alt8=21;} - } - else { - alt8=21;} - } - else { - alt8=21;} - } - else { - alt8=21;} - break; - default: - alt8=21;} - - break; - case 'R': - int LA8_14 = input.LA(2); - if ( (LA8_14=='E') ) { - switch ( input.LA(3) ) { - case 'A': - int LA8_38 = input.LA(4); - if ( (LA8_38=='D') ) { - int LA8_48 = input.LA(5); - if ( (LA8_48=='$'||LA8_48=='.'||(LA8_48>='0' && LA8_48<='9')||(LA8_48>='A' && LA8_48<='Z')||(LA8_48>='a' && LA8_48<='z')) ) { - alt8=21; - } - else { - alt8=18;} - } - else { - alt8=21;} - break; - case 'V': - int LA8_39 = input.LA(4); - if ( (LA8_39=='E') ) { - int LA8_49 = input.LA(5); - if ( (LA8_49=='R') ) { - int LA8_59 = input.LA(6); - if ( (LA8_59=='S') ) { - int LA8_67 = input.LA(7); - if ( (LA8_67=='E') ) { - int LA8_74 = input.LA(8); - if ( (LA8_74=='$'||LA8_74=='.'||(LA8_74>='0' && LA8_74<='9')||(LA8_74>='A' && LA8_74<='Z')||(LA8_74>='a' && LA8_74<='z')) ) { - alt8=21; - } - else { - alt8=16;} - } - else { - alt8=21;} - } - else { - alt8=21;} - } - else { - alt8=21;} - } - else { - alt8=21;} - break; - default: - alt8=21;} - - } - else { - alt8=21;} - break; - case 'M': - int LA8_15 = input.LA(2); - if ( (LA8_15=='A') ) { - int LA8_30 = input.LA(3); - if ( (LA8_30=='C') ) { - int LA8_40 = input.LA(4); - if ( (LA8_40=='R') ) { - int LA8_50 = input.LA(5); - if ( (LA8_50=='O') ) { - int LA8_60 = input.LA(6); - if ( (LA8_60=='$'||LA8_60=='.'||(LA8_60>='0' && LA8_60<='9')||(LA8_60>='A' && LA8_60<='Z')||(LA8_60>='a' && LA8_60<='z')) ) { - alt8=21; - } - else { - alt8=19;} - } - else { - alt8=21;} - } - else { - alt8=21;} - } - else { - alt8=21;} - } - else { - alt8=21;} - break; - case '\'': - alt8=20; - break; - case '$': - case '.': - case 'A': - case 'B': - case 'C': - case 'D': - case 'G': - case 'H': - case 'J': - case 'K': - case 'L': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': - alt8=21; - break; - case '\"': - alt8=22; - break; - case '#': - alt8=23; - break; - case '\t': - case '\n': - case '\r': - case ' ': - alt8=24; - break; - case '%': - alt8=25; - break; - default: - NoViableAltException nvae = - new NoViableAltException("1:1: Tokens : ( T25 | T26 | T27 | T28 | T29 | T30 | T31 | T32 | T33 | STRINGS | INTEGERS | FUNCTION | EXECUTE | SORT | ITERATE | REVERSE | ENTRY | READ | MACRO | QUOTED | IDENTIFIER | STRING | INTEGER | WS | LINE_COMMENT );", 8, 0, input); - - throw nvae; - } - + alt8 = dfa8.predict(input); switch (alt8) { case 1 : - // Bst.g:1:10: T25 + // Bst.g:1:10: T__25 { - mT25(); + mT__25(); } break; case 2 : - // Bst.g:1:14: T26 + // Bst.g:1:16: T__26 { - mT26(); + mT__26(); } break; case 3 : - // Bst.g:1:18: T27 + // Bst.g:1:22: T__27 { - mT27(); + mT__27(); } break; case 4 : - // Bst.g:1:22: T28 + // Bst.g:1:28: T__28 { - mT28(); + mT__28(); } break; case 5 : - // Bst.g:1:26: T29 + // Bst.g:1:34: T__29 { - mT29(); + mT__29(); } break; case 6 : - // Bst.g:1:30: T30 + // Bst.g:1:40: T__30 { - mT30(); + mT__30(); } break; case 7 : - // Bst.g:1:34: T31 + // Bst.g:1:46: T__31 { - mT31(); + mT__31(); } break; case 8 : - // Bst.g:1:38: T32 + // Bst.g:1:52: T__32 { - mT32(); + mT__32(); } break; case 9 : - // Bst.g:1:42: T33 + // Bst.g:1:58: T__33 { - mT33(); + mT__33(); } break; case 10 : - // Bst.g:1:46: STRINGS + // Bst.g:1:64: STRINGS { mSTRINGS(); } break; case 11 : - // Bst.g:1:54: INTEGERS + // Bst.g:1:72: INTEGERS { mINTEGERS(); } break; case 12 : - // Bst.g:1:63: FUNCTION + // Bst.g:1:81: FUNCTION { mFUNCTION(); } break; case 13 : - // Bst.g:1:72: EXECUTE + // Bst.g:1:90: EXECUTE { mEXECUTE(); } break; case 14 : - // Bst.g:1:80: SORT + // Bst.g:1:98: SORT { mSORT(); } break; case 15 : - // Bst.g:1:85: ITERATE + // Bst.g:1:103: ITERATE { mITERATE(); } break; case 16 : - // Bst.g:1:93: REVERSE + // Bst.g:1:111: REVERSE { mREVERSE(); } break; case 17 : - // Bst.g:1:101: ENTRY + // Bst.g:1:119: ENTRY { mENTRY(); } break; case 18 : - // Bst.g:1:107: READ + // Bst.g:1:125: READ { mREAD(); } break; case 19 : - // Bst.g:1:112: MACRO + // Bst.g:1:130: MACRO { mMACRO(); } break; case 20 : - // Bst.g:1:118: QUOTED + // Bst.g:1:136: QUOTED { mQUOTED(); } break; case 21 : - // Bst.g:1:125: IDENTIFIER + // Bst.g:1:143: IDENTIFIER { mIDENTIFIER(); } break; case 22 : - // Bst.g:1:136: STRING + // Bst.g:1:154: STRING { mSTRING(); } break; case 23 : - // Bst.g:1:143: INTEGER + // Bst.g:1:161: INTEGER { mINTEGER(); } break; case 24 : - // Bst.g:1:151: WS + // Bst.g:1:169: WS { mWS(); } break; case 25 : - // Bst.g:1:154: LINE_COMMENT + // Bst.g:1:172: LINE_COMMENT { mLINE_COMMENT(); @@ -1659,6 +1013,167 @@ } + protected DFA8 dfa8 = new DFA8(this); + static final String DFA8_eotS = + "\12\uffff\6\21\6\uffff\24\21\1\64\6\21\1\73\2\21\1\uffff\4\21\1"+ + "\102\1\21\1\uffff\1\104\5\21\1\uffff\1\21\1\uffff\1\113\1\21\1\115"+ + "\1\21\1\117\1\120\1\uffff\1\121\1\uffff\1\122\4\uffff"; + static final String DFA8_eofS = + "\123\uffff"; + static final String DFA8_minS = + "\1\11\11\uffff\1\117\1\116\1\125\1\116\1\105\1\101\6\uffff\2\122"+ + "\1\124\1\105\1\116\1\105\1\124\1\101\1\103\1\111\1\124\1\105\1\122"+ + "\2\103\1\122\1\105\1\104\1\122\1\116\1\44\1\107\1\101\1\124\1\125"+ + "\1\131\1\122\1\44\1\117\1\107\1\uffff\1\105\1\124\1\111\1\124\1"+ + "\44\1\123\1\uffff\1\44\1\123\1\122\1\105\1\117\1\105\1\uffff\1\105"+ + "\1\uffff\1\44\1\123\1\44\1\116\2\44\1\uffff\1\44\1\uffff\1\44\4"+ + "\uffff"; + static final String DFA8_maxS = + "\1\175\11\uffff\2\124\1\125\1\130\1\105\1\101\6\uffff\2\122\1\124"+ + "\1\105\1\116\1\105\1\124\1\126\1\103\1\111\1\124\1\105\1\122\2\103"+ + "\1\122\1\105\1\104\1\122\1\116\1\172\1\107\1\101\1\124\1\125\1\131"+ + "\1\122\1\172\1\117\1\107\1\uffff\1\105\1\124\1\111\1\124\1\172\1"+ + "\123\1\uffff\1\172\1\123\1\122\1\105\1\117\1\105\1\uffff\1\105\1"+ + "\uffff\1\172\1\123\1\172\1\116\2\172\1\uffff\1\172\1\uffff\1\172"+ + "\4\uffff"; + static final String DFA8_acceptS = + "\1\uffff\1\1\1\2\1\3\1\4\1\5\1\6\1\7\1\10\1\11\6\uffff\1\24\1\25"+ + "\1\26\1\27\1\30\1\31\36\uffff\1\16\6\uffff\1\22\6\uffff\1\21\1\uffff"+ + "\1\23\6\uffff\1\12\1\uffff\1\17\1\uffff\1\15\1\20\1\13\1\14"; + static final String DFA8_specialS = + "\123\uffff}>"; + static final String[] DFA8_transitionS = { + "\2\24\25\uffff\1\24\1\uffff\1\22\1\23\1\21\1\25\1\uffff\1\20"+ + "\2\uffff\1\11\1\6\1\uffff\1\7\1\21\13\uffff\1\10\1\uffff\1\3"+ + "\1\5\1\4\2\uffff\4\21\1\15\1\14\2\21\1\13\3\21\1\17\4\21\1\16"+ + "\1\12\7\21\6\uffff\32\21\1\1\1\uffff\1\2", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "\1\27\4\uffff\1\26", + "\1\30\5\uffff\1\31", + "\1\32", + "\1\34\11\uffff\1\33", + "\1\35", + "\1\36", + "", + "", + "", + "", + "", + "", + "\1\37", + "\1\40", + "\1\41", + "\1\42", + "\1\43", + "\1\44", + "\1\45", + "\1\47\24\uffff\1\46", + "\1\50", + "\1\51", + "\1\52", + "\1\53", + "\1\54", + "\1\55", + "\1\56", + "\1\57", + "\1\60", + "\1\61", + "\1\62", + "\1\63", + "\1\21\11\uffff\1\21\1\uffff\12\21\7\uffff\32\21\6\uffff\32"+ + "\21", + "\1\65", + "\1\66", + "\1\67", + "\1\70", + "\1\71", + "\1\72", + "\1\21\11\uffff\1\21\1\uffff\12\21\7\uffff\32\21\6\uffff\32"+ + "\21", + "\1\74", + "\1\75", + "", + "\1\76", + "\1\77", + "\1\100", + "\1\101", + "\1\21\11\uffff\1\21\1\uffff\12\21\7\uffff\32\21\6\uffff\32"+ + "\21", + "\1\103", + "", + "\1\21\11\uffff\1\21\1\uffff\12\21\7\uffff\32\21\6\uffff\32"+ + "\21", + "\1\105", + "\1\106", + "\1\107", + "\1\110", + "\1\111", + "", + "\1\112", + "", + "\1\21\11\uffff\1\21\1\uffff\12\21\7\uffff\32\21\6\uffff\32"+ + "\21", + "\1\114", + "\1\21\11\uffff\1\21\1\uffff\12\21\7\uffff\32\21\6\uffff\32"+ + "\21", + "\1\116", + "\1\21\11\uffff\1\21\1\uffff\12\21\7\uffff\32\21\6\uffff\32"+ + "\21", + "\1\21\11\uffff\1\21\1\uffff\12\21\7\uffff\32\21\6\uffff\32"+ + "\21", + "", + "\1\21\11\uffff\1\21\1\uffff\12\21\7\uffff\32\21\6\uffff\32"+ + "\21", + "", + "\1\21\11\uffff\1\21\1\uffff\12\21\7\uffff\32\21\6\uffff\32"+ + "\21", + "", + "", + "", + "" + }; + + static final short[] DFA8_eot = DFA.unpackEncodedString(DFA8_eotS); + static final short[] DFA8_eof = DFA.unpackEncodedString(DFA8_eofS); + static final char[] DFA8_min = DFA.unpackEncodedStringToUnsignedChars(DFA8_minS); + static final char[] DFA8_max = DFA.unpackEncodedStringToUnsignedChars(DFA8_maxS); + static final short[] DFA8_accept = DFA.unpackEncodedString(DFA8_acceptS); + static final short[] DFA8_special = DFA.unpackEncodedString(DFA8_specialS); + static final short[][] DFA8_transition; + + static { + int numStates = DFA8_transitionS.length; + DFA8_transition = new short[numStates][]; + for (int i=0; i ^(COMMANDS commands+); + +commands + : STRINGS^ idList + | INTEGERS^ idList + | FUNCTION^ id stack + | MACRO^ id '{'! STRING '}'! + | READ^ + | EXECUTE^ '{'! function '}'! + | ITERATE^ '{'! function '}'! + | REVERSE^ '{'! function '}'! + | ENTRY^ idList0 idList0 idList0 + | SORT^; + +identifier + : IDENTIFIER; + +id + : '{'! identifier '}'!; + +idList + : '{' identifier+ '}' -> ^(IDLIST identifier+); + +idList0 + : '{' identifier* '}' -> ^(IDLIST identifier*); + +function + : '<' | '>' | '=' | '+' | '-' | ':=' | '*' | identifier; + +stack + : '{' stackitem+ '}' -> ^(STACK stackitem+); + +stackitem + : function + | STRING + | INTEGER + | QUOTED + | stack; + +STRINGS : 'STRINGS'; +INTEGERS : 'INTEGERS'; +FUNCTION : 'FUNCTION'; +EXECUTE : 'EXECUTE'; +SORT : 'SORT'; +ITERATE : 'ITERATE'; +REVERSE : 'REVERSE'; +ENTRY : 'ENTRY'; +READ : 'READ'; +MACRO : 'MACRO'; + +QUOTED + : '\'' IDENTIFIER; + +IDENTIFIER + : LETTER (LETTER|NUMERAL)* ; + +fragment LETTER + : ('a'..'z'|'A'..'Z'|'.'|'$'); + +STRING + : '"' (~('"'))* '"'; + +INTEGER + : '#' ('+'|'-')? NUMERAL+ ; + +fragment NUMERAL + : ('0'..'9'); + +WS + : (' '|'\t'|'\n')+ {channel=99;} ; + +LINE_COMMENT + : '%' ~('\n'|'\r')* '\r'? '\n' {channel=99;} + ; +