Example usage for org.antlr.v4.runtime NoViableAltException NoViableAltException

List of usage examples for org.antlr.v4.runtime NoViableAltException NoViableAltException

Introduction

In this page you can find the example usage for org.antlr.v4.runtime NoViableAltException NoViableAltException.

Prototype

public NoViableAltException(Parser recognizer) 

Source Link

Usage

From source file:BrahmsParser.java

License:Open Source License

public final TypeDeclarationContext typeDeclaration() throws RecognitionException {
    TypeDeclarationContext _localctx = new TypeDeclarationContext(_ctx, getState());
    enterRule(_localctx, 6, RULE_typeDeclaration);
    try {/* w  ww.ja  v a2s  . c o m*/
        setState(264);
        switch (_input.LA(1)) {
        case T__5:
            enterOuterAlt(_localctx, 1); {
            setState(255);
            groupDeclaration();
        }
            break;
        case T__6:
        case T__7:
            enterOuterAlt(_localctx, 2); {
            setState(256);
            agentDeclaration();
        }
            break;
        case T__8:
            enterOuterAlt(_localctx, 3); {
            setState(257);
            classDeclaration();
        }
            break;
        case T__9:
            enterOuterAlt(_localctx, 4); {
            setState(258);
            objectDeclaration();
        }
            break;
        case T__72:
            enterOuterAlt(_localctx, 5); {
            setState(259);
            conceptClassDeclaration();
        }
            break;
        case T__73:
            enterOuterAlt(_localctx, 6); {
            setState(260);
            conceptObjectDeclaration();
        }
            break;
        case T__74:
            enterOuterAlt(_localctx, 7); {
            setState(261);
            areaDefDeclaration();
        }
            break;
        case T__75:
            enterOuterAlt(_localctx, 8); {
            setState(262);
            areaDeclaration();
        }
            break;
        case T__76:
            enterOuterAlt(_localctx, 9); {
            setState(263);
            pathDeclaration();
        }
            break;
        default:
            throw new NoViableAltException(this);
        }
    } catch (RecognitionException re) {
        _localctx.exception = re;
        _errHandler.reportError(this, re);
        _errHandler.recover(this, re);
    } finally {
        exitRule();
    }
    return _localctx;
}

From source file:BrahmsParser.java

License:Open Source License

public final ActivityDeclarationContext activityDeclaration() throws RecognitionException {
    ActivityDeclarationContext _localctx = new ActivityDeclarationContext(_ctx, getState());
    enterRule(_localctx, 34, RULE_activityDeclaration);
    try {//from  w  w w .j  a  v a2s .com
        setState(367);
        switch (_input.LA(1)) {
        case T__18:
            enterOuterAlt(_localctx, 1); {
            setState(363);
            primitiveActivity();
        }
            break;
        case T__21:
            enterOuterAlt(_localctx, 2); {
            setState(364);
            communicateActivity();
        }
            break;
        case T__24:
            enterOuterAlt(_localctx, 3); {
            setState(365);
            broadcastActivity();
        }
            break;
        case T__25:
            enterOuterAlt(_localctx, 4); {
            setState(366);
            javaActivity();
        }
            break;
        default:
            throw new NoViableAltException(this);
        }
    } catch (RecognitionException re) {
        _localctx.exception = re;
        _errHandler.reportError(this, re);
        _errHandler.recover(this, re);
    } finally {
        exitRule();
    }
    return _localctx;
}

From source file:BrahmsParser.java

License:Open Source License

public final WorkFrameBodyElementContext workFrameBodyElement() throws RecognitionException {
    WorkFrameBodyElementContext _localctx = new WorkFrameBodyElementContext(_ctx, getState());
    enterRule(_localctx, 98, RULE_workFrameBodyElement);
    try {/*from  w ww  .j  a va 2s.  c o m*/
        setState(624);
        switch (_input.LA(1)) {
        case T__56:
            enterOuterAlt(_localctx, 1); {
            setState(622);
            consequence();
        }
            break;
        case Identifier:
            enterOuterAlt(_localctx, 2); {
            setState(623);
            activityRef();
        }
            break;
        default:
            throw new NoViableAltException(this);
        }
    } catch (RecognitionException re) {
        _localctx.exception = re;
        _errHandler.reportError(this, re);
        _errHandler.recover(this, re);
    } finally {
        exitRule();
    }
    return _localctx;
}

From source file:BrahmsParser.java

License:Open Source License

