mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-14 23:33:28 +00:00
Merge branch 'master' of github.com:Araq/Nimrod
This commit is contained in:
@@ -765,8 +765,8 @@ proc parseExprStmt(p: var TParser): PNode =
|
||||
addSon(result, a)
|
||||
getTok(p)
|
||||
skipComment(p, result)
|
||||
if (p.tok.tokType == tkInd) or
|
||||
not (p.tok.TokType in {tkOf, tkElif, tkElse, tkExcept}):
|
||||
if p.tok.tokType == tkSad: getTok(p)
|
||||
if not (p.tok.TokType in {tkOf, tkElif, tkElse, tkExcept}):
|
||||
addSon(result, parseStmt(p))
|
||||
while true:
|
||||
if p.tok.tokType == tkSad: getTok(p)
|
||||
|
||||
17
tests/accept/compile/tmacrostmt.nim
Normal file
17
tests/accept/compile/tmacrostmt.nim
Normal file
@@ -0,0 +1,17 @@
|
||||
import macros
|
||||
macro case_token(n: stmt): stmt =
|
||||
# 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
|
||||
Reference in New Issue
Block a user