Make anchors aware of the nodes they point to

This commit is contained in:
Juno Takano 2026-01-11 08:00:35 -03:00
commit 3fa399c317
31 changed files with 366 additions and 230 deletions

View file

@ -1,6 +1,6 @@
use parser::{token::Token, lexeme::Lexeme};
use crate::types::Config;
use crate::types::Graph;
pub mod parser;
@ -8,12 +8,13 @@ pub trait Parseable: std::fmt::Display {
fn probe(lexeme: &Lexeme) -> bool;
fn lex(lexeme: &Lexeme) -> Self;
fn render(&self) -> String;
fn flatten(&self) -> String;
}
type Probe = fn(&Lexeme) -> bool;
type Lexer = fn(&Lexeme) -> Token;
type LexMap<'lm> = &'lm [(Probe, Lexer)];
pub fn parse(text: &str, config: &Config) -> String {
parser::read(text, config)
pub fn parse(text: &str, graph: &Graph) -> String {
parser::read(text, graph)
}