Search in sources :

Example 16 with NoViableAltException

use of antlr.NoViableAltException in project jasn1 by openmuc.

the class ASNParser method integer_type.

public final AsnType integer_type() throws RecognitionException, TokenStreamException {
    AsnType obj;
    AsnInteger intgr = new AsnInteger();
    AsnNamedNumberList numlst;
    AsnConstraint cnstrnt;
    obj = null;
    try {
        // for error handling
        {
            match(INTEGER_KW);
            {
                if ((LA(1) == L_BRACE) && (LA(2) == ELLIPSIS || LA(2) == LOWER) && (LA(3) == COMMA || LA(3) == L_PAREN || LA(3) == R_BRACE)) {
                    numlst = namedNumber_list();
                    if (inputState.guessing == 0) {
                        intgr.namedNumberList = numlst;
                    }
                } else if ((_tokenSet_41.member(LA(1))) && (_tokenSet_27.member(LA(2))) && (_tokenSet_27.member(LA(3)))) {
                } else {
                    throw new NoViableAltException(LT(1), getFilename());
                }
            }
            {
                if ((_tokenSet_41.member(LA(1))) && (_tokenSet_27.member(LA(2))) && (_tokenSet_27.member(LA(3)))) {
                    cnstrnt = constraint();
                    if (inputState.guessing == 0) {
                        intgr.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());
                }
            }
        }
        if (inputState.guessing == 0) {
            obj = intgr;
            numlst = null;
            cnstrnt = null;
            intgr = 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 17 with NoViableAltException

use of antlr.NoViableAltException in project jasn1 by openmuc.

the class ASNParser method elementType.

public final AsnElementType elementType() throws RecognitionException, TokenStreamException {
    AsnElementType eletyp;
    Token lid = null;
    eletyp = new AsnElementType();
    AsnValue val;
    AsnType obj;
    AsnTag tg;
    String s;
    try {
        // for error handling
        {
            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 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 L_BRACKET:
                case UPPER:
                case LOWER:
                    {
                        {
                            {
                                if ((LA(1) == LOWER) && (_tokenSet_43.member(LA(2))) && (_tokenSet_56.member(LA(3)))) {
                                    lid = LT(1);
                                    match(LOWER);
                                    if (inputState.guessing == 0) {
                                        eletyp.name = lid.getText();
                                    }
                                } else if ((_tokenSet_43.member(LA(1))) && (_tokenSet_56.member(LA(2))) && (_tokenSet_27.member(LA(3)))) {
                                } else {
                                    throw new NoViableAltException(LT(1), getFilename());
                                }
                            }
                            {
                                if ((LA(1) == L_BRACKET) && (_tokenSet_47.member(LA(2))) && (LA(3) == R_BRACKET || LA(3) == NUMBER || LA(3) == LOWER)) {
                                    tg = tag();
                                    if (inputState.guessing == 0) {
                                        eletyp.tag = tg;
                                    }
                                } else if ((_tokenSet_43.member(LA(1))) && (_tokenSet_56.member(LA(2))) && (_tokenSet_27.member(LA(3)))) {
                                } else {
                                    throw new NoViableAltException(LT(1), getFilename());
                                }
                            }
                            {
                                switch(LA(1)) {
                                    case AUTOMATIC_KW:
                                    case EXPLICIT_KW:
                                    case IMPLICIT_KW:
                                        {
                                            s = tag_default();
                                            if (inputState.guessing == 0) {
                                                eletyp.tagType = s;
                                            }
                                            break;
                                        }
                                    case ANY_KW:
                                    case BIT_KW:
                                    case BMP_STR_KW:
                                    case BOOLEAN_KW:
                                    case CHARACTER_KW:
                                    case CHOICE_KW:
                                    case EMBEDDED_KW:
                                    case ENUMERATED_KW:
                                    case EXTERNAL_KW:
                                    case GENERALIZED_TIME_KW:
                                    case GENERAL_STR_KW:
                                    case GRAPHIC_STR_KW:
                                    case IA5_STRING_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 L_BRACKET:
                                    case UPPER:
                                    case LOWER:
                                        {
                                            break;
                                        }
                                    default:
                                        {
                                            throw new NoViableAltException(LT(1), getFilename());
                                        }
                                }
                            }
                            {
                                obj = type();
                            }
                            {
                                switch(LA(1)) {
                                    case OPTIONAL_KW:
                                        {
                                            {
                                                match(OPTIONAL_KW);
                                                if (inputState.guessing == 0) {
                                                    eletyp.isOptional = true;
                                                }
                                            }
                                            break;
                                        }
                                    case DEFAULT_KW:
                                        {
                                            {
                                                match(DEFAULT_KW);
                                                if (inputState.guessing == 0) {
                                                    eletyp.isDefault = true;
                                                }
                                                val = value();
                                                if (inputState.guessing == 0) {
                                                    eletyp.value = val;
                                                }
                                            }
                                            break;
                                        }
                                    case COMMA:
                                    case R_BRACE:
                                        {
                                            break;
                                        }
                                    default:
                                        {
                                            throw new NoViableAltException(LT(1), getFilename());
                                        }
                                }
                            }
                        }
                        break;
                    }
                case COMPONENTS_KW:
                    {
                        match(COMPONENTS_KW);
                        match(OF_KW);
                        if (inputState.guessing == 0) {
                            eletyp.isComponentsOf = true;
                        }
                        {
                            obj = type();
                        }
                        break;
                    }
                default:
                    {
                        throw new NoViableAltException(LT(1), getFilename());
                    }
            }
        }
        if (inputState.guessing == 0) {
            if ((AsnDefinedType.class).isInstance(obj)) {
                eletyp.isDefinedType = true;
                eletyp.definedType = (AsnDefinedType) obj;
            } else {
                eletyp.typeReference = obj;
            }
        }
    } catch (RecognitionException ex) {
        if (inputState.guessing == 0) {
            reportError(ex);
            recover(ex, _tokenSet_33);
        } else {
            throw ex;
        }
    }
    return eletyp;
}
Also used : NoViableAltException(antlr.NoViableAltException) Token(antlr.Token) RecognitionException(antlr.RecognitionException)

Example 18 with NoViableAltException

use of antlr.NoViableAltException in project jasn1 by openmuc.

the class ASNParser method namedNumber_list.

public final AsnNamedNumberList namedNumber_list() throws RecognitionException, TokenStreamException {
    AsnNamedNumberList nnlist;
    nnlist = new AsnNamedNumberList();
    AsnNamedNumber nnum;
    try {
        // for error handling
        {
            match(L_BRACE);
            {
                switch(LA(1)) {
                    case ELLIPSIS:
                        {
                            match(ELLIPSIS);
                            break;
                        }
                    case LOWER:
                        {
                            nnum = namedNumber();
                            if (inputState.guessing == 0) {
                                nnlist.namedNumbers.add(nnum);
                            }
                            break;
                        }
                    default:
                        {
                            throw new NoViableAltException(LT(1), getFilename());
                        }
                }
            }
            {
                _loop341: do {
                    if ((LA(1) == COMMA)) {
                        match(COMMA);
                        {
                            switch(LA(1)) {
                                case ELLIPSIS:
                                    {
                                        match(ELLIPSIS);
                                        break;
                                    }
                                case LOWER:
                                    {
                                        {
                                            nnum = namedNumber();
                                            if (inputState.guessing == 0) {
                                                nnlist.namedNumbers.add(nnum);
                                            }
                                        }
                                        break;
                                    }
                                default:
                                    {
                                        throw new NoViableAltException(LT(1), getFilename());
                                    }
                            }
                        }
                    } else {
                        break _loop341;
                    }
                } while (true);
            }
            match(R_BRACE);
        }
    } catch (RecognitionException ex) {
        if (inputState.guessing == 0) {
            reportError(ex);
            recover(ex, _tokenSet_41);
        } else {
            throw ex;
        }
    }
    return nnlist;
}
Also used : NoViableAltException(antlr.NoViableAltException) RecognitionException(antlr.RecognitionException)

Example 19 with NoViableAltException

use of antlr.NoViableAltException in project jasn1 by openmuc.

the class ASNParser method symbols_from_module.

public final void symbols_from_module(AsnModule module) throws RecognitionException, TokenStreamException {
    Token up = null;
    SymbolsFromModule sym = new SymbolsFromModule();
    String s = "";
    AsnModuleIdentifier mid;
    AsnDefinedValue defval;
    ArrayList arl;
    AsnOidComponentList cmplist;
    try {
        // for error handling
        {
            {
                arl = symbol_list();
                if (inputState.guessing == 0) {
                    sym.symbolList = arl;
                }
            }
            match(FROM_KW);
            {
                up = LT(1);
                match(UPPER);
                if (inputState.guessing == 0) {
                    sym.modref = up.getText();
                }
                {
                    if ((LA(1) == L_BRACE)) {
                        cmplist = obj_id_comp_lst();
                        if (inputState.guessing == 0) {
                            sym.isOidValue = true;
                            sym.cmplist = cmplist;
                        }
                    } else {
                        boolean synPredMatched132 = false;
                        if (((LA(1) == UPPER || LA(1) == LOWER) && (_tokenSet_17.member(LA(2))) && (_tokenSet_18.member(LA(3))))) {
                            int _m132 = mark();
                            synPredMatched132 = true;
                            inputState.guessing++;
                            try {
                                {
                                    defined_value();
                                }
                            } catch (RecognitionException pe) {
                                synPredMatched132 = false;
                            }
                            rewind(_m132);
                            inputState.guessing--;
                        }
                        if (synPredMatched132) {
                            {
                                defval = defined_value();
                                if (inputState.guessing == 0) {
                                    sym.isDefinedValue = true;
                                    sym.defval = defval;
                                }
                            }
                        } else if ((_tokenSet_19.member(LA(1))) && (_tokenSet_18.member(LA(2))) && (_tokenSet_20.member(LA(3)))) {
                        } else {
                            throw new NoViableAltException(LT(1), getFilename());
                        }
                    }
                }
            }
        }
        if (inputState.guessing == 0) {
            module.importSymbolFromModuleList.add(sym);
        }
    } catch (RecognitionException ex) {
        if (inputState.guessing == 0) {
            reportError(ex);
            recover(ex, _tokenSet_19);
        } else {
            throw ex;
        }
    }
}
Also used : NoViableAltException(antlr.NoViableAltException) Token(antlr.Token) RecognitionException(antlr.RecognitionException)

Example 20 with NoViableAltException

use of antlr.NoViableAltException in project jasn1 by openmuc.

the class ASNParser method setof_type.

public final AsnType setof_type() throws RecognitionException, TokenStreamException {
    AsnType obj;
    AsnSequenceOf setof = new AsnSequenceOf();
    setof.componentType = new AsnElementType();
    AsnConstraint cns;
    obj = null;
    Object obj1;
    String s;
    try {
        // for error handling
        {
            match(SET_KW);
            {
                if ((_tokenSet_40.member(LA(1))) && ((LA(2) >= ABSENT_KW && LA(2) <= PATTERN_KW)) && (_tokenSet_27.member(LA(3)))) {
                    cns = constraint();
                    if (inputState.guessing == 0) {
                        setof.constraint = cns;
                    }
                } else if ((LA(1) == OF_KW) && (_tokenSet_12.member(LA(2))) && (_tokenSet_45.member(LA(3)))) {
                } else {
                    throw new NoViableAltException(LT(1), getFilename());
                }
            }
            match(OF_KW);
            {
                obj1 = type();
                if (inputState.guessing == 0) {
                    if ((AsnDefinedType.class).isInstance(obj1)) {
                        setof.componentType.isDefinedType = true;
                        setof.componentType.definedType = (AsnDefinedType) obj1;
                    } else {
                        setof.componentType.typeReference = (AsnType) obj1;
                    }
                }
            }
        }
        if (inputState.guessing == 0) {
            obj = setof;
            cns = null;
            obj1 = null;
            setof = 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