Search in sources :

Example 86 with Token

use of antlr.Token in project sonar-java by SonarSource.

the class ValidWhenLexer method mNOTEQUALSIGN.

public final void mNOTEQUALSIGN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype;
    Token _token = null;
    int _begin = text.length();
    _ttype = NOTEQUALSIGN;
    int _saveIndex;
    match('!');
    match('=');
    if (_createToken && _token == null && _ttype != Token.SKIP) {
        _token = makeToken(_ttype);
        _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
    }
    _returnToken = _token;
}
Also used : Token(antlr.Token) CommonToken(antlr.CommonToken) ANTLRHashString(antlr.ANTLRHashString)

Example 87 with Token

use of antlr.Token in project sonar-java by SonarSource.

the class ValidWhenLexer method mTHIS.

public final void mTHIS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype;
    Token _token = null;
    int _begin = text.length();
    _ttype = THIS;
    int _saveIndex;
    match("*this*");
    if (_createToken && _token == null && _ttype != Token.SKIP) {
        _token = makeToken(_ttype);
        _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
    }
    _returnToken = _token;
}
Also used : Token(antlr.Token) CommonToken(antlr.CommonToken) ANTLRHashString(antlr.ANTLRHashString)

Example 88 with Token

use of antlr.Token in project sonar-java by SonarSource.

the class ValidWhenLexer method mHEX_LITERAL.

public final void mHEX_LITERAL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype;
    Token _token = null;
    int _begin = text.length();
    _ttype = HEX_LITERAL;
    int _saveIndex;
    match('0');
    match('x');
    {
        int _cnt23 = 0;
        _loop23: do {
            switch(LA(1)) {
                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 'a':
                case 'b':
                case 'c':
                case 'd':
                case 'e':
                case 'f':
                    {
                        matchRange('a', 'f');
                        break;
                    }
                default:
                    {
                        if (_cnt23 >= 1) {
                            break _loop23;
                        } else {
                            throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn());
                        }
                    }
            }
            _cnt23++;
        } while (true);
    }
    if (_createToken && _token == null && _ttype != Token.SKIP) {
        _token = makeToken(_ttype);
        _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
    }
    _returnToken = _token;
}
Also used : NoViableAltForCharException(antlr.NoViableAltForCharException) Token(antlr.Token) CommonToken(antlr.CommonToken) ANTLRHashString(antlr.ANTLRHashString)

Example 89 with Token

use of antlr.Token in project sonar-java by SonarSource.

the class ValidWhenLexer method mWS.

public final void mWS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype;
    Token _token = null;
    int _begin = text.length();
    _ttype = WS;
    int _saveIndex;
    {
        int _cnt15 = 0;
        _loop15: do {
            switch(LA(1)) {
                case ' ':
                    {
                        match(' ');
                        break;
                    }
                case '\t':
                    {
                        match('\t');
                        break;
                    }
                case '\n':
                    {
                        match('\n');
                        break;
                    }
                case '\r':
                    {
                        match('\r');
                        break;
                    }
                default:
                    {
                        if (_cnt15 >= 1) {
                            break _loop15;
                        } else {
                            throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn());
                        }
                    }
            }
            _cnt15++;
        } while (true);
    }
    _ttype = Token.SKIP;
    if (_createToken && _token == null && _ttype != Token.SKIP) {
        _token = makeToken(_ttype);
        _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
    }
    _returnToken = _token;
}
Also used : NoViableAltForCharException(antlr.NoViableAltForCharException) Token(antlr.Token) CommonToken(antlr.CommonToken) ANTLRHashString(antlr.ANTLRHashString)

Example 90 with Token

use of antlr.Token in project sonar-java by SonarSource.

the class ValidWhenLexer method mLESSTHANSIGN.

public final void mLESSTHANSIGN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype;
    Token _token = null;
    int _begin = text.length();
    _ttype = LESSTHANSIGN;
    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;
}
Also used : Token(antlr.Token) CommonToken(antlr.CommonToken) ANTLRHashString(antlr.ANTLRHashString)

Aggregations

Token (antlr.Token)218 ANTLRHashString (antlr.ANTLRHashString)163 CommonToken (antlr.CommonToken)138 NoViableAltForCharException (antlr.NoViableAltForCharException)53 RecognitionException (antlr.RecognitionException)40 NoViableAltException (antlr.NoViableAltException)33 TokenStreamRecognitionException (antlr.TokenStreamRecognitionException)8 CharStreamException (antlr.CharStreamException)6 CharStreamIOException (antlr.CharStreamIOException)6 TokenStreamException (antlr.TokenStreamException)6 TokenStreamIOException (antlr.TokenStreamIOException)6 AST (antlr.collections.AST)2 Constructor (java.lang.reflect.Constructor)2 GroovyLexer (org.codehaus.groovy.antlr.parser.GroovyLexer)2 GroovyRecognizer (org.codehaus.groovy.antlr.parser.GroovyRecognizer)2 ASTPair (antlr.ASTPair)1 CharScanner (antlr.CharScanner)1 BadLocationException (javax.swing.text.BadLocationException)1