Stabilize joinir tests and env guards

This commit is contained in:
2025-12-27 17:41:30 +09:00
parent 88ead0df9f
commit 0d6229d5a2
28 changed files with 444 additions and 127 deletions

View File

@ -214,6 +214,22 @@ impl NyashParser {
pub(super) fn parse_statement(&mut self) -> Result<ASTNode, ParseError> {
// For grammar diff: capture starting token to classify statement keyword
let start_tok = self.current_token().token_type.clone();
if !crate::config::env::parser_stage3_enabled() {
if let TokenType::IDENTIFIER(name) = &start_tok {
let is_stage3_keyword = matches!(
name.as_str(),
"local" | "flow" | "try" | "catch" | "cleanup" | "throw" | "while" | "for"
| "in"
);
if is_stage3_keyword {
return Err(ParseError::UnexpectedToken {
found: start_tok.clone(),
expected: "enable NYASH_FEATURES=stage3 for Stage-3 keywords".to_string(),
line: self.current_token().line,
});
}
}
}
let result = match &start_tok {
TokenType::LBRACE => self.parse_standalone_block_statement(),