diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2014-10-13 19:14:30 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2014-10-13 19:14:30 +0000 |
commit | eafd7a3974e8605fd02794269db6114a3446e016 (patch) | |
tree | 064737b35dbe10f2995753ead92f95bac30ba048 /test/import1.rl | |
download | ragel-tarball-eafd7a3974e8605fd02794269db6114a3446e016.tar.gz |
ragel-6.9ragel-6.9
Diffstat (limited to 'test/import1.rl')
-rw-r--r-- | test/import1.rl | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/test/import1.rl b/test/import1.rl new file mode 100644 index 0000000..e721f56 --- /dev/null +++ b/test/import1.rl @@ -0,0 +1,73 @@ +/* + * @LANG: c + */ + +#include <stdio.h> + +char *foo = "foo"; + +char b = 98; +char a = 97; +char r = 114; + +#define SP 32 +#define NL '\n' + +%%{ + machine tmp; + import "import1.rl"; + + foobar = + foo @{printf("foo\n"); } | + b a r @{printf("bar\n");}; + + main := ( foobar SP foobar NL )*; +}%% + +%% write data; + +int cs; + +void exec_str( char *p, int len ) +{ + char *pe = p + len; + %% write exec; +} + +void exec_c( char c ) +{ + exec_str( &c, 1 ); +} + +int main() +{ + %% write init; + + exec_str( foo, 3 ); + exec_c( SP ); + exec_c( b ); + exec_c( a ); + exec_c( r ); + exec_c( NL ); + + exec_c( b ); + exec_c( a ); + exec_c( r ); + exec_c( SP ); + exec_str( foo, 3 ); + exec_c( NL ); + + if ( cs < tmp_first_final ) + printf("FAIL\n"); + else + printf("ACCEPT\n"); + + return 0; +} +#ifdef _____OUTPUT_____ +foo +bar +bar +foo +ACCEPT +#endif |