Class ParserUtils
java.lang.Object
org.pgcodekeeper.core.database.base.parser.ParserUtils
Utility class for creating and managing ANTLR parser
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddErrorListener(org.antlr.v4.runtime.Lexer lexer, org.antlr.v4.runtime.Parser parser, String parsedObjectName, List<Object> errors, int offset, int lineOffset, int inLineOffset) static IgnoreListParsercreateIgnoreListParser(Path listFile) Creates a parser for ignore list files.static voidreadKeywords(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.
-
Field Details
-
SQL
- See Also:
-
PARSED_OBJ_NAME
- See Also:
-
-
Method Details
-
createIgnoreListParser
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
-
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 namesstartId- the starting token (inclusive)endId- the ending token(inclusive)keywords- the map to populate with keywords and their categoriestype- the category to assign to all keywords in the specified range
-