mirror of
https://github.com/erg-lang/erg.git
synced 2025-08-03 18:29:00 +00:00
feat: allow separating sample code and doc-comments
This commit is contained in:
parent
0c579fa6fb
commit
51cae591a3
15 changed files with 135 additions and 79 deletions
|
@ -221,20 +221,13 @@ impl Context {
|
|||
Public,
|
||||
Some(FUNC_PRED),
|
||||
);
|
||||
int.register_builtin_py_impl(
|
||||
int.register_py_builtin(
|
||||
FUNC_BIT_LENGTH,
|
||||
fn0_met(Int, Nat),
|
||||
Immutable,
|
||||
Public,
|
||||
Some(FUNC_BIT_LENGTH),
|
||||
28,
|
||||
);
|
||||
int.register_builtin_py_impl(
|
||||
FUNC_BIT_COUNT,
|
||||
fn0_met(Int, Nat),
|
||||
Immutable,
|
||||
Public,
|
||||
Some(FUNC_BIT_COUNT),
|
||||
);
|
||||
int.register_py_builtin(FUNC_BIT_COUNT, fn0_met(Int, Nat), Some(FUNC_BIT_COUNT), 17);
|
||||
let t_from_bytes = func(
|
||||
vec![kw(
|
||||
BYTES,
|
||||
|
|
|
@ -217,10 +217,10 @@ impl Context {
|
|||
poly(ZIP, vec![ty_tp(T.clone()), ty_tp(U.clone())]),
|
||||
)
|
||||
.quantify();
|
||||
self.register_py_builtin(FUNC_ABS, t_abs, Some(FUNC_ABS), 17);
|
||||
self.register_py_builtin(FUNC_ALL, t_all, Some(FUNC_ALL), 29);
|
||||
self.register_py_builtin(FUNC_ANY, t_any, Some(FUNC_ANY), 41);
|
||||
self.register_py_builtin(FUNC_ASCII, t_ascii, Some(FUNC_ASCII), 67);
|
||||
self.register_py_builtin(FUNC_ABS, t_abs, Some(FUNC_ABS), 11);
|
||||
self.register_py_builtin(FUNC_ALL, t_all, Some(FUNC_ALL), 22);
|
||||
self.register_py_builtin(FUNC_ANY, t_any, Some(FUNC_ANY), 33);
|
||||
self.register_py_builtin(FUNC_ASCII, t_ascii, Some(FUNC_ASCII), 53);
|
||||
// Leave as `Const`, as it may negatively affect assert casting.
|
||||
self.register_builtin_erg_impl(FUNC_ASSERT, t_assert, Const, vis);
|
||||
self.register_builtin_py_impl(FUNC_BIN, t_bin, Immutable, vis, Some(FUNC_BIN));
|
||||
|
|
|
@ -116,13 +116,13 @@ impl Context {
|
|||
)
|
||||
.quantify();
|
||||
self.register_builtin_py_impl("dir!", t_dir, Immutable, vis, Some("dir"));
|
||||
self.register_py_builtin("print!", t_print, Some("print"), 95);
|
||||
self.register_py_builtin("print!", t_print, Some("print"), 81);
|
||||
self.register_builtin_py_impl("id!", t_id, Immutable, vis, Some("id"));
|
||||
self.register_builtin_py_impl("input!", t_input, Immutable, vis, Some("input"));
|
||||
self.register_builtin_py_impl("globals!", t_globals, Immutable, vis, Some("globals"));
|
||||
self.register_builtin_py_impl("locals!", t_locals, Immutable, vis, Some("locals"));
|
||||
self.register_builtin_py_impl("next!", t_next, Immutable, vis, Some("next"));
|
||||
self.register_py_builtin("open!", t_open, Some("open"), 212);
|
||||
self.register_py_builtin("open!", t_open, Some("open"), 198);
|
||||
let name = if cfg!(feature = "py_compatible") {
|
||||
"if"
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue