Skip to content

Commit

Permalink
Updated comment.
Browse files Browse the repository at this point in the history
  • Loading branch information
quephird committed Mar 2, 2024
1 parent 3171a1f commit 5620ffa
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion slox/Parser.swift
Expand Up @@ -56,7 +56,10 @@ struct Parser {
// whileStmt → "while" "(" expression ")" statement ;
// block → "{" declaration* "}" ;
mutating private func parseDeclaration() throws -> Statement {
// We check for the next token to accomodate supporting lambdas
// We look ahead to see if the next token is an identifer,
// and if so we assume this is a function declaration. Otherwise,
// if the current token is `fun`, then we have a lambda, and we
// will eventually parse it when we hit parsePrimary().
if currentTokenMatches(type: .fun) && nextTokenMatches(type: .identifier) {
advanceCursor()
return try parseFunctionDeclaration()
Expand Down

0 comments on commit 5620ffa

Please sign in to comment.