public AtomContext atom()
        {
            AtomContext _localctx = new AtomContext(Context, State);

            EnterRule(_localctx, 18, RULE_atom);
            int _la;

            try {
                EnterOuterAlt(_localctx, 1);
                {
                    State = 100;
                    _la   = TokenStream.LA(1);
                    if (!(_la == ID || _la == DIGIT))
                    {
                        ErrorHandler.RecoverInline(this);
                    }
                    else
                    {
                        ErrorHandler.ReportMatch(this);
                        Consume();
                    }
                }
            }
            catch (RecognitionException re) {
                _localctx.exception = re;
                ErrorHandler.ReportError(this, re);
                ErrorHandler.Recover(this, re);
            }
            finally {
                ExitRule();
            }
            return(_localctx);
        }
Пример #2
0
        public AtomContext atom()
        {
            AtomContext _localctx = new AtomContext(Context, State);

            EnterRule(_localctx, 8, RULE_atom);
            int _la;

            try {
                EnterOuterAlt(_localctx, 1);
                {
                    State = 44;
                    _la   = TokenStream.LA(1);
                    if (!((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << NUMBER) | (1L << STRING) | (1L << SYMBOL))) != 0)))
                    {
                        ErrorHandler.RecoverInline(this);
                    }
                    else
                    {
                        ErrorHandler.ReportMatch(this);
                        Consume();
                    }
                }
            }
            catch (RecognitionException re) {
                _localctx.exception = re;
                ErrorHandler.ReportError(this, re);
                ErrorHandler.Recover(this, re);
            }
            finally {
                ExitRule();
            }
            return(_localctx);
        }
    public AtomContext atom()
    {
        AtomContext _localctx = new AtomContext(Context, State);

        EnterRule(_localctx, 10, RULE_atom);
        try {
            State = 67;
            ErrorHandler.Sync(this);
            switch (TokenStream.LA(1))
            {
            case SCIENTIFIC_NUMBER:
                EnterOuterAlt(_localctx, 1);
                {
                    State = 60; scientific();
                }
                break;

            case VARIABLE:
                EnterOuterAlt(_localctx, 2);
                {
                    State = 61; variable();
                }
                break;

            case PI:
            case EULER:
            case I:
                EnterOuterAlt(_localctx, 3);
                {
                    State = 62; constant();
                }
                break;

            case LPAREN:
                EnterOuterAlt(_localctx, 4);
                {
                    State = 63; Match(LPAREN);
                    State = 64; expression();
                    State = 65; Match(RPAREN);
                }
                break;

            default:
                throw new NoViableAltException(this);
            }
        }
        catch (RecognitionException re) {
            _localctx.exception = re;
            ErrorHandler.ReportError(this, re);
            ErrorHandler.Recover(this, re);
        }
        finally {
            ExitRule();
        }
        return(_localctx);
    }
Пример #4
0
    public AtomContext atom()
    {
        AtomContext _localctx = new AtomContext(_ctx, State);

        EnterRule(_localctx, 12, RULE_atom);
        try {
            State = 71;
            _errHandler.Sync(this);
            switch (_input.La(1))
            {
            case NUMBER:
                EnterOuterAlt(_localctx, 1);
                {
                    State = 64; number();
                }
                break;

            case VARIABLE:
                EnterOuterAlt(_localctx, 2);
                {
                    State = 65; variable();
                }
                break;

            case LBRACK:
                EnterOuterAlt(_localctx, 3);
                {
                    State = 66; multiDensityList();
                }
                break;

            case LPAREN:
                EnterOuterAlt(_localctx, 4);
                {
                    State = 67; Match(LPAREN);
                    State = 68; density();
                    State = 69; Match(RPAREN);
                }
                break;

            default:
                throw new NoViableAltException(this);
            }
        }
        catch (RecognitionException re) {
            _localctx.exception = re;
            _errHandler.ReportError(this, re);
            _errHandler.Recover(this, re);
        }
        finally {
            ExitRule();
        }
        return(_localctx);
    }
Пример #5
0
    public AtomContext atom()
    {
        AtomContext _localctx = new AtomContext(Context, State);

        EnterRule(_localctx, 8, RULE_atom);
        try {
            State = 52;
            ErrorHandler.Sync(this);
            switch (TokenStream.LA(1))
            {
            case ID:
                EnterOuterAlt(_localctx, 1);
                {
                    State = 46; Match(ID);
                }
                break;

            case INT:
                EnterOuterAlt(_localctx, 2);
                {
                    State = 47; Match(INT);
                }
                break;

            case T__0:
                EnterOuterAlt(_localctx, 3);
                {
                    State = 48; Match(T__0);
                    State = 49; expr();
                    State = 50; Match(T__1);
                }
                break;

            default:
                throw new NoViableAltException(this);
            }
        }
        catch (RecognitionException re) {
            _localctx.exception = re;
            ErrorHandler.ReportError(this, re);
            ErrorHandler.Recover(this, re);
        }
        finally {
            ExitRule();
        }
        return(_localctx);
    }
