Fix variable scoping issues.
This commit is contained in:
parent
95eeeb6ec7
commit
1a345d4693
1 changed files with 2 additions and 1 deletions
|
@ -46,6 +46,7 @@ pub fn parse(data: &str) -> Result<Program, String> {
|
|||
let mut argument_builder: String = "".to_string();
|
||||
let mut statements: Vec<Statement> = vec![];
|
||||
let mut labels: HashMap<String, usize> = HashMap::new();
|
||||
let mut potential_argument_length;
|
||||
|
||||
let mut inside_string = false;
|
||||
let mut string_escape = false;
|
||||
|
@ -55,7 +56,7 @@ pub fn parse(data: &str) -> Result<Program, String> {
|
|||
program_begun = true;
|
||||
} else if program_begun {
|
||||
if operator.is_none() {
|
||||
let (operator, potential_argument_length) = operator_to_arglength(char.clone());
|
||||
(operator, potential_argument_length) = operator_to_arglength(char.clone());
|
||||
if potential_argument_length.is_none() { return Err(format!("Invalid operator {} at statement {}.", char, statements.len())); }
|
||||
expected_arguments = potential_argument_length.unwrap();
|
||||
} else if expected_arguments > 0 {
|
||||
|
|
Loading…
Reference in a new issue