(goctl): fix prefix syntax (#4113)

This commit is contained in:
kesonan
2024-04-30 17:11:08 +08:00
committed by GitHub
parent 04116f647d
commit a9d27cda8a
4 changed files with 37 additions and 5 deletions

View File

@@ -1247,6 +1247,34 @@ func (p *Parser) parseAtServerKVExpression() *ast.KVExpr {
}
}
valueTok.Type = token.PATH
node := ast.NewTokenNode(valueTok)
node.SetLeadingCommentGroup(leadingCommentGroup)
expr.Value = node
return expr
} else if p.peekTokenIs(token.SUB) {
for {
if p.peekTokenIs(token.SUB) {
if !p.nextToken() {
return nil
}
subTok := p.curTok
if !p.advanceIfPeekTokenIs(token.IDENT) {
return nil
}
idTok := p.curTok
valueTok = token.Token{
Text: valueTok.Text + subTok.Text + idTok.Text,
Position: valueTok.Position,
}
leadingCommentGroup = p.curTokenNode().LeadingCommentGroup
} else {
break
}
}
valueTok.Type = token.PATH
node := ast.NewTokenNode(valueTok)
node.SetLeadingCommentGroup(leadingCommentGroup)