Пример #6
0
    public AtomContext atom()
    {
        AtomContext _localctx = new AtomContext(Context, State);

        EnterRule(_localctx, 8, RULE_atom);
        try {
            EnterOuterAlt(_localctx, 1);
            {
                State = 30; Match(NUMBER);
            }
        }
        catch (RecognitionException re) {
            _localctx.exception = re;
            ErrorHandler.ReportError(this, re);
            ErrorHandler.Recover(this, re);
        }
        finally {
            ExitRule();
        }
        return(_localctx);
    }
Пример #7
0
    public AtomContext atom()
    {
        AtomContext _localctx = new AtomContext(Context, State);

        EnterRule(_localctx, 4, RULE_atom);
        try {
            State = 50;
            ErrorHandler.Sync(this);
            switch (TokenStream.LA(1))
            {
            case SCIENTIFIC_NUMBER:
                EnterOuterAlt(_localctx, 1);
                {
                    State = 48;
                    scientific();
                }
                break;

            case VARIABLE:
                EnterOuterAlt(_localctx, 2);
                {
                    State = 49;
                    variable();
                }
                break;

            default:
                throw new NoViableAltException(this);
            }
        }
        catch (RecognitionException re) {
            _localctx.exception = re;
            ErrorHandler.ReportError(this, re);
            ErrorHandler.Recover(this, re);
        }
        finally {
            ExitRule();
        }
        return(_localctx);
    }
        public AtomContext atom()
        {
            AtomContext _localctx = new AtomContext(_ctx, State);

            EnterRule(_localctx, 18, RULE_atom);
            int _la;

            try {
                EnterOuterAlt(_localctx, 1);
                {
                    State = 100;
                    _la   = _input.La(1);
                    if (!(_la == ID || _la == DIGIT))
                    {
                        _errHandler.RecoverInline(this);
                    }
                    else
                    {
                        if (_input.La(1) == TokenConstants.Eof)
                        {
                            matchedEOF = true;
                        }

                        _errHandler.ReportMatch(this);
                        Consume();
                    }
                }
            }
            catch (RecognitionException re) {
                _localctx.exception = re;
                _errHandler.ReportError(this, re);
                _errHandler.Recover(this, re);
            }
            finally {
                ExitRule();
            }
            return(_localctx);
        }
Пример #9
0
    public AtomContext atom()
    {
        AtomContext _localctx = new AtomContext(Context, State);

        EnterRule(_localctx, 0, RULE_atom);
        int _la;

        try {
            EnterOuterAlt(_localctx, 1);
            {
                State = 4; Match(T__0);
                State = 8;
                ErrorHandler.Sync(this);
                _la = TokenStream.LA(1);
                while (_la == IDENTIFIER)
                {
                    {
                        {
                            State = 5; Match(IDENTIFIER);
                        }
                    }
                    State = 10;
                    ErrorHandler.Sync(this);
                    _la = TokenStream.LA(1);
                }
                State = 11; Match(T__1);
            }
        }
        catch (RecognitionException re) {
            _localctx.exception = re;
            ErrorHandler.ReportError(this, re);
            ErrorHandler.Recover(this, re);
        }
        finally {
            ExitRule();
        }
        return(_localctx);
    }
