예제 #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
            }));
        }
예제 #2
0
파일: Parser.cs 프로젝트: 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 });
        }