Add multi-line comment support to parser

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 #57
This commit is contained in:
Nakul Pathak 2020-12-12 00:47:30 -05:00
parent 9011cc0c30
commit 86b7f7d6f4
2 changed files with 5 additions and 1 deletions

View File

@ -1,3 +1,6 @@
/*
Example Ottofile
*/
pipeline {
steps {

View File

@ -44,4 +44,5 @@ STRV = @{ "''" | (!"'" ~ ANY)* }
COMMA = @{ "," }
WHITESPACE = _{ (" " | NEWLINE) }
COMMENT = _{ "//" ~ (!NEWLINE ~ ANY)* }
BLOCK_COMMENT = _{ "/*" ~ (BLOCK_COMMENT | !"*/" ~ ANY)* ~ "*/" }
COMMENT = _{ BLOCK_COMMENT | ("//" ~ (!NEWLINE ~ ANY)*) }