Skip to content

Commit

Permalink
Merge branch 'sync/pmderodat/dump_f_prefix' into 'master'
Browse files Browse the repository at this point in the history
Python API: do not remove "f_" parsing field prefix in .dump() output

Closes #682

See merge request eng/libadalang/langkit!868
  • Loading branch information
pmderodat committed Jun 12, 2023
2 parents 17219fe + f8a6f7e commit 6fab69b
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 92 deletions.
4 changes: 1 addition & 3 deletions langkit/templates/python_api/module_py.mako
Original file line number Diff line number Diff line change
Expand Up @@ -1628,9 +1628,7 @@ class ${root_astnode_name}:
print_node("item_{}".format(i), value)
else:
for name, value in self.iter_fields():
# Remove the f_ prefix to have the same behavior as the Ada
# dumper.
print_node(name[2:], value)
print_node(name, value)

def findall(
self,
Expand Down
12 changes: 6 additions & 6 deletions testsuite/tests/grammar/cuts/test.out
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
FooNodeList buffer:1:1-1:6
|item_0:
| Def buffer:1:1-1:6
| |id:
| |f_id:
| | Id buffer:1:5-1:6: a

=== invalid case 1: use cut ===
Expand All @@ -13,24 +13,24 @@ FooNodeList buffer:1:1-1:6
FooNodeList buffer:1:1-1:10
|item_0:
| Def buffer:1:1-1:6
| |id:
| |f_id:
| | Id buffer:1:5-1:6: a
|item_1:
| Def buffer:1:7-1:10
| |id: None
| |f_id: None

=== valid case 2: use stopcut ===

FooNodeList buffer:1:1-1:20
|item_0:
| Def buffer:1:1-1:6
| |id:
| |f_id:
| | Id buffer:1:5-1:6: a
|item_1:
| Block buffer:1:7-1:20
| |el:
| |f_el:
| | VarDef buffer:1:9-1:18
| | |id:
| | |f_id:
| | | Id buffer:1:17-1:18: b

Done
Loading

0 comments on commit 6fab69b

Please sign in to comment.