From 0e0fee425ab036468476d2eb91094bbeba023c09 Mon Sep 17 00:00:00 2001
From: afonya2 <adamhir@freemail.hu>
Date: Wed, 11 Jun 2025 14:20:57 +0200
Subject: [PATCH] fixing

---
 src/errors.rs |  4 ++--
 src/lexer.rs  | 10 ++++++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/errors.rs b/src/errors.rs
index 514ad39..579e50f 100644
--- a/src/errors.rs
+++ b/src/errors.rs
@@ -132,14 +132,14 @@ pub fn create_error(message: &str, position: usize, typ: ErrorType, stype: Error
 
 fn get_exact_pos(file: &String, pos: usize) -> (usize, usize) {
     let mut line = 1;
-    let mut column = 1;
+    let mut column = 0;
     for (i, c) in file.char_indices() {
         if i == pos {
             return (line, column);
         }
         if c == '\n' {
             line += 1;
-            column = 1;
+            column = 0;
         } else {
             column += 1;
         }
diff --git a/src/lexer.rs b/src/lexer.rs
index 33131f9..cd82689 100644
--- a/src/lexer.rs
+++ b/src/lexer.rs
@@ -48,6 +48,12 @@ fn is_sep(char: &str) -> bool {
     let check = String::from(char) + next_char;
     return chars.contains(&check.as_str());
 }*/
+fn is_str_start(input: &Vec<&str>, pos: &usize) -> bool {
+    if *pos + 5 >= input.len() {
+        return false;
+    }
+    return input[*pos-1..*pos+5].join("") == "szaft\"";
+}
 
 fn read_string(splitted: &Vec<&str>, pos: &mut usize, out: &mut Vec<Token>, ctx: &Context) {
     let mut str = String::from("");
@@ -131,7 +137,7 @@ fn read_identifier(splitted: &Vec<&str>, pos: &mut usize, out: &mut Vec<Token>)
     while pos < &mut splitted.len() {
         let prev_char = splitted[*pos-1];
         let char = splitted[*pos];
-        if is_operator(char) || is_sep(char) || char == "\n" || char == "\r" || (prev_char == " " && is_number(char)) {
+        if is_operator(char) || is_sep(char) || char == "\n" || char == "\r" || (prev_char == " " && is_number(char)) || is_str_start(splitted, &(*pos+1)) {
             break;
         }
         *pos += 1;
@@ -238,7 +244,7 @@ pub fn lex(input: String, ctx: &Context) -> Vec<Token> {
             }
             pos -= 1;
             out.push(Token { typ: TokenType::NUMBER, value: num, pos: start_pos });
-        } else if splitted.len() >= pos+5 && splitted[(pos-1)..(pos+5)].join("") == "szaft\"" {
+        } else if is_str_start(&splitted, &pos) {
             read_string(&splitted, &mut pos, &mut out, ctx);
         } else if splitted.len() >= pos+1 && splitted[(pos-1)..(pos+1)].join("") == "//" {
             read_comment(&splitted, &mut pos, false, ctx);