Пример #1
0
    public void mCOMMENT(bool _createToken)     //throws RecognitionException, CharStreamException, TokenStreamException
    {
        int _ttype; Token _token = null; int _begin = text.Length;

        _ttype = COMMENT;

        match("//");
        {            // ( ... )*
            for (;;)
            {
                if ((tokenSet_0_.member(LA(1))))
                {
                    {
                        match(tokenSet_0_);
                    }
                }
                else
                {
                    goto _loop15_breakloop;
                }
            }
            _loop15_breakloop :;
        }            // ( ... )*
        _ttype = Token.SKIP;
        if (_createToken && (null == _token) && (_ttype != Token.SKIP))
        {
            _token = makeToken(_ttype);
            _token.setText(text.ToString(_begin, text.Length - _begin));
        }
        returnToken_ = _token;
    }
Пример #2
0
    public void mSTRING_LITERAL(bool _createToken)     //throws RecognitionException, CharStreamException, TokenStreamException
    {
        int _ttype; Token _token = null; int _begin = text.Length;

        _ttype = STRING_LITERAL;

        int _saveIndex = 0;

        _saveIndex = text.Length;
        match('"');
        text.Length = _saveIndex;
        {            // ( ... )*
            for (;;)
            {
                if ((LA(1) == '"') && (LA(2) == '"'))
                {
                    match('"');
                    _saveIndex = text.Length;
                    match('"');
                    text.Length = _saveIndex;
                }
                else if ((tokenSet_1_.member(LA(1))))
                {
                    {
                        match(tokenSet_1_);
                    }
                }
                else
                {
                    goto _loop24_breakloop;
                }
            }
            _loop24_breakloop :;
        }            // ( ... )*
        {
            if ((LA(1) == '"'))
            {
                _saveIndex = text.Length;
                match('"');
                text.Length = _saveIndex;
            }
            else
            {
            }
        }
        if (_createToken && (null == _token) && (_ttype != Token.SKIP))
        {
            _token = makeToken(_ttype);
            _token.setText(text.ToString(_begin, text.Length - _begin));
        }
        returnToken_ = _token;
    }
Пример #3
0
    protected void mDIGIT(bool _createToken)     //throws RecognitionException, CharStreamException, TokenStreamException
    {
        int _ttype; Token _token = null; int _begin = text.Length;

        _ttype = DIGIT;

        matchRange('0', '9');
        if (_createToken && (null == _token) && (_ttype != Token.SKIP))
        {
            _token = makeToken(_ttype);
            _token.setText(text.ToString(_begin, text.Length - _begin));
        }
        returnToken_ = _token;
    }
Пример #4
0
    public void mRCURLY(bool _createToken)     //throws RecognitionException, CharStreamException, TokenStreamException
    {
        int _ttype; Token _token = null; int _begin = text.Length;

        _ttype = RCURLY;

        match(')');
        if (_createToken && (null == _token) && (_ttype != Token.SKIP))
        {
            _token = makeToken(_ttype);
            _token.setText(text.ToString(_begin, text.Length - _begin));
        }
        returnToken_ = _token;
    }
Пример #5
0
    public void mCHARLIT(bool _createToken)     //throws RecognitionException, CharStreamException, TokenStreamException
    {
        int _ttype; Token _token = null; int _begin = text.Length;

        _ttype = CHARLIT;

        int _saveIndex = 0;

        _saveIndex = text.Length;
        match('\'');
        text.Length = _saveIndex;
        matchNot(EOF /*_CHAR*/);
        _saveIndex = text.Length;
        match('\'');
        text.Length = _saveIndex;
        if (_createToken && (null == _token) && (_ttype != Token.SKIP))
        {
            _token = makeToken(_ttype);
            _token.setText(text.ToString(_begin, text.Length - _begin));
        }
        returnToken_ = _token;
    }
Пример #6
0
    public void mINTLIT(bool _createToken)     //throws RecognitionException, CharStreamException, TokenStreamException
    {
        int _ttype; Token _token = null; int _begin = text.Length;

        _ttype = INTLIT;

        {         // ( ... )+
            int _cnt19 = 0;
            for (;;)
            {
                if (((LA(1) >= '0' && LA(1) <= '9')))
                {
                    mDIGIT(false);
                }
                else
                {
                    if (_cnt19 >= 1)
                    {
                        goto _loop19_breakloop;
                    }
                    else
                    {
                        throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());;
                    }
                }

                _cnt19++;
            }
            _loop19_breakloop :;
        }            // ( ... )+
        if (_createToken && (null == _token) && (_ttype != Token.SKIP))
        {
            _token = makeToken(_ttype);
            _token.setText(text.ToString(_begin, text.Length - _begin));
        }
        returnToken_ = _token;
    }
