parser.rb 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. #
  2. # DO NOT MODIFY!!!!
  3. # This file is automatically generated by Racc 1.4.6
  4. # from Racc grammer file "".
  5. #
  6. require 'racc/parser.rb'
  7. require 'journey/parser_extras'
  8. module Journey
  9. class Parser < Racc::Parser
  10. ##### State transition tables begin ###
  11. racc_action_table = [
  12. 17, 22, 13, 15, 14, 7, 15, 16, 8, 19,
  13. 13, 15, 14, 7, 24, 16, 8, 19, 13, 15,
  14. 14, 7, nil, 16, 8, 13, 15, 14, 7, nil,
  15. 16, 8, 13, 15, 14, 7, nil, 16, 8 ]
  16. racc_action_check = [
  17. 1, 17, 1, 1, 1, 1, 8, 1, 1, 1,
  18. 20, 20, 20, 20, 20, 20, 20, 20, 7, 7,
  19. 7, 7, nil, 7, 7, 19, 19, 19, 19, nil,
  20. 19, 19, 0, 0, 0, 0, nil, 0, 0 ]
  21. racc_action_pointer = [
  22. 30, 0, nil, nil, nil, nil, nil, 16, 3, nil,
  23. nil, nil, nil, nil, nil, nil, nil, 1, nil, 23,
  24. 8, nil, nil, nil, nil ]
  25. racc_action_default = [
  26. -18, -18, -2, -3, -4, -5, -6, -18, -18, -10,
  27. -11, -12, -13, -14, -15, -16, -17, -18, -1, -18,
  28. -18, -9, 25, -8, -7 ]
  29. racc_goto_table = [
  30. 18, 1, 21, nil, nil, nil, nil, nil, 20, nil,
  31. nil, nil, nil, nil, nil, nil, nil, nil, 23, 18 ]
  32. racc_goto_check = [
  33. 2, 1, 7, nil, nil, nil, nil, nil, 1, nil,
  34. nil, nil, nil, nil, nil, nil, nil, nil, 2, 2 ]
  35. racc_goto_pointer = [
  36. nil, 1, -1, nil, nil, nil, nil, -6, nil, nil,
  37. nil ]
  38. racc_goto_default = [
  39. nil, nil, 2, 3, 4, 5, 6, 10, 9, 11,
  40. 12 ]
  41. racc_reduce_table = [
  42. 0, 0, :racc_error,
  43. 2, 11, :_reduce_1,
  44. 1, 11, :_reduce_2,
  45. 1, 11, :_reduce_none,
  46. 1, 12, :_reduce_none,
  47. 1, 12, :_reduce_none,
  48. 1, 12, :_reduce_none,
  49. 3, 15, :_reduce_7,
  50. 3, 13, :_reduce_8,
  51. 2, 16, :_reduce_9,
  52. 1, 14, :_reduce_none,
  53. 1, 14, :_reduce_none,
  54. 1, 14, :_reduce_none,
  55. 1, 14, :_reduce_none,
  56. 1, 19, :_reduce_14,
  57. 1, 18, :_reduce_15,
  58. 1, 17, :_reduce_16,
  59. 1, 20, :_reduce_17 ]
  60. racc_reduce_n = 18
  61. racc_shift_n = 25
  62. racc_token_table = {
  63. false => 0,
  64. :error => 1,
  65. :SLASH => 2,
  66. :LITERAL => 3,
  67. :SYMBOL => 4,
  68. :LPAREN => 5,
  69. :RPAREN => 6,
  70. :DOT => 7,
  71. :STAR => 8,
  72. :OR => 9 }
  73. racc_nt_base = 10
  74. racc_use_result_var = true
  75. Racc_arg = [
  76. racc_action_table,
  77. racc_action_check,
  78. racc_action_default,
  79. racc_action_pointer,
  80. racc_goto_table,
  81. racc_goto_check,
  82. racc_goto_default,
  83. racc_goto_pointer,
  84. racc_nt_base,
  85. racc_reduce_table,
  86. racc_token_table,
  87. racc_shift_n,
  88. racc_reduce_n,
  89. racc_use_result_var ]
  90. Racc_token_to_s_table = [
  91. "$end",
  92. "error",
  93. "SLASH",
  94. "LITERAL",
  95. "SYMBOL",
  96. "LPAREN",
  97. "RPAREN",
  98. "DOT",
  99. "STAR",
  100. "OR",
  101. "$start",
  102. "expressions",
  103. "expression",
  104. "or",
  105. "terminal",
  106. "group",
  107. "star",
  108. "literal",
  109. "symbol",
  110. "slash",
  111. "dot" ]
  112. Racc_debug_parser = false
  113. ##### State transition tables end #####
  114. # reduce 0 omitted
  115. def _reduce_1(val, _values, result)
  116. result = Cat.new(val.first, val.last)
  117. result
  118. end
  119. def _reduce_2(val, _values, result)
  120. result = val.first
  121. result
  122. end
  123. # reduce 3 omitted
  124. # reduce 4 omitted
  125. # reduce 5 omitted
  126. # reduce 6 omitted
  127. def _reduce_7(val, _values, result)
  128. result = Group.new(val[1])
  129. result
  130. end
  131. def _reduce_8(val, _values, result)
  132. result = Or.new([val.first, val.last])
  133. result
  134. end
  135. def _reduce_9(val, _values, result)
  136. result = Star.new(Symbol.new(val.last.left))
  137. result
  138. end
  139. # reduce 10 omitted
  140. # reduce 11 omitted
  141. # reduce 12 omitted
  142. # reduce 13 omitted
  143. def _reduce_14(val, _values, result)
  144. result = Slash.new('/')
  145. result
  146. end
  147. def _reduce_15(val, _values, result)
  148. result = Symbol.new(val.first)
  149. result
  150. end
  151. def _reduce_16(val, _values, result)
  152. result = Literal.new(val.first)
  153. result
  154. end
  155. def _reduce_17(val, _values, result)
  156. result = Dot.new(val.first)
  157. result
  158. end
  159. def _reduce_none(val, _values, result)
  160. val[0]
  161. end
  162. end # class Parser
  163. end # module Journey