Search in sources :

Example 11 with NoViableAltForCharException

use of antlr.NoViableAltForCharException in project jasn1 by openmuc.

the class ASNLexer method mB_STRING.

protected final void mB_STRING(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype;
    Token _token = null;
    int _begin = text.length();
    _ttype = B_STRING;
    int _saveIndex;
    mSINGLE_QUOTE(false);
    {
        int _cnt70 = 0;
        _loop70: do {
            if ((LA(1) == '0' || LA(1) == '1')) {
                mBDIG(false);
            } else {
                if (_cnt70 >= 1) {
                    break _loop70;
                } else {
                    throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn());
                }
            }
            _cnt70++;
        } while (true);
    }
    mSINGLE_QUOTE(false);
    match('B');
    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 12 with NoViableAltForCharException

use of antlr.NoViableAltForCharException in project jasn1 by openmuc.

the class ASNLexer 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 _cnt29 = 0;
        _loop29: do {
            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') && (true) && (true) && (true) && (true) && (true) && (true) && (true) && (true) && (true)) {
                                match("\r\n");
                                if (inputState.guessing == 0) {
                                    newline();
                                }
                            } else if ((LA(1) == '\r') && (true) && (true) && (true) && (true) && (true) && (true) && (true) && (true) && (true) && (true)) {
                                match('\r');
                                if (inputState.guessing == 0) {
                                    newline();
                                }
                            } else if ((LA(1) == '\n')) {
                                match('\n');
                                if (inputState.guessing == 0) {
                                    newline();
                                }
                            } else {
                                throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn());
                            }
                        }
                        break;
                    }
                default:
                    {
                        if (_cnt29 >= 1) {
                            break _loop29;
                        } else {
                            throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn());
                        }
                    }
            }
            _cnt29++;
        } while (true);
    }
    if (inputState.guessing == 0) {
        _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 13 with NoViableAltForCharException

use of antlr.NoViableAltForCharException 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 14 with NoViableAltForCharException

use of antlr.NoViableAltForCharException 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 15 with NoViableAltForCharException

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

the class ValidWhenLexer method mDECIMAL_LITERAL.

public final void mDECIMAL_LITERAL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype;
    Token _token = null;
    int _begin = text.length();
    _ttype = DECIMAL_LITERAL;
    int _saveIndex;
    {
        switch(LA(1)) {
            case '-':
                {
                    match('-');
                    break;
                }
            case '1':
            case '2':
            case '3':
            case '4':
            case '5':
            case '6':
            case '7':
            case '8':
            case '9':
                {
                    break;
                }
            default:
                {
                    throw new NoViableAltForCharException((char) LA(1), getFilename(), getLine(), getColumn());
                }
        }
    }
    {
        matchRange('1', '9');
    }
    {
        _loop20: do {
            if (((LA(1) >= '0' && LA(1) <= '9'))) {
                matchRange('0', '9');
            } else {
                break _loop20;
            }
        } 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)

Aggregations

NoViableAltForCharException (antlr.NoViableAltForCharException)55 Token (antlr.Token)53 ANTLRHashString (antlr.ANTLRHashString)47 CommonToken (antlr.CommonToken)44 RecognitionException (antlr.RecognitionException)7 TokenStreamRecognitionException (antlr.TokenStreamRecognitionException)7 CharStreamException (antlr.CharStreamException)6 CharStreamIOException (antlr.CharStreamIOException)6 TokenStreamException (antlr.TokenStreamException)6 TokenStreamIOException (antlr.TokenStreamIOException)6 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