All Downloads are FREE. Search and download functionalities are using the official Maven repository.

prerna.sablecc2.lexer.Lexer Maven / Gradle / Ivy

The newest version!
/* This file was generated by SableCC (http://www.sablecc.org/). */

package prerna.sablecc2.lexer;

import java.io.*;
import prerna.sablecc2.node.*;

@SuppressWarnings("nls")
public class Lexer
{
    protected Token token;
    protected State state = State.INITIAL;

    private IPushbackReader in;
    private int line;
    private int pos;
    private boolean cr;
    private boolean eof;
    private final StringBuffer text = new StringBuffer();

    @SuppressWarnings("unused")
    protected void filter() throws LexerException, IOException
    {
        // Do nothing
    }

    public Lexer(@SuppressWarnings("hiding") final PushbackReader in)
    {
        this.in = new IPushbackReader() {

            private PushbackReader pushbackReader = in;
            
            @Override
            public void unread(int c) throws IOException {
                pushbackReader.unread(c);
            }
            
            @Override
            public int read() throws IOException {
                return pushbackReader.read();
            }
        };
    }
 
    public Lexer(@SuppressWarnings("hiding") IPushbackReader in)
    {
        this.in = in;
    }
 
    public Token peek() throws LexerException, IOException
    {
        while(this.token == null)
        {
            this.token = getToken();
            filter();
        }

        return this.token;
    }

    public Token next() throws LexerException, IOException
    {
        while(this.token == null)
        {
            this.token = getToken();
            filter();
        }

        Token result = this.token;
        this.token = null;
        return result;
    }

