Customize the PEGTL parse_tree implementation #252
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pending taocpp/PEGTL#309 (or perhaps taocpp/PEGTL#313), I need to suppress the try/catch/rethrow handling in
match_control_unwind
to unblock reasonably deep nested selection sets on Windows. This was originally reported as #222, which was mitigated by adding a depth limit parameter, but it still needs to be set to a very low number to avoid a stack overflow on Windows. Sinceast_node
does not have anyunwind
handling, it is safe to let the exception unwind directly from where it is thrown to the point where we're attempting to parse a GraphQL document. If/when that PR is merged, I can revert to the original version in PEGTL.This also simplifies a lot of the
ast_node
implementation by inheriting from PEGTL'sparse_tree::basic_node
CRTP type. This will help when migrating to the 4.x/main branch of PEGTL because some of the input iterator types have been replaced withfrobnicator
types, indicating that they should be considered a low-level internal feature and not something that should be referenced outside of it.If for some reason taocpp/PEGTL#313 is merged without taocpp/PEGTL#309, then I will need to make some more changes before I can revert the custom parse tree. By inheriting from
parse_tree::basic_node
, I'm exposing anunwind
implementation onast_node
. I will likely need to compose theparse_tree::basic_node
as a private member instead of inheriting it to be able to suppress the call tounwind
with taocpp/PEGTL#313 by itself.