new tester; all tests categorized
This commit is contained in:
parent
51ee524109
commit
20b5f31c03
481 changed files with 794 additions and 2506 deletions
26
tests/macro/tmacrostmt.nim
Normal file
26
tests/macro/tmacrostmt.nim
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import macros
|
||||
macro case_token(n: stmt): stmt {.immediate.} =
|
||||
# creates a lexical analyzer from regular expressions
|
||||
# ... (implementation is an exercise for the reader :-)
|
||||
nil
|
||||
|
||||
case_token: # this colon tells the parser it is a macro statement
|
||||
of r"[A-Za-z_]+[A-Za-z_0-9]*":
|
||||
return tkIdentifier
|
||||
of r"0-9+":
|
||||
return tkInteger
|
||||
of r"[\+\-\*\?]+":
|
||||
return tkOperator
|
||||
else:
|
||||
return tkUnknown
|
||||
|
||||
case_token: inc i
|
||||
|
||||
#bug #488
|
||||
|
||||
macro foo: stmt =
|
||||
var exp = newCall("whatwhat", newIntLitNode(1))
|
||||
if compiles(getAst(exp)): return exp
|
||||
else: echo "Does not compute!"
|
||||
|
||||
foo()
|
||||
Loading…
Add table
Add a link
Reference in a new issue