File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55
66class TokenStream :
77 def __init__ (self , text : str = '' ):
8- self ._tokens = self .__build (text )
8+ self ._tokens = self ._build (text )
99
1010 def get (self , index : int = 0 ) -> Token :
1111 if index < len (self ._tokens ):
1212 return self ._tokens [index ]
1313 return EOFToken ()
1414
15- def __build (self , text : str ) -> list [Token ]:
15+ def _build (self , text : str ) -> list [Token ]:
1616 char_stream = CharStream (text ) # noqa
1717 index = 0
1818 char = char_stream .get (index )
Original file line number Diff line number Diff line change @@ -42,13 +42,13 @@ def __bool__(self):
4242 return len (self .chars )
4343
4444
45- def _register_token (token_cls : Token ) -> Token :
45+ def _register_token (TokenClass : Token ) -> Token :
4646 '''Build a {char_str: parsers} dict for tokens'''
47- for hint_str in token_cls .HINTS :
47+ for hint_str in TokenClass .HINTS :
4848 if hint_str not in _TOKEN_TYPE_MAP :
4949 _TOKEN_TYPE_MAP [hint_str ] = []
50- _TOKEN_TYPE_MAP [hint_str ].append (token_cls .PARSER )
51- return token_cls
50+ _TOKEN_TYPE_MAP [hint_str ].append (TokenClass .PARSER )
51+ return TokenClass
5252
5353
5454class EOFToken (Token ):
You can’t perform that action at this time.
0 commit comments