The lexical analyser is Perl is quite sophisticated due to lexical complexity of the language. So I think it already counts past lexems and thus can determine the balance of "()", '[]' and "{}"
So you probably can initially experiment with the following scheme
If all the following conditions are true
the lexical analyser needs to insert lexem "semicolon" in the stream of lexem passed to syntax analyser.
The warning issued should be something like:
"Attempt to correct missing semicolon was attempted. If this is incorrect please use extra parenthesis or disable pragma "softsemicolon" for this fragment."From what I read, Perl syntax analyser relies on lexical analyser in some unorthodox way, so it might be possible to use "clues" from syntax analyser for improving this scheme. See, for example, the scheme proposed for recursive descent parsers in:
Follow set error recovery C Stirling - Software: Practice and Experience, 1985 - Wiley Online Library … Some accounts of the recovery scheme mention and make use of non-systematic changes to their recursive descent parsers in order to improve … In the former he anticipates the possibility of a missing semicolon whereas in the latter he does not anticipate a missing comma …
In reply to Re^10: What esteemed monks think about changes necessary/desirable in Perl 7 outside of OO staff
by likbez
in thread What esteemed monks think about changes necessary/desirable in Perl 7 outside of OO staff
by likbez
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |