koatl 0.3.8__tar.gz → 0.3.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {koatl-0.3.8 → koatl-0.3.9}/Cargo.lock +1 -1
- {koatl-0.3.8 → koatl-0.3.9}/PKG-INFO +1 -1
- {koatl-0.3.8 → koatl-0.3.9}/koatl/Cargo.toml +1 -1
- koatl-0.3.9/koatl/python/koatl/prelude/__init__.tl +38 -0
- {koatl-0.3.8 → koatl-0.3.9/koatl}/python/koatl/std/data/list.tl +1 -1
- {koatl-0.3.8 → koatl-0.3.9}/koatl/python/koatl/std/iter.tl +3 -3
- koatl-0.3.9/koatl/python/koatl/std/re.tl +41 -0
- koatl-0.3.9/python/koatl/prelude/__init__.tl +38 -0
- {koatl-0.3.8/koatl → koatl-0.3.9}/python/koatl/std/data/list.tl +1 -1
- {koatl-0.3.8 → koatl-0.3.9}/python/koatl/std/iter.tl +3 -3
- koatl-0.3.9/python/koatl/std/re.tl +41 -0
- koatl-0.3.8/koatl/python/koatl/prelude/__init__.tl +0 -42
- koatl-0.3.8/koatl/python/koatl/std/re.tl +0 -48
- koatl-0.3.8/python/koatl/prelude/__init__.tl +0 -42
- koatl-0.3.8/python/koatl/std/re.tl +0 -48
- {koatl-0.3.8 → koatl-0.3.9}/Cargo.toml +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/README.md +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/.github/workflows/CI.yml +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/.gitignore +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/LICENSE +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/README.md +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/python/koatl/__init__.py +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/python/koatl/__main__.py +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/python/koatl/cli.py +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/python/koatl/notebook/__init__.py +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/python/koatl/notebook/magic.py +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/python/koatl/runtime/__init__.py +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/python/koatl/runtime/meta_finder.py +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/python/koatl/runtime/record.py +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/python/koatl/runtime/vattr.py +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/python/koatl/std/__init__.tl +0 -0
- {koatl-0.3.8/koatl/python/koatl/std/alg → koatl-0.3.9/koatl/python/koatl/std/control}/__init__.tl +0 -0
- {koatl-0.3.8/koatl/python/koatl/std/alg → koatl-0.3.9/koatl/python/koatl/std/control}/async.tl +0 -0
- {koatl-0.3.8/koatl/python/koatl/std/alg → koatl-0.3.9/koatl/python/koatl/std/control}/base.tl +0 -0
- {koatl-0.3.8/koatl/python/koatl/std/alg → koatl-0.3.9/koatl/python/koatl/std/control}/do.tl +0 -0
- {koatl-0.3.8/koatl/python/koatl/std/alg → koatl-0.3.9/koatl/python/koatl/std/control}/env.tl +0 -0
- {koatl-0.3.8/koatl/python/koatl/std/alg → koatl-0.3.9/koatl/python/koatl/std/control}/memo.tl +0 -0
- {koatl-0.3.8/koatl/python/koatl/std/alg → koatl-0.3.9/koatl/python/koatl/std/control}/result.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/python/koatl/std/data/__init__.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/python/koatl/std/data/record.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/python/koatl/std/ext.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/python/koatl/std/io.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/python/koatl/std/json.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/python/koatl/std/lazy_module.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/python/koatl/std/pickle.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/python/koatl/std/trait.py +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/requirements.txt +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/src/emit_py.rs +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/src/lib.rs +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/tests/e2e/base/containers.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/tests/e2e/base/data.txt +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/tests/e2e/base/decorators.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/tests/e2e/base/destructure-for-and-fn.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/tests/e2e/base/destructure.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/tests/e2e/base/escape_ident.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/tests/e2e/base/fstr.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/tests/e2e/base/functions.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/tests/e2e/base/generator.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/tests/e2e/base/if_expr.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/tests/e2e/base/loops.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/tests/e2e/base/match.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/tests/e2e/base/nary-list.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/tests/e2e/base/placeholder.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/tests/e2e/base/precedence.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/tests/e2e/base/scopes.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/tests/e2e/base/semantic_whitespace.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/tests/e2e/base/short_circuit.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/tests/e2e/base/with.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/tests/e2e/prelude/async.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/tests/e2e/prelude/aug_assign.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/tests/e2e/prelude/coal.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/tests/e2e/prelude/env.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/tests/e2e/prelude/imports.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/tests/e2e/prelude/iterables.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/tests/e2e/prelude/list.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/tests/e2e/prelude/memo.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/tests/e2e/prelude/record.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/tests/e2e/prelude/result.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/tests/e2e/prelude/slice.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/tests/e2e/prelude/try.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/tests/e2e/prelude/virtual.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/tests/e2e/util/__init__.py +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/tests/e2e/util/module0.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/tests/e2e/util/module1.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/tests/e2e/util/module2.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/tests/parse/arith.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/tests/parse/assign.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/tests/parse/block-comments.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/tests/parse/deco.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/tests/parse/func.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/tests/parse/matches.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/tests/parse/numbers.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/tests/test_e2e.py +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl/tests/test_parse.py +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl-core/Cargo.toml +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl-core/src/ast.rs +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl-core/src/ast_builder.rs +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl-core/src/inference.rs +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl-core/src/lib.rs +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl-core/src/lift_cst.rs +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl-core/src/main.rs +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl-core/src/py/ast.rs +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl-core/src/py/ast_builder.rs +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl-core/src/py/emit.rs +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl-core/src/py/mod.rs +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl-core/src/resolve_scopes.rs +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl-core/src/transform.rs +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl-core/src/types.rs +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl-core/src/util.rs +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl-parser/Cargo.toml +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl-parser/src/cst.rs +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl-parser/src/lexer.rs +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl-parser/src/lib.rs +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl-parser/src/parser.rs +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/koatl-parser/src/simple_fmt.rs +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/pyproject.toml +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/python/koatl/__init__.py +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/python/koatl/__main__.py +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/python/koatl/cli.py +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/python/koatl/notebook/__init__.py +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/python/koatl/notebook/magic.py +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/python/koatl/runtime/__init__.py +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/python/koatl/runtime/meta_finder.py +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/python/koatl/runtime/record.py +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/python/koatl/runtime/vattr.py +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/python/koatl/std/__init__.tl +0 -0
- {koatl-0.3.8/python/koatl/std/alg → koatl-0.3.9/python/koatl/std/control}/__init__.tl +0 -0
- {koatl-0.3.8/python/koatl/std/alg → koatl-0.3.9/python/koatl/std/control}/async.tl +0 -0
- {koatl-0.3.8/python/koatl/std/alg → koatl-0.3.9/python/koatl/std/control}/base.tl +0 -0
- {koatl-0.3.8/python/koatl/std/alg → koatl-0.3.9/python/koatl/std/control}/do.tl +0 -0
- {koatl-0.3.8/python/koatl/std/alg → koatl-0.3.9/python/koatl/std/control}/env.tl +0 -0
- {koatl-0.3.8/python/koatl/std/alg → koatl-0.3.9/python/koatl/std/control}/memo.tl +0 -0
- {koatl-0.3.8/python/koatl/std/alg → koatl-0.3.9/python/koatl/std/control}/result.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/python/koatl/std/data/__init__.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/python/koatl/std/data/record.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/python/koatl/std/ext.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/python/koatl/std/io.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/python/koatl/std/json.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/python/koatl/std/lazy_module.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/python/koatl/std/pickle.tl +0 -0
- {koatl-0.3.8 → koatl-0.3.9}/python/koatl/std/trait.py +0 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export import koatl.std.(
|
|
2
|
+
trait.*
|
|
3
|
+
ext.*
|
|
4
|
+
data.*
|
|
5
|
+
iter.*
|
|
6
|
+
control.(Result, Ok, Err, Env, Memo, Async, AsyncMemo, do)
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
import koatl.std.(
|
|
10
|
+
re.Pattern
|
|
11
|
+
lazy_module.(LazyModule, RootModulesProxy)
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
export std = LazyModule("koatl.std")
|
|
15
|
+
export mod = RootModulesProxy()
|
|
16
|
+
|
|
17
|
+
Extension.trait(Iterable)
|
|
18
|
+
|
|
19
|
+
Extension.property(list, "len")! List.len.fget
|
|
20
|
+
|
|
21
|
+
Extension.property(object, "result")! self => Result(self)
|
|
22
|
+
|
|
23
|
+
Extension.method(str, "match")! (regex, str) => Pattern(regex).match(str)
|
|
24
|
+
Extension.method(str, "matches")! (str, regex) => Pattern(regex).match(str)
|
|
25
|
+
|
|
26
|
+
__tl__.do = koatl.std.control.do.do
|
|
27
|
+
|
|
28
|
+
__tl__.op_map = koatl.std.control.result.op_map
|
|
29
|
+
__tl__.op_coal = koatl.std.control.result.op_coal
|
|
30
|
+
|
|
31
|
+
__tl__.Ok = koatl.std.control.result.Ok
|
|
32
|
+
__tl__.Err = koatl.std.control.result.Err
|
|
33
|
+
__tl__.Result = koatl.std.control.result.Result
|
|
34
|
+
|
|
35
|
+
__tl__.MatchError = koatl.std.MatchError
|
|
36
|
+
|
|
37
|
+
__tl__.memo_value = koatl.std.control.memo.Memo.value
|
|
38
|
+
__tl__.async_memo_value = koatl.std.control.memo.AsyncMemo.value
|
|
@@ -3,14 +3,14 @@ import builtins
|
|
|
3
3
|
|
|
4
4
|
import koatl.std.data.Record
|
|
5
5
|
import koatl.std.trait.Trait
|
|
6
|
-
import .
|
|
6
|
+
import .control.(Traversable, Ok, Err, Memo, Async, AsyncMemo, Result)
|
|
7
7
|
|
|
8
8
|
export Iterable = class(Traversable, Trait):
|
|
9
9
|
iter = Trait.abstract! self => None
|
|
10
10
|
|
|
11
11
|
skip = (self, n) =>
|
|
12
12
|
let it = self.iter
|
|
13
|
-
for _ in
|
|
13
|
+
for _ in..n:
|
|
14
14
|
next(it, None)
|
|
15
15
|
it
|
|
16
16
|
|
|
@@ -27,7 +27,7 @@ export Iterable = class(Traversable, Trait):
|
|
|
27
27
|
take = (self, n) =>
|
|
28
28
|
let impl = () =>
|
|
29
29
|
let it = self.iter
|
|
30
|
-
for _ in
|
|
30
|
+
for _ in..n:
|
|
31
31
|
try:
|
|
32
32
|
yield next(it)
|
|
33
33
|
except StopIteration(value=value) =>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import re
|
|
2
|
+
import collections
|
|
3
|
+
import .control.Result
|
|
4
|
+
|
|
5
|
+
export Pattern = class:
|
|
6
|
+
__slots__ = ("pattern",)
|
|
7
|
+
|
|
8
|
+
__init__ = (self, pattern) =>
|
|
9
|
+
pattern match:
|
|
10
|
+
re.Pattern() => self.pattern = pattern
|
|
11
|
+
str() => self.pattern = re.compile(pattern)
|
|
12
|
+
Pattern(pattern=pattern) => self.pattern = pattern
|
|
13
|
+
default => raise TypeError(
|
|
14
|
+
f"Expected a str or pattern, but got {type(pattern).__name__}"
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
__repr__ = self => f"Pattern({self.pattern})"
|
|
18
|
+
|
|
19
|
+
match = (self, string, flags=0) =>
|
|
20
|
+
if not isinstance(string, str):
|
|
21
|
+
raise TypeError(f"Expected a string, but got {type(string).__name__}")
|
|
22
|
+
|
|
23
|
+
self.pattern.match(string, flags).result.map(Match)
|
|
24
|
+
|
|
25
|
+
export Match = collections.abc.Sequence.register! class:
|
|
26
|
+
__slots__ = ("_match",)
|
|
27
|
+
__match_args__ = ("match",)
|
|
28
|
+
|
|
29
|
+
__init__ = (self, match) =>
|
|
30
|
+
if not isinstance(match, re.Match):
|
|
31
|
+
raise TypeError(f"Expected a re.Match, but got {type(match).__name__}")
|
|
32
|
+
|
|
33
|
+
self._match = match
|
|
34
|
+
|
|
35
|
+
__iter__ = self => iter(self._match.groups())
|
|
36
|
+
__len__ = self => len(self._match.groups())
|
|
37
|
+
__getitem__ = (self, index) => self._match[index]
|
|
38
|
+
|
|
39
|
+
match = property! self => self._match.group(0)
|
|
40
|
+
|
|
41
|
+
__repr__ = self => f"Match({self._match})"
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export import koatl.std.(
|
|
2
|
+
trait.*
|
|
3
|
+
ext.*
|
|
4
|
+
data.*
|
|
5
|
+
iter.*
|
|
6
|
+
control.(Result, Ok, Err, Env, Memo, Async, AsyncMemo, do)
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
import koatl.std.(
|
|
10
|
+
re.Pattern
|
|
11
|
+
lazy_module.(LazyModule, RootModulesProxy)
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
export std = LazyModule("koatl.std")
|
|
15
|
+
export mod = RootModulesProxy()
|
|
16
|
+
|
|
17
|
+
Extension.trait(Iterable)
|
|
18
|
+
|
|
19
|
+
Extension.property(list, "len")! List.len.fget
|
|
20
|
+
|
|
21
|
+
Extension.property(object, "result")! self => Result(self)
|
|
22
|
+
|
|
23
|
+
Extension.method(str, "match")! (regex, str) => Pattern(regex).match(str)
|
|
24
|
+
Extension.method(str, "matches")! (str, regex) => Pattern(regex).match(str)
|
|
25
|
+
|
|
26
|
+
__tl__.do = koatl.std.control.do.do
|
|
27
|
+
|
|
28
|
+
__tl__.op_map = koatl.std.control.result.op_map
|
|
29
|
+
__tl__.op_coal = koatl.std.control.result.op_coal
|
|
30
|
+
|
|
31
|
+
__tl__.Ok = koatl.std.control.result.Ok
|
|
32
|
+
__tl__.Err = koatl.std.control.result.Err
|
|
33
|
+
__tl__.Result = koatl.std.control.result.Result
|
|
34
|
+
|
|
35
|
+
__tl__.MatchError = koatl.std.MatchError
|
|
36
|
+
|
|
37
|
+
__tl__.memo_value = koatl.std.control.memo.Memo.value
|
|
38
|
+
__tl__.async_memo_value = koatl.std.control.memo.AsyncMemo.value
|
|
@@ -3,14 +3,14 @@ import builtins
|
|
|
3
3
|
|
|
4
4
|
import koatl.std.data.Record
|
|
5
5
|
import koatl.std.trait.Trait
|
|
6
|
-
import .
|
|
6
|
+
import .control.(Traversable, Ok, Err, Memo, Async, AsyncMemo, Result)
|
|
7
7
|
|
|
8
8
|
export Iterable = class(Traversable, Trait):
|
|
9
9
|
iter = Trait.abstract! self => None
|
|
10
10
|
|
|
11
11
|
skip = (self, n) =>
|
|
12
12
|
let it = self.iter
|
|
13
|
-
for _ in
|
|
13
|
+
for _ in..n:
|
|
14
14
|
next(it, None)
|
|
15
15
|
it
|
|
16
16
|
|
|
@@ -27,7 +27,7 @@ export Iterable = class(Traversable, Trait):
|
|
|
27
27
|
take = (self, n) =>
|
|
28
28
|
let impl = () =>
|
|
29
29
|
let it = self.iter
|
|
30
|
-
for _ in
|
|
30
|
+
for _ in..n:
|
|
31
31
|
try:
|
|
32
32
|
yield next(it)
|
|
33
33
|
except StopIteration(value=value) =>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import re
|
|
2
|
+
import collections
|
|
3
|
+
import .control.Result
|
|
4
|
+
|
|
5
|
+
export Pattern = class:
|
|
6
|
+
__slots__ = ("pattern",)
|
|
7
|
+
|
|
8
|
+
__init__ = (self, pattern) =>
|
|
9
|
+
pattern match:
|
|
10
|
+
re.Pattern() => self.pattern = pattern
|
|
11
|
+
str() => self.pattern = re.compile(pattern)
|
|
12
|
+
Pattern(pattern=pattern) => self.pattern = pattern
|
|
13
|
+
default => raise TypeError(
|
|
14
|
+
f"Expected a str or pattern, but got {type(pattern).__name__}"
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
__repr__ = self => f"Pattern({self.pattern})"
|
|
18
|
+
|
|
19
|
+
match = (self, string, flags=0) =>
|
|
20
|
+
if not isinstance(string, str):
|
|
21
|
+
raise TypeError(f"Expected a string, but got {type(string).__name__}")
|
|
22
|
+
|
|
23
|
+
self.pattern.match(string, flags).result.map(Match)
|
|
24
|
+
|
|
25
|
+
export Match = collections.abc.Sequence.register! class:
|
|
26
|
+
__slots__ = ("_match",)
|
|
27
|
+
__match_args__ = ("match",)
|
|
28
|
+
|
|
29
|
+
__init__ = (self, match) =>
|
|
30
|
+
if not isinstance(match, re.Match):
|
|
31
|
+
raise TypeError(f"Expected a re.Match, but got {type(match).__name__}")
|
|
32
|
+
|
|
33
|
+
self._match = match
|
|
34
|
+
|
|
35
|
+
__iter__ = self => iter(self._match.groups())
|
|
36
|
+
__len__ = self => len(self._match.groups())
|
|
37
|
+
__getitem__ = (self, index) => self._match[index]
|
|
38
|
+
|
|
39
|
+
match = property! self => self._match.group(0)
|
|
40
|
+
|
|
41
|
+
__repr__ = self => f"Match({self._match})"
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
export import koatl.std.(
|
|
2
|
-
trait.*
|
|
3
|
-
ext.*
|
|
4
|
-
data.*
|
|
5
|
-
iter.*
|
|
6
|
-
alg.(Result, Ok, Err, Env, Memo, Async, AsyncMemo)
|
|
7
|
-
alg.do
|
|
8
|
-
)
|
|
9
|
-
|
|
10
|
-
import koatl.std.(
|
|
11
|
-
re.Pattern
|
|
12
|
-
lazy_module.(LazyModule, RootModulesProxy)
|
|
13
|
-
)
|
|
14
|
-
|
|
15
|
-
export std = LazyModule("koatl.std")
|
|
16
|
-
export mod = RootModulesProxy()
|
|
17
|
-
|
|
18
|
-
Extension.trait(Iterable)
|
|
19
|
-
|
|
20
|
-
Extension.property(list, "len")! List.len.fget
|
|
21
|
-
|
|
22
|
-
Extension.property(object, "result")! self => Result(self)
|
|
23
|
-
|
|
24
|
-
Extension.method(str, "match")! (regex, str) => Pattern(regex).match(str)
|
|
25
|
-
|
|
26
|
-
# Note: the below methods have arguments in reverse order to Python's re module.
|
|
27
|
-
Extension.method(str, "matches")! (str, regex) => Pattern(regex).match(str)
|
|
28
|
-
Extension.method(str, "search")! (str, regex) => Pattern(regex).search(str)
|
|
29
|
-
|
|
30
|
-
__tl__.do = koatl.std.alg.do.do
|
|
31
|
-
|
|
32
|
-
__tl__.op_map = koatl.std.alg.result.op_map
|
|
33
|
-
__tl__.op_coal = koatl.std.alg.result.op_coal
|
|
34
|
-
|
|
35
|
-
__tl__.Ok = koatl.std.alg.result.Ok
|
|
36
|
-
__tl__.Err = koatl.std.alg.result.Err
|
|
37
|
-
__tl__.Result = koatl.std.alg.result.Result
|
|
38
|
-
|
|
39
|
-
__tl__.MatchError = koatl.std.MatchError
|
|
40
|
-
|
|
41
|
-
__tl__.memo_value = koatl.std.alg.memo.Memo.value
|
|
42
|
-
__tl__.async_memo_value = koatl.std.alg.memo.AsyncMemo.value
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import re
|
|
2
|
-
import collections
|
|
3
|
-
import .alg.Result
|
|
4
|
-
|
|
5
|
-
export Pattern = class:
|
|
6
|
-
__slots__ = ("pattern",)
|
|
7
|
-
|
|
8
|
-
__init__ = (self, pattern) =>
|
|
9
|
-
pattern match:
|
|
10
|
-
re.Pattern() => self.pattern = pattern
|
|
11
|
-
str() => self.pattern = re.compile(pattern)
|
|
12
|
-
Regex(pattern=pattern) => self.pattern = pattern
|
|
13
|
-
default => raise TypeError(
|
|
14
|
-
f"Expected a str or pattern, but got {type(pattern).__name__}"
|
|
15
|
-
)
|
|
16
|
-
|
|
17
|
-
__repr__ = self => f"Regex({self.pattern})"
|
|
18
|
-
|
|
19
|
-
match = (self, string) =>
|
|
20
|
-
if not isinstance(string, str):
|
|
21
|
-
raise TypeError(f"Expected a string, but got {type(string).__name__}")
|
|
22
|
-
|
|
23
|
-
self.pattern.match(string).result.map(Regex.Match)
|
|
24
|
-
|
|
25
|
-
search = (self, string) =>
|
|
26
|
-
if not isinstance(string, str):
|
|
27
|
-
raise TypeError(f"Expected a string, but got {type(string).__name__}")
|
|
28
|
-
|
|
29
|
-
self.pattern.search(string).result.map(Regex.Match)
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
Match = collections.abc.Sequence.register! class:
|
|
33
|
-
__slots__ = ("_match",)
|
|
34
|
-
__match_args__ = ("match",)
|
|
35
|
-
|
|
36
|
-
__init__ = (self, match) =>
|
|
37
|
-
if not isinstance(match, re.Match):
|
|
38
|
-
raise TypeError(f"Expected a re.Match, but got {type(match).__name__}")
|
|
39
|
-
|
|
40
|
-
self._match = match
|
|
41
|
-
|
|
42
|
-
__iter__ = self => iter(self._match.groups())
|
|
43
|
-
__len__ = self => len(self._match.groups())
|
|
44
|
-
__getitem__ = (self, index) => self._match[index]
|
|
45
|
-
|
|
46
|
-
match = property! self => self._match.group(0)
|
|
47
|
-
|
|
48
|
-
__repr__ = self => f"Match({self._match})"
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
export import koatl.std.(
|
|
2
|
-
trait.*
|
|
3
|
-
ext.*
|
|
4
|
-
data.*
|
|
5
|
-
iter.*
|
|
6
|
-
alg.(Result, Ok, Err, Env, Memo, Async, AsyncMemo)
|
|
7
|
-
alg.do
|
|
8
|
-
)
|
|
9
|
-
|
|
10
|
-
import koatl.std.(
|
|
11
|
-
re.Pattern
|
|
12
|
-
lazy_module.(LazyModule, RootModulesProxy)
|
|
13
|
-
)
|
|
14
|
-
|
|
15
|
-
export std = LazyModule("koatl.std")
|
|
16
|
-
export mod = RootModulesProxy()
|
|
17
|
-
|
|
18
|
-
Extension.trait(Iterable)
|
|
19
|
-
|
|
20
|
-
Extension.property(list, "len")! List.len.fget
|
|
21
|
-
|
|
22
|
-
Extension.property(object, "result")! self => Result(self)
|
|
23
|
-
|
|
24
|
-
Extension.method(str, "match")! (regex, str) => Pattern(regex).match(str)
|
|
25
|
-
|
|
26
|
-
# Note: the below methods have arguments in reverse order to Python's re module.
|
|
27
|
-
Extension.method(str, "matches")! (str, regex) => Pattern(regex).match(str)
|
|
28
|
-
Extension.method(str, "search")! (str, regex) => Pattern(regex).search(str)
|
|
29
|
-
|
|
30
|
-
__tl__.do = koatl.std.alg.do.do
|
|
31
|
-
|
|
32
|
-
__tl__.op_map = koatl.std.alg.result.op_map
|
|
33
|
-
__tl__.op_coal = koatl.std.alg.result.op_coal
|
|
34
|
-
|
|
35
|
-
__tl__.Ok = koatl.std.alg.result.Ok
|
|
36
|
-
__tl__.Err = koatl.std.alg.result.Err
|
|
37
|
-
__tl__.Result = koatl.std.alg.result.Result
|
|
38
|
-
|
|
39
|
-
__tl__.MatchError = koatl.std.MatchError
|
|
40
|
-
|
|
41
|
-
__tl__.memo_value = koatl.std.alg.memo.Memo.value
|
|
42
|
-
__tl__.async_memo_value = koatl.std.alg.memo.AsyncMemo.value
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import re
|
|
2
|
-
import collections
|
|
3
|
-
import .alg.Result
|
|
4
|
-
|
|
5
|
-
export Pattern = class:
|
|
6
|
-
__slots__ = ("pattern",)
|
|
7
|
-
|
|
8
|
-
__init__ = (self, pattern) =>
|
|
9
|
-
pattern match:
|
|
10
|
-
re.Pattern() => self.pattern = pattern
|
|
11
|
-
str() => self.pattern = re.compile(pattern)
|
|
12
|
-
Regex(pattern=pattern) => self.pattern = pattern
|
|
13
|
-
default => raise TypeError(
|
|
14
|
-
f"Expected a str or pattern, but got {type(pattern).__name__}"
|
|
15
|
-
)
|
|
16
|
-
|
|
17
|
-
__repr__ = self => f"Regex({self.pattern})"
|
|
18
|
-
|
|
19
|
-
match = (self, string) =>
|
|
20
|
-
if not isinstance(string, str):
|
|
21
|
-
raise TypeError(f"Expected a string, but got {type(string).__name__}")
|
|
22
|
-
|
|
23
|
-
self.pattern.match(string).result.map(Regex.Match)
|
|
24
|
-
|
|
25
|
-
search = (self, string) =>
|
|
26
|
-
if not isinstance(string, str):
|
|
27
|
-
raise TypeError(f"Expected a string, but got {type(string).__name__}")
|
|
28
|
-
|
|
29
|
-
self.pattern.search(string).result.map(Regex.Match)
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
Match = collections.abc.Sequence.register! class:
|
|
33
|
-
__slots__ = ("_match",)
|
|
34
|
-
__match_args__ = ("match",)
|
|
35
|
-
|
|
36
|
-
__init__ = (self, match) =>
|
|
37
|
-
if not isinstance(match, re.Match):
|
|
38
|
-
raise TypeError(f"Expected a re.Match, but got {type(match).__name__}")
|
|
39
|
-
|
|
40
|
-
self._match = match
|
|
41
|
-
|
|
42
|
-
__iter__ = self => iter(self._match.groups())
|
|
43
|
-
__len__ = self => len(self._match.groups())
|
|
44
|
-
__getitem__ = (self, index) => self._match[index]
|
|
45
|
-
|
|
46
|
-
match = property! self => self._match.group(0)
|
|
47
|
-
|
|
48
|
-
__repr__ = self => f"Match({self._match})"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{koatl-0.3.8/koatl/python/koatl/std/alg → koatl-0.3.9/koatl/python/koatl/std/control}/__init__.tl
RENAMED
|
File without changes
|
{koatl-0.3.8/koatl/python/koatl/std/alg → koatl-0.3.9/koatl/python/koatl/std/control}/async.tl
RENAMED
|
File without changes
|
{koatl-0.3.8/koatl/python/koatl/std/alg → koatl-0.3.9/koatl/python/koatl/std/control}/base.tl
RENAMED
|
File without changes
|
|
File without changes
|
{koatl-0.3.8/koatl/python/koatl/std/alg → koatl-0.3.9/koatl/python/koatl/std/control}/env.tl
RENAMED
|
File without changes
|
{koatl-0.3.8/koatl/python/koatl/std/alg → koatl-0.3.9/koatl/python/koatl/std/control}/memo.tl
RENAMED
|
File without changes
|
{koatl-0.3.8/koatl/python/koatl/std/alg → koatl-0.3.9/koatl/python/koatl/std/control}/result.tl
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|