Skip to content

Commit

Permalink
Document acceptUnsupportedGrammar option
Browse files Browse the repository at this point in the history
  • Loading branch information
nene committed Nov 17, 2024
1 parent 204ac57 commit 7689818
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,10 @@ Parses SQL string and returns the CST tree. Takes the following options:
By default a query like `SELECT * FROM tbl WHERE id = ?` will result in parse error.
To fix it, use `paramTypes: ["?"]` config option.
- **filename**: `string` Name of the SQL file. This is only used for error-reporting.
- **acceptUnsupportedGrammar**: `boolean` When enabled, code that would otherwise fail to parse,
gets parsed as `unsupported_grammar_stmt` node. That will consume all text until the next semicolon.
After the semicolon, parsing will resume as normal. This option is primarily intended as a workaround
for using the parser with an SQL dialect that's not yet 100% supported.

When parsing fails with syntax error, it throws `FormattedSyntaxError` which contains a message like:

Expand Down

0 comments on commit 7689818

Please sign in to comment.