Skip to content

Commit

Permalink
Merge pull request #58 from gwenn/sync
Browse files Browse the repository at this point in the history
Merge changes from SQLite official repository
  • Loading branch information
gwenn committed Jul 20, 2024
2 parents 69c67e1 + 76e6391 commit dfc680c
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 127 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

[LEMON parser generator](https://www.sqlite.org/src/doc/trunk/doc/lemon.html) modified to generate Rust code.

Lemon source and SQLite3 grammar were last synced as of November 2023.
Lemon source and SQLite3 grammar were last synced as of July 2024.

## Unsupported

Expand Down
243 changes: 122 additions & 121 deletions src/dialect/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,125 +55,126 @@ pub enum TokenType {
TK_OR = 43,
TK_AND = 44,
TK_IS = 45,
TK_MATCH = 46,
TK_LIKE_KW = 47,
TK_BETWEEN = 48,
TK_IN = 49,
TK_ISNULL = 50,
TK_NOTNULL = 51,
TK_NE = 52,
TK_EQ = 53,
TK_GT = 54,
TK_LE = 55,
TK_LT = 56,
TK_GE = 57,
TK_ESCAPE = 58,
TK_ID = 59,
TK_COLUMNKW = 60,
TK_DO = 61,
TK_FOR = 62,
TK_IGNORE = 63,
TK_INITIALLY = 64,
TK_INSTEAD = 65,
TK_NO = 66,
TK_KEY = 67,
TK_OF = 68,
TK_OFFSET = 69,
TK_PRAGMA = 70,
TK_RAISE = 71,
TK_RECURSIVE = 72,
TK_REPLACE = 73,
TK_RESTRICT = 74,
TK_ROW = 75,
TK_ROWS = 76,
TK_TRIGGER = 77,
TK_VACUUM = 78,
TK_VIEW = 79,
TK_VIRTUAL = 80,
TK_WITH = 81,
TK_NULLS = 82,
TK_FIRST = 83,
TK_LAST = 84,
TK_CURRENT = 85,
TK_FOLLOWING = 86,
TK_PARTITION = 87,
TK_PRECEDING = 88,
TK_RANGE = 89,
TK_UNBOUNDED = 90,
TK_EXCLUDE = 91,
TK_GROUPS = 92,
TK_OTHERS = 93,
TK_TIES = 94,
TK_GENERATED = 95,
TK_ALWAYS = 96,
TK_MATERIALIZED = 97,
TK_REINDEX = 98,
TK_RENAME = 99,
TK_CTIME_KW = 100,
TK_ANY = 101,
TK_BITAND = 102,
TK_BITOR = 103,
TK_LSHIFT = 104,
TK_RSHIFT = 105,
TK_PLUS = 106,
TK_MINUS = 107,
TK_STAR = 108,
TK_SLASH = 109,
TK_REM = 110,
TK_CONCAT = 111,
TK_PTR = 112,
TK_COLLATE = 113,
TK_BITNOT = 114,
TK_ON = 115,
TK_INDEXED = 116,
TK_STRING = 117,
TK_JOIN_KW = 118,
TK_CONSTRAINT = 119,
TK_DEFAULT = 120,
TK_NULL = 121,
TK_PRIMARY = 122,
TK_UNIQUE = 123,
TK_CHECK = 124,
TK_REFERENCES = 125,
TK_AUTOINCR = 126,
TK_INSERT = 127,
TK_DELETE = 128,
TK_UPDATE = 129,
TK_SET = 130,
TK_DEFERRABLE = 131,
TK_FOREIGN = 132,
TK_DROP = 133,
TK_UNION = 134,
TK_ALL = 135,
TK_EXCEPT = 136,
TK_INTERSECT = 137,
TK_SELECT = 138,
TK_VALUES = 139,
TK_DISTINCT = 140,
TK_DOT = 141,
TK_FROM = 142,
TK_JOIN = 143,
TK_USING = 144,
TK_ORDER = 145,
TK_GROUP = 146,
TK_HAVING = 147,
TK_LIMIT = 148,
TK_WHERE = 149,
TK_RETURNING = 150,
TK_INTO = 151,
TK_NOTHING = 152,
TK_BLOB = 153,
TK_FLOAT = 154,
TK_INTEGER = 155,
TK_VARIABLE = 156,
TK_CASE = 157,
TK_WHEN = 158,
TK_THEN = 159,
TK_ELSE = 160,
TK_INDEX = 161,
TK_ALTER = 162,
TK_ADD = 163,
TK_WINDOW = 164,
TK_OVER = 165,
TK_FILTER = 166,
TK_ISNOT = 46,
TK_MATCH = 47,
TK_LIKE_KW = 48,
TK_BETWEEN = 49,
TK_IN = 50,
TK_ISNULL = 51,
TK_NOTNULL = 52,
TK_NE = 53,
TK_EQ = 54,
TK_GT = 55,
TK_LE = 56,
TK_LT = 57,
TK_GE = 58,
TK_ESCAPE = 59,
TK_ID = 60,
TK_COLUMNKW = 61,
TK_DO = 62,
TK_FOR = 63,
TK_IGNORE = 64,
TK_INITIALLY = 65,
TK_INSTEAD = 66,
TK_NO = 67,
TK_KEY = 68,
TK_OF = 69,
TK_OFFSET = 70,
TK_PRAGMA = 71,
TK_RAISE = 72,
TK_RECURSIVE = 73,
TK_REPLACE = 74,
TK_RESTRICT = 75,
TK_ROW = 76,
TK_ROWS = 77,
TK_TRIGGER = 78,
TK_VACUUM = 79,
TK_VIEW = 80,
TK_VIRTUAL = 81,
TK_WITH = 82,
TK_NULLS = 83,
TK_FIRST = 84,
TK_LAST = 85,
TK_CURRENT = 86,
TK_FOLLOWING = 87,
TK_PARTITION = 88,
TK_PRECEDING = 89,
TK_RANGE = 90,
TK_UNBOUNDED = 91,
TK_EXCLUDE = 92,
TK_GROUPS = 93,
TK_OTHERS = 94,
TK_TIES = 95,
TK_GENERATED = 96,
TK_ALWAYS = 97,
TK_MATERIALIZED = 98,
TK_REINDEX = 99,
TK_RENAME = 100,
TK_CTIME_KW = 101,
TK_ANY = 102,
TK_BITAND = 103,
TK_BITOR = 104,
TK_LSHIFT = 105,
TK_RSHIFT = 106,
TK_PLUS = 107,
TK_MINUS = 108,
TK_STAR = 109,
TK_SLASH = 110,
TK_REM = 111,
TK_CONCAT = 112,
TK_PTR = 113,
TK_COLLATE = 114,
TK_BITNOT = 115,
TK_ON = 116,
TK_INDEXED = 117,
TK_STRING = 118,
TK_JOIN_KW = 119,
TK_CONSTRAINT = 120,
TK_DEFAULT = 121,
TK_NULL = 122,
TK_PRIMARY = 123,
TK_UNIQUE = 124,
TK_CHECK = 125,
TK_REFERENCES = 126,
TK_AUTOINCR = 127,
TK_INSERT = 128,
TK_DELETE = 129,
TK_UPDATE = 130,
TK_SET = 131,
TK_DEFERRABLE = 132,
TK_FOREIGN = 133,
TK_DROP = 134,
TK_UNION = 135,
TK_ALL = 136,
TK_EXCEPT = 137,
TK_INTERSECT = 138,
TK_SELECT = 139,
TK_VALUES = 140,
TK_DISTINCT = 141,
TK_DOT = 142,
TK_FROM = 143,
TK_JOIN = 144,
TK_USING = 145,
TK_ORDER = 146,
TK_GROUP = 147,
TK_HAVING = 148,
TK_LIMIT = 149,
TK_WHERE = 150,
TK_RETURNING = 151,
TK_INTO = 152,
TK_NOTHING = 153,
TK_BLOB = 154,
TK_FLOAT = 155,
TK_INTEGER = 156,
TK_VARIABLE = 157,
TK_CASE = 158,
TK_WHEN = 159,
TK_THEN = 160,
TK_ELSE = 161,
TK_INDEX = 162,
TK_ALTER = 163,
TK_ADD = 164,
TK_WINDOW = 165,
TK_OVER = 166,
TK_FILTER = 167,
}
2 changes: 1 addition & 1 deletion src/parser/ast/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ pub enum Expr {
/// Qualified name
Qualified(Name, Name),
/// `RAISE` function call
Raise(ResolveType, Option<Name>),
Raise(ResolveType, Option<Box<Expr>>),
/// Subquery expression
Subquery(Box<Select>),
/// Unary expression
Expand Down
10 changes: 6 additions & 4 deletions src/parser/parse.y
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,13 @@ columnname(A) ::= nm(X) typetoken(Y). {A = (X, Y);}
// improve performance and reduce the executable size. The goal here is
// to get the "jump" operations in ISNULL through ESCAPE to have numeric
// values that are early enough so that all jump operations are clustered
// at the beginning.
// at the beginning. Also, operators like NE and EQ need to be adjacent,
// and all of the comparison operators need to be clustered together.
// Various assert() statements throughout the code enforce these restrictions.
//
%token ABORT ACTION AFTER ANALYZE ASC ATTACH BEFORE BEGIN BY CASCADE CAST.
%token CONFLICT DATABASE DEFERRED DESC DETACH EACH END EXCLUSIVE EXPLAIN FAIL.
%token OR AND NOT IS MATCH LIKE_KW BETWEEN IN ISNULL NOTNULL NE EQ.
%token OR AND NOT IS ISNOT MATCH LIKE_KW BETWEEN IN ISNULL NOTNULL NE EQ.
%token GT LE LT GE ESCAPE.

// The following directive causes tokens ABORT, AFTER, ASC, etc. to
Expand Down Expand Up @@ -1260,8 +1262,8 @@ trigger_cmd(A) ::= select(X).
expr(A) ::= RAISE LP IGNORE RP. {
A = Expr::Raise(ResolveType::Ignore, None);
}
expr(A) ::= RAISE LP raisetype(T) COMMA nm(Z) RP. {
A = Expr::Raise(T, Some(Z));
expr(A) ::= RAISE LP raisetype(T) COMMA expr(Z) RP. {
A = Expr::Raise(T, Some(Box::new(Z)));
}
%endif !SQLITE_OMIT_TRIGGER

Expand Down

0 comments on commit dfc680c

Please sign in to comment.