summaryrefslogtreecommitdiff
path: root/test/erract8.rl
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2014-10-13 19:14:30 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2014-10-13 19:14:30 +0000
commiteafd7a3974e8605fd02794269db6114a3446e016 (patch)
tree064737b35dbe10f2995753ead92f95bac30ba048 /test/erract8.rl
downloadragel-tarball-eafd7a3974e8605fd02794269db6114a3446e016.tar.gz
ragel-6.9ragel-6.9
Diffstat (limited to 'test/erract8.rl')
-rw-r--r--test/erract8.rl44
1 files changed, 44 insertions, 0 deletions
diff --git a/test/erract8.rl b/test/erract8.rl
new file mode 100644
index 0000000..7926186
--- /dev/null
+++ b/test/erract8.rl
@@ -0,0 +1,44 @@
+/*
+ * @LANG: java
+ */
+
+class erract8
+{
+ %%{
+ machine erract8;
+
+ action on_char { System.out.println("char: " + data[p]); }
+ action on_err { System.out.println("err: " + data[p]); }
+ action to_state { System.out.println("to state: " + data[p]); }
+
+ main := 'heXXX' $on_char $err(on_err) $to(to_state);
+ }%%
+
+ %% write data;
+
+ static void test( char data[] )
+ {
+ int cs, p = 0, pe = data.length;
+ int eof = pe;
+ int top;
+
+ %% write init;
+ %% write exec;
+
+ System.out.println("rest: " + data[p] + data[p+1] + data[p+2]);
+ }
+
+ public static void main( String args[] )
+ {
+ test( "hello".toCharArray() );
+ }
+}
+
+/* _____OUTPUT_____
+char: h
+to state: h
+char: e
+to state: e
+err: l
+rest: llo
+*/