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/accumbt1.lm | |
download | colm-tarball-404ae0f284a3b2d41fcdb53826550e4dfec5c65c.tar.gz |
colm-0.12.0HEADcolm-0.12.0master
Diffstat (limited to 'test/accumbt1.lm')
-rw-r--r-- | test/accumbt1.lm | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/test/accumbt1.lm b/test/accumbt1.lm new file mode 100644 index 0000000..77d56f5 --- /dev/null +++ b/test/accumbt1.lm @@ -0,0 +1,41 @@ +##### LM ##### + +# Token names. +lex + token number /[0-9]+/ + token id /[a-z]+/ + token string /'"' [^"]* '"'/ + ignore ws / [ \t\n]+ / +end + +def prefix [id] + +def choice1 + [number number] +| [number] + +def choice2 + [string id] +| [number number] +| [id number] +| [number] + +def start + [prefix choice1 choice2 string id id] + +cons I: parser<start> [] + +send I " id " +send I " 77 " +send I " 88 " +send I " \"hello\" " +send I " dude " +send I " dude\n" + +S: start = I() +S = match S + ~id 77 88 "hello" dude dude +print_xml( S ) +print( '\n' ) +##### EXP ##### +<start><prefix><id>id</id></prefix><choice1><number>77</number></choice1><choice2><number>88</number></choice2><string>"hello"</string><id>dude</id><id>dude</id></start> |