# # DO NOT MODIFY!!!! # This file is automatically generated by Racc 1.6.2 # 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', 58) 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(/\([WJFSR]\)/) then s.push_token(:DISK_STATUS) when s.scan(//) then s.push_token(:NONE) 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(/DELAYED\b/) then s.push_token(:DELAYED) when s.scan(/KB\b/) then s.push_token(:BYTE_UNIT) when s.scan(/K\/sec\b/) then s.push_token(:SPEED_UNIT) when s.scan(/PENDING\b/) then s.push_token(:PENDING) when s.scan(/Personalities :/) then s.push_token(:PERSONALITIES) when s.scan(/REMOTE\b/) then s.push_token(:REMOTE) when s.scan(/algorithm\b/) then s.push_token(:ALGORITHM) when s.scan(/bitmap\b/) then s.push_token(:BITMAP) when s.scan(/blocks\b/) then s.push_token(:BLOCKS) when s.scan(/check\b/) then s.push_token(:CHECK) when s.scan(/chunk\b/) then s.push_token(:CHUNK) when s.scan(/finish\b/) then s.push_token(:FINISH) when s.scan(/k\b/) then s.push_token(:UNIT) when s.scan(/level\b/) then s.push_token(:LEVEL) when s.scan(/min\b/) then s.push_token(:MIN) when s.scan(/pages\b/) then s.push_token(:PAGES) when s.scan(/(raid([014-6]|10)|linear|multipath|faulty)\b/) then s.push_token(:PERSONALITY) when s.scan(/recover\b/) then s.push_token(:RECOVER) when s.scan(/recovery\b/) then s.push_token(:RECOVERY) when s.scan(/reshape\b/) then s.push_token(:RESHAPE) when s.scan(/resync\b/) then s.push_token(:RESYNC) when s.scan(/speed\b/) then s.push_token(:SPEED) when s.scan(/super\b/) then s.push_token(:SUPER) when s.scan(/unused devices:/) then s.push_token(:UNUSED_DEVICES) 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(/\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 = [ 60, 17, 10, 53, 54, 15, 73, 55, 56, 14, 3, 13, 10, 28, 4, 7, 12, 61, 72, 62, 63, 11, 71, 18, 19, 20, 21, 22, 23, 24, 10, 27, 30, 32, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 58, 64, 65, 66, 67, 68, 69, 70, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100 ] racc_action_check = [ 53, 11, 5, 50, 50, 11, 66, 50, 50, 10, 0, 10, 25, 25, 1, 4, 6, 53, 66, 53, 53, 5, 66, 12, 13, 14, 16, 18, 19, 20, 23, 24, 28, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 52, 54, 55, 56, 58, 59, 64, 65, 67, 68, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97, 98, 99 ] racc_action_pointer = [ -8, 14, nil, nil, 15, -10, -16, nil, nil, nil, -23, -11, 4, 12, 12, nil, 14, nil, -6, 9, -4, nil, nil, 18, 22, 0, nil, nil, 28, nil, 4, 20, 24, 4, 24, nil, 25, 3, 5, 28, 29, 13, 11, 38, 14, 11, 36, 47, 17, 38, -18, nil, 49, -6, 16, 17, 18, nil, 22, 20, nil, nil, nil, nil, 34, 35, -2, 47, 50, nil, nil, nil, nil, nil, 27, 25, 51, 26, 49, 54, 36, 34, 57, 58, 67, 33, 41, 65, 40, 40, 65, 68, 75, 66, 75, 56, nil, 47, 72, 58, nil ] racc_action_default = [ -33, -33, -6, -4, -33, -33, -2, 101, -1, -5, -33, -33, -33, -33, -33, -29, -30, -32, -33, -33, -33, -31, -3, -33, -11, -33, -9, -10, -33, -8, -13, -15, -33, -33, -33, -12, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -24, -14, -17, -33, -33, -33, -33, -7, -33, -33, -25, -26, -27, -28, -33, -33, -33, -33, -33, -19, -20, -21, -22, -23, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -16, -33, -33, -33, -18 ] racc_goto_table = [ 9, 1, 2, 5, 8, 6, 25, 31, 33, 52, 57, 59, 16, nil, nil, nil, nil, nil, 26, nil, 29 ] racc_goto_check = [ 6, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13, nil, nil, nil, nil, nil, 6, nil, 6 ] racc_goto_pointer = [ nil, 1, 2, 1, -1, 2, -5, -17, -23, -23, -41, -42, -42, 1 ] racc_goto_default = [ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil ] racc_reduce_table = [ 0, 0, :racc_error, 3, 42, :_reduce_1, 2, 43, :_reduce_none, 4, 46, :_reduce_none, 0, 46, :_reduce_none, 2, 44, :_reduce_5, 0, 44, :_reduce_6, 19, 47, :_reduce_7, 2, 48, :_reduce_none, 1, 48, :_reduce_none, 5, 47, :_reduce_none, 4, 47, :_reduce_none, 2, 49, :_reduce_none, 0, 49, :_reduce_none, 9, 50, :_reduce_none, 0, 50, :_reduce_none, 14, 52, :_reduce_none, 0, 52, :_reduce_none, 18, 51, :_reduce_none, 3, 51, :_reduce_none, 3, 51, :_reduce_none, 3, 51, :_reduce_none, 3, 51, :_reduce_none, 3, 51, :_reduce_none, 0, 51, :_reduce_none, 1, 53, :_reduce_none, 1, 53, :_reduce_none, 1, 53, :_reduce_none, 1, 53, :_reduce_none, 2, 45, :_reduce_none, 2, 45, :_reduce_none, 2, 54, :_reduce_none, 1, 54, :_reduce_none ] racc_reduce_n = 33 racc_shift_n = 101 racc_token_table = { false => 0, :error => 1, :ALGORITHM => 2, :BITMAP => 3, :BLOCKS => 4, :BYTE_UNIT => 5, :CHECK => 6, :CHUNK => 7, :DELAYED => 8, :DISK_STATUS => 9, :FINISH => 10, :FLOAT => 11, :IDENTIFIER => 12, :INTEGER => 13, :LEVEL => 14, :MIN => 15, :NONE => 16, :PAGES => 17, :PERSONALITIES => 18, :PERSONALITY => 19, :PENDING => 20, :PROGRESS => 21, :RECOVER => 22, :RECOVERY => 23, :REMOTE => 24, :RESHAPE => 25, :RESYNC => 26, :SPEED => 27, :SPEED_UNIT => 28, :SUPER => 29, :UNIT => 30, :UNUSED_DEVICES => 31, "[" => 32, "]" => 33, ":" => 34, "/" => 35, "," => 36, "=" => 37, "%" => 38, "(" => 39, ")" => 40 } racc_nt_base = 41 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", "DELAYED", "DISK_STATUS", "FINISH", "FLOAT", "IDENTIFIER", "INTEGER", "LEVEL", "MIN", "NONE", "PAGES", "PERSONALITIES", "PERSONALITY", "PENDING", "PROGRESS", "RECOVER", "RECOVERY", "REMOTE", "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", "identifiers" ] 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 # reduce 25 omitted # reduce 26 omitted # reduce 27 omitted # reduce 28 omitted # reduce 29 omitted # reduce 30 omitted # reduce 31 omitted # reduce 32 omitted def _reduce_none(val, _values, result) val[0] end end # class MdstatParser end # module Tools end # module Riemann