-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.py
More file actions
25 lines (16 loc) · 708 Bytes
/
errors.py
File metadata and controls
25 lines (16 loc) · 708 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
def invalid_number(line, error_line, code):
return (f"INVALID_NUMBER_ERROR\n"
f"\terror at line {line}\n"
f"\t>> {error_line[line - 1]}\n")
def invalid_string(line, error_line, code):
return (f"INVALID_STRING_ERROR\n"
f"\terror at line {line}\n"
f"\t>> {error_line[line - 1]}\n")
def invalid_variable_name(line, error_line, code):
return (f"INVALID_VARIABLE_NAME_ERROR\n"
f"\terror at line {line}\n"
f"\t>> {error_line[line - 1]}\n"
f"\t {'^' * len(code)}")
def variable_already_declared(variable):
return (f"VARIABLE_ALREADY_DECLARED\n"
f"\tvariable '{variable}' already declared\n")