You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Each parse helper called byparseStatement() should "know" the full grammar of the statement type it's attempting to parse. For example, parseForStatement() should actually be checking for the existence of the for token, not parseStatment(). That means all of the parse helps will need to return Statement? and the call site should have an if let to grab the return value, like so:
In parseStatement():
if let forStmt = try parseForStatement() {
return forStmt
}
.
.
.
Each parse helper called by
parseStatement()
should "know" the full grammar of the statement type it's attempting to parse. For example,parseForStatement()
should actually be checking for the existence of thefor
token, notparseStatment()
. That means all of the parse helps will need to returnStatement?
and the call site should have anif let
to grab the return value, like so:In
parseStatement()
:... then in
parseForStatement()
:Look for other places in the parser where there is a similar splintering of knowledge.
The text was updated successfully, but these errors were encountered: