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
# stmt -> complexOrSimpleStmt -> simpleStmt -> discardStmt# where "discardStmt = 'discard' optInd expr?", and optInd# is "optInd = COMMENT? IND?" so matches nothing here.## Then all the non-simpleExpr cases of expr require some non-'(' initial# token so expr -> simpleExpr, which scans through the precedence order,# and eventually reaches primary -> identOrLiteral -> tupleConstr:## tupleConstr = '(' optInd (exprColonEqExpr comma?)* optPar ')'## Still no optInd, so exprColonEqExpr = expr (':'|'=' expr)?## expr matches "ifExpr = 'if' condExpr" and "literal = | INT_LIT",# which is '0'.## https://nim-lang.org/docs/manual.html#procedures-command-invocation-syntax# "Routines can be invoked without the () if the call is syntactically a# statement. This command invocation syntax also works for expressions, but# then only a single argument may follow. This restriction means# `echo f 1, f 2` is parsed as `echo(f(1), f(2))` and not as# `echo(f(1, f(2)))`.## is satisfied here. `f()` takes one argument and is used with one argument.procf(x: int): int=0discard (
iftrue:
f0else:
f0,
1)
f(try:
0finally:
int0,
0)
shows a similar issue and basically analogous parsing/grammar.
f(try:
0exceptCatchableError:
int0,
0)
does as well.
Nim Version
Current devel
Nim Compiler Version 1.9.3 [Linux: amd64]
Compiled at 2023-06-08
Copyright (c) 2006-2023 by Andreas Rumpf
git hash: ea91cfb3050bac5c808ed8ab08e12cd33f1dc8ff
active boot switches: -d:release
Nim Compiler Version 1.6.12 [Linux: amd64]
Compiled at 2023-06-06
Copyright (c) 2006-2023 by Andreas Rumpf
git hash: 1aa9273640c0c51486cf3a7b67282fe58f360e91
active boot switches: -d:release
Current Output
ifelse.nim(32, 3) Error: invalid indentation
Similar errors for other variations (try/finally, try/except, et cetera)
Expected Output
Successful compilation
Possible Solution
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered:
As noted in #21655, condExpr does not actually parse expr, it parses stmt, so it attempts to parse f 0, 1 which consumes the comma but quits after the comma due to the unindent
Description
shows a similar issue and basically analogous parsing/grammar.
does as well.
Nim Version
Current
devel
Current Output
Expected Output
Possible Solution
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: