📄 prolexer.java
字号:
// $ANTLR 3.0 PRO.g 2007-07-14 13:28:13import org.antlr.runtime.*;import java.util.Stack;import java.util.List;import java.util.ArrayList;public class PROLexer extends Lexer { public static final int FUNCTION=12; public static final int WHILE=20; public static final int MOD=35; public static final int LETTER=42; public static final int DIGITS=39; public static final int DO=21; public static final int SEPARATOR=5; public static final int NOT=22; public static final int AND=36; public static final int ID=6; public static final int ASSIGNOP=16; public static final int EOF=-1; public static final int ADDOPA=29; public static final int IF=17; public static final int SMALL=26; public static final int THEN=18; public static final int ADDOPB=30; public static final int OPTIONAL_FRACTION=40; public static final int BEGIN=14; public static final int EQUAL=23; public static final int MULOPA=32; public static final int MULOPB=33; public static final int VAR=7; public static final int DIGIT=43; public static final int ARRAY=8; public static final int NB=25; public static final int INTEGER=10; public static final int GRAT=28; public static final int NS=27; public static final int ELSE=19; public static final int T49=49; public static final int T48=48; public static final int Tokens=55; public static final int OF=37; public static final int PROCEDURE=13; public static final int T47=47; public static final int T46=46; public static final int NUM=9; public static final int T45=45; public static final int REAL=11; public static final int WS=44; public static final int NEQ=24; public static final int NEWLINE=38; public static final int T50=50; public static final int OR=31; public static final int PROGRAM=4; public static final int DIV=34; public static final int T52=52; public static final int OPTIONAL_EXPONENT=41; public static final int END=15; public static final int T51=51; public static final int T54=54; public static final int T53=53; public PROLexer() {;} public PROLexer(CharStream input) { super(input); } public String getGrammarFileName() { return "PRO.g"; } // $ANTLR start T45 public final void mT45() throws RecognitionException { try { int _type = T45; // PRO.g:4:7: ( '(' ) // PRO.g:4:7: '(' { match('('); } this.type = _type; } finally { } } // $ANTLR end T45 // $ANTLR start T46 public final void mT46() throws RecognitionException { try { int _type = T46; // PRO.g:5:7: ( ')' ) // PRO.g:5:7: ')' { match(')'); } this.type = _type; } finally { } } // $ANTLR end T46 // $ANTLR start T47 public final void mT47() throws RecognitionException { try { int _type = T47; // PRO.g:6:7: ( '.' ) // PRO.g:6:7: '.' { match('.'); } this.type = _type; } finally { } } // $ANTLR end T47 // $ANTLR start T48 public final void mT48() throws RecognitionException { try { int _type = T48; // PRO.g:7:7: ( ':' ) // PRO.g:7:7: ':' { match(':'); } this.type = _type; } finally { } } // $ANTLR end T48 // $ANTLR start T49 public final void mT49() throws RecognitionException { try { int _type = T49; // PRO.g:8:7: ( ';' ) // PRO.g:8:7: ';' { match(';'); } this.type = _type; } finally { } } // $ANTLR end T49 // $ANTLR start T50 public final void mT50() throws RecognitionException { try { int _type = T50; // PRO.g:9:7: ( ',' ) // PRO.g:9:7: ',' { match(','); } this.type = _type; } finally { } } // $ANTLR end T50 // $ANTLR start T51 public final void mT51() throws RecognitionException { try { int _type = T51; // PRO.g:10:7: ( '[' ) // PRO.g:10:7: '[' { match('['); } this.type = _type; } finally { } } // $ANTLR end T51 // $ANTLR start T52 public final void mT52() throws RecognitionException { try { int _type = T52; // PRO.g:11:7: ( '..' ) // PRO.g:11:7: '..' { match(".."); } this.type = _type; } finally { } } // $ANTLR end T52 // $ANTLR start T53 public final void mT53() throws RecognitionException { try { int _type = T53; // PRO.g:12:7: ( ']' ) // PRO.g:12:7: ']' { match(']'); } this.type = _type; } finally { } } // $ANTLR end T53 // $ANTLR start T54 public final void mT54() throws RecognitionException { try { int _type = T54; // PRO.g:13:7: ( 'OF' ) // PRO.g:13:7: 'OF' { match("OF"); } this.type = _type; } finally { } } // $ANTLR end T54 // $ANTLR start PROGRAM public final void mPROGRAM() throws RecognitionException { try { int _type = PROGRAM; // PRO.g:167:11: ( 'program' | 'Program' | 'PROGRAM' ) int alt1=3; int LA1_0 = input.LA(1); if ( (LA1_0=='p') ) { alt1=1; } else if ( (LA1_0=='P') ) { int LA1_2 = input.LA(2); if ( (LA1_2=='R') ) { alt1=3; } else if ( (LA1_2=='r') ) { alt1=2; } else { NoViableAltException nvae = new NoViableAltException("167:1: PROGRAM : ( 'program' | 'Program' | 'PROGRAM' );", 1, 2, input); throw nvae; } } else { NoViableAltException nvae = new NoViableAltException("167:1: PROGRAM : ( 'program' | 'Program' | 'PROGRAM' );", 1, 0, input); throw nvae; } switch (alt1) { case 1 : // PRO.g:167:11: 'program' { match("program"); } break; case 2 : // PRO.g:167:21: 'Program' { match("Program"); } break; case 3 : // PRO.g:167:31: 'PROGRAM' { match("PROGRAM"); } break; } this.type = _type; } finally { } } // $ANTLR end PROGRAM // $ANTLR start VAR public final void mVAR() throws RecognitionException { try { int _type = VAR; // PRO.g:168:7: ( 'var' | 'VAR' | 'Var' ) int alt2=3; int LA2_0 = input.LA(1); if ( (LA2_0=='v') ) { alt2=1; } else if ( (LA2_0=='V') ) { int LA2_2 = input.LA(2); if ( (LA2_2=='A') ) { alt2=2; } else if ( (LA2_2=='a') ) { alt2=3; } else { NoViableAltException nvae = new NoViableAltException("168:1: VAR : ( 'var' | 'VAR' | 'Var' );", 2, 2, input); throw nvae; } } else { NoViableAltException nvae = new NoViableAltException("168:1: VAR : ( 'var' | 'VAR' | 'Var' );", 2, 0, input); throw nvae; } switch (alt2) { case 1 : // PRO.g:168:7: 'var' { match("var"); } break; case 2 : // PRO.g:168:13: 'VAR' { match("VAR"); } break; case 3 : // PRO.g:168:19: 'Var' { match("Var"); } break; } this.type = _type; } finally { } } // $ANTLR end VAR // $ANTLR start ARRAY public final void mARRAY() throws RecognitionException { try { int _type = ARRAY; // PRO.g:169:9: ( 'array' | 'ARRAY' | 'Array' ) int alt3=3; int LA3_0 = input.LA(1); if ( (LA3_0=='a') ) { alt3=1; } else if ( (LA3_0=='A') ) { int LA3_2 = input.LA(2); if ( (LA3_2=='R') ) { alt3=2; } else if ( (LA3_2=='r') ) { alt3=3; } else { NoViableAltException nvae = new NoViableAltException("169:1: ARRAY : ( 'array' | 'ARRAY' | 'Array' );", 3, 2, input); throw nvae; } } else { NoViableAltException nvae = new NoViableAltException("169:1: ARRAY : ( 'array' | 'ARRAY' | 'Array' );", 3, 0, input); throw nvae; } switch (alt3) { case 1 : // PRO.g:169:9: 'array' { match("array"); } break; case 2 : // PRO.g:169:17: 'ARRAY' { match("ARRAY"); } break; case 3 : // PRO.g:169:25: 'Array' { match("Array"); } break; } this.type = _type; } finally { } } // $ANTLR end ARRAY // $ANTLR start OF public final void mOF() throws RecognitionException { try { int _type = OF; // PRO.g:170:6: ( 'of' | 'OF' | 'Of' ) int alt4=3; int LA4_0 = input.LA(1); if ( (LA4_0=='o') ) { alt4=1; } else if ( (LA4_0=='O') ) { int LA4_2 = input.LA(2); if ( (LA4_2=='F') ) { alt4=2; } else if ( (LA4_2=='f') ) { alt4=3; } else { NoViableAltException nvae = new NoViableAltException("170:1: OF : ( 'of' | 'OF' | 'Of' );", 4, 2, input); throw nvae; } } else { NoViableAltException nvae = new NoViableAltException("170:1: OF : ( 'of' | 'OF' | 'Of' );", 4, 0, input); throw nvae; } switch (alt4) { case 1 : // PRO.g:170:6: 'of' { match("of"); } break; case 2 : // PRO.g:170:11: 'OF' { match("OF"); } break; case 3 : // PRO.g:170:16: 'Of' { match("Of"); } break; } this.type = _type; } finally { } } // $ANTLR end OF // $ANTLR start FUNCTION public final void mFUNCTION() throws RecognitionException { try { int _type = FUNCTION; // PRO.g:171:11: ( 'function' | 'FUNCTON' | 'Funtion' ) int alt5=3; int LA5_0 = input.LA(1); if ( (LA5_0=='f') ) { alt5=1; } else if ( (LA5_0=='F') ) { int LA5_2 = input.LA(2); if ( (LA5_2=='u') ) { alt5=3; } else if ( (LA5_2=='U') ) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -