diff --git a/README.md b/README.md index cf655191f..9737a2f04 100644 --- a/README.md +++ b/README.md @@ -165,7 +165,7 @@ This is how you iterate: x.times x x.write x.plus 1 - TRUE + true ``` This code will print this: diff --git a/eo-maven-plugin/src/it/duplicate_classes/src/test/eo/equality-test.eo b/eo-maven-plugin/src/it/duplicate_classes/src/test/eo/equality-test.eo index 996155de4..021666e89 100644 --- a/eo-maven-plugin/src/it/duplicate_classes/src/test/eo/equality-test.eo +++ b/eo-maven-plugin/src/it/duplicate_classes/src/test/eo/equality-test.eo @@ -29,4 +29,4 @@ [] > ensures-equality eq. > @ equality - TRUE \ No newline at end of file + true \ No newline at end of file diff --git a/eo-maven-plugin/src/it/fibonacci/src/main/eo/org/eolang/examples/longname.eo b/eo-maven-plugin/src/it/fibonacci/src/main/eo/org/eolang/examples/longname.eo index 3656e5728..697ae62cf 100644 --- a/eo-maven-plugin/src/it/fibonacci/src/main/eo/org/eolang/examples/longname.eo +++ b/eo-maven-plugin/src/it/fibonacci/src/main/eo/org/eolang/examples/longname.eo @@ -81,4 +81,4 @@ [] > blah38 blah39 > @ [] > blah39 - TRUE > @ + true > @ diff --git a/eo-parser/src/main/antlr4/org/eolang/parser/Eo.g4 b/eo-parser/src/main/antlr4/org/eolang/parser/Eo.g4 index f78404f27..3edb53c94 100644 --- a/eo-parser/src/main/antlr4/org/eolang/parser/Eo.g4 +++ b/eo-parser/src/main/antlr4/org/eolang/parser/Eo.g4 @@ -541,7 +541,6 @@ as : COLON (NAME | INT) // Data data: BYTES - | BOOL | TEXT | STRING | INT @@ -638,10 +637,6 @@ BYTES | LINE_BYTES (MINUS EOL LINE_BYTES)* ; -BOOL: 'TRUE' - | 'FALSE' - ; - fragment ESCAPE_SEQUENCE : '\\' [btnfr"'\\] | '\\' ([0-3]? [0-7])? [0-7] diff --git a/eo-parser/src/main/java/org/eolang/parser/XeEoListener.java b/eo-parser/src/main/java/org/eolang/parser/XeEoListener.java index 89db8cee4..69dd90b91 100644 --- a/eo-parser/src/main/java/org/eolang/parser/XeEoListener.java +++ b/eo-parser/src/main/java/org/eolang/parser/XeEoListener.java @@ -1225,14 +1225,6 @@ public final class XeEoListener implements EoListener, Iterable { type = "bytes"; base = "bytes"; data = text.replaceAll("\\s+", "").replace("-", " ").trim(); - } else if (ctx.BOOL() != null) { - type = "bytes"; - base = "bool"; - if (Boolean.parseBoolean(text)) { - data = XeEoListener.bytesToHex((byte) 0x01); - } else { - data = XeEoListener.bytesToHex((byte) 0x00); - } } else if (ctx.FLOAT() != null) { type = "bytes"; base = "float"; diff --git a/eo-runtime/src/main/eo/org/eolang/switch.eo b/eo-runtime/src/main/eo/org/eolang/switch.eo index 0a5c45ce5..3ea05f5d2 100644 --- a/eo-runtime/src/main/eo/org/eolang/switch.eo +++ b/eo-runtime/src/main/eo/org/eolang/switch.eo @@ -29,12 +29,12 @@ # Allow to choose right options according to cases conditions. # Parameter cases is the array of two dimensional array, which # consist of condition bool value and expected value, if this -# condition is TRUE. +# condition is true. # e.g. # switch # * # * -# TRUE +# true # "this value will be returned" # * # FALSE @@ -45,12 +45,12 @@ cases.length > len! # Take case by given index. - # If case key is TRUE, return case value. + # If case key is true, return case value. # Otherwise take next case. [index] > case-at if > @ index.eq ^.len - TRUE + true if at. ^.cases.at index > case diff --git a/eo-runtime/src/main/java/EOorg/EOeolang/EOif.java b/eo-runtime/src/main/java/EOorg/EOeolang/EOif.java deleted file mode 100644 index 58138dd69..000000000 --- a/eo-runtime/src/main/java/EOorg/EOeolang/EOif.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2016-2024 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.AtVoid; -import org.eolang.Atom; -import org.eolang.Param; -import org.eolang.PhDefault; -import org.eolang.Phi; -import org.eolang.Versionized; -import org.eolang.XmirObject; - -/** - * IF. - * - * @since 0.36.0 - * @checkstyle TypeNameCheck (5 lines) - */ -@Versionized -@XmirObject(oname = "if") -public final class EOif extends PhDefault implements Atom { - /** - * Ctor. - * @param sigma Sigma - */ - public EOif(final Phi sigma) { - super(sigma); - this.add("condition", new AtVoid("condition")); - this.add("left", new AtVoid("left")); - this.add("right", new AtVoid("right")); - } - - @Override - public Phi lambda() { - final Phi out; - if (new Param(this, "condition").strong(Boolean.class)) { - out = this.take("left"); - } else { - out = this.take("right"); - } - return out; - } -} diff --git a/eo-runtime/src/main/java/org/eolang/Data.java b/eo-runtime/src/main/java/org/eolang/Data.java index 73466df06..b71e0414b 100644 --- a/eo-runtime/src/main/java/org/eolang/Data.java +++ b/eo-runtime/src/main/java/org/eolang/Data.java @@ -146,46 +146,37 @@ public interface Data { */ private static Phi toPhi(final Object obj) { final Phi phi; - final byte[] bytes; - final boolean delta; final Phi eolang = Phi.Φ.take("org").take("eolang"); if (obj instanceof Boolean) { - phi = eolang.take("bool").copy(); - delta = false; if (obj.equals(true)) { - bytes = new byte[] {0x01}; + phi = eolang.take("true"); } else { - bytes = new byte[] {0x00}; + phi = eolang.take("false"); } } else if (obj instanceof byte[]) { phi = eolang.take("bytes").copy(); - delta = true; - bytes = (byte[]) obj; - } else if (obj instanceof Long) { - phi = eolang.take("int").copy(); - delta = false; - bytes = new BytesOf((Long) obj).take(); - } else if (obj instanceof String) { - phi = eolang.take("string").copy(); - delta = false; - bytes = Data.ToPhi.unescapeJavaString( - (String) obj - ).getBytes(StandardCharsets.UTF_8); - } else if (obj instanceof Double) { - phi = eolang.take("float").copy(); - delta = false; - bytes = new BytesOf((Double) obj).take(); - } else { - throw new IllegalArgumentException( - String.format( - "Unknown type of data: %s", - obj.getClass().getCanonicalName() - ) - ); - } - if (delta) { - phi.attach(bytes); + phi.attach((byte[]) obj); } else { + final byte[] bytes; + if (obj instanceof Long) { + phi = eolang.take("int").copy(); + bytes = new BytesOf((Long) obj).take(); + } else if (obj instanceof String) { + phi = eolang.take("string").copy(); + bytes = Data.ToPhi.unescapeJavaString( + (String) obj + ).getBytes(StandardCharsets.UTF_8); + } else if (obj instanceof Double) { + phi = eolang.take("float").copy(); + bytes = new BytesOf((Double) obj).take(); + } else { + throw new IllegalArgumentException( + String.format( + "Unknown type of data: %s", + obj.getClass().getCanonicalName() + ) + ); + } final Phi bts = eolang.take("bytes").copy(); bts.attach(bytes); phi.put(0, bts); diff --git a/eo-runtime/src/main/java/org/eolang/Main.java b/eo-runtime/src/main/java/org/eolang/Main.java index 05f62c794..b72d138df 100644 --- a/eo-runtime/src/main/java/org/eolang/Main.java +++ b/eo-runtime/src/main/java/org/eolang/Main.java @@ -134,7 +134,7 @@ public final class Main { /** * Process one option. * @param opt The option - * @return TRUE if it's time to exit + * @return True if it's time to exit * @throws IOException If fails */ private static boolean parse(final String opt) throws IOException { diff --git a/eo-runtime/src/test/eo/org/eolang/bool-tests.eo b/eo-runtime/src/test/eo/org/eolang/bool-tests.eo index 5bc49d103..183b9c6d7 100644 --- a/eo-runtime/src/test/eo/org/eolang/bool-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/bool-tests.eo @@ -29,18 +29,18 @@ # Test. [] > compares-two-bools eq. > @ - TRUE - TRUE + true + true # Test. [] > true-as-bool - TRUE.as-bool > @ + true.as-bool > @ # Test. [] > compares-two-different-types not. > @ eq. - TRUE + true 42 # Test. diff --git a/eo-runtime/src/test/eo/org/eolang/goto-tests.eo b/eo-runtime/src/test/eo/org/eolang/goto-tests.eo index 8c0c64923..fd9c35a37 100644 --- a/eo-runtime/src/test/eo/org/eolang/goto-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/goto-tests.eo @@ -43,7 +43,7 @@ if i.as-int.lt 10 g.backward - TRUE + true stdout "Finished!\n" i 10 @@ -62,7 +62,7 @@ * if x.eq 0 - g.forward TRUE + g.forward true TRUE r.write (42.div x) (dataized r).as-bytes > result diff --git a/eo-runtime/src/test/eo/org/eolang/memory-tests.eo b/eo-runtime/src/test/eo/org/eolang/memory-tests.eo index 0c7eb2de4..1d89363dd 100644 --- a/eo-runtime/src/test/eo/org/eolang/memory-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/memory-tests.eo @@ -112,7 +112,7 @@ and. > @ QQ.io.stdout e m.free - TRUE + true # Test. [] > memory-is-strictly-typed-string-error-overflow diff --git a/eo-runtime/src/test/eo/org/eolang/negative-infinity-tests.eo b/eo-runtime/src/test/eo/org/eolang/negative-infinity-tests.eo index 9a5fbfd90..2c747d0e9 100644 --- a/eo-runtime/src/test/eo/org/eolang/negative-infinity-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/negative-infinity-tests.eo @@ -76,7 +76,7 @@ [] > negative-infinity-lt-positive-infinity eq. > @ negative-infinity.lt positive-infinity - TRUE + true # Test. [] > negative-infinity-not-lt-nan @@ -100,13 +100,13 @@ [] > negative-infinity-lte-negative-infinity eq. > @ negative-infinity.lte negative-infinity - TRUE + true # Test. [] > negative-infinity-lte-positive-infinity eq. > @ negative-infinity.lte positive-infinity - TRUE + true # Test. [] > negative-infinity-not-lte-nan @@ -118,13 +118,13 @@ [] > negative-infinity-lte-int eq. > @ negative-infinity.lte 42 - TRUE + true # Test. [] > negative-infinity-lte-float eq. > @ negative-infinity.lte 42.5 - TRUE + true # Greater than. [] > negative-infinity-gt-negative-infinity diff --git a/eo-runtime/src/test/eo/org/eolang/positive-infinity-tests.eo b/eo-runtime/src/test/eo/org/eolang/positive-infinity-tests.eo index 43dd2ca6a..e6d5cf2c4 100644 --- a/eo-runtime/src/test/eo/org/eolang/positive-infinity-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/positive-infinity-tests.eo @@ -100,7 +100,7 @@ [] > positive-infinity-lte-positive-infinity eq. > @ positive-infinity.lte positive-infinity - TRUE + true # Test. [] > positive-infinity-not-lte-negative-infinity diff --git a/eo-runtime/src/test/eo/org/eolang/seq-tests.eo b/eo-runtime/src/test/eo/org/eolang/seq-tests.eo index 9709c88d8..1a75d456c 100644 --- a/eo-runtime/src/test/eo/org/eolang/seq-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/seq-tests.eo @@ -82,51 +82,51 @@ # This test should have acceptable time to pass. [] > very-long-seq eq. > @ - TRUE + true seq * - TRUE - TRUE - TRUE - TRUE - TRUE - TRUE - TRUE - TRUE - TRUE - TRUE - TRUE - TRUE - TRUE - TRUE - TRUE - TRUE - TRUE - TRUE - TRUE - TRUE - TRUE - TRUE - TRUE - TRUE - TRUE - TRUE - TRUE - TRUE - TRUE - TRUE - TRUE - TRUE - TRUE - TRUE - TRUE - TRUE - TRUE - TRUE - TRUE - TRUE - TRUE - TRUE + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true # Test. [] > seq-single-dataization-int-equal-to-test diff --git a/eo-runtime/src/test/eo/org/eolang/string-tests.eo b/eo-runtime/src/test/eo/org/eolang/string-tests.eo index de055d390..6d421fe30 100644 --- a/eo-runtime/src/test/eo/org/eolang/string-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/string-tests.eo @@ -148,7 +148,7 @@ eq. "x" "x" - TRUE + true # Test. [] > one-symbol-string-compares @@ -240,7 +240,7 @@ 1 [e] QQ.io.stdout e > @ - TRUE + true # Test. [] > slice-end-below-start @@ -252,7 +252,7 @@ -1 [e] QQ.io.stdout e > @ - TRUE + true # Test. [] > slice-end-greater-actual @@ -264,4 +264,4 @@ 5 [e] QQ.io.stdout e > @ - TRUE + true diff --git a/eo-runtime/src/test/eo/org/eolang/switch-tests.eo b/eo-runtime/src/test/eo/org/eolang/switch-tests.eo index 715407ca3..e235079c7 100644 --- a/eo-runtime/src/test/eo/org/eolang/switch-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/switch-tests.eo @@ -35,7 +35,7 @@ FALSE "1" * - TRUE + true "2" "2" @@ -62,13 +62,13 @@ switch * * - TRUE + true "TRUE1" * FALSE "FALSE" * - TRUE + true "TRUE2" "TRUE1"