summaryrefslogtreecommitdiff
path: root/test/scan1.rl
diff options
context:
space:
mode:
Diffstat (limited to 'test/scan1.rl')
-rw-r--r--test/scan1.rl64
1 files changed, 64 insertions, 0 deletions
diff --git a/test/scan1.rl b/test/scan1.rl
new file mode 100644
index 0000000..df0971a
--- /dev/null
+++ b/test/scan1.rl
@@ -0,0 +1,64 @@
+/*
+ * @LANG: indep
+ */
+ptr ts;
+ptr te;
+int act;
+int token;
+%%
+%%{
+ machine scanner;
+
+ # Warning: changing the patterns or the input string will affect the
+ # coverage of the scanner action types.
+ main := |*
+ 'a' => {
+ prints "on last ";
+ if ( p+1 == te )
+ prints "yes";
+ prints "\n";
+ };
+
+ 'b'+ => {
+ prints "on next ";
+ if ( p+1 == te )
+ prints "yes";
+ prints "\n";
+ };
+
+ 'c1' 'dxxx'? => {
+ prints "on lag ";
+ if ( p+1 == te )
+ prints "yes";
+ prints "\n";
+ };
+
+ 'd1' => {
+ prints "lm switch1 ";
+ if ( p+1 == te )
+ prints "yes";
+ prints "\n";
+ };
+ 'd2' => {
+ prints "lm switch2 ";
+ if ( p+1 == te )
+ prints "yes";
+ prints "\n";
+ };
+
+ [d0-9]+ '.';
+
+ '\n';
+ *|;
+}%%
+/* _____INPUT_____
+"abbc1d1d2\n"
+_____INPUT_____ */
+/* _____OUTPUT_____
+on last yes
+on next yes
+on lag yes
+lm switch1 yes
+lm switch2 yes
+ACCEPT
+_____OUTPUT_____ */