aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/ast
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2017-09-04 20:24:09 +0200
committerDmitry Vyukov <dvyukov@google.com>2017-09-04 20:25:03 +0200
commitf400a0da0fcd3e4d27d915b57c54f504813ef1d3 (patch)
tree3aab1932fc78ba7ef2280713a9383608d5cd1a92 /pkg/ast
parenta54dce007d0d1fb8f21f73468c25e026e3b3d5c6 (diff)
pkg/ast: fix struct comment parsing
Diffstat (limited to 'pkg/ast')
-rw-r--r--pkg/ast/parser.go2
-rw-r--r--pkg/ast/testdata/all.txt11
2 files changed, 13 insertions, 0 deletions
diff --git a/pkg/ast/parser.go b/pkg/ast/parser.go
index 214be7fb9..9e1ab679e 100644
--- a/pkg/ast/parser.go
+++ b/pkg/ast/parser.go
@@ -353,6 +353,8 @@ func (p *parser) parseCommentBlock() []*Comment {
for p.tok == tokComment {
comments = append(comments, p.parseComment())
p.consume(tokNewLine)
+ for p.tryConsume(tokNewLine) {
+ }
}
return comments
}
diff --git a/pkg/ast/testdata/all.txt b/pkg/ast/testdata/all.txt
index 9ddf67844..b71b7919c 100644
--- a/pkg/ast/testdata/all.txt
+++ b/pkg/ast/testdata/all.txt
@@ -28,3 +28,14 @@ include <linux/foo.h>
include "linux/foo.h"
incdir </foo/bar>
incdir "/foo/bar"
+
+s2 {
+ f1 int8
+
+ # comment
+
+ f2 int8
+
+ # comment
+
+}