public void Visit(ExprUnaryNode node) { foreach (var subnode in node) { Visit((dynamic)subnode); } }
public Node ExprUnary() { var top = new ExprUnaryNode(); var temp = top; if (firstOfExprUnary.Contains(CurrentToken)) { while (firstOfExprUnary.Contains(CurrentToken)) { switch (CurrentToken) { case TokenCategory.PLUS: temp.AnchorToken = Expect(TokenCategory.PLUS); break; case TokenCategory.NEG: temp.AnchorToken = Expect(TokenCategory.NEG); break; case TokenCategory.NOT: temp.AnchorToken = Expect(TokenCategory.NOT); break; default: throw new SyntaxError(firstOfExprUnary, tokenStream.Current); } if (!firstOfExprUnary.Contains(CurrentToken)) { temp.Add(ExprPrimary()); } else { var newNode = new ExprUnaryNode(); temp.Add(newNode); temp = newNode; } } } else { return(ExprPrimary()); } return(top); }