Skip to content

Commit 7477ec3

Browse files
committed
grammar: Add CREATE VIRTUAL TABLE support to the new parser
Add support for parsing CREATE VIRTUAL TABLE statements to the new bison-generated parser. Also remove support for this from the Antlr parser. Parsing virtual tables is far from complete but good enough for our purposes. It is also not worse than with the old parser. See issue #1990.
1 parent 9e8cb6e commit 7477ec3

File tree

8 files changed

+2491
-2646
lines changed

8 files changed

+2491
-2646
lines changed

src/grammar/Sqlite3Parser.cpp

Lines changed: 1272 additions & 1579 deletions
Large diffs are not rendered by default.

src/grammar/Sqlite3Parser.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ class CUSTOM_API Sqlite3Parser : public ANTLR_USE_NAMESPACE(antlr)LLkParser, pub
4545
public: void keywordastablename();
4646
public: void columndef();
4747
public: void tableconstraint();
48-
public: void name();
49-
public: void expr();
5048
public: void keywordascolumnname();
5149
public: void columnname();
5250
public: void type_name();
5351
public: void columnconstraint();
52+
public: void name();
5453
public: void conflictclause();
54+
public: void expr();
5555
public: void literalvalue();
5656
public: void foreignkeyclause();
5757
public: void indexedcolumn();

src/grammar/sqlite3.g

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -270,13 +270,9 @@ keywordastablename
270270

271271
createtable
272272
:
273-
(CREATE (TEMP|TEMPORARY)? TABLE (IF_T NOT EXISTS)? (tablename | keywordastablename)
273+
CREATE (TEMP|TEMPORARY)? TABLE (IF_T NOT EXISTS)? (tablename | keywordastablename)
274274
(LPAREN columndef (COMMA columndef)* (COMMA tableconstraint)* RPAREN (WITHOUT ROWID)?)
275275
{#createtable = #([CREATETABLE, "CREATETABLE"], #createtable);}
276-
)
277-
|(CREATE VIRTUAL TABLE (IF_T NOT EXISTS)? (tablename | keywordastablename)
278-
USING name (LPAREN (expr (COMMA expr)*)? RPAREN)? // TODO: Not sure about using "expr" here
279-
)
280276
;
281277

282278
keywordascolumnname

src/sql/parser/ParserDriver.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class ParserDriver
2828
int parse(const std::string& s);
2929

3030
// Result returned by the parsing process
31-
sqlb::IndexPtr result;
31+
sqlb::ObjectPtr result;
3232

3333
// The token's location used by the scanner
3434
sqlb::parser::location location;

0 commit comments

Comments
 (0)