Skip to content

Commit 3f894c7

Browse files
authored
Fix virtual table module arguments to support numeric literals (#728)
* Update sql.bnf module_argument_def supports numeric and string literals and identifiers. e.g CREATE VIRTUAL TABLE ft_locale USING fts5(a, b, c, locale=1); * Update Test.s Add some examples of numeric literal arguments * Update CHANGELOG.md * Update CHANGELOG.md
1 parent 1ff0de1 commit 3f894c7

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
## Unreleased
44

5-
Mothing yet!
6-
5+
- Support numeric literals when using virtual table module arguments (https://github.com/sqldelight/sql-psi/pull/728)
76

87
## [0.7.2] - 2025-11-12
98
[0.7.2]: https://github.com/sqldelight/sql-psi/releases/tag/0.7.2

core/src/main/kotlin/com/alecstrong/sql/psi/core/sql.bnf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ module_column_def ::= [ javadoc ] column_name [ column_type ] ( column_constrain
149149
mixin = "com.alecstrong.sql.psi.core.psi.mixins.ModuleColumnDefMixin"
150150
implements = "com.alecstrong.sql.psi.core.psi.SqlColumnDef"
151151
}
152-
module_argument_def ::= ( module_argument_name EQ (string_literal | identifier) ) | column_def | module_column_def
152+
module_argument_def ::= ( module_argument_name EQ (numeric_literal | string_literal | identifier) ) | column_def | module_column_def
153153
create_virtual_table_stmt ::= CREATE VIRTUAL TABLE [ IF NOT EXISTS ] [ database_name DOT ] table_name USING module_name [ LP <<custom_module_argument module_argument_def>> ( COMMA <<custom_module_argument module_argument_def>> ) * RP ] {
154154
mixin = "com.alecstrong.sql.psi.core.psi.mixins.CreateVirtualTableMixin"
155155
implements = "com.alecstrong.sql.psi.core.psi.TableElement"

core/src/testFixtures/resources/fixtures/fts5-tables/Test.s

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
CREATE VIRTUAL TABLE ft_locale USING fts5(a, b, c, locale=1);
2+
CREATE VIRTUAL TABLE ft_columnsize USING fts5(a, b, c, columnsize=0);
3+
CREATE VIRTUAL TABLE ft_contentless_delete USING fts5(a, b, c, content='', contentless_delete=1);
4+
CREATE VIRTUAL TABLE ft_contentless_unindexed USING fts5(a, b UNINDEXED, content='', contentless_unindexed=1);
5+
16
CREATE VIRTUAL TABLE data5 USING fts5(text, content=other_table, content_rowid=rowid, prefix='2 3 4 5 6');
27

38
SELECT *

0 commit comments

Comments
 (0)