-
Notifications
You must be signed in to change notification settings - Fork 91
TSynSQLSyn (sqlOracle dialect): q-quote / alternative quoting mechanism not recognized #294
Description
Description
TSynSQLSyn with SQLDialect = sqlOracle does not recognize Oracle's alternative quoting mechanism (q-quote operator), introduced in Oracle 10gR2.
The syntax uses a q or Q prefix followed by a chosen delimiter pair, allowing single quotes inside string literals without escaping:
SELECT q'[it's a string]' FROM dual -- delimiters [ ]
SELECT q'(it's a string)' FROM dual -- delimiters ( )
SELECT q'{it's a string}' FROM dual -- delimiters { }
SELECT q'<it's a string>' FROM dual -- delimiters < >
SELECT q'-it's a string-' FROM dual -- symmetric delimiter -
SELECT q'Xit's a stringX' FROM dual -- symmetric delimiter XCurrent behavior
The highlighter does not recognize the q'...' literal. Everything from the opening q' onward is tokenized incorrectly (the string is not recognized as a string literal, and subsequent tokens are miscolored).
Expected behavior
When SQLDialect = sqlOracle, the highlighter should recognize q'<delim>...<closing-delim>' as a complete string token, where:
- If the opening delimiter is
[,(,{, or<, the closing delimiter is the matching],),}, or> - Otherwise the closing delimiter is the same character as the opening one
- The token ends only when the closing delimiter is immediately followed by a single quote (
')
Notes
- The
qprefix is case-insensitive (qorQ) - The delimiter can be any character except space, tab, newline, and
' - This syntax is valid in both SQL and PL/SQL
- It has been available since Oracle 10gR2 (2005)
Example screenshots:
1. This is a screenshot of of TSynEdit displaying some SQL using this syntax:

2. This is the same SQL as highlighted by a commercial oracle-specific SQL tool which is aware of this syntax:
