diff options
Diffstat (limited to 'test/trans.d/case/eofact_go.rl')
-rw-r--r-- | test/trans.d/case/eofact_go.rl | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/test/trans.d/case/eofact_go.rl b/test/trans.d/case/eofact_go.rl new file mode 100644 index 00000000..caa7d707 --- /dev/null +++ b/test/trans.d/case/eofact_go.rl @@ -0,0 +1,70 @@ +/* + * @LANG: go + * @GENERATED: true + */ + +package main +import "fmt" + + + + +%%{ + machine eofact; + + action a1 {fmt.Print( "a1\n" );} + action a2 {fmt.Print( "a2\n" );} + action a3 {fmt.Print( "a3\n" );} + action a4 {fmt.Print( "a4\n" );} + + + main := ( + 'hello' @eof a1 %eof a2 '\n'? | + 'there' @eof a3 %eof a4 + ); + +}%% + + +var cs int; +var blen int; +var buffer [1024] byte; + +%% write data; + +func prepare() { + %% write init; +} + +func exec(data string) { + var p int = 0 + var pe int = len(data) + var eof int = pe + %% write exec; +} +func finish() { + if cs >= eofact_first_final { + fmt.Println("ACCEPT") + } else { + fmt.Println("FAIL") + } +} +var inp []string = []string { +"", +"h", +"hell", +"hello", +"hello\n", +"t", +"ther", +"there", +"friend", +}; + +func main() { + for _, data := range inp { + prepare() + exec(data) + finish() + } +} |