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

Richer Source Positions #232

Merged
merged 2 commits into from
Jul 30, 2022
Merged

Richer Source Positions #232

merged 2 commits into from
Jul 30, 2022

Conversation

Pat-Lafon
Copy link
Contributor

Now that there are a couple of front-end compilers, specifically looking at #227 and #197, I want to tie things together into a nice bow by extending #161 with (optional) richer source position information as discussed in part in #191.

To support something span-like, this pr adds an optional pos_end field to describe the end line/column of the position.

To provide source code for the error message, this pr adds an optional src field which is an absolute path to the original file that this position points to. Note that the src field does not need to be the same across the entire Bril program.

Each is currently described as their own field to be compatible with the original specification, but I would probably like to combine them into one object if that's fine. Something like

{
  ...
  "pos": {
    "pos_start" : {"row": <int>, "col": <int>},
    "pos_end" : {"row": <int>, "col": <int>}?,
    "src" : "<string>"?,
  }
}

@sampsyo
Copy link
Owner

sampsyo commented Jul 30, 2022

Nice!! Pretty rad that this extra information can be done in a clean backwards-compatible way. Looks perfect to me!

@sampsyo sampsyo merged commit 732f63f into sampsyo:main Jul 30, 2022
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.

2 participants