Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions babel/src/main/codegen/config.fmpp
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,10 @@ data: {
"< NULL_SAFE_EQUAL: \"<=>\" >"
]

# Custom identifier token.
# Example: "< IDENTIFIER: (<LETTER>|<DIGIT>)+ >".
customIdentifierToken: "< IDENTIFIER: (<LETTER>|<DIGIT>)+ >"

# Binary operators initialization.
# Example: "InfixCast".
extraBinaryExpressions: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,13 @@ class BabelParserTest extends SqlParserTest {
sql(sql).ok(expected);
}

@Test void testIdentifierStartWithNumber() {
final String sql = "select 1 as 1_c1 from t";
final String expected = "SELECT 1 AS `1_C1`\n"
+ "FROM `T`";
sql(sql).ok(expected);
}

/** Tests that there are no reserved keywords. */
@Disabled
@Test void testKeywords() {
Expand Down
6 changes: 5 additions & 1 deletion core/src/main/codegen/templates/Parser.jj
Original file line number Diff line number Diff line change
Expand Up @@ -8323,7 +8323,11 @@ MORE :

<DEFAULT, DQID, BTID, BQID> TOKEN :
{
< IDENTIFIER: <LETTER> (<LETTER>|<DIGIT>)* >
<#if parser.customIdentifierToken??>
${parser.customIdentifierToken}
<#else>
< IDENTIFIER: <LETTER> (<LETTER>|<DIGIT>)* >
</#if>
}

<DEFAULT, DQID, BTID, BQID, BQHID> TOKEN :
Expand Down