Skip to content

Commit d309746

Browse files
authored
Applies minor style fixes. (#27)
This applies some very minor changes that I meant to apply as part of #25, but forgot to before merging. Also removes some redundant `#[rstest]` attributes in the tests and makes the spacing in the PEG more consistent around parenthesis.
1 parent c8085bb commit d309746

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

partiql-parser/src/partiql.pest

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ WHITESPACE = _{ " " | "\t" | "\x0B" | "\x0C" | "\r" | "\n" }
22

33
COMMENT = _{ LineComment | BlockComment }
44

5-
BlockComment = { "/*" ~ ( BlockComment | (!"*/" ~ ANY) )* ~ "*/" }
6-
LineComment = { "--" ~ ( !"\n" ~ ANY )* ~ "\n" }
5+
BlockComment = { "/*" ~ (BlockComment | (!"*/" ~ ANY))* ~ "*/" }
6+
LineComment = { "--" ~ (!"\n" ~ ANY )* ~ "\n" }
77

88
// TODO implement a full grammar, this is a very primitive version to start
99
// working with Pest and its APIs.

partiql-parser/src/scanner.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,6 @@ mod test {
407407
" \n ",
408408
]
409409
)]
410-
#[rstest]
411410
#[case::comment_mid_line(
412411
scanner_test_case![
413412
"SELECT" => keyword("SELECT"),
@@ -418,7 +417,6 @@ mod test {
418417
" \n ",
419418
]
420419
)]
421-
#[rstest]
422420
#[case::comment_until_eol(
423421
scanner_test_case![
424422
" -- ",
@@ -431,7 +429,6 @@ mod test {
431429
"SELECT" => keyword("SELECT"),
432430
]
433431
)]
434-
#[rstest]
435432
#[case::comment_block(
436433
scanner_test_case![
437434
" /* ",
@@ -442,7 +439,6 @@ mod test {
442439
"SELECT" => keyword("SELECT"),
443440
]
444441
)]
445-
#[rstest]
446442
#[case::comment_block_nested(
447443
scanner_test_case![
448444
"employee" => identifier("employee"),
@@ -456,7 +452,6 @@ mod test {
456452
"IN" => keyword("IN"),
457453
]
458454
)]
459-
#[rstest]
460455
#[case::single_keyword(
461456
scanner_test_case![
462457
" ",
@@ -590,10 +585,10 @@ mod test {
590585
#[rstest]
591586
#[case::bad_identifier("💩")]
592587
#[case::unterminated_line_comment("-- DROP")]
593-
#[case::unbalanced_block_comment("/*\n\n SELECT /* WHERE */")]
594-
#[case::unbalanced_block_comment("/* CASE do WHEN re THEN mi ELSE fa END /*")]
595-
#[case::unbalanced_block_comment("/*SELECT /* FROM /* FULL OUTER JOIN */ */ ")]
596-
#[case::unbalanced_block_comment("/*/*/*/*/*/*/*/*[ascii art here]*/*/*/*/*/*/*/ ")]
588+
#[case::unbalanced_block_nested("/*\n\n SELECT /* WHERE */")]
589+
#[case::unbalanced_block_end_dangling("/* CASE do WHEN re THEN mi ELSE fa END /*")]
590+
#[case::unbalanced_block_nested_open_two_deep("/*SELECT /* FROM /* FULL OUTER JOIN */ */ ")]
591+
#[case::unbalanced_block_deeply_nested("/*/*/*/*/*/*/*/*[ascii art here]*/*/*/*/*/*/*/ ")]
597592
fn bad_tokens(#[case] input: &str) -> ParserResult<()> {
598593
let expecteds = vec![syntax_error("IGNORED MESSAGE", Position::at(1, 1))];
599594
assert_input(input, expecteds)

0 commit comments

Comments
 (0)