Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,9 @@ jobs:
- name: Cache
uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # pin@v2

- name: Install ripgrep
run: cargo install ripgrep

- name: Test
run: ./s/test

Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/squawk_parser/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ insta.workspace = true
dir-test.workspace = true
camino.workspace = true
pg_query.workspace = true
xshell.workspace = true

[lints]
workspace = true
6 changes: 3 additions & 3 deletions crates/squawk_parser/src/grammar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4163,8 +4163,8 @@ const EXPR_FIRST: TokenSet = LHS_FIRST;
const ATTRIBUTE_FIRST: TokenSet = TokenSet::new(&[POUND, GROUP_KW]);

const TARGET_FOLLOW: TokenSet = TokenSet::new(&[
FROM_KW, WHERE_KW, LIMIT_KW, ORDER_KW, OFFSET_KW, GROUP_KW, HAVING_KW, WINDOW_KW, HAVING_KW,
FETCH_KW, FOR_KW, R_PAREN, R_BRACK,
SELECT_KW, FROM_KW, WHERE_KW, LIMIT_KW, ORDER_KW, OFFSET_KW, GROUP_KW, INTO_KW, HAVING_KW,
WINDOW_KW, HAVING_KW, FETCH_KW, FOR_KW, R_PAREN, R_BRACK,
])
.union(COMPOUND_SELECT_FIRST);

Expand Down Expand Up @@ -4216,7 +4216,7 @@ fn opt_as_col_label(p: &mut Parser<'_>) -> bool {
}

