}
} else if id_match("BEGIN", identifier) {
let (next_id, rest2) = self.next_id_in_command(rest, eof)?;
+ println!("next_id={next_id:?}");
if id_match("DATA", next_id) {
+ println!("{}:{}", file!(), line!());
let rest2 = skip_spaces_and_comments(rest2, eof)?;
+ println!("{}:{} {rest2:?}", file!(), line!());
let rest2 = if let Some(s) = rest2.strip_prefix('.') {
- skip_spaces(s, eof)?
+ skip_spaces_and_comments(s, eof)?
} else {
rest2
};
+ println!("{}:{}", file!(), line!());
if is_end_of_line(rest2, eof)? {
let s = &input[..input.len() - rest2.len()];
self.state = (
},
Substate::empty(),
);
+ println!("{}:{}", file!(), line!());
return Ok((rest, Type::Identifier));
}
+ println!("{}:{}", file!(), line!());
}
}
}
);
}
- #[test]
+ #[test]
fn test_begin_data() {
- print_segmentation(r#"begin data.
+ print_segmentation(
+ r#"begin data.
end data.
begin data. /*
begin data 123.
not data
+"#,
+ );
+ }
+
+ #[test]
+ fn test_do_repeat() {
+ print_segmentation(r#"do repeat x=a b c
+ y=d e f.
+ do repeat a=1 thru 5.
+another command.
+second command
++ third command.
+end /* x */ /* y */ repeat print.
+end
+ repeat.
+do
+ repeat #a=1.
+ inner command.
+end repeat.
"#);
}