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

Assign location to tokens #150

Merged
merged 4 commits into from
Jan 1, 2024
Merged

Conversation

kant2002
Copy link
Collaborator

  • That allow implement parsers which indirectly span across multiple files, like C/C++

Related: #34 (comment)

- That allow implement parsers which indirectly span across multiple files, like C/C++

Related: LanguageDev#34 (comment)
@kant2002
Copy link
Collaborator Author

This PR can be considered draft in a sense that it has flaws and require discussion. Also tired.

  • SourceFile as abstraction too much tied to TextReader. Lexers need direct access to TextReader, but SourceFile diagnostics machinery require buffered access where precalculated lines. Possble highligt issue in SourceFile implementation
  • I have to reimplement Equals and GetHashCode for Token. That also hints on too much coupling between concepts.

Would like to start talking about directions.

@kant2002
Copy link
Collaborator Author

Also I did not attempt to make API without breaking changes. Have to know opinion on the matter, and is breaking changes possible

@kant2002
Copy link
Collaborator Author

kant2002 commented Sep 3, 2022

I come to conclusion that features of SourceFile which trigger inconsistent behaviour is overkill. Would be good if SourceFile would no longer be derived from TextWriter, and for backward compatibility there either other class with similar functionality, or make breaking change.

@kant2002
Copy link
Collaborator Author

kant2002 commented Sep 3, 2022

Will try to summon @LPeter1997 to discuss things

@LPeter1997
Copy link
Contributor

Sorry for the super-delayed reply. I'll try to get to this in a week or so. I'm sadly working on other things and I have many-many things left here to tidy up.

Restore backward compatible constructors for generated lexers and restore changes in tests.
@kant2002
Copy link
Collaborator Author

kant2002 commented Jan 1, 2024

@ForNeVeR I manage to change PR to the state where it does not have source breaking changes, and only binary one. What do you think, should I go further and make it binary compatible (which ideally proper way)

@ForNeVeR
Copy link

ForNeVeR commented Jan 1, 2024

I'd say that Yoakke shouldn't care about binary compatibility for now.

@kant2002 kant2002 merged commit ce461fd into LanguageDev:master Jan 1, 2024
3 checks passed
@kant2002 kant2002 deleted the kant/token-location branch January 1, 2024 19:27
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.

3 participants