summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2011-04-05 00:34:59 +0200
committerAraq <rumpf_a@web.de>2011-04-05 00:34:59 +0200
commite38876efb67b6b7f24f4c9a4669ced6fdd2d4371 (patch)
tree57c06f426681f3da072a27b9a38ea6aae25d8bb5 /tests
parentae5074455d3547f0d8ca65e591fce5d814d61f21 (diff)
parentffd05510bd8e0f8ca294497eb6b8062a3d80b7a1 (diff)
downloadNim-e38876efb67b6b7f24f4c9a4669ced6fdd2d4371.tar.gz
Merge branch 'master' of github.com:Araq/Nimrod
Diffstat (limited to 'tests')
-rw-r--r--tests/accept/compile/tmacrostmt.nim17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/accept/compile/tmacrostmt.nim b/tests/accept/compile/tmacrostmt.nim
new file mode 100644
index 000000000..5d1403dac
--- /dev/null
+++ b/tests/accept/compile/tmacrostmt.nim
@@ -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