Skip to content

Faulty parsing: change logic of errorBlock#13042

Merged
MarcusDenker merged 11 commits intopharo-project:Pharo12from
privat:faulty-parser-errorBlock
Mar 18, 2023
Merged

Faulty parsing: change logic of errorBlock#13042
MarcusDenker merged 11 commits intopharo-project:Pharo12from
privat:faulty-parser-errorBlock

Conversation

@privat
Copy link
Contributor

@privat privat commented Mar 18, 2023

This is a rewrite of #12912. I didn't like how it was done (but you might want to re-read it to compare).

Here is the new proposal, less radical but much cleaner than the current state anyway (so good enough for now).

  • RBParser gets a isFaulty flag used for all "faulty" parsing (no more weird RBParser class>>errorNodeBlock).
    For contxt, faulty mode produces RBParseErrorNode, then continue the parsing in degraded mode to produce faulty AST. In 'non-faulty' mode, exceptions are signaled (that just stops the parsing).
  • errorBlock is kept (for the moment?) because it is used a lot, but is only for error notification (and most of the time non-local return). Reparation was broken by design and never performed by client at this level (not even by a test!!!). Therefore, reparation is no more possible (and parseErrorNode is now private).
  • SyntaxErrorNotification is therefore signaled if neither isFaulty or errorBlock wanted to do anything
  • If resumed, RBParseErrorNode is produced (as in isFaulty mode). This was in the previous PR.

Next PR will be likely about cleaning up more parser error things (messages and positions).

@privat
Copy link
Contributor Author

privat commented Mar 18, 2023

note: OpalCompiler uses the name failBlock and RBParser uses errorBlock. Which one do you prefer?

@MarcusDenker
Copy link
Member

I somehow prefer failBlock

Copy link
Member

@MarcusDenker MarcusDenker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getting rid of the errorNodeBlock mechanism is very good.

For the errorBlock, I somehow prefer failBlock, but that is I guess because the compiler API uses that term.

And yes, it would be nice to get rid of it both on the level of the compiler and the parser

@MarcusDenker MarcusDenker merged commit 5743f98 into pharo-project:Pharo12 Mar 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants