Currently, indexing operators are misparsed by ppxlib in Context_free.special_function because the Longident parsing code stops on the first closing parenthesis in (.!(;..)) and fails with an invalid argument because this first closing parenthesis is not at the end of the identifier.
This PR fixes this issue by finding the first pair of matched parentheses and add a test for the indexing operator cases.
Along the way, I added some more context on the Invalid_argument error.
Note that I am also tempted to propose a version of special_function that doesn't parse its argument and takes a longident directly to avoid this recurring issue.
Currently, indexing operators are misparsed by ppxlib in
Context_free.special_function
because theLongident
parsing code stops on the first closing parenthesis in(.!(;..))
and fails with an invalid argument because this first closing parenthesis is not at the end of the identifier.This PR fixes this issue by finding the first pair of matched parentheses and add a test for the indexing operator cases. Along the way, I added some more context on the
Invalid_argument
error.Note that I am also tempted to propose a version of
special_function
that doesn't parse its argument and takes alongident
directly to avoid this recurring issue.