Error recovery: ignore malformed elements #334
Labels
enhancement
target:biniou
Issues related to biniou
target:bucklescript
Issues related to the Bucklescript backend
target:go
Issue related to Go/Golang
target:java
Issues related to the Java backend (atdj)
target:json
Issues related to all JSON backends
target:ocaml
Issues related to the OCaml backend (atdgen)
target:python
Issues related to the Python backend (atdpy)
target:scala
Issues related to the Scala backend (atds)
target:typescript
Issues related to the TypeScript backend (atdts)
Goal: maximize backward compatibility of outdated JSON readers
This was inspired by what tree-sitter parsers do. Tree-sitter is a parser generator. When a tree-sitter parser encounters an unsupported syntax in an input file, instead of failing completely, it will try to contain the error by creating an error node that a client can happily ignore.
We could apply a similar strategy to JSON readers, to any target language: if an ignorable node is malformed, skip it. The ignored material could be reported as an error outside of the main result e.g. an OCaml signature for a JSON reader could be
Ignorable nodes include list or array elements (ATD
list
) and optional values (ATDoption
,nullable
).Tasks:
The text was updated successfully, but these errors were encountered: