예제 #1
0
        // prefixed_expression: <prefix>? postfix_expression
        private Expression ParsePrefixedExpression()
        {
            int start;
            Token t;
            Expression ret;
            if (IsPrefixToken(PeekToken()))
            {
                if (PeekToken(TokenKind.KeywordAwait))
                    return ParseAwaitExpression();

                t = NextToken();
                start = GetStart();

                ret = new UnaryExpression(false, t.Kind, ParsePrefixedExpression());
                ret.SetLoc(_globalParent, start, GetEnd());
                return ret;
            }
            else
            {
                return ParsePostfixedExpression();
            }
        }
예제 #2
0
        // postfixed_expression: call_or_new_expression ( <postfix_op> )*
        private Expression ParsePostfixedExpression()
        {
            Expression ret = ParseCallOrNewExpression();
            if (ret == null)
                return ret;

            while (IsPostfixToken(PeekToken()))
            {
                Token t = NextToken();
                var start = ret.StartIndex;
                ret = new UnaryExpression(true, t.Kind, ret);
                ret.SetLoc(_globalParent, start, GetEnd());
            }
            return ret;
        }