(goctl)fix parser issues (#3930)
This commit is contained in:
@@ -84,6 +84,19 @@ func (t *TokenNode) SetLeadingCommentGroup(cg CommentGroup) {
|
||||
t.LeadingCommentGroup = cg
|
||||
}
|
||||
|
||||
// RawText returns the node's raw text.
|
||||
func (t *TokenNode) RawText() string {
|
||||
text := t.Token.Text
|
||||
if strings.HasPrefix(text, "`") {
|
||||
text = strings.TrimPrefix(text, "`")
|
||||
text = strings.TrimSuffix(text, "`")
|
||||
} else if strings.HasPrefix(text, `"`) {
|
||||
text = strings.TrimPrefix(text, `"`)
|
||||
text = strings.TrimSuffix(text, `"`)
|
||||
}
|
||||
return text
|
||||
}
|
||||
|
||||
func (t *TokenNode) HasLeadingCommentGroup() bool {
|
||||
return t.LeadingCommentGroup.Valid() || t.leadingFlag
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user