fixed a bug where the character directly following a float literal would be ignored (because parsing the float accidentally used that character). this is what caused [12.5] to break.

This commit is contained in:
Dummi26 2023-04-15 16:01:34 +02:00
parent c484d2cbb2
commit ea5346f81c
2 changed files with 31 additions and 33 deletions

View File

@ -116,7 +116,7 @@ impl File {
&self.pos
}
pub fn get_ppos(&self) -> &FilePosition {
&self.pos
&self.ppos
}
pub fn set_pos(&mut self, pos: FilePosition) {
self.pos = pos;

View File

@ -593,6 +593,7 @@ fn parse_statement_adv(
let mut pot_float = String::new();
for ch in &mut *file {
if ch.is_whitespace() || is_delimeter(ch) {
file.set_pos(*file.get_ppos());
break;
}
pot_float.push(ch);
@ -758,14 +759,10 @@ fn parse_function(
file.skip_whitespaces();
// find the arguments to the function
let mut args = Vec::new();
loop {
match file.peek() {
Some(')') => {
if let Some(')') = file.peek() {
file.next();
break;
}
_ => (),
}
} else {
loop {
let mut arg_name = String::new();
loop {
let err_fn_arg_name_start = *file.get_pos();
@ -795,6 +792,7 @@ fn parse_function(
break;
}
}
}
Ok(SFunction::new(args, parse_block(file)?))
}