diff --git a/crates/lsp/src/database.rs b/crates/lsp/src/database.rs index 29c2e57..36fa3cb 100644 --- a/crates/lsp/src/database.rs +++ b/crates/lsp/src/database.rs @@ -19,23 +19,19 @@ use syntax::{ /** * We will store -* Open data -> Parse -> output -> Syntax -> analyzer -> db{ - FileID { - Template { - signal, - - } - } - - value - Template map: { Hash(FileID, token) -> Template} - Vars map: {Hash(FileID, template, token)} -> Var} - Component map {Hash(FileID, template, token)} -> ComponentInfo - Signals map {Hash(FileID, template, token)} -> Signal - - +* Open data -> Parse -> output -> Syntax -> analyzer -> db + { + FileID { + Template { + signal, + } + } -} + Template map: { Hash(FileID, token) -> Template} + Vars map: {Hash(FileID, template, token)} -> Var} + Component map {Hash(FileID, template, token)} -> ComponentInfo + Signals map {Hash(FileID, template, token)} -> Signal + } */ #[derive(Clone, Copy, Debug, Hash, PartialEq, Eq)] diff --git a/crates/parser/src/grammar.rs b/crates/parser/src/grammar.rs index 5de71db..2fa91f3 100644 --- a/crates/parser/src/grammar.rs +++ b/crates/parser/src/grammar.rs @@ -12,38 +12,57 @@ mod pragma; mod statement; mod template; -/** - * parse circom program - */ - pub mod entry { - use crate::token_kind::TokenKind; - use super::*; + /// Parses a full Circom program from top-level constructs. + /// + /// This function handles parsing of all valid top-level elements in a Circom file, + /// such as pragmas, templates, includes, component instantiations, and function + /// definitions. Invalid tokens are flagged with an error. + /// + /// Grammar: + /// * `` ::= { `` | `` | `