-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
101 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
...rg/eolang/parser/packs/optimize/redundant-levels-with-arguments-and-abstract-parents.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
xsls: | ||
- /org/eolang/parser/optimize/abstracts-float-up.xsl | ||
- /org/eolang/parser/optimize/remove-levels.xsl | ||
tests: | ||
- /program/errors[count(*)=0] | ||
# 'main' object | ||
- //o[@name='main'] | ||
- //o[@name='main']/o[@base='sibling' and @name='@'] | ||
- //o[@name='main']/o[not(@base) and @name='arg'] | ||
- //o[@name='main']/o[@base='main$sibling' and @name='sibling'] | ||
- //o[@name='main']/o[@base='main$sibling' and @name='sibling']/o[@base='arg' and not(@name)] | ||
# 'main$sibling' object | ||
- //o[@name='main$sibling' and count(o)=3] | ||
- //o[@name='main$sibling']/o[not(@base) and @name='arg'] | ||
- //o[@name='main$sibling']/o[@base='main$sibling$first' and @name='first'] | ||
- //o[@name='main$sibling']/o[@base='main$sibling$first' and @name='first']/o[@base='arg' and not(@name)] | ||
- //o[@name='main$sibling']/o[@base='main$sibling$second' and @name='second'] | ||
- //o[@name='main$sibling']/o[@base='main$sibling$second' and @name='second']/o[@base='arg' and not(@name)] | ||
# 'main$sibling$first' object | ||
- //o[@name='main$sibling$first' and count(o)=3] | ||
- //o[@name='main$sibling$first']/o[@base='arg' and not(@name)] | ||
- //o[@name='main$sibling$first']/o[@base='.one' and @name='@'] | ||
- //o[@name='main$sibling$first']/o[not(@base) and @name='arg'] | ||
# 'main$sibling$second' object | ||
- //o[@name='main$sibling$second' and count(o)=3] | ||
- //o[@name='main$sibling$second']/o[@base='arg' and not(@name)] | ||
- //o[@name='main$sibling$second']/o[@base='.two' and @name='@'] | ||
- //o[@name='main$sibling$second']/o[not(@base) and @name='arg'] | ||
# Currently the test converts the code from the snippet to: | ||
# ____ | ||
# [arg] > main | ||
# sibling > @ | ||
# main$sibling > sibling | ||
# arg | ||
# | ||
# [arg] > main$sibling | ||
# main$sibling$first > first | ||
# arg | ||
# main$sibling$second > second | ||
# arg | ||
# | ||
# [arg] > main$sibling$first | ||
# arg.one > @ | ||
# | ||
# [] > main$sibling$second | ||
# arg.two > @ | ||
# ____ | ||
eo: | | ||
[arg] > main | ||
sibling > @ | ||
[] > sibling | ||
[] > first | ||
arg.one > @ | ||
[] > second | ||
arg.two > @ |
45 changes: 45 additions & 0 deletions
45
...ources/org/eolang/parser/packs/optimize/redundant-levels-with-arguments-and-siblings.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
xsls: | ||
- /org/eolang/parser/optimize/abstracts-float-up.xsl | ||
- /org/eolang/parser/optimize/remove-levels.xsl | ||
tests: | ||
- /program/errors[count(*)=0] | ||
# 'main' object | ||
- //o[@name='main'] | ||
- //o[@name='main']/o[@base='sibling' and @name='@'] | ||
- //o[@name='main']/o[@base='.eq' and @name='sibling'] | ||
- //o[@name='main']/o[@base='.eq' and @name='sibling']/o[@base='main$t2$first' and @name='first' and count(o)=1] | ||
- //o[@name='main']/o[@base='.eq' and @name='sibling']/o[@base='main$t2$second' and @name='second' and count(o)=1] | ||
# 'main$t2$first' object | ||
- //o[@name='main$t2$first' and count(o)=3] | ||
- //o[@name='main$t2$first']/o[@base='arg' and not(@name)] | ||
- //o[@name='main$t2$first']/o[@base='.one' and @name='@'] | ||
- //o[@name='main$t2$first']/o[not(@base) and @name='arg'] | ||
# 'main$t2$second' object | ||
- //o[@name='main$t2$second' and count(o)=3] | ||
- //o[@name='main$t2$second']/o[@base='arg' and not(@name)] | ||
- //o[@name='main$t2$second']/o[@base='.two' and @name='@'] | ||
- //o[@name='main$t2$second']/o[not(@base) and @name='arg'] | ||
# Currently the test converts the code from the snippet to: | ||
# ____ | ||
# [arg] > main | ||
# sibling > @ | ||
# eq. > sibling | ||
# main$t2$first > first | ||
# arg | ||
# main$t2$second > second | ||
# arg | ||
# | ||
# [arg] > main$t2$first | ||
# arg.one > @ | ||
# | ||
# [] > main$t2$second | ||
# arg.two > @ | ||
# ____ | ||
eo: | | ||
[arg] > main | ||
sibling > @ | ||
eq. > sibling | ||
[] > first | ||
arg.one > @ | ||
[] > second | ||
arg.two > @ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0146ce4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Puzzle
2126-624e8604
disappeared fromeo-parser/src/test/resources/org/eolang/parser/packs/optimize/redundant-levels-with-siblings.yaml
), that's why I closed #2175. Please, remember that the puzzle was not necessarily removed in this particular commit. Maybe it happened earlier, but we discovered this fact only now.