Files
hakorune/src/grammar/generated.rs
nyash-codex c344451087 fix(mir-builder): static method arity mismatch根治 - Phase 25.x
**問題**:
- ParserStmtBox.parse_using/4 に5引数が渡される
- me.method呼び出しで instance/static 判別なし
- static method に誤って receiver 追加

**修正**:
- MeCallPolicyBox: params[0]の型で instance/static 判別
- Instance method: receiver 追加
- Static method: receiver なし
- Arity検証(NYASH_ME_CALL_ARITY_STRICT=1)

**ドキュメント**:
- docs/reference/environment-variables.md 新規作成
- docs/development/architecture/mir-logs-observability.md 更新

**テスト**:
- src/tests/mir_stage1_cli_emit_program_min.rs 追加
- 既存 stage1 テスト全てパス

Phase: 25.x
2025-11-21 11:16:38 +09:00

72 lines
1.9 KiB
Rust

// Auto-generated from grammar/unified-grammar.toml
pub static KEYWORDS: &[(&str, &str)] = &[
("me", "ME"),
("from", "FROM"),
("loop", "LOOP"),
("box", "BOX"),
("local", "LOCAL"),
("peek", "PEEK"),
];
pub static OPERATORS_ADD_COERCION: &str = "string_priority";
pub static OPERATORS_SUB_COERCION: &str = "numeric_only";
pub static OPERATORS_MUL_COERCION: &str = "numeric_only";
pub static OPERATORS_DIV_COERCION: &str = "numeric_only";
pub static OPERATORS_ADD_RULES: &[(&str, &str, &str, &str)] = &[
("String", "String", "String", "concat"),
("String", "Integer", "String", "concat"),
("Integer", "String", "String", "concat"),
("String", "Bool", "String", "concat"),
("Bool", "String", "String", "concat"),
("String", "Other", "String", "concat"),
("Other", "String", "String", "concat"),
("Integer", "Integer", "Integer", "add_i64"),
("Float", "Float", "Float", "add_f64"),
];
pub static OPERATORS_SUB_RULES: &[(&str, &str, &str, &str)] = &[
("Integer", "Integer", "Integer", "sub_i64"),
("Float", "Float", "Float", "sub_f64"),
];
pub static OPERATORS_MUL_RULES: &[(&str, &str, &str, &str)] = &[
("Integer", "Integer", "Integer", "mul_i64"),
("Float", "Float", "Float", "mul_f64"),
];
pub static OPERATORS_DIV_RULES: &[(&str, &str, &str, &str)] = &[
("Integer", "Integer", "Integer", "div_i64"),
("Float", "Float", "Float", "div_f64"),
];
pub fn lookup_keyword(word: &str) -> Option<&'static str> {
for (k, t) in KEYWORDS {
if *k == word { return Some(*t); }
}
None
}
pub static SYNTAX_ALLOWED_STATEMENTS: &[&str] = &[
"box",
"global",
"function",
"static",
"if",
"loop",
"break",
"return",
"print",
"nowait",
"include",
"local",
"outbox",
"try",
"throw",
"using",
"from",
];
pub static SYNTAX_ALLOWED_BINOPS: &[&str] = &[
"add",
"sub",
"mul",
"div",
"and",
"or",
"eq",
"ne",
];