fn opt_target_list(p: &mut Parser) -> Option<CompletedMarker> {
if !p.at_ts(TARGET_LIST_START) || p.at(SELECT_KW) {
if !p.at_ts(TARGET_LIST_START) || p.at_ts(TARGET_FOLLOW) {
return None;
}
let m = p.start();
Expand Down
3 changes: 3 additions & 0 deletions crates/squawk_parser/tests/data/ok/select_funcs.sql
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ select json_array(a absent on null);
select json_array(a absent on null returning foo format json);
select json_array(1, true, json '{"a":null}');
select json_array(1, b, '3' format json, 4);
-- regression test
select json_array(select from t);
select json_array(select into t from u);

-- query_expression
select json_array(select 1);
Expand Down
1 change: 0 additions & 1 deletion crates/squawk_parser/tests/snapshots/.gitignore

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
source: crates/squawk_parser/tests/tests.rs
input_file: crates/squawk_parser/tests/data/regression_suite/alter_generic.sql
---
ERROR@15151: expected R_PAREN
ERROR@15152: expected OPERATOR, or FUNCTION
ERROR@15152: expected SEMICOLON
ERROR@15153: expected command, found IDENT
ERROR@15157: expected command, found R_PAREN
ERROR@21020: expected type name
ERROR@21020: expected R_PAREN
ERROR@21020: expected SEMICOLON
ERROR@21020: expected command, found L_BRACK
ERROR@21021: expected command, found R_BRACK
ERROR@21022: expected command, found COMMA
ERROR@21024: expected command, found IDENT
ERROR@21028: expected command, found R_PAREN
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
---
source: crates/squawk_parser/tests/tests.rs
input_file: crates/squawk_parser/tests/data/regression_suite/alter_table.sql
---
ERROR@12719: expected VALID_KW
ERROR@12719: expected SEMICOLON
ERROR@12720: expected command, found ENFORCED_KW
ERROR@15268: expected R_PAREN
ERROR@15268: expected SEMICOLON
ERROR@15269: expected command, found NOT_KW
ERROR@15273: expected command, found VALID_KW
ERROR@15278: expected command, found R_PAREN
ERROR@33822: expected FOREIGN_KW
ERROR@33822: expected KEY_KW
ERROR@33822: expected column list
ERROR@33822: expected REFERENCES_KW
ERROR@33826: expected SEMICOLON
ERROR@33827: expected command, found NULL_KW
ERROR@33832: expected command, found IDENT
ERROR@33835: expected command, found NOT_KW
ERROR@33839: expected command, found VALID_KW
ERROR@33940: expected FOREIGN_KW
ERROR@33940: expected KEY_KW
ERROR@33940: expected column list
ERROR@33940: expected REFERENCES_KW
ERROR@33944: expected SEMICOLON
ERROR@33945: expected command, found NULL_KW
ERROR@33950: expected command, found IDENT
ERROR@38443: expected L_PAREN
ERROR@38448: expected R_PAREN
ERROR@38448: expected SEMICOLON
ERROR@38449: expected command, found OIDS_KW
ERROR@42440: expected command, found INT_NUMBER
ERROR@42443: expected command, found INT_NUMBER
ERROR@42446: expected command, found INT_NUMBER
ERROR@42495: expected command, found INT_NUMBER
ERROR@42498: expected command, found INT_NUMBER
ERROR@42635: expected command, found INT_NUMBER
ERROR@42638: expected command, found INT_NUMBER
ERROR@43987: expected NULL_KW
ERROR@43987: expected SEMICOLON
ERROR@43988: expected command, found ENFORCED_KW
ERROR@44078: expected NULL_KW
ERROR@44078: expected SEMICOLON
ERROR@44079: expected command, found ENFORCED_KW
ERROR@44088: expected command, found ENFORCED_KW
ERROR@67262: expected type name
ERROR@67262: expected SEMICOLON
ERROR@67262: expected command, found DOT
ERROR@67263: expected command, found IDENT
ERROR@67270: expected command, found INTEGER_KW
ERROR@67278: expected command, found CHECK_KW
ERROR@67284: expected command, found L_PAREN
ERROR@67285: expected command, found VALUE_KW
ERROR@67291: expected command, found R_ANGLE
ERROR@67293: expected command, found INT_NUMBER
ERROR@67294: expected command, found R_PAREN
ERROR@67380: expected R_PAREN
ERROR@67380: expected function option
ERROR@67380: expected SEMICOLON
ERROR@67380: expected command, found DOT
ERROR@67381: expected command, found IDENT
ERROR@67386: expected command, found COMMA
ERROR@67388: expected command, found IDENT
ERROR@67394: expected command, found DOT
ERROR@67395: expected command, found IDENT
ERROR@67400: expected command, found R_PAREN
ERROR@67402: expected command, found RETURNS_KW
ERROR@67410: expected command, found BOOLEAN_KW
ERROR@67418: expected command, found LANGUAGE_KW
ERROR@67427: expected command, found SQL_KW
ERROR@67431: expected command, found AS_KW
ERROR@67434: expected command, found STRING
ERROR@68763: expected R_PAREN
ERROR@68763: expected function option
ERROR@68763: expected SEMICOLON
ERROR@68763: expected command, found DOT
ERROR@68764: expected command, found IDENT
ERROR@68769: expected command, found COMMA
ERROR@68771: expected command, found IDENT
ERROR@68777: expected command, found DOT
ERROR@68778: expected command, found IDENT
ERROR@68783: expected command, found R_PAREN
ERROR@68795: expected EQ
ERROR@71700: expected type name
ERROR@74909: expected FOREIGN_KW
ERROR@74909: expected KEY_KW
ERROR@74909: expected column list
ERROR@74909: expected REFERENCES_KW
ERROR@74913: expected R_PAREN
ERROR@74913: expected SEMICOLON
ERROR@74914: expected command, found NULL_KW
ERROR@74919: expected command, found IDENT
ERROR@74921: expected command, found COMMA
ERROR@74925: expected command, found IDENT
ERROR@74938: expected command, found INT_KW
ERROR@74942: expected command, found CHECK_KW
ERROR@74948: expected command, found L_PAREN
ERROR@74949: expected command, found IDENT
ERROR@74962: expected command, found R_ANGLE
ERROR@74964: expected command, found INT_NUMBER
ERROR@74965: expected command, found R_PAREN
ERROR@74966: expected command, found COMMA
ERROR@74970: expected command, found IDENT
ERROR@74982: expected command, found INT_KW
ERROR@74985: expected command, found COMMA
ERROR@74989: expected command, found CONSTRAINT_KW
ERROR@75000: expected command, found IDENT
ERROR@75016: expected command, found PRIMARY_KW
ERROR@75024: expected command, found KEY_KW
ERROR@75028: expected command, found L_PAREN
ERROR@75029: expected command, found IDENT
ERROR@75031: expected command, found R_PAREN
ERROR@75032: expected command, found R_PAREN
ERROR@86438: expected name
ERROR@86438: expected type name
ERROR@86447: expected SEMICOLON
ERROR@86448: expected command, found IDENT
ERROR@91452: expected R_PAREN
ERROR@91452: expected SEMICOLON
ERROR@91453: expected command, found NO_KW
ERROR@91456: expected command, found INHERIT_KW
ERROR@91463: expected command, found COMMA
ERROR@91466: expected command, found IDENT
ERROR@91468: expected command, found CHAR_KW
ERROR@91472: expected command, found L_PAREN
ERROR@91473: expected command, found INT_NUMBER
ERROR@91474: expected command, found R_PAREN
ERROR@91476: expected command, found COLLATE_KW
ERROR@91484: expected command, found IDENT
ERROR@91487: expected command, found COMMA
ERROR@91490: expected command, found CONSTRAINT_KW
ERROR@91501: expected command, found IDENT
ERROR@91509: expected command, found CHECK_KW
ERROR@91515: expected command, found L_PAREN
ERROR@91516: expected command, found IDENT
ERROR@91518: expected command, found R_ANGLE
ERROR@91520: expected command, found INT_NUMBER
ERROR@91521: expected command, found R_PAREN
ERROR@91523: expected command, found R_PAREN
Loading
Loading