diff options
Diffstat (limited to 'test/repeat1.lm')
-rw-r--r-- | test/repeat1.lm | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/test/repeat1.lm b/test/repeat1.lm new file mode 100644 index 0000000..315a63e --- /dev/null +++ b/test/repeat1.lm @@ -0,0 +1,42 @@ +##### LM ##### +lex + ignore /space+/ + literal `* `( `) + token id /[a-zA-Z_]+/ +end + +def item + [id] +| [`( item* `)] + +def start + [item*] + +parse Input: start[ stdin ] + +match Input [ItemList: item*] + +for I: item* in repeat( ItemList ) + print( ^I '\n' ) + +for I: item* in rev_repeat( ItemList ) + print( ^I '\n' ) +##### IN ##### +a b ( c d ) e ( f g ) h i +##### EXP ##### +a b ( c d ) e ( f g ) h i +b ( c d ) e ( f g ) h i +( c d ) e ( f g ) h i +e ( f g ) h i +( f g ) h i +h i +i + + +i +h i +( f g ) h i +e ( f g ) h i +( c d ) e ( f g ) h i +b ( c d ) e ( f g ) h i +a b ( c d ) e ( f g ) h i |