Support for stmtListExpr in parser after major keywords. Scaled down version. (#10852)
* Support for stmtListExpr in parser after major keywords * fixes #4035
This commit is contained in:
parent
c19cd14fc9
commit
862897dc0f
4 changed files with 54 additions and 12 deletions
|
|
@ -1,5 +1,5 @@
|
|||
discard """
|
||||
outputsub: '''Error: invalid indentation 45'''
|
||||
outputsub: '''Error: expression expected, but found '[EOF]' -- 45'''
|
||||
"""
|
||||
|
||||
# feature request #1473
|
||||
|
|
@ -9,6 +9,7 @@ macro test(text: string): untyped =
|
|||
try:
|
||||
result = parseExpr(text.strVal)
|
||||
except ValueError:
|
||||
echo text
|
||||
result = newLit getCurrentExceptionMsg()
|
||||
|
||||
const
|
||||
|
|
@ -17,4 +18,4 @@ const
|
|||
b = test("valid")
|
||||
c = test("\"") # bug #2504
|
||||
|
||||
echo a, " ", b
|
||||
echo a, " -- ", b
|
||||
|
|
|
|||
20
tests/parser/tstmtlist_expr.nim
Normal file
20
tests/parser/tstmtlist_expr.nim
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
discard """
|
||||
output: '''10'''
|
||||
"""
|
||||
|
||||
proc xx(a: int): int =
|
||||
let y = 0
|
||||
return
|
||||
var x = 0
|
||||
x + y
|
||||
|
||||
proc b(x: int): int =
|
||||
raise
|
||||
var e: ref Exception
|
||||
new(e)
|
||||
e.msg = "My Exception msg"
|
||||
e
|
||||
|
||||
##issue 4035
|
||||
echo(5 +
|
||||
5)
|
||||
Loading…
Add table
Add a link
Reference in a new issue