/**
   * Parse according to the grammar statement. statement: ID '=' expression ;
   *
   * <p>match(ID); match('='); expr()
   */
  public void parserRuleAssignmentStatement(final AbstractSyntaxTree ast) {
    final LangType p1 = this.parserLookAhead(1);
    final LangType p2 = this.parserLookAhead(2);
    boolean checkRuleSymbol = p1 != null && p1.eqlt(new LangTypeTokenSymbol("<none>"));
    boolean checkRuleAssignment = p2 != null && p2.eql(new LangTypeToken("="));

    if (checkRuleSymbol && checkRuleAssignment) {
      this.parserMatchType(new LangTypeTokenSymbol("<none>"));
      this.parserMatch(new LangTypeToken("="));

      AbstractSyntaxTree continueWithAssignTree = null;
      final AbstractSyntaxTree assignTree = new AssignmentNode(p2);
      assignTree.addChildToAbstractSyntaxTree(new SymbolNode(p1));
      ast.addChildToAbstractSyntaxTree(assignTree);
      continueWithAssignTree = assignTree;

      // Continue with rule for numbers
      this.parserRuleNumberExpression(continueWithAssignTree);

    } else if (checkRuleSymbol) {
      this.parserMatchType(new LangTypeTokenSymbol("<none>"));

    } else {
      System.out.println(
          "Parser rule fail - "
              + checkRuleSymbol
              + " // "
              + checkRuleAssignment
              + " $ "
              + p1
              + "/"
              + p2);
    } // End of if - check for assignment rule
  }
  /** Parse according to the grammar statement. expressionRest: +/- NUMBER {expressionRest} */
  public void parserRuleNumberExpressionRest(
      final AbstractSyntaxTree ast, final LangType numberValLhs) {
    final LangType p1 = this.parserLookAhead(1);
    final boolean checkRulePlus = p1 != null && p1.eql(new LangTypeToken("+"));
    if (checkRulePlus) {
      final LangType plus = new LangTypeToken("+");
      final AbstractSyntaxTree newNodePlus = new PlusNode(plus);
      final AbstractSyntaxTree valnode = new NumberNode(numberValLhs);
      newNodePlus.addChildToAbstractSyntaxTree(valnode);

      this.parserMatch(plus);
      final LangType numberValRhs = this.parserLookAhead(1);
      this.parserMatchType(new LangTypeTokenDouble(-1));
      this.parserRuleNumberExpressionRest(newNodePlus, numberValRhs);
      ast.addChildToAbstractSyntaxTree(newNodePlus);
    } else {
      final AbstractSyntaxTree valnode = new NumberNode(numberValLhs);
      ast.addChildToAbstractSyntaxTree(valnode);
    } // End of the if - check rule for plus
  }