Skip to content

Commit

Permalink
internal (only required due to changes to txtpbfmt in diffbase)
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 513816470
  • Loading branch information
txtpbfmt-copybara-robot committed Mar 6, 2023
1 parent 1a4f451 commit 63785f1
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -668,10 +668,10 @@ func (p *parser) parse(isRoot bool) (result []*ast.Node, endPos ast.Position, er
p.config.infof("name: %q", nd.Name)
}
// Skip separator.
_, _ = p.skipWhiteSpaceAndReadComments(true /* multiLine */)
preCommentsBeforeColon, _ := p.skipWhiteSpaceAndReadComments(true /* multiLine */)
nd.SkipColon = !p.consume(':')
previousPos := p.position()
_, _ = p.skipWhiteSpaceAndReadComments(true /* multiLine */)
preCommentsAfterColon, _ := p.skipWhiteSpaceAndReadComments(true /* multiLine */)

if p.consume('{') || p.consume('<') {
if p.config.SkipAllColons {
Expand All @@ -692,7 +692,12 @@ func (p *parser) parse(isRoot bool) (result []*ast.Node, endPos ast.Position, er
openBracketLine := p.line

// Skip separator.
preComments := p.readContinuousBlocksOfComments()
preCommentsAfterListStart := p.readContinuousBlocksOfComments()

var preComments []string
preComments = append(preComments, preCommentsBeforeColon...)
preComments = append(preComments, preCommentsAfterColon...)
preComments = append(preComments, preCommentsAfterListStart...)

if p.nextInputIs('{') {
// Handle list of nodes.
Expand Down

0 comments on commit 63785f1

Please sign in to comment.