示例#1
0
        private void HandleExtractBlock(char c)
        {
            switch (c)
            {
            case '\n':
                throw new ParseException("')' is expected here", this.globalIndex);

            case '(':
                this.stack += c;
                this.bracketCount++;
                break;

            case ')':
                if (this.bracketCount == 0)
                {
                    RawExpression rawExpression = new RawExpression(this.globalIndex - this.stack.Length, this.stack);
                    this.expressions.Add(new Expression(rawExpression));
                    this.state = ParseStates.Start;
                }
                else
                {
                    this.bracketCount--;
                    this.stack += c;
                }
                break;

            default:
                this.stack += c;
                break;
            }
        }
示例#2
0
        public void Parse(RawExpression rawExpression)
        {
            RawExpressionParser         parser         = new RawExpressionParser(rawExpression);
            IEnumerable <RawMultiplier> rawMultipliers = parser.Iterator();

            foreach (RawMultiplier rawMultiplier in rawMultipliers)
            {
                Multiplier multiplier = new Multiplier(rawMultiplier);
                Expression expression = multiplier.ConvertToExpression();
                this.Join(expression);
            }
        }
示例#3
0
 public RawExpressionParser(RawExpression rawExpression)
 {
     this.rawExpression = rawExpression;
     this.reset();
 }
示例#4
0
 public Expression(RawExpression rawExpresion)
 {
     this.rawExpression = rawExpresion;
     this.Parse(rawExpression);
 }