lib/riemann/tools/mdstat_parser.tab.rb in riemann-tools-1.5.0 vs lib/riemann/tools/mdstat_parser.tab.rb in riemann-tools-1.6.0

- old
+ new

@@ -13,57 +13,63 @@ module Riemann module Tools class MdstatParser < Racc::Parser -module_eval(<<'...end mdstat_parser.y/module_eval...', 'mdstat_parser.y', 49) +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(/\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(/\[/) 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(/\([WJFSR]\)/) then s.push_token(:DISK_STATUS) + when s.scan(/<none>/) 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(/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) + 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 @@ -81,143 +87,158 @@ 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 ] + 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 = [ - 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 ] + 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 = [ - -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 ] + -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 = [ - -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 ] + -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, 12, 25, 34, 36, 55, - 57, 59, nil, nil, nil, nil, 26, nil, nil, nil, - 30 ] + 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, nil, nil, nil, nil, 6, nil, nil, nil, + 11, 12, 13, nil, nil, nil, nil, nil, 6, nil, 6 ] racc_goto_pointer = [ - nil, 1, 2, 1, -1, -1, -5, -15, -25, -26, - -44, -45, -45 ] + 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, 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, + 3, 42, :_reduce_1, + 2, 43, :_reduce_none, + 4, 46, :_reduce_none, 0, 46, :_reduce_none, - 9, 47, :_reduce_none, - 0, 47, :_reduce_none, - 14, 49, :_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, - 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 ] + 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 = 25 +racc_reduce_n = 33 -racc_shift_n = 93 +racc_shift_n = 101 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 } + :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 = 38 +racc_nt_base = 41 racc_use_result_var = true Racc_arg = [ racc_action_table, @@ -242,40 +263,43 @@ "BITMAP", "BLOCKS", "BYTE_UNIT", "CHECK", "CHUNK", - "FAILED", + "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", @@ -284,11 +308,12 @@ "list_of_devices", "super", "level", "progress", "bitmap", - "progress_action" ] + "progress_action", + "identifiers" ] Racc_debug_parser = false ##### State transition tables end ##### @@ -359,9 +384,25 @@ # 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