def _MatchOshToken_Fast(lex_mode, line, start_pos): """Returns (Id, end_pos).""" tok_type, end_pos = fastlex.MatchOshToken(lex_mode.enum_id, line, start_pos) # IMPORTANT: We're reusing Id instances here. Ids are very common, so this # saves memory. return IdInstance(tok_type), end_pos
def testEquality(self): left = IdInstance(198) right = IdInstance(198) print(left, right) print(left == right) self.assertEqual(left, right)
def _MatchEchoToken_Fast(line, start_pos): """Returns (id, end_pos).""" tok_type, end_pos = fastlex.MatchEchoToken(line, start_pos) return IdInstance(tok_type), end_pos
def MatchToken(lex_mode, line, start_pos): tok_type, end_pos = fastlex.MatchToken(lex_mode.enum_id, line, start_pos) return IdInstance(tok_type), end_pos