Skip to content

Commit

Permalink
[CALCITE-1241] Add a freemarker variable for adding non reserved keyw…
Browse files Browse the repository at this point in the history
…ord list to Parser.jj template (Venki Korukanti)

Add a test to prevent unintentionally adding reserved keywords.

Close apache/calcite#233
  • Loading branch information
vkorukanti authored and julianhyde committed May 22, 2016
1 parent 7ede4fb commit a2abb64
Show file tree
Hide file tree
Showing 3 changed files with 352 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main/codegen/config.fmpp
Expand Up @@ -43,10 +43,15 @@ data: {
imports: [
]

# List of new keywords. Example: "DATABASES", "TABLES".
# List of new keywords. Example: "DATABASES", "TABLES". If the keyword is not a reserved
# keyword add it to 'nonReservedKeywords' section.
keywords: [
]

# List of keywords from "keywords" section that are not reserved.
nonReservedKeywords: [
]

# List of methods for parsing custom SQL statements.
# Return type of method implementation should be 'SqlNode'.
# Example: SqlShowDatabases(), SqlShowTables().
Expand Down
3 changes: 3 additions & 0 deletions src/main/codegen/templates/Parser.jj
Expand Up @@ -5619,6 +5619,9 @@ String CommonNonReservedKeyWord() :
| <WRITE>
| <XML>
| <ZONE>
<#list parser.nonReservedKeywords as keyword>
| <${keyword}>
</#list>
)
{
return unquotedIdentifier();
Expand Down

0 comments on commit a2abb64

Please sign in to comment.