diff options
author | gbrandl <devnull@localhost> | 2006-10-28 22:09:41 +0200 |
---|---|---|
committer | gbrandl <devnull@localhost> | 2006-10-28 22:09:41 +0200 |
commit | 7f8c2354a497187f33e7c7fc7e8bcdc5f5a8b7a5 (patch) | |
tree | aa49a45ff8216f4502eedba057d621aa0e22589b /pygments/token.py | |
parent | d336a1d4c0375b2b7cf266b6073932e3abb0968d (diff) | |
download | pygments-7f8c2354a497187f33e7c7fc7e8bcdc5f5a8b7a5.tar.gz |
[svn] Some fixes, add docs for new features.
Diffstat (limited to 'pygments/token.py')
-rw-r--r-- | pygments/token.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/pygments/token.py b/pygments/token.py index 7ec93262..bbbcc648 100644 --- a/pygments/token.py +++ b/pygments/token.py @@ -57,6 +57,15 @@ Comment = Token.Comment Generic = Token.Generic +def is_token_subtype(ttype, other): + """Return True if ``ttype`` is a subtype of ``other``.""" + while ttype is not None: + if ttype == other: + return True + ttype = ttype.parent + return False + + # Map standard token types to short names, used in CSS class naming. # If you add a new item, please be sure to run this file to perform # a consistency check for duplicate values. |