forked from n3tael/labast
Merge pull request 'Allow pushing negative addresses.' (#4) from bedohswe/labast:master into master
Reviewed-on: n3tael/labast#4
This commit is contained in:
commit
365807a365
@ -29,10 +29,8 @@ pub fn parse(stack: &mut Stack, file_content: &str) {
|
|||||||
arg = splited_data.get(0).unwrap().clone();
|
arg = splited_data.get(0).unwrap().clone();
|
||||||
} else if name.chars().nth(0) == Some('$') || name.chars().nth(1) == Some('$') {
|
} else if name.chars().nth(0) == Some('$') || name.chars().nth(1) == Some('$') {
|
||||||
arg = command[1].clone();
|
arg = command[1].clone();
|
||||||
} else if command[1] == "-1" { // required for
|
} else if let Ok(number) = command[1].parse::<i32>() {
|
||||||
data = 65535; // _unix_random
|
data = number as u16;
|
||||||
} else if let Ok(number) = command[1].parse() {
|
|
||||||
data = number;
|
|
||||||
} else {
|
} else {
|
||||||
eprintln!("{}", ParseError::ArgumentNotRequired(command[0].to_string(), i + 1, line.to_string()));
|
eprintln!("{}", ParseError::ArgumentNotRequired(command[0].to_string(), i + 1, line.to_string()));
|
||||||
std::process::exit(2);
|
std::process::exit(2);
|
||||||
@ -42,4 +40,4 @@ pub fn parse(stack: &mut Stack, file_content: &str) {
|
|||||||
let inst = Instruction { name, arg, data };
|
let inst = Instruction { name, arg, data };
|
||||||
stack.program.push(inst);
|
stack.program.push(inst);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user