parser(match): introduce expression (replaces syntax); keep AST PeekExpr lowering
- Tokenizer: add MATCH keyword; remove PEEK - Parser: parse (MVP: literal patterns, block/expr arms); build PeekExpr AST for existing lowering - Tests/Smokes: update peek samples to match; skip one return-value case pending richer arm parsing Notes: MIR unchanged; existing PeekExpr lowerers continue to work.
This commit is contained in:
@ -1,13 +1,13 @@
|
||||
use crate::parser::NyashParser;
|
||||
|
||||
#[test]
|
||||
fn parse_peek_with_block_arm() {
|
||||
fn parse_match_with_block_arm() {
|
||||
let src = r#"
|
||||
local x = 2
|
||||
local y = peek x {
|
||||
local y = match x {
|
||||
1 => { local a = 10 a }
|
||||
2 => { 20 }
|
||||
else => { 30 }
|
||||
_ => { 30 }
|
||||
}
|
||||
"#;
|
||||
let ast = NyashParser::parse_from_string(src).expect("parse ok");
|
||||
@ -26,4 +26,3 @@ fn parse_peek_with_block_arm() {
|
||||
}
|
||||
assert!(find_peek(&ast), "expected peek with block arms in AST");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user