forked from Orchid/orchid
redid the parser, patched up the project too.
This commit is contained in:
13
src/parse/comment.rs
Normal file
13
src/parse/comment.rs
Normal file
@@ -0,0 +1,13 @@
|
||||
pub use chumsky::{self, prelude::*, Parser};
|
||||
|
||||
/// Parses Lua-style comments
|
||||
pub fn comment_parser() -> impl Parser<char, String, Error = Simple<char>> {
|
||||
choice((
|
||||
just("--[").ignore_then(take_until(
|
||||
just("]--").ignored()
|
||||
)),
|
||||
just("--").ignore_then(take_until(
|
||||
just("\n").rewind().ignored().or(end())
|
||||
))
|
||||
)).map(|(vc, ())| vc).collect().labelled("comment")
|
||||
}
|
||||
Reference in New Issue
Block a user