From 70a050c90b8eab2432da754177f0fc8a03b21aa9 Mon Sep 17 00:00:00 2001 From: maxonfjvipon Date: Sun, 12 Jan 2025 22:27:24 +0300 Subject: [PATCH 1/3] bug(#3481): builds --- .../org/eolang/parser/shake/add-refs.xsl | 7 +- .../org/eolang/parser/shake/build-fqns.xsl | 180 ++++++++++++++++++ .../parser/eo-packs/shake/build-fqn.yaml | 58 ++++++ 3 files changed, 242 insertions(+), 3 deletions(-) create mode 100644 eo-parser/src/main/resources/org/eolang/parser/shake/build-fqns.xsl create mode 100644 eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/build-fqn.yaml diff --git a/eo-parser/src/main/resources/org/eolang/parser/shake/add-refs.xsl b/eo-parser/src/main/resources/org/eolang/parser/shake/add-refs.xsl index 4a47ff74bb..994bbd9d92 100644 --- a/eo-parser/src/main/resources/org/eolang/parser/shake/add-refs.xsl +++ b/eo-parser/src/main/resources/org/eolang/parser/shake/add-refs.xsl @@ -32,9 +32,10 @@ SOFTWARE. global or just a mistake. We must not add "ref" attributes to objects that refer to - "bytes" if such objects are inside the "org.eolang.bytes". Such - a reference would be misleading: instead of referring to the - global "org.eolang.bytes" they will lead to local "bytes" + "bytes", "string" or "number" if such objects are inside the + "org.eolang.bytes", "org.eolang.string" or "org.eolang.bytes". + Such a reference would be misleading: instead of referring to the + global, for example, "org.eolang.bytes" they will lead to local "bytes" defined in this particular file. --> diff --git a/eo-parser/src/main/resources/org/eolang/parser/shake/build-fqns.xsl b/eo-parser/src/main/resources/org/eolang/parser/shake/build-fqns.xsl new file mode 100644 index 0000000000..71ad62ac67 --- /dev/null +++ b/eo-parser/src/main/resources/org/eolang/parser/shake/build-fqns.xsl @@ -0,0 +1,180 @@ + + + + + + + + bytes + string + number + + + + + + + + + + + + . + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/build-fqn.yaml b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/build-fqn.yaml new file mode 100644 index 0000000000..85410e8628 --- /dev/null +++ b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/build-fqn.yaml @@ -0,0 +1,58 @@ +# The MIT License (MIT) +# +# Copyright (c) 2016-2025 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. +--- +sheets: + - /org/eolang/parser/shake/build-fqns.xsl +asserts: + - /program[not(errors)] + - /program/objects[count(o)=3] + - /program/objects/o[@base='foo' and @name='bar'] + - /program/objects/o[@name='foo'] + - /program/objects/o[@name='first']/o[@base='stdout' and @name='std']/o[@base='.x']/o[@base='$'] + - /program/objects/o[@name='first']/o[@name='second']/o[@base='.std']/o[1][@base='$'] + - /program/objects/o[@name='first']/o[@name='second']/o[@base='.std']/o[2][@base='.x']/o[1][@base='^'] + - /program/objects/o[@name='first']/o[@name='second']/o[@name='third']/o[@base='number' and @name='x'] + - /program/objects/o[@name='first']/o[@name='second']/o[@name='third']/o[@base='.plus']/o[1][@base='.x']/o[1][@base='$'] + - /program/objects/o[@name='first']/o[@name='second']/o[@name='third']/o[@base='.plus']/o[2][@base='.y']/o[1][@base='.^']/o[1][@base='^'] + - /program/objects/o[@name='first']/o[@name='second']/o[@name='third']/o[@base='.std']/o[1][@base='^'] + - /program/objects/o[@name='first']/o[@name='second']/o[@name='third']/o[@base='.std']/o[2][@base='qwe'] + - /program/objects/o[@name='first']/o[@name='second']/o[@name='fourth']/o[@base='string' and @name='inner'] + - /program/objects/o[@name='first']/o[@name='second']/o[@name='fourth']/o[@base='.inner' and @name='outer']/o[1][@base='^'] + - /program/objects/o[@name='first']/o[@name='second']/o[@name='fourth']/o[@base='.inner' and @name='self']/o[1][@base='$'] +input: |- + # No comments. + [x y] > first + stdout x > std + [std] > second + std x > inner + [] > third + 5 > x + x.plus y > sum + std qwe > closest + [] > fourth + "some" > inner + ^.inner > outer + inner > self + foo > bar + + # Foo. + [] > foo From a319051404723c86b9fbb2d082e51f8f6746e021 Mon Sep 17 00:00:00 2001 From: maxonfjvipon Date: Sun, 12 Jan 2025 22:41:54 +0300 Subject: [PATCH 2/3] bug(#3481): pack --- .../org/eolang/parser/shake/build-fqns.xsl | 11 ++--- .../shake/skips-fqns-in-primitives.yaml | 44 +++++++++++++++++++ 2 files changed, 50 insertions(+), 5 deletions(-) create mode 100644 eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/skips-fqns-in-primitives.yaml diff --git a/eo-parser/src/main/resources/org/eolang/parser/shake/build-fqns.xsl b/eo-parser/src/main/resources/org/eolang/parser/shake/build-fqns.xsl index 71ad62ac67..0609bed39b 100644 --- a/eo-parser/src/main/resources/org/eolang/parser/shake/build-fqns.xsl +++ b/eo-parser/src/main/resources/org/eolang/parser/shake/build-fqns.xsl @@ -22,16 +22,17 @@ 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. --> - + diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/skips-fqns-in-primitives.yaml b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/skips-fqns-in-primitives.yaml new file mode 100644 index 0000000000..2cf85919ca --- /dev/null +++ b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/skips-fqns-in-primitives.yaml @@ -0,0 +1,44 @@ +# The MIT License (MIT) +# +# Copyright (c) 2016-2025 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. +--- +sheets: + - /org/eolang/parser/shake/build-fqns.xsl +asserts: + - /program[not(errors)] + - /program/objects[count(o)=3] + - /program/objects/o[@name='number']/o[@base='number' and @name='self' and text()!=''] + - /program/objects/o[@name='bytes']/o[@base='bytes' and @name='self' and text()!=''] + - /program/objects/o[@name='string']/o[@base='string' and @name='self' and text()!=''] +input: |- + +package org.eolang + + # No comments. + [] > number + 5 > self + + # No comment. + [] > bytes + 2A- > self + + # No comment. + [] > string + "Hello" > self From 22392533c57b66b6842d878cd0345016038f67dc Mon Sep 17 00:00:00 2001 From: maxonfjvipon Date: Sun, 12 Jan 2025 22:44:22 +0300 Subject: [PATCH 3/3] bug(#3481): xcop --- .../src/main/resources/org/eolang/parser/shake/build-fqns.xsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eo-parser/src/main/resources/org/eolang/parser/shake/build-fqns.xsl b/eo-parser/src/main/resources/org/eolang/parser/shake/build-fqns.xsl index 0609bed39b..11336d2924 100644 --- a/eo-parser/src/main/resources/org/eolang/parser/shake/build-fqns.xsl +++ b/eo-parser/src/main/resources/org/eolang/parser/shake/build-fqns.xsl @@ -151,7 +151,7 @@ SOFTWARE. - +