diff options
author | thurston <thurston@052ea7fc-9027-0410-9066-f65837a77df0> | 2007-01-21 22:58:22 +0000 |
---|---|---|
committer | thurston <thurston@052ea7fc-9027-0410-9066-f65837a77df0> | 2007-01-21 22:58:22 +0000 |
commit | 12056158053532946b53b6249cb0e6cfd4580051 (patch) | |
tree | 9b5449ef42e829f98bf7a6c6e0554b88d4ab9132 /test/patact.rl | |
download | ragel-12056158053532946b53b6249cb0e6cfd4580051.tar.gz ragel-12056158053532946b53b6249cb0e6cfd4580051.tar.bz2 ragel-12056158053532946b53b6249cb0e6cfd4580051.zip |
Import from my private repository. Snapshot after version 5.16, immediately
following the rewrite of the parsers. Repository revision number 3961.
git-svn-id: http://svn.complang.org/ragel/trunk@2 052ea7fc-9027-0410-9066-f65837a77df0
Diffstat (limited to 'test/patact.rl')
-rw-r--r-- | test/patact.rl | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/test/patact.rl b/test/patact.rl new file mode 100644 index 0000000..c15d93d --- /dev/null +++ b/test/patact.rl @@ -0,0 +1,91 @@ +/* + * @LANG: indep + */ + +char comm; +int top; +int stack[32]; +ptr tokstart; +ptr tokend; +int act; +int val; +%% +%%{ + machine patact; + + other := |* + [a-z]+ => { prints "word\n"; }; + [0-9]+ => { prints "num\n"; }; + [\n ] => { prints "space\n"; }; + *|; + + exec_test := |* + [a-z]+ => { prints "word (w/lbh)\n"; fexec tokend-1; fgoto other; }; + [a-z]+ ' foil' => { prints "word (c/lbh)\n"; }; + [\n ] => { prints "space\n"; }; + '22' => { prints "num (w/switch)\n"; }; + [0-9]+ => { prints "num (w/switch)\n"; fexec tokend-1; fgoto other;}; + [0-9]+ ' foil' => {prints "num (c/switch)\n"; }; + '!';# => { prints "immdiate\n"; fgoto exec_test; }; + *|; + + main := |* + [a-z]+ => { prints "word (w/lbh)\n"; fhold; fgoto other; }; + [a-z]+ ' foil' => { prints "word (c/lbh)\n"; }; + [\n ] => { prints "space\n"; }; + '22' => { prints "num (w/switch)\n"; }; + [0-9]+ => { prints "num (w/switch)\n"; fhold; fgoto other;}; + [0-9]+ ' foil' => {prints "num (c/switch)\n"; }; + '!' => { prints "immdiate\n"; fgoto exec_test; }; + *|; +}%% +/* _____INPUT_____ +"abcd foix\n" +"abcd\nanother\n" +"123 foix\n" +"!abcd foix\n" +"!abcd\nanother\n" +"!123 foix\n" +_____INPUT_____ */ +/* _____OUTPUT_____ +word (w/lbh) +word +space +word +space +ACCEPT +word (w/lbh) +word +space +word +space +ACCEPT +num (w/switch) +num +space +word +space +ACCEPT +immdiate +word (w/lbh) +word +space +word +space +ACCEPT +immdiate +word (w/lbh) +word +space +word +space +ACCEPT +immdiate +num (w/switch) +num +space +word +space +ACCEPT +_____OUTPUT_____ */ + |