forked from objectionary/eo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(objectionary#2555): fix + tests
- Loading branch information
1 parent
8e1cd27
commit 134efc7
Showing
14 changed files
with
272 additions
and
119 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
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
21 changes: 17 additions & 4 deletions
21
eo-parser/src/test/resources/org/eolang/parser/packs/syntax/tuples.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 |
---|---|---|
@@ -1,17 +1,30 @@ | ||
xsls: | ||
# [] | ||
- /org/eolang/parser/stars-to-tuples.xsl | ||
- /org/eolang/parser/stars-to-tuples.xsl | ||
- /org/eolang/parser/stars-to-tuples.xsl | ||
tests: | ||
- //objects[count(//objects/o[@base='tuple'])=4] | ||
- //objects[count(//objects/o[@base='tuple'])=5] | ||
- //o[@base='tuple' and @line=1 and not(@name)] | ||
- //o[@base='.empty' and @name='xs'] | ||
- //o[@base='tuple' and @line=1 and not(@name)]/following-sibling::o[@base='.empty' and @name='xs'] | ||
- //o[@base='tuple' and @line=2 and @name='xl']/o[@base='tuple'] | ||
- //o[@base='tuple' and @line=2 and @name='xl']/o[@base='.empty' and @method] | ||
- //o[@base='tuple' and @line=3]/o[@base='tuple' and @star]/o[@base='int'] | ||
- //o[@base='tuple' and @line=2 and @name='xl']/o[@base='int' and @line=2] | ||
- //o[@base='tuple' and @line=3]/o[@base='tuple']/o[@base='tuple'] | ||
- //o[@base='tuple' and @line=3]/o[@base='tuple']/o[@base='.empty' and @method] | ||
- //o[@base='tuple' and @line=3]/o[@base='tuple']/o[@base='int' and @line=3] | ||
- //o[@base='tuple' and @line=3]/o[@base='int' and @line=3] | ||
- //o[@base='tuple' and @line=3]/o[@base='int'] | ||
- //o[@base='tuple' and @line=4 and not(@star)]/following-sibling::o[@base='.empty' and @name='empty'] | ||
- //o[@base='tuple' and @line=5 and count(o)=4 and count(o[@method])=2] | ||
- //o[@base='tuple' and @line=5]/o[@base='tuple' and count(o)=4 and count(o[@method])=2] | ||
- //o[@base='tuple' and @line=5]/o[@base='tuple']/o[@base='tuple'] | ||
- //o[@base='tuple' and @line=5]/o[@base='tuple']/o[@base='tuple']/o[@base='.empty' and @method] | ||
eo: | | ||
* > xs | ||
* 1 > xl | ||
* 1 2 | ||
*.empty > empty | ||
* | ||
a.b.c | ||
d.e.f | ||
g.h.i |
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
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
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,69 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2016-2023 Objectionary.com | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included | ||
* in all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
/* | ||
* @checkstyle PackageNameCheck (4 lines) | ||
*/ | ||
package EOorg.EOeolang; | ||
|
||
import org.eolang.AtComposite; | ||
import org.eolang.AtFree; | ||
import org.eolang.Data; | ||
import org.eolang.Param; | ||
import org.eolang.PhDefault; | ||
import org.eolang.Phi; | ||
import org.eolang.Versionized; | ||
import org.eolang.XmirObject; | ||
|
||
/** | ||
* PLUS. | ||
* | ||
* @since 0.23 | ||
* @checkstyle TypeNameCheck (5 lines) | ||
*/ | ||
@Versionized | ||
@XmirObject(oname = "int.plus") | ||
public class EOint$EOplus extends PhDefault { | ||
|
||
/** | ||
* Ctor. | ||
* @param sigma Sigma | ||
*/ | ||
public EOint$EOplus(final Phi sigma) { | ||
super(sigma); | ||
this.add("x", new AtFree()); | ||
this.add( | ||
"φ", | ||
new AtComposite( | ||
this, | ||
rho -> new Data.ToPhi( | ||
Long.sum( | ||
new Param(rho).strong(Long.class), | ||
new Param(rho, "x").strong(Long.class) | ||
) | ||
) | ||
) | ||
); | ||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
eo-runtime/src/main/java/EOorg/EOeolang/EOint$EOtimes.java
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,67 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2016-2023 Objectionary.com | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included | ||
* in all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
/* | ||
* @checkstyle PackageNameCheck (4 lines) | ||
*/ | ||
package EOorg.EOeolang; | ||
|
||
import org.eolang.AtComposite; | ||
import org.eolang.AtFree; | ||
import org.eolang.Data; | ||
import org.eolang.Param; | ||
import org.eolang.PhDefault; | ||
import org.eolang.Phi; | ||
import org.eolang.Versionized; | ||
import org.eolang.XmirObject; | ||
|
||
/** | ||
* TIMES. | ||
* | ||
* @since 1.0 | ||
* @checkstyle TypeNameCheck (5 lines) | ||
*/ | ||
@Versionized | ||
@XmirObject(oname = "int.times") | ||
public class EOint$EOtimes extends PhDefault { | ||
|
||
/** | ||
* Ctor. | ||
* @param sigma Sigma | ||
*/ | ||
public EOint$EOtimes(final Phi sigma) { | ||
super(sigma); | ||
this.add("x", new AtFree()); | ||
this.add( | ||
"φ", | ||
new AtComposite( | ||
this, | ||
rho -> new Data.ToPhi( | ||
new Param(rho).strong(Long.class) | ||
* new Param(rho, "x").strong(Long.class) | ||
) | ||
) | ||
); | ||
} | ||
} |
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
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
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
Oops, something went wrong.