I can see how the code operates by looking at it and running the unit tests but
i just wanted to make sure that this was intended:
Suppose I have a ReplaceOp to take effect at index 2 to index 4.
And then I wanted to get a stream.toString(3, 5).
Shouldn't my ReplaceOp still kick in since its range covers the "start" of
toString()?
Example:
Here's how the code works today:
CharStream input = new ANTLRStringStream("abcccba");
Interpreter lexEngine = new Interpreter(g, input);
TokenRewriteStream tokens = new TokenRewriteStream(lexEngine);
tokens.LT(1); // fill buffer
tokens.replace(2, 4, "x");
String result = tokens.toString(3,5);
String expecting = "ccb";
assertEquals(expecting, result);
This is what i'm implying it should have worked:
...
tokens.replace(2, 4, "x");
String result = tokens.toString(3,5);
String expecting = "ba";
assertEquals(expecting, result);
Is my expectation reasonable? (note expected "ba" vs. "ccb")
The code skips the ops which have a lower index than the start regardless of
their "to" or lastIndex.
_______________________________________________
antlr-dev mailing list
[email protected]
http://www.antlr.org:8080/mailman/listinfo/antlr-dev