示例#1
0
文件: Parser.cs 项目: bolsson/Spider
        public Parser(Tokens tokens)
        {
            branchesStack = new Stack<Node>();
            BinaryTree = new BinaryTreeImp();
            _tokens = tokens;

            next = _tokens.PeekToken();
            if (next.ToString() == "(")
                _query();
            else //NOTE: if the first token is not a parenthesis then all tokens are treated as word tokens, not logic tokens or others
                _buildTreeWordsOnly();
        }
示例#2
0
        public Parser(Tokens tokens)
        {
            branchesStack = new Stack <Node>();
            BinaryTree    = new BinaryTreeImp();
            _tokens       = tokens;

            next = _tokens.PeekToken();
            if (next.ToString() == "(")
            {
                _query();
            }
            else //NOTE: if the first token is not a parenthesis then all tokens are treated as word tokens, not logic tokens or others
            {
                _buildTreeWordsOnly();
            }
        }
示例#3
0
 private void _query()
 {
     _andTerm();
     if (next.GetType() == typeof(AndNotToken))
     {
         newSimpleTree(new Node(_tokens.getNextToken()), branchesStack.Pop());
         next = _tokens.PeekToken();
         _query();
     }
     else
     {
         return;
     }
 }