diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2014-02-01 19:49:33 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2014-02-01 19:49:33 +0000 |
commit | 404ae0f284a3b2d41fcdb53826550e4dfec5c65c (patch) | |
tree | cc446af26234e4465b8cc168b720ec44816ff5ab /test/ignore3.lm | |
download | colm-tarball-master.tar.gz |
colm-0.12.0HEADcolm-0.12.0master
Diffstat (limited to 'test/ignore3.lm')
-rw-r--r-- | test/ignore3.lm | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/test/ignore3.lm b/test/ignore3.lm new file mode 100644 index 0000000..ccf9c13 --- /dev/null +++ b/test/ignore3.lm @@ -0,0 +1,53 @@ +##### LM ##### +lex + ignore /space+/ + literal `* + literal `( -ni + literal ni- `) + literal `! `; + token id /[a-zA-Z_0-9]+/ +end + +lex + ignore /space+/ + token inner_t /[a-zA-Z_0-9]+/ + token empty - +end + +def inner + [inner_t*] +| [empty] + +def item + [id] +| [`( inner `)] + +def start + [item* `;] + +parse Start: start[ stdin ] + +if ( ! Start ) { + print( 'parse error\n' ) + exit( 0 ) +} + +for I: item in Start { + print( 'item: .' I '.\n' ) + if match I [ O: `( Inner: inner C: `) ] + 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. |