From bf4c32ff73537111b7c381f8764cca6fc246b4ba Mon Sep 17 00:00:00 2001 From: Adrian Thurston Date: Wed, 22 Feb 2017 15:36:54 +0800 Subject: flatteneed test directory --- test/repeat1.lm | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 test/repeat1.lm (limited to 'test/repeat1.lm') diff --git a/test/repeat1.lm b/test/repeat1.lm new file mode 100644 index 00000000..9c907ff6 --- /dev/null +++ b/test/repeat1.lm @@ -0,0 +1,41 @@ +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 -- cgit v1.2.1