Class Keyword

java.lang.Object
org.pgcodekeeper.core.sql.Keyword

public class Keyword extends Object
PostgreSQL keyword classification and management. Contains complete PostgreSQL keyword dictionary with categories and label information.

KEYWORDS list maintenance:

  1. Copy code from kwlist.h, use your desired stable branch with actual version of postgres.
  2. Paste it into addKeywords(Map), replacing the code there.
  3. In pasted code, replace PG_KEYWORD\(("\w+"), \w+, (\w+), (\w+)\) by addKw\(map, $1, $2, $3\); using regular expressions.
Author:
levsha_aa
  • Field Details

  • Constructor Details

    • Keyword

      public Keyword(String keyword, Keyword.KeywordCategory category, Keyword.LabelCategory labelCategory)
      Creates a new keyword with specified properties.
      Parameters:
      keyword - the keyword string
      category - the keyword category
      labelCategory - the label category
  • Method Details

    • getKeyword

      public String getKeyword()
    • getCategory

      public Keyword.KeywordCategory getCategory()
    • getLabelCategory

      public Keyword.LabelCategory getLabelCategory()
    • getAllTokensByGroups

      public static String 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

      public static String 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