⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 prolexer.java

📁 使用antlr实现c和pascal的转换
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
                    alt5=2;                }                else {                    NoViableAltException nvae =                        new NoViableAltException("171:1: FUNCTION : ( 'function' | 'FUNCTON' | 'Funtion' );", 5, 2, input);                    throw nvae;                }            }            else {                NoViableAltException nvae =                    new NoViableAltException("171:1: FUNCTION : ( 'function' | 'FUNCTON' | 'Funtion' );", 5, 0, input);                throw nvae;            }            switch (alt5) {                case 1 :                    // PRO.g:171:11: 'function'                    {                    match("function");                     }                    break;                case 2 :                    // PRO.g:171:22: 'FUNCTON'                    {                    match("FUNCTON");                     }                    break;                case 3 :                    // PRO.g:171:32: 'Funtion'                    {                    match("Funtion");                     }                    break;            }            this.type = _type;        }        finally {        }    }    // $ANTLR end FUNCTION    // $ANTLR start PROCEDURE    public final void mPROCEDURE() throws RecognitionException {        try {            int _type = PROCEDURE;            // PRO.g:173:4: ( 'procedure' | 'PROCEDURE' | 'Procedure' )            int alt6=3;            int LA6_0 = input.LA(1);            if ( (LA6_0=='p') ) {                alt6=1;            }            else if ( (LA6_0=='P') ) {                int LA6_2 = input.LA(2);                if ( (LA6_2=='R') ) {                    alt6=2;                }                else if ( (LA6_2=='r') ) {                    alt6=3;                }                else {                    NoViableAltException nvae =                        new NoViableAltException("172:1: PROCEDURE : ( 'procedure' | 'PROCEDURE' | 'Procedure' );", 6, 2, input);                    throw nvae;                }            }            else {                NoViableAltException nvae =                    new NoViableAltException("172:1: PROCEDURE : ( 'procedure' | 'PROCEDURE' | 'Procedure' );", 6, 0, input);                throw nvae;            }            switch (alt6) {                case 1 :                    // PRO.g:173:4: 'procedure'                    {                    match("procedure");                     }                    break;                case 2 :                    // PRO.g:173:16: 'PROCEDURE'                    {                    match("PROCEDURE");                     }                    break;                case 3 :                    // PRO.g:173:28: 'Procedure'                    {                    match("Procedure");                     }                    break;            }            this.type = _type;        }        finally {        }    }    // $ANTLR end PROCEDURE    // $ANTLR start BEGIN    public final void mBEGIN() throws RecognitionException {        try {            int _type = BEGIN;            // PRO.g:174:9: ( ( 'BEGIN' | 'Begin' | 'begin' ) )            // PRO.g:174:9: ( 'BEGIN' | 'Begin' | 'begin' )            {            // PRO.g:174:9: ( 'BEGIN' | 'Begin' | 'begin' )            int alt7=3;            int LA7_0 = input.LA(1);            if ( (LA7_0=='B') ) {                int LA7_1 = input.LA(2);                if ( (LA7_1=='E') ) {                    alt7=1;                }                else if ( (LA7_1=='e') ) {                    alt7=2;                }                else {                    NoViableAltException nvae =                        new NoViableAltException("174:9: ( 'BEGIN' | 'Begin' | 'begin' )", 7, 1, input);                    throw nvae;                }            }            else if ( (LA7_0=='b') ) {                alt7=3;            }            else {                NoViableAltException nvae =                    new NoViableAltException("174:9: ( 'BEGIN' | 'Begin' | 'begin' )", 7, 0, input);                throw nvae;            }            switch (alt7) {                case 1 :                    // PRO.g:174:10: 'BEGIN'                    {                    match("BEGIN");                     }                    break;                case 2 :                    // PRO.g:174:18: 'Begin'                    {                    match("Begin");                     }                    break;                case 3 :                    // PRO.g:174:26: 'begin'                    {                    match("begin");                     }                    break;            }            }            this.type = _type;        }        finally {        }    }    // $ANTLR end BEGIN    // $ANTLR start END    public final void mEND() throws RecognitionException {        try {            int _type = END;            // PRO.g:175:7: ( ( 'END' | 'End' | 'end' ) )            // PRO.g:175:7: ( 'END' | 'End' | 'end' )            {            // PRO.g:175:7: ( 'END' | 'End' | 'end' )            int alt8=3;            int LA8_0 = input.LA(1);            if ( (LA8_0=='E') ) {                int LA8_1 = input.LA(2);                if ( (LA8_1=='n') ) {                    alt8=2;                }                else if ( (LA8_1=='N') ) {                    alt8=1;                }                else {                    NoViableAltException nvae =                        new NoViableAltException("175:7: ( 'END' | 'End' | 'end' )", 8, 1, input);                    throw nvae;                }            }            else if ( (LA8_0=='e') ) {                alt8=3;            }            else {                NoViableAltException nvae =                    new NoViableAltException("175:7: ( 'END' | 'End' | 'end' )", 8, 0, input);                throw nvae;            }            switch (alt8) {                case 1 :                    // PRO.g:175:8: 'END'                    {                    match("END");                     }                    break;                case 2 :                    // PRO.g:175:14: 'End'                    {                    match("End");                     }                    break;                case 3 :                    // PRO.g:175:20: 'end'                    {                    match("end");                     }                    break;            }            }            this.type = _type;        }        finally {        }    }    // $ANTLR end END    // $ANTLR start IF    public final void mIF() throws RecognitionException {        try {            int _type = IF;            // PRO.g:176:6: ( 'IF' | 'If' | 'if' )            int alt9=3;            int LA9_0 = input.LA(1);            if ( (LA9_0=='I') ) {                int LA9_1 = input.LA(2);                if ( (LA9_1=='f') ) {                    alt9=2;                }                else if ( (LA9_1=='F') ) {                    alt9=1;                }                else {                    NoViableAltException nvae =                        new NoViableAltException("176:1: IF : ( 'IF' | 'If' | 'if' );", 9, 1, input);                    throw nvae;                }            }            else if ( (LA9_0=='i') ) {                alt9=3;            }            else {                NoViableAltException nvae =                    new NoViableAltException("176:1: IF : ( 'IF' | 'If' | 'if' );", 9, 0, input);                throw nvae;            }            switch (alt9) {                case 1 :                    // PRO.g:176:6: 'IF'                    {                    match("IF");                     }                    break;                case 2 :                    // PRO.g:176:11: 'If'                    {                    match("If");                     }                    break;                case 3 :                    // PRO.g:176:16: 'if'                    {                    match("if");                     }                    break;            }            this.type = _type;        }        finally {        }    }    // $ANTLR end IF    // $ANTLR start THEN    public final void mTHEN() throws RecognitionException {        try {            int _type = THEN;            // PRO.g:177:8: ( 'THEN' | 'Then' | 'then' )            int alt10=3;            int LA10_0 = input.LA(1);            if ( (LA10_0=='T') ) {                int LA10_1 = input.LA(2);                if ( (LA10_1=='h') ) {                    alt10=2;                }                else if ( (LA10_1=='H') ) {                    alt10=1;                }                else {                    NoViableAltException nvae =                        new NoViableAltException("177:1: THEN : ( 'THEN' | 'Then' | 'then' );", 10, 1, input);                    throw nvae;                }            }            else if ( (LA10_0=='t') ) {                alt10=3;            }            else {                NoViableAltException nvae =                    new NoViableAltException("177:1: THEN : ( 'THEN' | 'Then' | 'then' );", 10, 0, input);                throw nvae;            }            switch (alt10) {                case 1 :                    // PRO.g:177:8: 'THEN'                    {                    match("THEN");                     }                    break;                case 2 :                    // PRO.g:177:15: 'Then'                    {                    match("Then");                     }                    break;                case 3 :                    // PRO.g:177:22: 'then'                    {                    match("then");                     }                    break;            }            this.type = _type;        }        finally {        }    }    // $ANTLR end THEN    // $ANTLR start ELSE    public final void mELSE() throws RecognitionException {        try {            int _type = ELSE;            // PRO.g:178:8: ( 'ELSE' | 'Else' | 'else' )            int alt11=3;            int LA11_0 = input.LA(1);            if ( (LA11_0=='E') ) {                int LA11_1 = input.LA(2);                if ( (LA11_1=='l') ) {                    alt11=2;                }                else if ( (LA11_1=='L') ) {                    alt11=1;                }                else {                    NoViableAltException nvae =                        new NoViableAltException("178:1: ELSE : ( 'ELSE' | 'Else' | 'else' );", 11, 1, input);                    throw nvae;                }            }            else if ( (LA11_0=='e') ) {                alt11=3;            }            else {                NoViableAltException nvae =                    new NoViableAltException("178:1: ELSE : ( 'ELSE' | 'Else' | 'else' );", 11, 0, input);                throw nvae;            }            switch (alt11) {                case 1 :                    // PRO.g:178:8: 'ELSE'                    {                    match("ELSE");                     }                    break;                case 2 :                    // PRO.g:178:15: 'Else'                    {                    match("Else");                     }                    break;                case 3 :                    // PRO.g:178:22: 'else'                    {                    match("else");                     }                    break;            }            this.type = _type;        }        finally {        }    }    // $ANTLR end ELSE    // $ANTLR start WHILE    public final void mWHILE() throws RecognitionException {        try {            int _type = WHILE;            // PRO.g:179:9: ( 'WHILE' | 'While' | 'while' )            int alt12=3;            int LA12_0 = input.LA(1);            if ( (LA12_0=='W') ) {                int LA12_1 = input.LA(2);                if ( (LA12_1=='H') ) {                    alt12=1;                }                else if ( (LA12_1=='h') ) {                    alt12=2;                }                else {                    NoViableAltException nvae =                        new NoViableAltException("179:1: WHILE : ( 'WHILE' | 'While' | 'while' );", 12, 1, input);                    throw nvae;                }            }            else if ( (LA12_0=='w') ) {                alt12=3;            }            else {                NoViableAltException nvae =                    new NoViableAltException("179:1: WHILE : ( 'WHILE' | 'While' | 'while' );", 12, 0, input);                throw nvae;            }            switch (alt12) {                case 1 :                    // PRO.g:179:9: 'WHILE'                    {                    match("WHILE");                     }                    break;                case 2 :                    // PRO.g:179:17: 'While'                    {                    match("While");                     }                    break;                case 3 :                    // PRO.g:179:25: 'while'                    {                    match("while");                     }                    break;            }            this.type = _type;        }        finally {        }    }    // $ANTLR end WHILE    // $ANTLR start DO    public final void mDO() throws RecognitionException {        try {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -