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
1 change: 1 addition & 0 deletions crates/plotnik-lib/src/parser/cst.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ pub enum SyntaxKind {
Newline,

#[regex(r"//[^\n]*", allow_greedy = true)]
#[regex(r";[^\n]*", allow_greedy = true)]
LineComment,

#[regex(r"/\*(?:[^*]|\*[^/])*\*/")]
Expand Down
26 changes: 26 additions & 0 deletions crates/plotnik-lib/src/parser/tests/grammar/trivia_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
"#);
}