cybertec-postgresql / poc-plpgsql-analyzer

Proof of concept for tooling to migrate PL/SQL code to PL/pgSQL written in Rust
MIT License
7 stars 0 forks source link

Parser: Do not write errors into AST #102

Closed KieranKaelin closed 1 year ago

KieranKaelin commented 1 year ago

Currently, for every error that is registered with the Parser, it will create a new Token and splice it into the AST. This makes transpiling impossible since the TextRanges after the error do no longer match up with the original string input.

Goal

Do not insert errors into the AST. Instead, extend the existing errors attribute the parser already owns to also denote the errors position inside the AST.

How to demo

Tests showcasing how errors are no longer in the AST, but instead asserting the Parse::errors attribute.