Search in sources :

Example 6 with NoViableAltForCharException

use of antlr.NoViableAltForCharException in project sonarqube 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 7 with NoViableAltForCharException

use of antlr.NoViableAltForCharException in project sonarqube 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 8 with NoViableAltForCharException

use of antlr.NoViableAltForCharException in project sonarqube by SonarSource.

the class ValidWhenLexer method mSTRING_LITERAL.

public final void mSTRING_LITERAL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype;
    Token _token = null;
    int _begin = text.length();
    _ttype = STRING_LITERAL;
    int _saveIndex;
    switch(LA(1)) {
        case '\'':
            {
                {
                    match('\'');
                    {
                        int _cnt30 = 0;
                        _loop30: do {
                            if ((_tokenSet_0.member(LA(1)))) {
                                matchNot('\'');
                            } else {
                                if (_cnt30 >= 1) {
                                    break _loop30;
                                } else {
                                    throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn());
                                }
                            }
                            _cnt30++;
                        } while (true);
                    }
                    match('\'');
                }
                break;
            }
        case '"':
            {
                {
                    match('\"');
                    {
                        int _cnt33 = 0;
                        _loop33: do {
                            if ((_tokenSet_1.member(LA(1)))) {
                                matchNot('\"');
                            } else {
                                if (_cnt33 >= 1) {
                                    break _loop33;
                                } else {
                                    throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn());
                                }
                            }
                            _cnt33++;
                        } while (true);
                    }
                    match('\"');
                }
                break;
            }
        default:
            {
                throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn());
            }
    }
    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)

Aggregations

NoViableAltForCharException (antlr.NoViableAltForCharException)8 CommonToken (antlr.CommonToken)6 Token (antlr.Token)6 ANTLRHashString (antlr.ANTLRHashString)5 MismatchedCharException (antlr.MismatchedCharException)2 MismatchedTokenException (antlr.MismatchedTokenException)2 NoViableAltException (antlr.NoViableAltException)2 Message (org.codehaus.groovy.control.messages.Message)2 SimpleMessage (org.codehaus.groovy.control.messages.SimpleMessage)2 SyntaxErrorMessage (org.codehaus.groovy.control.messages.SyntaxErrorMessage)2 CharStreamException (antlr.CharStreamException)1 CharStreamIOException (antlr.CharStreamIOException)1 RecognitionException (antlr.RecognitionException)1 TokenStreamException (antlr.TokenStreamException)1 TokenStreamIOException (antlr.TokenStreamIOException)1 TokenStreamRecognitionException (antlr.TokenStreamRecognitionException)1