private Node ParseModExpression() { Node node = ParseMultiplicativeExpression(); while((tokenType == TokenType.Percent)){ TokenType op_type = tokenType; GetToken(); Node right = ParseMultiplicativeExpression(); node = new OPNode(node,right,op_type); } return node; }
//*と/の処理。 private Node ParseMultiplicativeExpression() { ShowDebugMessage("ParseMultiplicativeExpression"); Node node = ParseUnaryExpression(); while((tokenType == TokenType.Asterisk) || (tokenType == TokenType.Slash)){ TokenType op_type = tokenType; GetToken(); Node right = ParseUnaryExpression(); node = new OPNode(node,right,op_type); } return node; }
// + と - の処理。 private Node ParseAdditiveExpression() { ShowDebugMessage("ParseAdditiveExpression"); // +と-の前に*と/の処理。 Node node = ParseModExpression(); while((tokenType == TokenType.Plus) || (tokenType == TokenType.Minus)){ TokenType op_type = tokenType; GetToken(); Node right = ParseModExpression(); node = new OPNode(node,right,op_type); } return node; }