summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser
diff options
context:
space:
mode:
authorBrice Figureau <brice-puppet@daysofwonder.com>2011-02-11 22:46:15 +0100
committerBrice Figureau <brice-puppet@daysofwonder.com>2011-02-11 22:46:15 +0100
commitb4a171e78c501208798220910352943331ceb9e0 (patch)
tree460bc89cfc5393613f6a69369b8b22818a469fbe /lib/puppet/parser
parentcfa0c32fc5149464af97235a7bb458950d19cc82 (diff)
downloadpuppet-b4a171e78c501208798220910352943331ceb9e0.tar.gz
puppet-b4a171e78c501208798220910352943331ceb9e0.tar.xz
puppet-b4a171e78c501208798220910352943331ceb9e0.zip
Fix #5720 - puppetdoc misses some class comments
It appears that the fix for #5252 wasn't complete, and class, nodes and definition were still using the current lexer line number instead of the line number of the class/define/node token. This combined with some missing comments stack pushing/pop on parenthesis prevented puppetdoc to correctly get the documentation of some class (including parametrized ones). Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
Diffstat (limited to 'lib/puppet/parser')
-rw-r--r--lib/puppet/parser/lexer.rb5
-rw-r--r--lib/puppet/parser/parser_support.rb6
2 files changed, 7 insertions, 4 deletions
diff --git a/lib/puppet/parser/lexer.rb b/lib/puppet/parser/lexer.rb
index 31d39ae2f..9a25263f6 100644
--- a/lib/puppet/parser/lexer.rb
+++ b/lib/puppet/parser/lexer.rb
@@ -476,9 +476,12 @@ class Puppet::Parser::Lexer
@expected.pop
end
- if final_token.name == :LBRACE
+ if final_token.name == :LBRACE or final_token.name == :LPAREN
commentpush
end
+ if final_token.name == :RPAREN
+ commentpop
+ end
yield [final_token.name, token_value]
diff --git a/lib/puppet/parser/parser_support.rb b/lib/puppet/parser/parser_support.rb
index 7bbebb124..7a0aa2601 100644
--- a/lib/puppet/parser/parser_support.rb
+++ b/lib/puppet/parser/parser_support.rb
@@ -135,19 +135,19 @@ class Puppet::Parser::Parser
# Create a new class, or merge with an existing class.
def newclass(name, options = {})
- known_resource_types.add Puppet::Resource::Type.new(:hostclass, name, ast_context(true).merge(options))
+ known_resource_types.add Puppet::Resource::Type.new(:hostclass, name, ast_context(true, options[:line]).merge(options))
end
# Create a new definition.
def newdefine(name, options = {})
- known_resource_types.add Puppet::Resource::Type.new(:definition, name, ast_context(true).merge(options))
+ known_resource_types.add Puppet::Resource::Type.new(:definition, name, ast_context(true, options[:line]).merge(options))
end
# Create a new node. Nodes are special, because they're stored in a global
# table, not according to namespaces.
def newnode(names, options = {})
names = [names] unless names.instance_of?(Array)
- context = ast_context(true)
+ context = ast_context(true, options[:line])
names.collect do |name|
known_resource_types.add(Puppet::Resource::Type.new(:node, name, context.merge(options)))
end