summaryrefslogtreecommitdiff
path: root/src/parse
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-05-03 15:58:15 +0200
committerLaurenz <laurmaedje@gmail.com>2022-05-03 15:58:15 +0200
commitd59109e8fffa1d0b03234329e12f5d3e578804e8 (patch)
treefe7453da6f2ae327993e5ca6436ddc6a448a2c41 /src/parse
parentf77f1f61bf05ae506689be3c40252c5807276280 (diff)
Support recursive show rules
Diffstat (limited to 'src/parse')
-rw-r--r--src/parse/mod.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/parse/mod.rs b/src/parse/mod.rs
index 32d61885..9f4860e7 100644
--- a/src/parse/mod.rs
+++ b/src/parse/mod.rs
@@ -807,9 +807,15 @@ fn set_expr(p: &mut Parser) -> ParseResult {
fn show_expr(p: &mut Parser) -> ParseResult {
p.perform(NodeKind::ShowExpr, |p| {
p.assert(NodeKind::Show);
- ident(p)?;
- p.expect(NodeKind::Colon)?;
- ident(p)?;
+ let marker = p.marker();
+ expr(p)?;
+ if p.eat_if(NodeKind::Colon) {
+ marker.filter_children(p, |child| match child.kind() {
+ NodeKind::Ident(_) | NodeKind::Colon => Ok(()),
+ _ => Err("expected identifier"),
+ });
+ expr(p)?;
+ }
p.expect(NodeKind::As)?;
expr(p)
})