    protected Token getToken() throws IOException, LexerException
    {
        int dfa_state = 0;

        int start_pos = this.pos;
        int start_line = this.line;

        int accept_state = -1;
        int accept_token = -1;
        int accept_length = -1;
        int accept_pos = -1;
        int accept_line = -1;

        @SuppressWarnings("hiding") int[][][] gotoTable = Lexer.gotoTable[this.state.id()];
        @SuppressWarnings("hiding") int[] accept = Lexer.accept[this.state.id()];
        this.text.setLength(0);

        while(true)
        {
            int c = getChar();

            if(c != -1)
            {
                switch(c)
                {
                case 10:
                    if(this.cr)
                    {
                        this.cr = false;
                    }
                    else
                    {
                        this.line++;
                        this.pos = 0;
                    }
                    break;
                case 13:
                    this.line++;
                    this.pos = 0;
                    this.cr = true;
                    break;
                default:
                    this.pos++;
                    this.cr = false;
                    break;
                }

                this.text.append((char) c);

                do
                {
                    int oldState = (dfa_state < -1) ? (-2 -dfa_state) : dfa_state;

                    dfa_state = -1;

                    int[][] tmp1 =  gotoTable[oldState];
                    int low = 0;
                    int high = tmp1.length - 1;

                    while(low <= high)
                    {
                        // int middle = (low + high) / 2;
                        int middle = (low + high) >>> 1;
                        int[] tmp2 = tmp1[middle];

                        if(c < tmp2[0])
                        {
                            high = middle - 1;
                        }
                        else if(c > tmp2[1])
                        {
                            low = middle + 1;
                        }
                        else
                        {
                            dfa_state = tmp2[2];
                            break;
                        }
                    }
                }while(dfa_state < -1);
            }
            else
            {
                dfa_state = -1;
            }

            if(dfa_state >= 0)
            {
                if(accept[dfa_state] != -1)
                {
                    accept_state = dfa_state;
                    accept_token = accept[dfa_state];
                    accept_length = this.text.length();
                    accept_pos = this.pos;
                    accept_line = this.line;
                }
            }
            else
            {
                if(accept_state != -1)
                {
                    switch(accept_token)
                    {
                    case 0:
                        {
                            @SuppressWarnings("hiding") Token token = new0(
                                start_line + 1,
                                start_pos + 1);
                            pushBack(accept_length);
                            this.pos = accept_pos;
                            this.line = accept_line;
                            return token;
                        }
                    case 1:
                        {
                            @SuppressWarnings("hiding") Token token = new1(
                                getText(accept_length),
                                start_line + 1,
                                start_pos + 1);
                            pushBack(accept_length);
                            this.pos = accept_pos;
                            this.line = accept_line;
                            return token;
                        }
                    case 2:
                        {
                            @SuppressWarnings("hiding") Token token = new2(
                                getText(accept_length),
                                start_line + 1,
                                start_pos + 1);
                            pushBack(accept_length);
                            this.pos = accept_pos;
                            this.line = accept_line;
                            return token;
                        }
                    case 3:
                        {
                            @SuppressWarnings("hiding") Token token = new3(
                                start_line + 1,
                                start_pos + 1);
                            pushBack(accept_length);
                            this.pos = accept_pos;
                            this.line = accept_line;
                            return token;
                        }
                    case 4:
                        {
                            @SuppressWarnings("hiding") Token token = new4(
                                getText(accept_length),
                                start_line + 1,
                                start_pos + 1);
                            pushBack(accept_length);
                            this.pos = accept_pos;
                            this.line = accept_line;
                            return token;
                        }
                    case 5:
                        {
                            @SuppressWarnings("hiding") Token token = new5(
                                start_line + 1,
                                start_pos + 1);
                            pushBack(accept_length);
                            this.pos = accept_pos;
                            this.line = accept_line;
                            return token;
                        }
                    case 6:
                        {
                            @SuppressWarnings("hiding") Token token = new6(
                                start_line + 1,
                                start_pos + 1);
                            pushBack(accept_length);
                            this.pos = accept_pos;
                            this.line = accept_line;
                            return token;
                        }
                    case 7:
                        {
                            @SuppressWarnings("hiding") Token token = new7(
                                start_line + 1,
                                start_pos + 1);
                            pushBack(accept_length);
                            this.pos = accept_pos;
                            this.line = accept_line;
                            return token;
                        }
                    case 8:
                        {
                            @SuppressWarnings("hiding") Token token = new8(
                                start_line + 1,
                                start_pos + 1);
                            pushBack(accept_length);
                            this.pos = accept_pos;
                            this.line = accept_line;
                            return token;
                        }
                    case 9:
                        {
                            @SuppressWarnings("hiding") Token token = new9(
                                start_line + 1,
                                start_pos + 1);
                            pushBack(accept_length);
                            this.pos = accept_pos;
                            this.line = accept_line;
                            return token;
                        }
                    case 10:
                        {
                            @SuppressWarnings("hiding") Token token = new10(
                                start_line + 1,
                                start_pos + 1);
                            pushBack(accept_length);
                            this.pos = accept_pos;
                            this.line = accept_line;
                            return token;
                        }
                    case 11:
                        {
                            @SuppressWarnings("hiding") Token token = new11(
                                start_line + 1,
                                start_pos + 1);
                            pushBack(accept_length);
                            this.pos = accept_pos;
                            this.line = accept_line;
                            return token;
                        }
                    case 12:
                        {
                            @SuppressWarnings("hiding") Token token = new12(
                                getText(accept_length),
                                start_line + 1,
                                start_pos + 1);
                            pushBack(accept_length);
                            this.pos = accept_pos;
                            this.line = accept_line;
                            return token;
                        }
                    case 13:
                        {
                            @SuppressWarnings("hiding") Token token = new13(
                                getText(accept_length),
                                start_line + 1,
                                start_pos + 1);
                            pushBack(accept_length);
                            this.pos = accept_pos;
                            this.line = accept_line;
                            return token;
                        }
                    case 14:
                        {
                            @SuppressWarnings("hiding") Token token = new14(
                                start_line + 1,
                                start_pos + 1);
                            pushBack(accept_length);
                            this.pos = accept_pos;
                            this.line = accept_line;
                            return token;
                        }
                    case 15:
                        {
                            @SuppressWarnings("hiding") Token token = new15(
                                start_line + 1,
                                start_pos + 1);
                            pushBack(accept_length);
                            this.pos = accept_pos;
                            this.line = accept_line;
                            return token;
                        }
                    case 16:
                        {
                            @SuppressWarnings("hiding") Token token = new16(
                                start_line + 1,
                                start_pos + 1);
                            pushBack(accept_length);
                            this.pos = accept_pos;
                            this.line = accept_line;
                            return token;
                        }
                    case 17:
                        {
                            @SuppressWarnings("hiding") Token token = new17(
                                getText(accept_length),
                                start_line + 1,
                                start_pos + 1);
                            pushBack(accept_length);
                            this.pos = accept_pos;
                            this.line = accept_line;
                            return token;
                        }
                    case 18:
                        {
                            @SuppressWarnings("hiding") Token token = new18(
                                start_line + 1,
                                start_pos + 1);
                            pushBack(accept_length);
                            this.pos = accept_pos;
                            this.line = accept_line;
                            return token;
                        }
                    case 19:
                        {
                            @SuppressWarnings("hiding") Token token = new19(
                                start_line + 1,
                                start_pos + 1);
                            pushBack(accept_length);
                            this.pos = accept_pos;
                            this.line = accept_line;
                            return token;
                        }
                    case 20:
                        {
                            @SuppressWarnings("hiding") Token token = new20(
                                start_line + 1,
                                start_pos + 1);
                            pushBack(accept_length);
                            this.pos = accept_pos;
                            this.line = accept_line;
                            return token;
                        }
                    case 21:
                        {
                            @SuppressWarnings("hiding") Token token = new21(
                                start_line + 1,
                                start_pos + 1);
                            pushBack(accept_length);
                            this.pos = accept_pos;
                            this.line = accept_line;
                            return token;
                        }
                    case 22:
                        {
                            @SuppressWarnings("hiding") Token token = new22(
                                start_line + 1,
                                start_pos + 1);
                            pushBack(accept_length);
                            this.pos = accept_pos;
                            this.line = accept_line;
                            return token;
                        }
                    case 23:
                        {
                            @SuppressWarnings("hiding") Token token = new23(
                                start_line + 1,
                                start_pos + 1);
                            pushBack(accept_length);
                            this.pos = accept_pos;
                            this.line = accept_line;
                            return token;
                        }
                    case 24:
                        {
                            @SuppressWarnings("hiding") Token token = new24(
                                start_line + 1,
                                start_pos + 1);
                            pushBack(accept_length);
                            this.pos = accept_pos;
                            this.line = accept_line;
                            return token;
                        }
                    case 25:
                        {
                            @SuppressWarnings("hiding") Token token = new25(
                                start_line + 1,
                                start_pos + 1);
                            pushBack(accept_length);
                            this.pos = accept_pos;
                            this.line = accept_line;
                            return token;
                        }
                    case 26:
                        {
                            @SuppressWarnings("hiding") Token token = new26(
                                start_line + 1,
                                start_pos + 1);
                            pushBack(accept_length);
                            this.pos = accept_pos;
                            this.line = accept_line;
                            return token;
                        }
                    case 27:
                        {
                            @SuppressWarnings("hiding") Token token = new27(
                                start_line + 1,
                                start_pos + 1);
                            pushBack(accept_length);
                            this.pos = accept_pos;
                            this.line = accept_line;
                            return token;
                        }
                    case 28:
                        {
                            @SuppressWarnings("hiding") Token token = new28(
                                start_line + 1,
                                start_pos + 1);
                            pushBack(accept_length);
                            this.pos = accept_pos;
                            this.line = accept_line;
                            return token;
                        }
                    case 29:
                        {
                            @SuppressWarnings("hiding") Token token = new29(
                                getText(accept_length),
                                start_line + 1,
                                start_pos + 1);
                            pushBack(accept_length);
                            this.pos = accept_pos;
                            this.line = accept_line;
                            return token;
                        }
                    case 30:
                        {
                            @SuppressWarnings("hiding") Token token = new30(
                                getText(accept_length),
                                start_line + 1,
                                start_pos + 1);
                            pushBack(accept_length);
                            this.pos = accept_pos;
                            this.line = accept_line;
                            return token;
                        }
                    case 31:
                        {
                            @SuppressWarnings("hiding") Token token = new31(
                                start_line + 1,
                                start_pos + 1);
                            pushBack(accept_length);
                            this.pos = accept_pos;
                            this.line = accept_line;
                            return token;
                        }
                    case 32:
                        {
                            @SuppressWarnings("hiding") Token token = new32(
                                getText(accept_length),
                                start_line + 1,
                                start_pos + 1);
                            pushBack(accept_length);
                            this.pos = accept_pos;
                            this.line = accept_line;
                            return token;
                        }
                    case 33:
                        {
                            @SuppressWarnings("hiding") Token token = new33(
                                start_line + 1,
                                start_pos + 1);
                            pushBack(accept_length);
                            this.pos = accept_pos;
                            this.line = accept_line;
                            return token;
                        }
                    case 34:
                        {
                            @SuppressWarnings("hiding") Token token = new34(
                                getText(accept_length),
                                start_line + 1,
                                start_pos + 1);
                            pushBack(accept_length);
                            this.pos = accept_pos;
                            this.line = accept_line;
                            return token;
                        }
                    case 35:
                        {
                            @SuppressWarnings("hiding") Token token = new35(
                                getText(accept_length),
                                start_line + 1,
                                start_pos + 1);
                            pushBack(accept_length);
                            this.pos = accept_pos;
                            this.line = accept_line;
                            return token;
                        }
                    }
                }
                else
                {
                    if(this.text.length() > 0)
                    {
                        throw new LexerException(
                            new InvalidToken(this.text.substring(0, 1), start_line + 1, start_pos + 1),
                            "[" + (start_line + 1) + "," + (start_pos + 1) + "]" +
                            " Unknown token: " + this.text);
                    }

                    @SuppressWarnings("hiding") EOF token = new EOF(
                        start_line + 1,
                        start_pos + 1);
                    return token;
                }
            }
        }
    }

