diff options
Diffstat (limited to 'test/ignore5.lm')
-rw-r--r-- | test/ignore5.lm | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/test/ignore5.lm b/test/ignore5.lm new file mode 100644 index 0000000..28a3392 --- /dev/null +++ b/test/ignore5.lm @@ -0,0 +1,51 @@ +##### LM ##### +lex + ignore /space+/ + literal `* `! `; + literal `( -ni ni- `) + token id /[a-zA-Z_0-9]+/ +end + +lex + ignore /space+/ + token inner_t /[a-zA-Z_0-9]+/ + + token empty - +end + +def inner + [empty inner_t*] + +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. |