Phase 30.1 & 73: Stage-3 features env and JoinIR flag cleanup
This commit is contained in:
@ -11,7 +11,7 @@ pub(crate) fn wrap_with_optional_postfix(
|
||||
p: &mut NyashParser,
|
||||
body: Vec<ASTNode>,
|
||||
) -> Result<Vec<ASTNode>, ParseError> {
|
||||
if !(crate::config::env::parser_stage3()
|
||||
if !(crate::config::env::parser_stage3_enabled()
|
||||
&& (p.match_token(&TokenType::CATCH) || p.match_token(&TokenType::CLEANUP)))
|
||||
{
|
||||
return Ok(body);
|
||||
|
||||
@ -121,7 +121,7 @@ pub fn parse_box_declaration(p: &mut NyashParser) -> Result<ASTNode, ParseError>
|
||||
let mut last_method_name: Option<String> = None;
|
||||
while !p.match_token(&TokenType::RBRACE) && !p.is_at_end() {
|
||||
// 分類(段階移行用の観測): 将来の分岐移譲のための前処理
|
||||
if crate::config::env::parser_stage3() {
|
||||
if crate::config::env::parser_stage3_enabled() {
|
||||
if let Ok(kind) = members::common::classify_member(p) {
|
||||
let _ = kind; // 現段階では観測のみ(無副作用)
|
||||
}
|
||||
|
||||
@ -159,10 +159,10 @@ impl NyashParser {
|
||||
}
|
||||
|
||||
/// 文字列からパース (トークナイズ + パース)
|
||||
/// Note: Reads environment variables (NYASH_PARSER_STAGE3, etc.) for using-chain parsing
|
||||
/// Note: Reads parser_stage3_enabled() (NYASH_FEATURES=stage3 or legacy env) for using-chain parsing
|
||||
pub fn parse_from_string(input: impl Into<String>) -> Result<ASTNode, ParseError> {
|
||||
// Ensure Stage-3 features are enabled when parsing using-chain files
|
||||
// if the parent process has NYASH_PARSER_STAGE3=1 set
|
||||
// when parent requested Stage-3 parsing via NYASH_FEATURES/legacy env
|
||||
Self::parse_from_string_with_fuel(input, Some(100_000))
|
||||
}
|
||||
|
||||
|
||||
@ -192,16 +192,7 @@ impl NyashParser {
|
||||
|
||||
/// Helper: env-gated Stage-3 enable check.
|
||||
fn is_stage3_enabled() -> bool {
|
||||
let on = |key: &str| {
|
||||
std::env::var(key)
|
||||
.ok()
|
||||
.map(|v| {
|
||||
let lv = v.to_ascii_lowercase();
|
||||
lv == "1" || lv == "true" || lv == "on"
|
||||
})
|
||||
.unwrap_or(false)
|
||||
};
|
||||
on("NYASH_PARSER_STAGE3") || on("HAKO_PARSER_STAGE3")
|
||||
crate::config::env::parser_stage3_enabled()
|
||||
}
|
||||
|
||||
/// Parse break statement
|
||||
|
||||
Reference in New Issue
Block a user