pos := p.expect(token.STRUCT);
lbrace := p.expect(token.LBRACE);
list := vector.New(0);
- for p.tok != token.RBRACE && p.tok != token.EOF {
+ for p.tok == token.IDENT || p.tok == token.MUL {
f := p.parseFieldDecl();
- list.Push(f);
- if p.tok == token.SEMICOLON {
- p.next();
- f.Comment = p.lineComment;
- } else {
- f.Comment = p.lineComment;
- break;
+ if p.tok != token.RBRACE {
+ p.expect(token.SEMICOLON);
}
+ f.Comment = p.lineComment;
+ list.Push(f);
}
rbrace := p.expect(token.RBRACE);
p.optSemi = true;
lbrace := p.expect(token.LBRACE);
list := vector.New(0);
for p.tok == token.IDENT {
- list.Push(p.parseMethodSpec());
+ m := p.parseMethodSpec();
if p.tok != token.RBRACE {
p.expect(token.SEMICOLON);
}
+ m.Comment = p.lineComment;
+ list.Push(m);
}
rbrace := p.expect(token.RBRACE);
p.optSemi = true;
// The I1 interface; some methods are not exported.
type I1 interface {
I0;
- F(x float) float;
+ F(x float) float; // exported methods
// contains unexported methods
}
// The I2 interface; all methods are exported.
type I2 interface {
I0;
- F(x float) float;
- G(x float) float;
+ F(x float) float; // exported method
+ G(x float) float; // exported method
}