Stabilize joinir tests and env guards
This commit is contained in:
@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user