Fixed an inconsistency in the value of p following an error. In the C directly
[external/ragel.git] / test / ruby1.rl
1 #
2 # @LANG: ruby
3 #
4 # Test the host language scanning for ruby.
5 #
6
7 # %%{
8 a = 1
9 b = /%%\{\}/;
10
11 %%{
12     machine ruby1;
13
14     main := lower+ digit+ '\n' @{
15
16                 # }
17                 c = 1
18                 d = /\}/
19                 puts "NL"
20         };
21 }%%
22
23 # %%{
24 e = 1
25 f = /%%\{\}/;
26
27 %% write data;
28
29 # %%{
30 g = 1
31 h = /%%\{\}/;
32
33 def run_machine( data )
34         p = 0;
35         pe = data.length
36         cs = 0
37
38         %% write init;
39         %% write exec;
40         %% write eof;
41         if  cs >= ruby1_first_final
42                 puts "ACCEPT"
43         else
44                 puts "FAIL"
45         end
46 end
47
48 inp = [
49                 "abc1231\n",
50 ]
51
52 inp.each { |str| run_machine(str) }
53
54 =begin _____OUTPUT_____
55 NL
56 ACCEPT
57 =end _____OUTPUT_____