News for hackers. Stuff that matters.
Re:Show HN: A Rust macro that parses Java-like syntax and ru... by jD91mZM2 on Friday August 10, 2018 @03:11PM (#17735997)
I gotta say what I really like about macros are that ( and )s are matched. If you say:

  while ($($cond:tt)*) {
You'll actually match both

  while (true) {
and

  while (5 * (2 + 3)) {
. It counts the parenthesis :D
Re:Show HN: A Rust macro that parses Java-like syntax and ru... by kazinator on Friday August 10, 2018 @03:12PM (#17736003)
Even C preprocessor macros count parenthesis.

   MAC((here, have one argument), and then this second one)
Re:Show HN: A Rust macro that parses Java-like syntax and ru... by dan-robertson on Friday August 10, 2018 @03:23PM (#17736072)
But this is a requirement of the “you must be able to parse source code including macros without having to know how to expand macros” rule. Otherwise how would you know how to parse the following:

  foo!((x))
As

  foo! ( { ( x ) } )
Or

  foo! ( { ( x } ) )
With {} representing the argument to the macro.