コード例 #1
0
ファイル: PolishNotation.cs プロジェクト: molongwudi/IL2C
        internal static ExpressionNode ParseExpression(string line, int startIndex)
        {
            if (startIndex >= line.Length)
            {
                return(null);
            }

            var oper = ParseOperator(line, startIndex);

            if (oper == null)
            {
                return(null);
            }

            ReducibleNode left = ParseNumeric(line, oper.NextIndex);

            if (left == null)
            {
                left = ParseExpression(line, oper.NextIndex);
                if (left == null)
                {
                    return(null);
                }
            }

            ReducibleNode right = ParseNumeric(line, left.NextIndex);

            if (right == null)
            {
                right = ParseExpression(line, left.NextIndex);
                if (right == null)
                {
                    return(null);
                }
            }

            var index = SkipWhiteSpace(line, right.NextIndex);

            return(new ExpressionNode(oper, left, right, index));
        }
コード例 #2
0
ファイル: PolishNotation.cs プロジェクト: molongwudi/IL2C
 public ExpressionNode(OperatorNode oper, ReducibleNode left, ReducibleNode right, int nextIndex) : base(nextIndex)
 {
     this.Operator = oper;
     this.Left     = left;
     this.Right    = right;
 }