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

Commit fe9af46

Browse files
committed
Fixed pylint issue R1710
1 parent 92f141a commit fe9af46

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

ilanguage/Main/lexer.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -226,31 +226,33 @@ def gettoken(string: str, line: int, column: int) -> Optional[LexerToken]:
226226
column (int): Column number of the token.
227227
228228
Returns:
229-
Token from the specified string.
229+
LexerToken: Token from the specified string.
230230
"""
231231

232+
result = None
233+
232234
if string in list(KEYWORDS):
233-
return LexerToken(KEYWORDS[string], string)
235+
result = LexerToken(KEYWORDS[string], string)
234236

235237
if len(string) > 1 and string[0] == "_":
236-
return LexerToken("BUILTIN_CONST", string)
238+
result = LexerToken("BUILTIN_CONST", string)
237239

238240
if string in ["true", "false"]:
239-
return LexerToken("BOOL", string)
241+
result = LexerToken("BOOL", string)
240242

241243
if string in BASE_TYPES:
242-
return LexerToken("BASETYPE", string)
244+
result = LexerToken("BASETYPE", string)
243245

244246
if validate_integer(string) and len(string) > 0:
245-
return LexerToken("INT", string)
247+
result = LexerToken("INT", string)
246248

247249
if string[0] not in DIGITS_AS_STRINGS and len(string) > 0:
248-
return LexerToken("NAME", string)
250+
result = LexerToken("NAME", string)
249251

250252
if not len(string) > 0:
251253
LexerError(f"Unrecognized Pattern: {string!r}", line, column)
252254

253-
return None
255+
return result
254256

255257

256258
##############

0 commit comments

Comments
 (0)