From adf10fc7f615805fa63845e47633eeb1cb8abe70 Mon Sep 17 00:00:00 2001 From: Vu Vo Date: Mon, 28 Oct 2024 00:32:04 +0700 Subject: [PATCH] tag support (#58) --- crates/parser/src/grammar/block.rs | 36 ------------------------ crates/parser/src/grammar/declaration.rs | 13 +++++++++ 2 files changed, 13 insertions(+), 36 deletions(-) diff --git a/crates/parser/src/grammar/block.rs b/crates/parser/src/grammar/block.rs index 47b4a69..059dd05 100644 --- a/crates/parser/src/grammar/block.rs +++ b/crates/parser/src/grammar/block.rs @@ -37,39 +37,3 @@ pub fn block(p: &mut Parser) { } } -// #[cfg(test)] -// mod tests { - -// use crate::{ -// ast::{AstBlock, AstNode}, -// grammar::entry::Scope, -// syntax_node::SyntaxNode, -// }; - -// use super::*; -// #[test] -// fn parse_block_test() { -// let source = r#" -// { -// var x, y; -// var (x, y); -// var (x, y) = a + b; -// var a = x, b = y; -// var a = x, b = y; - -// signal a; -// signal a, b; -// signal (a, b); -// signal (a, b) = a - b; -// a <== 12 + 1 -// a ==>b -// } -// "#; -// let green_node = Parser::parse_scope(source, Scope::Block); -// let syntax_node = SyntaxNode::new_root(green_node); - -// if let Some(ast_block) = AstBlock::cast(syntax_node) { -// println!("{:?}", ast_block.statement_list().unwrap().syntax().kind()); -// } -// } -// } diff --git a/crates/parser/src/grammar/declaration.rs b/crates/parser/src/grammar/declaration.rs index d70e521..293fb5a 100644 --- a/crates/parser/src/grammar/declaration.rs +++ b/crates/parser/src/grammar/declaration.rs @@ -14,6 +14,11 @@ fn signal_header(p: &mut Parser) -> Option { res = Some(false); } p.advance(); + + if p.at(LCurly) { + p.expect(Identifier); + p.expect(RCurly); + } } p.close(m, SignalHeader); res @@ -120,3 +125,11 @@ pub(super) fn declaration(p: &mut Parser) { _ => unreachable!(), } } + +#[cfg(test)] +mod declar_tests { + #[test] + fn signal_with_tag() { + + } +}