refactor(parser): get rid of tailcall in favor of chain
Signed-off-by: Charlotte Meyer <dev@buffet.sh>
This commit is contained in:
parent
4a9d49fbd8
commit
f215335627
1 changed files with 1 additions and 10 deletions
|
@ -114,15 +114,6 @@ impl Iterator for Parser<'_> {
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! tailcall {
|
|
||||||
($rule:expr) => {{
|
|
||||||
use NodeKind::*;
|
|
||||||
self.stack.pop();
|
|
||||||
self.stack.push($rule);
|
|
||||||
Some(ParseEvent::StartNode($rule))
|
|
||||||
}};
|
|
||||||
}
|
|
||||||
|
|
||||||
macro_rules! leaf {
|
macro_rules! leaf {
|
||||||
($type:expr $(, $mode:ident)?) => {{
|
($type:expr $(, $mode:ident)?) => {{
|
||||||
use NodeKind::*;
|
use NodeKind::*;
|
||||||
|
@ -200,7 +191,7 @@ impl Iterator for Parser<'_> {
|
||||||
Newlines => leaf!(Newlines),
|
Newlines => leaf!(Newlines),
|
||||||
Comment => leaf!(Comment),
|
Comment => leaf!(Comment),
|
||||||
PlainText | DoubleQuote | OpeningParenthesis | EscapedChar => {
|
PlainText | DoubleQuote | OpeningParenthesis | EscapedChar => {
|
||||||
tailcall!(Command)
|
chain!(call!(Command), ret!())
|
||||||
}
|
}
|
||||||
Semicolon => chain_buf!(chain!(error!(UnexpectedSemicolon), ret!()), ret!()),
|
Semicolon => chain_buf!(chain!(error!(UnexpectedSemicolon), ret!()), ret!()),
|
||||||
Pipe => chain!(error!(UnexpectedPipe), ret!()),
|
Pipe => chain!(error!(UnexpectedPipe), ret!()),
|
||||||
|
|
Loading…
Reference in a new issue