lexer_kit 0.6.1-aarch64-linux → 0.7.0-aarch64-linux
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.
- checksums.yaml +4 -4
- data/README.md +7 -3
- data/lib/lexer_kit/builder/compiler.rb +50 -15
- data/lib/lexer_kit/builder/conflict_detector.rb +18 -20
- data/lib/lexer_kit/builder/validator.rb +45 -0
- data/lib/lexer_kit/builder.rb +34 -7
- data/lib/lexer_kit/cli/commands.rb +17 -7
- data/lib/lexer_kit/core/source.rb +3 -2
- data/lib/lexer_kit/debug/disassembler.rb +0 -2
- data/lib/lexer_kit/dfa/dfa_builder.rb +1 -1
- data/lib/lexer_kit/dfa/dfa_minimizer.rb +2 -2
- data/lib/lexer_kit/dfa/regex_ast.rb +4 -0
- data/lib/lexer_kit/dfa/regex_parser.rb +41 -8
- data/lib/lexer_kit/errors.rb +2 -2
- data/lib/lexer_kit/format/lkb1.rb +3 -3
- data/lib/lexer_kit/format/lkt1.rb +3 -1
- data/lib/lexer_kit/format.rb +4 -4
- data/lib/lexer_kit/ir/compiled_program.rb +39 -26
- data/lib/lexer_kit/ir/constant_pool.rb +33 -11
- data/lib/lexer_kit/ir/dfa_table.rb +9 -19
- data/lib/lexer_kit/ir/instruction.rb +3 -0
- data/lib/lexer_kit/ir/jump_table.rb +3 -13
- data/lib/lexer_kit/ir/keyword_table.rb +0 -9
- data/lib/lexer_kit/ir/limits.rb +48 -0
- data/lib/lexer_kit/ir/serializer.rb +69 -30
- data/lib/lexer_kit/ir.rb +1 -0
- data/lib/lexer_kit/version.rb +1 -1
- data/lib/lexer_kit.rb +15 -2
- data/lib/lexer_kit_rust/3.3/lexer_kit_rust.so +0 -0
- data/lib/lexer_kit_rust/3.4/lexer_kit_rust.so +0 -0
- data/lib/lexer_kit_rust/4.0/lexer_kit_rust.so +0 -0
- data/vendor/nupur/LICENSE +176 -0
- data/vendor/nupur/NOTICE +64 -0
- data/vendor/nupur/README.ja.md +150 -0
- data/vendor/nupur/README.md +257 -0
- data/vendor/nupur.sha256 +68 -0
- metadata +9 -2
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# Nupur(ヌプㇽ)
|
|
2
|
+
|
|
3
|
+
Nupur は Makiri の拡張(extension)における Ruby バインディングレイヤーです。
|
|
4
|
+
これにより、拡張ライブラリは Ruby の C APIに対応する安全な API を利用できます。これには Ruby の値とそのクラスチェック済みハンドル、例外、メソッドトランポリン、TypedData、GVL、および例外を発生する可能性のあるすべての C 呼び出しに対するラッパーが含まれます。
|
|
5
|
+
Ruby とやりとりするすべての `unsafe` コードは、ただ一つの例外を除いて Nupur またはその配下のクレートに実装されています。その唯一の例外は、拡張ライブラリの `Init_` であり、定義を `run_init` に渡します。
|
|
6
|
+
|
|
7
|
+
レイヤー構成(上から順に):
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
makiri_rs 拡張ライブラリ:Makiri の Ruby メソッド
|
|
11
|
+
nupur nupur_sys 上に構築された安全な API
|
|
12
|
+
nupur_sys (sys/) Ruby の C API。各呼び出しは証明(proof)を受け取る。rb-sys に依存する唯一のクレート
|
|
13
|
+
rb-sys Ruby の C API(生成されたバインディング)
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Nupurは拡張ライブラリ自体に依存しておらず、その存在すら認識していません。Nupurが拡張から必要とするもの(破損した内部不変条件に対する例外クラスや、`rake oom` フック)は、拡張によって `Init_` に登録されます。この拡張は`crate::nupur` としてNupurに公開され、その `bridge` は `rb`、`typed`、`gvl`、`build`、`hash`、および `args` を再エクスポートします。
|
|
17
|
+
|
|
18
|
+
## 保証しているもの
|
|
19
|
+
|
|
20
|
+
Nupurのルールの大部分は、その型とクレートの依存関係であり、これらを破るコードはコンパイルできません。`src/lib.rs`にそれぞれ詳細が記載されています。
|
|
21
|
+
|
|
22
|
+
- **raiseがRustの後始末を飛び越えない** raiseは`longjmp`であり、またいだRustフレームのデストラクタを実行しません。raiseを引き起こし得るすべてのC呼び出しは、`&Protected`を受け取る`nupur_sys::raising`のラッパーとなっています。`&Protected`を作るのは`rb_protect`のサンクだけで、サンクはそれを`raw::call`が実行するクロージャに貸し出すため、raiseは`Err`として返されます。NupurにはC関数を呼び出す他の手段はありません。rb-sysに依存しておらず、`nupur_sys`もC関数を再エクスポートしていません。保護の外でraiseが起こるのは次の2か所で、どちらも解放すべきものを持たないフレームしかまたぎません。
|
|
23
|
+
- メソッドのトランポリンが`Err`をraiseするとき(または`break`や`throw`を再開するとき)と、`Init_`が`fatal`をraiseするとき。いずれもメソッドのすべてのRustフレームが復帰した後です。
|
|
24
|
+
- ラップしたオブジェクトのマークコールバック内の`rb_gc_mark`(`nupur_sys::non_raising::gc_mark_in_dmark`)。Rubyのmark stackを伸ばせないとき、`NoMemoryError`をraiseし得ます。コールバックは後始末の要るものを何も持たず、このリスクはどのC拡張のマーク関数にも共通です。
|
|
25
|
+
- **Cに到達するpanicを禁止する** トランポリンはpanicを内部エラーに変換します。Cが呼び出すコールバックがpanicを捕捉し(`caught::PanicLatch`)、その呼び出し元が再開できるようにします。巻き戻り(unwind)してはならないコードは`no_unwind`サイトであり、`--cfg nupur_no_unwind`を指定したリリースビルドによって、それが不可能であることが証明されます(`rake no_unwind`)。
|
|
26
|
+
- **GVL は型になる**:GVL を必要とする Ruby の C APIを呼び出すには、GVL を保持していることを型レベルで保証する値を要求します。その保証する値には、対象となる Ruby の値(Nupur の `Value` が内部的に保持する `nupur_sys::value::Value`)か、対象となる値が存在しない場合にはトークン `Ruby` を使用します。どちらも `Send` を実装していないため、GVL を解放した状態で実行される処理の内部に持ち込むことはできません。値を生成できるのは `nupur_sys` の内部だけで、トークンを生成できるのは `rb::method` の非公開関数 `entry_token` のみです。この関数は Ruby から呼び出されるエントリポイントでのみ使用されます。
|
|
27
|
+
- **GCはラップされたオブジェクトが保持するすべてのRuby値を認識する** GCはラップされたオブジェクトのRustデータ内部を参照できないため、オブジェクトが生存させている値(MakiriノードはDocumentを保持します)は、そのマークコールバックによって報告される必要があります。Nupurはこのような値をスロット(`nupur_sys::value::Root`)に保持し、決してRustデータには保持せず、自らマークを行います。拡張機能はマーク関数を記述しないため、マークを忘れることはありません。
|
|
28
|
+
- **ラップされたオブジェクトはそのデータの借用期間よりも長く生存する** データには`typed::Typed` ハンドルを通じてのみアクセスでき、このハンドルが最後の借用が終了するまでオブジェクトを生存させ続けます。
|
|
29
|
+
- **Stringの読み取りはコピーで行う** 文字列のスライスが渡されることはありません。テキストはstdのバリデータによってUTF-8であることが確認されたコピーであり、Stringのキャッシュされたコードレンジから信頼されることはありません。
|
|
30
|
+
- **Cの整数は1箇所で変換する** (`nupur_sys::int`)。Cの `long` はWindowsでは32ビットであるため、変換処理はどちらのビット幅にも対応するよう1ヶ所に記述され、両方でテスト・検証されています (`verus/int.rs`)。
|
|
31
|
+
- **2つのRactorが同時にこのレイヤーで実行できる**。拡張ライブラリが自身をRactorセーフであると宣言した場合 (`rb::method::declare_ractor_safe`)、2つのRactorが同時に実行できます。Nupurの要素で、任意のRactorが読み取り可能なもの以外は、両者間で共有されません。ラップしたオブジェクトは、型を共有可能と宣言しない限り(`TypedType::shareable`)、作ったRactorから出ません。共有可能な型はペイロードが `Sync` であることを要し、オブジェクトは作られた時点で凍結され、共有可能になります。
|
|
32
|
+
|
|
33
|
+
### 型で保持できないこと
|
|
34
|
+
|
|
35
|
+
一部のルールは型として表現できません。Makiri ではこれらをコードのチェック(`lints/nupur_lints` にある `rake dylint` の lint、`rake no_unwind`、`rake unsafe:boundaries`)によって保持しているため、他で Nupur のコピーを使用する場合は独自チェックが必要です。
|
|
36
|
+
|
|
37
|
+
- **トークンは Ruby から呼び出される場所でのみ作成されること**:Ruby が GVL を保持した状態でコードを呼び出したという事実は呼び出し元の状態であり、型で表現することはできません。`gvl_token_outside_entry` は トランポリン や `run_init` を Ruby が呼び出す場所に限定し、`nupur_sys` のトークン作成処理(`Ruby::assume_gvl`)を `entry_token` に制限します。
|
|
38
|
+
- **Ruby の値は GC のスタックスキャンに見える場所に留まること**:値は `Copy` であり、スキャンから内容が見えない `Vec` や `Box` への格納を型の仕組みだけで防ぐことはできません。`ruby_value_on_heap` がバインディング、フィールド、static、式の型を読み取って検出します。
|
|
39
|
+
- **`nupur_sys` 自体のコードがこのバインディング層のルールを守ること**:`nupur_sys` は rb-sys を参照できる唯一のクレートであるため、その内部では raise、GVL、整数のルールは lint として管理されます(`raising_call_outside_protect`、`ffi_without_gvl_proof`、`c_integer_outside_int`)。どの C 関数が raise し得るかは、Ruby の C API の調査に基づくテーブルで管理されています。
|
|
40
|
+
|
|
41
|
+
拡張ライブラリ自体もいくつかのルールを守る必要があります。GVL を解放して実行されるボディは Ruby を実行しないこと、呼び出し元の Ruby を勝手に実行しないこと、そして Ractor セーフな拡張ライブラリの独自状態は Ractor 間で安全であることです。`src/lib.rs` にこれらと各チェック方法が一覧化されています。使用前に読んでください。
|
|
42
|
+
|
|
43
|
+
## 拡張ライブラリの記述方法
|
|
44
|
+
|
|
45
|
+
メソッドはRustの関数で、GVL のトークン(`&Ruby`)を受け取り、その値または `Result` を返すものです。`method!` / `function!` マクロがこれを トランポリン にラップします。`Init_` は `run_init` に 2 つの関数を渡します。1 つは実行中 Ruby のチェック(拒否された場合は `LoadError` になる)、もう 1 つは各種定義です。以下は `test/ext/src/lib.rs` にあるテスト拡張ライブラリの簡略版コピーです。
|
|
46
|
+
|
|
47
|
+
```rust
|
|
48
|
+
use nupur::rb::{prelude::*, Error, ExceptionClass, RbConst, Ruby, Value};
|
|
49
|
+
use nupur::function;
|
|
50
|
+
|
|
51
|
+
static INTERNAL: RbConst<ExceptionClass> = RbConst::new();
|
|
52
|
+
|
|
53
|
+
fn echo(_: &Ruby, v: Value) -> Value {
|
|
54
|
+
v
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
fn check(ruby: &Ruby) -> Result<(), Error> {
|
|
58
|
+
nupur::abi::check_running_api("nupur_test", "rake nupur:spec")?;
|
|
59
|
+
nupur::abi::check_raise_state(ruby)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
fn init(ruby: &Ruby) -> Result<(), Error> {
|
|
63
|
+
let m = ruby.define_module("NupurTest")?;
|
|
64
|
+
let internal = m.define_error("InternalError", ruby.exception_exception())?;
|
|
65
|
+
INTERNAL.set(internal)?;
|
|
66
|
+
nupur::rb::error::INTERNAL_ERROR.set(internal)?;
|
|
67
|
+
m.define_module_function("echo", function!(echo, 1))?;
|
|
68
|
+
Ok(())
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
#[no_mangle]
|
|
72
|
+
#[allow(non_snake_case)]
|
|
73
|
+
pub extern "C" fn Init_nupur_test() {
|
|
74
|
+
// 安全性: Ruby は自身のスレッド上で GVL を保持したまま `Init_nupur_test` を呼び出します。
|
|
75
|
+
unsafe { nupur::rb::method::run_init(check, init) };
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
テスト用拡張ライブラリでは、スロットを持つオブジェクトのラップ(`TypedType`, `Birth`)、引数とキーワードの読み取り(`args`)、Hash のトラバース、String の読み取り、GVL 解放状態での処理の実行などもカバーしています。
|
|
80
|
+
|
|
81
|
+
拡張ライブラリ側のビルドで知っておくべきことが三つあります。
|
|
82
|
+
|
|
83
|
+
- `rb::Error` はメッセージをインラインで持つ(256 バイト)ので、生成時にメモリ割り当てが起きません。その代わり `Result<_, Error>` はどれも clippy の `result_large_err` の既定値を超えます。Makiri と同じく、拡張ライブラリの `clippy.toml` に `large-error-threshold = 288` を書いてください。
|
|
84
|
+
- プロファイルは Nupur のテスト用拡張ライブラリと同じく `panic = "unwind"` にします。`abort` だと、メソッド内の panic が内部エラーとして Ruby に届く前にホストプロセスを殺してしまいます。依存先の crate の profile は効かないので Nupur からは設定できず、`unwind` でなければ Nupur はコンパイルを拒否します。
|
|
85
|
+
- Nupur の lint を `allow` するときは `cfg_attr(dylint_lib = "nupur_lints", ...)` の下に書くので、拡張ライブラリの `Cargo.toml` に cfg を登録してください。登録しないと、その `allow` のたびに警告が出ます。書き方は `[lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(dylint_lib, values(any()))'] }` です。lint は拡張ライブラリのワークスペースで `cargo dylint --path <makiri>/ext/makiri/rust/lints --pattern nupur_lints --no-deps` と実行すると掛かります。ほかの crate も一緒に lint するときの拡張ライブラリの crate 名、Ruby に依存しない crate、独自の巻き戻り禁止ガードは、ワークスペースの `dylint.toml` の `[nupur_lints]` に書きます(`lints/nupur_lints/README.md`)。
|
|
86
|
+
|
|
87
|
+
渡されたオブジェクトのメソッドを呼ぶ拡張ライブラリ(`to_json` を呼ぶ JSON の生成器など)は、`rb::call` を通して呼びます。安全に呼ぶための規則はそのモジュールの文書にあり、要点は一つです。呼び出された側が無効にしうるものを、呼び出しをまたいで持たないことです。
|
|
88
|
+
|
|
89
|
+
## Magnus との比較
|
|
90
|
+
|
|
91
|
+
Nupur は Makiri において Magnus を置き換えたものであり、多くの名称(`Value`、`RString`、`Error`、`method!`)を継承しています。ここでの比較対象は、2026 年 10 月の置き換えまで Makiri で使用されていた Magnus 0.8.2 です。
|
|
92
|
+
|
|
93
|
+
Magnus は Ruby の C API の広範囲をカバーする汎用バインディングです。これに対して Nupur は、Makiri が使用する C 関数と型のみをカバーします。Magnus を使う場合、Makiri が必要とする 30 ほどの機能のために、Magnus の内部構造とすべての `unsafe` を信用することになります。Nupur を使う場合は、信頼するのは Makiri が選定し契約を記述した C 関数のみとなります。
|
|
94
|
+
|
|
95
|
+
両者の安全性に関する違い:
|
|
96
|
+
|
|
97
|
+
| | Magnus | Nupur |
|
|
98
|
+
| --- | --- | --- |
|
|
99
|
+
| Raise し得る C 呼び出し | 多くの呼び出しが `protect` 下で動作。どれが raise するかは実装者の判断でありユーザーは検証不可 | それぞれが保護のトークンを受け取るラッパーであり、`rb_protect` の外では呼び出し不可。どの関数が raise するかは Ruby C API の調査に基づくテーブルで管理 |
|
|
100
|
+
| メソッド内でのパニック | `fatal` として raise される(Magnus #118)。発生場所での rescue は不可 | 拡張ライブラリの内部エラー(ホスト側が名前で rescue 可能な `Exception`)として raise される |
|
|
101
|
+
| 引数 | `to_str` / `to_int` で自動変換される(呼び出し側で再定義可能な Ruby コード) | 自動変換なし:メソッドは `Value` を受け取って型をチェック。`RString` や `i64` を直接受け取るメソッドはコンパイル不可 |
|
|
102
|
+
| ラップされたオブジェクト内の Ruby 値 | ユーザーがマーク関数を記述。`Vec` やフィールド内に値を置くことが可能(ヒープ用には `BoxValue` が存在) | 固定スロット。一度だけ書き込まれ Nupur がマーク。ペイロードは Ruby 値を保持せず、ヒープ上の保持は lint で拒否 |
|
|
103
|
+
| ラップされたオブジェクトデータの参照 | 借用した `&T` が、最適化によって破棄されたその `Value` より長生きし、解放済みメモリを指す恐れがあった(Magnus #131, #101) | 最後の参照が終わるまで GC からオブジェクトが見える状態を保つ `Typed` ハンドル経由で借用 |
|
|
104
|
+
| String のバイト列 | `RString::as_slice` で貸し出し可能 | コピーによる取り出しのみ(貸し出し不可) |
|
|
105
|
+
| GVL | `Ruby::get()` で実行時にチェック | Ruby の値、または値がない場合はトークンで保持を証明。トークンは Ruby からの呼び出し口でのみ作成され、どちらも `Send` ではないため GVL 解放処理には進入不可 |
|
|
106
|
+
| 生の `VALUE` | `rb-sys` 機能(`AsRawValue`, `FromRawValue`)で使用可能 | Nupur からはアクセス不可:`nupur_sys` は `VALUE` を再エクスポートしない |
|
|
107
|
+
|
|
108
|
+
Magnus のほうが記述は容易です。引数や返り値を自動変換し、ハンドルは `Copy` であり、Ruby API の大部分をサポートする公開クレートです。Nupur はこれらを意図的に放棄しています。エラーを引き起こしやすい書き方は「不可能であるか、最も冗長な書き方になる」ように設計されています。Nupur は公開されておらず、Makiri のワークスペース内でのみ使用されます。
|
|
109
|
+
|
|
110
|
+
## ディレクトリ/モジュール構造
|
|
111
|
+
|
|
112
|
+
| Nupur | 含まれる内容 |
|
|
113
|
+
| --- | --- |
|
|
114
|
+
| `rb` | `Value` とクラスチェック付きハンドル、`Error`、`method!` / `function!` トランポリン、クラス・モジュール定義、任意のオブジェクトの public メソッドを呼ぶ `rb::call` |
|
|
115
|
+
| `typed` | TypedData: Rust のペイロードを Ruby オブジェクトとしてラップ、そのスロットと GC コールバック、GC へ報告するメモリ |
|
|
116
|
+
| `gvl` | GVL を解放した本体の実行(`without_gvl`)と、Ruby がスレッドを返すよう求めたら止まる本体の実行(`without_gvl_cancellable`。本体は `Cancel` に問い合わせる) |
|
|
117
|
+
| `build` | Array、Hash、数値、Symbol、UTF-8 String の構築 |
|
|
118
|
+
| `string`, `encoding`, `utf8_copy` | コピーによる String の読み取り(検査済み UTF-8 として `read_utf8`、バイト列として `read_bytes`)、UTF-8 の String の生成(`&str` を受け取り有効と印を付ける `utf8_str`、呼び出し側が UTF-8 と保証するバイト列から作る `utf8_str_trusting`)と ASCII-8BIT の String の生成(`binary_str`)、エンコーディング |
|
|
119
|
+
| `args`, `hash` | メソッドの引数の読み取り、受け付けるキーワードを宣言したうえでの読み取り(`Kwargs::only`。それ以外は拒む)、Hash の走査 |
|
|
120
|
+
| `describe`, `msg` | 呼び出しやメモリ割り当てを行わずに例外メッセージへ Ruby 値を書き込む処理 |
|
|
121
|
+
| `abi` | バイナリが実行中 Ruby に対して前提とする内容と、ロード時のチェック |
|
|
122
|
+
| `caught`, `no_unwind` | C 境界でのパニックキャッチ、巻き戻り禁止ボディ |
|
|
123
|
+
| `stack`, `table`, `inject` | ネイティブスタックチェック、内部用整数キーテーブル、`rake oom` フック |
|
|
124
|
+
|
|
125
|
+
`raw`(保護された呼び出し)、`int`(`nupur_sys::int` の再エクスポート)、`cname` はクレートのプライベートモジュールです。
|
|
126
|
+
|
|
127
|
+
| `nupur_sys` | 含まれる内容 |
|
|
128
|
+
| --- | --- |
|
|
129
|
+
| `protect` | `rb_protect` の thunk、`Protected` トークン、`$!`、保留中の非ローカルエグジット |
|
|
130
|
+
| `raising` | Raise する可能性のある C 呼び出し(各呼び出しは `&Protected` を受け取る) |
|
|
131
|
+
| `non_raising` | Raise しない C 呼び出し(値またはトークンを受け取る。読み取りのほか、書き込みや GVL の解放を行うものもある) |
|
|
132
|
+
| `value` | `Value`、トークン `Ruby`、スロットの `Root` |
|
|
133
|
+
| `data_type` | TypedData 型の `rb_data_type_t` とそのフラグ(`DataFlags`) |
|
|
134
|
+
| `int` | C の整数型と Rust のビット幅間の変換 |
|
|
135
|
+
| `no_unwind` | 巻き戻り禁止ボディのガード(Nupur が再エクスポート) |
|
|
136
|
+
|
|
137
|
+
## 機能(Features)と依存関係
|
|
138
|
+
|
|
139
|
+
Nupur は `nupur_sys` にのみ依存し、`nupur_sys` は rb-sys にのみ依存します。唯一の feature である `alloc-inject` は `rake oom` フックをコンパイルします。拡張ライブラリ自体の `alloc-inject` がこれを有効化し、さらに `nupur_sys` の同機能を有効化します。拡張ライブラリは既に `rb_*` シンボルを提供する Ruby プロセス内にロードされるため、rb-sys は `link-ruby` なしで使用されます。
|
|
140
|
+
|
|
141
|
+
## テスト
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
cargo test -p nupur -p nupur_sys
|
|
145
|
+
bundle exec rake nupur:spec
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
`rake nupur:spec` はテスト用拡張ライブラリ(`test/ext`。Makiri のコードを含まず Nupur の上にいくつかのメソッドを持つのみ)をビルドし、その横にあるスペック(`test/spec`)を実行します。テスト内容には、メソッド内・GVL 解放下・Hash トラバース中のパニック、ブロックのエグジット、GC とコンパクション下でのスロット動作、検証付き String 読み取りなどが含まれます。CI(Linux / macOS)で実行されています。
|
|
149
|
+
|
|
150
|
+
`nupur_sys` の compile-fail doctest は、トークンや値が外部で作成できないことを実証します。各テストが指定するエラー内容を検証できるのは nightly の rustdoc のみであるため、`rake rust:compile_fail` で実行されます。
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
# Nupur
|
|
2
|
+
|
|
3
|
+
Nupur is the Ruby binding layer under Makiri's extension. It gives the
|
|
4
|
+
extension a safe API over Ruby's C: Ruby values and their class-checked
|
|
5
|
+
handles, exceptions, method trampolines, TypedData, the GVL, and a wrapper
|
|
6
|
+
for every C call that can raise. Every `unsafe` that talks to Ruby is in
|
|
7
|
+
Nupur or in the crate under it, but one: the extension's `Init_`, which hands
|
|
8
|
+
its definitions to `run_init`.
|
|
9
|
+
|
|
10
|
+
The layers, from the top:
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
makiri_rs the extension: Makiri's Ruby methods
|
|
14
|
+
nupur the safe API, built on nupur_sys
|
|
15
|
+
nupur_sys (sys/) Ruby's C, each call taking a proof; the one crate on rb-sys
|
|
16
|
+
rb-sys Ruby's C API, as generated bindings
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Nupur does not depend on the extension and knows nothing of it. What it needs
|
|
20
|
+
from the extension (the exception class for a broken internal invariant, the
|
|
21
|
+
`rake oom` hooks) the extension registers at `Init_`. The extension reaches
|
|
22
|
+
Nupur as `crate::nupur`, and its `bridge` re-exports `rb`, `typed`, `gvl`,
|
|
23
|
+
`build`, `hash` and `args`.
|
|
24
|
+
|
|
25
|
+
## What it guarantees
|
|
26
|
+
|
|
27
|
+
Most of Nupur's rules are its types and its crates' dependencies, so code
|
|
28
|
+
that breaks one does not compile. `src/lib.rs` states each in full.
|
|
29
|
+
|
|
30
|
+
- **No raise skips Rust's cleanup.** A raise is a `longjmp`, which runs no
|
|
31
|
+
destructor of the Rust frames it crosses. Every C call that can raise is
|
|
32
|
+
a wrapper in `nupur_sys::raising` that takes a `&Protected`. Only
|
|
33
|
+
`rb_protect`'s thunk makes one, and lends it to the closure that
|
|
34
|
+
`raw::call` runs, so the raise comes back as an `Err`. Nupur has no other
|
|
35
|
+
way to call a C function: it does not depend on rb-sys, and `nupur_sys`
|
|
36
|
+
re-exports no C function. A raise leaves Ruby unprotected in two places,
|
|
37
|
+
each over frames that own nothing to release:
|
|
38
|
+
- a method's trampoline raises its `Err` (or resumes a `break` or
|
|
39
|
+
`throw`), and `Init_` raises its `fatal`, once every Rust frame of the
|
|
40
|
+
method has returned;
|
|
41
|
+
- `rb_gc_mark`, in a wrapped object's mark callback
|
|
42
|
+
(`nupur_sys::non_raising::gc_mark_in_dmark`), can raise `NoMemoryError`
|
|
43
|
+
when Ruby's mark stack cannot grow. The callback holds nothing that
|
|
44
|
+
needs cleanup, and every C extension's mark function takes the same
|
|
45
|
+
risk.
|
|
46
|
+
- **No panic reaches C.** A trampoline turns a panic into the internal
|
|
47
|
+
error; a callback C calls catches one (`caught::PanicLatch`) for its
|
|
48
|
+
caller to resume. Code that must not unwind is a `no_unwind` site, and a
|
|
49
|
+
release build with `--cfg nupur_no_unwind` proves it cannot
|
|
50
|
+
(`rake no_unwind`).
|
|
51
|
+
- **The GVL is a type.** A call of Ruby's C that needs the GVL takes a proof
|
|
52
|
+
that it is held: the Ruby value it is about (`nupur_sys::value::Value`,
|
|
53
|
+
which Nupur's `Value` holds), or, where there is none, the token `Ruby`.
|
|
54
|
+
Neither is `Send`, so neither can enter a body run with the GVL released.
|
|
55
|
+
A value is made only inside `nupur_sys`; a token only by `rb::method`'s
|
|
56
|
+
private `entry_token`, which only the entries Ruby calls use.
|
|
57
|
+
- **The GC sees every Ruby value a wrapped object keeps.** The GC cannot
|
|
58
|
+
see into a wrapped object's Rust data, so a value the object keeps alive
|
|
59
|
+
(a Makiri node keeps its Document) must be reported by its mark callback.
|
|
60
|
+
Nupur keeps such values in slots (`nupur_sys::value::Root`), never in the
|
|
61
|
+
Rust data, and marks them itself: an extension writes no mark function,
|
|
62
|
+
so it cannot forget one.
|
|
63
|
+
- **A wrapped object outlives the borrow of its data.** The data is reached
|
|
64
|
+
only through a `typed::Typed` handle, which keeps the object alive until
|
|
65
|
+
the last borrow ends.
|
|
66
|
+
- **A String is read by copying.** No slice of one is handed out. Text is a
|
|
67
|
+
copy checked to be UTF-8 by std's validator, never trusted from the
|
|
68
|
+
String's cached coderange.
|
|
69
|
+
- **A C integer is converted in one place** (`nupur_sys::int`). A C `long`
|
|
70
|
+
is 32 bits on Windows, so the conversions are written once for either
|
|
71
|
+
width, tested at both and proved at both (`verus/int.rs`).
|
|
72
|
+
- **Two Ractors may run the layer at once**, once the extension declares
|
|
73
|
+
itself Ractor-safe (`rb::method::declare_ractor_safe`). Nothing of
|
|
74
|
+
Nupur's is shared between them but what any Ractor may read. A wrapped
|
|
75
|
+
object stays in its Ractor unless its type is declared shareable
|
|
76
|
+
(`TypedType::shareable`), which requires a `Sync` payload and makes each
|
|
77
|
+
object frozen and shareable as it is made.
|
|
78
|
+
|
|
79
|
+
### What the types do not hold
|
|
80
|
+
|
|
81
|
+
Some rules cannot be types. Makiri holds these with checks of the code
|
|
82
|
+
(`rake dylint`'s lints in `lints/nupur_lints`, `rake no_unwind`,
|
|
83
|
+
`rake unsafe:boundaries`), so a copy of Nupur used elsewhere needs checks of
|
|
84
|
+
its own:
|
|
85
|
+
|
|
86
|
+
- **That a token is made only where Ruby calls in.** That Ruby called the
|
|
87
|
+
code, holding the GVL, is a fact about the caller, which no type states.
|
|
88
|
+
`gvl_token_outside_entry` keeps the trampolines and `run_init` to where
|
|
89
|
+
Ruby calls them, and `nupur_sys`'s maker (`Ruby::assume_gvl`) to
|
|
90
|
+
`entry_token`.
|
|
91
|
+
- **That a Ruby value stays where the GC's stack scan sees it.** A value is
|
|
92
|
+
`Copy`, and no type can refuse one in a `Vec` or a `Box`, whose contents
|
|
93
|
+
the scan does not see. `ruby_value_on_heap` reads the types of bindings,
|
|
94
|
+
fields, statics and expressions to find one.
|
|
95
|
+
- **That `nupur_sys`'s own code keeps the layer's rules.** It is the one
|
|
96
|
+
crate that can name rb-sys, so inside it the raise, GVL and integer rules
|
|
97
|
+
are lints (`raising_call_outside_protect`, `ffi_without_gvl_proof`,
|
|
98
|
+
`c_integer_outside_int`). Which C functions can raise is a table held to
|
|
99
|
+
a survey of Ruby's C API.
|
|
100
|
+
|
|
101
|
+
An extension must keep a few rules of its own: a body run with the GVL
|
|
102
|
+
released runs no Ruby, nothing runs the caller's Ruby unasked, and a
|
|
103
|
+
Ractor-safe extension's own state is safe across Ractors. `src/lib.rs` lists
|
|
104
|
+
them and what checks each. Read it before using the layer.
|
|
105
|
+
|
|
106
|
+
## Writing an extension
|
|
107
|
+
|
|
108
|
+
A method is a Rust function that takes the GVL's token (`&Ruby`) and returns
|
|
109
|
+
its value, or a `Result` of it; the `method!` / `function!` macros wrap it in
|
|
110
|
+
a trampoline. `Init_` hands two functions to `run_init`: a check of the
|
|
111
|
+
running Ruby, whose refusal is a `LoadError`, and the definitions. This is a
|
|
112
|
+
trimmed copy of the test extension in `test/ext/src/lib.rs`:
|
|
113
|
+
|
|
114
|
+
```rust
|
|
115
|
+
use nupur::rb::{prelude::*, Error, ExceptionClass, RbConst, Ruby, Value};
|
|
116
|
+
use nupur::function;
|
|
117
|
+
|
|
118
|
+
static INTERNAL: RbConst<ExceptionClass> = RbConst::new();
|
|
119
|
+
|
|
120
|
+
fn echo(_: &Ruby, v: Value) -> Value {
|
|
121
|
+
v
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
fn check(ruby: &Ruby) -> Result<(), Error> {
|
|
125
|
+
nupur::abi::check_running_api("nupur_test", "rake nupur:spec")?;
|
|
126
|
+
nupur::abi::check_raise_state(ruby)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
fn init(ruby: &Ruby) -> Result<(), Error> {
|
|
130
|
+
let m = ruby.define_module("NupurTest")?;
|
|
131
|
+
let internal = m.define_error("InternalError", ruby.exception_exception())?;
|
|
132
|
+
INTERNAL.set(internal)?;
|
|
133
|
+
nupur::rb::error::INTERNAL_ERROR.set(internal)?;
|
|
134
|
+
m.define_module_function("echo", function!(echo, 1))?;
|
|
135
|
+
Ok(())
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
#[no_mangle]
|
|
139
|
+
#[allow(non_snake_case)]
|
|
140
|
+
pub extern "C" fn Init_nupur_test() {
|
|
141
|
+
// SAFETY: Ruby calls `Init_nupur_test` on its thread, with the GVL held.
|
|
142
|
+
unsafe { nupur::rb::method::run_init(check, init) };
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
The test extension also wraps an object with a slot (`TypedType`, `Birth`),
|
|
147
|
+
reads arguments and keywords (`args`), walks a Hash, reads Strings, and runs
|
|
148
|
+
a body with the GVL released.
|
|
149
|
+
|
|
150
|
+
Three things an extension's own build needs to know:
|
|
151
|
+
|
|
152
|
+
- `rb::Error` holds its message inline (256 bytes), so that making one
|
|
153
|
+
allocates nothing, which puts every `Result<_, Error>` past clippy's
|
|
154
|
+
default for `result_large_err`. Set `large-error-threshold = 288` in the
|
|
155
|
+
extension's `clippy.toml`, as Makiri does.
|
|
156
|
+
- The profile builds with `panic = "unwind"`, as Nupur's test extension
|
|
157
|
+
does; with `abort`, a panic in a method would kill the host instead of
|
|
158
|
+
reaching Ruby as the internal error. A dependency's profile does not
|
|
159
|
+
apply, so Nupur cannot set it: it refuses to compile without it.
|
|
160
|
+
- An `allow` of one of Nupur's lints sits under
|
|
161
|
+
`cfg_attr(dylint_lib = "nupur_lints", ...)`, so register the cfg in the
|
|
162
|
+
extension's `Cargo.toml`, or every such allow warns:
|
|
163
|
+
`[lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(dylint_lib, values(any()))'] }`.
|
|
164
|
+
The lints run over the extension from its workspace with
|
|
165
|
+
`cargo dylint --path <makiri>/ext/makiri/rust/lints --pattern nupur_lints --no-deps`;
|
|
166
|
+
a `[nupur_lints]` table in the workspace's `dylint.toml` names the
|
|
167
|
+
extension's crate when others are linted too, its Ruby-free crates and
|
|
168
|
+
its own no-unwind guards (`lints/nupur_lints/README.md`).
|
|
169
|
+
|
|
170
|
+
An extension that calls a method of an object it was handed (a JSON
|
|
171
|
+
generator calling `to_json`) does it through `rb::call`, whose module doc
|
|
172
|
+
gives the one rule that keeps it safe: hold nothing across the call that
|
|
173
|
+
the callee could invalidate.
|
|
174
|
+
|
|
175
|
+
## Compared with Magnus
|
|
176
|
+
|
|
177
|
+
Nupur replaced Magnus in Makiri, and keeps many of its names (`Value`,
|
|
178
|
+
`RString`, `Error`, `method!`). The comparison is with Magnus 0.8.2, the
|
|
179
|
+
version Makiri used until the replacement in October 2026.
|
|
180
|
+
|
|
181
|
+
Magnus is a general binding that covers most of Ruby's C API; Nupur covers
|
|
182
|
+
only the C functions and types Makiri uses. Using Magnus meant trusting all
|
|
183
|
+
of its internals and their `unsafe` for the thirty or so things Makiri
|
|
184
|
+
needed from it. With Nupur, what is trusted is the C functions Makiri chose
|
|
185
|
+
and wrote a contract for.
|
|
186
|
+
|
|
187
|
+
Where the two differ on safety:
|
|
188
|
+
|
|
189
|
+
| | Magnus | Nupur |
|
|
190
|
+
| --- | --- | --- |
|
|
191
|
+
| C calls that can raise | Many run under `protect`; which ones can raise is the implementers' judgement, which a user cannot check | Each is a wrapper that takes the protection's token, so it cannot be called outside `rb_protect`; which functions can raise is a table held to a survey of Ruby's C API |
|
|
192
|
+
| A panic in a method | Raised as `fatal` (Magnus #118), which cannot be rescued where it happens | Raised as the extension's internal error, an `Exception` that a host can rescue by name |
|
|
193
|
+
| Arguments | Converted with `to_str` / `to_int`, Ruby code the caller can redefine | Not converted: a method takes `Value` and checks the type; a method taking `RString` or `i64` does not compile |
|
|
194
|
+
| Ruby values in a wrapped object | The user writes the mark function; a value can sit in a `Vec` or a field (`BoxValue` exists for the heap) | Fixed slots, written once and marked by Nupur; a payload holds no Ruby value, and a lint refuses one on the heap |
|
|
195
|
+
| Borrowing a wrapped object's data | A borrowed `&T` could outlive its `Value`, which the optimizer had dropped, and point at freed memory (Magnus #131, #101) | Borrowed through a `Typed` handle that keeps the object visible to the GC until the last borrow ends |
|
|
196
|
+
| A String's bytes | `RString::as_slice` lends them | Only copied out, never lent |
|
|
197
|
+
| The GVL | `Ruby::get()`, checked at run time | A Ruby value proves it, or a token where there is none; the token is made only where Ruby calls in, and neither is `Send`, so neither enters a GVL-released body |
|
|
198
|
+
| Raw `VALUE`s | Available with its `rb-sys` feature (`AsRawValue`, `FromRawValue`) | Not reachable from Nupur: `nupur_sys` re-exports no `VALUE` |
|
|
199
|
+
|
|
200
|
+
Magnus is easier to write against: it converts arguments and return values
|
|
201
|
+
for you, its handles are `Copy`, it has far more of Ruby's API, and it is a
|
|
202
|
+
published crate. Nupur gives these up on purpose: an error-prone way of
|
|
203
|
+
writing something is either impossible or the longest way to write it.
|
|
204
|
+
Nupur is not published, and is used only inside Makiri's workspace.
|
|
205
|
+
|
|
206
|
+
## Layout
|
|
207
|
+
|
|
208
|
+
| Nupur | What it holds |
|
|
209
|
+
| --- | --- |
|
|
210
|
+
| `rb` | `Value` and the class-checked handles, `Error`, the `method!` / `function!` trampolines, class and module definitions; `rb::call`, calling a public method of any object |
|
|
211
|
+
| `typed` | TypedData: wrapping a Rust payload as a Ruby object, its slots and GC callbacks, memory reported to the GC |
|
|
212
|
+
| `gvl` | Running a body with the GVL released (`without_gvl`), or one that stops when Ruby asks for the thread back (`without_gvl_cancellable`, its body asking a `Cancel`) |
|
|
213
|
+
| `build` | Building Arrays, Hashes, numbers, Symbols and UTF-8 Strings |
|
|
214
|
+
| `string`, `encoding`, `utf8_copy` | Reading Strings by copying, as checked UTF-8 (`read_utf8`) or as bytes (`read_bytes`); making UTF-8 Strings, of text marked valid (`utf8_str`, which takes a `&str`) or of bytes the caller holds to be UTF-8 (`utf8_str_trusting`), and ASCII-8BIT ones (`binary_str`); encodings |
|
|
215
|
+
| `args`, `hash` | Reading a method's arguments, and its keywords once it has declared them (`Kwargs::only`, any other refused); walking a Hash |
|
|
216
|
+
| `describe`, `msg` | Writing Ruby values into an exception message without a call or an allocation |
|
|
217
|
+
| `abi` | What the binary assumes of the running Ruby, and the load-time checks of it |
|
|
218
|
+
| `caught`, `no_unwind` | Catching a panic at a C boundary; the bodies that must not unwind |
|
|
219
|
+
| `stack`, `table`, `inject` | The native-stack check, a private integer-keyed table, the `rake oom` hooks |
|
|
220
|
+
|
|
221
|
+
`raw` (the protected calls), `int` (`nupur_sys::int`, re-exported) and
|
|
222
|
+
`cname` are private to the crate.
|
|
223
|
+
|
|
224
|
+
| `nupur_sys` | What it holds |
|
|
225
|
+
| --- | --- |
|
|
226
|
+
| `protect` | `rb_protect`'s thunk, the `Protected` token, `$!`, a pending non-local exit |
|
|
227
|
+
| `raising` | The C calls that can raise, each taking `&Protected` |
|
|
228
|
+
| `non_raising` | The C calls that raise nothing, each taking a value or the token (some read, some write or release the GVL) |
|
|
229
|
+
| `value` | `Value`, the token `Ruby`, a slot's `Root` |
|
|
230
|
+
| `data_type` | A TypedData type's `rb_data_type_t` and its flags (`DataFlags`) |
|
|
231
|
+
| `int` | The conversions between C's integers and Rust's widths |
|
|
232
|
+
| `no_unwind` | The guard of each body that must not unwind (Nupur re-exports it) |
|
|
233
|
+
|
|
234
|
+
## Features and dependencies
|
|
235
|
+
|
|
236
|
+
Nupur depends on `nupur_sys` alone, and `nupur_sys` on rb-sys alone. The one
|
|
237
|
+
feature, `alloc-inject`, compiles in the `rake oom` hooks; the extension's
|
|
238
|
+
own `alloc-inject` turns it on, and it turns on `nupur_sys`'s. rb-sys is used
|
|
239
|
+
without `link-ruby`, since the extension is loaded into a Ruby that already
|
|
240
|
+
provides the `rb_*` symbols.
|
|
241
|
+
|
|
242
|
+
## Tests
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
cargo test -p nupur -p nupur_sys
|
|
246
|
+
bundle exec rake nupur:spec
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
`rake nupur:spec` builds the test extension (`test/ext`, a few methods over
|
|
250
|
+
the layer and nothing of Makiri's) and runs the specs beside it
|
|
251
|
+
(`test/spec`): a panic in a method, below the GVL release and in a Hash
|
|
252
|
+
walk; a block's exits; a slot under GC and compaction; checked String reads.
|
|
253
|
+
CI runs it on Linux and macOS.
|
|
254
|
+
|
|
255
|
+
`nupur_sys`'s compile-fail doctests show that its tokens and values cannot
|
|
256
|
+
be made outside it. Only nightly's rustdoc checks the error each names, so
|
|
257
|
+
`rake rust:compile_fail` runs them there.
|
data/vendor/nupur.sha256
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Nupur の写しの内容。rake nupur:vendor が書く。手で編集しない。
|
|
2
|
+
# https://github.com/takahashim/makiri v0.17.1 54b17ace85d4342c44db5dbe89f89eb12dd415ee
|
|
3
|
+
48ebcf38af6685a5f91500b883d742d133a079026495d3797c8d3f9c9430483b Cargo.toml
|
|
4
|
+
06f62ab96b052c1c2c2b589d1b4f59b6524a1e3928071079140cf98e389b580e LICENSE
|
|
5
|
+
17a9036fc35612a15fb01c55152671cefd446defc1718b525482635e1140eda6 NOTICE
|
|
6
|
+
14b20ab672ffb4749abcba59959d7e24db25ad17a1cbce51c0c54c9b9171de8d README.ja.md
|
|
7
|
+
ccc4c1d0fc5cde25789ff1cd822e1b6307875e8cc1af0ce15ace421b930907fd README.md
|
|
8
|
+
9761bb6426797274196eb9713d717e44695a98573df42083e7c93a753f94fd15 src/abi.rs
|
|
9
|
+
eb46cd127ff588efd6aa7ea88e02fb2e4321bed4bdf919cbf1c909d2deb06cd1 src/args.rs
|
|
10
|
+
894c578960edac9c4169ed495d91247bedc005ee5aa3eb0b77e35a6a6ff12757 src/build.rs
|
|
11
|
+
e7efe365b9f52a2191f76c959574d483c33089762d7d3d3ab9fb940d3ba18c0f src/caught.rs
|
|
12
|
+
9ab1a40c4d04eb44ebe8813bc4be46e2cd3a611a84cb1cf705789043edd34fab src/cname.rs
|
|
13
|
+
8facd1042b94760458c353a664838a1ee81a0f350815a32e3af128d1e80b901e src/describe.rs
|
|
14
|
+
b056aed93b03b23c23f8fb57543ece4537d87172eff7484794664df293028ab6 src/encoding.rs
|
|
15
|
+
11c11b0b673feeb804be73f472411d4f7cb19ea050e4fa57c36342f76812031a src/gvl.rs
|
|
16
|
+
54dffd4a41381db56d1930b6f9daa35c4546eb5dbc8961698d7791aebda41baf src/hash.rs
|
|
17
|
+
9bfbd860cc55550e988b2eb7fee416bd2f090961d790a2a69a9efef926182242 src/inject.rs
|
|
18
|
+
e4d9608908fb04886aa1374cf5e063f2f2a72981e434e29218efccdca6669774 src/lib.rs
|
|
19
|
+
cdd4482fd7e3336cd2d1c462fda8ab1861e0393d4ae1936d9910fbdd0983e4f6 src/lint_probe.rs
|
|
20
|
+
7f5d8b504d938705814c2b149a8e9aa1ee0b289b6c95499f169bf86953d95464 src/msg.rs
|
|
21
|
+
4ba64ae7b3086765f420f86c8d60d620c971176c856512ca579956be18e017c0 src/no_unwind.rs
|
|
22
|
+
b4865a0285b9c6c685ef232717815a688cdbac0bdae1c7de7cab150b456f60a8 src/raw/check.rs
|
|
23
|
+
49d2e3a9c31c665f16034dd2aa4260340c4eaf654cde911c827f8f57d255cee4 src/raw/data.rs
|
|
24
|
+
71d94d6be9ab4e7485e50270f46dfb461c03bb3f49e441b883eff011cb7fca5f src/raw/define.rs
|
|
25
|
+
4e7162a811b115cdaa2a4daaff4cb76a1408f96987c5a646168404ac507ea26d src/raw/exception.rs
|
|
26
|
+
3ebae7e088628955f0bb89dffd01648d2b84e21d3e8ccdff0244899052fcb4a8 src/raw/iterate.rs
|
|
27
|
+
235b6363aac32f8646b949454aa09e48015141661c32d97e2d8e0013b2dfac85 src/raw/mod.rs
|
|
28
|
+
216aa3e7ddb80462bf3ff465e5ac5c6fa16489e5846e08ebe60d5b67f16b48e7 src/raw/protect.rs
|
|
29
|
+
a3d1ecd24c78d5b7e972b930284cecf3fa55bffa9c5062ceb2a3ebee085ec6fe src/raw/string.rs
|
|
30
|
+
8aeb9790063e1b7f9b522c31b738d90be528d97fbbf24369cad8a58e414d3514 src/raw/symbol.rs
|
|
31
|
+
4414c79c4885ae2dff79e9544b0f74718395eb0795cae3523e14bdd1d4c93499 src/raw/values.rs
|
|
32
|
+
f2bc439da9113794d5c428ff8d26299a47761ae4a8647e2c96d7b5391bd9527c src/rb/call.rs
|
|
33
|
+
0dfe4c53f964332890f328389df3e0e0cd1e8dd65cb48f11d69fa756650a6e2a src/rb/class.rs
|
|
34
|
+
74d6193df66b4fe0743e7f70c64c3954fa18e4b265ce778fd4fd5cb24aa10565 src/rb/convert.rs
|
|
35
|
+
297b19aef62d5c3e3677ff72c6f1bc57cc0ba7e3ce70df3afdca78a24ef8aa01 src/rb/error.rs
|
|
36
|
+
69dfb1d7f7eaad529668d1c8e8fc60b3bb1365625a1eac51f74d1000d9cffb88 src/rb/global.rs
|
|
37
|
+
df3ae78935de8ce6cd2a97f1590e759b6faf690593f8c68b213a1146d34353da src/rb/kept.rs
|
|
38
|
+
ee50d230dddb950a46dc8b4e3ec05f2a523f07ce457c562f2deffaffcb1a7495 src/rb/method.rs
|
|
39
|
+
4757a026ebe97501461b0d1eee1efe3ddc9bc334135033d6d220bc0d8abed67b src/rb/method/frame.rs
|
|
40
|
+
f1f737c94233ecff0ec53f453a7408a4b0374b1dc0a19a195305a33287fe3d9c src/rb/mod.rs
|
|
41
|
+
496d965b56f0179f83ee1266e3a2d51a665f777dac34b00820369258df75d886 src/rb/object.rs
|
|
42
|
+
e853d19f56303eabcf6075b94f2c45e3ceaaabfd6a5e656e0ce00a7c4d7e4d42 src/rb/ruby.rs
|
|
43
|
+
42524b1e63e90afd044a894072ee66dee8055aa4b2e83aa962e2e18e9181c3e1 src/rb/value.rs
|
|
44
|
+
26e895cd9874ddba3cf280e8ad62997009b6a132d5e6271ad2da868b8ecf653a src/rb/value/header.rs
|
|
45
|
+
cf6c78f76ab8552cfc0a8c23dfebc58167aa7fd954015d86c54d68795bb3dc78 src/rb/value/id.rs
|
|
46
|
+
206250cd274d061653d4846821735f8ca9d794b31600848ab540cbc59985a972 src/rb/value/integer.rs
|
|
47
|
+
49d429a8f8fe5527a62bb81372374fd01e17d6d9f514b2a4ab8664a5f9b77cd1 src/stack.rs
|
|
48
|
+
5f94d9ba395796942dabe3b194391e37805e258518152d2ba77e3ceceef72f4b src/string/make.rs
|
|
49
|
+
775ee1ec1798abd680edc38e89f1a5579de2881bf637dd602d7aae9f1f7bb42a src/string/mod.rs
|
|
50
|
+
15a422430364caf3ae1c1314b6b8961489ca2f4d29cae86370114789830ab898 src/string/read.rs
|
|
51
|
+
9518dfbcac32b89fb58868ac5b99dbe4973707906ce78c4c28329ed640e6e45e src/table.rs
|
|
52
|
+
6f9c0bef92e0f99df55906180579f9f87c02c6f3354e2f32a3449cd96fc37628 src/typed/callbacks.rs
|
|
53
|
+
3f18f4a8563bf4b4d413b67a3859ac40bf4e1bf2b4ad24519de0ca8127296285 src/typed/data_type.rs
|
|
54
|
+
7bf81a0c7803dab1916fcd90e7ceacc2021928a85ec6de222856eb15bf7df163 src/typed/embedded.rs
|
|
55
|
+
d3c2630c8d012170ede03c3400ae2948318b9f13832f78421ccaf1000c0e8394 src/typed/external.rs
|
|
56
|
+
8df8ce8f476ee6c7b0289badd32806d4fa8de0b71c9e2548384a8401a6bcfa53 src/typed/hidden.rs
|
|
57
|
+
d13b1043bdeeb41229afe562976d420ae9bdfa229eb179eb9461ea7a2934dcab src/typed/mod.rs
|
|
58
|
+
2bedfba01a61961cc05dccb3e82d9cffd43207afd5afe05aea1fae2a9d69889f src/utf8_copy.rs
|
|
59
|
+
bfebc32b8f096192220eebd56e984873ea509cec9b24ab686c50e422da7270e3 sys/Cargo.toml
|
|
60
|
+
b6f7a697cc7a78e3172072c05f58cc2f2c13128c74ad54df4e3664aa250fea94 sys/src/data_type.rs
|
|
61
|
+
29729269b5f13b37b54d050414aa16d9ec58b56711191a20dc2da9597d47efa9 sys/src/int.rs
|
|
62
|
+
c3ca1645c3734686f53db1fbc5535380d1d9058cb6c4e1caec4087c41299de46 sys/src/lib.rs
|
|
63
|
+
9928ad551b89bc77ae88c88443ed38ecc7790a9741890a9927153b94c22d099e sys/src/lint_probe.rs
|
|
64
|
+
6f0d225af05d98b65efa273ed0eb5b40cb001a816f7eea0d3631d1197801f4a9 sys/src/no_unwind.rs
|
|
65
|
+
5ae1e0d33883f57b85fbb6ec080ff43e64b7219b6770814b6517cb53616a92aa sys/src/non_raising.rs
|
|
66
|
+
a840227137992b7bbb5f2514775f7d0356b71dc958db59bc60e326f9e7a11267 sys/src/protect.rs
|
|
67
|
+
1089595250c250d0ea834213f8a51e84f9f3f2a4b55a4d07988c01e559e31e66 sys/src/raising.rs
|
|
68
|
+
3be7e3c8a0980f7bf5935ba9b7432e5d985a2318f2a9d2aee007fec1bef96d48 sys/src/value.rs
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lexer_kit
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.7.0
|
|
5
5
|
platform: aarch64-linux
|
|
6
6
|
authors:
|
|
7
7
|
- takahashim
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-06
|
|
11
|
+
date: 2026-12-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: base64
|
|
@@ -75,6 +75,7 @@ files:
|
|
|
75
75
|
- lib/lexer_kit/ir/instruction.rb
|
|
76
76
|
- lib/lexer_kit/ir/jump_table.rb
|
|
77
77
|
- lib/lexer_kit/ir/keyword_table.rb
|
|
78
|
+
- lib/lexer_kit/ir/limits.rb
|
|
78
79
|
- lib/lexer_kit/ir/opcode.rb
|
|
79
80
|
- lib/lexer_kit/ir/serializer.rb
|
|
80
81
|
- lib/lexer_kit/runner.rb
|
|
@@ -83,9 +84,15 @@ files:
|
|
|
83
84
|
- lib/lexer_kit_rust/3.3/lexer_kit_rust.so
|
|
84
85
|
- lib/lexer_kit_rust/3.4/lexer_kit_rust.so
|
|
85
86
|
- lib/lexer_kit_rust/4.0/lexer_kit_rust.so
|
|
87
|
+
- vendor/nupur.sha256
|
|
88
|
+
- vendor/nupur/LICENSE
|
|
89
|
+
- vendor/nupur/NOTICE
|
|
90
|
+
- vendor/nupur/README.ja.md
|
|
91
|
+
- vendor/nupur/README.md
|
|
86
92
|
homepage: https://github.com/takahashim/lexer_kit
|
|
87
93
|
licenses:
|
|
88
94
|
- MIT
|
|
95
|
+
- Apache-2.0
|
|
89
96
|
metadata:
|
|
90
97
|
homepage_uri: https://github.com/takahashim/lexer_kit
|
|
91
98
|
source_code_uri: https://github.com/takahashim/lexer_kit
|