Skip to content
This repository was archived by the owner on Mar 8, 2020. It is now read-only.

Commit eace9f9

Browse files
Denys Smirnovdennwc
authored andcommitted
transform Javadoc into uast:Comment
Signed-off-by: Denys Smirnov <denys@sourced.tech>
1 parent 18b8daf commit eace9f9

2 files changed

Lines changed: 19 additions & 6 deletions

File tree

driver/normalizer/normalizer.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,13 @@ var Normalizers = []Mapping{
225225
),
226226
},
227227
)),
228+
229+
MapSemantic("Javadoc", uast.Comment{}, MapObj(
230+
Obj{
231+
"text": CommentText([2]string{"/**", "*/"}, "comm"),
232+
},
233+
CommentNode(true, "comm", nil),
234+
)),
228235
}
229236

230237
var argsPart = Each("args", UASTType(uast.Argument{}, Obj{

fixtures/javadoc.java.sem.uast

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@
1212
},
1313
},
1414
comments: [
15-
{ '@type': "java:Javadoc",
16-
'@token': "* javadoc comment inline ",
17-
'@role': [Comment, Documentation],
15+
{ '@type': "uast:Comment",
1816
'@pos': { '@type': "uast:Positions",
1917
start: { '@type': "uast:Position",
2018
offset: 44,
@@ -27,10 +25,13 @@
2725
col: 40,
2826
},
2927
},
28+
Block: true,
29+
Prefix: " ",
30+
Suffix: " ",
31+
Tab: "",
32+
Text: "javadoc comment inline",
3033
},
31-
{ '@type': "java:Javadoc",
32-
'@token': "*\n* This is a multiline JavaDoc\n* comment\n* ",
33-
'@role': [Comment, Documentation],
34+
{ '@type': "uast:Comment",
3435
'@pos': { '@type': "uast:Positions",
3536
start: { '@type': "uast:Position",
3637
offset: 77,
@@ -43,6 +44,11 @@
4344
col: 6,
4445
},
4546
},
47+
Block: true,
48+
Prefix: "\n* ",
49+
Suffix: " ",
50+
Tab: "",
51+
Text: "This is a multiline JavaDoc\n* comment\n*",
4652
},
4753
],
4854
imports: ~,

0 commit comments

Comments
 (0)