When applying rewriting modifications, stop with an error when the tree
obtained by parsing the unparsed rewriting tree does not have the exact
same shape as the rewriting tree itself.
For tokens matched by literals only (like keywords), only compare the
kind. For `@symbol` tokens (generally matched by patterns), also compare
the symbol. For all the other tokens, keep comparing the actual token
text.
Continue accepting "recurse" templates when loading the "node"
configuration for regular nodes, but convert them to the equivalent
"recurse_field" templates internally.
This allows doing this conversion (expansion to the concrete syntax for
regular nodes) only once per regular node type, versus once per template
insantiation (i.e. one per regular node found in the parse tree). This
is a minor optimization right now, but will later also allow to
pre-compute the Prettier IR for tokens in the configuration directly
rather than during template instantiation.
Move the implementation of the rewriting engine to Langkit_Support and
add bindings to it in the generic API. Rework the C bindings to be
implemented on top of the generic API.
Note that no new testcase is added: the generic API is tested indirectly
by all existing rewriting testcases by the virtue of being the
common implementation behind all the other rewriting APIs. The Ada API
testcase will transition to the generic API once the Ada API is removed.
Parse fields that contain list nodes or qualifier nodes are never
supposed to contain actual null nodes, but empty lists/absent qualifier
nodes instead. However, declaring null fields removes storage for them,
and thus makes the getters return null nodes in the generated libraries,
which is inconsistent.
Reject these null parse fields to avoid this inconsistency. Rework
Liblktlang and the `ada_api/rewriting` testcase to avoid this.
Note that this fixes the sorting of enum types by name. It used to be
done only during the `CompileTypeRepo -> CompileCtx` transition, and tha
transition used to happen before all enum types were known.