Example #1
0
        private IAstNode Shift(IAstNode left, int level)
        {
            AstLeaf  op    = new AstLeaf(_lexer.Read());
            IAstNode right = Factor();

            Precedence next;

            while ((next = NextOperator()) != null && RightFirst(level, next))
            {
                right = Shift(right, next.Level);
            }

            return(new ExpressionNode(new Collection <IAstNode>()
            {
                left, op, right
            }));
        }
Example #2
0
File: Parser.cs Project: ljcleo/LEP
        private IAstNode Shift(IAstNode left, int level)
        {
            AstLeaf op = new AstLeaf(_lexer.Read());
            IAstNode right = Factor();

            Precedence next;
            while ((next = NextOperator()) != null && RightFirst(level, next)) right = Shift(right, next.Level);

            return new ExpressionNode(new Collection<IAstNode>() { left, op, right });
        }