diff options
author | Adrian Thurston <thurston@colm.net> | 2019-09-09 10:19:58 -0600 |
---|---|---|
committer | Adrian Thurston <thurston@colm.net> | 2019-09-09 10:19:58 -0600 |
commit | fff52cd5a567ec541cd487b9fee2d89bf9b6f6eb (patch) | |
tree | 046a3f0f457343f7c99bf096863daf023a085051 /test/colm.d/undofrag1.lm | |
parent | 2d8e9c3f5c0417d6237c945c50f92bf8d28b32d5 (diff) | |
download | colm-fff52cd5a567ec541cd487b9fee2d89bf9b6f6eb.tar.gz |
base (aapl, colm, ragel) test cases building
Diffstat (limited to 'test/colm.d/undofrag1.lm')
-rw-r--r-- | test/colm.d/undofrag1.lm | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/test/colm.d/undofrag1.lm b/test/colm.d/undofrag1.lm new file mode 100644 index 00000000..5fbe7df6 --- /dev/null +++ b/test/colm.d/undofrag1.lm @@ -0,0 +1,66 @@ + +lex + ignore /space+/ + literal `# `{ `} + token id2 /[a-zA-Z_]+/ +end + +def item2 + [id2] +| [`{ item2* `}] + +def start2 + [item2*] + + +context ctx + + SP: parser<start2> + + lex + ignore /space+/ + literal `* `( `) `! + token semi_nl /';\n'/ + token id /[a-zA-Z_]+/ + end + + def item + [id] + | [`( item* `)] + + + def A [] { + print( 'A\n' ) + send SP "{ A{d} }" + } + + def B [] { + print( 'B\n' ) + send SP "{ B{d} }" + } + + def start1 + [A item* `!] + | [B item* semi_nl] + +end # ctx + + +CTX: ctx = new ctx() +CTX->SP = new parser<start2>() +send CTX->SP "a b{c}" + +parse Input: ctx::start1( CTX )[stdin] + +send CTX->SP "{e}f g" + +print( Input ) +print( CTX->SP->finish(), '\n' ) + +##### IN ##### +a b c ( d ) e f g ; +##### EXP ##### +A +B +a b c ( d ) e f g ; +a b{c}{ B{d} }{e}f g |