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