Class ParserUtils

java.lang.Object
org.pgcodekeeper.core.database.base.parser.ParserUtils

public class ParserUtils extends Object
Utility class for creating and managing ANTLR parser
  • Field Details

  • Method Details

    • createIgnoreListParser

      public static IgnoreListParser createIgnoreListParser(Path listFile) throws IOException
      Creates a parser for ignore list files.
      Parameters:
      listFile - path to the ignore list file
      Returns:
      configured IgnoreListParser instance
      Throws:
      IOException - if there's an error reading the file
    • addErrorListener

      public static void addErrorListener(org.antlr.v4.runtime.Lexer lexer, org.antlr.v4.runtime.Parser parser, String parsedObjectName, List<Object> errors, int offset, int lineOffset, int inLineOffset)
    • readKeywords

      public static void readKeywords(org.antlr.v4.runtime.Vocabulary vocab, int startId, int endId, Map<String,KeywordCategory> keywords, KeywordCategory type)
      Reads a range of token IDs from a vocabulary and populates a keyword map with the specified category. This is a utility method for initializing keyword maps based on lexer token definitions.
      Parameters:
      vocab - the vocabulary containing token literal names
      startId - the starting token (inclusive)
      endId - the ending token(inclusive)
      keywords - the map to populate with keywords and their categories
      type - the category to assign to all keywords in the specified range