WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
File tree Expand file tree Collapse file tree 2 files changed +7
-14
lines changed
specification/scripts/generators Expand file tree Collapse file tree 2 files changed +7
-14
lines changed Original file line number Diff line number Diff line change @@ -1290,6 +1290,9 @@ def collect_child_locations(node):
12901290 start_col = node .col_offset
12911291 end_lineno = node .end_lineno
12921292 end_col = node .end_col_offset
1293+ # 构建自定义的 SourceLocation 对象
1294+ start_pos = UNode .Position (start_lineno , start_col + 1 )
1295+ end_pos = UNode .Position (end_lineno , end_col + 1 )
12931296 else :
12941297 # 递归收集所有子节点的位置
12951298 child_locations = collect_child_locations (node )
@@ -1303,7 +1306,7 @@ def collect_child_locations(node):
13031306 end_lineno = max (loc .end .line for loc in child_locations )
13041307 end_col = max (loc .end .column for loc in child_locations )
13051308
1306- # 构建自定义的 SourceLocation 对象
1307- start_pos = UNode .Position (start_lineno , start_col + 1 )
1308- end_pos = UNode .Position (end_lineno , end_col + 1 )
1309+ # 构建自定义的 SourceLocation 对象
1310+ start_pos = UNode .Position (start_lineno , start_col )
1311+ end_pos = UNode .Position (end_lineno , end_col )
13091312 return UNode .SourceLocation (start_pos , end_pos , self .sourcefile )
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ abstract public class ASTNode {
1414 public ASTNode parent;
1515 public String type;
1616 public Loc loc;
17- public Meta _meta;
17+ public Map<String, Object> _meta;
1818 abstract public <T> T accept(UastVisitor visitor);
1919};`
2020 }
@@ -41,16 +41,6 @@ public class LineColumn {
4141 }
4242}
4343
44- const Meta = function ( ) {
45- return function ( ) {
46- return `${ DISCLAIMER } ${ packageDecl }
47- import java.util.Map;
48-
49- public class Meta {
50- public Map<String, Object> _meta;
51- };`
52- }
53- }
5444
5545
5646// java的每个 AST 节点的描述会作为一个类,单独写到一个文件中
You can’t perform that action at this time.
0 commit comments