From f400a0da0fcd3e4d27d915b57c54f504813ef1d3 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Mon, 4 Sep 2017 20:24:09 +0200 Subject: [PATCH] pkg/ast: fix struct comment parsing --- pkg/ast/parser.go | 2 ++ pkg/ast/testdata/all.txt | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/pkg/ast/parser.go b/pkg/ast/parser.go index 214be7fb9b29..9e1ab679e189 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 9ddf67844ab6..b71b7919cb37 100644 --- a/pkg/ast/testdata/all.txt +++ b/pkg/ast/testdata/all.txt @@ -28,3 +28,14 @@ include include "linux/foo.h" incdir incdir "/foo/bar" + +s2 { + f1 int8 + + # comment + + f2 int8 + + # comment + +}