Skip to content

[oslcomp] Reworked source location to include column numbers #2006

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lucafascione
Copy link

Description

Touched up lexer and parser so that for each AST node created the start/end line and columns are recorded.
A new object called SrcLoc has been introduced that records the filename together with these 4 numbers,
and the code has been updated to make direct use of this new entity.

Diagnostics from the compiler are now followed by a print out of where the error occurred, and a "squiggle underline"
pointing at the diagnosed offender.

Defect: at the moment, the print out uses before-preprocessing code, while the lexer can only track locations after preprocessing. This means that if macros are involved that alter the spacing, the squiggles will be in the wrong place.
Until we get a preprocessing frontend that tells us about the pre-substitution locations, this cannot be fixed.

Tests

No new tests have been added

Checklist:

  • I have read the contribution guidelines.
  • I have updated the documentation, if applicable.
  • I have ensured that the change is tested somewhere in the testsuite (adding new test cases if necessary).
  • My code follows the prevailing code style of this project. If I haven't
    already run clang-format v17 before submitting, I definitely will look at
    the CI test that runs clang-format and fix anything that it highlights as
    being nonconforming.

and track begin/end pairs. Introduce OSL::pvt::SrcLoc to track this and
percolate throughout the source

Signed-off-by: Luca Fascione <[email protected]>
@lucafascione lucafascione force-pushed the sourceloc_with_columns branch from 6387fce to 958f162 Compare July 22, 2025 10:24
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