Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IntStream's size's documentation includes EOF but it shouldn't based on implementation #4783

Open
asztrikx opened this issue Mar 2, 2025 · 0 comments

Comments

@asztrikx
Copy link

asztrikx commented Mar 2, 2025

This affects multiple targets but for example in C# target:

IIntstream defines Size in documentation as the length of stream + 1 (EOF):
Returns the total number of symbols in the stream, including a single EOF

However for example BaseInputCharStream defines Size as n

where n is set to input's size only e.g. in AntlrInputStream

this.n = input.Length;

I tested this with the following code:

var input = "test";
var lexer = new ExampleLexer(new AntlrInputStream(input));
var expected = input.Length + 1;
var got = lexer.InputStream.Size; // IIntstream
Trace.Assert(expected == got, $"Expected: {expected}, got: {got}");
	// Expected: 5, got: 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant