koatl 0.1.21__tar.gz → 0.1.22__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.1.21 → koatl-0.1.22}/Cargo.lock +1 -1
- {koatl-0.1.21 → koatl-0.1.22}/PKG-INFO +1 -1
- {koatl-0.1.21 → koatl-0.1.22}/koatl/Cargo.toml +1 -1
- {koatl-0.1.21 → koatl-0.1.22}/koatl/python/koatl/runtime/helpers.py +1 -1
- {koatl-0.1.21 → koatl-0.1.22}/koatl-core/src/resolve_scopes.rs +0 -14
- {koatl-0.1.21 → koatl-0.1.22}/koatl-core/src/transform.rs +22 -8
- {koatl-0.1.21 → koatl-0.1.22}/python/koatl/runtime/helpers.py +1 -1
- {koatl-0.1.21 → koatl-0.1.22}/Cargo.toml +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/README.md +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/.github/workflows/CI.yml +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/.gitignore +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/LICENSE +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/README.md +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/python/koatl/__init__.py +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/python/koatl/__main__.py +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/python/koatl/cli.py +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/python/koatl/notebook/__init__.py +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/python/koatl/notebook/magic.py +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/python/koatl/prelude/__init__.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/python/koatl/prelude/functional/__init__.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/python/koatl/prelude/functional/async.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/python/koatl/prelude/functional/async_util.py +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/python/koatl/prelude/functional/memo.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/python/koatl/prelude/functional/monad.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/python/koatl/prelude/functional/reader.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/python/koatl/prelude/functional/result.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/python/koatl/prelude/iterable.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/python/koatl/runtime/__init__.py +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/python/koatl/runtime/meta_finder.py +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/python/koatl/runtime/record.py +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/python/koatl/runtime/virtual.py +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/requirements.txt +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/src/emit_py.rs +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/src/lib.rs +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/tests/e2e/base/coal.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/tests/e2e/base/containers.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/tests/e2e/base/decorators.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/tests/e2e/base/destructure-for-and-fn.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/tests/e2e/base/destructure.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/tests/e2e/base/escape_ident.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/tests/e2e/base/fstr.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/tests/e2e/base/functions.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/tests/e2e/base/generator.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/tests/e2e/base/if_expr.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/tests/e2e/base/imports.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/tests/e2e/base/loops.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/tests/e2e/base/match.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/tests/e2e/base/nary-list.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/tests/e2e/base/placeholder.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/tests/e2e/base/precedence.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/tests/e2e/base/scopes.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/tests/e2e/base/semantic_whitespace.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/tests/e2e/base/slice.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/tests/e2e/base/try.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/tests/e2e/destructure.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/tests/e2e/prelude/async.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/tests/e2e/prelude/iterables.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/tests/e2e/prelude/memo.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/tests/e2e/prelude/reader.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/tests/e2e/prelude/result.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/tests/e2e/prelude/virtual.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/tests/e2e/util/__init__.py +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/tests/e2e/util/module0.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/tests/e2e/util/module1.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/tests/e2e/util/module2.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/tests/parse/arith.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/tests/parse/assign.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/tests/parse/block-comments.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/tests/parse/deco.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/tests/parse/func.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/tests/parse/matches.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/tests/test_e2e.py +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl/tests/test_parse.py +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl-core/Cargo.toml +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl-core/parser/Cargo.toml +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl-core/parser/src/ast.rs +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl-core/parser/src/lexer.rs +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl-core/parser/src/lib.rs +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl-core/parser/src/parser.rs +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl-core/parser/src/util.rs +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl-core/parser/tests/lexer.rs +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl-core/src/inference.rs +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl-core/src/lib.rs +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl-core/src/main.rs +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl-core/src/parse_timer.rs +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl-core/src/parser.rs +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl-core/src/py/ast.rs +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl-core/src/py/emit.rs +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl-core/src/py/mod.rs +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl-core/src/py/util.rs +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl-core/src/types.rs +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/koatl-core/src/util.rs +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/pyproject.toml +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/python/koatl/__init__.py +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/python/koatl/__main__.py +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/python/koatl/cli.py +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/python/koatl/notebook/__init__.py +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/python/koatl/notebook/magic.py +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/python/koatl/prelude/__init__.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/python/koatl/prelude/functional/__init__.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/python/koatl/prelude/functional/async.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/python/koatl/prelude/functional/async_util.py +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/python/koatl/prelude/functional/memo.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/python/koatl/prelude/functional/monad.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/python/koatl/prelude/functional/reader.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/python/koatl/prelude/functional/result.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/python/koatl/prelude/iterable.tl +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/python/koatl/runtime/__init__.py +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/python/koatl/runtime/meta_finder.py +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/python/koatl/runtime/record.py +0 -0
- {koatl-0.1.21 → koatl-0.1.22}/python/koatl/runtime/virtual.py +0 -0
|
@@ -76,7 +76,7 @@ def do(f):
|
|
|
76
76
|
|
|
77
77
|
try:
|
|
78
78
|
# TODO: this is a workaround to avoid recursion.
|
|
79
|
-
# is it possible to
|
|
79
|
+
# is it possible to derive bind_gen directly from bind_once?
|
|
80
80
|
|
|
81
81
|
return vget(m, "bind_gen")(gen)
|
|
82
82
|
except (NotImplementedError, AttributeError):
|
|
@@ -213,13 +213,6 @@ impl<'src> ResolveState<'src> {
|
|
|
213
213
|
let placeholder_ctx = self.placeholder_stack.pop().unwrap();
|
|
214
214
|
|
|
215
215
|
if placeholder_ctx.activated {
|
|
216
|
-
if ph_fn_ctx.is_async || ph_fn_ctx.is_generator || ph_fn_ctx.is_do {
|
|
217
|
-
self.errors.extend(simple_err(
|
|
218
|
-
"Await, bind, and yield are not allowed in placeholder functions",
|
|
219
|
-
placeholder_ctx.span,
|
|
220
|
-
));
|
|
221
|
-
}
|
|
222
|
-
|
|
223
216
|
ph_fn_ctx.is_placeholder = true;
|
|
224
217
|
|
|
225
218
|
ph_fn_ctx.arg_names.push(placeholder_ctx.arg_decl);
|
|
@@ -1323,13 +1316,6 @@ impl<'src> SExprExt<'src> for Indirect<SExpr<'src>> {
|
|
|
1323
1316
|
|
|
1324
1317
|
let fn_ctx = state.fn_stack.pop().unwrap();
|
|
1325
1318
|
|
|
1326
|
-
if fn_ctx.is_async || fn_ctx.is_generator || fn_ctx.is_do {
|
|
1327
|
-
state.errors.extend(simple_err(
|
|
1328
|
-
"Memo expressions cannot be async, generator, or do",
|
|
1329
|
-
span,
|
|
1330
|
-
));
|
|
1331
|
-
}
|
|
1332
|
-
|
|
1333
1319
|
state.memo_captures.insert(inner.as_ref().into(), fn_ctx);
|
|
1334
1320
|
|
|
1335
1321
|
Expr::Memo(inner)
|
|
@@ -15,6 +15,7 @@ use crate::{
|
|
|
15
15
|
use once_cell::sync::Lazy;
|
|
16
16
|
use parser::ast::*;
|
|
17
17
|
use slotmap::SlotMap;
|
|
18
|
+
use std::hash::{Hash, Hasher};
|
|
18
19
|
|
|
19
20
|
static PY_KWS: &[&str] = &[
|
|
20
21
|
"and", "as", "assert", "break", "class", "continue", "def", "del", "elif", "else", "except",
|
|
@@ -2279,20 +2280,26 @@ impl<'src, 'ast> SExprExt<'src, 'ast> for SExpr<'src> {
|
|
|
2279
2280
|
|
|
2280
2281
|
let callback = pre.bind(make_fn_exp(
|
|
2281
2282
|
ctx,
|
|
2282
|
-
FnDef::PyFnDef(vec![], py_body,
|
|
2283
|
+
FnDef::PyFnDef(vec![], py_body, memo_captures.is_do, memo_captures.is_async),
|
|
2283
2284
|
&span,
|
|
2284
2285
|
)?);
|
|
2285
2286
|
|
|
2286
2287
|
let linecol = ctx.line_cache.linecol(span.start);
|
|
2287
2288
|
|
|
2288
|
-
a.
|
|
2289
|
+
let memo_call = a.call(
|
|
2289
2290
|
a.tl_builtin("memo"),
|
|
2290
2291
|
vec![
|
|
2291
|
-
PyCallItem::Arg(
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2292
|
+
PyCallItem::Arg(a.str(format!(
|
|
2293
|
+
"{}:{}:{}:{:08x}",
|
|
2294
|
+
ctx.filename,
|
|
2295
|
+
linecol.0,
|
|
2296
|
+
linecol.1,
|
|
2297
|
+
{
|
|
2298
|
+
let mut hasher = std::collections::hash_map::DefaultHasher::new();
|
|
2299
|
+
ctx.source[span.start..span.end].hash(&mut hasher);
|
|
2300
|
+
hasher.finish() as u32
|
|
2301
|
+
}
|
|
2302
|
+
))),
|
|
2296
2303
|
PyCallItem::Arg(
|
|
2297
2304
|
a.tuple(
|
|
2298
2305
|
nonlocals
|
|
@@ -2304,7 +2311,14 @@ impl<'src, 'ast> SExprExt<'src, 'ast> for SExpr<'src> {
|
|
|
2304
2311
|
),
|
|
2305
2312
|
PyCallItem::Arg(callback),
|
|
2306
2313
|
],
|
|
2307
|
-
)
|
|
2314
|
+
);
|
|
2315
|
+
|
|
2316
|
+
if memo_captures.is_do {
|
|
2317
|
+
// TODO should we really automatically bind a monadic expression for convenience?
|
|
2318
|
+
a.yield_(a.yield_(memo_call))
|
|
2319
|
+
} else {
|
|
2320
|
+
a.yield_(memo_call)
|
|
2321
|
+
}
|
|
2308
2322
|
}
|
|
2309
2323
|
Expr::Await(expr) => a.await_(pre.bind(expr.transform(ctx)?)),
|
|
2310
2324
|
Expr::Yield(expr) => a.yield_(pre.bind(expr.transform(ctx)?)),
|
|
@@ -76,7 +76,7 @@ def do(f):
|
|
|
76
76
|
|
|
77
77
|
try:
|
|
78
78
|
# TODO: this is a workaround to avoid recursion.
|
|
79
|
-
# is it possible to
|
|
79
|
+
# is it possible to derive bind_gen directly from bind_once?
|
|
80
80
|
|
|
81
81
|
return vget(m, "bind_gen")(gen)
|
|
82
82
|
except (NotImplementedError, AttributeError):
|
|
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
|