racc (1.4.5-1) packages/racc/test/tab/scan

Summary

 packages/racc/test/tab/scan |  158 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 158 insertions(+)

    
download this patch

Patch contents

--- racc-1.4.5.orig/packages/racc/test/tab/scan
+++ racc-1.4.5/packages/racc/test/tab/scan
@@ -0,0 +1,158 @@
+#
+# DO NOT MODIFY!!!!
+# This file is automatically generated by racc 1.4.5
+# from racc grammer file "scan.y".
+#
+
+require 'racc/parser'
+
+
+class P < Racc::Parser
+
+module_eval <<'..end scan.y modeval..id649bfd5894', 'scan.y', 36
+
+  def parse
+    @sstring = @dstring = nil
+    @regexp = nil
+    @pre_match = @matched = @post_match = @m = nil
+
+    @src = [[:A, 'A'], [false, '$']]
+    do_parse
+
+    assert_equal 'squote string', @sstring
+    assert_equal 'dquote string', @dstring
+    assert_equal /some regexp with spaces/, @regexp
+    assert_equal 'some ', @pre_match
+    assert_equal 'regexp', @matched
+    assert_equal ' matches to this string', @post_match
+    assert_instance_of MatchingData, @m
+  end
+
+  def assert_equal(ok, data)
+    unless ok == data
+      raise "expected <#{ok.inspect}> but is <#{data.inspect}>"
+    end
+  end
+
+  def assert_instance_of(klass, obj)
+    unless obj.instance_of?(klass)
+      raise "expected #{klass} but is #{obj.class}"
+    end
+  end
+
+  def next_token
+    @src.shift
+  end
+
+..end scan.y modeval..id649bfd5894
+
+##### racc 1.4.5 generates ###
+
+racc_reduce_table = [
+ 0, 0, :racc_error,
+ 1, 4, :_reduce_1 ]
+
+racc_reduce_n = 2
+
+racc_shift_n = 5
+
+racc_action_table = [
+     1,     3,     4 ]
+
+racc_action_check = [
+     0,     2,     3 ]
+
+racc_action_pointer = [
+    -2,   nil,     1,     2,   nil ]
+
+racc_action_default = [
+    -2,    -1,    -2,    -2,     5 ]
+
+racc_goto_table = [
+     2 ]
+
+racc_goto_check = [
+     1 ]
+
+racc_goto_pointer = [
+   nil,     0 ]
+
+racc_goto_default = [
+   nil,   nil ]
+
+racc_token_table = {
+ false => 0,
+ Object.new => 1,
+ :A => 2 }
+
+racc_use_result_var = true
+
+racc_nt_base = 3
+
+Racc_arg = [
+ racc_action_table,
+ racc_action_check,
+ racc_action_default,
+ racc_action_pointer,
+ racc_goto_table,
+ racc_goto_check,
+ racc_goto_default,
+ racc_goto_pointer,
+ racc_nt_base,
+ racc_reduce_table,
+ racc_token_table,
+ racc_shift_n,
+ racc_reduce_n,
+ racc_use_result_var ]
+
+Racc_token_to_s_table = [
+'$end',
+'error',
+'A',
+'$start',
+'a']
+
+Racc_debug_parser = false
+
+##### racc system variables end #####
+
+ # reduce 0 omitted
+
+module_eval <<'.,.,', 'scan.y', 31
+  def _reduce_1( val, _values, result )
+        # comment test
+
+        # comment test
+
+        # string
+        @sstring = 'squote string'
+        @dstring = 'dquote string'
+
+        # regexp
+        @regexp  = /some regexp with spaces/
+
+        # gvar
+        /regexp/ === 'some regexp matches to this string'
+        @pre_match = $`
+        @matched = $&
+        @post_match = $'
+        @m = $~
+
+        # braces
+        @array = []
+        [1,2,3].each {|i|
+          @array.push i
+        }
+        3.times { @array.push 10 }
+   result
+  end
+.,.,
+
+ def _reduce_none( val, _values, result )
+  result
+ end
+
+end   # class P
+
+
+P.new.parse