all repos

clerk @ 42ed6f1

missing tooling for ledger/hledger
1 files changed, 10 insertions(+), 13 deletions(-)
parser: fix header comment parsing
Author: Oleksandr Smirnov olexsmir@gmail.com
Committed at: 2026-06-22 18:00:13 +0300
Authored at: 2026-06-17 15:41:06 +0300
Change ID: tlwlsqwwkkkvyplxspoqrtxlnsnqvknp
Parent: a7ca45c
M journal/parser/parser.go
ยทยทยท
        224
        224
         	comment := p.parseOptInlineComment()

      
        225
        225
         	p.expectNewline()

      
        226
        226
         

      
        227
        
        -	var headerComments []*ast.Comment

      
        228
        
        -	var postings []*ast.Posting

      
        229
        
        -	for p.got(token.INDENT) || p.got(token.SEMICOLON) {

      
        230
        
        -		if p.got(token.SEMICOLON) {

      
        231
        
        -			c := p.parseComment()

      
        232
        
        -			headerComments = append(headerComments, c)

      
        233
        
        -			continue

      
        234
        
        -		}

      
        235
        
        -		posting := p.parsePosting()

      
        236
        
        -		if posting != nil {

      
        237
        
        -			postings = append(postings, posting)

      
        
        227
        +	// header comment

      
        
        228
        +	for p.got(token.INDENT) && p.willGet(token.SEMICOLON) {

      
        
        229
        +		p.advance()

      
        
        230
        +		pt.HeaderComments = append(pt.HeaderComments, p.parseComment())

      
        
        231
        +	}

      
        
        232
        +

      
        
        233
        +	// postings

      
        
        234
        +	for p.got(token.INDENT) {

      
        
        235
        +		if posting := p.parsePosting(); posting != nil {

      
        
        236
        +			pt.Postings = append(pt.Postings, posting)

      
        238
        237
         		}

      
        239
        238
         	}

      
        240
        239
         

      
        241
        
        -	pt.HeaderComments = headerComments

      
        242
        
        -	pt.Postings = postings

      
        243
        240
         	pt.Comment = comment

      
        244
        241
         	return pt

      
        245
        242
         }