]> git.lizzy.rs Git - rust.git/commit
Add Span and separate open/close delims to TTDelim
authorBrendan Zabarauskas <bjzaba@yahoo.com.au>
Wed, 22 Oct 2014 05:37:20 +0000 (16:37 +1100)
committerBrendan Zabarauskas <bjzaba@yahoo.com.au>
Sat, 25 Oct 2014 22:53:29 +0000 (09:53 +1100)
commit971d776aa5a678672eb3d37f2f507664aacd2440
tree050e68a9c76a8bf969778396b42c44060671c241
parent80e5fe1a56bb95e8e89d5f8f0ff5122583bb5336
Add Span and separate open/close delims to TTDelim

This came up when working [on the gl-rs generator extension](https://github.com/bjz/gl-rs/blob/990383de801bd2e233159d5be07c9b5622827620/src/gl_generator/lib.rs#L135-L146).

The new definition of  `TTDelim` adds an associated `Span` that covers the whole token tree and enforces the invariant that a delimited sequence of token trees must have an opening and closing delimiter.

A `get_span` method has also been added to `TokenTree` type to make it easier to implement better error messages for syntax extensions.
src/libsyntax/ast.rs
src/libsyntax/ext/log_syntax.rs
src/libsyntax/ext/quote.rs
src/libsyntax/ext/tt/macro_rules.rs
src/libsyntax/ext/tt/transcribe.rs
src/libsyntax/fold.rs
src/libsyntax/parse/mod.rs
src/libsyntax/parse/parser.rs
src/libsyntax/print/pprust.rs