csyonghe / Spire

Other
174 stars 22 forks source link

Fix function-like macros for `TokenList` change. #69

Closed tangent-vector closed 7 years ago

tangent-vector commented 7 years ago

The TokenList change means that we now expect all token sequences to have an extra token "past the end" that represents the end of the stream. This is helpful for reporting good diagnostics.

When I made the change, I neglected to account for the way that we have arguments to function-like macros behave as if they were macros themselves (so that they hold token lists), and we didn't have any tests covering that case. This change puts in a fix.

I then added a test case to make sure that I wouldn't break function-like macro expansion again, and when doing that I noticed that it was actually kind of broken (the closing ) at an invocation site wasn't being consumed). I fixed things up using the new test case.

We should add tests more often!