diff --git a/lib/puppet/external/nagios/parser.rb b/lib/puppet/external/nagios/parser.rb index 15b302a62..e89192b3a 100644 --- a/lib/puppet/external/nagios/parser.rb +++ b/lib/puppet/external/nagios/parser.rb @@ -1,345 +1,342 @@ # # DO NOT MODIFY!!!! # This file is automatically generated by Racc 1.4.9 # from Racc grammer file "". # require 'racc/parser.rb' module Nagios class Parser < Racc::Parser module_eval(<<'...end grammar.ry/module_eval...', 'grammar.ry', 57) class ::Nagios::Parser::SyntaxError < RuntimeError; end def parse(src) @src = src # state variables @invar = false @inobject = false @done = false @line = 0 @yydebug = true do_parse end # The lexer. Very simple. def token @src.sub!(/\A\n/,'') if $& @line += 1 return [ :RETURN, "\n" ] end if @done return nil end yytext = String.new # remove comments from this line @src.sub!(/\A[ \t]*;.*\n/,"\n") if $& return [:INLINECOMMENT, ""] end @src.sub!(/\A#.*\n/,"\n") if $& return [:COMMENT, ""] end @src.sub!(/#.*/,'') if @src.length == 0 @done = true return [false, '$'] end if @invar @src.sub!(/\A[ \t]+/,'') @src.sub!(/\A([^;\n]+)(\n|;)/,'\2') if $1 yytext += $1 end @invar = false return [:VALUE, yytext] else @src.sub!(/\A[\t ]*(\S+)([\t ]*|$)/,'') if $1 yytext = $1 case yytext when 'define' #puts "got define" return [:DEFINE, yytext] when '{' #puts "got {" @inobject = true return [:LCURLY, yytext] else unless @inobject #puts "got type: #{yytext}" if yytext =~ /\W/ giveback = yytext.dup giveback.sub!(/^\w+/,'') #puts "giveback " + giveback #puts "yytext " + yytext yytext.sub!(/\W.*$/,'') #puts "yytext " + yytext #puts "all [#{giveback} #{yytext} #{orig}]" @src = giveback + @src end return [:NAME, yytext] else if yytext == '}' #puts "got closure: #{yytext}" @inobject = false return [:RCURLY, '}'] end unless @invar @invar = true return [:PARAM, $1] else end end end end end end def next_token token end def yydebug 1 end def yywrap 0 end def on_error(token, value, vstack ) msg = "" unless value.nil? msg = "line #{@line}: syntax error at '#{value}'" else msg = "line #{@line}: syntax error at '#{token}'" end unless @src.size > 0 msg = "line #{@line}: Unexpected end of file" end if token == '$end'.intern puts "okay, this is silly" else raise ::Nagios::Parser::SyntaxError, msg end end ...end grammar.ry/module_eval... ##### State transition tables begin ### racc_action_table = [ 8, 17, 7, 18, 7, 14, 12, 13, 11, 4, 6, 4, 6, 17, 10, 20, 22, 24, 25 ] racc_action_check = [ 1, 15, 1, 15, 0, 13, 8, 11, 7, 1, 1, 0, 0, 14, 6, 17, 20, 21, 23 ] racc_action_pointer = [ 2, 0, nil, nil, nil, nil, 5, 5, 6, nil, nil, 1, nil, -4, 8, -4, nil, 7, nil, nil, 5, 8, nil, 9, nil, nil ] racc_action_default = [ -15, -15, -1, -3, -4, -5, -15, -15, -15, -2, -6, -15, 26, -15, -15, -15, -8, -15, -7, -9, -13, -15, -14, -10, -11, -12 ] racc_goto_table = [ 16, 19, 2, 9, 1, 15, 21, 23 ] racc_goto_check = [ 6, 6, 2, 2, 1, 5, 7, 8 ] racc_goto_pointer = [ nil, 4, 2, nil, nil, -9, -14, -14, -14 ] racc_goto_default = [ nil, nil, nil, 3, 5, nil, nil, nil, nil ] racc_reduce_table = [ 0, 0, :racc_error, 1, 13, :_reduce_1, 2, 13, :_reduce_2, 1, 14, :_reduce_3, 1, 14, :_reduce_4, 1, 14, :_reduce_none, 2, 16, :_reduce_6, 6, 15, :_reduce_7, 1, 17, :_reduce_none, 2, 17, :_reduce_9, 4, 18, :_reduce_10, 1, 20, :_reduce_none, 2, 20, :_reduce_none, 0, 19, :_reduce_none, 1, 19, :_reduce_none ] racc_reduce_n = 15 racc_shift_n = 26 racc_token_table = { false => 0, :error => 1, :DEFINE => 2, :NAME => 3, :STRING => 4, :PARAM => 5, :LCURLY => 6, :RCURLY => 7, :VALUE => 8, :RETURN => 9, :COMMENT => 10, :INLINECOMMENT => 11 } racc_nt_base = 12 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", "DEFINE", "NAME", "STRING", "PARAM", "LCURLY", "RCURLY", "VALUE", "RETURN", "COMMENT", "INLINECOMMENT", "$start", "decls", "decl", "object", "comment", "vars", "var", "icomment", "returns" ] Racc_debug_parser = false ##### State transition tables end ##### # reduce 0 omitted module_eval(<<'.,.,', 'grammar.ry', 6) def _reduce_1(val, _values, result) - return val[0] if val[0] + return val[0] if val[0] result end .,., module_eval(<<'.,.,', 'grammar.ry', 8) def _reduce_2(val, _values, result) - if val[1].nil? - result = val[0] - else - if val[0].nil? - result = val[1] - else - result = [ val[0], val[1] ].flatten - end - end - + if val[1].nil? + result = val[0] + else + if val[0].nil? + result = val[1] + else + result = [ val[0], val[1] ].flatten + end + end result end .,., module_eval(<<'.,.,', 'grammar.ry', 20) def _reduce_3(val, _values, result) - result = [val[0]] + result = [val[0]] result end .,., module_eval(<<'.,.,', 'grammar.ry', 21) def _reduce_4(val, _values, result) - result = nil + result = nil result end .,., # reduce 5 omitted module_eval(<<'.,.,', 'grammar.ry', 25) def _reduce_6(val, _values, result) - result = nil + result = nil result end .,., module_eval(<<'.,.,', 'grammar.ry', 29) def _reduce_7(val, _values, result) - result = Nagios::Base.create(val[1],val[4]) - + result = Nagios::Base.create(val[1],val[4]) result end .,., # reduce 8 omitted module_eval(<<'.,.,', 'grammar.ry', 35) def _reduce_9(val, _values, result) - val[1].each {|p,v| - val[0][p] = v - } - result = val[0] - + val[1].each {|p,v| + val[0][p] = v + } + result = val[0] result end .,., module_eval(<<'.,.,', 'grammar.ry', 42) def _reduce_10(val, _values, result) - result = {val[0] => val[1]} + result = {val[0] => val[1]} result end .,., # reduce 11 omitted # reduce 12 omitted # reduce 13 omitted # reduce 14 omitted def _reduce_none(val, _values, result) val[0] end end # class Parser end # module Nagios