Author pablogsal
Recipients CCLDArjun, lys.nikolaou, pablogsal
Date 2021-06-06.23:52:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1623023531.92.0.69695749892.issue44324@roundup.psfhosted.org>
In-reply-to
Content
>> Well, I was thinking we could just do a simple check in _PyPegen_check_tokenizer_errors or _PyPegen_run_parser functions. If the last three tokens in the Parser object's tokens array are NAME, EQUAL/MINEQUAL/etc and NEWLINE, we raise the special error. Is this the right way to do it? I saw that unclosed parentheses' special error are checked in the same place. 

I find that quite inelegant and error prone. A PEG parser is not assured to finish when you think it will finish as it can backtrack and expand to parse left recursive rules. Incorrect syntax must be handled by the parser itself using the parser process, not after the fact. Once the parser has finished, the semantic information is gone and you are left with unstructured tokens.


> Yea, I realized that the "expected an expression" error can be used in multiple places. Could be added one by one?

Not sure what you mean here, but this should be added in a single place related to the assignment rule, otherwise is going to be quite difficult to maintain.
History
Date User Action Args
2021-06-06 23:52:11pablogsalsetrecipients: + pablogsal, lys.nikolaou, CCLDArjun
2021-06-06 23:52:11pablogsalsetmessageid: <1623023531.92.0.69695749892.issue44324@roundup.psfhosted.org>
2021-06-06 23:52:11pablogsallinkissue44324 messages
2021-06-06 23:52:11pablogsalcreate