In order to support context-sensitive parsing of statements (specifically break, continue, and return), we need the parent parser to be able to provide its understanding of which statements are valid.
e.g. Once inside a while statement, any break/continue statement is valid. Once inside a function, any return statement is valid.
This can be done by wrapping the parsers with alt combinators.
In order to support context-sensitive parsing of statements (specifically
break
,continue
, andreturn
), we need the parent parser to be able to provide its understanding of which statements are valid.e.g. Once inside a
while
statement, anybreak
/continue
statement is valid. Once inside a function, anyreturn
statement is valid.This can be done by wrapping the parsers with
alt
combinators.