mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
implement TokensIterator::peek
This commit is contained in:
parent
a949117017
commit
92fcb0af8f
7 changed files with 196 additions and 198 deletions
|
|
@ -9,9 +9,9 @@ try_from_atoms!(<'a, E>: When<RenderBox<'a, E>>: |state, atoms| {
|
|||
let head = atoms.next()?;
|
||||
if (head.kind(), head.text()) == (TokenKind::Key, "when") {
|
||||
let condition = atoms.next();
|
||||
if let Some(condition) = condition {
|
||||
if let Some(ref condition) = condition {
|
||||
let condition = state.get_bool(condition).expect("no condition");
|
||||
if let Some(content) = atoms.next() {
|
||||
if let Some(ref content) = atoms.next() {
|
||||
let content = state.get_content(content).expect("no atom");
|
||||
return Some(Self(condition, content))
|
||||
}
|
||||
|
|
@ -22,11 +22,11 @@ try_from_atoms!(<'a, E>: Either<RenderBox<'a, E>, RenderBox<'a, E>>: |state, ato
|
|||
let head = atoms.next()?;
|
||||
if (head.kind(), head.text()) == (TokenKind::Key, "either") {
|
||||
let condition = atoms.next();
|
||||
if let Some(condition) = condition {
|
||||
if let Some(ref condition) = condition {
|
||||
let condition = state.get_bool(condition).expect("no condition");
|
||||
if let Some(content1) = atoms.next() {
|
||||
if let Some(ref content1) = atoms.next() {
|
||||
let content1 = state.get_content(content1).expect("no content1");
|
||||
if let Some(content2) = atoms.next() {
|
||||
if let Some(ref content2) = atoms.next() {
|
||||
let content2 = state.get_content(content2).expect("no content2");
|
||||
return Some(Self(condition, content1, content2))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue