# # DO NOT MODIFY!!!! # This file is automatically generated by Racc 1.6.0 # from Racc grammar file "". # require 'racc/parser.rb' require 'strscan' module Riemann module Tools class MdstatParser < Racc::Parser module_eval(<<'...end mdstat_parser.y/module_eval...', 'mdstat_parser.y', 42) def parse(text) s = StringScanner.new(text) @tokens = [] until s.eos? do case when s.scan(/\n/) then # ignore when s.scan(/\s+/) then # ignore when s.scan(/\[=*>.*\]/) then @tokens << [:PROGRESS, s.matched] when s.scan(/%/) then @tokens << ['%', s.matched] when s.scan(/,/) then @tokens << [',', s.matched] when s.scan(/:/) then @tokens << [':', s.matched] when s.scan(//) then @tokens << ['>', s.matched] when s.scan(/\(/) then @tokens << ['(', s.matched] when s.scan(/\)/) then @tokens << [')', s.matched] when s.scan(/\./) then @tokens << ['.', s.matched] when s.scan(/\//) then @tokens << ['/', s.matched] when s.scan(/\[/) then @tokens << ['[', s.matched] when s.scan(/]/) then @tokens << [']', s.matched] when s.scan(/algorithm/) then @tokens << [:ALGORITHM, s.matched] when s.scan(/bitmap/) then @tokens << [:BITMAP, s.matched] when s.scan(/blocks/) then @tokens << [:BLOCKS, s.matched] when s.scan(/chunk/) then @tokens << [:CHUNK, s.matched] when s.scan(/finish/) then @tokens << [:FINISH, s.matched] when s.scan(/level/) then @tokens << [:LEVEL, s.matched] when s.scan(/min/) then @tokens << [:MIN, s.matched] when s.scan(/pages/) then @tokens << [:PAGES, s.matched] when s.scan(/(raid([014-6]|10)|linear|multipath|faulty)\b/) then @tokens << [:PERSONALITY, s.matched] when s.scan(/Personalities/) then @tokens << [:PERSONALITIES, s.matched] when s.scan(/recovery/) then @tokens << [:RECOVERY, s.matched] when s.scan(/speed/) then @tokens << [:SPEED, s.matched] when s.scan(/super/) then @tokens << [:SUPER, s.matched] when s.scan(/unused devices/) then @tokens << [:UNUSED_DEVICES, s.matched] when s.scan(/K\/sec/) then @tokens << [:SPEED_UNIT, s.matched.to_i] when s.scan(/KB/) then @tokens << [:BYTE_UNIT, s.matched.to_i] when s.scan(/k/) then @tokens << [:UNIT, s.matched.to_i] when s.scan(/\d+\.\d+/) then @tokens << [:FLOAT, s.matched.to_i] when s.scan(/\d+/) then @tokens << [:INTEGER, s.matched.to_i] when s.scan(/F\b/) then @tokens << [:FAILED, s.matched.to_i] when s.scan(/\w+/) then @tokens << [:IDENTIFIER, s.matched] else raise s.rest end end do_parse end def next_token @tokens.shift end ...end mdstat_parser.y/module_eval... ##### State transition tables begin ### racc_action_table = [ 10, 13, 14, 10, 29, 3, 4, 6, 7, 15, 16, 17, 18, 11, 19, 20, 21, 22, 23, 24, 10, 27, 28, 31, 32, 33, 35, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 56, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88 ] racc_action_check = [ 5, 10, 10, 25, 25, 0, 1, 3, 4, 11, 12, 13, 14, 5, 15, 16, 17, 18, 19, 20, 21, 22, 23, 27, 29, 31, 32, 34, 35, 36, 37, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 55, 56, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 84, 85, 86, 87 ] racc_action_pointer = [ -10, 6, nil, -17, 8, -10, nil, nil, nil, nil, -23, -15, -15, 1, 1, -19, -1, 0, -9, 8, -7, 10, -7, -12, nil, -7, nil, 16, nil, 20, nil, -4, 5, nil, 15, 19, 4, 19, nil, 20, 2, 6, 23, 24, 14, 11, 32, 14, 10, 31, 40, 17, 33, 42, nil, 29, 23, nil, 30, 38, 19, 24, 43, 42, 22, 41, 28, 32, 47, 48, 33, 56, 51, 37, 35, 35, 58, 56, 37, 64, 61, 65, 59, nil, 54, 43, 64, 56, nil ] racc_action_default = [ -21, -21, -6, -21, -21, -21, -4, 89, -1, -5, -21, -21, -2, -21, -21, -21, -21, -21, -21, -21, -21, -21, -11, -21, -3, -21, -9, -21, -20, -21, -8, -21, -13, -10, -15, -21, -21, -21, -12, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -17, -14, -19, -21, -7, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -16, -21, -21, -21, -21, -18 ] racc_goto_table = [ 9, 1, 2, 5, 8, 12, 25, 34, 36, 55, 57, nil, nil, nil, nil, nil, 26, nil, nil, nil, 30 ] racc_goto_check = [ 6, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, nil, nil, nil, nil, nil, 6, nil, nil, nil, 6 ] racc_goto_pointer = [ nil, 1, 2, 1, -1, -1, -5, -15, -25, -26, -44, -45 ] racc_goto_default = [ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil ] racc_reduce_table = [ 0, 0, :racc_error, 3, 36, :_reduce_1, 3, 37, :_reduce_none, 4, 40, :_reduce_none, 0, 40, :_reduce_none, 2, 38, :_reduce_5, 0, 38, :_reduce_6, 19, 41, :_reduce_7, 2, 42, :_reduce_none, 1, 42, :_reduce_none, 7, 41, :_reduce_none, 4, 41, :_reduce_none, 2, 43, :_reduce_none, 0, 43, :_reduce_none, 9, 44, :_reduce_none, 0, 44, :_reduce_none, 14, 45, :_reduce_none, 0, 45, :_reduce_none, 18, 46, :_reduce_none, 0, 46, :_reduce_none, 5, 39, :_reduce_none ] racc_reduce_n = 21 racc_shift_n = 89 racc_token_table = { false => 0, :error => 1, :ALGORITHM => 2, :BITMAP => 3, :BLOCKS => 4, :BYTE_UNIT => 5, :CHUNK => 6, :FAILED => 7, :FINISH => 8, :FLOAT => 9, :IDENTIFIER => 10, :INTEGER => 11, :LEVEL => 12, :MIN => 13, :PAGES => 14, :PERSONALITIES => 15, :PERSONALITY => 16, :PROGRESS => 17, :RECOVERY => 18, :SPEED => 19, :SPEED_UNIT => 20, :SUPER => 21, :UNIT => 22, :UNUSED_DEVICES => 23, ":" => 24, "[" => 25, "]" => 26, "/" => 27, "(" => 28, ")" => 29, "," => 30, "=" => 31, "%" => 32, "<" => 33, ">" => 34 } racc_nt_base = 35 racc_use_result_var = true 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", "ALGORITHM", "BITMAP", "BLOCKS", "BYTE_UNIT", "CHUNK", "FAILED", "FINISH", "FLOAT", "IDENTIFIER", "INTEGER", "LEVEL", "MIN", "PAGES", "PERSONALITIES", "PERSONALITY", "PROGRESS", "RECOVERY", "SPEED", "SPEED_UNIT", "SUPER", "UNIT", "UNUSED_DEVICES", "\":\"", "\"[\"", "\"]\"", "\"/\"", "\"(\"", "\")\"", "\",\"", "\"=\"", "\"%\"", "\"<\"", "\">\"", "$start", "target", "personalities", "devices", "unused_devices", "list_of_personalities", "device", "list_of_devices", "super", "level", "bitmap", "restore_progress" ] Racc_debug_parser = false ##### State transition tables end ##### # reduce 0 omitted module_eval(<<'.,.,', 'mdstat_parser.y', 3) def _reduce_1(val, _values, result) result = val[1] result end .,., # reduce 2 omitted # reduce 3 omitted # reduce 4 omitted module_eval(<<'.,.,', 'mdstat_parser.y', 10) def _reduce_5(val, _values, result) result = val[0].merge(val[1]) result end .,., module_eval(<<'.,.,', 'mdstat_parser.y', 11) def _reduce_6(val, _values, result) result = {} result end .,., module_eval(<<'.,.,', 'mdstat_parser.y', 13) def _reduce_7(val, _values, result) result = { val[0] => val[15] } result end .,., # reduce 8 omitted # reduce 9 omitted # reduce 10 omitted # reduce 11 omitted # reduce 12 omitted # reduce 13 omitted # reduce 14 omitted # reduce 15 omitted # reduce 16 omitted # reduce 17 omitted # reduce 18 omitted # reduce 19 omitted # reduce 20 omitted def _reduce_none(val, _values, result) val[0] end end # class MdstatParser end # module Tools end # module Riemann