Skip to content

Commit 05d1b73

Browse files
authored
parser: fix more pg test suite errors part 3 (#522)
unnamed function path types now work correctly when they're not named
1 parent cef200a commit 05d1b73

File tree

69 files changed

+789
-2297
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+789
-2297
lines changed

crates/squawk_lexer/src/lib.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@ impl Cursor<'_> {
389389
}
390390
}
391391

392+
// we have a dollar quoted string deliminated with `$$`
392393
if start.is_empty() {
393394
loop {
394395
self.eat_while(|c| c != '$');
@@ -428,9 +429,9 @@ impl Cursor<'_> {
428429
}
429430

430431
// closing '$'
431-
if self.first() == '$' {
432+
let terminated = match_count == start.len();
433+
if self.first() == '$' && terminated {
432434
self.bump();
433-
let terminated = match_count == start.len();
434435
return TokenKind::Literal {
435436
kind: LiteralKind::DollarQuotedString { terminated },
436437
};
@@ -586,6 +587,14 @@ $foo$hello$world$bar$
586587
"#))
587588
}
588589

590+
#[test]
591+
fn dollar_strings_part2() {
592+
assert_debug_snapshot!(lex(r#"
593+
DO $doblock$
594+
end
595+
$doblock$;"#))
596+
}
597+
589598
#[test]
590599
fn dollar_quote_mismatch_tags_simple() {
591600
assert_debug_snapshot!(lex(r#"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
source: crates/squawk_lexer/src/lib.rs
3+
expression: "lex(r#\"\nDO $doblock$\nend\n$doblock$;\"#)"
4+
---
5+
[
6+
"\n" @ Whitespace,
7+
"DO" @ Ident,
8+
" " @ Whitespace,
9+
"$doblock$\nend\n$doblock$" @ Literal { kind: DollarQuotedString { terminated: true } },
10+
";" @ Semi,
11+
]

crates/squawk_parser/src/generated/syntax_kind.rs

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)