Skip to content
This repository was archived by the owner on Apr 25, 2023. It is now read-only.

Commit 74c5330

Browse files
committed
Fixed another issue
1 parent 9ac20da commit 74c5330

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

ilanguage/Main/lexer.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,7 @@ def validate_integer(string: str) -> bool:
217217
return True
218218

219219

220-
def gettoken(
221-
string: str, line: int, column: int
222-
) -> Optional[LexerToken]:
220+
def gettoken(string: str, line: int, column: int) -> Optional[LexerToken]:
223221
"""Returns a token from the specified string.
224222
225223
Args:
@@ -243,15 +241,10 @@ def gettoken(
243241
elif string in BASE_TYPES:
244242
return LexerToken("BASETYPE", string)
245243

246-
elif len(string) == 0:
247-
return None
248-
249-
elif validate_integer(string):
244+
elif validate_integer(string) and len(string) > 0:
250245
return LexerToken("INT", string)
251246

252-
elif (
253-
len(string) > 0 and string[0] not in DIGITS_AS_STRINGS
254-
):
247+
elif len(string) > 0 and string[0] not in DIGITS_AS_STRINGS and len(string) > 0:
255248
return LexerToken("NAME", string)
256249
else:
257250
LexerError(f"Unrecognized Pattern: {string!r}", line, column)

0 commit comments

Comments
 (0)