
Michiel Salters wrote:
Even dereferencing *last could be a bug, if it is past-the-end. For iterators referencing contiguous memory (vectors and pointers only, as you've said), one would need to write
scanner.last = scanner.first + std::distance(first, last);
True, but that's an partial fix. For now, I've fixed that bug too in my vector<char> wrapper but it's becoming complex. I'm afraid someone will have to write re2cpp.
It's not a problem of the re2c tool, it's merely a problem of the interfacing code exposing the re2c generated lexer to the library. I'm completely aware of (some of) the related problems, but had no real reason to fix it yet, simply because it worked... (never touch a running system :-). I'll have to investigate this in the near future to clean it up finally.
My current problem is, somewhere deep down in cpp_macromap.hpp a simple innocent if (first != last) statement (line 433) triggers another assertion. These are iterator_facade's (which I don't grok) and end up comparing iterators to two distinct containers. Looking the other way on the callstack, I see some deeply suspect iterators (singular, destroyed, ?)
Since I'm still installing the vc8 on my spare machine here, I'm not able to reproduce it yet. Just give me some additional time. Could you please send me your input files, which lead to the problem you've observed?
Too messy to say what happened.
Very difficult to tell from the distance. Will try to reproduce and fix it asap. Could you get in direct contact with me to sort out the problems? Regards Hartmut