context: // Generated by TinyPG v1.3 available at www.codeproject.com
  
  using System;
  using System.Collections.Generic;
  
  namespace kOS.Compilation.KS
  {
      #region Parser
  
      public partial class Parser 
      {
          private Scanner scanner;
          private ParseTree tree;
          
          public Parser(Scanner scanner)
          {
              this.scanner = scanner;
          }
  
           public ParseTree Parse(string input)
          {
              return Parse(input, "", new ParseTree());
          }
  
          public ParseTree Parse(string input, string fileName)
          {
              return Parse(input, fileName, new ParseTree());
          }
  
          public ParseTree Parse(string input, string fileName, ParseTree tree)
          {
              scanner.Init(input, fileName);
  
              this.tree = tree;
              ParseStart(tree);
              tree.Skipped = scanner.Skipped;
  
              return tree;
          }
  
          private void ParseStart(ParseNode parent)
          {
              Token tok;
              ParseNode n;
              ParseNode node = parent.CreateNode(scanner.GetToken(TokenType.Start), "Start");
              parent.Nodes.Add(node);
  
  
              
              tok = scanner.LookAhead(TokenType.SET, TokenType.IF, TokenType.UNTIL, TokenType.LOCK, TokenType.UNLOCK, TokenType.PRINT, TokenType.ON, TokenType.TOGGLE, TokenType.WAIT, TokenType.WHEN, TokenType.IDENTIFIER, TokenType.STAGE, TokenType.CLEARSCREEN, TokenType.ADD, TokenType.REMOVE, TokenType.LOG, TokenType.BREAK, TokenType.PRESERVE, TokenType.DECLARE, TokenType.SWITCH, TokenType.COPY, TokenType.RENAME, TokenType.DELETE, TokenType.EDIT, TokenType.RUN, TokenType.LIST, TokenType.REBOOT, TokenType.SHUTDOWN, TokenType.FOR, TokenType.UNSET, TokenType.BATCH, TokenType.DEPLOY);
              while (tok.Type == TokenType.SET
                  || tok.Type == TokenType.IF
                  || tok.Type == TokenType.UNTIL
                  || tok.Type == TokenType.LOCK
                  || tok.Type == TokenType.UNLOCK
                  || tok.Type == TokenType.PRINT
                  || tok.Type == TokenType.ON
                  || tok.Type == TokenType.TOGGLE
                  || tok.Type == TokenType.WAIT
                  || tok.Type == TokenType.WHEN
                  || tok.Type == TokenType.IDENTIFIER
                  || tok.Type == TokenType.STAGE
                  || tok.Type == TokenType.CLEARSCREEN
                  || tok.Type == TokenType.ADD
                  || tok.Type == TokenType.REMOVE
                  || tok.Type == TokenType.LOG
                  || tok.Type == TokenType.BREAK
                  || tok.Type == TokenType.PRESERVE
                  || tok.Type == TokenType.DECLARE
                  || tok.Type == TokenType.SWITCH
                  || tok.Type == TokenType.COPY
                  || tok.Type == TokenType.RENAME
                  || tok.Type == TokenType.DELETE
                  || tok.Type == TokenType.EDIT
                  || tok.Type == TokenType.RUN
                  || tok.Type == TokenType.LIST
                  || tok.Type == TokenType.REBOOT
                  || tok.Type == TokenType.SHUTDOWN
                  || tok.Type == TokenType.FOR
                  || tok.Type == TokenType.UNSET
                  || tok.Type == TokenType.BATCH
                  || tok.Type == TokenType.DEPLOY)
              {
                  Parseinstruction(node);
              tok = scanner.LookAhead(TokenType.SET, TokenType.IF, TokenType.UNTIL, TokenType.LOCK, TokenType.UNLOCK, TokenType.PRINT, TokenType.ON, TokenType.TOGGLE, TokenType.WAIT, TokenType.WHEN, TokenType.IDENTIFIER, TokenType.STAGE, TokenType.CLEARSCREEN, TokenType.ADD, TokenType.REMOVE, TokenType.LOG, TokenType.BREAK, TokenType.PRESERVE, TokenType.DECLARE, TokenType.SWITCH, TokenType.COPY, TokenType.RENAME, TokenType.DELETE, TokenType.EDIT, TokenType.RUN, TokenType.LIST, TokenType.REBOOT, TokenType.SHUTDOWN, TokenType.FOR, TokenType.UNSET, TokenType.BATCH, TokenType.DEPLOY);
              }
  
              
              tok = scanner.Scan(TokenType.EOF);
              n = node.CreateNode(tok, tok.ToString() );
              node.Token.UpdateRange(tok);
              node.Nodes.Add(n);
              if (tok.Type != TokenType.EOF) {
                  tree.Errors.Add(new ParseError("Unexpected token '" + tok.Text.Replace("\n", "") + "' found. Expected " + TokenType.EOF.ToString(), 0x1001, tok));
                  return;
              }
  
              parent.Token.UpdateRange(node.Token);
          }
  
          private void Parseinstruction_block(ParseNode parent)
          {
              Token tok;
              ParseNode n;
              ParseNode node = parent.CreateNode(scanner.GetToken(TokenType.instruction_block), "instruction_block");
              parent.Nodes.Add(node);
  
              tok = scanner.LookAhead(TokenType.SET, TokenType.IF, TokenType.UNTIL, TokenType.LOCK, TokenType.UNLOCK, TokenType.PRINT, TokenType.ON, TokenType.TOGGLE, TokenType.WAIT, TokenType.WHEN, TokenType.IDENTIFIER, TokenType.STAGE, TokenType.CLEARSCREEN, TokenType.ADD, TokenType.REMOVE, TokenType.LOG, TokenType.BREAK, TokenType.PRESERVE, TokenType.DECLARE, TokenType.SWITCH, TokenType.COPY, TokenType.RENAME, TokenType.DELETE, TokenType.EDIT, TokenType.RUN, TokenType.LIST, TokenType.REBOOT, TokenType.SHUTDOWN, TokenType.FOR, TokenType.UNSET, TokenType.BATCH, TokenType.DEPLOY, TokenType.CURLYOPEN);
              switch (tok.Type)
              {
                  case TokenType.SET:
                  case TokenType.IF:
                  case TokenType.UNTIL:
                  case TokenType.LOCK:
                  case TokenType.UNLOCK:
                  case TokenType.PRINT:
                  case TokenType.ON:
                  case TokenType.TOGGLE:
                  case TokenType.WAIT:
                  case TokenType.WHEN:
                  case TokenType.IDENTIFIER:
                  case TokenType.STAGE:
                  case TokenType.CLEARSCREEN:
                  case TokenType.ADD:
                  case TokenType.REMOVE:
                  case TokenType.LOG:
                  case TokenType.BREAK:
                  case TokenType.PRESERVE:
                  case TokenType.DECLARE:
                  case TokenType.SWITCH:
                  case TokenType.COPY:
                  case TokenType.RENAME:
                  case TokenType.DELETE:
                  case TokenType.EDIT:
                  case TokenType.RUN:
                  case TokenType.LIST:
                  case TokenType.REBOOT:
                  case TokenType.SHUTDOWN:
                  case TokenType.FOR:
                  case TokenType.UNSET:
                  case TokenType.BATCH:
                  case TokenType.DEPLOY:
                      Parseinstruction(node);
                      break;
                  case TokenType.CURLYOPEN:
  
                      
                      tok = scanner.Scan(TokenType.CURLYOPEN);
                      n = node.CreateNode(tok, tok.ToString() );
                      node.Token.UpdateRange(tok);
                      node.Nodes.Add(n);
                      if (tok.Type != TokenType.CURLYOPEN) {
                          tree.Errors.Add(new ParseError("Unexpected token '" + tok.Text.Replace("\n", "") + "' found. Expected " + TokenType.CURLYOPEN.ToString(), 0x1001, tok));
                          return;
                      }
  
                      
                      do {
                          Parseinstruction(node);
                          tok = scanner.LookAhead(TokenType.SET, TokenType.IF, TokenType.UNTIL, TokenType.LOCK, TokenType.UNLOCK, TokenType.PRINT, TokenType.ON, TokenType.TOGGLE, TokenType.WAIT, TokenType.WHEN, TokenType.IDENTIFIER, TokenType.STAGE, TokenType.CLEARSCREEN, TokenType.ADD, TokenType.REMOVE, TokenType.LOG, TokenType.BREAK, TokenType.PRESERVE, TokenType.DECLARE, TokenType.SWITCH, TokenType.COPY, TokenType.RENAME, TokenType.DELETE, TokenType.EDIT, TokenType.RUN, TokenType.LIST, TokenType.REBOOT, TokenType.SHUTDOWN, TokenType.FOR, TokenType.UNSET, TokenType.BATCH, TokenType.DEPLOY);
                      } while (tok.Type == TokenType.SET
                          || tok.Type == TokenType.IF
                          || tok.Type == TokenType.UNTIL
                          || tok.Type == TokenType.LOCK
                          || tok.Type == TokenType.UNLOCK
                          || tok.Type == TokenType.PRINT
                          || tok.Type == TokenType.ON
                          || tok.Type == TokenType.TOGGLE
                          || tok.Type == TokenType.WAIT
                          || tok.Type == TokenType.WHEN
                          || tok.Type == TokenType.IDENTIFIER
                          || tok.Type == TokenType.STAGE
                          || tok.Type == TokenType.CLEARSCREEN
                          || tok.Type == TokenType.ADD
                          || tok.Type == TokenType.REMOVE
                          || tok.Type == TokenType.LOG
                          || tok.Type == TokenType.BREAK
                          || tok.Type == TokenType.PRESERVE
                          || tok.Type == TokenType.DECLARE
                          || tok.Type == TokenType.SWITCH
                          || tok.Type == TokenType.COPY
                          || tok.Type == TokenType.RENAME
                          || tok.Type == TokenType.DELETE
                          || tok.Type == TokenType.EDIT
                          || tok.Type == TokenType.RUN
                          || tok.Type == TokenType.LIST
                          || tok.Type == TokenType.REBOOT
                          || tok.Type == TokenType.SHUTDOWN
                          || tok.Type == TokenType.FOR
                          || tok.Type == TokenType.UNSET
                          || tok.Type == TokenType.BATCH
                          || tok.Type == TokenType.DEPLOY);
  
                      
                      tok = scanner.Scan(TokenType.CURLYCLOSE);
                      n = node.CreateNode(tok, tok.ToString() );
                      node.Token.UpdateRange(tok);
                      node.Nodes.Add(n);
                      if (tok.Type != TokenType.CURLYCLOSE) {
                          tree.Errors.Add(new ParseError("Unexpected token '" + tok.Text.Replace("\n", "") + "' found. Expected " + TokenType.CURLYCLOSE.ToString(), 0x1001, tok));
                          return;
                      }
  
                      
                      tok = scanner.LookAhead(TokenType.EOI);
                      if (tok.Type == TokenType.EOI)
                      {
                          tok = scanner.Scan(TokenType.EOI);
                          n = node.CreateNode(tok, tok.ToString() );
                          node.Token.UpdateRange(tok);
                          node.Nodes.Add(n);
                          if (tok.Type != TokenType.EOI) {
                              tree.Errors.Add(new ParseError("Unexpected token '" + tok.Text.Replace("\n", "") + "' found. Expected " + TokenType.EOI.ToString(), 0x1001, tok));
                              return;
                          }
                      }
                      break;
                  default:
                      tree.Errors.Add(new ParseError("Unexpected token '" + tok.Text.Replace("\n", "") + "' found.", 0x0002, tok));
                      break;
              }
  
              parent.Token.UpdateRange(node.Token);
          }
  
          private void Parseinstruction(ParseNode parent)
          {
              Token tok;
              ParseNode n;
              ParseNode node = parent.CreateNode(scanner.GetToken(TokenType.instruction), "instruction");
              parent.Nodes.Add(node);
  
              tok = scanner.LookAhead(TokenType.SET, TokenType.IF, TokenType.UNTIL, TokenType.LOCK, TokenType.UNLOCK, TokenType.PRINT, TokenType.ON, TokenType.TOGGLE, TokenType.WAIT, TokenType.WHEN, TokenType.IDENTIFIER, TokenType.STAGE, TokenType.CLEARSCREEN, TokenType.ADD, TokenType.REMOVE, TokenType.LOG, TokenType.BREAK, TokenType.PRESERVE, TokenType.DECLARE, TokenType.SWITCH, TokenType.COPY, TokenType.RENAME, TokenType.DELETE, TokenType.EDIT, TokenType.RUN, TokenType.LIST, TokenType.REBOOT, TokenType.SHUTDOWN, TokenType.FOR, TokenType.UNSET, TokenType.BATCH, TokenType.DEPLOY);
              switch (tok.Type)
              {
                  case TokenType.SET:
                      Parseset_stmt(node);
                      break;
                  case TokenType.IF:
                      Parseif_stmt(node);
                      break;
                  case TokenType.UNTIL:
                      Parseuntil_stmt(node);
                      break;
                  case TokenType.LOCK:
                      Parselock_stmt(node);
                      break;
                  case TokenType.UNLOCK:
                      Parseunlock_stmt(node);
                      break;
                  case TokenType.PRINT:
                      Parseprint_stmt(node);
                      break;
                  case TokenType.ON:
                      Parseon_stmt(node);
                      break;
                  case TokenType.TOGGLE:
                      Parsetoggle_stmt(node);
                      break;
                  case TokenType.WAIT:
                      Parsewait_stmt(node);
                      break;
                  case TokenType.WHEN:
                      Parsewhen_stmt(node);
                      break;
                  case TokenType.IDENTIFIER:
                      Parseonoff_stmt(node);
                      break;
                  case TokenType.STAGE:
                      Parsestage_stmt(node);
                      break;
                  case TokenType.CLEARSCREEN:
                      Parseclear_stmt(node);
                      break;
                  case TokenType.ADD:
                      Parseadd_stmt(node);
                      break;
                  case TokenType.REMOVE:
                      Parseremove_stmt(node);
                      break;
                  case TokenType.LOG:
                      Parselog_stmt(node);
                      break;
                  case TokenType.BREAK:
                      Parsebreak_stmt(node);
                      break;
                  case TokenType.PRESERVE:
                      Parsepreserve_stmt(node);
                      break;
                  case TokenType.DECLARE:
                      Parsedeclare_stmt(node);
                      break;
                  case TokenType.SWITCH:
                      Parseswitch_stmt(node);
                      break;
                  case TokenType.COPY:
                      Parsecopy_stmt(node);
                      break;
                  case TokenType.RENAME:
                      Parserename_stmt(node);
                      break;
                  case TokenType.DELETE:
                      Parsedelete_stmt(node);
                      break;
                  case TokenType.EDIT:
                      Parseedit_stmt(node);
                      break;
                  case TokenType.RUN:
                      Parserun_stmt(node);
                      break;
                  case TokenType.LIST:
                      Parselist_stmt(node);
                      break;
                  case TokenType.REBOOT:
                      Parsereboot_stmt(node);
                      break;
                  case TokenType.SHUTDOWN:
                      Parseshutdown_stmt(node);
                      break;
                  case TokenType.FOR:
                      Parsefor_stmt(node);
                      break;
                  case TokenType.UNSET:
                      Parseunset_stmt(node);
                      break;
                  case TokenType.BATCH:
                      Parsebatch_stmt(node);
                      break;
                  case TokenType.DEPLOY:
                      Parsedeploy_stmt(node);
                      break;
                  default:
                      tree.Errors.Add(new ParseError("Unexpected token '" + tok.Text.Replace("\n", "") + "' found.", 0x0002, tok));
                      break;
              }
  
              parent.Token.UpdateRange(node.Token);
          }
  
          private void Parseset_stmt(ParseNode parent)
          {
              Token tok;
              ParseNode n;
              ParseNode node = parent.CreateNode(scanner.GetToken(TokenType.set_stmt), "set_stmt");
              parent.Nodes.Add(node);
  
  
              
              tok = scanner.Scan(TokenType.SET);
              n = node.CreateNode(tok, tok.ToString() );
              node.Token.UpdateRange(tok);
              node.Nodes.Add(n);
              if (tok.Type != TokenType.SET) {
                  tree.Errors.Add(new ParseError("Unexpected token '" + tok.Text.Replace("\n", "") + "' found. Expected " + TokenType.SET.ToString(), 0x1001, tok));
                  return;
              }
  
              
              Parsevaridentifier(node);
  
              
              tok = scanner.Scan(TokenType.TO);
              n = node.CreateNode(tok, tok.ToString() );
              node.Token.UpdateRange(tok);
              node.Nodes.Add(n);
              if (tok.Type != TokenType.TO) {
                  tree.Errors.Add(new ParseError("Unexpected token '" + tok.Text.Replace("\n", "") + "' found. Expected " + TokenType.TO.ToString(), 0x1001, tok));
                  return;
              }
  
              
              Parseexpr(node);
  
              
              tok = scanner.Scan(TokenType.EOI);
              n = node.CreateNode(tok, tok.ToString() );
              node.Token.UpdateRange(tok);
              node.Nodes.Add(n);
              if (tok.Type != TokenType.EOI) {
                  tree.Errors.Add(new ParseError("Unexpected token '" + tok.Text.Replace("\n", "") + "' found. Expected " + TokenType.EOI.ToString(), 0x1001, tok));
                  return;
              }
  
              parent.Token.UpdateRange(node.Token);
          }
  
          private void Parseif_stmt(ParseNode parent)
          {
              Token tok;
              ParseNode n;
              ParseNode node = parent.CreateNode(scanner.GetToken(TokenType.if_stmt), "if_stmt");
              parent.Nodes.Add(node);
  
  
              
              tok = scanner.Scan(TokenType.IF);
              n = node.CreateNode(tok, tok.ToString() );
              node.Token.UpdateRange(tok);
              node.Nodes.Add(n);
              if (tok.Type != TokenType.IF) {
                  tree.Errors.Add(new ParseError("Unexpected token '" + tok.Text.Replace("\n", "") + "' found. Expected " + TokenType.IF.ToString(), 0x1001, tok));
                  return;
              }
  
              
              Parseexpr(node);
  
              
              Parseinstruction_block(node);
  
              
              tok = scanner.LookAhead(TokenType.ELSE);
              if (tok.Type == TokenType.ELSE)
              {
  
                  
                  tok = scanner.Scan(TokenType.ELSE);
                  n = node.CreateNode(tok, tok.ToString() );
                  node.Token.UpdateRange(tok);
                  node.Nodes.Add(n);
                  if (tok.Type != TokenType.ELSE) {
                      tree.Errors.Add(new ParseError("Unexpected token '" + tok.Text.Replace("\n", "") + "' found. Expected " + TokenType.ELSE.ToString(), 0x1001, tok));
                      return;
                  }
  
                  
                  Parseinstruction_block(node);
              }
  
              
              tok = scanner.LookAhead(TokenType.EOI);
              if (tok.Type == TokenType.EOI)
              {
                  tok = scanner.Scan(TokenType.EOI);
                  n = node.CreateNode(tok, tok.ToString() );
                  node.Token.UpdateRange(tok);
                  node.Nodes.Add(n);
                  if (tok.Type != TokenType.EOI) {
                      tree.Errors.Add(new ParseError("Unexpected token '" + tok.Text.Replace("\n", "") + "' found. Expected " + TokenType.EOI.ToString(), 0x1001, tok));
                      return;
                  }
              }
  
              parent.Token.UpdateRange(node.Token);
          }
  
          private void Parseuntil_stmt(ParseNode parent)
          {
              Token tok;
              ParseNode n;
              ParseNode node = parent.CreateNode(scanner.GetToken(TokenType.until_stmt), "until_stmt");
              parent.Nodes.Add(node);
  
  
              
              tok = scanner.Scan(TokenType.UNTIL);
              n = node.CreateNode(tok, tok.ToString() );
              node.Token.UpdateRange(tok);
              node.Nodes.Add(n);
              if (tok.Type != TokenType.UNTIL) {
                  tree.Errors.Add(new ParseError("Unexpected token '" + tok.Text.Replace("\n", "") + "' found. Expected " + TokenType.UNTIL.ToString(), 0x1001, tok));
                  return;
              }
  
              
              Parseexpr(node);
  
              
              Parseinstruction_block(node);
  
              
              tok = scanner.LookAhead(TokenType.EOI);
              if (tok.Type == TokenType.EOI)
              {
                  tok = scanner.Scan(TokenType.EOI);
                  n = node.CreateNode(tok, tok.ToString() );
                  node.Token.UpdateRange(tok);
                  node.Nodes.Add(n);
                  if (tok.Type != TokenType.EOI) {
                      tree.Errors.Add(new ParseError("Unexpected token '" + tok.Text.Replace("\n", "") + "' found. Expected " + TokenType.EOI.ToString(), 0x1001, tok));
                      return;
                  }
              }
  
              parent.Token.UpdateRange(node.Token);
          }
  
          private void Parselock_stmt(ParseNode parent)
          {
              Token tok;
              ParseNode n;
              ParseNode node = parent.CreateNode(scanner.GetToken(TokenType.lock_stmt), "lock_stmt");
              parent.Nodes.Add(node);
  
  
              
              tok = scanner.Scan(TokenType.LOCK);
              n = node.CreateNode(tok, tok.ToString() );
              node.Token.UpdateRange(tok);
              node.Nodes.Add(n);
              if (tok.Type != TokenType.LOCK) {
                  tree.Errors.Add(new ParseError("Unexpected token '" + tok.Text.Replace("\n", "") + "' found. Expected " + TokenType.LOCK.ToString(), 0x1001, tok));
                  return;
              }
  
              
              tok = scanner.Scan(TokenType.IDENTIFIER);
              n = node.CreateNode(tok, tok.ToString() );
              node.Token.UpdateRange(tok);
              node.Nodes.Add(n);
              if (tok.Type != TokenType.IDENTIFIER) {
                  tree.Errors.Add(new ParseError("Unexpected token '" + tok.Text.Replace("\n", "") + "' found. Expected " + TokenType.IDENTIFIER.ToString(), 0x1001, tok));
                  return;
              }
  
              
              tok = scanner.Scan(TokenType.TO);
              n = node.CreateNode(tok, tok.ToString() );
              node.Token.UpdateRange(tok);
              node.Nodes.Add(n);
              if (tok.Type != TokenType.TO) {
                  tree.Errors.Add(new ParseError("Unexpected token '" + tok.Text.Replace("\n", "") + "' found. Expected " + TokenType.TO.ToString(), 0x1001, tok));
                  return;
              }
  
              
              Parseexpr(node);
  
              
              tok = scanner.Scan(TokenType.EOI);
              n = node.CreateNode(tok, tok.ToString() );
              node.Token.UpdateRange(tok);
              node.Nodes.Add(n);
              if (tok.Type != TokenType.EOI) {
                  tree.Errors.Add(new ParseError("Unexpected token '" + tok.Text.Replace("\n", "") + "' found. Expected " + TokenType.EOI.ToString(), 0x1001, tok));
                  return;
              }
  
              parent.Token.UpdateRange(node.Token);
          }
  
          private void Parseunlock_stmt(ParseNode parent)
          {
              Token tok;
              ParseNode n;
              ParseNode node = parent.CreateNode(scanner.GetToken(TokenType.unlock_stmt), "unlock_stmt");
              parent.Nodes.Add(node);
  
  
              
              tok = scanner.Scan(TokenType.UNLOCK);
              n = node.CreateNode(tok, tok.ToString() );
              node.Token.UpdateRange(tok);
              node.Nodes.Add(n);
              if (tok.Type != TokenType.UNLOCK) {
                  tree.Errors.Add(new ParseError("Unexpected token '" + tok.Text.Replace("\n", "") + "' found. Expected " + TokenType.UNLOCK.ToString(), 0x1001, tok));
                  return;
              }
  
              
              tok = scanner.LookAhead(TokenType.IDENTIFIER, TokenType.ALL);
              switch (tok.Type)
              {
                  case TokenType.IDENTIFIER:
                      tok = scanner.Scan(TokenType.IDENTIFIER);
                      n = node.CreateNode(tok, tok.ToString() );
                      node.Token.UpdateRange(tok);
                      node.Nodes.Add(n);
                      if (tok.Type != TokenType.IDENTIFIER) {
                          tree.Errors.Add(new ParseError("Unexpected token '" + tok.Text.Replace("\n", "") + "' found. Expected " + TokenType.IDENTIFIER.ToString(), 0x1001, tok));
                          return;
                      }
                      break;
                  case TokenType.ALL:
                      tok = scanner.Scan(TokenType.ALL);
                      n = node.CreateNode(tok, tok.ToString() );
                      node.Token.UpdateRange(tok);
                      node.Nodes.Add(n);
                      if (tok.Type != TokenType.ALL) {
                          tree.Errors.Add(new ParseError("Unexpected token '" + tok.Text.Replace("\n", "") + "' found. Expected " + TokenType.ALL.ToString(), 0x1001, tok));
                          return;
                      }
                      break;
                  default:
                      tree.Errors.Add(new ParseError("Unexpected token '" + tok.Text.Replace("\n", "") + "' found.", 0x0002, tok));
                      break;
              }
  
              
              tok = scanner.Scan(TokenType.EOI);
              n = node.CreateNode(tok, tok.ToString() );
              node.Token.UpdateRange(tok);
              node.Nodes.Add(n);
              if (tok.Type != TokenType.EOI) {
                  tree.Errors.Add(new ParseError("Unexpected token '" + tok.Text.Replace("\n", "") + "' found. Expected " + TokenType.EOI.ToString(), 0x1001, tok));
                  return;
              }
  
              parent.Token.UpdateRange(node.Token);
          }
  
          private void Parseprint_stmt(ParseNode parent)
          {
              Token tok;
              ParseNode n;
              ParseNode node = parent.CreateNode(scanner.GetToken(TokenType.print_stmt), "print_stmt");
              parent.Nodes.Add(node);
  
  
              
              tok = scanner.Scan(TokenType.PRINT);
              n = node.CreateNode(tok, tok.ToString() );
              node.Token.UpdateRange(tok);
              node.Nodes.Add(n);
              if (tok.Type != TokenType.PRINT) {
                  tree.Errors.Add(new ParseError("Unexpected token '" + tok.Text.Replace("\n", "") + "' found. Expected " + TokenType.PRINT.ToString(), 0x1001, tok));
                  return;
              }
  
              
              Parseexpr(node);
  
              
              tok = scanner.LookAhead(TokenType.AT);
              if (tok.Type == TokenType.AT)
              {
  
                  
                  tok = scanner.Scan(TokenType.AT);
                  n = node.CreateNode(tok, tok.ToString() );
                  node.Token.UpdateRange(tok);
                  node.Nodes.Add(n);
                  if (tok.Type != TokenType.AT) {
                      tree.Errors.Add(new ParseError("Unexpected token '" + tok.Text.Replace("\n", "") + "' found. Expected " + TokenType.AT.ToString(), 0x1001, tok));
                      return;
                  }
  
                  
                  tok = scanner.Scan(TokenType.BRACKETOPEN);
                  n = node.CreateNode(tok, tok.ToString() );
                  node.Token.UpdateRange(tok);
                  node.Nodes.Add(n);
                  if (tok.Type != TokenType.BRACKETOPEN) {
                      tree.Errors.Add(new ParseError("Unexpected token '" + tok.Text.Replace("\n", "") + "' found. Expected " + TokenType.BRACKETOPEN.ToString(), 0x1001, tok));
                      return;
                  }
  
                  
                  Parseexpr(node);
  
                  
                  tok = scanner.Scan(TokenType.COMMA);
                  n = node.CreateNode(tok, tok.ToString() );
                  node.Token.UpdateRange(tok);
                  node.Nodes.Add(n);
                  if (tok.Type != TokenType.COMMA) {
                      tree.Errors.Add(new ParseError("Unexpected token '" + tok.Text.Replace("\n", "") + "' found. Expected " + TokenType.COMMA.ToString(), 0x1001, tok));
                      return;
                  }
  
                  
                  Parseexpr(node);
  
                  
                  tok = scanner.Scan(TokenType.BRACKETCLOSE);
                  n = node.CreateNode(tok, tok.ToString() );
                  node.Token.UpdateRange(tok);
                  node.Nodes.Add(n);
                  if (tok.Type != TokenType.BRACKETCLOSE) {
                      tree.Errors.Add(new ParseError("Unexpected token '" + tok.Text.Replace("\n", "") + "' found. Expected " + TokenType.BRACKETCLOSE.ToString(), 0x1001, tok));
                      return;
                  }
              }
  
              
  
gt:             tok = scanner.Scan(TokenType.EOI);