A test for the ruby frontend scanner.
authorthurston <thurston@052ea7fc-9027-0410-9066-f65837a77df0>
Fri, 6 Apr 2007 20:11:57 +0000 (20:11 +0000)
committerthurston <thurston@052ea7fc-9027-0410-9066-f65837a77df0>
Fri, 6 Apr 2007 20:11:57 +0000 (20:11 +0000)
git-svn-id: http://svn.complang.org/ragel/trunk@172 052ea7fc-9027-0410-9066-f65837a77df0

test/atoi3.rl
test/ruby1.rl [new file with mode: 0644]

index a4b9387..b8d54f6 100644 (file)
@@ -2,9 +2,6 @@
 # @LANG: ruby
 #
 
-neg = false
-val = 0
-
 %%{
     machine atoi3;
     action begin {
@@ -33,7 +30,6 @@ def run_machine( data )
        p = 0;
        pe = data.length
        cs = 0
-       cs = 0
        val = 0;
        neg = false;
 
diff --git a/test/ruby1.rl b/test/ruby1.rl
new file mode 100644 (file)
index 0000000..003ebc9
--- /dev/null
@@ -0,0 +1,57 @@
+#
+# @LANG: ruby
+#
+# Test the host language scanning for ruby.
+#
+
+# %%{
+a = 1
+b = /%%\{\}/;
+
+%%{
+    machine ruby1;
+
+    main := lower+ digit+ '\n' @{
+
+               # }
+               c = 1
+               d = /\}/
+               puts "NL"
+       };
+}%%
+
+# %%{
+e = 1
+f = /%%\{\}/;
+
+%% write data;
+
+# %%{
+g = 1
+h = /%%\{\}/;
+
+def run_machine( data )
+       p = 0;
+       pe = data.length
+       cs = 0
+
+       %% write init;
+       %% write exec;
+       %% write eof;
+       if  cs >= ruby1_first_final
+               puts "ACCEPT"
+       else
+               puts "FAIL"
+       end
+end
+
+inp = [
+               "abc1231\n",
+]
+
+inp.each { |str| run_machine(str) }
+
+=begin _____OUTPUT_____
+NL
+ACCEPT
+=end _____OUTPUT_____