Search in sources :

Example 11 with NoViableAltException

use of antlr.NoViableAltException in project jasn1 by openmuc.

the class ASNParser method namedNumber.

public final AsnNamedNumber namedNumber() throws RecognitionException, TokenStreamException {
    AsnNamedNumber nnum;
    Token lid = null;
    nnum = new AsnNamedNumber();
    AsnSignedNumber i;
    AsnDefinedValue s;
    try {
        // for error handling
        {
            lid = LT(1);
            match(LOWER);
            if (inputState.guessing == 0) {
                nnum.name = lid.getText();
            }
            {
                switch(LA(1)) {
                    case L_PAREN:
                        {
                            match(L_PAREN);
                            {
                                switch(LA(1)) {
                                    case MINUS:
                                    case NUMBER:
                                        {
                                            i = signed_number();
                                            if (inputState.guessing == 0) {
                                                nnum.signedNumber = i;
                                                nnum.isSignedNumber = true;
                                            }
                                            break;
                                        }
                                    case UPPER:
                                    case LOWER:
                                        {
                                            {
                                                s = defined_value();
                                                if (inputState.guessing == 0) {
                                                    nnum.definedValue = s;
                                                }
                                            }
                                            break;
                                        }
                                    default:
                                        {
                                            throw new NoViableAltException(LT(1), getFilename());
                                        }
                                }
                            }
                            match(R_PAREN);
                            break;
                        }
                    case COMMA:
                    case R_BRACE:
                        {
                            break;
                        }
                    default:
                        {
                            throw new NoViableAltException(LT(1), getFilename());
                        }
                }
            }
        }
    } catch (RecognitionException ex) {
        if (inputState.guessing == 0) {
            reportError(ex);
            recover(ex, _tokenSet_33);
        } else {
            throw ex;
        }
    }
    return nnum;
}
Also used : NoViableAltException(antlr.NoViableAltException) Token(antlr.Token) RecognitionException(antlr.RecognitionException)

Example 12 with NoViableAltException

use of antlr.NoViableAltException in project jasn1 by openmuc.

the class ASNParser method tag_default.

public final String tag_default() throws RecognitionException, TokenStreamException {
    String s;
    Token tg = null;
    Token tg1 = null;
    Token tg2 = null;
    s = "";
    try {
        // for error handling
        switch(LA(1)) {
            case EXPLICIT_KW:
                {
                    {
                        tg = LT(1);
                        match(EXPLICIT_KW);
                        if (inputState.guessing == 0) {
                            s = tg.getText();
                        }
                    }
                    break;
                }
            case IMPLICIT_KW:
                {
                    {
                        tg1 = LT(1);
                        match(IMPLICIT_KW);
                        if (inputState.guessing == 0) {
                            s = tg1.getText();
                        }
                    }
                    break;
                }
            case AUTOMATIC_KW:
                {
                    {
                        tg2 = LT(1);
                        match(AUTOMATIC_KW);
                        if (inputState.guessing == 0) {
                            s = tg2.getText();
                        }
                    }
                    break;
                }
            default:
                {
                    throw new NoViableAltException(LT(1), getFilename());
                }
        }
    } catch (RecognitionException ex) {
        if (inputState.guessing == 0) {
            reportError(ex);
            recover(ex, _tokenSet_12);
        } else {
            throw ex;
        }
    }
    return s;
}
Also used : NoViableAltException(antlr.NoViableAltException) Token(antlr.Token) RecognitionException(antlr.RecognitionException)

Example 13 with NoViableAltException

use of antlr.NoViableAltException in project jasn1 by openmuc.

the class ASNParser method choice_value.

public final void choice_value(AsnValue value) throws RecognitionException, TokenStreamException {
    Token lid = null;
    AsnChoiceValue chval = new AsnChoiceValue();
    AsnValue val;
    try {
        // for error handling
        {
            {
                lid = LT(1);
                match(LOWER);
                if (inputState.guessing == 0) {
                    chval.name = lid.getText();
                }
            }
            {
                switch(LA(1)) {
                    case COLON:
                        {
                            match(COLON);
                            break;
                        }
                    case FALSE_KW:
                    case MINUS_INFINITY_KW:
                    case NULL_KW:
                    case PLUS_INFINITY_KW:
                    case TRUE_KW:
                    case L_BRACE:
                    case MINUS:
                    case NUMBER:
                    case UPPER:
                    case LOWER:
                    case B_STRING:
                    case H_STRING:
                    case C_STRING:
                        {
                            break;
                        }
                    default:
                        {
                            throw new NoViableAltException(LT(1), getFilename());
                        }
                }
            }
            {
                val = value();
                if (inputState.guessing == 0) {
                    chval.value = val;
                }
            }
        }
        if (inputState.guessing == 0) {
            value.chval = chval;
        }
    } catch (RecognitionException ex) {
        if (inputState.guessing == 0) {
            reportError(ex);
            recover(ex, _tokenSet_37);
        } else {
            throw ex;
        }
    }
}
Also used : NoViableAltException(antlr.NoViableAltException) Token(antlr.Token) RecognitionException(antlr.RecognitionException)

