Adding prob7, unfinished.
This commit is contained in:
parent
ce2778a09f
commit
17740888b5
17
src/prob7.rs
Normal file
17
src/prob7.rs
Normal file
@ -0,0 +1,17 @@
|
||||
use nom::{branch::alt, bytes::complete::tag, combinator::map, IResult};
|
||||
|
||||
use crate::prob7::Instructions::{Cd, Dir, Ls};
|
||||
|
||||
enum Instructions {
|
||||
Ls,
|
||||
Cd,
|
||||
Dir,
|
||||
}
|
||||
|
||||
fn parse_instruction(i: &str) -> IResult<&str, Instructions> {
|
||||
alt((
|
||||
map(tag("ls"), |_| Ls),
|
||||
map(tag("cd"), |_| Cd),
|
||||
map(tag("dir"), |_| Dir),
|
||||
))(i)
|
||||
}
|
Loading…
Reference in New Issue
Block a user