Package antlr

Examples of antlr.Token


    {
        StringBuilder b = new StringBuilder();
        ParsedStatement stmt = new ParsedStatement();
        ColonStatementLexer lexer = new ColonStatementLexer(new StringReader(sql));
        try {
            Token t = lexer.nextToken();
            while (t.getType() != EOF) {
                switch (t.getType()) {
                    case LITERAL:
                        b.append(t.getText());
                        break;
                    case NAMED_PARAM:
                        stmt.addNamedParamAt(t.getText().substring(1, t.getText().length()));
                        b.append("?");
                        break;
                    case QUOTED_TEXT:
                        b.append(t.getText());
                        break;
                    case DOUBLE_QUOTED_TEXT:
                        b.append(t.getText());
                        break;
                    case POSITIONAAL_PARAM:
                        b.append("?");
                        stmt.addPositionalParamAt();
                        break;
View Full Code Here


                      new Integer( 66 ) );
    }

    public Token nextToken() throws TokenStreamException
    {
        Token theRetToken = null;
        tryAgain : for ( ;; )
        {
            Token _token = null;
            int _ttype = Token.INVALID_TYPE;
            resetText();
            try
            { // for char stream error handling
                try
View Full Code Here

    public final void mQUESTION(boolean _createToken) throws RecognitionException,
                                                     CharStreamException,
                                                     TokenStreamException
    {
        int _ttype;
        Token _token = null;
        int _begin = text.length();
        _ttype = QUESTION;
        int _saveIndex;

        match( '?' );
        if ( _createToken && _token == null && _ttype != Token.SKIP )
        {
            _token = makeToken( _ttype );
            _token.setText( new String( text.getBuffer(),
                                        _begin,
                                        text.length() - _begin ) );
        }
        _returnToken = _token;
    }
View Full Code Here

    public final void mLPAREN(boolean _createToken) throws RecognitionException,
                                                   CharStreamException,
                                                   TokenStreamException
    {
        int _ttype;
        Token _token = null;
        int _begin = text.length();
        _ttype = LPAREN;
        int _saveIndex;

        match( '(' );
        if ( _createToken && _token == null && _ttype != Token.SKIP )
        {
            _token = makeToken( _ttype );
            _token.setText( new String( text.getBuffer(),
                                        _begin,
                                        text.length() - _begin ) );
        }
        _returnToken = _token;
    }
View Full Code Here

    public final void mRPAREN(boolean _createToken) throws RecognitionException,
                                                   CharStreamException,
                                                   TokenStreamException
    {
        int _ttype;
        Token _token = null;
        int _begin = text.length();
        _ttype = RPAREN;
        int _saveIndex;

        match( ')' );
        if ( _createToken && _token == null && _ttype != Token.SKIP )
        {
            _token = makeToken( _ttype );
            _token.setText( new String( text.getBuffer(),
                                        _begin,
                                        text.length() - _begin ) );
        }
        _returnToken = _token;
    }
View Full Code Here

    public final void mLBRACK(boolean _createToken) throws RecognitionException,
                                                   CharStreamException,
                                                   TokenStreamException
    {
        int _ttype;
        Token _token = null;
        int _begin = text.length();
        _ttype = LBRACK;
        int _saveIndex;

        match( '[' );
        if ( _createToken && _token == null && _ttype != Token.SKIP )
        {
            _token = makeToken( _ttype );
            _token.setText( new String( text.getBuffer(),
                                        _begin,
                                        text.length() - _begin ) );
        }
        _returnToken = _token;
    }
View Full Code Here

    public final void mRBRACK(boolean _createToken) throws RecognitionException,
                                                   CharStreamException,
                                                   TokenStreamException
    {
        int _ttype;
        Token _token = null;
        int _begin = text.length();
        _ttype = RBRACK;
        int _saveIndex;

        match( ']' );
        if ( _createToken && _token == null && _ttype != Token.SKIP )
        {
            _token = makeToken( _ttype );
            _token.setText( new String( text.getBuffer(),
                                        _begin,
                                        text.length() - _begin ) );
        }
        _returnToken = _token;
    }
View Full Code Here

    public final void mLCURLY(boolean _createToken) throws RecognitionException,
                                                   CharStreamException,
                                                   TokenStreamException
    {
        int _ttype;
        Token _token = null;
        int _begin = text.length();
        _ttype = LCURLY;
        int _saveIndex;

        match( '{' );
        if ( _createToken && _token == null && _ttype != Token.SKIP )
        {
            _token = makeToken( _ttype );
            _token.setText( new String( text.getBuffer(),
                                        _begin,
                                        text.length() - _begin ) );
        }
        _returnToken = _token;
    }
View Full Code Here

    public final void mRCURLY(boolean _createToken) throws RecognitionException,
                                                   CharStreamException,
                                                   TokenStreamException
    {
        int _ttype;
        Token _token = null;
        int _begin = text.length();
        _ttype = RCURLY;
        int _saveIndex;

        match( '}' );
        if ( _createToken && _token == null && _ttype != Token.SKIP )
        {
            _token = makeToken( _ttype );
            _token.setText( new String( text.getBuffer(),
                                        _begin,
                                        text.length() - _begin ) );
        }
        _returnToken = _token;
    }
View Full Code Here

    public final void mCOLON(boolean _createToken) throws RecognitionException,
                                                  CharStreamException,
                                                  TokenStreamException
    {
        int _ttype;
        Token _token = null;
        int _begin = text.length();
        _ttype = COLON;
        int _saveIndex;

        match( ':' );
        if ( _createToken && _token == null && _ttype != Token.SKIP )
        {
            _token = makeToken( _ttype );
            _token.setText( new String( text.getBuffer(),
                                        _begin,
                                        text.length() - _begin ) );
        }
        _returnToken = _token;
    }
View Full Code Here

TOP

Related Classes of antlr.Token

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.