Refactor tokenizer
This commit is contained in:
0
smnp/error/__init__.py
Normal file
0
smnp/error/__init__.py
Normal file
4
smnp/error/runtime.py
Normal file
4
smnp/error/runtime.py
Normal file
@@ -0,0 +1,4 @@
|
||||
class RuntimeException(Exception):
|
||||
def __init__(self, pos, msg):
|
||||
posStr = "" if pos is None else f"[line {pos[0]+1}, col {pos[1]+1}]"
|
||||
self.msg = f"Syntax error {posStr}:\n{msg}"
|
||||
4
smnp/error/syntax.py
Normal file
4
smnp/error/syntax.py
Normal file
@@ -0,0 +1,4 @@
|
||||
class SyntaxException(Exception):
|
||||
def __init__(self, pos, msg):
|
||||
posStr = "" if pos is None else f"[line {pos[0]+1}, col {pos[1]+1}]"
|
||||
self.msg = f"Syntax error {posStr}:\n{msg}"
|
||||
Reference in New Issue
Block a user