11#!/usr/bin/python3
22"""
33I Language lexer.
4- Version: 0.1.2
4+ Version: 0.1.3
55
66Copyright (c) 2023-present ElBe Devleopment.
77
@@ -166,13 +166,13 @@ def validate_integer(string: str) -> bool:
166166 return valid
167167
168168 def gettoken (
169- string : str , l , c
170- ) -> LexerToken | None : # What's l and c, find better names
169+ string : str , line : int , column : int
170+ ) -> LexerToken | None :
171171 if string in list (self .keywords .keys ()):
172172 return LexerToken (self .keywords [string ], string )
173173 elif len (string ) > 0 and string [0 ] == "_" :
174174 return LexerToken ("BUILTIN_CONST" , string )
175- elif string == "true" or string == "false" :
175+ elif string in [ "true" , "false" , "True" , "False" ] :
176176 return LexerToken ("BOOL" , string )
177177 elif string in self .base_types :
178178 return LexerToken ("BASETYPE" , string )
@@ -183,24 +183,13 @@ def gettoken(
183183 return LexerToken ("INT" , string )
184184 return LexerToken ("FLOAT" , string )
185185
186- elif len (string ) > 0 and string [0 ] not in [
187- "0" ,
188- "1" ,
189- "2" ,
190- "3" ,
191- "4" ,
192- "5" ,
193- "6" ,
194- "7" ,
195- "8" ,
196- "9" ,
197- ]:
186+ elif len (string ) > 0 and string [0 ] not in DIGITS_AS_STRINGS :
198187 return LexerToken ("NAME" , string )
199188
200189 else :
201- raise LexerError ("Unrecognized Pattern: '" + string + "'" , l , c )
190+ raise LexerError ("Unrecognized Pattern: '" + string + "'" , line , column )
202191
203- def repl (ar ):
192+ def repl (ar ): # What's that?
204193 n = []
205194 for el in ar :
206195 if el is not None :
0 commit comments