diff options
author | Georg Brandl <georg@python.org> | 2014-10-16 10:01:17 +0200 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2014-10-16 10:01:17 +0200 |
commit | f73424b26123a98834eb82ddf799e47e2a2a6c38 (patch) | |
tree | b98a9d8c70cbcad34cb020224ecd52a23fb96876 | |
parent | 5727fe42393a86817bd0f702d93c3fc399b68eb3 (diff) | |
download | pygments-f73424b26123a98834eb82ddf799e47e2a2a6c38.tar.gz |
More fixes thanks to regexlint.
-rw-r--r-- | pygments/lexers/_openedge_builtins.py | 15 | ||||
-rw-r--r-- | pygments/lexers/c_like.py | 4 | ||||
-rw-r--r-- | pygments/lexers/configs.py | 6 | ||||
-rw-r--r-- | pygments/lexers/eiffel.py | 2 | ||||
-rw-r--r-- | pygments/lexers/fortran.py | 4 | ||||
-rw-r--r-- | pygments/lexers/graphics.py | 4 | ||||
-rw-r--r-- | pygments/lexers/int_fiction.py | 4 | ||||
-rw-r--r-- | pygments/lexers/javascript.py | 9 | ||||
-rw-r--r-- | pygments/lexers/jvm.py | 2 | ||||
-rw-r--r-- | pygments/lexers/lisp.py | 8 | ||||
-rw-r--r-- | pygments/lexers/prolog.py | 16 | ||||
-rw-r--r-- | pygments/lexers/rebol.py | 2 | ||||
-rw-r--r-- | pygments/lexers/resource.py | 10 | ||||
-rw-r--r-- | pygments/lexers/theorem.py | 2 | ||||
-rw-r--r-- | pygments/lexers/webmisc.py | 2 |
15 files changed, 39 insertions, 51 deletions
diff --git a/pygments/lexers/_openedge_builtins.py b/pygments/lexers/_openedge_builtins.py index 1bd97ca8..bd7f7c72 100644 --- a/pygments/lexers/_openedge_builtins.py +++ b/pygments/lexers/_openedge_builtins.py @@ -543,7 +543,6 @@ OPENEDGEKEYWORDS = ( 'DELIMITER', 'DESC', 'DESCENDING', - 'DESC', 'DESCE', 'DESCEN', 'DESCEND', @@ -575,7 +574,6 @@ OPENEDGEKEYWORDS = ( 'DISCONNEC', 'DISP', 'DISPLAY', - 'DISP', 'DISPL', 'DISPLA', 'DISPLAY-MESSAGE', @@ -777,7 +775,6 @@ OPENEDGEKEYWORDS = ( 'FOREGROUN', 'FORM', 'FORMAT', - 'FORM', 'FORMA', 'FORMATTED', 'FORMATTE', @@ -1010,7 +1007,6 @@ OPENEDGEKEYWORDS = ( 'GRID-FACTOR-VE', 'GRID-FACTOR-VER', 'GRID-FACTOR-VERT', - 'GRID-FACTOR-VERT', 'GRID-FACTOR-VERTI', 'GRID-FACTOR-VERTIC', 'GRID-FACTOR-VERTICA', @@ -1365,7 +1361,6 @@ OPENEDGEKEYWORDS = ( 'MARK-NEW', 'MARK-ROW-STATE', 'MATCHES', - 'MAX', 'MAX-BUTTON', 'MAX-CHARS', 'MAX-DATA-GUESS', @@ -1393,7 +1388,6 @@ OPENEDGEKEYWORDS = ( 'MAX-VALUE', 'MAX-VAL', 'MAX-VALU', - 'MAX-WIDTH', 'MAX-WIDTH-CHARS', 'MAX-WIDTH', 'MAX-WIDTH-', @@ -1428,7 +1422,6 @@ OPENEDGEKEYWORDS = ( 'MESSAGE-AREA-FONT', 'MESSAGE-LINES', 'METHOD', - 'MIN', 'MIN-BUTTON', 'MIN-COLUMN-WIDTH-CHARS', 'MIN-COLUMN-WIDTH-C', @@ -1563,8 +1556,6 @@ OPENEDGEKEYWORDS = ( 'NO-ATTR-LI', 'NO-ATTR-LIS', 'NO-ATTR-SPACE', - 'NO-ATTR', - 'NO-ATTR-', 'NO-ATTR-S', 'NO-ATTR-SP', 'NO-ATTR-SPA', @@ -1593,8 +1584,6 @@ OPENEDGEKEYWORDS = ( 'NO-INHERIT-BGCOLOR', 'NO-INHERIT-BGC', 'NO-INHERIT-BGCO', - 'LABEL-BGCOL', - 'LABEL-BGCOLO', 'NO-INHERIT-FGCOLOR', 'NO-INHERIT-FGC', 'NO-INHERIT-FGCO', @@ -1987,9 +1976,7 @@ OPENEDGEKEYWORDS = ( 'ROUTINE-LEVEL', 'ROW', 'ROW-HEIGHT-CHARS', - 'HEIGHT', 'ROW-HEIGHT-PIXELS', - 'HEIGHT-P', 'ROW-MARKERS', 'ROW-OF', 'ROW-RESIZABLE', @@ -2247,7 +2234,6 @@ OPENEDGEKEYWORDS = ( 'SUM-MAXIMU', 'SUB-MENU', 'SUBSUB-', - 'MINIMUM', 'SUB-MIN', 'SUBSCRIBE', 'SUBSTITUTE', @@ -2494,7 +2480,6 @@ OPENEDGEKEYWORDS = ( 'WIDGET-LEA', 'WIDGET-LEAV', 'WIDGET-POOL', - 'WIDTH', 'WIDTH-CHARS', 'WIDTH', 'WIDTH-', diff --git a/pygments/lexers/c_like.py b/pygments/lexers/c_like.py index ff9b266c..e618a969 100644 --- a/pygments/lexers/c_like.py +++ b/pygments/lexers/c_like.py @@ -51,7 +51,7 @@ class PikeLexer(CppLexer): r'[a-z_][a-z0-9_]*_t)\b', Keyword.Type), (r'(class)(\s+)', bygroups(Keyword, Text), 'classname'), - (r'[~!%^&*+=|?:<>/-@]', Operator), + (r'[~!%^&*+=|?:<>/@-]', Operator), inherit, ], 'classname': [ @@ -625,7 +625,7 @@ class MqlLexer(CppLexer): 'PRICE_MEDIAN', 'PRICE_TYPICAL', 'PRICE_WEIGHTED', 'VOLUME_TICK', 'VOLUME_REAL', 'STO_LOWHIGH', 'STO_CLOSECLOSE', - 'MODE_OPEN', 'MODE_LOW', 'MODE_HIGH', 'MODE_CLOSE', 'MODE_VOLUME', 'MODE_TIME', + 'MODE_OPEN', 'MODE_CLOSE', 'MODE_VOLUME', 'MODE_SMA', 'MODE_EMA', 'MODE_SMMA', 'MODE_LWMA', 'MODE_MAIN', 'MODE_SIGNAL', 'MODE_MAIN', 'MODE_PLUSDI', 'MODE_MINUSDI', 'MODE_UPPER', diff --git a/pygments/lexers/configs.py b/pygments/lexers/configs.py index 735ac4a9..1a9aec68 100644 --- a/pygments/lexers/configs.py +++ b/pygments/lexers/configs.py @@ -127,7 +127,11 @@ def _rx_indent(level): space_repeat = '+' else: space_repeat = '{1,%d}' % (tab_width - 1) - return r'(?:\t| %s\t| {%s}){%s}.*\n' % (space_repeat, tab_width, level) + if level == 1: + level_repeat = '' + else: + level_repeat = '{%s}' % level + return r'(?:\t| %s\t| {%s})%s.*\n' % (space_repeat, tab_width, level_repeat) class KconfigLexer(RegexLexer): diff --git a/pygments/lexers/eiffel.py b/pygments/lexers/eiffel.py index 28e3fcac..7d6757df 100644 --- a/pygments/lexers/eiffel.py +++ b/pygments/lexers/eiffel.py @@ -49,7 +49,7 @@ class EiffelLexer(RegexLexer): (r'"([^"%\n]|%.)*?"', String), include('numbers'), (r"'([^'%]|%'|%%)'", String.Char), - (r"(//|\\\\|>=|<=|:=|/=|~|/~|[\\\?!#%&@|+/\-=\>\*$<|^\[\]])", Operator), + (r"(//|\\\\|>=|<=|:=|/=|~|/~|[\\?!#%&@|+/\-=>*$<^\[\]])", Operator), (r"([{}():;,.])", Punctuation), (r'([a-z]\w*)|([A-Z][A-Z0-9_]*[a-z]\w*)', Name), (r'([A-Z][A-Z0-9_]*)', Name.Class), diff --git a/pygments/lexers/fortran.py b/pygments/lexers/fortran.py index 2e08a0c2..2ed89e54 100644 --- a/pygments/lexers/fortran.py +++ b/pygments/lexers/fortran.py @@ -103,8 +103,8 @@ class FortranLexer(RegexLexer): 'C_Null_Char', 'C_Alert', 'C_Backspace', 'C_Form_Feed', 'C_FunLoc', 'C_Loc', 'C_Sizeof', 'C_New_Line', 'C_Carriage_Return', 'C_Horizontal_Tab', 'C_Vertical_Tab', 'DAbs', 'DACos', 'DASin', - 'DATan', 'Date_and_Time', 'DbesJ', 'DbesJ', 'DbesJN', 'DbesY', - 'DbesY', 'DbesYN', 'Dble', 'DCos', 'DCosH', 'DDiM', 'DErF', + 'DATan', 'Date_and_Time', 'DbesJ', 'DbesJN', 'DbesY', + 'DbesYN', 'Dble', 'DCos', 'DCosH', 'DDiM', 'DErF', 'DErFC', 'DExp', 'Digits', 'DiM', 'DInt', 'DLog', 'DLog', 'DMax', 'DMin', 'DMod', 'DNInt', 'Dot_Product', 'DProd', 'DSign', 'DSinH', 'DShiftL', 'DShiftR', 'DSin', 'DSqRt', 'DTanH', 'DTan', 'DTime', diff --git a/pygments/lexers/graphics.py b/pygments/lexers/graphics.py index 30f2281c..95010046 100644 --- a/pygments/lexers/graphics.py +++ b/pygments/lexers/graphics.py @@ -107,7 +107,7 @@ class PostScriptLexer(RegexLexer): # String literals are awkward; enter separate state. (r'\(', String, 'stringliteral'), - (r'[\{\}(\<\<)(\>\>)\[\]]', Punctuation), + (r'[{}<>\[\]]', Punctuation), # Numbers (r'<[0-9A-Fa-f]+>' + delimiter_end, Number.Hex), @@ -225,7 +225,7 @@ class AsymptoteLexer(RegexLexer): r'scaleT|scientific|segment|side|slice|splitface|string|surface|' r'tensionSpecifier|ticklocate|ticksgridT|tickvalues|transform|' r'transformation|tree|triangle|trilinear|triple|vector|' - r'vertex|void)(?=([ ]{1,}[a-zA-Z]))', Keyword.Type), + r'vertex|void)(?=\s+[a-zA-Z])', Keyword.Type), # Now the asy-type-name which are not asy-function-name # except yours ! # Perhaps useless diff --git a/pygments/lexers/int_fiction.py b/pygments/lexers/int_fiction.py index e621d9ae..1d21eafa 100644 --- a/pygments/lexers/int_fiction.py +++ b/pygments/lexers/int_fiction.py @@ -120,7 +120,7 @@ class Inform6Lexer(RegexLexer): (r'[%s][^@][%s]' % (_squote, _squote), String.Char, '#pop'), (r'([%s])(@\{[0-9a-fA-F]{1,4}\})([%s])' % (_squote, _squote), bygroups(String.Char, String.Escape, String.Char), '#pop'), - (r'([%s])(@..)([%s])' % (_squote, _squote), + (r'([%s])(@.{2})([%s])' % (_squote, _squote), bygroups(String.Char, String.Escape, String.Char), '#pop'), (r'[%s]' % _squote, String.Single, ('#pop', 'dictionary-word')), (r'[%s]' % _dquote, String.Double, ('#pop', 'string')), @@ -181,7 +181,7 @@ class Inform6Lexer(RegexLexer): (r'[^~^\\@({%s]+' % _squote, String.Single), (r'[({]', String.Single), (r'@\{[0-9a-fA-F]{,4}\}', String.Escape), - (r'@..', String.Escape), + (r'@.{2}', String.Escape), (r'[%s]' % _squote, String.Single, '#pop') ], 'string': [ diff --git a/pygments/lexers/javascript.py b/pygments/lexers/javascript.py index f058ec6d..f7e4e478 100644 --- a/pygments/lexers/javascript.py +++ b/pygments/lexers/javascript.py @@ -137,9 +137,8 @@ class KalLexer(RegexLexer): r'([gim]+\b|\B)', String.Regex), (r'\?|:|_(?=\n)|==?|!=|-(?!>)|[<>+*/-]=?', Operator), - (r'\band\b|\bor\b|\bis\b|\bisnt\b|\bnot\b|' - r'\bbut\b|\bbitwise\b|\bmod\b|\^|\bxor\b|\bexists\b|\bdoesnt\s+exist\b', - Operator.Word), + (r'\b(and|or|isnt|is|not|but|bitwise|mod|\^|xor|exists|' + r'doesnt\s+exist)\b', Operator.Word), (r'(?:\([^()]+\))?\s*>', Name.Function), (r'[{(]', Punctuation), (r'\[', Punctuation, 'listcomprehension'), @@ -373,8 +372,8 @@ class DartLexer(RegexLexer): ], 'string_literal': [ # Raw strings. - (r'r"""([\s|\S]*?)"""', String.Double), - (r"r'''([\s|\S]*?)'''", String.Single), + (r'r"""([\w\W]*?)"""', String.Double), + (r"r'''([\w\W]*?)'''", String.Single), (r'r"(.*?)"', String.Double), (r"r'(.*?)'", String.Single), # Normal Strings. diff --git a/pygments/lexers/jvm.py b/pygments/lexers/jvm.py index feefefc2..1009ef9f 100644 --- a/pygments/lexers/jvm.py +++ b/pygments/lexers/jvm.py @@ -1242,7 +1242,7 @@ class GoloLexer(RegexLexer): (r'-?\d[\d_]*', Number.Integer), ('`?[a-zA-Z_][\w$]*', Name), - (r'@[a-zA-Z_][\w$._]*', Name.Decorator), + (r'@[a-zA-Z_][\w$.]*', Name.Decorator), (r'"""', String, combined('stringescape', 'triplestring')), (r'"', String, combined('stringescape', 'doublestring')), diff --git a/pygments/lexers/lisp.py b/pygments/lexers/lisp.py index 9cd0460c..35e80e41 100644 --- a/pygments/lexers/lisp.py +++ b/pygments/lexers/lisp.py @@ -1375,7 +1375,7 @@ class NewLispLexer(RegexLexer): 'base64-enc', 'bayes-query', 'bayes-train', 'begin', 'begin', 'begin', 'beta', 'betai', 'bind', 'binomial', 'bits', 'callback', 'case', 'case', 'case', 'catch', 'ceil', 'change-dir', 'char', 'chop', 'Class', 'clean', - 'close', 'command-event', 'cond', 'cond', 'cond', 'cons', 'constant', + 'close', 'command-event', 'cond', 'cons', 'constant', 'context?', 'context', 'copy-file', 'copy', 'cos', 'cosh', 'count', 'cpymem', 'crc32', 'crit-chi2', 'crit-z', 'current-line', 'curry', 'date-list', 'date-parse', 'date-value', 'date', 'debug', 'dec', @@ -1392,8 +1392,8 @@ class NewLispLexer(RegexLexer): 'get-url', 'global?', 'global', 'if-not', 'if', 'ifft', 'import', 'inc', 'index', 'inf?', 'int', 'integer?', 'integer', 'intersect', 'invert', 'irr', 'join', 'lambda-macro', 'lambda?', 'lambda', 'last-error', - 'last', 'legal?', 'length', 'let', 'let', 'let', 'letex', 'letn', - 'letn', 'letn', 'list?', 'list', 'load', 'local', 'log', 'lookup', + 'last', 'legal?', 'length', 'let', 'letex', 'letn', + 'list?', 'list', 'load', 'local', 'log', 'lookup', 'lower-case', 'macro?', 'main-args', 'MAIN', 'make-dir', 'map', 'mat', 'match', 'max', 'member', 'min', 'mod', 'module', 'mul', 'multiply', 'NaN?', 'net-accept', 'net-close', 'net-connect', 'net-error', @@ -1408,7 +1408,7 @@ class NewLispLexer(RegexLexer): 'println', 'prob-chi2', 'prob-z', 'process', 'prompt-event', 'protected?', 'push', 'put-url', 'pv', 'quote?', 'quote', 'rand', 'random', 'randomize', 'read', 'read-char', 'read-expr', 'read-file', - 'read-key', 'read-line', 'read-utf8', 'read', 'reader-event', + 'read-key', 'read-line', 'read-utf8', 'reader-event', 'real-path', 'receive', 'ref-all', 'ref', 'regex-comp', 'regex', 'remove-dir', 'rename-file', 'replace', 'reset', 'rest', 'reverse', 'rotate', 'round', 'save', 'search', 'seed', 'seek', 'select', 'self', diff --git a/pygments/lexers/prolog.py b/pygments/lexers/prolog.py index 6914bd78..b9e06ed2 100644 --- a/pygments/lexers/prolog.py +++ b/pygments/lexers/prolog.py @@ -100,10 +100,10 @@ class LogtalkLexer(RegexLexer): tokens = { 'root': [ # Directives - (r'^\s*:-\s',Punctuation,'directive'), + (r'^\s*:-\s', Punctuation, 'directive'), # Comments (r'%.*?\n', Comment), - (r'/\*(.|\n)*?\*/',Comment), + (r'/\*(.|\n)*?\*/', Comment), # Whitespace (r'\n', Text), (r'\s+', Text), @@ -231,12 +231,12 @@ class LogtalkLexer(RegexLexer): (r'[()\[\],.|]', Text), # Atoms (r"[a-z][a-zA-Z0-9_]*", Text), - (r"[']", String, 'quoted_atom'), + (r"'", String, 'quoted_atom'), ], 'quoted_atom': [ - (r"['][']", String), - (r"[']", String, '#pop'), + (r"''", String), + (r"'", String, '#pop'), (r'\\([\\abfnrtv"\']|(x[a-fA-F0-9]+|[0-7]+)\\)', String.Escape), (r"[^\\'\n]+", String), (r'\\', String), @@ -248,7 +248,7 @@ class LogtalkLexer(RegexLexer): (r'(e(lse|ndif))[.]', Keyword, 'root'), # Entity directives (r'(category|object|protocol)(?=[(])', Keyword, 'entityrelations'), - (r'(end_(category|object|protocol))[.]',Keyword, 'root'), + (r'(end_(category|object|protocol))[.]', Keyword, 'root'), # Predicate scope directives (r'(public|protected|private)(?=[(])', Keyword, 'root'), # Other directives @@ -275,7 +275,7 @@ class LogtalkLexer(RegexLexer): (r'([A-Z_][a-zA-Z0-9_]*)', Name.Variable), # Atoms (r"[a-z][a-zA-Z0-9_]*", Text), - (r"[']", String, 'quoted_atom'), + (r"'", String, 'quoted_atom'), # Strings (r'"(\\\\|\\"|[^"])*"', String), # End of entity-opening directive @@ -286,7 +286,7 @@ class LogtalkLexer(RegexLexer): (r'[()\[\],.|]', Text), # Comments (r'%.*?\n', Comment), - (r'/\*(.|\n)*?\*/',Comment), + (r'/\*(.|\n)*?\*/', Comment), # Whitespace (r'\n', Text), (r'\s+', Text), diff --git a/pygments/lexers/rebol.py b/pygments/lexers/rebol.py index 7c8e4d73..2a0579ec 100644 --- a/pygments/lexers/rebol.py +++ b/pygments/lexers/rebol.py @@ -328,7 +328,7 @@ class RedLexer(RegexLexer): (r'#\{[0-9a-f\s]*\}', Number.Hex), (r'2#\{', Number.Hex, 'bin2'), (r'64#\{[0-9a-z+/=\s]*\}', Number.Hex), - (r'([0-9a-f]+)(h)((\s)|(?=[\[\]{}""\(\)]))', + (r'([0-9a-f]+)(h)((\s)|(?=[\[\]{}"\(\)]))', bygroups(Number.Hex, Name.Variable, Whitespace)), (r'"', String, 'string'), (r'\{', String, 'string2'), diff --git a/pygments/lexers/resource.py b/pygments/lexers/resource.py index 681c4c6c..1ac0819f 100644 --- a/pygments/lexers/resource.py +++ b/pygments/lexers/resource.py @@ -39,7 +39,7 @@ class ResourceLexer(RegexLexer): (words(_types), Keyword), ], 'string': [ - (r'(\\x[0-9a-fA-F]{2}|\\u[0-9a-fA-F]{4}|\\U00[0-9a-fA-F]{6}|' + (r'(\\x[0-9a-f]{2}|\\u[0-9a-f]{4}|\\U00[0-9a-f]{6}|' r'\\[0-7]{1,3}|\\c.|\\[abtnvfre\'"?\\]|\\\{|[^"{\\])+', String), (r'\{', String.Escape, 'msgname'), (r'"', String, '#pop') @@ -50,13 +50,13 @@ class ResourceLexer(RegexLexer): 'message': [ (r'\{', String.Escape, 'msgname'), (r'\}', String.Escape, '#pop'), - (r'(,)(\s*)([a-zA-Z]+)(\s*\})', + (r'(,)(\s*)([a-z]+)(\s*\})', bygroups(Operator, String.Escape, Keyword, String.Escape), '#pop'), - (r'(,)(\s*)([a-zA-Z]+)(\s*)(,)(\s*)(offset)(\s*)(:)(\s*)(-?\d+)(\s*)', + (r'(,)(\s*)([a-z]+)(\s*)(,)(\s*)(offset)(\s*)(:)(\s*)(-?\d+)(\s*)', bygroups(Operator, String.Escape, Keyword, String.Escape, Operator, String.Escape, Operator.Word, String.Escape, Operator, String.Escape, Number.Integer, String.Escape), 'choice'), - (r'(,)(\s*)([a-zA-Z]+)(\s*)(,)(\s*)', + (r'(,)(\s*)([a-z]+)(\s*)(,)(\s*)', bygroups(Operator, String.Escape, Keyword, String.Escape, Operator, String.Escape), 'choice'), (r'\s+', String.Escape) @@ -64,7 +64,7 @@ class ResourceLexer(RegexLexer): 'choice': [ (r'(=|<|>|<=|>=|!=)(-?\d+)(\s*\{)', bygroups(Operator, Number.Integer, String.Escape), 'message'), - (r'([a-zA-Z]+)(\s*\{)', bygroups(Keyword.Type, String.Escape), 'str'), + (r'([a-z]+)(\s*\{)', bygroups(Keyword.Type, String.Escape), 'str'), (r'\}', String.Escape, ('#pop', '#pop')), (r'\s+', String.Escape) ], diff --git a/pygments/lexers/theorem.py b/pygments/lexers/theorem.py index 137355f1..a59b86ae 100644 --- a/pygments/lexers/theorem.py +++ b/pygments/lexers/theorem.py @@ -416,7 +416,7 @@ class LeanLexer(RegexLexer): ) operators = ( - '!=', '#', '&', '&&', '*', '+', '-', '/', '#', '@', + '!=', '#', '&', '&&', '*', '+', '-', '/', '@', '-.', '->', '.', '..', '...', '::', ':>', ';', ';;', '<', '<-', '=', '==', '>', '_', '`', '|', '||', '~', '=>', '<=', '>=', '/\\', '\\/', u'∀', u'Π', u'λ', u'↔', u'∧', u'∨', u'≠', u'≤', u'≥', diff --git a/pygments/lexers/webmisc.py b/pygments/lexers/webmisc.py index c52dcfd4..6dd9cede 100644 --- a/pygments/lexers/webmisc.py +++ b/pygments/lexers/webmisc.py @@ -878,7 +878,7 @@ class SlimLexer(ExtendedRegexLexer): (r'([ \t]*==?)(.*\n)', bygroups(Punctuation, using(RubyLexer)), 'root'), - (r'[ \t]+[\w:-]+(?=[=])', Name.Attribute, 'html-attributes'), + (r'[ \t]+[\w:-]+(?==)', Name.Attribute, 'html-attributes'), default('plain'), ], |