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

Tested against
```
/* 1-line multiline comment */

/*
  N-line multiline comment
*/

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

*/
```

Testing steps -
* `cargo build`
* `make run`
* `scripts/local-run` with above inputs

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

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 36c2c4c

Please sign in to comment.