Concentrate configuration content parsing in syntax::serial
Fixes some pages not having parsed input by making it much harder to construct a config with unparsed text, which is something you basically never want. The parsing now happens much earlier and consumers don't need to remember to parse the configuration anymore. Fixes a possible stack overflow due to parsing and configuration depending on each other. This commit also has dependencies updates and minor justfile tweaks.
This commit is contained in:
parent
a24a877ad7
commit
7300a29b67
12 changed files with 142 additions and 132 deletions
|
|
@ -1,5 +1,7 @@
|
|||
use parser::{token::Token, lexeme::Lexeme};
|
||||
|
||||
use crate::types::Config;
|
||||
|
||||
pub mod parser;
|
||||
|
||||
pub trait Parseable {
|
||||
|
|
@ -12,6 +14,9 @@ type Probe = fn(&Lexeme) -> bool;
|
|||
type Lexer = fn(&Lexeme) -> Token;
|
||||
type LexMap<'lm> = &'lm [(Probe, Lexer)];
|
||||
|
||||
pub fn parse(text: &str) -> String {
|
||||
parser::read(text)
|
||||
pub fn parse(text: &str, config: &Config) -> String {
|
||||
if text.is_empty() {
|
||||
return String::new();
|
||||
}
|
||||
parser::read(text, config)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue