diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-02-08 16:00:41 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-02-08 16:00:41 +0000 |
commit | 01072a8a1f9f429d29891b32461d54b6db927e1e (patch) | |
tree | d44e1f413c70d1304ed6f854e18418d7f05c7a01 /lib/puppet/parser | |
parent | 7ca3d3dfc54c32b2e431345b919f9eaafdf327ff (diff) | |
download | puppet-01072a8a1f9f429d29891b32461d54b6db927e1e.tar.gz puppet-01072a8a1f9f429d29891b32461d54b6db927e1e.tar.xz puppet-01072a8a1f9f429d29891b32461d54b6db927e1e.zip |
replacing all occurences of "is_a?" in the parser with "instance_of?"
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@879 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/parser')
-rw-r--r-- | lib/puppet/parser/grammar.ra | 44 | ||||
-rw-r--r-- | lib/puppet/parser/parser.rb | 48 |
2 files changed, 46 insertions, 46 deletions
diff --git a/lib/puppet/parser/grammar.ra b/lib/puppet/parser/grammar.ra index 4ed100159..87a67652d 100644 --- a/lib/puppet/parser/grammar.ra +++ b/lib/puppet/parser/grammar.ra @@ -38,7 +38,7 @@ program: statements { statements: statement | statements statement { - if val[0].is_a?(AST::ASTArray) + if val[0].instance_of?(AST::ASTArray) val[0].push(val[1]) result = val[0] else @@ -99,11 +99,11 @@ classname: name #object: name LBRACE objectname COLON params endcomma RBRACE { object: name LBRACE objectinstances endsemi RBRACE { - if val[0].is_a?(AST::ASTArray) + if val[0].instance_of?(AST::ASTArray) raise Puppet::ParseError, "Invalid name" end array = val[2] - if array.is_a?(AST::ObjectInst) + if array.instance_of?(AST::ObjectInst) array = [array] end result = AST::ASTArray.new( @@ -112,7 +112,7 @@ object: name LBRACE objectinstances endsemi RBRACE { ) # this iterates across each specified objectinstance array.each { |instance| - unless instance.is_a?(AST::ObjectInst) + unless instance.instance_of?(AST::ObjectInst) raise Puppet::Dev, "Got something that isn't an instance" end # now, i need to somehow differentiate between those things with @@ -127,7 +127,7 @@ object: name LBRACE objectinstances endsemi RBRACE { ) } } | name LBRACE params endcomma RBRACE { - if val[0].is_a?(AST::ASTArray) + if val[0].instance_of?(AST::ASTArray) Puppet.notice "invalid name" raise Puppet::ParseError, "Invalid name" end @@ -144,7 +144,7 @@ object: name LBRACE objectinstances endsemi RBRACE { ) } | type LBRACE params endcomma RBRACE { # a template setting for a type - if val[0].is_a?(AST::ASTArray) + if val[0].instance_of?(AST::ASTArray) raise Puppet::ParseError, "Invalid type" end result = AST::TypeDefaults.new( @@ -166,7 +166,7 @@ objectinst: objectname COLON params { objectinstances: objectinst | objectinstances SEMIC objectinst { - if val[0].is_a?(AST::ObjectInst) + if val[0].instance_of?(AST::ObjectInst) result = AST::ASTArray.new( :line => @lexer.line, :file => @lexer.file, @@ -230,7 +230,7 @@ params: # nothing } | param { result = val[0] } | params COMMA param { - if val[0].is_a?(AST::ASTArray) + if val[0].instance_of?(AST::ASTArray) val[0].push(val[2]) result = val[0] else @@ -259,7 +259,7 @@ param: NAME FARROW rvalue { rvalues: rvalue | rvalues comma rvalue { - if val[0].is_a?(AST::ASTArray) + if val[0].instance_of?(AST::ASTArray) result = val[0].push(val[2]) else result = AST::ASTArray.new( @@ -308,7 +308,7 @@ objectref: name LBRACK rvalue RBRACK { casestatement: CASE rvalue LBRACE caseopts RBRACE { options = val[3] - unless options.is_a?(AST::ASTArray) + unless options.instance_of?(AST::ASTArray) options = AST::ASTArray.new( :line => @lexer.line, :file => @lexer.file, @@ -325,7 +325,7 @@ casestatement: CASE rvalue LBRACE caseopts RBRACE { caseopts: caseopt | caseopts caseopt { - if val[0].is_a?(AST::ASTArray) + if val[0].instance_of?(AST::ASTArray) val[0].push val[1] result = val[0] else @@ -361,7 +361,7 @@ caseopt: casevalues COLON LBRACE statements RBRACE { casevalues: selectlhand | casevalues COMMA selectlhand { - if val[0].is_a?(AST::ASTArray) + if val[0].instance_of?(AST::ASTArray) val[0].push(val[2]) result = val[0] else @@ -388,7 +388,7 @@ svalues: selectval sintvalues: selectval | sintvalues comma selectval { - if val[0].is_a?(AST::ASTArray) + if val[0].instance_of?(AST::ASTArray) val[0].push(val[2]) result = val[0] else @@ -512,7 +512,7 @@ hostclass: CLASS NAME parent LBRACE statements RBRACE { :code => val[4] } # It'll be an ASTArray if we didn't get a parent - if val[2].is_a?(AST::Name) + if val[2].instance_of?(AST::Name) args[:parentclass] = val[2] end result = AST::ClassDef.new(args) @@ -529,14 +529,14 @@ hostclass: CLASS NAME parent LBRACE statements RBRACE { ) } # It'll be an ASTArray if we didn't get a parent - if val[2].is_a?(AST::Name) + if val[2].instance_of?(AST::Name) args[:parentclass] = val[2] end result = AST::ClassDef.new(args) } nodedef: NODE names parent LBRACE statements RBRACE { - unless val[1].is_a?(AST::ASTArray) + unless val[1].instance_of?(AST::ASTArray) val[1] = AST::ASTArray.new( :line => val[1].line, :file => val[1].file, @@ -550,12 +550,12 @@ nodedef: NODE names parent LBRACE statements RBRACE { :keyword => val[0], :code => val[4] } - if val[2].is_a?(AST::Name) + if val[2].instance_of?(AST::Name) args[:parentclass] = val[2] end result = AST::NodeDef.new(args) } | NODE names parent LBRACE RBRACE { - unless val[1].is_a?(AST::ASTArray) + unless val[1].instance_of?(AST::ASTArray) val[1] = AST::ASTArray.new( :line => val[1].line, :file => val[1].file, @@ -573,7 +573,7 @@ nodedef: NODE names parent LBRACE statements RBRACE { :children => [] ) } - if val[2].is_a?(AST::Name) + if val[2].instance_of?(AST::Name) args[:parentclass] = val[2] end result = AST::NodeDef.new(args) @@ -581,7 +581,7 @@ nodedef: NODE names parent LBRACE statements RBRACE { names: name | names name { - if val[0].is_a?(AST::ASTArray) + if val[0].instance_of?(AST::ASTArray) result = val[0] result.push val[1] else @@ -665,7 +665,7 @@ variable: VARIABLE { } array: LBRACK rvalues RBRACK { - if val[1].is_a?(AST::ASTArray) + if val[1].instance_of?(AST::ASTArray) result = val[1] else result = AST::ASTArray.new( @@ -705,7 +705,7 @@ attr_accessor :files # Create an AST array out of all of the args def aryfy(*args) - if args[0].is_a?(AST::ASTArray) + if args[0].instance_of?(AST::ASTArray) result = args.shift args.each { |arg| result.push arg diff --git a/lib/puppet/parser/parser.rb b/lib/puppet/parser/parser.rb index 7ec7ae29b..ee40085d9 100644 --- a/lib/puppet/parser/parser.rb +++ b/lib/puppet/parser/parser.rb @@ -29,13 +29,13 @@ module Puppet class Parser < Racc::Parser -module_eval <<'..end grammar.ra modeval..id6f2ed69196', 'grammar.ra', 703 +module_eval <<'..end grammar.ra modeval..id4d297a9dfb', 'grammar.ra', 703 attr_reader :file attr_accessor :files # Create an AST array out of all of the args def aryfy(*args) - if args[0].is_a?(AST::ASTArray) + if args[0].instance_of?(AST::ASTArray) result = args.shift args.each { |arg| result.push arg @@ -144,7 +144,7 @@ def string=(string) end # $Id$ -..end grammar.ra modeval..id6f2ed69196 +..end grammar.ra modeval..id4d297a9dfb ##### racc 1.4.4 generates ### @@ -585,7 +585,7 @@ module_eval <<'.,.,', 'grammar.ra', 37 module_eval <<'.,.,', 'grammar.ra', 51 def _reduce_3( val, _values, result ) - if val[0].is_a?(AST::ASTArray) + if val[0].instance_of?(AST::ASTArray) val[0].push(val[1]) result = val[0] else @@ -660,11 +660,11 @@ module_eval <<'.,.,', 'grammar.ra', 95 module_eval <<'.,.,', 'grammar.ra', 129 def _reduce_17( val, _values, result ) - if val[0].is_a?(AST::ASTArray) + if val[0].instance_of?(AST::ASTArray) raise Puppet::ParseError, "Invalid name" end array = val[2] - if array.is_a?(AST::ObjectInst) + if array.instance_of?(AST::ObjectInst) array = [array] end result = AST::ASTArray.new( @@ -673,7 +673,7 @@ module_eval <<'.,.,', 'grammar.ra', 129 ) # this iterates across each specified objectinstance array.each { |instance| - unless instance.is_a?(AST::ObjectInst) + unless instance.instance_of?(AST::ObjectInst) raise Puppet::Dev, "Got something that isn't an instance" end # now, i need to somehow differentiate between those things with @@ -693,7 +693,7 @@ module_eval <<'.,.,', 'grammar.ra', 129 module_eval <<'.,.,', 'grammar.ra', 145 def _reduce_18( val, _values, result ) - if val[0].is_a?(AST::ASTArray) + if val[0].instance_of?(AST::ASTArray) Puppet.notice "invalid name" raise Puppet::ParseError, "Invalid name" end @@ -715,7 +715,7 @@ module_eval <<'.,.,', 'grammar.ra', 145 module_eval <<'.,.,', 'grammar.ra', 157 def _reduce_19( val, _values, result ) # a template setting for a type - if val[0].is_a?(AST::ASTArray) + if val[0].instance_of?(AST::ASTArray) raise Puppet::ParseError, "Invalid type" end result = AST::TypeDefaults.new( @@ -744,7 +744,7 @@ module_eval <<'.,.,', 'grammar.ra', 165 module_eval <<'.,.,', 'grammar.ra', 179 def _reduce_22( val, _values, result ) - if val[0].is_a?(AST::ObjectInst) + if val[0].instance_of?(AST::ObjectInst) result = AST::ASTArray.new( :line => @lexer.line, :file => @lexer.file, @@ -835,7 +835,7 @@ module_eval <<'.,.,', 'grammar.ra', 230 module_eval <<'.,.,', 'grammar.ra', 243 def _reduce_36( val, _values, result ) - if val[0].is_a?(AST::ASTArray) + if val[0].instance_of?(AST::ASTArray) val[0].push(val[2]) result = val[0] else @@ -871,7 +871,7 @@ module_eval <<'.,.,', 'grammar.ra', 258 module_eval <<'.,.,', 'grammar.ra', 271 def _reduce_39( val, _values, result ) - if val[0].is_a?(AST::ASTArray) + if val[0].instance_of?(AST::ASTArray) result = val[0].push(val[2]) else result = AST::ASTArray.new( @@ -940,7 +940,7 @@ module_eval <<'.,.,', 'grammar.ra', 307 module_eval <<'.,.,', 'grammar.ra', 324 def _reduce_52( val, _values, result ) options = val[3] - unless options.is_a?(AST::ASTArray) + unless options.instance_of?(AST::ASTArray) options = AST::ASTArray.new( :line => @lexer.line, :file => @lexer.file, @@ -961,7 +961,7 @@ module_eval <<'.,.,', 'grammar.ra', 324 module_eval <<'.,.,', 'grammar.ra', 338 def _reduce_54( val, _values, result ) - if val[0].is_a?(AST::ASTArray) + if val[0].instance_of?(AST::ASTArray) val[0].push val[1] result = val[0] else @@ -1009,7 +1009,7 @@ module_eval <<'.,.,', 'grammar.ra', 360 module_eval <<'.,.,', 'grammar.ra', 374 def _reduce_58( val, _values, result ) - if val[0].is_a?(AST::ASTArray) + if val[0].instance_of?(AST::ASTArray) val[0].push(val[2]) result = val[0] else @@ -1049,7 +1049,7 @@ module_eval <<'.,.,', 'grammar.ra', 386 module_eval <<'.,.,', 'grammar.ra', 401 def _reduce_63( val, _values, result ) - if val[0].is_a?(AST::ASTArray) + if val[0].instance_of?(AST::ASTArray) val[0].push(val[2]) result = val[0] else @@ -1205,7 +1205,7 @@ module_eval <<'.,.,', 'grammar.ra', 519 :code => val[4] } # It'll be an ASTArray if we didn't get a parent - if val[2].is_a?(AST::Name) + if val[2].instance_of?(AST::Name) args[:parentclass] = val[2] end result = AST::ClassDef.new(args) @@ -1227,7 +1227,7 @@ module_eval <<'.,.,', 'grammar.ra', 536 ) } # It'll be an ASTArray if we didn't get a parent - if val[2].is_a?(AST::Name) + if val[2].instance_of?(AST::Name) args[:parentclass] = val[2] end result = AST::ClassDef.new(args) @@ -1237,7 +1237,7 @@ module_eval <<'.,.,', 'grammar.ra', 536 module_eval <<'.,.,', 'grammar.ra', 557 def _reduce_75( val, _values, result ) - unless val[1].is_a?(AST::ASTArray) + unless val[1].instance_of?(AST::ASTArray) val[1] = AST::ASTArray.new( :line => val[1].line, :file => val[1].file, @@ -1251,7 +1251,7 @@ module_eval <<'.,.,', 'grammar.ra', 557 :keyword => val[0], :code => val[4] } - if val[2].is_a?(AST::Name) + if val[2].instance_of?(AST::Name) args[:parentclass] = val[2] end result = AST::NodeDef.new(args) @@ -1261,7 +1261,7 @@ module_eval <<'.,.,', 'grammar.ra', 557 module_eval <<'.,.,', 'grammar.ra', 580 def _reduce_76( val, _values, result ) - unless val[1].is_a?(AST::ASTArray) + unless val[1].instance_of?(AST::ASTArray) val[1] = AST::ASTArray.new( :line => val[1].line, :file => val[1].file, @@ -1279,7 +1279,7 @@ module_eval <<'.,.,', 'grammar.ra', 580 :children => [] ) } - if val[2].is_a?(AST::Name) + if val[2].instance_of?(AST::Name) args[:parentclass] = val[2] end result = AST::NodeDef.new(args) @@ -1291,7 +1291,7 @@ module_eval <<'.,.,', 'grammar.ra', 580 module_eval <<'.,.,', 'grammar.ra', 594 def _reduce_78( val, _values, result ) - if val[0].is_a?(AST::ASTArray) + if val[0].instance_of?(AST::ASTArray) result = val[0] result.push val[1] else @@ -1407,7 +1407,7 @@ module_eval <<'.,.,', 'grammar.ra', 665 module_eval <<'.,.,', 'grammar.ra', 677 def _reduce_90( val, _values, result ) - if val[1].is_a?(AST::ASTArray) + if val[1].instance_of?(AST::ASTArray) result = val[1] else result = AST::ASTArray.new( |