示例#1
0
        public static new EXPRESSION parse(Token first, iSCOPE context)
        {
            EXPRESSION result = UNARY.parse(first, context);

            while (true)
            {
                Token token = get();
                switch (token.code)
                {
                case TokenCode.Multiply:
                case TokenCode.Divide:
                case TokenCode.Remainder:
                    forget(); break;

                default:
                    goto Out;
                }
                EXPRESSION second = UNARY.parse(null, context);
                Span       begin  = result.span;
                result = new MULTIPLICATIVE(token, result, second);
                result.setSpan(begin, second.span);
            }
Out:
            return(result);
        }
示例#2
0
        public static new EXPRESSION parse(Token first, iSCOPE context)
        {
            EXPRESSION result = MULTIPLICATIVE.parse(first, context);

            while (true)
            {
                Token token = get();
                switch (token.code)
                {
                case TokenCode.Plus:
                case TokenCode.Minus:
                    forget(); break;

                default:
                    goto Out;
                }
                EXPRESSION second = MULTIPLICATIVE.parse(null, context);
                Span       start  = result.span;
                result = new ADDITIVE(token, result, second);
                result.setSpan(start, second.span);
            }
Out:
            return(result);
        }