mirror of
https://github.com/fluencelabs/aquavm
synced 2024-12-04 23:20:18 +00:00
Comments: ignore everything after a semicolon (#30)
This commit is contained in:
parent
c2d81749fe
commit
dde12e2a40
@ -87,6 +87,10 @@ match {
|
||||
"xor",
|
||||
"fold",
|
||||
"next",
|
||||
// ignore patterns
|
||||
// see: https://lalrpop.github.io/lalrpop/lexer_tutorial/001_lexer_gen.html#customizing-skipping-between-tokens
|
||||
r"\s*" => { }, // The default whitespace skipping is disabled if an `ignore pattern` is specified
|
||||
r";[^\n\r]*[\n\r]*" => { }, // Skip `; comments`
|
||||
} else {
|
||||
_
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
@ -403,7 +403,28 @@ fn no_output() {
|
||||
#[test]
|
||||
fn fold_json_path() {
|
||||
let source_code = r#"
|
||||
(fold members.$.["users"] m (null))
|
||||
; comment
|
||||
(fold members.$.["users"] m (null)) ;;; comment
|
||||
;;; comment
|
||||
"#;
|
||||
let instruction = parse(&source_code.as_ref());
|
||||
let expected = Instruction::Fold(Fold {
|
||||
iterable: JsonPath {
|
||||
variable: "members",
|
||||
path: "$.[\"users\"]",
|
||||
},
|
||||
iterator: "m",
|
||||
instruction: Rc::new(null()),
|
||||
});
|
||||
assert_eq!(instruction, expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn comments() {
|
||||
let source_code = r#"
|
||||
; comment
|
||||
(fold members.$.["users"] m (null)) ;;; comment ;;?()()
|
||||
;;; comme;?!.$. nt[][][][()()()null;$::!
|
||||
"#;
|
||||
let instruction = parse(&source_code.as_ref());
|
||||
let expected = Instruction::Fold(Fold {
|
||||
|
Loading…
Reference in New Issue
Block a user