Пример #10
0
	public AtomContext atom() {
		AtomContext _localctx = new AtomContext(Context, State);
		EnterRule(_localctx, 128, RULE_atom);
		int _la;
		try {
			State = 855;
			switch (TokenStream.La(1)) {
			case OPEN_PAREN:
				EnterOuterAlt(_localctx, 1);
				{
				State = 828; Match(OPEN_PAREN);
				State = 831;
				switch (TokenStream.La(1)) {
				case YIELD:
					{
					State = 829; yield_expr();
					}
					break;
				case LAMBDA:
				case NOT:
				case NONE:
				case TRUE:
				case FALSE:
				case NAME:
				case STRING_LITERAL:
				case BYTES_LITERAL:
				case DECIMAL_INTEGER:
				case OCT_INTEGER:
				case HEX_INTEGER:
				case BIN_INTEGER:
				case FLOAT_NUMBER:
				case IMAG_NUMBER:
				case ELLIPSIS:
				case STAR:
				case OPEN_PAREN:
				case OPEN_BRACK:
				case ADD:
				case MINUS:
				case NOT_OP:
				case OPEN_BRACE:
					{
					State = 830; testlist_comp();
					}
					break;
				case CLOSE_PAREN:
					break;
				default:
					throw new NoViableAltException(this);
				}
				State = 833; Match(CLOSE_PAREN);
				}
				break;
			case OPEN_BRACK:
				EnterOuterAlt(_localctx, 2);
				{
				State = 834; Match(OPEN_BRACK);
				State = 836;
				_la = TokenStream.La(1);
				if (((((_la - 20)) & ~0x3f) == 0 && ((1L << (_la - 20)) & ((1L << (LAMBDA - 20)) | (1L << (NOT - 20)) | (1L << (NONE - 20)) | (1L << (TRUE - 20)) | (1L << (FALSE - 20)) | (1L << (NAME - 20)) | (1L << (STRING_LITERAL - 20)) | (1L << (BYTES_LITERAL - 20)) | (1L << (DECIMAL_INTEGER - 20)) | (1L << (OCT_INTEGER - 20)) | (1L << (HEX_INTEGER - 20)) | (1L << (BIN_INTEGER - 20)) | (1L << (FLOAT_NUMBER - 20)) | (1L << (IMAG_NUMBER - 20)) | (1L << (ELLIPSIS - 20)) | (1L << (STAR - 20)) | (1L << (OPEN_PAREN - 20)) | (1L << (OPEN_BRACK - 20)) | (1L << (ADD - 20)) | (1L << (MINUS - 20)) | (1L << (NOT_OP - 20)) | (1L << (OPEN_BRACE - 20)))) != 0)) {
					{
					State = 835; testlist_comp();
					}
				}

				State = 838; Match(CLOSE_BRACK);
				}
				break;
			case OPEN_BRACE:
				EnterOuterAlt(_localctx, 3);
				{
				State = 839; Match(OPEN_BRACE);
				State = 841;
				_la = TokenStream.La(1);
				if (((((_la - 20)) & ~0x3f) == 0 && ((1L << (_la - 20)) & ((1L << (LAMBDA - 20)) | (1L << (NOT - 20)) | (1L << (NONE - 20)) | (1L << (TRUE - 20)) | (1L << (FALSE - 20)) | (1L << (NAME - 20)) | (1L << (STRING_LITERAL - 20)) | (1L << (BYTES_LITERAL - 20)) | (1L << (DECIMAL_INTEGER - 20)) | (1L << (OCT_INTEGER - 20)) | (1L << (HEX_INTEGER - 20)) | (1L << (BIN_INTEGER - 20)) | (1L << (FLOAT_NUMBER - 20)) | (1L << (IMAG_NUMBER - 20)) | (1L << (ELLIPSIS - 20)) | (1L << (STAR - 20)) | (1L << (OPEN_PAREN - 20)) | (1L << (OPEN_BRACK - 20)) | (1L << (ADD - 20)) | (1L << (MINUS - 20)) | (1L << (NOT_OP - 20)) | (1L << (OPEN_BRACE - 20)))) != 0)) {
					{
					State = 840; dictorsetmaker();
					}
				}

				State = 843; Match(CLOSE_BRACE);
				}
				break;
			case NAME:
				EnterOuterAlt(_localctx, 4);
				{
				State = 844; Match(NAME);
				}
				break;
			case DECIMAL_INTEGER:
			case OCT_INTEGER:
			case HEX_INTEGER:
			case BIN_INTEGER:
			case FLOAT_NUMBER:
			case IMAG_NUMBER:
				EnterOuterAlt(_localctx, 5);
				{
				State = 845; number();
				}
				break;
			case STRING_LITERAL:
			case BYTES_LITERAL:
				EnterOuterAlt(_localctx, 6);
				{
				State = 847;
				ErrorHandler.Sync(this);
				_la = TokenStream.La(1);
				do {
					{
					{
					State = 846; @string();
					}
					}
					State = 849;
					ErrorHandler.Sync(this);
					_la = TokenStream.La(1);
				} while ( _la==STRING_LITERAL || _la==BYTES_LITERAL );
				}
				break;
			case ELLIPSIS:
				EnterOuterAlt(_localctx, 7);
				{
				State = 851; Match(ELLIPSIS);
				}
				break;
			case NONE:
				EnterOuterAlt(_localctx, 8);
				{
				State = 852; Match(NONE);
				}
				break;
			case TRUE:
				EnterOuterAlt(_localctx, 9);
				{
				State = 853; Match(TRUE);
				}
				break;
			case FALSE:
				EnterOuterAlt(_localctx, 10);
				{
				State = 854; Match(FALSE);
				}
				break;
			default:
				throw new NoViableAltException(this);
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			ErrorHandler.ReportError(this, re);
			ErrorHandler.Recover(this, re);
		}
		finally {
			ExitRule();
		}
		return _localctx;
	}
 public ConstantPIContext(AtomContext context)
 {
     CopyFrom(context);
 }
 public virtual void CopyFrom(AtomContext context)
 {
     base.CopyFrom(context);
 }
 public IntContext(AtomContext context)
 {
     CopyFrom(context);
 }
 public DoubleContext(AtomContext context)
 {
     CopyFrom(context);
 }
 public BracesContext(AtomContext context)
 {
     CopyFrom(context);
 }
 public VariableContext(AtomContext context)
 {
     CopyFrom(context);
 }
Пример #17
0
    public AtomContext atom()
    {
        AtomContext _localctx = new AtomContext(Context, State);

        EnterRule(_localctx, 14, RULE_atom);
        try {
            State = 104;
            ErrorHandler.Sync(this);
            switch (Interpreter.AdaptivePredict(TokenStream, 8, Context))
            {
            case 1:
                EnterOuterAlt(_localctx, 1);
                {
                    State           = 85; _localctx._NUMBER = Match(NUMBER);
                    _localctx.value = ComplexNumber.Parse((_localctx._NUMBER != null?_localctx._NUMBER.Text:null));
                }
                break;

            case 2:
                EnterOuterAlt(_localctx, 2);
                {
                    State           = 87; _localctx._ID = Match(ID);
                    _localctx.value = new VariableEntity((_localctx._ID != null?_localctx._ID.Text:null));
                }
                break;

            case 3:
                EnterOuterAlt(_localctx, 3);
                {
                    State           = 89; Match(T__5);
                    State           = 90; _localctx._expression = expression();
                    State           = 91; Match(T__6);
                    _localctx.value = _localctx._expression.value;
                }
                break;

            case 4:
                EnterOuterAlt(_localctx, 4);
                {
                    State           = 94; _localctx._ID = Match(ID);
                    State           = 95; Match(T__5);
                    State           = 96; _localctx.args = function_arguments();
                    State           = 97; Match(T__6);
                    _localctx.value = new FunctionEntity((_localctx._ID != null?_localctx._ID.Text:null) + 'f'); foreach (var arg in _localctx.args.list)
                    {
                        _localctx.value.Children.Add(arg);
                    }
                }
                break;

            case 5:
                EnterOuterAlt(_localctx, 5);
                {
                    State           = 100; _localctx._ID = Match(ID);
                    State           = 101; Match(T__5);
                    State           = 102; Match(T__6);
                    _localctx.value = new FunctionEntity((_localctx._ID != null?_localctx._ID.Text:null) + 'f');
                }
                break;
            }
        }
        catch (RecognitionException re) {
            _localctx.exception = re;
            ErrorHandler.ReportError(this, re);
            ErrorHandler.Recover(this, re);
        }
        finally {
            ExitRule();
        }
        return(_localctx);
    }
    public AtomContext atom()
    {
        AtomContext _localctx = new AtomContext(Context, State);

        EnterRule(_localctx, 12, RULE_atom);
        try {
            State = 77;
            ErrorHandler.Sync(this);
            switch (TokenStream.LA(1))
            {
            case PI:
                _localctx = new ConstantPIContext(_localctx);
                EnterOuterAlt(_localctx, 1);
                {
                    State = 68; Match(PI);
                }
                break;

            case E:
                _localctx = new ConstantEContext(_localctx);
                EnterOuterAlt(_localctx, 2);
                {
                    State = 69; Match(E);
                }
                break;

            case DOUBLE:
                _localctx = new DoubleContext(_localctx);
                EnterOuterAlt(_localctx, 3);
                {
                    State = 70; Match(DOUBLE);
                }
                break;

            case INT:
                _localctx = new IntContext(_localctx);
                EnterOuterAlt(_localctx, 4);
                {
                    State = 71; Match(INT);
                }
                break;

            case ID:
                _localctx = new VariableContext(_localctx);
                EnterOuterAlt(_localctx, 5);
                {
                    State = 72; Match(ID);
                }
                break;

            case LPAR:
                _localctx = new BracesContext(_localctx);
                EnterOuterAlt(_localctx, 6);
                {
                    State = 73; Match(LPAR);
                    State = 74; plusOrMinus(0);
                    State = 75; Match(RPAR);
                }
                break;

            default:
                throw new NoViableAltException(this);
            }
        }
        catch (RecognitionException re) {
            _localctx.exception = re;
            ErrorHandler.ReportError(this, re);
            ErrorHandler.Recover(this, re);
        }
        finally {
            ExitRule();
        }
        return(_localctx);
    }