Skip to content

Commit

Permalink
Merge pull request #3276 from maxonfjvipon/feat/#3251/text-and-sscanf…
Browse files Browse the repository at this point in the history
…-in-runtime

feat(#3251): added `text` and `sscanf` objects to `eo-runtime`
  • Loading branch information
yegor256 authored Jul 17, 2024
2 parents c0c7d49 + b248cfd commit d4513c7
Show file tree
Hide file tree
Showing 14 changed files with 1,251 additions and 270 deletions.
5 changes: 1 addition & 4 deletions .codacy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,4 @@
# package name contains capital letter and such names are conventional.
---
exclude_paths:
- "eo-runtime/src/test/java/EOorg/EOeolang/EOtxt/EOsprintfTest.java"
- "eo-runtime/src/test/java/EOorg/EOeolang/EOtxt/package-info.java"
- "eo-runtime/src/main/java/EOorg/EOeolang/EOtxt/EOsprintf.java"
- "eo-runtime/src/main/java/EOorg/EOeolang/EOtxt/package-info.java"
- "eo-runtime/src/main/java/EOorg/EOeolang/EOtxt/EOsscanf.java"
6 changes: 0 additions & 6 deletions eo-runtime/src/main/eo/org/eolang/string.eo
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@
[as-bytes] > string
as-bytes > @

# Is true if both objects are equal.
[x] > eq
eq. > @
^.as-bytes
x.as-bytes

# Get the length of it.
[] > length /int

Expand Down
35 changes: 35 additions & 0 deletions eo-runtime/src/main/eo/org/eolang/txt/sscanf.eo
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# 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.

+architect [email protected]
+home https://github.com/objectionary/eo
+package org.eolang.txt
+rt jvm org.eolang:eo-runtime:0.0.0
+rt node eo2js-runtime:0.0.0
+version 0.0.0

# Reads formatted input from a string.
# This object has two free attributes:
# 1. `format` - is a formatter string (e.g. "Hello, %s!")
# 2. `read` - is a string where data exists (e.g. "Hello, John!")
# returns a `tuple` of formatted values (e.g. * "John").
[format read] > sscanf /tuple
Loading

2 comments on commit d4513c7

@0pdd
Copy link

@0pdd 0pdd commented on d4513c7 Jul 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 2718-91412c50 disappeared from eo-runtime/src/test/java/org/eolang/SnippetTestCase.java), that's why I closed #2985. Please, remember that the puzzle was not necessarily removed in this particular commit. Maybe it happened earlier, but we discovered this fact only now.

@0pdd
Copy link

@0pdd 0pdd commented on d4513c7 Jul 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 3251-af1f04ef discovered in eo-runtime/src/main/eo/org/eolang/txt/text.eo) and submitted as #3277. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but we discovered it only now.

Please sign in to comment.