On Wednesday, August 01, 2012 21:54:01 Jonathan M Davis wrote: > On Wednesday, August 01, 2012 21:47:22 Walter Bright wrote: > > > Couldn't that just be part of the range type? A separate lexer type > > > shouldn't be necessary. > > > > No, because the user may want to serially present ranges to the same lexer > > type. Why do that, you might say? That's how dmd works - it means the > > identifier table will be the same for all source files. > > Then just pass the same identifier table to the function which creates the > token range. That doesn't require another type.
If you end up with enough pieces of state that you need to carry around between files/strings being lexed, then creating another object makes sense, but I would hope that the amount of global state like that would be minimal. - Jonathan M Davis