mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-05 23:33:07 +00:00
Merge pull request #728 from mir-protocol/fix_prohibited_macro_names
Fix prohibited macro names
This commit is contained in:
commit
3da80fffe0
@ -512,6 +512,12 @@ mod tests {
|
||||
assert_eq!(kernel.code, vec![push1, 42, push1, 42]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn macro_with_reserved_prefix() {
|
||||
// The name `repeat` should be allowed, even though `rep` is reserved.
|
||||
parse_and_assemble(&["%macro repeat %endmacro", "%repeat"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic]
|
||||
fn macro_with_wrong_vars() {
|
||||
|
||||
@ -17,7 +17,7 @@ constant = ${ "@" ~ identifier }
|
||||
|
||||
item = { macro_def | macro_call | repeat | stack | global_label_decl | local_label_decl | macro_label_decl | bytes_item | push_instruction | prover_input_instruction | nullary_instruction }
|
||||
macro_def = { ^"%macro" ~ identifier ~ paramlist? ~ item* ~ ^"%endmacro" }
|
||||
macro_call = ${ "%" ~ !(^"macro" | ^"endmacro" | ^"rep" | ^"endrep" | ^"stack") ~ identifier ~ macro_arglist? }
|
||||
macro_call = ${ "%" ~ !((^"macro" | ^"endmacro" | ^"rep" | ^"endrep" | ^"stack") ~ !identifier_char) ~ identifier ~ macro_arglist? }
|
||||
repeat = { ^"%rep" ~ literal ~ item* ~ ^"%endrep" }
|
||||
paramlist = { "(" ~ identifier ~ ("," ~ identifier)* ~ ")" }
|
||||
macro_arglist = !{ "(" ~ push_target ~ ("," ~ push_target)* ~ ")" }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user