code: function initializeParser(document, debug) {
      const chars = new antlr.InputStream(document);
      const lexer = new grammar.DocumentLexer(chars);
      const listener = new CustomErrorListener(debug);
      lexer.removeErrorListeners();
      lexer.addErrorListener(listener);
      const tokens = new antlr.CommonTokenStream(lexer);
      const parser = new grammar.DocumentParser(tokens);
      parser.buildParseTrees = true;
      parser.removeErrorListeners();
      parser.addErrorListener(listener);
      parser._errHandler = new CustomErrorStrategy();
      return parser;
  }
docs: PRIVATE FUNCTIONS