Пример #7
0
    public void mID(bool _createToken)     //throws RecognitionException, CharStreamException, TokenStreamException
    {
        int _ttype; Token _token = null; int _begin = text.Length;

        _ttype = ID;

        {
            switch (LA(1))
            {
            case 'a':
            case 'b':
            case 'c':
            case 'd':
            case 'e':
            case 'f':
            case 'g':
            case 'h':
            case 'i':
            case 'j':
            case 'k':
            case 'l':
            case 'm':
            case 'n':
            case 'o':
            case 'p':
            case 'q':
            case 'r':
            case 's':
            case 't':
            case 'u':
            case 'v':
            case 'w':
            case 'x':
            case 'y':
            case 'z':
            {
                matchRange('a', 'z');
                break;
            }

            case 'A':
            case 'B':
            case 'C':
            case 'D':
            case 'E':
            case 'F':
            case 'G':
            case 'H':
            case 'I':
            case 'J':
            case 'K':
            case 'L':
            case 'M':
            case 'N':
            case 'O':
            case 'P':
            case 'Q':
            case 'R':
            case 'S':
            case 'T':
            case 'U':
            case 'V':
            case 'W':
            case 'X':
            case 'Y':
            case 'Z':
            {
                matchRange('A', 'Z');
                break;
            }

            case '_':
            {
                match('_');
                break;
            }

            default:
            {
                throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
            }
            }
        }
        {            // ( ... )*
            for (;;)
            {
                switch (LA(1))
                {
                case 'a':
                case 'b':
                case 'c':
                case 'd':
                case 'e':
                case 'f':
                case 'g':
                case 'h':
                case 'i':
                case 'j':
                case 'k':
                case 'l':
                case 'm':
                case 'n':
                case 'o':
                case 'p':
                case 'q':
                case 'r':
                case 's':
                case 't':
                case 'u':
                case 'v':
                case 'w':
                case 'x':
                case 'y':
                case 'z':
                {
                    matchRange('a', 'z');
                    break;
                }

                case 'A':
                case 'B':
                case 'C':
                case 'D':
                case 'E':
                case 'F':
                case 'G':
                case 'H':
                case 'I':
                case 'J':
                case 'K':
                case 'L':
                case 'M':
                case 'N':
                case 'O':
                case 'P':
                case 'Q':
                case 'R':
                case 'S':
                case 'T':
                case 'U':
                case 'V':
                case 'W':
                case 'X':
                case 'Y':
                case 'Z':
                {
                    matchRange('A', 'Z');
                    break;
                }

                case '0':
                case '1':
                case '2':
                case '3':
                case '4':
                case '5':
                case '6':
                case '7':
                case '8':
                case '9':
                {
                    matchRange('0', '9');
                    break;
                }

                case '_': {
                    match('_');
                    break;
                }

                default: {
                    goto _loop32_breakloop;
                }
                }
            }
            _loop32_breakloop :;
        }            // ( ... )*
        _ttype = testLiteralsTable(_ttype);
        if (_createToken && (null == _token) && (_ttype != Token.SKIP))
        {
            _token = makeToken(_ttype);
            _token.setText(text.ToString(_begin, text.Length - _begin));
        }
        returnToken_ = _token;
    }
Пример #8
0
    public void mWS(bool _createToken)     //throws RecognitionException, CharStreamException, TokenStreamException
    {
        int _ttype; Token _token = null; int _begin = text.Length;

        _ttype = WS;

        {
            switch (LA(1))
            {
            case ' ':
            {
                match(' ');
                break;
            }

            case '\t':
            {
                match('\t');
                break;
            }

            case '\u000c':
            {
                match('\f');
                break;
            }

            case '\n':
            case '\r':
            {
                {
                    if ((LA(1) == '\r') && (LA(2) == '\n'))
                    {
                        match("\r\n");
                    }
                    else if ((LA(1) == '\r') && (true))
                    {
                        match('\r');
                    }
                    else if ((LA(1) == '\n'))
                    {
                        match('\n');
                    }
                    else
                    {
                        throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
                    }
                }
                newline();
                break;
            }

            default:
            {
                throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
            }
            }
        }
        _ttype = Token.SKIP;
        if (_createToken && (null == _token) && (_ttype != Token.SKIP))
        {
            _token = makeToken(_ttype);
            _token.setText(text.ToString(_begin, text.Length - _begin));
        }
        returnToken_ = _token;
    }