Commit 35f66707 authored by Christopher Happe's avatar Christopher Happe
Browse files

Position zu Token hinzugefügt

parent 1db3efae
......@@ -2,9 +2,10 @@ import re
class Token:
def __init__(self, key, value):
def __init__(self, key, value, position):
self.k = key
self.v = value
self.p = position
class Lexer:
......@@ -20,7 +21,7 @@ class Lexer:
for pattern, value in self.regex_to_token:
match = pattern.match(self.program, self.current_position)
if match:
next_token = Token(value, match.group())
next_token = Token(value, match.group(), self.current_position)
new_position = match.span()[1]
break
if self.current_position == new_position:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment