remove pointer errors from lint as they are not always correct

This commit is contained in:
b1ek 2023-08-22 22:58:55 +10:00
parent 6a608d7e48
commit 2cbe2dc197
Signed by: blek
GPG Key ID: 14546221E3595D0C
1 changed files with 0 additions and 15 deletions

View File

@ -9,7 +9,6 @@ pub fn lint_code(code: &&str) -> Result<(), Vec<String>> {
let mut loop_stack: Vec<usize> = vec![]; let mut loop_stack: Vec<usize> = vec![];
let mut pos = 0 as usize; let mut pos = 0 as usize;
let mut pointer = 0;
let chars = code.chars().collect::<Vec<char>>(); let chars = code.chars().collect::<Vec<char>>();
let size = code.len(); let size = code.len();
@ -24,20 +23,6 @@ pub fn lint_code(code: &&str) -> Result<(), Vec<String>> {
let char = chars[pos]; let char = chars[pos];
pos += 1; pos += 1;
if char == '<' {
if pointer == 0 {
errors.push(format!("ERR: Reducing pointer to less than 0 is not allowed ({})", pos));
continue
}
pointer -= 1;
}
if char == '>' {
if pointer == 29999 {
errors.push(format!("ERR: Increasing pointer to more than 29999 is not allowed ({})", pos));
continue
}
pointer += 1;
}
if char == '[' { if char == '[' {
loop_stack.push(pos); loop_stack.push(pos);
continue continue