public final PreConditionContext preCondition() throws RecognitionException {
    PreConditionContext _localctx = new PreConditionContext(_ctx, getState());
    enterRule(_localctx, 122, RULE_preCondition);
    int _la;//from  w  w  w .ja  v  a 2 s. co m
    try {
        setState(712);
        switch (_input.LA(1)) {
        case T__52:
        case T__53:
            enterOuterAlt(_localctx, 1); {
            setState(702);
            _la = _input.LA(1);
            if (!(_la == T__52 || _la == T__53)) {
                _errHandler.recoverInline(this);
            } else {
                consume();
            }
            setState(703);
            match(T__19);
            setState(704);
            noValComparison();
            setState(705);
            match(T__20);
        }
            break;
        case T__54:
        case T__55:
            enterOuterAlt(_localctx, 2); {
            setState(707);
            _la = _input.LA(1);
            if (!(_la == T__54 || _la == T__55)) {
                _errHandler.recoverInline(this);
            } else {
                consume();
            }
            setState(708);
            match(T__19);
            setState(709);
            evalComparison();
            setState(710);
            match(T__20);
        }
            break;
        default:
            throw new NoViableAltException(this);
        }
    } catch (RecognitionException re) {
        _localctx.exception = re;
        _errHandler.reportError(this, re);
        _errHandler.recover(this, re);
    } finally {
        exitRule();
    }
    return _localctx;
}

From source file:BrahmsParser.java

License:Open Source License

public final PrimaryContext primary() throws RecognitionException {
    PrimaryContext _localctx = new PrimaryContext(_ctx, getState());
    enterRule(_localctx, 154, RULE_primary);
    try {//from   w ww.j a  v a2  s. c  o  m
        setState(903);
        switch (_input.LA(1)) {
        case T__53:
        case T__71:
        case Identifier:
        case Number:
            enterOuterAlt(_localctx, 1); {
            setState(900);
            element();
        }
            break;
        case T__60:
            enterOuterAlt(_localctx, 2); {
            setState(901);
            match(T__60);
            setState(902);
            primary();
        }
            break;
        default:
            throw new NoViableAltException(this);
        }
    } catch (RecognitionException re) {
        _localctx.exception = re;
        _errHandler.reportError(this, re);
        _errHandler.recover(this, re);
    } finally {
        exitRule();
    }
    return _localctx;
}

From source file:BrahmsParser.java

License:Open Source License

public final EvaluationOperatorContext evaluationOperator() throws RecognitionException {
    EvaluationOperatorContext _localctx = new EvaluationOperatorContext(_ctx, getState());
    enterRule(_localctx, 160, RULE_evaluationOperator);
    try {//from  w  ww. j  a  va2  s  .c o m
        setState(918);
        switch (_input.LA(1)) {
        case T__67:
            enterOuterAlt(_localctx, 1); {
            setState(913);
            match(T__67);
        }
            break;
        case T__68:
            enterOuterAlt(_localctx, 2); {
            setState(914);
            match(T__68);
        }
            break;
        case T__69:
            enterOuterAlt(_localctx, 3); {
            setState(915);
            match(T__69);
        }
            break;
        case T__70:
            enterOuterAlt(_localctx, 4); {
            setState(916);
            match(T__70);
        }
            break;
        case T__65:
        case T__66:
            enterOuterAlt(_localctx, 5); {
            setState(917);
            equalityOperator();
        }
            break;
        default:
            throw new NoViableAltException(this);
        }
    } catch (RecognitionException re) {
        _localctx.exception = re;
        _errHandler.reportError(this, re);
        _errHandler.recover(this, re);
    } finally {
        exitRule();
    }
    return _localctx;
}

From source file:BrahmsParser.java

License:Open Source License

public final SglObjectRefContext sglObjectRef() throws RecognitionException {
    SglObjectRefContext _localctx = new SglObjectRefContext(_ctx, getState());
    enterRule(_localctx, 168, RULE_sglObjectRef);
    try {//from w  ww. ja  v a2 s  .c om
        setState(935);
        switch (_input.LA(1)) {
        case T__71:
        case Identifier:
            enterOuterAlt(_localctx, 1); {
            setState(933);
            tupleObjectRef();
        }
            break;
        case T__53:
            enterOuterAlt(_localctx, 2); {
            setState(934);
            match(T__53);
        }
            break;
        default:
            throw new NoViableAltException(this);
        }
    } catch (RecognitionException re) {
        _localctx.exception = re;
        _errHandler.reportError(this, re);
        _errHandler.recover(this, re);
    } finally {
        exitRule();
    }
    return _localctx;
}

