diff options
author | Brice Figureau <brice-puppet@daysofwonder.com> | 2009-06-28 14:12:59 +0200 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2009-07-10 10:57:38 +1000 |
commit | faefd92c78f69580204c40179f3f0b766b0208fb (patch) | |
tree | 72c7c6e580e32d094126df532eaacc4195b3ccc7 /lib/puppet/parser | |
parent | 869ec273a085c1fa28da14bfd627ffc24af87a07 (diff) | |
download | puppet-faefd92c78f69580204c40179f3f0b766b0208fb.tar.gz puppet-faefd92c78f69580204c40179f3f0b766b0208fb.tar.xz puppet-faefd92c78f69580204c40179f3f0b766b0208fb.zip |
Make sure the parser sees the correct line number
Careful inspection of the parser code show that when we
associate a source line number for an AST node, we use the
current line number of the currently lexed token.
In many case, this is correct, but there are some cases where
this is incorrect.
Unfortunately due to how LALR parser works the ast node creation
of a statement can appear _after_ we lexed another token after
the current statement:
1. $foo = 1
2.
3. class test
When the parser asks for the class token, it can reduce the
assignement statement into the AST VarDef node, because no other
grammar rule match. Unfortunately we already lexed the class token
so we affect to the VarDef node the line number 3 instead of 1.
This is not a real issue for error reporting, but becomes a real
concern when we associate documentation comments to AST node for
puppetdoc.
The solution is to enhance the tokens lexed and returned to the parser
to carry their declaration line number.
Thus a token value becomes a hash: { :value => tokenvalue, :line }
Next, each time we create an AST node, we use the line number of
the correct token (ie the foo line number in the previous example).
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
Diffstat (limited to 'lib/puppet/parser')
-rw-r--r-- | lib/puppet/parser/grammar.ra | 119 | ||||
-rw-r--r-- | lib/puppet/parser/lexer.rb | 8 | ||||
-rw-r--r-- | lib/puppet/parser/parser.rb | 391 | ||||
-rw-r--r-- | lib/puppet/parser/parser_support.rb | 7 |
4 files changed, 292 insertions, 233 deletions
diff --git a/lib/puppet/parser/grammar.ra b/lib/puppet/parser/grammar.ra index d7828d71a..4c5d32099 100644 --- a/lib/puppet/parser/grammar.ra +++ b/lib/puppet/parser/grammar.ra @@ -75,26 +75,30 @@ statement: resource fstatement: NAME LPAREN funcvalues RPAREN { args = aryfy(val[2]) result = ast AST::Function, - :name => val[0], + :name => val[0][:value], + :line => val[0][:line], :arguments => args, :ftype => :statement } | NAME LPAREN funcvalues COMMA RPAREN { args = aryfy(val[2]) result = ast AST::Function, - :name => val[0], + :name => val[0][:value], + :line => val[0][:line], :arguments => args, :ftype => :statement } | NAME LPAREN RPAREN { result = ast AST::Function, - :name => val[0], + :name => val[0][:value], + :line => val[0][:line], :arguments => AST::ASTArray.new({}), :ftype => :statement } | NAME funcvalues { args = aryfy(val[1]) result = ast AST::Function, - :name => val[0], + :name => val[0][:value], + :line => val[0][:line], :arguments => args, :ftype => :statement } @@ -126,7 +130,7 @@ namestring: name | selector | quotedtext | CLASSNAME { - result = ast AST::Name, :value => val[0] + result = ast AST::Name, :value => val[0][:value] } resource: classname LBRACE resourceinstances endsemi RBRACE { @@ -267,15 +271,16 @@ collstatement: collexpr result.parens = true } -colljoin: AND | OR +colljoin: AND { result=val[0][:value] } + | OR { result=val[0][:value] } collexpr: colllval ISEQUAL simplervalue { - result = ast AST::CollExpr, :test1 => val[0], :oper => val[1], :test2 => val[2] + result = ast AST::CollExpr, :test1 => val[0], :oper => val[1][:value], :test2 => val[2] #result = ast AST::CollExpr #result.push *val } | colllval NOTEQUAL simplervalue { - result = ast AST::CollExpr, :test1 => val[0], :oper => val[1], :test2 => val[2] + result = ast AST::CollExpr, :test1 => val[0], :oper => val[1][:value], :test2 => val[2] #result = ast AST::CollExpr #result.push *val } @@ -305,11 +310,11 @@ undef: UNDEF { } name: NAME { - result = ast AST::Name, :value => val[0] + result = ast AST::Name, :value => val[0][:value], :line => val[0][:line] } type: CLASSREF { - result = ast AST::Type, :value => val[0] + result = ast AST::Type, :value => val[0][:value], :line => val[0][:line] } resourcename: quotedtext @@ -320,17 +325,17 @@ resourcename: quotedtext | array assignment: VARIABLE EQUALS expression { - if val[0] =~ /::/ + if val[0][:value] =~ /::/ raise Puppet::ParseError, "Cannot assign to variables in other namespaces" end # this is distinct from referencing a variable - variable = ast AST::Name, :value => val[0] - result = ast AST::VarDef, :name => variable, :value => val[2] + variable = ast AST::Name, :value => val[0][:value], :line => val[0][:line] + result = ast AST::VarDef, :name => variable, :value => val[2], :line => val[0][:line] } append: VARIABLE APPENDS expression { - variable = ast AST::Name, :value => val[0] - result = ast AST::VarDef, :name => variable, :value => val[2], :append => true + variable = ast AST::Name, :value => val[0][:value], :line => val[0][:line] + result = ast AST::VarDef, :name => variable, :value => val[2], :append => true, :line => val[0][:line] } params: # nothing @@ -348,11 +353,11 @@ params: # nothing } param: NAME FARROW rvalue { - result = ast AST::ResourceParam, :param => val[0], :value => val[2] + result = ast AST::ResourceParam, :param => val[0][:value], :line => val[0][:line], :value => val[2] } addparam: NAME PARROW rvalue { - result = ast AST::ResourceParam, :param => val[0], :value => val[2], + result = ast AST::ResourceParam, :param => val[0][:value], :line => val[0][:line], :value => val[2], :add => true } @@ -404,29 +409,29 @@ rvalue: quotedtext funcrvalue: NAME LPAREN funcvalues RPAREN { args = aryfy(val[2]) result = ast AST::Function, - :name => val[0], + :name => val[0][:value], :line => val[0][:line], :arguments => args, :ftype => :rvalue } | NAME LPAREN RPAREN { result = ast AST::Function, - :name => val[0], + :name => val[0][:value], :line => val[0][:line], :arguments => AST::ASTArray.new({}), :ftype => :rvalue } quotedtext: DQTEXT { - result = ast AST::String, :value => val[0] + result = ast AST::String, :value => val[0][:value], :line => val[0][:line] } | SQTEXT { - result = ast AST::FlatString, :value => val[0] + result = ast AST::FlatString, :value => val[0][:value], :line => val[0][:line] } boolean: BOOLEAN { - result = ast AST::Boolean, :value => val[0] + result = ast AST::Boolean, :value => val[0][:value], :line => val[0][:line] } resourceref: NAME LBRACK rvalues RBRACK { Puppet.warning addcontext("Deprecation notice: Resource references should now be capitalized") - result = ast AST::ResourceReference, :type => val[0], :title => val[2] + result = ast AST::ResourceReference, :type => val[0][:value], :line => val[0][:line], :title => val[2] } | classref LBRACK rvalues RBRACK { result = ast AST::ResourceReference, :type => val[0], :title => val[2] } @@ -482,52 +487,52 @@ else: # nothing expression: rvalue | expression PLUS expression { - result = ast AST::ArithmeticOperator, :operator => val[1], :lval => val[0], :rval => val[2] + result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] } | expression MINUS expression { - result = ast AST::ArithmeticOperator, :operator => val[1], :lval => val[0], :rval => val[2] + result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] } | expression DIV expression { - result = ast AST::ArithmeticOperator, :operator => val[1], :lval => val[0], :rval => val[2] + result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] } | expression TIMES expression { - result = ast AST::ArithmeticOperator, :operator => val[1], :lval => val[0], :rval => val[2] + result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] } | expression LSHIFT expression { - result = ast AST::ArithmeticOperator, :operator => val[1], :lval => val[0], :rval => val[2] + result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] } | expression RSHIFT expression { - result = ast AST::ArithmeticOperator, :operator => val[1], :lval => val[0], :rval => val[2] + result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] } | MINUS expression =UMINUS { result = ast AST::Minus, :value => val[1] } | expression NOTEQUAL expression { - result = ast AST::ComparisonOperator, :operator => val[1], :lval => val[0], :rval => val[2] + result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] } | expression ISEQUAL expression { - result = ast AST::ComparisonOperator, :operator => val[1], :lval => val[0], :rval => val[2] + result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] } | expression GREATERTHAN expression { - result = ast AST::ComparisonOperator, :operator => val[1], :lval => val[0], :rval => val[2] + result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] } | expression GREATEREQUAL expression { - result = ast AST::ComparisonOperator, :operator => val[1], :lval => val[0], :rval => val[2] + result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] } | expression LESSTHAN expression { - result = ast AST::ComparisonOperator, :operator => val[1], :lval => val[0], :rval => val[2] + result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] } | expression LESSEQUAL expression { - result = ast AST::ComparisonOperator, :operator => val[1], :lval => val[0], :rval => val[2] + result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] } | NOT expression { result = ast AST::Not, :value => val[1] } | expression AND expression { - result = ast AST::BooleanOperator, :operator => val[1], :lval => val[0], :rval => val[2] + result = ast AST::BooleanOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] } | expression OR expression { - result = ast AST::BooleanOperator, :operator => val[1], :lval => val[0], :rval => val[2] + result = ast AST::BooleanOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] } | LPAREN expression RPAREN { result = val[1] @@ -605,7 +610,7 @@ selectlhand: name | boolean | undef | DEFAULT { - result = ast AST::Default, :value => val[0] + result = ast AST::Default, :value => val[0][:value], :line => val[0][:line] } # These are only used for importing, and we don't interpolate there. @@ -626,14 +631,14 @@ import: IMPORT qtexts { #definition: DEFINE NAME argumentlist parent LBRACE statements RBRACE { definition: DEFINE classname argumentlist LBRACE statements RBRACE { @lexer.commentpop - newdefine classname(val[1]), :arguments => val[2], :code => val[4] + newdefine classname(val[1]), :arguments => val[2], :code => val[4], :line => val[0][:line] @lexer.indefine = false result = nil #} | DEFINE NAME argumentlist parent LBRACE RBRACE { } | DEFINE classname argumentlist LBRACE RBRACE { @lexer.commentpop - newdefine classname(val[1]), :arguments => val[2] + newdefine classname(val[1]), :arguments => val[2], :line => val[0][:line] @lexer.indefine = false result = nil } @@ -643,30 +648,30 @@ hostclass: CLASS classname classparent LBRACE statements RBRACE { @lexer.commentpop # Our class gets defined in the parent namespace, not our own. @lexer.namepop - newclass classname(val[1]), :code => val[4], :parent => val[2] + newclass classname(val[1]), :code => val[4], :parent => val[2], :line => val[0][:line] result = nil } | CLASS classname classparent LBRACE RBRACE { @lexer.commentpop # Our class gets defined in the parent namespace, not our own. @lexer.namepop - newclass classname(val[1]), :parent => val[2] + newclass classname(val[1]), :parent => val[2], :line => val[0][:line] result = nil } nodedef: NODE hostnames nodeparent LBRACE statements RBRACE { @lexer.commentpop - newnode val[1], :parent => val[2], :code => val[4] + newnode val[1], :parent => val[2], :code => val[4], :line => val[0][:line] result = nil } | NODE hostnames nodeparent LBRACE RBRACE { @lexer.commentpop - newnode val[1], :parent => val[2] + newnode val[1], :parent => val[2], :line => val[0][:line] result = nil } -classref: CLASSREF +classref: CLASSREF { result = val[0][:value] } -classname: NAME - | CLASSNAME +classname: NAME { result = val[0][:value] } + | CLASSNAME { result = val[0][:value] } # Multiple hostnames, as used for node names. These are all literal # strings, not AST objects. @@ -674,13 +679,13 @@ hostnames: hostname | hostnames COMMA hostname { result = val[0] result = [result] unless result.is_a?(Array) - result << val[2] + result << val[2][:value] } -hostname: NAME - | SQTEXT - | DQTEXT - | DEFAULT +hostname: NAME { result = val[0][:value] } + | SQTEXT { result = val[0][:value] } + | DQTEXT { result = val[0][:value] } + | DEFAULT { result = val[0][:value] } nil: { result = nil @@ -708,15 +713,15 @@ arguments: argument argument: NAME EQUALS rvalue { Puppet.warning addcontext("Deprecation notice: must now include '$' in prototype") - result = [val[0], val[2]] + result = [val[0][:value], val[2]] } | NAME { Puppet.warning addcontext("Deprecation notice: must now include '$' in prototype") - result = [val[0]] + result = [val[0][:value]] } | VARIABLE EQUALS rvalue { - result = [val[0], val[2]] + result = [val[0][:value], val[2]] } | VARIABLE { - result = [val[0]] + result = [val[0][:value]] } nodeparent: nil @@ -732,7 +737,7 @@ classparent: nil classnameordefault: classname | DEFAULT variable: VARIABLE { - result = ast AST::Variable, :value => val[0] + result = ast AST::Variable, :value => val[0][:value], :line => val[0][:line] } array: LBRACK rvalues RBRACK { diff --git a/lib/puppet/parser/lexer.rb b/lib/puppet/parser/lexer.rb index 6884e687e..e296872f9 100644 --- a/lib/puppet/parser/lexer.rb +++ b/lib/puppet/parser/lexer.rb @@ -353,7 +353,7 @@ class Puppet::Parser::Lexer return if token.skip - return token, value + return token, { :value => value, :line => @line } end # Go up one in the namespace. @@ -415,13 +415,15 @@ class Puppet::Parser::Lexer @last_return = false end - final_token, value = munge_token(matched_token, value) + final_token, token_value = munge_token(matched_token, value) unless final_token skip() next end + value = token_value[:value] + if match = @@pairs[value] and final_token.name != :DQUOTE and final_token.name != :SQUOTE @expected << match elsif exp = @expected[-1] and exp == value and final_token.name != :DQUOTE and final_token.name != :SQUOTE @@ -432,7 +434,7 @@ class Puppet::Parser::Lexer commentpush end - yield [final_token.name, value] + yield [final_token.name, token_value] if @previous_token namestack(value) if @previous_token.name == :CLASS diff --git a/lib/puppet/parser/parser.rb b/lib/puppet/parser/parser.rb index c0b5435b6..feb8436a5 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..idf6e9d74445', 'grammar.ra', 779 +module_eval <<'..end grammar.ra modeval..id53fc2ece56', 'grammar.ra', 784 # It got too annoying having code in a file that needs to be compiled. require 'puppet/parser/parser_support' @@ -41,7 +41,7 @@ require 'puppet/parser/parser_support' # $Id$ -..end grammar.ra modeval..idf6e9d74445 +..end grammar.ra modeval..id53fc2ece56 ##### racc 1.4.5 generates ### @@ -96,8 +96,8 @@ racc_reduce_table = [ 3, 96, :_reduce_47, 1, 97, :_reduce_none, 3, 97, :_reduce_49, - 1, 98, :_reduce_none, - 1, 98, :_reduce_none, + 1, 98, :_reduce_50, + 1, 98, :_reduce_51, 3, 99, :_reduce_52, 3, 99, :_reduce_53, 1, 100, :_reduce_none, @@ -206,15 +206,15 @@ racc_reduce_table = [ 5, 73, :_reduce_157, 6, 74, :_reduce_158, 5, 74, :_reduce_159, - 1, 92, :_reduce_none, - 1, 87, :_reduce_none, - 1, 87, :_reduce_none, + 1, 92, :_reduce_160, + 1, 87, :_reduce_161, + 1, 87, :_reduce_162, 1, 124, :_reduce_none, 3, 124, :_reduce_164, - 1, 126, :_reduce_none, - 1, 126, :_reduce_none, - 1, 126, :_reduce_none, - 1, 126, :_reduce_none, + 1, 126, :_reduce_165, + 1, 126, :_reduce_166, + 1, 126, :_reduce_167, + 1, 126, :_reduce_168, 0, 62, :_reduce_169, 0, 127, :_reduce_170, 1, 122, :_reduce_none, @@ -1032,43 +1032,47 @@ module_eval <<'.,.,', 'grammar.ra', 58 # reduce 17 omitted -module_eval <<'.,.,', 'grammar.ra', 81 +module_eval <<'.,.,', 'grammar.ra', 82 def _reduce_18( val, _values, result ) args = aryfy(val[2]) result = ast AST::Function, - :name => val[0], + :name => val[0][:value], + :line => val[0][:line], :arguments => args, :ftype => :statement result end .,., -module_eval <<'.,.,', 'grammar.ra', 88 +module_eval <<'.,.,', 'grammar.ra', 90 def _reduce_19( val, _values, result ) args = aryfy(val[2]) result = ast AST::Function, - :name => val[0], + :name => val[0][:value], + :line => val[0][:line], :arguments => args, :ftype => :statement result end .,., -module_eval <<'.,.,', 'grammar.ra', 93 +module_eval <<'.,.,', 'grammar.ra', 96 def _reduce_20( val, _values, result ) result = ast AST::Function, - :name => val[0], + :name => val[0][:value], + :line => val[0][:line], :arguments => AST::ASTArray.new({}), :ftype => :statement result end .,., -module_eval <<'.,.,', 'grammar.ra', 100 +module_eval <<'.,.,', 'grammar.ra', 104 def _reduce_21( val, _values, result ) args = aryfy(val[1]) result = ast AST::Function, - :name => val[0], + :name => val[0][:value], + :line => val[0][:line], :arguments => args, :ftype => :statement result @@ -1079,7 +1083,7 @@ module_eval <<'.,.,', 'grammar.ra', 100 # reduce 23 omitted -module_eval <<'.,.,', 'grammar.ra', 108 +module_eval <<'.,.,', 'grammar.ra', 112 def _reduce_24( val, _values, result ) result = aryfy(val[0], val[2]) result.line = @lexer.line @@ -1088,7 +1092,7 @@ module_eval <<'.,.,', 'grammar.ra', 108 end .,., -module_eval <<'.,.,', 'grammar.ra', 117 +module_eval <<'.,.,', 'grammar.ra', 121 def _reduce_25( val, _values, result ) unless val[0].is_a?(AST::ASTArray) val[0] = aryfy(val[0]) @@ -1115,14 +1119,14 @@ module_eval <<'.,.,', 'grammar.ra', 117 # reduce 32 omitted -module_eval <<'.,.,', 'grammar.ra', 130 +module_eval <<'.,.,', 'grammar.ra', 134 def _reduce_33( val, _values, result ) - result = ast AST::Name, :value => val[0] + result = ast AST::Name, :value => val[0][:value] result end .,., -module_eval <<'.,.,', 'grammar.ra', 152 +module_eval <<'.,.,', 'grammar.ra', 156 def _reduce_34( val, _values, result ) @lexer.commentpop array = val[2] @@ -1147,7 +1151,7 @@ module_eval <<'.,.,', 'grammar.ra', 152 end .,., -module_eval <<'.,.,', 'grammar.ra', 155 +module_eval <<'.,.,', 'grammar.ra', 159 def _reduce_35( val, _values, result ) # This is a deprecated syntax. error "All resource specifications require names" @@ -1155,7 +1159,7 @@ module_eval <<'.,.,', 'grammar.ra', 155 end .,., -module_eval <<'.,.,', 'grammar.ra', 158 +module_eval <<'.,.,', 'grammar.ra', 162 def _reduce_36( val, _values, result ) # a defaults setting for a type result = ast(AST::ResourceDefaults, :type => val[0], :params => val[2]) @@ -1163,7 +1167,7 @@ module_eval <<'.,.,', 'grammar.ra', 158 end .,., -module_eval <<'.,.,', 'grammar.ra', 164 +module_eval <<'.,.,', 'grammar.ra', 168 def _reduce_37( val, _values, result ) @lexer.commentpop result = ast AST::ResourceOverride, :object => val[0], :params => val[2] @@ -1171,7 +1175,7 @@ module_eval <<'.,.,', 'grammar.ra', 164 end .,., -module_eval <<'.,.,', 'grammar.ra', 191 +module_eval <<'.,.,', 'grammar.ra', 195 def _reduce_38( val, _values, result ) type = val[0] @@ -1199,21 +1203,21 @@ module_eval <<'.,.,', 'grammar.ra', 191 end .,., -module_eval <<'.,.,', 'grammar.ra', 192 +module_eval <<'.,.,', 'grammar.ra', 196 def _reduce_39( val, _values, result ) result = :virtual result end .,., -module_eval <<'.,.,', 'grammar.ra', 193 +module_eval <<'.,.,', 'grammar.ra', 197 def _reduce_40( val, _values, result ) result = :exported result end .,., -module_eval <<'.,.,', 'grammar.ra', 217 +module_eval <<'.,.,', 'grammar.ra', 221 def _reduce_41( val, _values, result ) if val[0] =~ /^[a-z]/ Puppet.warning addcontext("Collection names must now be capitalized") @@ -1237,7 +1241,7 @@ module_eval <<'.,.,', 'grammar.ra', 217 end .,., -module_eval <<'.,.,', 'grammar.ra', 236 +module_eval <<'.,.,', 'grammar.ra', 240 def _reduce_42( val, _values, result ) if val[0] =~ /^[a-z]/ Puppet.warning addcontext("Collection names must now be capitalized") @@ -1260,7 +1264,7 @@ module_eval <<'.,.,', 'grammar.ra', 236 end .,., -module_eval <<'.,.,', 'grammar.ra', 246 +module_eval <<'.,.,', 'grammar.ra', 250 def _reduce_43( val, _values, result ) if val[1] result = val[1] @@ -1272,7 +1276,7 @@ module_eval <<'.,.,', 'grammar.ra', 246 end .,., -module_eval <<'.,.,', 'grammar.ra', 254 +module_eval <<'.,.,', 'grammar.ra', 258 def _reduce_44( val, _values, result ) if val[1] result = val[1] @@ -1288,7 +1292,7 @@ module_eval <<'.,.,', 'grammar.ra', 254 # reduce 46 omitted -module_eval <<'.,.,', 'grammar.ra', 262 +module_eval <<'.,.,', 'grammar.ra', 266 def _reduce_47( val, _values, result ) result = ast AST::CollExpr, :test1 => val[0], :oper => val[1], :test2 => val[2] result @@ -1297,7 +1301,7 @@ module_eval <<'.,.,', 'grammar.ra', 262 # reduce 48 omitted -module_eval <<'.,.,', 'grammar.ra', 268 +module_eval <<'.,.,', 'grammar.ra', 272 def _reduce_49( val, _values, result ) result = val[1] result.parens = true @@ -1305,22 +1309,32 @@ module_eval <<'.,.,', 'grammar.ra', 268 end .,., - # reduce 50 omitted +module_eval <<'.,.,', 'grammar.ra', 273 + def _reduce_50( val, _values, result ) + result=val[0][:value] + result + end +.,., - # reduce 51 omitted +module_eval <<'.,.,', 'grammar.ra', 274 + def _reduce_51( val, _values, result ) + result=val[0][:value] + result + end +.,., -module_eval <<'.,.,', 'grammar.ra', 276 +module_eval <<'.,.,', 'grammar.ra', 281 def _reduce_52( val, _values, result ) - result = ast AST::CollExpr, :test1 => val[0], :oper => val[1], :test2 => val[2] + result = ast AST::CollExpr, :test1 => val[0], :oper => val[1][:value], :test2 => val[2] #result = ast AST::CollExpr #result.push *val result end .,., -module_eval <<'.,.,', 'grammar.ra', 281 +module_eval <<'.,.,', 'grammar.ra', 286 def _reduce_53( val, _values, result ) - result = ast AST::CollExpr, :test1 => val[0], :oper => val[1], :test2 => val[2] + result = ast AST::CollExpr, :test1 => val[0], :oper => val[1][:value], :test2 => val[2] #result = ast AST::CollExpr #result.push *val result @@ -1331,7 +1345,7 @@ module_eval <<'.,.,', 'grammar.ra', 281 # reduce 55 omitted -module_eval <<'.,.,', 'grammar.ra', 288 +module_eval <<'.,.,', 'grammar.ra', 293 def _reduce_56( val, _values, result ) result = ast AST::ResourceInstance, :children => [val[0],val[2]] result @@ -1340,7 +1354,7 @@ module_eval <<'.,.,', 'grammar.ra', 288 # reduce 57 omitted -module_eval <<'.,.,', 'grammar.ra', 298 +module_eval <<'.,.,', 'grammar.ra', 303 def _reduce_58( val, _values, result ) if val[0].instance_of?(AST::ResourceInstance) result = ast AST::ASTArray, :children => [val[0],val[2]] @@ -1356,23 +1370,23 @@ module_eval <<'.,.,', 'grammar.ra', 298 # reduce 60 omitted -module_eval <<'.,.,', 'grammar.ra', 305 +module_eval <<'.,.,', 'grammar.ra', 310 def _reduce_61( val, _values, result ) result = ast AST::Undef, :value => :undef result end .,., -module_eval <<'.,.,', 'grammar.ra', 309 +module_eval <<'.,.,', 'grammar.ra', 314 def _reduce_62( val, _values, result ) - result = ast AST::Name, :value => val[0] + result = ast AST::Name, :value => val[0][:value], :line => val[0][:line] result end .,., -module_eval <<'.,.,', 'grammar.ra', 313 +module_eval <<'.,.,', 'grammar.ra', 318 def _reduce_63( val, _values, result ) - result = ast AST::Type, :value => val[0] + result = ast AST::Type, :value => val[0][:value], :line => val[0][:line] result end .,., @@ -1389,41 +1403,41 @@ module_eval <<'.,.,', 'grammar.ra', 313 # reduce 69 omitted -module_eval <<'.,.,', 'grammar.ra', 329 +module_eval <<'.,.,', 'grammar.ra', 334 def _reduce_70( val, _values, result ) - if val[0] =~ /::/ + if val[0][:value] =~ /::/ raise Puppet::ParseError, "Cannot assign to variables in other namespaces" end # this is distinct from referencing a variable - variable = ast AST::Name, :value => val[0] - result = ast AST::VarDef, :name => variable, :value => val[2] + variable = ast AST::Name, :value => val[0][:value], :line => val[0][:line] + result = ast AST::VarDef, :name => variable, :value => val[2], :line => val[0][:line] result end .,., -module_eval <<'.,.,', 'grammar.ra', 334 +module_eval <<'.,.,', 'grammar.ra', 339 def _reduce_71( val, _values, result ) - variable = ast AST::Name, :value => val[0] - result = ast AST::VarDef, :name => variable, :value => val[2], :append => true + variable = ast AST::Name, :value => val[0][:value], :line => val[0][:line] + result = ast AST::VarDef, :name => variable, :value => val[2], :append => true, :line => val[0][:line] result end .,., -module_eval <<'.,.,', 'grammar.ra', 339 +module_eval <<'.,.,', 'grammar.ra', 344 def _reduce_72( val, _values, result ) result = ast AST::ASTArray result end .,., -module_eval <<'.,.,', 'grammar.ra', 339 +module_eval <<'.,.,', 'grammar.ra', 344 def _reduce_73( val, _values, result ) result = val[0] result end .,., -module_eval <<'.,.,', 'grammar.ra', 348 +module_eval <<'.,.,', 'grammar.ra', 353 def _reduce_74( val, _values, result ) if val[0].instance_of?(AST::ASTArray) val[0].push(val[2]) @@ -1435,16 +1449,16 @@ module_eval <<'.,.,', 'grammar.ra', 348 end .,., -module_eval <<'.,.,', 'grammar.ra', 352 +module_eval <<'.,.,', 'grammar.ra', 357 def _reduce_75( val, _values, result ) - result = ast AST::ResourceParam, :param => val[0], :value => val[2] + result = ast AST::ResourceParam, :param => val[0][:value], :line => val[0][:line], :value => val[2] result end .,., -module_eval <<'.,.,', 'grammar.ra', 357 +module_eval <<'.,.,', 'grammar.ra', 362 def _reduce_76( val, _values, result ) - result = ast AST::ResourceParam, :param => val[0], :value => val[2], + result = ast AST::ResourceParam, :param => val[0][:value], :line => val[0][:line], :value => val[2], :add => true result end @@ -1454,21 +1468,21 @@ module_eval <<'.,.,', 'grammar.ra', 357 # reduce 78 omitted -module_eval <<'.,.,', 'grammar.ra', 365 +module_eval <<'.,.,', 'grammar.ra', 370 def _reduce_79( val, _values, result ) result = ast AST::ASTArray result end .,., -module_eval <<'.,.,', 'grammar.ra', 365 +module_eval <<'.,.,', 'grammar.ra', 370 def _reduce_80( val, _values, result ) result = val[0] result end .,., -module_eval <<'.,.,', 'grammar.ra', 374 +module_eval <<'.,.,', 'grammar.ra', 379 def _reduce_81( val, _values, result ) if val[0].instance_of?(AST::ASTArray) val[0].push(val[2]) @@ -1482,7 +1496,7 @@ module_eval <<'.,.,', 'grammar.ra', 374 # reduce 82 omitted -module_eval <<'.,.,', 'grammar.ra', 383 +module_eval <<'.,.,', 'grammar.ra', 388 def _reduce_83( val, _values, result ) if val[0].instance_of?(AST::ASTArray) result = val[0].push(val[2]) @@ -1525,64 +1539,64 @@ module_eval <<'.,.,', 'grammar.ra', 383 # reduce 99 omitted -module_eval <<'.,.,', 'grammar.ra', 410 +module_eval <<'.,.,', 'grammar.ra', 415 def _reduce_100( val, _values, result ) args = aryfy(val[2]) result = ast AST::Function, - :name => val[0], + :name => val[0][:value], :line => val[0][:line], :arguments => args, :ftype => :rvalue result end .,., -module_eval <<'.,.,', 'grammar.ra', 415 +module_eval <<'.,.,', 'grammar.ra', 420 def _reduce_101( val, _values, result ) result = ast AST::Function, - :name => val[0], + :name => val[0][:value], :line => val[0][:line], :arguments => AST::ASTArray.new({}), :ftype => :rvalue result end .,., -module_eval <<'.,.,', 'grammar.ra', 419 +module_eval <<'.,.,', 'grammar.ra', 424 def _reduce_102( val, _values, result ) - result = ast AST::String, :value => val[0] + result = ast AST::String, :value => val[0][:value], :line => val[0][:line] result end .,., -module_eval <<'.,.,', 'grammar.ra', 421 +module_eval <<'.,.,', 'grammar.ra', 426 def _reduce_103( val, _values, result ) - result = ast AST::FlatString, :value => val[0] + result = ast AST::FlatString, :value => val[0][:value], :line => val[0][:line] result end .,., -module_eval <<'.,.,', 'grammar.ra', 425 +module_eval <<'.,.,', 'grammar.ra', 430 def _reduce_104( val, _values, result ) - result = ast AST::Boolean, :value => val[0] + result = ast AST::Boolean, :value => val[0][:value], :line => val[0][:line] result end .,., -module_eval <<'.,.,', 'grammar.ra', 430 +module_eval <<'.,.,', 'grammar.ra', 435 def _reduce_105( val, _values, result ) Puppet.warning addcontext("Deprecation notice: Resource references should now be capitalized") - result = ast AST::ResourceReference, :type => val[0], :title => val[2] + result = ast AST::ResourceReference, :type => val[0][:value], :line => val[0][:line], :title => val[2] result end .,., -module_eval <<'.,.,', 'grammar.ra', 432 +module_eval <<'.,.,', 'grammar.ra', 437 def _reduce_106( val, _values, result ) result = ast AST::ResourceReference, :type => val[0], :title => val[2] result end .,., -module_eval <<'.,.,', 'grammar.ra', 446 +module_eval <<'.,.,', 'grammar.ra', 451 def _reduce_107( val, _values, result ) @lexer.commentpop args = { @@ -1599,7 +1613,7 @@ module_eval <<'.,.,', 'grammar.ra', 446 end .,., -module_eval <<'.,.,', 'grammar.ra', 459 +module_eval <<'.,.,', 'grammar.ra', 464 def _reduce_108( val, _values, result ) @lexer.commentpop args = { @@ -1618,7 +1632,7 @@ module_eval <<'.,.,', 'grammar.ra', 459 # reduce 109 omitted -module_eval <<'.,.,', 'grammar.ra', 465 +module_eval <<'.,.,', 'grammar.ra', 470 def _reduce_110( val, _values, result ) @lexer.commentpop result = ast AST::Else, :statements => val[2] @@ -1626,7 +1640,7 @@ module_eval <<'.,.,', 'grammar.ra', 465 end .,., -module_eval <<'.,.,', 'grammar.ra', 469 +module_eval <<'.,.,', 'grammar.ra', 474 def _reduce_111( val, _values, result ) @lexer.commentpop result = ast AST::Else, :statements => ast(AST::Nop) @@ -1636,126 +1650,126 @@ module_eval <<'.,.,', 'grammar.ra', 469 # reduce 112 omitted -module_eval <<'.,.,', 'grammar.ra', 486 +module_eval <<'.,.,', 'grammar.ra', 491 def _reduce_113( val, _values, result ) - result = ast AST::ArithmeticOperator, :operator => val[1], :lval => val[0], :rval => val[2] + result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] result end .,., -module_eval <<'.,.,', 'grammar.ra', 489 +module_eval <<'.,.,', 'grammar.ra', 494 def _reduce_114( val, _values, result ) - result = ast AST::ArithmeticOperator, :operator => val[1], :lval => val[0], :rval => val[2] + result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] result end .,., -module_eval <<'.,.,', 'grammar.ra', 492 +module_eval <<'.,.,', 'grammar.ra', 497 def _reduce_115( val, _values, result ) - result = ast AST::ArithmeticOperator, :operator => val[1], :lval => val[0], :rval => val[2] + result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] result end .,., -module_eval <<'.,.,', 'grammar.ra', 495 +module_eval <<'.,.,', 'grammar.ra', 500 def _reduce_116( val, _values, result ) - result = ast AST::ArithmeticOperator, :operator => val[1], :lval => val[0], :rval => val[2] + result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] result end .,., -module_eval <<'.,.,', 'grammar.ra', 498 +module_eval <<'.,.,', 'grammar.ra', 503 def _reduce_117( val, _values, result ) - result = ast AST::ArithmeticOperator, :operator => val[1], :lval => val[0], :rval => val[2] + result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] result end .,., -module_eval <<'.,.,', 'grammar.ra', 501 +module_eval <<'.,.,', 'grammar.ra', 506 def _reduce_118( val, _values, result ) - result = ast AST::ArithmeticOperator, :operator => val[1], :lval => val[0], :rval => val[2] + result = ast AST::ArithmeticOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] result end .,., -module_eval <<'.,.,', 'grammar.ra', 504 +module_eval <<'.,.,', 'grammar.ra', 509 def _reduce_119( val, _values, result ) result = ast AST::Minus, :value => val[1] result end .,., -module_eval <<'.,.,', 'grammar.ra', 507 +module_eval <<'.,.,', 'grammar.ra', 512 def _reduce_120( val, _values, result ) - result = ast AST::ComparisonOperator, :operator => val[1], :lval => val[0], :rval => val[2] + result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] result end .,., -module_eval <<'.,.,', 'grammar.ra', 510 +module_eval <<'.,.,', 'grammar.ra', 515 def _reduce_121( val, _values, result ) - result = ast AST::ComparisonOperator, :operator => val[1], :lval => val[0], :rval => val[2] + result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] result end .,., -module_eval <<'.,.,', 'grammar.ra', 513 +module_eval <<'.,.,', 'grammar.ra', 518 def _reduce_122( val, _values, result ) - result = ast AST::ComparisonOperator, :operator => val[1], :lval => val[0], :rval => val[2] + result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] result end .,., -module_eval <<'.,.,', 'grammar.ra', 516 +module_eval <<'.,.,', 'grammar.ra', 521 def _reduce_123( val, _values, result ) - result = ast AST::ComparisonOperator, :operator => val[1], :lval => val[0], :rval => val[2] + result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] result end .,., -module_eval <<'.,.,', 'grammar.ra', 519 +module_eval <<'.,.,', 'grammar.ra', 524 def _reduce_124( val, _values, result ) - result = ast AST::ComparisonOperator, :operator => val[1], :lval => val[0], :rval => val[2] + result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] result end .,., -module_eval <<'.,.,', 'grammar.ra', 522 +module_eval <<'.,.,', 'grammar.ra', 527 def _reduce_125( val, _values, result ) - result = ast AST::ComparisonOperator, :operator => val[1], :lval => val[0], :rval => val[2] + result = ast AST::ComparisonOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] result end .,., -module_eval <<'.,.,', 'grammar.ra', 525 +module_eval <<'.,.,', 'grammar.ra', 530 def _reduce_126( val, _values, result ) result = ast AST::Not, :value => val[1] result end .,., -module_eval <<'.,.,', 'grammar.ra', 528 +module_eval <<'.,.,', 'grammar.ra', 533 def _reduce_127( val, _values, result ) - result = ast AST::BooleanOperator, :operator => val[1], :lval => val[0], :rval => val[2] + result = ast AST::BooleanOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] result end .,., -module_eval <<'.,.,', 'grammar.ra', 531 +module_eval <<'.,.,', 'grammar.ra', 536 def _reduce_128( val, _values, result ) - result = ast AST::BooleanOperator, :operator => val[1], :lval => val[0], :rval => val[2] + result = ast AST::BooleanOperator, :operator => val[1][:value], :lval => val[0], :rval => val[2] result end .,., -module_eval <<'.,.,', 'grammar.ra', 534 +module_eval <<'.,.,', 'grammar.ra', 539 def _reduce_129( val, _values, result ) result = val[1] result end .,., -module_eval <<'.,.,', 'grammar.ra', 543 +module_eval <<'.,.,', 'grammar.ra', 548 def _reduce_130( val, _values, result ) @lexer.commentpop options = val[3] @@ -1769,7 +1783,7 @@ module_eval <<'.,.,', 'grammar.ra', 543 # reduce 131 omitted -module_eval <<'.,.,', 'grammar.ra', 553 +module_eval <<'.,.,', 'grammar.ra', 558 def _reduce_132( val, _values, result ) if val[0].instance_of?(AST::ASTArray) val[0].push val[1] @@ -1781,7 +1795,7 @@ module_eval <<'.,.,', 'grammar.ra', 553 end .,., -module_eval <<'.,.,', 'grammar.ra', 558 +module_eval <<'.,.,', 'grammar.ra', 563 def _reduce_133( val, _values, result ) @lexer.commentpop result = ast AST::CaseOpt, :value => val[0], :statements => val[3] @@ -1789,7 +1803,7 @@ module_eval <<'.,.,', 'grammar.ra', 558 end .,., -module_eval <<'.,.,', 'grammar.ra', 564 +module_eval <<'.,.,', 'grammar.ra', 569 def _reduce_134( val, _values, result ) @lexer.commentpop result = ast(AST::CaseOpt, @@ -1802,7 +1816,7 @@ module_eval <<'.,.,', 'grammar.ra', 564 # reduce 135 omitted -module_eval <<'.,.,', 'grammar.ra', 574 +module_eval <<'.,.,', 'grammar.ra', 579 def _reduce_136( val, _values, result ) if val[0].instance_of?(AST::ASTArray) val[0].push(val[2]) @@ -1814,7 +1828,7 @@ module_eval <<'.,.,', 'grammar.ra', 574 end .,., -module_eval <<'.,.,', 'grammar.ra', 578 +module_eval <<'.,.,', 'grammar.ra', 583 def _reduce_137( val, _values, result ) result = ast AST::Selector, :param => val[0], :values => val[2] result @@ -1823,7 +1837,7 @@ module_eval <<'.,.,', 'grammar.ra', 578 # reduce 138 omitted -module_eval <<'.,.,', 'grammar.ra', 584 +module_eval <<'.,.,', 'grammar.ra', 589 def _reduce_139( val, _values, result ) @lexer.commentpop result = val[1] @@ -1833,7 +1847,7 @@ module_eval <<'.,.,', 'grammar.ra', 584 # reduce 140 omitted -module_eval <<'.,.,', 'grammar.ra', 594 +module_eval <<'.,.,', 'grammar.ra', 599 def _reduce_141( val, _values, result ) if val[0].instance_of?(AST::ASTArray) val[0].push(val[2]) @@ -1845,7 +1859,7 @@ module_eval <<'.,.,', 'grammar.ra', 594 end .,., -module_eval <<'.,.,', 'grammar.ra', 598 +module_eval <<'.,.,', 'grammar.ra', 603 def _reduce_142( val, _values, result ) result = ast AST::ResourceParam, :param => val[0], :value => val[2] result @@ -1866,28 +1880,28 @@ module_eval <<'.,.,', 'grammar.ra', 598 # reduce 149 omitted -module_eval <<'.,.,', 'grammar.ra', 609 +module_eval <<'.,.,', 'grammar.ra', 614 def _reduce_150( val, _values, result ) - result = ast AST::Default, :value => val[0] + result = ast AST::Default, :value => val[0][:value], :line => val[0][:line] result end .,., -module_eval <<'.,.,', 'grammar.ra', 611 +module_eval <<'.,.,', 'grammar.ra', 616 def _reduce_151( val, _values, result ) result = [val[0].value] result end .,., -module_eval <<'.,.,', 'grammar.ra', 615 +module_eval <<'.,.,', 'grammar.ra', 620 def _reduce_152( val, _values, result ) results = val[0] << val[2].value result end .,., -module_eval <<'.,.,', 'grammar.ra', 623 +module_eval <<'.,.,', 'grammar.ra', 628 def _reduce_153( val, _values, result ) val[1].each do |file| import(file) @@ -1898,10 +1912,10 @@ module_eval <<'.,.,', 'grammar.ra', 623 end .,., -module_eval <<'.,.,', 'grammar.ra', 634 +module_eval <<'.,.,', 'grammar.ra', 639 def _reduce_154( val, _values, result ) @lexer.commentpop - newdefine classname(val[1]), :arguments => val[2], :code => val[4] + newdefine classname(val[1]), :arguments => val[2], :code => val[4], :line => val[0][:line] @lexer.indefine = false result = nil @@ -1910,89 +1924,124 @@ module_eval <<'.,.,', 'grammar.ra', 634 end .,., -module_eval <<'.,.,', 'grammar.ra', 639 +module_eval <<'.,.,', 'grammar.ra', 644 def _reduce_155( val, _values, result ) @lexer.commentpop - newdefine classname(val[1]), :arguments => val[2] + newdefine classname(val[1]), :arguments => val[2], :line => val[0][:line] @lexer.indefine = false result = nil result end .,., -module_eval <<'.,.,', 'grammar.ra', 648 +module_eval <<'.,.,', 'grammar.ra', 653 def _reduce_156( val, _values, result ) @lexer.commentpop # Our class gets defined in the parent namespace, not our own. @lexer.namepop - newclass classname(val[1]), :code => val[4], :parent => val[2] + newclass classname(val[1]), :code => val[4], :parent => val[2], :line => val[0][:line] result = nil result end .,., -module_eval <<'.,.,', 'grammar.ra', 654 +module_eval <<'.,.,', 'grammar.ra', 659 def _reduce_157( val, _values, result ) @lexer.commentpop # Our class gets defined in the parent namespace, not our own. @lexer.namepop - newclass classname(val[1]), :parent => val[2] + newclass classname(val[1]), :parent => val[2], :line => val[0][:line] result = nil result end .,., -module_eval <<'.,.,', 'grammar.ra', 660 +module_eval <<'.,.,', 'grammar.ra', 665 def _reduce_158( val, _values, result ) @lexer.commentpop - newnode val[1], :parent => val[2], :code => val[4] + newnode val[1], :parent => val[2], :code => val[4], :line => val[0][:line] result = nil result end .,., -module_eval <<'.,.,', 'grammar.ra', 664 +module_eval <<'.,.,', 'grammar.ra', 669 def _reduce_159( val, _values, result ) @lexer.commentpop - newnode val[1], :parent => val[2] + newnode val[1], :parent => val[2], :line => val[0][:line] result = nil result end .,., - # reduce 160 omitted +module_eval <<'.,.,', 'grammar.ra', 670 + def _reduce_160( val, _values, result ) + result = val[0][:value] + result + end +.,., - # reduce 161 omitted +module_eval <<'.,.,', 'grammar.ra', 672 + def _reduce_161( val, _values, result ) + result = val[0][:value] + result + end +.,., - # reduce 162 omitted +module_eval <<'.,.,', 'grammar.ra', 673 + def _reduce_162( val, _values, result ) + result = val[0][:value] + result + end +.,., # reduce 163 omitted -module_eval <<'.,.,', 'grammar.ra', 678 +module_eval <<'.,.,', 'grammar.ra', 683 def _reduce_164( val, _values, result ) result = val[0] result = [result] unless result.is_a?(Array) - result << val[2] + result << val[2][:value] result end .,., - # reduce 165 omitted - - # reduce 166 omitted +module_eval <<'.,.,', 'grammar.ra', 684 + def _reduce_165( val, _values, result ) + result = val[0][:value] + result + end +.,., - # reduce 167 omitted +module_eval <<'.,.,', 'grammar.ra', 685 + def _reduce_166( val, _values, result ) + result = val[0][:value] + result + end +.,., - # reduce 168 omitted +module_eval <<'.,.,', 'grammar.ra', 686 + def _reduce_167( val, _values, result ) + result = val[0][:value] + result + end +.,., module_eval <<'.,.,', 'grammar.ra', 687 + def _reduce_168( val, _values, result ) + result = val[0][:value] + result + end +.,., + +module_eval <<'.,.,', 'grammar.ra', 692 def _reduce_169( val, _values, result ) result = nil result end .,., -module_eval <<'.,.,', 'grammar.ra', 691 +module_eval <<'.,.,', 'grammar.ra', 696 def _reduce_170( val, _values, result ) result = ast AST::ASTArray, :children => [] result @@ -2001,14 +2050,14 @@ module_eval <<'.,.,', 'grammar.ra', 691 # reduce 171 omitted -module_eval <<'.,.,', 'grammar.ra', 696 +module_eval <<'.,.,', 'grammar.ra', 701 def _reduce_172( val, _values, result ) result = nil result end .,., -module_eval <<'.,.,', 'grammar.ra', 700 +module_eval <<'.,.,', 'grammar.ra', 705 def _reduce_173( val, _values, result ) result = val[1] result = [result] unless result[0].is_a?(Array) @@ -2018,7 +2067,7 @@ module_eval <<'.,.,', 'grammar.ra', 700 # reduce 174 omitted -module_eval <<'.,.,', 'grammar.ra', 707 +module_eval <<'.,.,', 'grammar.ra', 712 def _reduce_175( val, _values, result ) result = val[0] result = [result] unless result[0].is_a?(Array) @@ -2027,39 +2076,39 @@ module_eval <<'.,.,', 'grammar.ra', 707 end .,., -module_eval <<'.,.,', 'grammar.ra', 712 +module_eval <<'.,.,', 'grammar.ra', 717 def _reduce_176( val, _values, result ) Puppet.warning addcontext("Deprecation notice: must now include '$' in prototype") - result = [val[0], val[2]] + result = [val[0][:value], val[2]] result end .,., -module_eval <<'.,.,', 'grammar.ra', 716 +module_eval <<'.,.,', 'grammar.ra', 721 def _reduce_177( val, _values, result ) Puppet.warning addcontext("Deprecation notice: must now include '$' in prototype") - result = [val[0]] + result = [val[0][:value]] result end .,., -module_eval <<'.,.,', 'grammar.ra', 718 +module_eval <<'.,.,', 'grammar.ra', 723 def _reduce_178( val, _values, result ) - result = [val[0], val[2]] + result = [val[0][:value], val[2]] result end .,., -module_eval <<'.,.,', 'grammar.ra', 720 +module_eval <<'.,.,', 'grammar.ra', 725 def _reduce_179( val, _values, result ) - result = [val[0]] + result = [val[0][:value]] result end .,., # reduce 180 omitted -module_eval <<'.,.,', 'grammar.ra', 725 +module_eval <<'.,.,', 'grammar.ra', 730 def _reduce_181( val, _values, result ) result = val[1] result @@ -2068,7 +2117,7 @@ module_eval <<'.,.,', 'grammar.ra', 725 # reduce 182 omitted -module_eval <<'.,.,', 'grammar.ra', 730 +module_eval <<'.,.,', 'grammar.ra', 735 def _reduce_183( val, _values, result ) result = val[1] result @@ -2079,14 +2128,14 @@ module_eval <<'.,.,', 'grammar.ra', 730 # reduce 185 omitted -module_eval <<'.,.,', 'grammar.ra', 736 +module_eval <<'.,.,', 'grammar.ra', 741 def _reduce_186( val, _values, result ) - result = ast AST::Variable, :value => val[0] + result = ast AST::Variable, :value => val[0][:value], :line => val[0][:line] result end .,., -module_eval <<'.,.,', 'grammar.ra', 744 +module_eval <<'.,.,', 'grammar.ra', 749 def _reduce_187( val, _values, result ) if val[1].instance_of?(AST::ASTArray) result = val[1] @@ -2097,7 +2146,7 @@ module_eval <<'.,.,', 'grammar.ra', 744 end .,., -module_eval <<'.,.,', 'grammar.ra', 751 +module_eval <<'.,.,', 'grammar.ra', 756 def _reduce_188( val, _values, result ) if val[1].instance_of?(AST::ASTArray) result = val[1] @@ -2108,7 +2157,7 @@ module_eval <<'.,.,', 'grammar.ra', 751 end .,., -module_eval <<'.,.,', 'grammar.ra', 753 +module_eval <<'.,.,', 'grammar.ra', 758 def _reduce_189( val, _values, result ) result = ast AST::ASTArray result @@ -2121,7 +2170,7 @@ module_eval <<'.,.,', 'grammar.ra', 753 # reduce 192 omitted -module_eval <<'.,.,', 'grammar.ra', 758 +module_eval <<'.,.,', 'grammar.ra', 763 def _reduce_193( val, _values, result ) result = nil result diff --git a/lib/puppet/parser/parser_support.rb b/lib/puppet/parser/parser_support.rb index a7a980a0c..92db9af5f 100644 --- a/lib/puppet/parser/parser_support.rb +++ b/lib/puppet/parser/parser_support.rb @@ -310,6 +310,7 @@ class Puppet::Parser::Parser args[:code] = code if code args[:parentclass] = parent if parent args[:doc] = doc + args[:line] = options[:line] @loaded_code.add_hostclass(name, ast(AST::HostClass, args)) end @@ -336,7 +337,8 @@ class Puppet::Parser::Parser :code => options[:code], :parser => self, :classname => name, - :doc => options[:doc] + :doc => options[:doc], + :line => options[:line] } [:code, :arguments].each do |param| @@ -360,7 +362,8 @@ class Puppet::Parser::Parser args = { :name => name, :parser => self, - :doc => doc + :doc => doc, + :line => options[:line] } if options[:code] args[:code] = options[:code] |