You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it possible to emit an alternate token from a callback (i.e not the lexed token)?
For example, a stack-based white-space-sensetive parser:
`fn indent(lex: &mut logos::Lexer) -> /* ??? */ {
let extras = &mut lex.extras;
let mut indent = 0;
// maybe use a take_while then a replace?
for char in lex.remainder().chars() {
if char == '\t' {
for i in 1..8 {
if (indent + i) % 8 == 0 {
indent += i;
break;
}
}
} else if char == ' ' {
indent += 1;
} else {
break;
}
lex.bump(1);
let last = extras.indent.last();
if indent < last {
extras.indent.pop();
/* emit Dedent token instead of Indent */
} else if indent > last {
extras.indent.push(indent);
/* emit Indent */
}
}
}`
The text was updated successfully, but these errors were encountered:
Is it possible to emit an alternate token from a callback (i.e not the lexed token)?
For example, a stack-based white-space-sensetive parser:
`fn indent(lex: &mut logos::Lexer) -> /* ??? */ {
let extras = &mut lex.extras;
let mut indent = 0;
}`
The text was updated successfully, but these errors were encountered: