Skip to content

Commit

Permalink
;fray command
Browse files Browse the repository at this point in the history
  • Loading branch information
geremachek committed Jun 3, 2021
1 parent f324bea commit b7c8866
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "merlin"
version = "1.0.1"
version = "1.0.2"
authors = ["geremachek <mrender2005@gmail.com>"]
edition = "2018"

Expand Down
6 changes: 4 additions & 2 deletions src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ pub enum Command {
Decay,
Destroy,
Tether,
Fray,
Mirror,
Atom,
Scribe,
Expand Down Expand Up @@ -93,6 +94,7 @@ impl FromStr for Command {
"decay" => Ok(Command::Decay),
"destroy" => Ok(Command::Destroy),
"tether" => Ok(Command::Tether),
"fray" => Ok(Command::Fray),
"mirror" => Ok(Command::Mirror),
"atom" => Ok(Command::Atom),
"scribe" => Ok(Command::Scribe),
Expand All @@ -117,7 +119,7 @@ impl Command {
Command::Volumes | Command::Carved => true,
Command::Focus | Command::Traverse | Command::Appear | Command::Shave | Command::Shelve | Command::Incant | Command::Inscribe | Command::Trample | Command::Peek |
Command::Summon | Command::Dub | Command::Spellbook | Command::Shift | Command::Infix | Command::Spine | Command::Nomen => args >= 1,
Command::Infuse | Command::Tether | Command::Peer => args >= 2,
Command::Infuse | Command::Tether | Command::Fray | Command::Peer => args >= 2,
}
}

Expand All @@ -140,7 +142,7 @@ impl Command {
Command::Volumes | Command::Carved => return Ok(0),
Command::Focus | Command::Traverse | Command::Appear | Command::Shave | Command::Shelve | Command::Inscribe | Command::Trample | Command::Incant |
Command::Summon | Command::Dub | Command::Spellbook | Command::Shift | Command::Infix | Command::Peek | Command::Spine => return Ok(1),
Command::Infuse | Command::Peer => return Ok(2),
Command::Infuse | Command::Peer | Command::Fray => return Ok(2),
Command::Genesis => return Ok(choose_mm(1, 0))
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ mod nomen;
fn main() {
let merlin_args = App::new("merlin:")
.about("An esoteric, programmable text editor")
.version("1.0.1")
.version("1.0.2")
.arg(Arg::with_name("no-errors")
.short("n")
.long("no-errors")
Expand Down
1 change: 1 addition & 0 deletions src/plane/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ impl Plane {
Command::Decay => self.stack.decay(),
Command::Destroy => self.stack.destroy(),
Command::Tether => return oksome(commands::tether(&data[..data.len()-1], &data.last().unwrap())),
Command::Fray => self.fray(&data[data.len()-2], &data.last().unwrap()),
Command::Atom => self.vision = Vision::Atom,
Command::Scribe => self.vision = Vision::Scribe,
Command::Mirror => self.print_result = !self.print_result,
Expand Down
10 changes: 10 additions & 0 deletions src/plane/plane_commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,14 @@ impl Plane {
self.current_volume + 1
}
}

// split atom by another atom

pub fn fray(&mut self, atom: &str, s: &str) {
for a in atom.split(s) {
if !a.is_empty() {
self.stack.push(a.to_string())
}
}
}
}

0 comments on commit b7c8866

Please sign in to comment.