Search in sources :

Example 6 with NoViableAltException

use of antlr.NoViableAltException in project jasn1 by openmuc.

the class ASNParser method sequenceof_type.

public final AsnSequenceOf sequenceof_type() throws RecognitionException, TokenStreamException {
    AsnSequenceOf obj;
    AsnSequenceOf seqof = new AsnSequenceOf();
    AsnConstraint cnstrnt;
    obj = null;
    AsnElementType referencedAsnType;
    String s;
    try {
        // for error handling
        {
            match(SEQUENCE_KW);
            if (inputState.guessing == 0) {
                seqof.isSequenceOf = true;
            }
            {
                if ((_tokenSet_40.member(LA(1))) && ((LA(2) >= ABSENT_KW && LA(2) <= PATTERN_KW)) && (_tokenSet_27.member(LA(3)))) {
                    cnstrnt = constraint();
                    if (inputState.guessing == 0) {
                        seqof.constraint = cnstrnt;
                    }
                } else if ((LA(1) == OF_KW) && (_tokenSet_43.member(LA(2))) && (_tokenSet_44.member(LA(3)))) {
                } else {
                    throw new NoViableAltException(LT(1), getFilename());
                }
            }
            match(OF_KW);
            {
                referencedAsnType = sequenceof_component();
                if (inputState.guessing == 0) {
                    seqof.componentType = referencedAsnType;
                }
            }
        }
        if (inputState.guessing == 0) {
            obj = seqof;
            cnstrnt = null;
            seqof = 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)

Example 7 with NoViableAltException

use of antlr.NoViableAltException in project jasn1 by openmuc.

the class ASNParser method character_str_type.

public final AsnCharacterString character_str_type() throws RecognitionException, TokenStreamException {
    AsnCharacterString obj;
    AsnCharacterString cstr = new AsnCharacterString();
    String s;
    AsnConstraint cnstrnt;
    obj = null;
    try {
        // for error handling
        {
            switch(LA(1)) {
                case CHARACTER_KW:
                    {
                        {
                            match(CHARACTER_KW);
                            match(STRING_KW);
                            if (inputState.guessing == 0) {
                                cstr.isUCSType = true;
                            }
                        }
                        break;
                    }
                case BMP_STR_KW:
                case GENERALIZED_TIME_KW:
                case GENERAL_STR_KW:
                case GRAPHIC_STR_KW:
                case IA5_STRING_KW:
                case ISO646_STR_KW:
                case NUMERIC_STR_KW:
                case OBJECT_DESCRIPTOR_KW:
                case PRINTABLE_STR_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:
                    {
                        {
                            s = character_set();
                            if (inputState.guessing == 0) {
                                cstr.stringtype = s;
                            }
                            {
                                if ((_tokenSet_41.member(LA(1))) && (_tokenSet_27.member(LA(2))) && (_tokenSet_27.member(LA(3)))) {
                                    cnstrnt = constraint();
                                    if (inputState.guessing == 0) {
                                        cstr.constraint = cnstrnt;
                                    }
                                } else if ((_tokenSet_24.member(LA(1))) && (_tokenSet_42.member(LA(2))) && (_tokenSet_27.member(LA(3)))) {
                                } else {
                                    throw new NoViableAltException(LT(1), getFilename());
                                }
                            }
                        }
                        break;
                    }
                default:
                    {
                        throw new NoViableAltException(LT(1), getFilename());
                    }
            }
        }
        if (inputState.guessing == 0) {
            obj = cstr;
            cnstrnt = null;
            cstr = 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)

Example 8 with NoViableAltException

use of antlr.NoViableAltException in project jasn1 by openmuc.

the class ASNParser method value.

public final AsnValue value() throws RecognitionException, TokenStreamException {
    AsnValue value;
    Token c = null;
    value = new AsnValue();
    AsnSequenceValue seqval;
    AsnDefinedValue defval;
    String aStr;
    AsnSignedNumber num;
    AsnOidComponentList cmplst;
    List<String> valueInBracesTokens;
    try {
        // for error handling
        switch(LA(1)) {
            case TRUE_KW:
                {
                    {
                        match(TRUE_KW);
                        if (inputState.guessing == 0) {
                            value.isTrueKW = true;
                        }
                    }
                    break;
                }
            case FALSE_KW:
                {
                    {
                        match(FALSE_KW);
                        if (inputState.guessing == 0) {
                            value.isFalseKW = true;
                        }
                    }
                    break;
                }
            case NULL_KW:
                {
                    {
                        match(NULL_KW);
                        if (inputState.guessing == 0) {
                            value.isNullKW = true;
                        }
                    }
                    break;
                }
            case C_STRING:
                {
                    {
                        c = LT(1);
                        match(C_STRING);
                        if (inputState.guessing == 0) {
                            value.isCString = true;
                            value.cStr = c.getText();
                        }
                    }
                    break;
                }
            case MINUS:
            case NUMBER:
                {
                    {
                        num = signed_number();
                        if (inputState.guessing == 0) {
                            value.isSignedNumber = true;
                            value.signedNumber = num;
                        }
                    }
                    break;
                }
            case PLUS_INFINITY_KW:
                {
                    {
                        match(PLUS_INFINITY_KW);
                        if (inputState.guessing == 0) {
                            value.isPlusInfinity = true;
                        }
                    }
                    break;
                }
            case MINUS_INFINITY_KW:
                {
                    {
                        match(MINUS_INFINITY_KW);
                        if (inputState.guessing == 0) {
                            value.isMinusInfinity = true;
                        }
                    }
                    break;
                }
            default:
                boolean synPredMatched431 = false;
                if (((LA(1) == UPPER || LA(1) == LOWER) && (_tokenSet_34.member(LA(2))) && (_tokenSet_35.member(LA(3))))) {
                    int _m431 = mark();
                    synPredMatched431 = true;
                    inputState.guessing++;
                    try {
                        {
                            defined_value();
                        }
                    } catch (RecognitionException pe) {
                        synPredMatched431 = false;
                    }
                    rewind(_m431);
                    inputState.guessing--;
                }
                if (synPredMatched431) {
                    {
                        defval = defined_value();
                        if (inputState.guessing == 0) {
                            value.isDefinedValue = true;
                            value.definedValue = defval;
                        }
                    }
                } else {
                    boolean synPredMatched437 = false;
                    if (((LA(1) == LOWER) && (_tokenSet_30.member(LA(2))) && (_tokenSet_36.member(LA(3))))) {
                        int _m437 = mark();
                        synPredMatched437 = true;
                        inputState.guessing++;
                        try {
                            {
                                choice_value(value);
                            }
                        } catch (RecognitionException pe) {
                            synPredMatched437 = false;
                        }
                        rewind(_m437);
                        inputState.guessing--;
                    }
                    if (synPredMatched437) {
                        {
                            choice_value(value);
                            if (inputState.guessing == 0) {
                                value.isChoiceValue = true;
                            }
                        }
                    } else {
                        boolean synPredMatched440 = false;
                        if (((LA(1) == L_BRACE) && (LA(2) == COMMA || LA(2) == R_BRACE || LA(2) == LOWER) && (_tokenSet_37.member(LA(3))))) {
                            int _m440 = mark();
                            synPredMatched440 = true;
                            inputState.guessing++;
                            try {
                                {
                                    sequence_value();
                                }
                            } catch (RecognitionException pe) {
                                synPredMatched440 = false;
                            }
                            rewind(_m440);
                            inputState.guessing--;
                        }
                        if (synPredMatched440) {
                            {
                                seqval = sequence_value();
                                if (inputState.guessing == 0) {
                                    value.isSequenceValue = true;
                                    value.seqval = seqval;
                                }
                            }
                        } else {
                            boolean synPredMatched443 = false;
                            if (((LA(1) == L_BRACE) && (_tokenSet_38.member(LA(2))) && (_tokenSet_36.member(LA(3))))) {
                                int _m443 = mark();
                                synPredMatched443 = true;
                                inputState.guessing++;
                                try {
                                    {
                                        sequenceof_value(value);
                                    }
                                } catch (RecognitionException pe) {
                                    synPredMatched443 = false;
                                }
                                rewind(_m443);
                                inputState.guessing--;
                            }
                            if (synPredMatched443) {
                                {
                                    sequenceof_value(value);
                                    if (inputState.guessing == 0) {
                                        value.isSequenceOfValue = true;
                                    }
                                }
                            } else {
                                boolean synPredMatched446 = false;
                                if (((LA(1) == L_BRACE || LA(1) == B_STRING || LA(1) == H_STRING) && (_tokenSet_37.member(LA(2))) && (_tokenSet_35.member(LA(3))))) {
                                    int _m446 = mark();
                                    synPredMatched446 = true;
                                    inputState.guessing++;
                                    try {
                                        {
                                            cstr_value(value);
                                        }
                                    } catch (RecognitionException pe) {
                                        synPredMatched446 = false;
                                    }
                                    rewind(_m446);
                                    inputState.guessing--;
                                }
                                if (synPredMatched446) {
                                    {
                                        cstr_value(value);
                                        if (inputState.guessing == 0) {
                                            value.isCStrValue = true;
                                        }
                                    }
                                } else {
                                    boolean synPredMatched449 = false;
                                    if (((LA(1) == L_BRACE) && ((LA(2) >= NUMBER && LA(2) <= LOWER)) && (_tokenSet_5.member(LA(3))))) {
                                        int _m449 = mark();
                                        synPredMatched449 = true;
                                        inputState.guessing++;
                                        try {
                                            {
                                                obj_id_comp_lst();
                                            }
                                        } catch (RecognitionException pe) {
                                            synPredMatched449 = false;
                                        }
                                        rewind(_m449);
                                        inputState.guessing--;
                                    }
                                    if (synPredMatched449) {
                                        {
                                            cmplst = obj_id_comp_lst();
                                            if (inputState.guessing == 0) {
                                                value.isAsnOIDValue = true;
                                                value.oidval = cmplst;
                                            }
                                        }
                                    } else {
                                        throw new NoViableAltException(LT(1), getFilename());
                                    }
                                }
                            }
                        }
                    }
                }
        }
    } catch (RecognitionException ex) {
        if (inputState.guessing == 0) {
            reportError(ex);
            recover(ex, _tokenSet_37);
        } else {
            throw ex;
        }
    }
    return value;
}
Also used : NoViableAltException(antlr.NoViableAltException) Token(antlr.Token) RecognitionException(antlr.RecognitionException)

Example 9 with NoViableAltException

use of antlr.NoViableAltException in project jasn1 by openmuc.

the class ASNParser method obj_id_component.

public final AsnOidComponent obj_id_component() throws RecognitionException, TokenStreamException {
    AsnOidComponent oidcmp;
    Token num = null;
    Token lid = null;
    Token num1 = null;
    oidcmp = new AsnOidComponent();
    AsnDefinedValue defval;
    String s, n = "";
    try {
        // for error handling
        {
            if ((LA(1) == NUMBER)) {
                {
                    num = LT(1);
                    match(NUMBER);
                    if (inputState.guessing == 0) {
                        s = num.getText();
                        oidcmp.num = new Integer(s);
                        oidcmp.numberForm = true;
                    }
                }
            } else {
                boolean synPredMatched99 = false;
                if (((LA(1) == LOWER) && (_tokenSet_9.member(LA(2))) && (_tokenSet_6.member(LA(3))))) {
                    int _m99 = mark();
                    synPredMatched99 = true;
                    inputState.guessing++;
                    try {
                        {
                            match(LOWER);
                            {
                                if ((LA(1) == L_PAREN)) {
                                    match(L_PAREN);
                                    match(NUMBER);
                                    match(R_PAREN);
                                } else {
                                }
                            }
                        }
                    } catch (RecognitionException pe) {
                        synPredMatched99 = false;
                    }
                    rewind(_m99);
                    inputState.guessing--;
                }
                if (synPredMatched99) {
                    {
                        {
                            lid = LT(1);
                            match(LOWER);
                            if (inputState.guessing == 0) {
                                oidcmp.name = lid.getText();
                                oidcmp.nameForm = true;
                            }
                        }
                        {
                            switch(LA(1)) {
                                case L_PAREN:
                                    {
                                        match(L_PAREN);
                                        {
                                            num1 = LT(1);
                                            match(NUMBER);
                                            if (inputState.guessing == 0) {
                                                n = num1.getText();
                                                oidcmp.num = new Integer(n);
                                                oidcmp.nameAndNumberForm = true;
                                            }
                                        }
                                        match(R_PAREN);
                                        break;
                                    }
                                case R_BRACE:
                                case NUMBER:
                                case UPPER:
                                case LOWER:
                                    {
                                        break;
                                    }
                                default:
                                    {
                                        throw new NoViableAltException(LT(1), getFilename());
                                    }
                            }
                        }
                    }
                } else {
                    boolean synPredMatched105 = false;
                    if (((LA(1) == UPPER || LA(1) == LOWER) && (_tokenSet_10.member(LA(2))) && (_tokenSet_6.member(LA(3))))) {
                        int _m105 = mark();
                        synPredMatched105 = true;
                        inputState.guessing++;
                        try {
                            {
                                defined_value();
                            }
                        } catch (RecognitionException pe) {
                            synPredMatched105 = false;
                        }
                        rewind(_m105);
                        inputState.guessing--;
                    }
                    if (synPredMatched105) {
                        {
                            defval = defined_value();
                            if (inputState.guessing == 0) {
                                oidcmp.isDefinedValue = true;
                                oidcmp.defval = defval;
                            }
                        }
                    } else {
                        throw new NoViableAltException(LT(1), getFilename());
                    }
                }
            }
        }
    } catch (RecognitionException ex) {
        if (inputState.guessing == 0) {
            reportError(ex);
            recover(ex, _tokenSet_11);
        } else {
            throw ex;
        }
    }
    return oidcmp;
}
Also used : NoViableAltException(antlr.NoViableAltException) Token(antlr.Token) RecognitionException(antlr.RecognitionException)

Example 10 with NoViableAltException

use of antlr.NoViableAltException in project jasn1 by openmuc.

the class ASNParser method built_in_type.

public final AsnType built_in_type() throws RecognitionException, TokenStreamException {
    AsnType obj;
    obj = null;
    try {
        // for error handling
        switch(LA(1)) {
            case ANY_KW:
                {
                    {
                        obj = any_type();
                    }
                    break;
                }
            case BIT_KW:
                {
                    {
                        obj = bit_string_type();
                    }
                    break;
                }
            case BOOLEAN_KW:
                {
                    {
                        obj = boolean_type();
                    }
                    break;
                }
            case BMP_STR_KW:
            case CHARACTER_KW:
            case GENERALIZED_TIME_KW:
            case GENERAL_STR_KW:
            case GRAPHIC_STR_KW:
            case IA5_STRING_KW:
            case ISO646_STR_KW:
            case NUMERIC_STR_KW:
            case OBJECT_DESCRIPTOR_KW:
            case PRINTABLE_STR_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:
                {
                    {
                        obj = character_str_type();
                    }
                    break;
                }
            case CHOICE_KW:
                {
                    {
                        obj = choice_type();
                    }
                    break;
                }
            case EMBEDDED_KW:
                {
                    {
                        obj = embedded_type();
                    }
                    break;
                }
            case ENUMERATED_KW:
                {
                    {
                        obj = enum_type();
                    }
                    break;
                }
            case EXTERNAL_KW:
                {
                    {
                        obj = external_type();
                    }
                    break;
                }
            case INTEGER_KW:
                {
                    {
                        obj = integer_type();
                    }
                    break;
                }
            case NULL_KW:
                {
                    {
                        obj = null_type();
                    }
                    break;
                }
            case OBJECT_KW:
                {
                    {
                        obj = object_identifier_type();
                    }
                    break;
                }
            case OCTET_KW:
                {
                    {
                        obj = octetString_type();
                    }
                    break;
                }
            case REAL_KW:
                {
                    {
                        obj = real_type();
                    }
                    break;
                }
            case RELATIVE_KW:
                {
                    {
                        obj = relativeOid_type();
                    }
                    break;
                }
            case L_BRACKET:
                {
                    {
                        obj = tagged_type();
                    }
                    break;
                }
            default:
                if ((LA(1) == SEQUENCE_KW) && (LA(2) == L_BRACE) && (_tokenSet_39.member(LA(3)))) {
                    {
                        obj = sequence_type();
                    }
                } else if ((LA(1) == SEQUENCE_KW) && (_tokenSet_40.member(LA(2))) && ((LA(3) >= ABSENT_KW && LA(3) <= PATTERN_KW))) {
                    {
                        obj = sequenceof_type();
                    }
                } else if ((LA(1) == SET_KW) && (LA(2) == L_BRACE) && (_tokenSet_39.member(LA(3)))) {
                    {
                        obj = set_type();
                    }
                } else if ((LA(1) == SET_KW) && (_tokenSet_40.member(LA(2))) && ((LA(3) >= ABSENT_KW && LA(3) <= PATTERN_KW))) {
                    {
                        obj = setof_type();
                    }
                } else {
                    throw new NoViableAltException(LT(1), getFilename());
                }
        }
    } 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