lib/yard/parser/c/c_parser.rb in yard-0.9.8 vs lib/yard/parser/c/c_parser.rb in yard-0.9.9
- old
+ new
@@ -36,10 +36,11 @@
case char
when /['"]/; consume_quote(char)
when '#'; consume_directive
when '/'; consume_comment
when /\s/; consume_whitespace
+ when '}'; advance # Skip possible C++ namespace closing brackets.
else consume_toplevel_statement
end
end
end
@@ -73,9 +74,11 @@
@newline = false
start = @index
line = @line
decl = consume_until(/[{;]/)
return nil if decl =~ /\A\s*\Z/
+ # Skip C++ namespace - treat content as top level statement.
+ return nil if decl =~ /\A(namespace)/
statement = ToplevelStatement.new(nil, @file, line)
@statements << statement
attach_comment(statement)
stmts = nil
if prevchar == '{'