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

Introduce IOrigin to make the Dafny AST easier to work with #5931

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

keyboardDrummer
Copy link
Member

@keyboardDrummer keyboardDrummer commented Nov 26, 2024

Description

  • Introduce IOrigin, which always has a Token StartToken, Token EndToken and Token Center
  • Code that operates on lexical tokens now uses the Token type, instead of IToken
  • Previously, an INode had .Tok and .RangeToken properties. Now it has an IOrigin that should replace both of those. Usages of .RangeToken have already been replaced, but usages of .Tok will be tackled in a follow-up PR.
  • "Token Wrapping", which is used for refinement and changing error messages, which was previously done on IToken, is now done on IOrigin. Dafny.IToken no longer exists. Boogie.IToken is still there
  • A RangeToken no longer takes two ITokens, which could be wrapped, but only takes two Token instances.

Future

  • Replace usages of Node.tok/Tok with Node.Origin
  • Rename RangeToken to SourceOrigin, and include a field for containing the "Center". Rename RangeNode to OriginNode
  • Replace usages of TokenNode with RangeNode, after which RangeNode can be merged into Node
  • Remove token like fields from IOrigin, so users must always choose to use Start/End/Center.
  • Get rid of BoogieRangeToken

How has this been tested?

Pure refactoring, covered by existing tests

By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.

@keyboardDrummer keyboardDrummer changed the title Rename IToken to IOrigin and reduce messiness around 'token wrapping' Introduce IOrigin to reduce headache around tokens Nov 26, 2024
@keyboardDrummer keyboardDrummer changed the title Introduce IOrigin to reduce headache around tokens Introduce IOrigin to make the Dafny AST easier to work with Nov 26, 2024
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