Skip to content

Commit e4c1e60

Browse files
edeadingtonclaude
andcommitted
Document the blank line separator option
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent ab8f394 commit e4c1e60

3 files changed

Lines changed: 10 additions & 6 deletions

File tree

‎src/main/java/net/sf/jsqlparser/parser/SimpleCharStream.java‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010
/* Generated By:JavaCC: Do not edit this line by hand. SimpleCharStream.java Version 8.0.0 */
1111
/*
1212
* Warning: this file is maintained by hand on top of the JavaCC template. Among other manual
13-
* adjustments it carries the in-buffer '#' rewrite in BeginToken(), which
14-
* Feature.allowHashLineComments depends on. Never overwrite it with a freshly generated
15-
* SimpleCharStream, that would silently drop the rewrite and break allowHashLineComments.
13+
* adjustments it carries the in-buffer '#' and blank line rewrites in BeginToken(), which
14+
* Feature.allowHashLineComments and Feature.allowBlankLinesAsStatementSeparator depend on. Never
15+
* overwrite it with a freshly generated SimpleCharStream, that would silently drop the rewrites and
16+
* break both features.
1617
*/
1718
package net.sf.jsqlparser.parser;
1819

‎src/main/java/net/sf/jsqlparser/parser/feature/Feature.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -890,9 +890,9 @@ public enum Feature {
890890
allowHashLineComments(false),
891891

892892
/**
893-
* treats three consecutive newlines as a statement separator, like `;`; enabled by default.
894-
* When disabled, blank lines are plain whitespace, so a statement containing them is parsed
895-
* whole instead of being cut off at the first run of blank lines
893+
* treats three consecutive newlines as a statement separator (enabled by default). When
894+
* disabled, blank lines are plain whitespace, so a statement containing them is parsed whole
895+
* instead of being cut off at the first run of blank lines
896896
*/
897897
allowBlankLinesAsStatementSeparator(true),
898898

‎src/site/sphinx/usage.rst‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ For several statements at once, use ``CCJSqlParserUtil.parseStatements()``, whic
204204
.. note::
205205

206206
Supported statement separators are semicolon ``;``, ``GO``, slash ``/`` and two empty lines ``\n\n\n``.
207+
Use ``withBlankLinesAsSeparator(false)`` to treat empty lines as plain whitespace instead.
207208

208209
If parsing fails on syntax JSQLParser does not know, see :ref:`Handle Parse Errors` — and please `open an issue <https://github.com/JSQLParser/JSqlParser/issues>`_, missing syntax gets added on demand.
209210

@@ -1571,6 +1572,8 @@ The individual features
15711572
- ``".."`` reads as a string literal instead of a quoted identifier (BigQuery, Spark/Databricks, MySQL default ``sql_mode``)
15721573
* - ``withHashLineComments``
15731574
- ``#`` starts a line comment
1575+
* - ``withBlankLinesAsSeparator``
1576+
- ``false`` stops two empty lines (``\n\n\n``) ending a statement, so they read as plain whitespace
15741577
* - ``withAdjacentStringLiterals``
15751578
- adjacent string literals concatenate: ``NEWLINE`` (SQL standard, PostgreSQL) or ``WHITESPACE`` (GoogleSQL, Spark/Databricks); ``true`` selects ``NEWLINE``, ``false`` switches it off
15761579
* - ``withAllowComplexParsing``

0 commit comments

Comments
 (0)