Skip to content

Commit

Permalink
Parser bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hg0428 committed Apr 19, 2024
1 parent 42a9745 commit cbd9937
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
16 changes: 10 additions & 6 deletions Aardvark Interpreter/Parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1151,8 +1151,14 @@ def pIfStatement(self, inline=False):
condition = self.pExpression(require=True)
body = None
lasti = condition["positions"]["end"]

if self.compare(TokenTypes["Delimiter"], "{") and not inline:
print(
"HERE",
condition["type"],
self.peek(),
self.compare("Delimiter", "{"),
inline,
)
if self.compare("Delimiter", "{") and not inline:
body, lasti = self.eatBlockScope()
elif not inline:
statm = self.pStatement(True)
Expand Down Expand Up @@ -1773,13 +1779,11 @@ def pMacroDefinition(self):
# Statement:
# VariableDefinition

def pStatement(self, require=False, eatLBs=True):
if eatLBs:
self.eatLBs()
def pStatement(self, require=False, eatLBs=False):
self.eatLBs()

if self.compare("Keyword", "try"):
return self.pTryCatch()

if self.compare("Keyword", "throw"):
return self.pThrow()
if self.compare("Keyword", "static") and self.compare("Keyword", "function", 1):
Expand Down
3 changes: 2 additions & 1 deletion build.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"require-type-annotations": true,
"require-function-return-type-annotation": true,
"force-pure-functions": false,
"allow-embeds": false
"allow-embeds": false,
"allow-keyword-arguments": false
}
}

0 comments on commit cbd9937

Please sign in to comment.