Conversation
| DATELITERAL : '{' D STRINGLITERAL '}'; | ||
| TIMELITERAL : '{' T STRINGLITERAL '}'; | ||
| TIMESTAMPLITERAL : '{' T S STRINGLITERAL '}'; | ||
| DATELITERAL : '{' D [ \t\r\n]* STRINGLITERAL '}'; |
There was a problem hiding this comment.
How about switching the general logic towards TIMESTAMP_ESCAPE_START (dateTime | genericTemporalLiteralText) '}' style as it is done in the HQL parser? The TIMESTAMP_ESCAPE_START is a bit strange though but it seems to require much less ceremony. What do you think?
There was a problem hiding this comment.
Yes, I agree that this structure is cleaner. I updated JPQL and EQL to use *_ESCAPE_START ... '}' parser rules, following HQL's approach. Since JPQL and EQL do not have HQL's structured dateTime, date, and time rules, they retain their existing quoted-literal scope through generic_temporal_literal_text.
Splitting the composite lexer tokens also exposed a round-trip detail: the default renderer adds a space before }, while always rendering inline changes the existing no-whitespace forms. I therefore introduced a shared JDBC escape rendering path for JPQL, EQL, and HQL that preserves whether whitespace follows the marker. The shared renderer TCK now covers both forms for date, time, and timestamp literals.
Replace the composite JDBC date, time, and timestamp lexer tokens with parser rules based on `TIMESTAMP_ESCAPE_START`, `DATE_ESCAPE_START`, and `TIME_ESCAPE_START`. Use a shared rendering path for JPQL, EQL, and HQL that preserves whether whitespace follows the escape marker. Cover both whitespace and no-whitespace forms through the shared renderer TCK. Signed-off-by: jewoodev <jewoos15@naver.com>
d0313ed to
d80578c
Compare
4887543 to
c43320e
Compare
JPQL and EQL tokenize JDBC date, time, and timestamp escape literals as single tokens, requiring the marker to be directly followed by the quoted literal. This rejects common JDBC-style forms such as
{d '2012-01-03'}.This change aligns JPQL and EQL parsing with HQL's
*_ESCAPE_STARTstructure. A shared JPQL, EQL, and HQL rendering path preserves both whitespace and no-whitespace forms, covered by the shared renderer TCK.