1 // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // Tests the behavior of various Kleene operators in macros with respect to `?` terminals. In
12 // particular, `?` in the position of a separator and of a Kleene operator is tested.
14 #![feature(macro_at_most_once_rep)]
16 // should match `` and `a`
22 ($(a),?) => {} //~ ERROR `?` macro repetition does not allow a separator
25 // should match `+` and `a+`
26 macro_rules! barplus {
30 // should match `*` and `a*`
31 macro_rules! barstar {
36 foo!(a?a?a); //~ ERROR no rules expected the token `?`
37 foo!(a?a); //~ ERROR no rules expected the token `?`
38 foo!(a?); //~ ERROR no rules expected the token `?`
39 barplus!(); //~ ERROR unexpected end of macro invocation
40 barstar!(); //~ ERROR unexpected end of macro invocation
41 barplus!(a?); //~ ERROR no rules expected the token `?`
42 barplus!(a); //~ ERROR unexpected end of macro invocation
43 barstar!(a?); //~ ERROR no rules expected the token `?`
44 barstar!(a); //~ ERROR unexpected end of macro invocation