diff --git a/crates/plotnik-lib/src/parser/cst.rs b/crates/plotnik-lib/src/parser/cst.rs index 0f5f6c80..e6cb307b 100644 --- a/crates/plotnik-lib/src/parser/cst.rs +++ b/crates/plotnik-lib/src/parser/cst.rs @@ -119,6 +119,7 @@ pub enum SyntaxKind { Newline, #[regex(r"//[^\n]*", allow_greedy = true)] + #[regex(r";[^\n]*", allow_greedy = true)] LineComment, #[regex(r"/\*(?:[^*]|\*[^/])*\*/")] diff --git a/crates/plotnik-lib/src/parser/tests/grammar/trivia_tests.rs b/crates/plotnik-lib/src/parser/tests/grammar/trivia_tests.rs index b3a773f0..18b6a8ea 100644 --- a/crates/plotnik-lib/src/parser/tests/grammar/trivia_tests.rs +++ b/crates/plotnik-lib/src/parser/tests/grammar/trivia_tests.rs @@ -182,3 +182,29 @@ fn comment_only_raw() { Newline "\n" "#); } + +#[test] +fn semicolon_comment() { + let input = indoc! {r#" + ; semicolon comment + Q = (identifier) + "#}; + + let res = Query::expect_valid_cst_full(input); + + insta::assert_snapshot!(res, @r#" + Root + LineComment "; semicolon comment" + Newline "\n" + Def + Id "Q" + Whitespace " " + Equals "=" + Whitespace " " + Tree + ParenOpen "(" + Id "identifier" + ParenClose ")" + Newline "\n" + "#); +}