Allow , to delimit macro 2.0 rules

This commit is contained in:
Jonas Schievink 2021-04-03 03:08:31 +02:00
parent eb264fb819
commit eaffdae300
3 changed files with 30 additions and 2 deletions

View file

@ -220,9 +220,11 @@ impl MacroDef {
while src.len() > 0 {
let rule = Rule::parse(&mut src, true)?;
rules.push(rule);
if let Err(()) = src.expect_char(';') {
if let Err(()) = src.expect_any_char(&[';', ',']) {
if src.len() > 0 {
return Err(ParseError::Expected("expected `;`".to_string()));
return Err(ParseError::Expected(
"expected `;` or `,` to delimit rules".to_string(),
));
}
break;
}