From source file:BrahmsParser.java

License:Open Source License

public final AttributeTypeContext attributeType() throws RecognitionException {
    AttributeTypeContext _localctx = new AttributeTypeContext(_ctx, getState());
    enterRule(_localctx, 200, RULE_attributeType);
    try {/* w w w. ja va 2  s  .c  om*/
        setState(1004);
        switch (_input.LA(1)) {
        case T__25:
            enterOuterAlt(_localctx, 1); {
            setState(993);
            match(T__25);
            setState(994);
            match(T__19);
            setState(995);
            javaTypeDef();
            setState(996);
            match(T__20);
        }
            break;
        case T__86:
            enterOuterAlt(_localctx, 2); {
            setState(998);
            match(T__86);
            setState(999);
            match(T__19);
            setState(1000);
            typeDef();
            setState(1001);
            match(T__20);
        }
            break;
        case T__90:
        case T__91:
        case T__92:
        case T__93:
        case T__94:
        case T__95:
        case T__96:
        case Identifier:
            enterOuterAlt(_localctx, 3); {
            setState(1003);
            typeDef();
        }
            break;
        default:
            throw new NoViableAltException(this);
        }
    } catch (RecognitionException re) {
        _localctx.exception = re;
        _errHandler.reportError(this, re);
        _errHandler.recover(this, re);
    } finally {
        exitRule();
    }
    return _localctx;
}

From source file:BrahmsParser.java

License:Open Source License

public final TypeDefContext typeDef() throws RecognitionException {
    TypeDefContext _localctx = new TypeDefContext(_ctx, getState());
    enterRule(_localctx, 204, RULE_typeDef);
    try {/*from  w w w  .j a  va2 s.c  om*/
        setState(1011);
        switch (_input.LA(1)) {
        case T__90:
        case T__91:
        case T__92:
        case T__93:
        case T__94:
        case T__95:
            enterOuterAlt(_localctx, 1); {
            setState(1008);
            primitiveTypes();
        }
            break;
        case T__96:
            enterOuterAlt(_localctx, 2); {
            setState(1009);
            collectionTypes();
        }
            break;
        case Identifier:
            enterOuterAlt(_localctx, 3); {
            setState(1010);
            match(Identifier);
        }
            break;
        default:
            throw new NoViableAltException(this);
        }
    } catch (RecognitionException re) {
        _localctx.exception = re;
        _errHandler.reportError(this, re);
        _errHandler.recover(this, re);
    } finally {
        exitRule();
    }
    return _localctx;
}

From source file:amulet.translator.CParser.java

public final PrimaryExpressionContext primaryExpression() throws RecognitionException {
    PrimaryExpressionContext _localctx = new PrimaryExpressionContext(_ctx, getState());
    enterRule(_localctx, 0, RULE_primaryExpression);
    try {/* w  w  w.  jav a2s . c  om*/
        int _alt;
        setState(171);
        switch (_input.LA(1)) {
        case Identifier:
            enterOuterAlt(_localctx, 1); {
            setState(160);
            match(Identifier);
        }
            break;
        case Constant:
            enterOuterAlt(_localctx, 2); {
            setState(161);
            match(Constant);
        }
            break;
        case StringLiteral:
            enterOuterAlt(_localctx, 3); {
            setState(163);
            _errHandler.sync(this);
            _alt = getInterpreter().adaptivePredict(_input, 0, _ctx);
            do {
                switch (_alt) {
                case 1: {
                    {
                        setState(162);
                        match(StringLiteral);
                    }
                }
                    break;
                default:
                    throw new NoViableAltException(this);
                }
                setState(165);
                _errHandler.sync(this);
                _alt = getInterpreter().adaptivePredict(_input, 0, _ctx);
            } while (_alt != 2 && _alt != -1);
        }
            break;
        case LeftParen:
            enterOuterAlt(_localctx, 4); {
            setState(167);
            match(LeftParen);
            setState(168);
            expression(0);
            setState(169);
            match(RightParen);
        }
            break;
        default:
            throw new NoViableAltException(this);
        }
    } catch (RecognitionException re) {
        _localctx.exception = re;
        _errHandler.reportError(this, re);
        _errHandler.recover(this, re);
    } finally {
        exitRule();
    }
    return _localctx;
}