Example 14 with NoViableAltException

use of antlr.NoViableAltException in project jasn1 by openmuc.

the class ASNParser method defined_value.

protected final AsnDefinedValue defined_value() throws RecognitionException, TokenStreamException {
    AsnDefinedValue defval;
    Token up = null;
    Token lid = null;
    defval = new AsnDefinedValue();
    try {
        // for error handling
        {
            {
                switch(LA(1)) {
                    case UPPER:
                        {
                            up = LT(1);
                            match(UPPER);
                            if (inputState.guessing == 0) {
                                defval.moduleIdentifier = up.getText();
                            }
                            match(DOT);
                            if (inputState.guessing == 0) {
                                defval.isDotPresent = true;
                            }
                            break;
                        }
                    case LOWER:
                        {
                            break;
                        }
                    default:
                        {
                            throw new NoViableAltException(LT(1), getFilename());
                        }
                }
            }
            lid = LT(1);
            match(LOWER);
            if (inputState.guessing == 0) {
                defval.name = lid.getText();
            }
        }
    } catch (RecognitionException ex) {
        if (inputState.guessing == 0) {
            reportError(ex);
            recover(ex, _tokenSet_8);
        } else {
            throw ex;
        }
    }
    return defval;
}
Also used : NoViableAltException(antlr.NoViableAltException) Token(antlr.Token) RecognitionException(antlr.RecognitionException)

Example 15 with NoViableAltException

use of antlr.NoViableAltException in project jasn1 by openmuc.

the class ASNParser method sequence_type.

public final AsnType sequence_type() throws RecognitionException, TokenStreamException {
    AsnType obj;
    AsnSequenceSet seq = new AsnSequenceSet();
    List<AsnElementType> eltplist;
    AsnConstraint cnstrnt;
    obj = null;
    try {
        // for error handling
        {
            match(SEQUENCE_KW);
            if (inputState.guessing == 0) {
                seq.isSequence = true;
            }
            match(L_BRACE);
            {
                switch(LA(1)) {
                    case ANY_KW:
                    case AUTOMATIC_KW:
                    case BIT_KW:
                    case BMP_STR_KW:
                    case BOOLEAN_KW:
                    case CHARACTER_KW:
                    case CHOICE_KW:
                    case COMPONENTS_KW:
                    case EMBEDDED_KW:
                    case ENUMERATED_KW:
                    case EXPLICIT_KW:
                    case EXTERNAL_KW:
                    case GENERALIZED_TIME_KW:
                    case GENERAL_STR_KW:
                    case GRAPHIC_STR_KW:
                    case IA5_STRING_KW:
                    case IMPLICIT_KW:
                    case INTEGER_KW:
                    case ISO646_STR_KW:
                    case NULL_KW:
                    case NUMERIC_STR_KW:
                    case OBJECT_DESCRIPTOR_KW:
                    case OBJECT_KW:
                    case OCTET_KW:
                    case PRINTABLE_STR_KW:
                    case REAL_KW:
                    case RELATIVE_KW:
                    case SEQUENCE_KW:
                    case SET_KW:
                    case TELETEX_STR_KW:
                    case T61_STR_KW:
                    case UNIVERSAL_STR_KW:
                    case UTC_TIME_KW:
                    case UTF8_STR_KW:
                    case VIDEOTEX_STR_KW:
                    case VISIBLE_STR_KW:
                    case TIME_KW:
                    case DATE_KW:
                    case TIME_OF_DAY_KW:
                    case DATE_TIME_KW:
                    case DURATION_KW:
                    case AMPERSAND:
                    case ELLIPSIS:
                    case L_BRACKET:
                    case UPPER:
                    case LOWER:
                        {
                            eltplist = elementType_list();
                            if (inputState.guessing == 0) {
                                seq.componentTypes = eltplist;
                            }
                            break;
                        }
                    case R_BRACE:
                        {
                            break;
                        }
                    default:
                        {
                            throw new NoViableAltException(LT(1), getFilename());
                        }
                }
            }
            match(R_BRACE);
        }
        if (inputState.guessing == 0) {
            obj = seq;
            eltplist = null;
            seq = null;
        }
    } catch (RecognitionException ex) {
        if (inputState.guessing == 0) {
            reportError(ex);
            recover(ex, _tokenSet_24);
        } else {
            throw ex;
        }
    }
    return obj;
}
Also used : NoViableAltException(antlr.NoViableAltException) RecognitionException(antlr.RecognitionException)

Aggregations

NoViableAltException (antlr.NoViableAltException)132 RecognitionException (antlr.RecognitionException)114 ASTPair (antlr.ASTPair)68 AST (antlr.collections.AST)68 Token (antlr.Token)33 MismatchedCharException (antlr.MismatchedCharException)2 MismatchedTokenException (antlr.MismatchedTokenException)2 NoViableAltForCharException (antlr.NoViableAltForCharException)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