From e18427723b7e8c09c73cceb47eb6fecb943f779c Mon Sep 17 00:00:00 2001 From: maxonfjvipon Date: Thu, 16 Jan 2025 13:53:19 +0300 Subject: [PATCH 1/2] bug(#3820): fixed ordering in to-phi --- .../org/eolang/parser/phi/to-phi.xsl | 6 +- .../parser/phi-packs/nested-bindings.yaml | 83 +++++++++++++++++++ 2 files changed, 86 insertions(+), 3 deletions(-) create mode 100644 eo-parser/src/test/resources/org/eolang/parser/phi-packs/nested-bindings.yaml diff --git a/eo-parser/src/main/resources/org/eolang/parser/phi/to-phi.xsl b/eo-parser/src/main/resources/org/eolang/parser/phi/to-phi.xsl index 714ad0e981..9130ce7478 100644 --- a/eo-parser/src/main/resources/org/eolang/parser/phi/to-phi.xsl +++ b/eo-parser/src/main/resources/org/eolang/parser/phi/to-phi.xsl @@ -160,7 +160,7 @@ SOFTWARE. - + @@ -246,7 +246,7 @@ SOFTWARE. CHECKS IF APPLICATION ARGUMENTS IS RIGHT ORDER WITH ALPHAS, e.g. α0 -> a, α1 -> b, ..., αN -> z --> - + @@ -473,7 +473,7 @@ SOFTWARE. - + diff --git a/eo-parser/src/test/resources/org/eolang/parser/phi-packs/nested-bindings.yaml b/eo-parser/src/test/resources/org/eolang/parser/phi-packs/nested-bindings.yaml new file mode 100644 index 0000000000..3e219a7c47 --- /dev/null +++ b/eo-parser/src/test/resources/org/eolang/parser/phi-packs/nested-bindings.yaml @@ -0,0 +1,83 @@ +# 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. +--- +input: | + +package com.example + + class > app + 5:version + method:init + 42:0 + "Hey":1 + 42:body +sweet: |- + {⟦ + com ↦ ⟦ + example ↦ ⟦ + app ↦ Φ̇.class( + version ↦ 5, + init ↦ Φ̇.method( + α0 ↦ 42, + α1 ↦ \"Hey\", + body ↦ 42 + ) + ), + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ + ⟧} +salty: |- + { + ⟦ + com ↦ ⟦ + example ↦ ⟦ + app ↦ Φ.org.eolang.class( + version ↦ Φ.org.eolang.number( + α0 ↦ Φ.org.eolang.bytes( + α0 ↦ ⟦ Δ ⤍ 40-14-00-00-00-00-00-00 ⟧ + ) + ), + init ↦ Φ.org.eolang.method( + α0 ↦ Φ.org.eolang.number( + α0 ↦ Φ.org.eolang.bytes( + α0 ↦ ⟦ Δ ⤍ 40-45-00-00-00-00-00-00 ⟧ + ) + ), + α1 ↦ Φ.org.eolang.string( + α0 ↦ Φ.org.eolang.bytes( + α0 ↦ ⟦ Δ ⤍ 48-65-79 ⟧ + ) + ), + body ↦ Φ.org.eolang.number( + α0 ↦ Φ.org.eolang.bytes( + α0 ↦ ⟦ Δ ⤍ 40-45-00-00-00-00-00-00 ⟧ + ) + ) + ) + ), + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ + ⟧ + } From 87de65d1c5dae3c1eba31cdd97c74d5d6fb93c93 Mon Sep 17 00:00:00 2001 From: maxonfjvipon Date: Thu, 16 Jan 2025 13:55:34 +0300 Subject: [PATCH 2/2] bug(#3820): quotes --- .../resources/org/eolang/parser/phi-packs/nested-bindings.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eo-parser/src/test/resources/org/eolang/parser/phi-packs/nested-bindings.yaml b/eo-parser/src/test/resources/org/eolang/parser/phi-packs/nested-bindings.yaml index 3e219a7c47..ed5fe4afdd 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/phi-packs/nested-bindings.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/phi-packs/nested-bindings.yaml @@ -37,7 +37,7 @@ sweet: |- version ↦ 5, init ↦ Φ̇.method( α0 ↦ 42, - α1 ↦ \"Hey\", + α1 ↦ "Hey", body ↦ 42 ) ),