    Token new0(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TNull(line, pos); }
    Token new1(@SuppressWarnings("hiding") String text, @SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TNumber(text, line, pos); }
    Token new2(@SuppressWarnings("hiding") String text, @SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TBoolean(text, line, pos); }
    Token new3(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TMeta(line, pos); }
    Token new4(@SuppressWarnings("hiding") String text, @SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TId(text, line, pos); }
    Token new5(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TDot(line, pos); }
    Token new6(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TSemicolon(line, pos); }
    Token new7(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TColon(line, pos); }
    Token new8(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TPlus(line, pos); }
    Token new9(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TMinus(line, pos); }
    Token new10(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TMod(line, pos); }
    Token new11(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TPow(line, pos); }
    Token new12(@SuppressWarnings("hiding") String text, @SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TWord(text, line, pos); }
    Token new13(@SuppressWarnings("hiding") String text, @SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TComment(text, line, pos); }
    Token new14(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TMult(line, pos); }
    Token new15(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TComma(line, pos); }
    Token new16(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TDiv(line, pos); }
    Token new17(@SuppressWarnings("hiding") String text, @SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TComparator(text, line, pos); }
    Token new18(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TAndComparator(line, pos); }
    Token new19(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TOrComparator(line, pos); }
    Token new20(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TEqual(line, pos); }
    Token new21(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TLPar(line, pos); }
    Token new22(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TRPar(line, pos); }
    Token new23(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TLBrac(line, pos); }
    Token new24(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TRBrac(line, pos); }
    Token new25(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TLCurl(line, pos); }
    Token new26(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TRCurl(line, pos); }
    Token new27(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TFrameprefix(line, pos); }
    Token new28(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TFrameid(line, pos); }
    Token new29(@SuppressWarnings("hiding") String text, @SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TBlank(text, line, pos); }
    Token new30(@SuppressWarnings("hiding") String text, @SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TJava(text, line, pos); }
    Token new31(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TIf(line, pos); }
    Token new32(@SuppressWarnings("hiding") String text, @SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TAsOp(text, line, pos); }
    Token new33(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TCustom(line, pos); }
    Token new34(@SuppressWarnings("hiding") String text, @SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TRelType(text, line, pos); }
    Token new35(@SuppressWarnings("hiding") String text, @SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new THelpToken(text, line, pos); }

    private int getChar() throws IOException
    {
        if(this.eof)
        {
            return -1;
        }

        int result = this.in.read();

        if(result == -1)
        {
            this.eof = true;
        }

        return result;
    }

    private void pushBack(int acceptLength) throws IOException
    {
        int length = this.text.length();
        for(int i = length - 1; i >= acceptLength; i--)
        {
            this.eof = false;

            this.in.unread(this.text.charAt(i));
        }
    }

    protected void unread(@SuppressWarnings("hiding") Token token) throws IOException
    {
        @SuppressWarnings("hiding") String text = token.getText();
        int length = text.length();

        for(int i = length - 1; i >= 0; i--)
        {
            this.eof = false;

            this.in.unread(text.charAt(i));
        }

        this.pos = token.getPos() - 1;
        this.line = token.getLine() - 1;
    }

    private String getText(int acceptLength)
    {
        StringBuffer s = new StringBuffer(acceptLength);
        for(int i = 0; i < acceptLength; i++)
        {
            s.append(this.text.charAt(i));
        }

        return s.toString();
    }

    private static int[][][][] gotoTable;
/*  {
        { // INITIAL
            {{10, 10, 1}, {13, 13, 2}, {32, 32, 3}, {33, 33, 4}, {34, 34, 5}, {35, 35, 6}, {37, 37, 7}, {39, 39, 8}, {40, 40, 9}, {41, 41, 10}, {42, 42, 11}, {43, 43, 12}, {44, 44, 13}, {45, 45, 14}, {46, 46, 15}, {47, 47, 16}, {48, 57, 17}, {58, 58, 18}, {59, 59, 19}, {60, 60, 20}, {61, 61, 21}, {62, 62, 22}, {63, 63, 23}, {65, 69, 24}, {70, 70, 25}, {71, 76, 24}, {77, 77, 26}, {78, 83, 24}, {84, 84, 27}, {85, 90, 24}, {91, 91, 28}, {93, 93, 29}, {94, 94, 30}, {95, 95, 31}, {97, 98, 32}, {99, 99, 33}, {100, 101, 32}, {102, 102, 34}, {103, 104, 32}, {105, 105, 35}, {106, 107, 32}, {108, 108, 36}, {109, 109, 32}, {110, 110, 37}, {111, 111, 38}, {112, 113, 32}, {114, 114, 39}, {115, 115, 40}, {116, 116, 41}, {117, 122, 32}, {123, 123, 42}, {124, 124, 43}, {125, 125, 44}, },
            {},
            {},
            {{65, 65, 45}, {79, 79, 46}, },
            {{61, 61, 47}, },
            {{0, 33, 48}, {34, 34, 49}, {35, 91, 48}, {92, 92, 50}, {93, 65535, 48}, },
            {{35, 35, 51}, },
            {},
            {{0, 38, 52}, {39, 39, 53}, {40, 65535, 52}, },
            {},
            {},
            {},
            {},
            {},
            {{45, 45, 54}, },
            {{97, 97, 55}, {111, 111, 56}, },
            {{42, 42, 57}, },
            {{48, 57, 17}, {65, 90, 24}, {95, 95, 31}, {97, 122, 32}, },
            {},
            {},
            {{61, 61, 58}, {62, 62, 59}, {106, 106, 60}, },
            {{61, 61, 61}, },
            {{61, 61, 62}, },
            {{98, 98, 63}, {101, 101, 64}, {108, 108, 65}, {110, 110, 66}, },
            {{48, 57, 67}, {65, 122, -19}, },
            {{48, 57, 67}, {65, 65, 68}, {66, 90, 24}, {95, 122, -19}, },
            {{48, 57, 67}, {65, 68, 24}, {69, 69, 69}, {70, 90, 24}, {95, 122, -19}, },
            {{48, 57, 67}, {65, 81, 24}, {82, 82, 70}, {83, 90, 24}, {95, 122, -19}, },
            {},
            {},
            {},
            {{48, 122, -26}, },
            {{48, 122, -26}, },
            {{48, 95, -26}, {97, 113, 32}, {114, 114, 71}, {115, 122, 32}, },
            {{36, 36, 72}, {46, 46, 73}, {48, 95, -26}, {97, 97, 74}, {98, 122, 32}, },
            {{48, 95, -26}, {97, 101, 32}, {102, 102, 75}, {103, 109, 32}, {110, 110, 76}, {111, 122, 32}, },
            {{48, 95, -26}, {97, 100, 32}, {101, 101, 77}, {102, 122, 32}, },
            {{48, 95, -26}, {97, 116, 32}, {117, 117, 78}, {118, 122, 32}, },
            {{48, 116, -39}, {117, 117, 79}, {118, 122, 32}, },
            {{48, 95, -26}, {97, 104, 32}, {105, 105, 80}, {106, 122, 32}, },
            {{48, 100, -38}, {101, 101, 81}, {102, 122, 32}, },
            {{48, 113, -35}, {114, 114, 82}, {115, 122, 32}, },
            {},
            {},
            {},
            {{78, 78, 83}, },
            {{82, 82, 84}, },
            {},
            {{0, 65535, -7}, },
            {},
            {{0, 33, 48}, {34, 34, 85}, {35, 65535, -7}, },
            {{0, 34, 86}, {36, 65535, 86}, },
            {{0, 65535, -10}, },
            {},
            {{32, 32, 87}, {104, 104, 88}, },
            {{115, 115, 89}, },
            {{117, 117, 90}, },
            {{0, 41, 91}, {42, 42, 92}, {43, 65535, 91}, },
            {},
            {},
            {{62, 62, 93}, },
            {},
            {},
            {{101, 101, 94}, },
            {{110, 110, 95}, },
            {{105, 105, 96}, },
            {{98, 98, 97}, {101, 101, 98}, {108, 108, 99}, },
            {{48, 122, -26}, },
            {{48, 57, 67}, {65, 75, 24}, {76, 76, 100}, {77, 90, 24}, {95, 122, -19}, },
            {{48, 57, 67}, {65, 83, 24}, {84, 84, 101}, {85, 90, 24}, {95, 122, -19}, },
            {{48, 57, 67}, {65, 84, 24}, {85, 85, 102}, {86, 90, 24}, {95, 122, -19}, },
            {{48, 95, -26}, {97, 110, 32}, {111, 111, 103}, {112, 122, 32}, },
            {},
            {},
            {{48, 95, -26}, {97, 107, 32}, {108, 108, 104}, {109, 122, 32}, },
            {{48, 122, -26}, },
            {{48, 95, -26}, {97, 109, 32}, {110, 110, 105}, {111, 122, 32}, },
            {{48, 101, -37}, {102, 102, 106}, {103, 122, 32}, },
            {{48, 107, -76}, {108, 108, 107}, {109, 122, 32}, },
            {{48, 95, -26}, {97, 115, 32}, {116, 116, 108}, {117, 122, 32}, },
            {{48, 95, -26}, {97, 102, 32}, {103, 103, 109}, {104, 122, 32}, },
            {{48, 107, -76}, {108, 108, 110}, {109, 122, 32}, },
            {{48, 116, -39}, {117, 117, 111}, {118, 122, 32}, },
            {{68, 68, 112}, },
            {{32, 32, 113}, },
            {{0, 65535, -7}, },
            {{0, 34, 114}, {35, 35, 115}, {36, 65535, 114}, },
            {{104, 104, 116}, },
            {{101, 101, 117}, },
            {},
            {{116, 116, 118}, },
            {{0, 41, 91}, {42, 42, 119}, {43, 65535, 91}, },
            {{0, 41, 120}, {42, 42, 121}, {43, 46, 120}, {47, 47, 122}, {48, 65535, 120}, },
            {{33, 33, 123}, {37, 37, 124}, {39, 39, 125}, {40, 40, 126}, {41, 41, 127}, {42, 42, 128}, {43, 43, 129}, {45, 45, 130}, {46, 46, 131}, {48, 57, 132}, {60, 60, 133}, {65, 90, 134}, {95, 95, 135}, {97, 122, 136}, {126, 126, 137}, },
            {{103, 103, 138}, },
            {{100, 100, 139}, },
            {{107, 107, 140}, },
            {{101, 101, 141}, },
            {{110, 110, 142}, },
            {{105, 105, 143}, },
            {{48, 57, 67}, {65, 82, 24}, {83, 83, 144}, {84, 90, 24}, {95, 122, -19}, },
            {{48, 57, 67}, {65, 65, 145}, {66, 122, -27}, },
            {{48, 68, -28}, {69, 69, 146}, {70, 122, -28}, },
            {{48, 95, -26}, {97, 114, 32}, {115, 115, 147}, {116, 122, 32}, },
            {{48, 114, -105}, {115, 115, 148}, {116, 122, 32}, },
            {{48, 100, -38}, {101, 101, 149}, {102, 122, 32}, },
            {{48, 115, -81}, {116, 116, 150}, {117, 122, 32}, },
            {{48, 107, -76}, {108, 108, 151}, {109, 122, 32}, },
            {{48, 100, -38}, {101, 101, 152}, {102, 122, 32}, },
            {{48, 95, -26}, {97, 103, 32}, {104, 104, 153}, {105, 122, 32}, },
            {{48, 101, -37}, {102, 102, 154}, {103, 122, 32}, },
            {{48, 100, -38}, {101, 101, 155}, {102, 122, 32}, },
            {{32, 32, 156}, },
            {},
            {{0, 65535, -88}, },
            {{0, 34, 157}, {35, 35, 158}, {36, 65535, 157}, },
            {{101, 101, 159}, },
            {{108, 108, 160}, },
            {},
            {{0, 41, 161}, {42, 42, 119}, {43, 46, 161}, {47, 47, 162}, {48, 65535, 161}, },
            {{0, 41, 163}, {42, 42, 164}, {43, 65535, 163}, },
            {{0, 65535, -94}, },
            {},
            {{33, 126, -95}, },
            {{33, 126, -95}, },
            {{33, 126, -95}, },
            {{33, 126, -95}, },
            {{33, 126, -95}, },
            {{33, 126, -95}, },
            {{33, 126, -95}, },
            {{33, 126, -95}, },
            {{33, 126, -95}, },
            {{33, 126, -95}, },
            {{47, 47, 165}, },
            {{33, 126, -95}, },
            {{33, 126, -95}, },
            {{33, 126, -95}, },
            {{33, 126, -95}, },
            {{105, 105, 166}, },
            {{115, 115, 167}, },
            {{101, 101, 168}, },
            {{103, 103, 169}, },
            {{100, 100, 170}, },
            {{107, 107, 171}, },
            {{48, 68, -28}, {69, 69, 172}, {70, 122, -28}, },
            {{48, 122, -26}, },
            {{48, 122, -26}, },
            {{48, 114, -105}, {115, 115, 173}, {116, 122, 32}, },
            {{48, 100, -38}, {101, 101, 174}, {102, 122, 32}, },
            {{48, 113, -35}, {114, 114, 175}, {115, 122, 32}, },
            {{46, 46, 176}, {48, 122, -26}, },
            {{48, 122, -26}, },
            {{48, 113, -35}, {114, 114, 177}, {115, 122, 32}, },
            {{48, 115, -81}, {116, 116, 178}, {117, 122, 32}, },
            {{46, 46, 179}, {48, 122, -26}, },
            {{48, 122, -26}, },
            {},
            {{0, 34, 180}, {35, 35, 115}, {36, 65535, 180}, },
            {},
            {{108, 108, 181}, },
            {{112, 112, 182}, },
            {{0, 41, 183}, {42, 42, 184}, {43, 65535, 183}, },
            {},
            {{0, 65535, -122}, },
            {{0, 41, 120}, {42, 42, 164}, {43, 65535, -94}, },
            {{106, 106, 185}, },
            {{110, 110, 186}, },
            {},
            {},
            {{105, 105, 187}, },
            {{115, 115, 188}, },
            {{101, 101, 189}, },
            {{48, 122, -26}, },
            {{46, 46, 190}, {48, 122, -26}, },
            {{48, 122, -26}, },
            {{46, 46, 191}, {48, 122, -26}, },
            {{111, 111, 192}, },
            {{46, 46, 193}, {48, 122, -26}, },
            {{46, 46, 194}, {48, 122, -26}, },
            {{106, 106, 195}, },
            {{0, 65535, -159}, },
            {{112, 112, 196}, },
            {},
            {{0, 65535, -163}, },
            {{0, 41, 161}, {42, 42, 184}, {43, 65535, -121}, },
            {{62, 62, 197}, },
            {{115, 115, 198}, },
            {{110, 110, 199}, },
            {},
            {},
            {{106, 106, 200}, },
            {{106, 106, 201}, },
            {{117, 117, 202}, },
            {{106, 106, 203}, },
            {{111, 111, 204}, },
            {{111, 111, 205}, },
            {},
            {},
            {},
            {{115, 115, 206}, },
            {{111, 111, 207}, },
            {{111, 111, 208}, },
            {{116, 116, 209}, },
            {{111, 111, 210}, },
            {{117, 117, 211}, },
            {{105, 105, 212}, },
            {},
            {{105, 105, 213}, },
            {{105, 105, 214}, },
            {{101, 101, 215}, },
            {{105, 105, 216}, },
            {{116, 116, 217}, },
            {{110, 110, 218}, },
            {{110, 110, 219}, },
            {{110, 110, 220}, },
            {{114, 114, 221}, },
            {{110, 110, 222}, },
            {{101, 101, 223}, },
            {},
            {},
            {},
            {{46, 46, 224}, },
            {},
            {{114, 114, 225}, },
            {{106, 106, 226}, },
            {{46, 46, 227}, },
            {{111, 111, 228}, },
            {{106, 106, 229}, },
            {{105, 105, 230}, },
            {{111, 111, 231}, },
            {{110, 110, 232}, },
            {{105, 105, 233}, },
            {},
            {{110, 110, 234}, },
            {},
        }
    };*/

    private static int[][] accept;
/*  {
        // INITIAL
        {4, 29, 29, 29, -1, -1, -1, 10, -1, 21, 22, 14, 8, 15, 9, 5, 16, 1, 7, 6, 17, 20, 17, -1, 4, 4, 4, 4, 23, 24, 11, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 25, 33, 26, -1, -1, 17, -1, 12, -1, -1, -1, 12, -1, -1, -1, -1, 17, 17, -1, 17, 17, -1, -1, -1, -1, 4, 4, 4, 4, 4, 27, 28, 4, 4, 4, 4, 4, 4, 4, 4, 4, -1, -1, 12, -1, -1, -1, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, -1, 19, -1, -1, -1, -1, 32, -1, -1, -1, 13, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 3, 2, 4, 4, 4, 4, 0, 4, 4, 4, 2, 18, -1, 13, -1, -1, -1, 13, -1, -1, -1, -1, 17, 17, -1, -1, -1, 2, 4, 2, 4, -1, 4, 4, -1, -1, -1, 35, -1, -1, -1, -1, -1, 17, 17, -1, -1, -1, -1, -1, -1, 35, 30, 17, -1, -1, -1, -1, -1, -1, -1, 17, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 34, 34, 34, -1, 34, -1, -1, -1, -1, -1, -1, -1, -1, -1, 34, -1, 34, },

    };*/

