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

Track location in pre-processed file, as well references to source. #866

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

yav
Copy link
Collaborator

@yav yav commented Feb 12, 2025

This is the first step of solving #823.

We introduce a new module Cerb_location.position, which defines a type replacing Lexing.position as the base type to use for positions. Values of the new position type keep the Lexing.position corresponding to the actual location in the preprocessed file, as well as the file name and line in the original source associated with the location.

We do this by introducing a new module `Cerb_location.position`, which
replaces `Lexing.position` as the base type to use for positions.
Values of the new position type keepl the `Lexing.position`
corresponding to the actual location in the preprocessed file,
as well as the file name and line in the original source assocaited with
the location.
@yav
Copy link
Collaborator Author

yav commented Feb 12, 2025

@kmemarian @cp526 this PR contains the changes to the lexer and parser to keep track of both the position in the pre-processed file, and also the position in the original source. Please have a look and let me know what you think.

At the moment the position in the actual file is not really used, but the next step would be to modify the injection code
to use to inject code in the pre-processed file.

yav added 3 commits February 12, 2025 15:39
* Add a way to ask for cartesian location in pre-processed or user visible file
* Add a way to save the pre-processed file, if needed
* Add code paths to optionally inject using either cartesian coordinates.
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

Successfully merging this pull request may close these issues.

1 participant