diff options
author | gbrandl <devnull@localhost> | 2007-05-03 22:45:12 +0200 |
---|---|---|
committer | gbrandl <devnull@localhost> | 2007-05-03 22:45:12 +0200 |
commit | 7fa8aaf17b3dd5757eb2ddd4d0eade1cff9d7b96 (patch) | |
tree | bc42fe8eb8e720c5080bc56e694225a2794ed957 /pygments/util.py | |
parent | 910c67bc2341a7f081affbc564660ec30f866182 (diff) | |
download | pygments-7fa8aaf17b3dd5757eb2ddd4d0eade1cff9d7b96.tar.gz |
[svn] Make the C# lexer unicode aware.
Warning, major hack ahead: the code to support multiple
token defs is not the prettiest.
Diffstat (limited to 'pygments/util.py')
-rw-r--r-- | pygments/util.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/pygments/util.py b/pygments/util.py index 463f8468..01af01e6 100644 --- a/pygments/util.py +++ b/pygments/util.py @@ -33,6 +33,14 @@ class OptionError(Exception): pass +def get_flag_opt(options, optname, allowed, default=None): + string = options.get(optname, default) + if string not in allowed: + raise OptionError('Value for option %s must be one of %s' % + (optname, ', '.join(map(str, allowed)))) + return string + + def get_bool_opt(options, optname, default=None): string = options.get(optname, default) if isinstance(string, bool): |