lib/yard/parser/c/c_parser.rb in yard-0.8.6.1 vs lib/yard/parser/c/c_parser.rb in yard-0.8.6.2
- old
+ new
@@ -78,11 +78,13 @@
@statements << statement
attach_comment(statement)
stmts = nil
if prevchar == '{'
stmts = consume_body_statements
- consume_until(';') if decl =~ /\A(typedef|enum|class|struct|union)\b/
+ if decl =~ /\A(typedef|enum|class|#{struct}|union)/
+ consume_until(';')
+ end
end
statement.source = @content[start..@index]
statement.block = stmts
statement.declaration = decl
end
@@ -217,9 +219,13 @@
end
def char(num = 1) @content[@index, num] end
def prevchar(num = 1) @content[@index - 1, num] end
def nextchar(num = 1) @content[@index + 1, num] end
+
+ def struct
+ /struct\s[:alnum:]+\s\{/
+ end
end
end
end
end