예제 #1
0
 public Parser(string exp, ICalcFunction calcFunc)
 {
     this.exp = exp;
     tree = null;
     scanner = new Scanner(exp);
     this.icalcfunc = calcFunc;
 }
예제 #2
0
 public void AddChild(SyntaxTreeNode node)
 {
     children.Add(node);
 }
예제 #3
0
        /// <summary>
        /// 分析表达式,生成token、列表和语法树。
        /// </summary>
        public void Parse()
        {
            tree = null;

            curTok = scanner.GetToken();

            if (null == CurToken)
            {
                return;
            }

            tree = Exp();

            if (CurToken != null)
            {
                throw new ParseException("unexpected token:", CurToken);
            }
        }
예제 #4
0
 public Parser(string exp)
 {
     this.exp = exp;
     tree = null;
     scanner = new Scanner(exp);
 }