Package org.pgcodekeeper.core.sql
Class Keyword
java.lang.Object
org.pgcodekeeper.core.sql.Keyword
PostgreSQL keyword classification and management.
Contains complete PostgreSQL keyword dictionary with categories and label information.
KEYWORDS list maintenance:
- Copy code from kwlist.h, use your desired stable branch with actual version of postgres.
- Paste it into
addKeywords(Map), replacing the code there. - In pasted code, replace
PG_KEYWORD\(("\w+"), \w+, (\w+), (\w+)\)byaddKw\(map, $1, $2, $3\);using regular expressions.
- Author:
- levsha_aa
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumPostgreSQL keyword categories based on parser classification.static enumLabel categories for keyword usage in different contexts. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionKeyword(String keyword, Keyword.KeywordCategory category, Keyword.LabelCategory labelCategory) Creates a new keyword with specified properties. -
Method Summary
-
Field Details
-
KEYWORDS
-
-
Constructor Details
-
Keyword
public Keyword(String keyword, Keyword.KeywordCategory category, Keyword.LabelCategory labelCategory) Creates a new keyword with specified properties.- Parameters:
keyword- the keyword stringcategory- the keyword categorylabelCategory- the label category
-
-
Method Details
-
getKeyword
-
getCategory
-
getLabelCategory
-
getAllTokensByGroups
Generates a formatted string containing all SQL keywords organized by categories in token format suitable for lexer grammar files. Keywords are grouped by category with section headers and alphabetically sorted within each category.- Returns:
- a formatted string with keywords in token format (e.g., "KEYWORD: 'KEYWORD';")
-
getAllWordsByGroups
Generates a formatted string containing all SQL keywords organized by categories. Keywords are grouped by category with section headers and includes a separate section for bare label keywords.- Returns:
- a formatted string with keywords organized by categories in list format
-