Exemple #1
0
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
Exemple #2
0
 def testEquality(self):
     left = IdInstance(198)
     right = IdInstance(198)
     print(left, right)
     print(left == right)
     self.assertEqual(left, right)
Exemple #3
0
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
Exemple #4
0
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