Skip to main content

seqc/
parser.rs

1//! Simple parser for Seq syntax
2//!
3//! Syntax:
4//! ```text
5//! : word-name ( stack-effect )
6//!   statement1
7//!   statement2
8//!   ... ;
9//! ```
10
11mod cursor;
12mod driver;
13mod items;
14mod statements;
15mod token;
16mod type_parse;
17
18#[cfg(test)]
19mod tests;
20
21pub use token::Token;
22
23// Private helpers brought into the parser module's scope so that sibling
24// sub-modules can reference them as `super::<name>`.
25use token::{annotate_error_with_line, is_float_literal, tokenize, unescape_string};
26
27pub struct Parser {
28    tokens: Vec<Token>,
29    pos: usize,
30    /// Counter for assigning unique IDs to quotations
31    /// Used by the typechecker to track inferred types
32    next_quotation_id: usize,
33    /// Pending lint annotations collected from `# seq:allow(lint-id)` comments
34    pending_allowed_lints: Vec<String>,
35    /// Known union type names - used to distinguish union types from type variables
36    /// RFC #345: Union types in stack effects must be recognized as concrete types
37    known_unions: std::collections::HashSet<String>,
38}