Skip to content

Commit

Permalink
Add multi-line comment support to parser
Browse files Browse the repository at this point in the history
Copied this straight from Pest itself so must be right 😅
https://github.com/pest-parser/pest/pull/332/files

Fixes rtyler#58
  • Loading branch information
nakulpathak3 committed Dec 12, 2020
1 parent 9011cc0 commit 0421bf7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
14 changes: 14 additions & 0 deletions Ottofile
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/* 1-line multiline comment */

/*
N-line multiline comment
*/

/*
// Line comment inside multiline
/*
(Multiline inside) multiline
*/

*/

pipeline {
steps {
Expand Down
3 changes: 2 additions & 1 deletion crates/parser/src/pipeline.pest
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,5 @@ STRV = @{ "''" | (!"'" ~ ANY)* }
COMMA = @{ "," }

WHITESPACE = _{ (" " | NEWLINE) }
COMMENT = _{ "//" ~ (!NEWLINE ~ ANY)* }
BLOCK_COMMENT = _{ "/*" ~ (BLOCK_COMMENT | !"*/" ~ ANY)* ~ "*/" }
COMMENT = _{ BLOCK_COMMENT | ("//" ~ (!NEWLINE ~ ANY)*) }

0 comments on commit 0421bf7

Please sign in to comment.