fixed the $0 parameter not being populated correctly

This commit is contained in:
2026-02-19 14:24:55 -05:00
parent 8cb8f20a35
commit 9483477edd
12 changed files with 210 additions and 99 deletions

View File

@@ -44,6 +44,7 @@ macro_rules! try_match {
pub struct ParsedSrc {
pub src: Arc<String>,
pub ast: Ast,
pub lex_flags: LexFlags,
}
impl ParsedSrc {
@@ -51,11 +52,16 @@ impl ParsedSrc {
Self {
src,
ast: Ast::new(vec![]),
lex_flags: LexFlags::empty(),
}
}
pub fn with_lex_flags(mut self, flags: LexFlags) -> Self {
self.lex_flags = flags;
self
}
pub fn parse_src(&mut self) -> Result<(), Vec<ShErr>> {
let mut tokens = vec![];
for lex_result in LexStream::new(self.src.clone(), LexFlags::empty()) {
for lex_result in LexStream::new(self.src.clone(), self.lex_flags) {
match lex_result {
Ok(token) => tokens.push(token),
Err(error) => return Err(vec![error]),