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(); }
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(); } }
private void _query() { _andTerm(); if (next.GetType() == typeof(AndNotToken)) { newSimpleTree(new Node(_tokens.getNextToken()), branchesStack.Pop()); next = _tokens.PeekToken(); _query(); } else { return; } }