summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2013-03-24 21:20:03 -0400
committerAdrian Thurston <thurston@complang.org>2013-03-24 21:20:03 -0400
commitce7beceb7772b7afa18ddd77e3c529ac58028ae9 (patch)
tree882670fc0631ef58b8dc2137def2931eae5d9a0e /test
parentb4854c7a53f2d5938ee0c4edbe3d4c941b741164 (diff)
downloadcolm-ce7beceb7772b7afa18ddd77e3c529ac58028ae9.tar.gz
added no_ignore for token defs
Diffstat (limited to 'test')
-rw-r--r--test/ignore5.lm53
1 files changed, 53 insertions, 0 deletions
diff --git a/test/ignore5.lm b/test/ignore5.lm
new file mode 100644
index 00000000..d49464d4
--- /dev/null
+++ b/test/ignore5.lm
@@ -0,0 +1,53 @@
+##### LM #####
+lex
+ ignore /space+/
+ literal '*', '!', ';'
+ token POPEN /'('/ ni
+ token PCLOSE ni /')'/
+ token id /[a-zA-Z_0-9]+/
+end
+
+lex
+ ignore /space+/
+ token inner_t /[a-zA-Z_0-9]+/
+
+ literal ''
+end
+
+def inner
+ ['' inner_t*]
+
+def item
+ [id]
+| [POPEN inner PCLOSE]
+
+def start
+ [item* ';']
+
+parse StartP: start[ stdin ]
+Start: start = StartP.tree
+
+if ( ! Start ) {
+ print( 'parse error\n' )
+ exit( 0 )
+}
+
+for I: item in Start {
+ print( 'item: .' %I '.\n' )
+ if match I [ O: POPEN Inner: inner C: PCLOSE ]
+ print( 'innr: .' %O '.' %Inner '.' %C '.\n' )
+}
+
+##### IN #####
+a b c ( d ) e ( ) f g;
+##### EXP #####
+item: .a .
+item: .b .
+item: .c .
+item: .( d ) .
+innr: .(. d .) .
+item: .e .
+item: .( ) .
+innr: .(. .) .
+item: .f .
+item: .g.