diff options
Diffstat (limited to 'src/parse')
| -rw-r--r-- | src/parse/mod.rs | 6 | ||||
| -rw-r--r-- | src/parse/regex/mod.rs | 6 |
2 files changed, 9 insertions, 3 deletions
diff --git a/src/parse/mod.rs b/src/parse/mod.rs index b475943..4cba0fd 100644 --- a/src/parse/mod.rs +++ b/src/parse/mod.rs @@ -1875,8 +1875,10 @@ pub struct Case<T: Stage> { } impl CmdDisplay for CaseBranch { - fn cdisplay(&self, _w: &mut dyn std::io::Write) -> std::io::Result<()> { - todo!() + fn cdisplay(&self, w: &mut dyn std::io::Write) -> std::io::Result<()> { + write!(w, "case_branch(\"{:?}\", ", self.pattern)?; + self.block.cdisplay(w)?; + write!(w, ")") } } diff --git a/src/parse/regex/mod.rs b/src/parse/regex/mod.rs index 1c761a1..d5e4cdf 100644 --- a/src/parse/regex/mod.rs +++ b/src/parse/regex/mod.rs @@ -89,7 +89,7 @@ fn parse_rep(s: &mut super::Cursor<'_>) -> Result<Pattern> { // TODO: non-greedy } -const SYMBOLS: &[u8] = b"{}[]()*+-?| "; +const SYMBOLS: &[u8] = b"{}[]()*+-?|. "; fn is_symbol(x: u8) -> bool { SYMBOLS.contains(&x) } @@ -150,6 +150,10 @@ fn parse_atom(s: &mut super::Cursor<'_>) -> Result<Pattern> { } Ok(inner) } + b'.' => { + s.adv(); + Ok(Pattern::Range(0, 127)) + } x if is_symbol(x) => Ok(Pattern::Nothing), ch => { s.adv(); |
