mirror of
https://github.com/rm-dr/daisy
synced 2025-07-05 01:59:30 -07:00
Reorganized variable code
This commit is contained in:
@ -17,22 +17,26 @@ pub use self::{
|
||||
token::Function,
|
||||
};
|
||||
|
||||
use crate::context::Context;
|
||||
|
||||
|
||||
pub fn parse(
|
||||
s: &String
|
||||
) -> Result<
|
||||
Token,
|
||||
(LineLocation, ParserError)
|
||||
> {
|
||||
s: &String, context: &Context
|
||||
) -> Result<Token, (LineLocation, ParserError)> {
|
||||
|
||||
let tokens = stage::tokenize(s);
|
||||
let (_, tokens) = stage::find_subs(tokens);
|
||||
let g = stage::groupify(tokens)?;
|
||||
let g = stage::treeify(g)?;
|
||||
|
||||
let g = stage::treeify(g, context)?;
|
||||
|
||||
return Ok(g);
|
||||
}
|
||||
|
||||
pub fn parse_no_context(s: &String) -> Result<Token, (LineLocation, ParserError)> {
|
||||
parse(s, &Context::new())
|
||||
}
|
||||
|
||||
|
||||
pub fn substitute(
|
||||
s: &String, // The string to substitute
|
||||
|
Reference in New Issue
Block a user