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

Store tokens' position range instead of just start position #461

Open
aabounegm opened this issue Sep 29, 2023 · 0 comments · May be fixed by #463
Open

Store tokens' position range instead of just start position #461

aabounegm opened this issue Sep 29, 2023 · 0 comments · May be fixed by #463
Labels
enhancement position Concerning position information in parsed AST

Comments

@aabounegm
Copy link

BNFC currently generates position information (BNFC'Position) for the parsed tokens, but it would also be great if the range information (begin position, end position) was also provided. This would help identify which part of the AST the cursor is currently at (useful for language servers in particular).

In other words, I am suggesting that instead of the current definition:

-- | Start position (line, column) of something.
type BNFC'Position = C.Maybe (C.Int, C.Int)

we instead (or in addition) have

-- | Start and end positions ((start line, start column), (end line, end column)) of something.
type BNFC'PositionRange = C.Maybe ((C.Int, C.Int), (C.Int, C.Int))
@andreasabel andreasabel added enhancement position Concerning position information in parsed AST labels Sep 30, 2023
@aabounegm aabounegm linked a pull request Oct 25, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement position Concerning position information in parsed AST
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants