]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.basicexpression/src/org/simantics/basicexpression/lexer/Lexer.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.basicexpression / src / org / simantics / basicexpression / lexer / Lexer.java
index 6dfac976824da9d8dc125d04c8bff4f0fd9fe9c0..8e8324eb9f1c0d081d20274b7faa43eaf3f4f005 100644 (file)
-/* This file was generated by SableCC (http://www.sablecc.org/). */\r
-\r
-package org.simantics.basicexpression.lexer;\r
-\r
-import java.io.*;\r
-import org.simantics.basicexpression.node.*;\r
-\r
-@SuppressWarnings("nls")\r
-public class Lexer\r
-{\r
-    protected Token token;\r
-    protected State state = State.INITIAL;\r
-\r
-    private PushbackReader in;\r
-    private int line;\r
-    private int pos;\r
-    private boolean cr;\r
-    private boolean eof;\r
-    private final StringBuffer text = new StringBuffer();\r
-\r
-    @SuppressWarnings("unused")\r
-    protected void filter() throws LexerException, IOException\r
-    {\r
-        // Do nothing\r
-    }\r
-\r
-    public Lexer(@SuppressWarnings("hiding") PushbackReader in)\r
-    {\r
-        this.in = in;\r
-    }\r
\r
-    public Token peek() throws LexerException, IOException\r
-    {\r
-        while(this.token == null)\r
-        {\r
-            this.token = getToken();\r
-            filter();\r
-        }\r
-\r
-        return this.token;\r
-    }\r
-\r
-    public Token next() throws LexerException, IOException\r
-    {\r
-        while(this.token == null)\r
-        {\r
-            this.token = getToken();\r
-            filter();\r
-        }\r
-\r
-        Token result = this.token;\r
-        this.token = null;\r
-        return result;\r
-    }\r
-\r
-    protected Token getToken() throws IOException, LexerException\r
-    {\r
-        int dfa_state = 0;\r
-\r
-        int start_pos = this.pos;\r
-        int start_line = this.line;\r
-\r
-        int accept_state = -1;\r
-        int accept_token = -1;\r
-        int accept_length = -1;\r
-        int accept_pos = -1;\r
-        int accept_line = -1;\r
-\r
-        @SuppressWarnings("hiding") int[][][] gotoTable = Lexer.gotoTable[this.state.id()];\r
-        @SuppressWarnings("hiding") int[] accept = Lexer.accept[this.state.id()];\r
-        this.text.setLength(0);\r
-\r
-        while(true)\r
-        {\r
-            int c = getChar();\r
-\r
-            if(c != -1)\r
-            {\r
-                switch(c)\r
-                {\r
-                case 10:\r
-                    if(this.cr)\r
-                    {\r
-                        this.cr = false;\r
-                    }\r
-                    else\r
-                    {\r
-                        this.line++;\r
-                        this.pos = 0;\r
-                    }\r
-                    break;\r
-                case 13:\r
-                    this.line++;\r
-                    this.pos = 0;\r
-                    this.cr = true;\r
-                    break;\r
-                default:\r
-                    this.pos++;\r
-                    this.cr = false;\r
-                    break;\r
-                }\r
-\r
-                this.text.append((char) c);\r
-\r
-                do\r
-                {\r
-                    int oldState = (dfa_state < -1) ? (-2 -dfa_state) : dfa_state;\r
-\r
-                    dfa_state = -1;\r
-\r
-                    int[][] tmp1 =  gotoTable[oldState];\r
-                    int low = 0;\r
-                    int high = tmp1.length - 1;\r
-\r
-                    while(low <= high)\r
-                    {\r
-                        int middle = (low + high) / 2;\r
-                        int[] tmp2 = tmp1[middle];\r
-\r
-                        if(c < tmp2[0])\r
-                        {\r
-                            high = middle - 1;\r
-                        }\r
-                        else if(c > tmp2[1])\r
-                        {\r
-                            low = middle + 1;\r
-                        }\r
-                        else\r
-                        {\r
-                            dfa_state = tmp2[2];\r
-                            break;\r
-                        }\r
-                    }\r
-                }while(dfa_state < -1);\r
-            }\r
-            else\r
-            {\r
-                dfa_state = -1;\r
-            }\r
-\r
-            if(dfa_state >= 0)\r
-            {\r
-                if(accept[dfa_state] != -1)\r
-                {\r
-                    accept_state = dfa_state;\r
-                    accept_token = accept[dfa_state];\r
-                    accept_length = this.text.length();\r
-                    accept_pos = this.pos;\r
-                    accept_line = this.line;\r
-                }\r
-            }\r
-            else\r
-            {\r
-                if(accept_state != -1)\r
-                {\r
-                    switch(accept_token)\r
-                    {\r
-                    case 0:\r
-                        {\r
-                            @SuppressWarnings("hiding") Token token = new0(\r
-                                start_line + 1,\r
-                                start_pos + 1);\r
-                            pushBack(accept_length);\r
-                            this.pos = accept_pos;\r
-                            this.line = accept_line;\r
-                            return token;\r
-                        }\r
-                    case 1:\r
-                        {\r
-                            @SuppressWarnings("hiding") Token token = new1(\r
-                                start_line + 1,\r
-                                start_pos + 1);\r
-                            pushBack(accept_length);\r
-                            this.pos = accept_pos;\r
-                            this.line = accept_line;\r
-                            return token;\r
-                        }\r
-                    case 2:\r
-                        {\r
-                            @SuppressWarnings("hiding") Token token = new2(\r
-                                start_line + 1,\r
-                                start_pos + 1);\r
-                            pushBack(accept_length);\r
-                            this.pos = accept_pos;\r
-                            this.line = accept_line;\r
-                            return token;\r
-                        }\r
-                    case 3:\r
-                        {\r
-                            @SuppressWarnings("hiding") Token token = new3(\r
-                                start_line + 1,\r
-                                start_pos + 1);\r
-                            pushBack(accept_length);\r
-                            this.pos = accept_pos;\r
-                            this.line = accept_line;\r
-                            return token;\r
-                        }\r
-                    case 4:\r
-                        {\r
-                            @SuppressWarnings("hiding") Token token = new4(\r
-                                start_line + 1,\r
-                                start_pos + 1);\r
-                            pushBack(accept_length);\r
-                            this.pos = accept_pos;\r
-                            this.line = accept_line;\r
-                            return token;\r
-                        }\r
-                    case 5:\r
-                        {\r
-                            @SuppressWarnings("hiding") Token token = new5(\r
-                                start_line + 1,\r
-                                start_pos + 1);\r
-                            pushBack(accept_length);\r
-                            this.pos = accept_pos;\r
-                            this.line = accept_line;\r
-                            return token;\r
-                        }\r
-                    case 6:\r
-                        {\r
-                            @SuppressWarnings("hiding") Token token = new6(\r
-                                start_line + 1,\r
-                                start_pos + 1);\r
-                            pushBack(accept_length);\r
-                            this.pos = accept_pos;\r
-                            this.line = accept_line;\r
-                            return token;\r
-                        }\r
-                    case 7:\r
-                        {\r
-                            @SuppressWarnings("hiding") Token token = new7(\r
-                                start_line + 1,\r
-                                start_pos + 1);\r
-                            pushBack(accept_length);\r
-                            this.pos = accept_pos;\r
-                            this.line = accept_line;\r
-                            return token;\r
-                        }\r
-                    case 8:\r
-                        {\r
-                            @SuppressWarnings("hiding") Token token = new8(\r
-                                start_line + 1,\r
-                                start_pos + 1);\r
-                            pushBack(accept_length);\r
-                            this.pos = accept_pos;\r
-                            this.line = accept_line;\r
-                            return token;\r
-                        }\r
-                    case 9:\r
-                        {\r
-                            @SuppressWarnings("hiding") Token token = new9(\r
-                                start_line + 1,\r
-                                start_pos + 1);\r
-                            pushBack(accept_length);\r
-                            this.pos = accept_pos;\r
-                            this.line = accept_line;\r
-                            return token;\r
-                        }\r
-                    case 10:\r
-                        {\r
-                            @SuppressWarnings("hiding") Token token = new10(\r
-                                start_line + 1,\r
-                                start_pos + 1);\r
-                            pushBack(accept_length);\r
-                            this.pos = accept_pos;\r
-                            this.line = accept_line;\r
-                            return token;\r
-                        }\r
-                    case 11:\r
-                        {\r
-                            @SuppressWarnings("hiding") Token token = new11(\r
-                                start_line + 1,\r
-                                start_pos + 1);\r
-                            pushBack(accept_length);\r
-                            this.pos = accept_pos;\r
-                            this.line = accept_line;\r
-                            return token;\r
-                        }\r
-                    case 12:\r
-                        {\r
-                            @SuppressWarnings("hiding") Token token = new12(\r
-                                getText(accept_length),\r
-                                start_line + 1,\r
-                                start_pos + 1);\r
-                            pushBack(accept_length);\r
-                            this.pos = accept_pos;\r
-                            this.line = accept_line;\r
-                            return token;\r
-                        }\r
-                    case 13:\r
-                        {\r
-                            @SuppressWarnings("hiding") Token token = new13(\r
-                                getText(accept_length),\r
-                                start_line + 1,\r
-                                start_pos + 1);\r
-                            pushBack(accept_length);\r
-                            this.pos = accept_pos;\r
-                            this.line = accept_line;\r
-                            return token;\r
-                        }\r
-                    case 14:\r
-                        {\r
-                            @SuppressWarnings("hiding") Token token = new14(\r
-                                getText(accept_length),\r
-                                start_line + 1,\r
-                                start_pos + 1);\r
-                            pushBack(accept_length);\r
-                            this.pos = accept_pos;\r
-                            this.line = accept_line;\r
-                            return token;\r
-                        }\r
-                    case 15:\r
-                        {\r
-                            @SuppressWarnings("hiding") Token token = new15(\r
-                                getText(accept_length),\r
-                                start_line + 1,\r
-                                start_pos + 1);\r
-                            pushBack(accept_length);\r
-                            this.pos = accept_pos;\r
-                            this.line = accept_line;\r
-                            return token;\r
-                        }\r
-                    case 16:\r
-                        {\r
-                            @SuppressWarnings("hiding") Token token = new16(\r
-                                getText(accept_length),\r
-                                start_line + 1,\r
-                                start_pos + 1);\r
-                            pushBack(accept_length);\r
-                            this.pos = accept_pos;\r
-                            this.line = accept_line;\r
-                            return token;\r
-                        }\r
-                    case 17:\r
-                        {\r
-                            @SuppressWarnings("hiding") Token token = new17(\r
-                                getText(accept_length),\r
-                                start_line + 1,\r
-                                start_pos + 1);\r
-                            pushBack(accept_length);\r
-                            this.pos = accept_pos;\r
-                            this.line = accept_line;\r
-                            return token;\r
-                        }\r
-                    case 18:\r
-                        {\r
-                            @SuppressWarnings("hiding") Token token = new18(\r
-                                getText(accept_length),\r
-                                start_line + 1,\r
-                                start_pos + 1);\r
-                            pushBack(accept_length);\r
-                            this.pos = accept_pos;\r
-                            this.line = accept_line;\r
-                            return token;\r
-                        }\r
-                    case 19:\r
-                        {\r
-                            @SuppressWarnings("hiding") Token token = new19(\r
-                                getText(accept_length),\r
-                                start_line + 1,\r
-                                start_pos + 1);\r
-                            pushBack(accept_length);\r
-                            this.pos = accept_pos;\r
-                            this.line = accept_line;\r
-                            return token;\r
-                        }\r
-                    }\r
-                }\r
-                else\r
-                {\r
-                    if(this.text.length() > 0)\r
-                    {\r
-                        throw new LexerException(\r
-                            "[" + (start_line + 1) + "," + (start_pos + 1) + "]" +\r
-                            " Unknown token: " + this.text);\r
-                    }\r
-\r
-                    @SuppressWarnings("hiding") EOF token = new EOF(\r
-                        start_line + 1,\r
-                        start_pos + 1);\r
-                    return token;\r
-                }\r
-            }\r
-        }\r
-    }\r
-\r
-    Token new0(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TLessThan(line, pos); }\r
-    Token new1(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TGreaterThan(line, pos); }\r
-    Token new2(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TEqual(line, pos); }\r
-    Token new3(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TPlus(line, pos); }\r
-    Token new4(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TMinus(line, pos); }\r
-    Token new5(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TMult(line, pos); }\r
-    Token new6(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TDiv(line, pos); }\r
-    Token new7(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TAmpersand(line, pos); }\r
-    Token new8(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TComma(line, pos); }\r
-    Token new9(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TColon(line, pos); }\r
-    Token new10(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TLPar(line, pos); }\r
-    Token new11(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TRPar(line, pos); }\r
-    Token new12(@SuppressWarnings("hiding") String text, @SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TVariable(text, line, pos); }\r
-    Token new13(@SuppressWarnings("hiding") String text, @SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TFunc(text, line, pos); }\r
-    Token new14(@SuppressWarnings("hiding") String text, @SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TCell(text, line, pos); }\r
-    Token new15(@SuppressWarnings("hiding") String text, @SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TRvi(text, line, pos); }\r
-    Token new16(@SuppressWarnings("hiding") String text, @SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TNumber(text, line, pos); }\r
-    Token new17(@SuppressWarnings("hiding") String text, @SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TString(text, line, pos); }\r
-    Token new18(@SuppressWarnings("hiding") String text, @SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TNewLine(text, line, pos); }\r
-    Token new19(@SuppressWarnings("hiding") String text, @SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TBlank(text, line, pos); }\r
-\r
-    private int getChar() throws IOException\r
-    {\r
-        if(this.eof)\r
-        {\r
-            return -1;\r
-        }\r
-\r
-        int result = this.in.read();\r
-\r
-        if(result == -1)\r
-        {\r
-            this.eof = true;\r
-        }\r
-\r
-        return result;\r
-    }\r
-\r
-    private void pushBack(int acceptLength) throws IOException\r
-    {\r
-        int length = this.text.length();\r
-        for(int i = length - 1; i >= acceptLength; i--)\r
-        {\r
-            this.eof = false;\r
-\r
-            this.in.unread(this.text.charAt(i));\r
-        }\r
-    }\r
-\r
-    protected void unread(@SuppressWarnings("hiding") Token token) throws IOException\r
-    {\r
-        @SuppressWarnings("hiding") String text = token.getText();\r
-        int length = text.length();\r
-\r
-        for(int i = length - 1; i >= 0; i--)\r
-        {\r
-            this.eof = false;\r
-\r
-            this.in.unread(text.charAt(i));\r
-        }\r
-\r
-        this.pos = token.getPos() - 1;\r
-        this.line = token.getLine() - 1;\r
-    }\r
-\r
-    private String getText(int acceptLength)\r
-    {\r
-        StringBuffer s = new StringBuffer(acceptLength);\r
-        for(int i = 0; i < acceptLength; i++)\r
-        {\r
-            s.append(this.text.charAt(i));\r
-        }\r
-\r
-        return s.toString();\r
-    }\r
-\r
-    private static int[][][][] gotoTable;\r
-/*  {\r
-        { // INITIAL\r
-            {{10, 10, 1}, {13, 13, 2}, {32, 32, 3}, {34, 34, 4}, {35, 35, 5}, {38, 38, 6}, {39, 39, 7}, {40, 40, 8}, {41, 41, 9}, {42, 42, 10}, {43, 43, 11}, {44, 44, 12}, {45, 45, 13}, {46, 46, 14}, {47, 47, 15}, {48, 57, 16}, {58, 58, 17}, {60, 60, 18}, {61, 61, 19}, {62, 62, 20}, {65, 90, 21}, {95, 95, 22}, {97, 122, 21}, },\r
-            {},\r
-            {{10, 10, 23}, },\r
-            {{32, 32, 3}, },\r
-            {{32, 33, 24}, {34, 34, 25}, {35, 38, 24}, {39, 39, 26}, {40, 91, 24}, {93, 255, 24}, },\r
-            {{35, 35, 27}, {46, 46, 28}, {47, 47, 29}, {48, 57, 30}, {65, 90, 31}, {95, 95, 32}, {97, 122, 31}, },\r
-            {},\r
-            {{32, 33, 33}, {34, 34, 34}, {35, 38, 33}, {39, 39, 35}, {40, 91, 33}, {93, 255, 33}, },\r
-            {},\r
-            {},\r
-            {},\r
-            {},\r
-            {},\r
-            {},\r
-            {{35, 35, 5}, {46, 46, 14}, {47, 47, 36}, },\r
-            {{35, 122, -7}, },\r
-            {{46, 46, 37}, {48, 57, 38}, },\r
-            {},\r
-            {},\r
-            {},\r
-            {},\r
-            {{40, 40, 39}, {48, 57, 40}, {65, 90, 41}, {95, 95, 41}, {97, 122, 41}, },\r
-            {{40, 122, -23}, },\r
-            {},\r
-            {{32, 255, -6}, },\r
-            {},\r
-            {{32, 255, -6}, },\r
-            {{35, 122, -7}, },\r
-            {{35, 122, -7}, },\r
-            {{35, 122, -7}, },\r
-            {{35, 122, -7}, },\r
-            {{35, 122, -7}, },\r
-            {{35, 122, -7}, },\r
-            {{32, 255, -9}, },\r
-            {{32, 255, -9}, },\r
-            {},\r
-            {{35, 122, -7}, },\r
-            {{46, 46, 37}, {48, 57, 42}, },\r
-            {{46, 57, -18}, },\r
-            {},\r
-            {{40, 57, -23}, {65, 90, 43}, {95, 95, 43}, {97, 122, 43}, },\r
-            {{40, 122, -23}, },\r
-            {{48, 57, 42}, },\r
-            {{40, 40, 39}, {48, 57, 44}, {65, 122, -42}, },\r
-            {{40, 122, -45}, },\r
-        }\r
-    };*/\r
-\r
-    private static int[][] accept;\r
-/*  {\r
-        // INITIAL\r
-        {19, 18, 18, 19, -1, 15, 7, -1, 10, 11, 5, 3, 8, 4, -1, 6, 16, 9, 0, 2, 1, 12, 12, 18, -1, 17, -1, 15, 15, 15, 15, 15, 15, -1, -1, 17, 15, 16, 16, 13, 12, 12, 16, 12, 12, },\r
-\r
-    };*/\r
-\r
-    public static class State\r
-    {\r
-        public final static State INITIAL = new State(0);\r
-\r
-        private int id;\r
-\r
-        private State(@SuppressWarnings("hiding") int id)\r
-        {\r
-            this.id = id;\r
-        }\r
-\r
-        public int id()\r
-        {\r
-            return this.id;\r
-        }\r
-    }\r
-\r
-    static \r
-    {\r
-        try\r
-        {\r
-            DataInputStream s = new DataInputStream(\r
-                new BufferedInputStream(\r
-                Lexer.class.getResourceAsStream("lexer.dat")));\r
-\r
-            // read gotoTable\r
-            int length = s.readInt();\r
-            gotoTable = new int[length][][][];\r
-            for(int i = 0; i < gotoTable.length; i++)\r
-            {\r
-                length = s.readInt();\r
-                gotoTable[i] = new int[length][][];\r
-                for(int j = 0; j < gotoTable[i].length; j++)\r
-                {\r
-                    length = s.readInt();\r
-                    gotoTable[i][j] = new int[length][3];\r
-                    for(int k = 0; k < gotoTable[i][j].length; k++)\r
-                    {\r
-                        for(int l = 0; l < 3; l++)\r
-                        {\r
-                            gotoTable[i][j][k][l] = s.readInt();\r
-                        }\r
-                    }\r
-                }\r
-            }\r
-\r
-            // read accept\r
-            length = s.readInt();\r
-            accept = new int[length][];\r
-            for(int i = 0; i < accept.length; i++)\r
-            {\r
-                length = s.readInt();\r
-                accept[i] = new int[length];\r
-                for(int j = 0; j < accept[i].length; j++)\r
-                {\r
-                    accept[i][j] = s.readInt();\r
-                }\r
-            }\r
-\r
-            s.close();\r
-        }\r
-        catch(Exception e)\r
-        {\r
-            throw new RuntimeException("The file \"lexer.dat\" is either missing or corrupted.");\r
-        }\r
-    }\r
-}\r
+/* This file was generated by SableCC (http://www.sablecc.org/). */
+
+package org.simantics.basicexpression.lexer;
+
+import java.io.*;
+import org.simantics.basicexpression.node.*;
+
+@SuppressWarnings("nls")
+public class Lexer
+{
+    protected Token token;
+    protected State state = State.INITIAL;
+
+    private PushbackReader 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") PushbackReader 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[] 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(
+                                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(
+                                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(
+                                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(
+                                getText(accept_length),
+                                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(
+                                getText(accept_length),
+                                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(
+                                getText(accept_length),
+                                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(
+                                getText(accept_length),
+                                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(
+                                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(
+                            "[" + (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 TLessThan(line, pos); }
+    Token new1(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TGreaterThan(line, pos); }
+    Token new2(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TEqual(line, pos); }
+    Token new3(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TPlus(line, pos); }
+    Token new4(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TMinus(line, pos); }
+    Token new5(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TMult(line, pos); }
+    Token new6(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TDiv(line, pos); }
+    Token new7(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TAmpersand(line, pos); }
+    Token new8(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TComma(line, pos); }
+    Token new9(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TColon(line, pos); }
+    Token new10(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TLPar(line, pos); }
+    Token new11(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TRPar(line, pos); }
+    Token new12(@SuppressWarnings("hiding") String text, @SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TVariable(text, line, pos); }
+    Token new13(@SuppressWarnings("hiding") String text, @SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TFunc(text, line, pos); }
+    Token new14(@SuppressWarnings("hiding") String text, @SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TCell(text, line, pos); }
+    Token new15(@SuppressWarnings("hiding") String text, @SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TRvi(text, line, pos); }
+    Token new16(@SuppressWarnings("hiding") String text, @SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TNumber(text, line, pos); }
+    Token new17(@SuppressWarnings("hiding") String text, @SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TString(text, line, pos); }
+    Token new18(@SuppressWarnings("hiding") String text, @SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TNewLine(text, line, pos); }
+    Token new19(@SuppressWarnings("hiding") String text, @SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new TBlank(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}, {34, 34, 4}, {35, 35, 5}, {38, 38, 6}, {39, 39, 7}, {40, 40, 8}, {41, 41, 9}, {42, 42, 10}, {43, 43, 11}, {44, 44, 12}, {45, 45, 13}, {46, 46, 14}, {47, 47, 15}, {48, 57, 16}, {58, 58, 17}, {60, 60, 18}, {61, 61, 19}, {62, 62, 20}, {65, 90, 21}, {95, 95, 22}, {97, 122, 21}, },
+            {},
+            {{10, 10, 23}, },
+            {{32, 32, 3}, },
+            {{32, 33, 24}, {34, 34, 25}, {35, 38, 24}, {39, 39, 26}, {40, 91, 24}, {93, 255, 24}, },
+            {{35, 35, 27}, {46, 46, 28}, {47, 47, 29}, {48, 57, 30}, {65, 90, 31}, {95, 95, 32}, {97, 122, 31}, },
+            {},
+            {{32, 33, 33}, {34, 34, 34}, {35, 38, 33}, {39, 39, 35}, {40, 91, 33}, {93, 255, 33}, },
+            {},
+            {},
+            {},
+            {},
+            {},
+            {},
+            {{35, 35, 5}, {46, 46, 14}, {47, 47, 36}, },
+            {{35, 122, -7}, },
+            {{46, 46, 37}, {48, 57, 38}, },
+            {},
+            {},
+            {},
+            {},
+            {{40, 40, 39}, {48, 57, 40}, {65, 90, 41}, {95, 95, 41}, {97, 122, 41}, },
+            {{40, 122, -23}, },
+            {},
+            {{32, 255, -6}, },
+            {},
+            {{32, 255, -6}, },
+            {{35, 122, -7}, },
+            {{35, 122, -7}, },
+            {{35, 122, -7}, },
+            {{35, 122, -7}, },
+            {{35, 122, -7}, },
+            {{35, 122, -7}, },
+            {{32, 255, -9}, },
+            {{32, 255, -9}, },
+            {},
+            {{35, 122, -7}, },
+            {{46, 46, 37}, {48, 57, 42}, },
+            {{46, 57, -18}, },
+            {},
+            {{40, 57, -23}, {65, 90, 43}, {95, 95, 43}, {97, 122, 43}, },
+            {{40, 122, -23}, },
+            {{48, 57, 42}, },
+            {{40, 40, 39}, {48, 57, 44}, {65, 122, -42}, },
+            {{40, 122, -45}, },
+        }
+    };*/
+
+    private static int[][] accept;
+/*  {
+        // INITIAL
+        {19, 18, 18, 19, -1, 15, 7, -1, 10, 11, 5, 3, 8, 4, -1, 6, 16, 9, 0, 2, 1, 12, 12, 18, -1, 17, -1, 15, 15, 15, 15, 15, 15, -1, -1, 17, 15, 16, 16, 13, 12, 12, 16, 12, 12, },
+
+    };*/
+
+    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.");
+        }
+    }
+}