-
Notifications
You must be signed in to change notification settings - Fork 95
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
Why sourcePos has line and column, but no token number? #17
Comments
Reading your request literally: Currently the For example the built-in character parsers, all of them are built on top of Digging a bit deeper: It looks like you actually want to track the tokens consumed, not necessarily the characters consumed. This would be different from the reported source position when we're parsing a stream of some other token type which has embedded location information in the token itself - the expectation is that the primitive parsers for the token-type will lift the token source positions into the A token-count would live in a new field in |
Yes, indeed, your deeper reading is what I was going for – a token count of number of tokens consumed. Perhaps So, it sounds like there is no fundamental reason this doesn't exist – more like one of lack of need perhaps or lack of effort to do it. Thanks! I do not think that I will be implementing this – as I have not personally needed this and do not think it is a good idea to implement features "just in case someone someday" needs them someday... So you can probably go ahead and close the issue – thanks for the clarification. |
Okay! I'm not opposed to this sort of thing, but I'll close the issue until someone wants to push for it. |
The
SourcePos
data structure seems to expose line number and column number, which is great for error messages, but it'd be really nice to also have the character number in the file. This would enable things like the combinator discussed here.Is there a reason this doesn't exist? Would it be hard to add? Is there a better way to write that combinator?
The text was updated successfully, but these errors were encountered: