mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-12 14:48:14 +00:00
fixes #1473
This commit is contained in:
17
tests/macros/ttryparseexpr.nim
Normal file
17
tests/macros/ttryparseexpr.nim
Normal file
@@ -0,0 +1,17 @@
|
||||
discard """
|
||||
outputsub: '''Error: invalid indentation'''
|
||||
"""
|
||||
|
||||
# feature request #1473
|
||||
import macros
|
||||
|
||||
macro test(text: string): expr =
|
||||
try:
|
||||
result = parseExpr(text.strVal)
|
||||
except ValueError:
|
||||
result = newLit getCurrentExceptionMsg()
|
||||
|
||||
const
|
||||
a = test("foo&&")
|
||||
|
||||
echo a
|
||||
Reference in New Issue
Block a user