    public static class State
    {
        public final static State INITIAL = new State(0);

        private int id;

        private State(@SuppressWarnings("hiding") int id)
        {
            this.id = id;
        }

        public int id()
        {
            return this.id;
        }
    }

    static 
    {
        try
        {
            DataInputStream s = new DataInputStream(
                new BufferedInputStream(
                Lexer.class.getResourceAsStream("lexer.dat")));

            // read gotoTable
            int length = s.readInt();
            gotoTable = new int[length][][][];
            for(int i = 0; i < gotoTable.length; i++)
            {
                length = s.readInt();
                gotoTable[i] = new int[length][][];
                for(int j = 0; j < gotoTable[i].length; j++)
                {
                    length = s.readInt();
                    gotoTable[i][j] = new int[length][3];
                    for(int k = 0; k < gotoTable[i][j].length; k++)
                    {
                        for(int l = 0; l < 3; l++)
                        {
                            gotoTable[i][j][k][l] = s.readInt();
                        }
                    }
                }
            }

            // read accept
            length = s.readInt();
            accept = new int[length][];
            for(int i = 0; i < accept.length; i++)
            {
                length = s.readInt();
                accept[i] = new int[length];
                for(int j = 0; j < accept[i].length; j++)
                {
                    accept[i][j] = s.readInt();
                }
            }

            s.close();
        }
        catch(Exception e)
        {
            throw new RuntimeException("The file \"lexer.dat\" is either missing or corrupted.");
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy