diff options
| author | Michael Howell <michael@notriddle.com> | 2019-05-28 14:42:59 -0700 | 
|---|---|---|
| committer | Michael Howell <michael@notriddle.com> | 2019-05-28 14:42:59 -0700 | 
| commit | f41f2197456be87c7c63582dbeee4667bfae35e8 (patch) | |
| tree | 4ec4b3c7c7d3b696317d737a8d83dd320a8fa011 | |
| parent | 3f44cece3931baccea9835b08bd5ad11aa59dab0 (diff) | |
| download | mrust-f41f2197456be87c7c63582dbeee4667bfae35e8.tar.gz | |
Allow square brackets in macro definitions
Fixes #103
| -rw-r--r-- | samples/test/issue-mrustc-103.rs | 9 | ||||
| -rw-r--r-- | src/macro_rules/parse.cpp | 1 | 
2 files changed, 10 insertions, 0 deletions
| diff --git a/samples/test/issue-mrustc-103.rs b/samples/test/issue-mrustc-103.rs new file mode 100644 index 00000000..f27fe6de --- /dev/null +++ b/samples/test/issue-mrustc-103.rs @@ -0,0 +1,9 @@ +macro_rules! pat { +  [$a:expr;$b:expr] => ( +    println!("{} {}", $a, $b); +  ) +} +fn main() { +        pat![4;5]; +} + diff --git a/src/macro_rules/parse.cpp b/src/macro_rules/parse.cpp index b3b1014e..0cc7b3a8 100644 --- a/src/macro_rules/parse.cpp +++ b/src/macro_rules/parse.cpp @@ -254,6 +254,7 @@ MacroRule Parse_MacroRules_Var(TokenStream& lex)      {      case TOK_BRACE_OPEN:    close = TOK_BRACE_CLOSE;    break;      case TOK_PAREN_OPEN:    close = TOK_PAREN_CLOSE;    break; +    case TOK_SQUARE_OPEN:   close = TOK_SQUARE_CLOSE;   break;      default:          throw ParseError::Unexpected(lex, tok);      } | 
