Phase 12.7: Nyash文法革命とANCP 90%圧縮技法の発見 - 文法改革完了とFunctionBox実装
This commit is contained in:
17
src/tests/parser_parent_colon.rs
Normal file
17
src/tests/parser_parent_colon.rs
Normal file
@ -0,0 +1,17 @@
|
||||
use crate::parser::NyashParser;
|
||||
use crate::ast::ASTNode;
|
||||
|
||||
#[test]
|
||||
fn parse_parent_colon_syntax() {
|
||||
let src = "Parent::birth()";
|
||||
let ast = NyashParser::parse_from_string(src).expect("parse ok");
|
||||
fn is_fromcall(n: &ASTNode) -> bool {
|
||||
match n {
|
||||
ASTNode::FromCall { parent, method, .. } => parent == "Parent" && method == "birth",
|
||||
ASTNode::Program { statements, .. } => statements.iter().any(is_fromcall),
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
assert!(is_fromcall(&ast));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user