I have such a macro:
macro_rules! expect_token (
([$($token:matchers, $result:expr)|+] <= $tokens:ident, $parsed_tokens:ident, $error:expr) => (
match $tokens.pop() {
$(
Some($token) => {
$parsed_tokens.push($token);
$result
},
)+
None => {
$parsed_tokens.reverse();
$tokens.extend($parsed_tokens.into_iter());
return NotComplete;
},
_ => return error(expr)
}
);
)
when I call it with expect_token!([Ident(name), name] <= tokens, parsed_tokens, "expected function name in prototype"); I get the error "error: expected open delimiter".
What does this error mean and what I am doing wrong?
P.S. If you are wondering what is the definition of identifiers like NotComplete, you can look at https://github.com/jauhien/iron-kaleidoscope/blob/master/src/parser.rs, but it is not relevant for this question as far as I understand, as the problem is not with the macro body, but with its invocation.
log_syntax!and/ortrace_macros!(true)? - errordevelopertrace_macros!(true)gives no additional information: expect_token! { [ Ident ( name ) , name ] <= tokens , parsed_tokens , "expected function name in prototype" } /home/jauhien/work/rust/iron-repl/iron-repl/src/parser.rs:167:31: 167:36 error: expected open delimiter /home/jauhien/work/rust/iron-repl/iron-repl/src/parser.rs:167 let name = expect_token!([Ident(name), name] <= tokens, parsed_tokens, "expected function name in prototype"); Regarding log_syntax!, I have not found how to properly use it. - Jaŭhien Piatlicki