mirror of
https://github.com/nim-lang/Nim.git
synced 2026-07-20 07:51:32 +00:00
parser support anon iterators
This commit is contained in:
17
tests/parser/tdomulttest.nim
Normal file
17
tests/parser/tdomulttest.nim
Normal file
@@ -0,0 +1,17 @@
|
||||
discard """
|
||||
file: "tdomulttest.nim"
|
||||
output: "555\ntest\nmulti lines\n99999999\nend"
|
||||
disabled: true
|
||||
"""
|
||||
proc foo(bar, baz: proc (x: int): int) =
|
||||
echo bar(555)
|
||||
echo baz(99999999)
|
||||
|
||||
foo do (x: int) -> int:
|
||||
return x
|
||||
do (x: int) -> int:
|
||||
echo("test")
|
||||
echo("multi lines")
|
||||
return x
|
||||
|
||||
echo("end")
|
||||
15
tests/parser/tinvwhen.nim
Normal file
15
tests/parser/tinvwhen.nim
Normal file
@@ -0,0 +1,15 @@
|
||||
discard """
|
||||
file: "tinvwhen.nim"
|
||||
line: 11
|
||||
errormsg: "invalid indentation"
|
||||
"""
|
||||
# This was parsed even though it should not!
|
||||
|
||||
proc chdir(path: cstring): cint {.importc: "chdir", header: "dirHeader".}
|
||||
|
||||
proc getcwd(buf: cstring, buflen: cint): cstring
|
||||
when defined(unix): {.importc: "getcwd", header: "<unistd.h>".} #ERROR_MSG invalid indentation
|
||||
elif defined(windows): {.importc: "getcwd", header: "<direct.h>"}
|
||||
else: {.error: "os library not ported to your OS. Please help!".}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user