Skip to content

chore: finish lexer implementation #1409

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 10, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion crates/lib-core/src/parser/lexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -784,10 +784,28 @@ fn iter_segments(
// Carry on to the next lexed element
break;
} else {
unimplemented!()
// We've got an element which extends beyond this templated slice.
// This means that a _single_ lexed element claims both some
// templated elements and some non-templated elements. That could
// include all kinds of things (and from here we don't know what
// else is yet to come, comments, blocks, literals etc...).

// In the `literal` version of this code we would consider
// splitting the literal element here, but in the templated
// side we don't. That's because the way that templated tokens
// are lexed, means that they should arrive "pre-split".

// Stash the source idx for later when we do make a segment.
if stashed_source_idx.is_none() {
stashed_source_idx = Some(tfs.source_slice.start);
continue;
}
// Move on to the next template slice
continue;
}
}
}
panic!("Unable to process slice: {:?}", tfs);
}
}
result
Expand Down
Loading