Skip to content

Commit

Permalink
= print line number
Browse files Browse the repository at this point in the history
  • Loading branch information
bergey committed Dec 28, 2022
1 parent 3e2187d commit 22b783d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ impl Equivalent for Address {
// F followed by a letter for lowercase function names
#[derive(Clone, Debug)]
pub enum Function {
Equals,
D, Fd,
G, Fg,
H, Fh,
Expand All @@ -48,6 +49,7 @@ impl Equivalent for Function {
fn equivalent(&self, other: &Function) -> bool {
use Function::*;
match (self, other) {
(Equals, Equals) => true,
(D, D) | (Fd, Fd) => true,
(G, G) | (Fg, Fg) => true,
(H, H) | (Fh, Fh) => true,
Expand Down Expand Up @@ -100,6 +102,7 @@ pub fn parse_function(cmd: Input) -> Progress<Function> {
let (s, function) = anychar(cmd)?;
use Function::{*};
match function {
'=' => Ok((s, Equals)), // spec says only allows one addr, not a 2-addr range 🤷
'd' => Ok((s, Fd)),
'D' => Ok((s, D)),
'g' => Ok((s, Fg)),
Expand Down
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ where R: Iterator<Item = io::Result<String>> {
use Function::{*};

match &cmd.function {
Equals => writeln!(output, "{}", line_number).unwrap(),
Fd => {
read.clear();
break;
Expand Down

0 comments on commit 22b783d

Please sign in to comment.