Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion _xtool/internal/parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ func (ct *Converter) ParseComment(rawComment string) *ast.CommentGroup {
lines := strings.Split(rawComment, "\n")
commentGroup := &ast.CommentGroup{}
for _, line := range lines {
commentGroup.List = append(commentGroup.List, &ast.Comment{Text: line + "\n"})
commentGroup.List = append(commentGroup.List, &ast.Comment{Text: line})
}
return commentGroup
}
Expand Down
60 changes: 30 additions & 30 deletions _xtool/internal/parser/testdata/comment/expect.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"Doc": {
"List": [
{
"Text": "// not read doc 1\n",
"Text": "// not read doc 1",
"_Type": "Comment"
}
],
Expand Down Expand Up @@ -47,7 +47,7 @@
"Doc": {
"List": [
{
"Text": "/* not read doc 2 */\n",
"Text": "/* not read doc 2 */",
"_Type": "Comment"
}
],
Expand Down Expand Up @@ -89,7 +89,7 @@
"Doc": {
"List": [
{
"Text": "/// doc\n",
"Text": "/// doc",
"_Type": "Comment"
}
],
Expand Down Expand Up @@ -131,7 +131,7 @@
"Doc": {
"List": [
{
"Text": "/** doc */\n",
"Text": "/** doc */",
"_Type": "Comment"
}
],
Expand Down Expand Up @@ -173,7 +173,7 @@
"Doc": {
"List": [
{
"Text": "/*! doc */\n",
"Text": "/*! doc */",
"_Type": "Comment"
}
],
Expand Down Expand Up @@ -215,11 +215,11 @@
"Doc": {
"List": [
{
"Text": "/// doc 1\n",
"Text": "/// doc 1",
"_Type": "Comment"
},
{
"Text": "/// doc 2\n",
"Text": "/// doc 2",
"_Type": "Comment"
}
],
Expand Down Expand Up @@ -261,11 +261,11 @@
"Doc": {
"List": [
{
"Text": "/*! doc 1 */\n",
"Text": "/*! doc 1 */",
"_Type": "Comment"
},
{
"Text": "/*! doc 2 */\n",
"Text": "/*! doc 2 */",
"_Type": "Comment"
}
],
Expand Down Expand Up @@ -307,11 +307,11 @@
"Doc": {
"List": [
{
"Text": "/** doc 1 */\n",
"Text": "/** doc 1 */",
"_Type": "Comment"
},
{
"Text": "/** doc 1 */\n",
"Text": "/** doc 1 */",
"_Type": "Comment"
}
],
Expand Down Expand Up @@ -353,19 +353,19 @@
"Doc": {
"List": [
{
"Text": "/**\n",
"Text": "/**",
"_Type": "Comment"
},
{
"Text": " * doc 1\n",
"Text": " * doc 1",
"_Type": "Comment"
},
{
"Text": " * doc 2\n",
"Text": " * doc 2",
"_Type": "Comment"
},
{
"Text": " */\n",
"Text": " */",
"_Type": "Comment"
}
],
Expand Down Expand Up @@ -423,7 +423,7 @@
"Doc": {
"List": [
{
"Text": "/// doc\n",
"Text": "/// doc",
"_Type": "Comment"
}
],
Expand All @@ -448,7 +448,7 @@
"Comment": {
"List": [
{
"Text": "///\u003c comment\n",
"Text": "///\u003c comment",
"_Type": "Comment"
}
],
Expand All @@ -474,7 +474,7 @@
"Comment": {
"List": [
{
"Text": "/*!\u003c comment */\n",
"Text": "/*!\u003c comment */",
"_Type": "Comment"
}
],
Expand Down Expand Up @@ -524,15 +524,15 @@
"Doc": {
"List": [
{
"Text": "/**\n",
"Text": "/**",
"_Type": "Comment"
},
{
"Text": " * static field doc\n",
"Text": " * static field doc",
"_Type": "Comment"
},
{
"Text": " */\n",
"Text": " */",
"_Type": "Comment"
}
],
Expand All @@ -557,7 +557,7 @@
"Comment": {
"List": [
{
"Text": "/*!\u003c static field comment */\n",
"Text": "/*!\u003c static field comment */",
"_Type": "Comment"
}
],
Expand All @@ -584,15 +584,15 @@
"Doc": {
"List": [
{
"Text": "/**\n",
"Text": "/**",
"_Type": "Comment"
},
{
"Text": " * field doc\n",
"Text": " * field doc",
"_Type": "Comment"
},
{
"Text": " */\n",
"Text": " */",
"_Type": "Comment"
}
],
Expand All @@ -617,7 +617,7 @@
"Comment": {
"List": [
{
"Text": "///\u003c field comment\n",
"Text": "///\u003c field comment",
"_Type": "Comment"
}
],
Expand All @@ -643,7 +643,7 @@
"Comment": {
"List": [
{
"Text": "/*!\u003c protected field comment */\n",
"Text": "/*!\u003c protected field comment */",
"_Type": "Comment"
}
],
Expand Down Expand Up @@ -672,15 +672,15 @@
"Doc": {
"List": [
{
"Text": "/**\n",
"Text": "/**",
"_Type": "Comment"
},
{
"Text": " * method doc\n",
"Text": " * method doc",
"_Type": "Comment"
},
{
"Text": " */\n",
"Text": " */",
"_Type": "Comment"
}
],
Expand Down
2 changes: 1 addition & 1 deletion _xtool/internal/parser/testdata/typeof/expect.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"Doc": {
"List": [
{
"Text": "// https://github.com/goplus/llcppg/issues/497\n",
"Text": "// https://github.com/goplus/llcppg/issues/497",
"_Type": "Comment"
}
],
Expand Down
Loading