diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-04-11 22:32:51 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-04-11 22:32:51 +0000 |
commit | 71793fb3d096b74977b73fffe16bbeb8f45c94b9 (patch) | |
tree | b1d2ac064df3fbe004b216112fea8ab2a0856b15 /lib | |
parent | f522a7e4fe87de6214d1d8e5e6d587d1948117ab (diff) | |
download | puppet-71793fb3d096b74977b73fffe16bbeb8f45c94b9.tar.gz puppet-71793fb3d096b74977b73fffe16bbeb8f45c94b9.tar.xz puppet-71793fb3d096b74977b73fffe16bbeb8f45c94b9.zip |
Changing "set" to "tag"
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1106 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/parser/ast.rb | 2 | ||||
-rw-r--r-- | lib/puppet/parser/ast/tag.rb | 26 | ||||
-rw-r--r-- | lib/puppet/parser/grammar.ra | 8 | ||||
-rw-r--r-- | lib/puppet/parser/lexer.rb | 2 | ||||
-rw-r--r-- | lib/puppet/parser/parser.rb | 12 |
5 files changed, 38 insertions, 12 deletions
diff --git a/lib/puppet/parser/ast.rb b/lib/puppet/parser/ast.rb index ea494dc6d..d9bb1cb4e 100644 --- a/lib/puppet/parser/ast.rb +++ b/lib/puppet/parser/ast.rb @@ -146,6 +146,6 @@ require 'puppet/parser/ast/objectref' require 'puppet/parser/ast/selector' require 'puppet/parser/ast/typedefaults' require 'puppet/parser/ast/vardef' -require 'puppet/parser/ast/set' +require 'puppet/parser/ast/tag' # $Id$ diff --git a/lib/puppet/parser/ast/tag.rb b/lib/puppet/parser/ast/tag.rb new file mode 100644 index 000000000..ce59558f3 --- /dev/null +++ b/lib/puppet/parser/ast/tag.rb @@ -0,0 +1,26 @@ +class Puppet::Parser::AST + # The code associated with a class. This is different from components + # in that each class is a singleton -- only one will exist for a given + # node. + class Set < AST::Branch + @name = :class + attr_accessor :type + + def evaluate(hash) + scope = hash[:scope] + + types = @type.safeevaluate(:scope => scope) + + types = [types] unless types.is_a? Array + + types.each do |type| + # Now set our class. We don't have to worry about checking + # whether we've been evaluated because we're not evaluating + # any code. + scope.setclass(self.object_id, type) + end + end + end +end + +# $Id$ diff --git a/lib/puppet/parser/grammar.ra b/lib/puppet/parser/grammar.ra index c59d36809..b872f3979 100644 --- a/lib/puppet/parser/grammar.ra +++ b/lib/puppet/parser/grammar.ra @@ -7,7 +7,7 @@ class Puppet::Parser::Parser token LBRACK DQTEXT SQTEXT RBRACK LBRACE RBRACE SYMBOL FARROW COMMA TRUE FALSE EQUALS token QMARK LPAREN RPAREN ISEQUAL GREATEREQUAL GREATERTHAN LESSTHAN LESSEQUAL NOTEQUAL token IF ELSE IMPORT DEFINE ELSIF VARIABLE CLASS INHERITS NODE BOOLEAN DOT COLON TYPE -token NAME SEMIC CASE DEFAULT INCLUDE SET +token NAME SEMIC CASE DEFAULT INCLUDE TAG # We have 2 shift/reduce conflicts expect 2 @@ -59,7 +59,7 @@ statement: object | casestatement | import | include - | set + | tag | definition | hostclass | nodedef @@ -91,10 +91,10 @@ include: INCLUDE classnames { ) } -set: SET classnames { +tag: TAG classnames { classnames = aryfy(val[1]) - result = AST::Set.new( + result = AST::Tag.new( :line => @lexer.line, :file => @lexer.file, :type => val[1] diff --git a/lib/puppet/parser/lexer.rb b/lib/puppet/parser/lexer.rb index f5d2bde78..d007bb45e 100644 --- a/lib/puppet/parser/lexer.rb +++ b/lib/puppet/parser/lexer.rb @@ -54,7 +54,7 @@ module Puppet "include" => :INCLUDE, "inherits" => :INHERITS, "node" => :NODE, - "set" => :SET, + "tag" => :TAG, "true" => :BOOLEAN } diff --git a/lib/puppet/parser/parser.rb b/lib/puppet/parser/parser.rb index fb0a08338..913c6ff19 100644 --- a/lib/puppet/parser/parser.rb +++ b/lib/puppet/parser/parser.rb @@ -29,7 +29,7 @@ module Puppet class Parser < Racc::Parser -module_eval <<'..end grammar.ra modeval..idaa75576a17', 'grammar.ra', 745 +module_eval <<'..end grammar.ra modeval..idb478f6db18', 'grammar.ra', 745 attr_reader :file attr_accessor :files @@ -150,7 +150,7 @@ end # $Id$ -..end grammar.ra modeval..idaa75576a17 +..end grammar.ra modeval..idb478f6db18 ##### racc 1.4.4 generates ### @@ -483,7 +483,7 @@ racc_token_table = { :CASE => 38, :DEFAULT => 39, :INCLUDE => 40, - :SET => 41 } + :TAG => 41 } racc_use_result_var = true @@ -547,7 +547,7 @@ Racc_token_to_s_table = [ 'CASE', 'DEFAULT', 'INCLUDE', -'SET', +'TAG', '$start', 'program', 'statements', @@ -557,7 +557,7 @@ Racc_token_to_s_table = [ 'casestatement', 'import', 'include', -'set', +'tag', 'definition', 'hostclass', 'nodedef', @@ -699,7 +699,7 @@ module_eval <<'.,.,', 'grammar.ra', 102 def _reduce_14( val, _values, result ) classnames = aryfy(val[1]) - result = AST::Set.new( + result = AST::Tag.new( :line => @lexer.line, :file => @lexer.file, :type => val[1] |