public Node ExprPow() { Node expressionUnary = ExprUnary(); while (CurrentToken == TokenCategory.EXPONENTIATION) { Node expressionPow = new Pow() { AnchorToken = Expect(TokenCategory.EXPONENTIATION) }; expressionPow.Add(expressionUnary); expressionPow.Add(ExprUnary()); return(expressionPow); } return(expressionUnary); }
public Node Pow() { var r = Fact(); if (Current == TokenCategory.POW) { var p = new Pow() { AnchorToken = Expect(TokenCategory.POW) }; p.Add(r); p.Add(Pow()); r = p; } return(r); }
public Node Pow() { var result = Fact(); if (Current == TokenCategory.POW) { var node = new Pow() { AnchorToken = Expect(TokenCategory.POW) }; node.Add(result); node.Add(Pow()); result = node; } return(result); }
public Node Pow() { var n1 = Fact(); if (Current == TokenCategory.POW) { var n2 = new Pow() { AnchorToken = Expect(TokenCategory.POW) }; n2.Add(n1); n2.Add(Pow()); n1 = n2; } return(n1); }
public Node Pow() { var node1 = Fact(); if (Current == TokenCategory.POW) { // We need to create a new node var node2 = new Pow() //Class Pow() : Node {} { AnchorToken = Expect(TokenCategory.POW) //AnchorToken is an attribute of Node //Useful for the production of MEANINGFUL error messages }; node2.Add(node1); //You make node1 the child of node2 node2.Add(Pow()); //Method Node Pow() node1 = node2; //Points the reference to the parent Pow Node } return(node1); }