(self, ttype, values, regex=False)
Checks whether the token matches the given arguments.

        *ttype* is a token type. If this token doesn't match the given token
        type.
        *values* is a list of possible values for this token. The values
        are OR'ed together so if only one of the values matches ``True``
        is returned. Except for keyword tokens the comparison is
        case-sensitive. For convenience it's ok to pass in a single string.
        If *regex* is ``True`` (default is ``False``) the given values are
        treated as regular expressions.
Checks whether the token matches the given arguments.
Checks whether the token matches the given arguments .
def match(self, ttype, values, regex=False):
        """Checks whether the token matches the given arguments.

        *ttype* is a token type. If this token doesn't match the given token
        type.
        *values* is a list of possible values for this token. The values
        are OR'ed together so if only one of the values matches ``True``
        is returned. Except for keyword tokens the comparison is
        case-sensitive. For convenience it's ok to pass in a single string.
        If *regex* is ``True`` (default is ``False``) the given values are
        treated as regular expressions.
        """
        type_matched = self.ttype is ttype
        if not type_matched or values is None:
            return type_matched
        if isinstance(values, str):
            values = set([values])
        if regex:
            if self.ttype is T.Keyword:
                values = set([re.compile(v, re.IGNORECASE) for v in values])
            else:
                values = set([re.compile(v) for v in values])
            for pattern in values:
                if pattern.search(self.value):
                    return True
            return False
        else:
            if self.ttype in T.Keyword:
                values = set([v.upper() for v in values])
                return self.value.upper() in values
            else:
                return self.value in values
def match ( self , ttype , values , regex = False ) : type_matched = self . ttype is ttype if not type_matched or values is None : return type_matched if isinstance ( values , str ) : values = set ( [ values ] ) if regex : if self . ttype is T . Keyword : values = set ( [ re . compile ( v , re . IGNORECASE ) for v in values ] ) else : values = set ( [ re . compile ( v ) for v in values ] ) for pattern in values : if pattern . search ( self . value ) : return True return False else : if self . ttype in T . Keyword : values = set ( [ v . upper ( ) for v in values ] ) return self . value . upper ( ) in values else : return self . value in values