Skip to content

Commit

Permalink
Address issue #1 and change wording for Clap
Browse files Browse the repository at this point in the history
  • Loading branch information
broad-well committed Mar 5, 2017
1 parent a3c81d9 commit 4ed0f0d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/bytecode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pub fn from_bytecode(bytecode: &Vec<u8>) -> Result<(usize, Vec<Vec<Token>>), Str

for (index, bytoken) in segment2.enumerate() {
let token = try_err_fallthru!(Token::from_bytearray(&bytoken),
format!("Failed to convert from bytes to Token in chunk index {}: ", index));
format!("Failed to convert from bytes to Token in chunk index {}: ", index));
if token.type_ == TokenType::KEYWORD {
toks.push(vec![token]);
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ fn main() {
let clap_matches = App::new("Assembunny-plus")
.version("0.0.1")
.author("Michael P. <michael@mcmoo.org>")
.about("A C compiler and interpreter for Assembunny+, an ASM-like language extended from the Assembunny concept in Advent of Code 2016")
.about("A compiler, interpreter, and bytecode manager for Assembunny+, an ASM-like language extended from the Assembunny concept in Advent of Code 2016")
.arg(Arg::with_name("interpret")
.short("i")
.long("interpret")
Expand Down
3 changes: 3 additions & 0 deletions src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,9 @@ pub fn to_tokens(line: &str, existing_regs: &mut Vec<String>) -> Result<Option<V

// If keyword is "def", add the defined register to `existing_regs` because the existence of this register will be checked later
if str_toks[0].to_lowercase() == "def" {
if existing_regs.contains(&str_toks[1].to_owned()) {
return Err(format!("def {}: Register name already exists", str_toks[1]));
}
existing_regs.push(str_toks[1].to_owned());
}

Expand Down

0 comments on commit 4ed0f0d

Please sign in to comment.