# # DO NOT MODIFY!!!! # This file is automatically generated by Racc 1.4.11 # from Racc grammer file "". # require 'racc/parser.rb' require 'strscan' module Rhcl class Parse < Racc::Parser module_eval(<<'...end parse.y/module_eval...', 'parse.y', 107) def initialize(obj) src = obj.is_a?(IO) ? obj.read : obj.to_s @ss = StringScanner.new(src) end def scan tok = nil until @ss.eos? if (tok = @ss.scan /\s+/) # nothing to do elsif (tok = @ss.scan(/#/)) @ss.scan_until(/\n/) elsif (tok = @ss.scan(%r|/|)) case @ss.getch when '/' @ss.scan_until(/(\n|\z)/) when '*' nested = 1 until nested.zero? case @ss.scan_until(%r{(/\*|\*/|\z)}) when %r|/\*\z| nested += 1 when %r|\*/\z| nested -= 1 else break end end else raise "comment expected, got '#{tok}'" end elsif (tok = @ss.scan(/-?\d+\.\d+/)) yield [:FLOAT, tok.to_f] elsif (tok = @ss.scan(/-?\d+/)) yield [:INTEGER, tok.to_i] elsif (tok = @ss.scan(/,/)) yield [:COMMA, tok] elsif (tok = @ss.scan(/\=/)) yield [:EQUAL, tok] elsif (tok = @ss.scan(/\[/)) yield [:LEFTBRACKET, tok] elsif (tok = @ss.scan(/\]/)) yield [:RIGHTBRACKET, tok] elsif (tok = @ss.scan(/\{/)) yield [:LEFTBRACE, tok] elsif (tok = @ss.scan(/\}/)) yield [:RIGHTBRACE, tok] elsif (tok = @ss.scan(/"/)) yield [:STRING, (@ss.scan_until(/("|\z)/) || '').sub(/"\z/, '')] else identifier = (@ss.scan_until(/(\s|\z)/) || '').sub(/\s\z/, '') token_type = :IDENTIFIER if ['true', 'false'].include?(identifier) identifier = !!(identifier =~ /true/) token_type = :BOOL end yield [token_type, identifier] end end yield [false, '$end'] end private :scan def parse yyparse self, :scan end def self.parse(obj) self.new(obj).parse end ...end parse.y/module_eval... ##### State transition tables begin ### racc_action_table = [ 10, 31, 32, 9, 16, 17, 20, 7, 14, 21, 22, 3, nil, 29, 6, 26, nil, 21, 22, 10, 3, 13, 29, 6, 6, nil, 21, 22, 30, 3, 24, 3, 6, nil, 6 ] racc_action_check = [ 9, 25, 25, 3, 9, 9, 9, 1, 7, 9, 9, 1, nil, 20, 1, 20, nil, 20, 20, 5, 0, 5, 32, 0, 5, nil, 32, 32, 23, 23, 10, 10, 23, nil, 10 ] racc_action_pointer = [ 16, 7, nil, -2, nil, 17, nil, 8, nil, -2, 27, nil, nil, nil, nil, nil, nil, nil, nil, nil, 6, nil, nil, 25, nil, -8, nil, nil, nil, nil, nil, nil, 15, nil ] racc_action_default = [ -23, -23, -1, -13, -10, -23, -14, -23, -2, -23, -23, -11, -12, -13, 34, -5, -6, -7, -8, -9, -23, -21, -22, -23, -4, -23, -16, -17, -19, -20, -3, -15, -23, -18 ] racc_goto_table = [ 8, 27, 1, 11, 12, 15, 25, 18, 19, nil, nil, nil, 23, 33, nil, nil, nil, nil, nil, nil, nil, nil, 8 ] racc_goto_check = [ 2, 9, 1, 3, 6, 4, 8, 3, 5, nil, nil, nil, 1, 9, nil, nil, nil, nil, nil, nil, nil, nil, 2 ] racc_goto_pointer = [ nil, 2, -1, -2, -4, -1, -1, nil, -14, -19 ] racc_goto_default = [ nil, nil, 2, nil, 28, nil, 4, 5, nil, nil ] racc_reduce_table = [ 0, 0, :racc_error, 1, 14, :_reduce_1, 2, 14, :_reduce_2, 3, 16, :_reduce_3, 2, 16, :_reduce_4, 3, 15, :_reduce_5, 3, 15, :_reduce_6, 3, 15, :_reduce_7, 3, 15, :_reduce_8, 3, 15, :_reduce_9, 1, 15, :_reduce_10, 2, 19, :_reduce_11, 2, 19, :_reduce_12, 1, 20, :_reduce_13, 1, 20, :_reduce_14, 3, 18, :_reduce_15, 2, 18, :_reduce_16, 1, 21, :_reduce_17, 3, 21, :_reduce_18, 1, 22, :_reduce_19, 1, 22, :_reduce_20, 1, 17, :_reduce_21, 1, 17, :_reduce_22 ] racc_reduce_n = 23 racc_shift_n = 34 racc_token_table = { false => 0, :error => 1, :LEFTBRACE => 2, :RIGHTBRACE => 3, :IDENTIFIER => 4, :EQUAL => 5, :BOOL => 6, :STRING => 7, :LEFTBRACKET => 8, :RIGHTBRACKET => 9, :COMMA => 10, :INTEGER => 11, :FLOAT => 12 } racc_nt_base = 13 racc_use_result_var = false 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", "LEFTBRACE", "RIGHTBRACE", "IDENTIFIER", "EQUAL", "BOOL", "STRING", "LEFTBRACKET", "RIGHTBRACKET", "COMMA", "INTEGER", "FLOAT", "$start", "objectlist", "objectitem", "object", "number", "list", "block", "blockId", "listitems", "listitem" ] Racc_debug_parser = false ##### State transition tables end ##### # reduce 0 omitted module_eval(<<'.,.,', 'parse.y', 5) def _reduce_1(val, _values) val[0] end .,., module_eval(<<'.,.,', 'parse.y', 9) def _reduce_2(val, _values) val[0].deep_merge(val[1]) end .,., module_eval(<<'.,.,', 'parse.y', 14) def _reduce_3(val, _values) val[1] end .,., module_eval(<<'.,.,', 'parse.y', 18) def _reduce_4(val, _values) {} end .,., module_eval(<<'.,.,', 'parse.y', 23) def _reduce_5(val, _values) {val[0] => val[2]} end .,., module_eval(<<'.,.,', 'parse.y', 27) def _reduce_6(val, _values) {val[0] => val[2]} end .,., module_eval(<<'.,.,', 'parse.y', 31) def _reduce_7(val, _values) {val[0] => val[2]} end .,., module_eval(<<'.,.,', 'parse.y', 35) def _reduce_8(val, _values) {val[0] => val[2]} end .,., module_eval(<<'.,.,', 'parse.y', 39) def _reduce_9(val, _values) {val[0] => val[2]} end .,., module_eval(<<'.,.,', 'parse.y', 43) def _reduce_10(val, _values) val[0] end .,., module_eval(<<'.,.,', 'parse.y', 48) def _reduce_11(val, _values) {val[0] => val[1]} end .,., module_eval(<<'.,.,', 'parse.y', 52) def _reduce_12(val, _values) {val[0] => val[1]} end .,., module_eval(<<'.,.,', 'parse.y', 58) def _reduce_13(val, _values) val[0] end .,., module_eval(<<'.,.,', 'parse.y', 62) def _reduce_14(val, _values) val[0] end .,., module_eval(<<'.,.,', 'parse.y', 67) def _reduce_15(val, _values) val[1] end .,., module_eval(<<'.,.,', 'parse.y', 71) def _reduce_16(val, _values) [] end .,., module_eval(<<'.,.,', 'parse.y', 76) def _reduce_17(val, _values) [val[0]] end .,., module_eval(<<'.,.,', 'parse.y', 80) def _reduce_18(val, _values) val[0] + [val[2]] end .,., module_eval(<<'.,.,', 'parse.y', 85) def _reduce_19(val, _values) val[0] end .,., module_eval(<<'.,.,', 'parse.y', 89) def _reduce_20(val, _values) val[0] end .,., module_eval(<<'.,.,', 'parse.y', 94) def _reduce_21(val, _values) val[0] end .,., module_eval(<<'.,.,', 'parse.y', 98) def _reduce_22(val, _values) val[0] end .,., def _reduce_none(val, _values) val[0] end end # class Parse end # module Rhcl