Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit 95d10ad

Browse files
parser in SQLcl 23.4.0 can parse Java code without syntax errors, ensure that quoted identifiers are kept (they are strings in Java)
1 parent 68e650a commit 95d10ad

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

settings/sql_developer/trivadis_custom_format.arbori

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,22 @@ d1_initialize_timer:
157157
dontFormatNode:
158158
[node) numeric_literal
159159
| [node) path -- expected in SQL*Plus, SQLcl commands only
160+
| [node) "create_java"
160161
->
161162
;
162163

164+
enableKeepQutoedIdentifiersForCall:
165+
runOnce
166+
-> {
167+
var keepQuotedIdentifiersForCall = false;
168+
}
169+
170+
enforceKeepQuotedIdentifiersForCall:
171+
[node) "create_java"
172+
-> {
173+
keepQuotedIdentifiersForCall = true;
174+
}
175+
163176
-- --------------------------------------------------------------------------------------------------------------------
164177
-- I5: Define global variables and functions.
165178
-- --------------------------------------------------------------------------------------------------------------------
@@ -638,6 +651,7 @@ i10_determine_and_normalize_line_separators:
638651
-- - The identifier is not part of a code section for which the formatter is disabled.
639652
-- - The identifier is not part of a conditional compilation block.
640653
-- - The identifier is not a reserved keyword
654+
-- - The variable keepQuotedIdentifiersForCall is true (set at the beginning, disabled for Java)
641655
--
642656
-- Quoted identifiers look like strings in Java and other languages. The parser in SQLDev 22.2.0 does not
643657
-- understand Java stored procedures. Trying to format a Java stored procedure leads to a syntax error.
@@ -759,7 +773,7 @@ i11_enforce_nonquoted_identifiers:
759773
// get custom option keepQuotedIdentifiers (might not exist)
760774
var keepQuotedIdentifiers = struct.options.get("keepQuotedIdentifiers");
761775

762-
if (keepQuotedIdentifiers == null || !keepQuotedIdentifiers) {
776+
if ((keepQuotedIdentifiers == null || !keepQuotedIdentifiers) && !keepQuotedIdentifiersForCall) {
763777
findAndConvertQuotedIdentifiers();
764778
}
765779
}

0 commit comments

Comments
 (0)