diff options
author | Georg Brandl <georg@python.org> | 2014-11-06 11:59:24 +0100 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2014-11-06 11:59:24 +0100 |
commit | 8b85d2a63069f341498a5feeb1874c11641b8dbc (patch) | |
tree | 1c14a9390d37dd4c5e9dc59378ae9eff0c46cc84 | |
parent | 524651a7519eed6216158762a0e627dc7b8bac15 (diff) | |
download | pygments-8b85d2a63069f341498a5feeb1874c11641b8dbc.tar.gz |
Simplify charclasses in a few modules
-rw-r--r-- | pygments/lexers/fantom.py | 8 | ||||
-rw-r--r-- | pygments/lexers/nimrod.py | 20 | ||||
-rw-r--r-- | pygments/lexers/rust.py | 2 |
3 files changed, 15 insertions, 15 deletions
diff --git a/pygments/lexers/fantom.py b/pygments/lexers/fantom.py index 25a9e027..953b324c 100644 --- a/pygments/lexers/fantom.py +++ b/pygments/lexers/fantom.py @@ -39,7 +39,7 @@ class FantomLexer(RegexLexer): id=r'[a-zA-Z_]\w*', # all chars which can be part of type definition. Starts with # either letter, or [ (maps), or | (funcs) - type=r'(?:\[|[a-zA-Z_]|\|)[:\w\[\]\|\->\?]*?', + type=r'(?:\[|[a-zA-Z_]|\|)[:\w\[\]|\->?]*?', ) ) @@ -118,7 +118,7 @@ class FantomLexer(RegexLexer): (r'\+\+|\-\-|\+|\-|\*|/|\|\||&&|<=>|<=|<|>=|>|=|!|\[|\]', Operator) ], 'inType': [ - (r'[\[\]\|\->:\?]', Punctuation), + (r'[\[\]|\->:?]', Punctuation), (s(r'$id'), Name.Class), default('#pop'), @@ -221,7 +221,7 @@ class FantomLexer(RegexLexer): (r'[ \t]+', Text), # consume whitespaces (r'(\[)(\w+)(\])', bygroups(Punctuation, Comment.Special, Punctuation)), # ffi - (r'(\")?([\w\.]+)(\")?', + (r'(\")?([\w.]+)(\")?', bygroups(Punctuation, Name.Namespace, Punctuation)), # podname (r'::', Punctuation, 'usingClass'), default('#pop') @@ -230,7 +230,7 @@ class FantomLexer(RegexLexer): (r'[ \t]+', Text), # consume whitespaces (r'(as)(\s+)(\w+)', bygroups(Keyword.Declaration, Text, Name.Class), '#pop:2'), - (r'[\w\$]+', Name.Class), + (r'[\w$]+', Name.Class), default('#pop:2') # jump out to root state ], 'facet': [ diff --git a/pygments/lexers/nimrod.py b/pygments/lexers/nimrod.py index e687152e..de2eafb0 100644 --- a/pygments/lexers/nimrod.py +++ b/pygments/lexers/nimrod.py @@ -71,7 +71,7 @@ class NimrodLexer(RegexLexer): 'root': [ (r'##.*$', String.Doc), (r'#.*$', Comment), - (r'\*|=|>|<|\+|-|/|@|\$|~|&|%|\!|\?|\||\\|\[|\]', Operator), + (r'[*=><+\-/@$~&%!?|\\\[\]]', Operator), (r'\.\.|\.|,|\[\.|\.\]|\{\.|\.\}|\(\.|\.\)|\{|\}|\(|\)|:|\^|`|;', Punctuation), @@ -85,7 +85,7 @@ class NimrodLexer(RegexLexer): # Keywords (r'(%s)\b' % underscorize(opWords), Operator.Word), - (r'(p_?r_?o_?c_?\s)(?![\(\[\]])', Keyword, 'funcname'), + (r'(p_?r_?o_?c_?\s)(?![(\[\]])', Keyword, 'funcname'), (r'(%s)\b' % underscorize(keywords), Keyword), (r'(%s)\b' % underscorize(['from', 'import', 'include']), Keyword.Namespace), @@ -95,10 +95,10 @@ class NimrodLexer(RegexLexer): # Identifiers (r'\b((?![_\d])\w)(((?!_)\w)|(_(?!_)\w))*', Name), # Numbers - (r'[0-9][0-9_]*(?=([eE.]|\'[fF](32|64)))', + (r'[0-9][0-9_]*(?=([e.]|\'f(32|64)))', Number.Float, ('float-suffix', 'float-number')), - (r'0[xX][a-f0-9][a-f0-9_]*', Number.Hex, 'int-suffix'), - (r'0[bB][01][01_]*', Number.Bin, 'int-suffix'), + (r'0x[a-f0-9][a-f0-9_]*', Number.Hex, 'int-suffix'), + (r'0b[01][01_]*', Number.Bin, 'int-suffix'), (r'0o[0-7][0-7_]*', Number.Oct, 'int-suffix'), (r'[0-9][0-9_]*', Number.Integer, 'int-suffix'), # Whitespace @@ -112,7 +112,7 @@ class NimrodLexer(RegexLexer): ], 'strings': [ (r'(?<!\$)\$(\d+|#|\w+)+', String.Interpol), - (r'[^\\\'"\$\n]+', String), + (r'[^\\\'"$\n]+', String), # quotes, dollars and backslashes must be parsed one at a time (r'[\'"\\]', String), # unhandled string formatting sign @@ -144,16 +144,16 @@ class NimrodLexer(RegexLexer): ], 'float-number': [ (r'\.(?!\.)[0-9_]*', Number.Float), - (r'[eE][+-]?[0-9][0-9_]*', Number.Float), + (r'e[+-]?[0-9][0-9_]*', Number.Float), default('#pop') ], 'float-suffix': [ - (r'\'[fF](32|64)', Number.Float), + (r'\'f(32|64)', Number.Float), default('#pop') ], 'int-suffix': [ - (r'\'[iI](32|64)', Number.Integer.Long), - (r'\'[iI](8|16)', Number.Integer), + (r'\'i(32|64)', Number.Integer.Long), + (r'\'i(8|16)', Number.Integer), default('#pop') ], } diff --git a/pygments/lexers/rust.py b/pygments/lexers/rust.py index 08a5cf54..4447e1db 100644 --- a/pygments/lexers/rust.py +++ b/pygments/lexers/rust.py @@ -162,6 +162,6 @@ class RustLexer(RegexLexer): 'attribute(': [ include('attribute_common'), (r'\);?', Comment.Preproc, '#pop'), - (r'[^"\)]+', Comment.Preproc), + (r'[^")]+', Comment.Preproc), ], } |