From 9053d1b7a1c3ac2c90944fe9d9564e0351dac74f Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Thu, 6 Nov 2014 13:02:16 +0100 Subject: Simplify charclasses in a few more modules --- pygments/lexers/dsls.py | 20 +++++------ pygments/lexers/dylan.py | 10 +++--- pygments/lexers/haskell.py | 68 ++++++++++++++++++------------------- pygments/lexers/int_fiction.py | 6 ++-- pygments/lexers/javascript.py | 77 +++++++++++++++++++++--------------------- pygments/lexers/julia.py | 2 +- pygments/lexers/make.py | 2 +- pygments/lexers/ml.py | 18 +++++----- 8 files changed, 102 insertions(+), 101 deletions(-) diff --git a/pygments/lexers/dsls.py b/pygments/lexers/dsls.py index 0c144175..c594440f 100644 --- a/pygments/lexers/dsls.py +++ b/pygments/lexers/dsls.py @@ -34,7 +34,7 @@ class ProtoBufLexer(RegexLexer): tokens = { 'root': [ (r'[ \t]+', Text), - (r'[,;{}\[\]\(\)]', Punctuation), + (r'[,;{}\[\]()]', Punctuation), (r'/(\\\n)?/(\n|(.|\n)*?[^\\]\n)', Comment.Single), (r'/(\\\n)?\*(.|\n)*?\*(\\\n)?/', Comment.Multiline), (words(( @@ -62,9 +62,9 @@ class ProtoBufLexer(RegexLexer): (r'0[0-7]+[LlUu]*', Number.Oct), (r'\d+[LlUu]*', Number.Integer), (r'[+-=]', Operator), - (r'([a-zA-Z_][\w\.]*)([ \t]*)(=)', + (r'([a-zA-Z_][\w.]*)([ \t]*)(=)', bygroups(Name.Attribute, Text, Operator)), - ('[a-zA-Z_][\w\.]*', Name), + ('[a-zA-Z_][\w.]*', Name), ], 'package': [ (r'[a-zA-Z_]\w*', Name.Namespace, '#pop'), @@ -140,7 +140,7 @@ class BroLexer(RegexLexer): (r'[{}()\[\]$.,;]', Punctuation), # Identfier (r'([_a-zA-Z]\w*)(::)', bygroups(Name, Name.Namespace)), - (r'[a-zA-Z_][a-zA-Z_0-9]*', Name) + (r'[a-zA-Z_]\w*', Name) ], 'string': [ (r'"', String, '#pop'), @@ -370,7 +370,7 @@ class VGLLexer(RegexLexer): tokens = { 'root': [ - (r'\{[^\}]*\}', Comment.Multiline), + (r'\{[^}]*\}', Comment.Multiline), (r'declare', Keyword.Constant), (r'(if|then|else|endif|while|do|endwhile|and|or|prompt|object' r'|create|on|line|with|global|routine|value|endroutine|constant' @@ -378,11 +378,11 @@ class VGLLexer(RegexLexer): r'|delete|enable|windows|name|notprotected)(?! *[=<>.,()])', Keyword), (r'(true|false|null|empty|error|locked)', Keyword.Constant), - (r'[~\^\*\#!%&\[\]\(\)<>\|+=:;,./?-]', Operator), + (r'[~^*#!%&\[\]()<>|+=:;,./?-]', Operator), (r'"[^"]*"', String), - (r'(\.)([a-z_\$][\w\$]*)', bygroups(Operator, Name.Attribute)), + (r'(\.)([a-z_$][\w$]*)', bygroups(Operator, Name.Attribute)), (r'[0-9][0-9]*(\.[0-9]+(e[+\-]?[0-9]+)?)?', Number), - (r'[a-z_\$][\w\$]*', Name), + (r'[a-z_$][\w$]*', Name), (r'[\r\n]+', Text), (r'\s+', Text) ] @@ -403,7 +403,7 @@ class AlloyLexer(RegexLexer): flags = re.MULTILINE | re.DOTALL - iden_rex = r'[a-zA-Z_][a-zA-Z0-9_\']*' + iden_rex = r'[a-zA-Z_][\w\']*' text_tuple = (r'[^\S\n]+', Text) tokens = { @@ -439,7 +439,7 @@ class AlloyLexer(RegexLexer): (r'(and|or|implies|iff|in)\b', Operator.Word), (r'(fun|pred|fact|assert)(\s+)', bygroups(Keyword, Text), 'fun'), (r'!|#|&&|\+\+|<<|>>|>=|<=>|<=|\.|->', Operator), - (r'[-+/*%=<>&!^|~\{\}\[\]\(\)\.]', Operator), + (r'[-+/*%=<>&!^|~{}\[\]().]', Operator), (iden_rex, Name), (r'[:,]', Punctuation), (r'[0-9]+', Number.Integer), diff --git a/pygments/lexers/dylan.py b/pygments/lexers/dylan.py index e13627a2..5e95a5e3 100644 --- a/pygments/lexers/dylan.py +++ b/pygments/lexers/dylan.py @@ -88,7 +88,7 @@ class DylanLexer(RegexLexer): 'type-error-value', 'type-for-copy', 'type-union', 'union', 'values', 'vector', 'zero?')) - valid_name = '\\\\?[a-z0-9' + re.escape('!&*<>|^$%@_-+~?/=') + ']+' + valid_name = '\\\\?[a-z0-9!&*<>|^$%@_\\-+~?/=]+' def get_tokens_unprocessed(self, text): for index, token, value in RegexLexer.get_tokens_unprocessed(self, text): @@ -137,10 +137,10 @@ class DylanLexer(RegexLexer): (r"'(\\.|\\[0-7]{1,3}|\\x[a-f0-9]{1,2}|[^\\\'\n])'", String.Char), # binary integer - (r'#[bB][01]+', Number.Bin), + (r'#b[01]+', Number.Bin), # octal integer - (r'#[oO][0-7]+', Number.Oct), + (r'#o[0-7]+', Number.Oct), # floating point (r'[-+]?(\d*\.\d+(e[-+]?\d+)?|\d+(\.\d*)?e[-+]?\d+)', Number.Float), @@ -149,7 +149,7 @@ class DylanLexer(RegexLexer): (r'[-+]?\d+', Number.Integer), # hex integer - (r'#[xX][0-9a-f]+', Number.Hex), + (r'#x[0-9a-f]+', Number.Hex), # Macro parameters (r'(\?' + valid_name + ')(:)' @@ -160,7 +160,7 @@ class DylanLexer(RegexLexer): (r'\?' + valid_name, Name.Tag), # Punctuation - (r'(=>|::|#\(|#\[|##|\?\?|\?=|\?|[(){}\[\],\.;])', Punctuation), + (r'(=>|::|#\(|#\[|##|\?\?|\?=|\?|[(){}\[\],.;])', Punctuation), # Most operators are picked up as names and then re-flagged. # This one isn't valid in a name though, so we pick it up now. diff --git a/pygments/lexers/haskell.py b/pygments/lexers/haskell.py index 48980e12..089cdf4e 100644 --- a/pygments/lexers/haskell.py +++ b/pygments/lexers/haskell.py @@ -51,7 +51,7 @@ class HaskellLexer(RegexLexer): # Whitespace: (r'\s+', Text), # (r'--\s*|.*$', Comment.Doc), - (r'--(?![!#$%&*+./<=>?@\^|_~:\\]).*?$', Comment.Single), + (r'--(?![!#$%&*+./<=>?@^|_~:\\]).*?$', Comment.Single), (r'\{-', Comment.Multiline, 'comment'), # Lexemes: # Identifiers @@ -111,7 +111,7 @@ class HaskellLexer(RegexLexer): (r'\s+', Text), (r'[' + uni.Lu + r']\w*', Keyword.Type), (r'(_[\w\']+|[' + uni.Ll + r'][\w\']*)', Name.Function), - (r'--(?![!#$%&*+./<=>?@\^|_~:\\]).*?$', Comment.Single), + (r'--(?![!#$%&*+./<=>?@^|_~:\\]).*?$', Comment.Single), (r'\{-', Comment.Multiline, 'comment'), (r',', Punctuation), (r'[:!#$%&*+.\\/<=>?@^|~-]+', Operator), @@ -141,7 +141,7 @@ class HaskellLexer(RegexLexer): ], 'escape': [ (r'[abfnrtv"\'&\\]', String.Escape, '#pop'), - (r'\^[][' + uni.Lu + r'@\^_]', String.Escape, '#pop'), + (r'\^[][' + uni.Lu + r'@^_]', String.Escape, '#pop'), ('|'.join(ascii), String.Escape, '#pop'), (r'o[0-7]+', String.Escape, '#pop'), (r'x[\da-fA-F]+', String.Escape, '#pop'), @@ -186,11 +186,11 @@ class IdrisLexer(RegexLexer): # Comments (r'^(\s*)(%%%s)' % '|'.join(directives), bygroups(Text, Keyword.Reserved)), - (r'(\s*)(--(?![!#$%&*+./<=>?@\^|_~:\\]).*?)$', bygroups(Text, Comment.Single)), + (r'(\s*)(--(?![!#$%&*+./<=>?@^|_~:\\]).*?)$', bygroups(Text, Comment.Single)), (r'(\s*)(\|{3}.*?)$', bygroups(Text, Comment.Single)), (r'(\s*)(\{-)', bygroups(Text, Comment.Multiline), 'comment'), # Declaration - (r'^(\s*)([^\s\(\)\{\}]+)(\s*)(:)(\s*)', + (r'^(\s*)([^\s(){}]+)(\s*)(:)(\s*)', bygroups(Text, Name.Function, Text, Operator.Word, Text)), # Identifiers (r'\b(%s)(?!\')\b' % '|'.join(reserved), Keyword.Reserved), @@ -199,7 +199,7 @@ class IdrisLexer(RegexLexer): (r'[a-z][\w\']*', Text), # Special Symbols (r'(<-|::|->|=>|=)', Operator.Word), # specials - (r'([\(\)\{\}\[\]:!#$%&*+.\\/<=>?@^|~-]+)', Operator.Word), # specials + (r'([(){}\[\]:!#$%&*+.\\/<=>?@^|~-]+)', Operator.Word), # specials # Numbers (r'\d+[eE][+-]?\d+', Number.Float), (r'\d+\.\d+([eE][+-]?\d+)?', Number.Float), @@ -208,7 +208,7 @@ class IdrisLexer(RegexLexer): # Strings (r"'", String.Char, 'character'), (r'"', String, 'string'), - (r'[^\s\(\)\{\}]+', Text), + (r'[^\s(){}]+', Text), (r'\s+?', Text), # Whitespace ], 'module': [ @@ -251,7 +251,7 @@ class IdrisLexer(RegexLexer): ], 'escape': [ (r'[abfnrtv"\'&\\]', String.Escape, '#pop'), - (r'\^[][A-Z@\^_]', String.Escape, '#pop'), + (r'\^[][A-Z@^_]', String.Escape, '#pop'), ('|'.join(ascii), String.Escape, '#pop'), (r'o[0-7]+', String.Escape, '#pop'), (r'x[\da-fA-F]+', String.Escape, '#pop'), @@ -285,10 +285,10 @@ class AgdaLexer(RegexLexer): tokens = { 'root': [ # Declaration - (r'^(\s*)([^\s\(\)\{\}]+)(\s*)(:)(\s*)', + (r'^(\s*)([^\s(){}]+)(\s*)(:)(\s*)', bygroups(Text, Name.Function, Text, Operator.Word, Text)), # Comments - (r'--(?![!#$%&*+./<=>?@\^|_~:\\]).*?$', Comment.Single), + (r'--(?![!#$%&*+./<=>?@^|_~:\\]).*?$', Comment.Single), (r'\{-', Comment.Multiline, 'comment'), # Holes (r'\{!', Comment.Directive, 'hole'), @@ -308,7 +308,7 @@ class AgdaLexer(RegexLexer): # Strings (r"'", String.Char, 'character'), (r'"', String, 'string'), - (r'[^\s\(\)\{\}]+', Text), + (r'[^\s(){}]+', Text), (r'\s+?', Text), # Whitespace ], 'hole': [ @@ -393,29 +393,29 @@ class CryptolLexer(RegexLexer): (r'\)', Punctuation, '#pop'), (r'qualified\b', Keyword), # import X as Y - (r'([A-Z][a-zA-Z0-9_.]*)(\s+)(as)(\s+)([A-Z][a-zA-Z0-9_.]*)', + (r'([A-Z][\w.]*)(\s+)(as)(\s+)([A-Z][\w.]*)', bygroups(Name.Namespace, Text, Keyword, Text, Name), '#pop'), # import X hiding (functions) - (r'([A-Z][a-zA-Z0-9_.]*)(\s+)(hiding)(\s+)(\()', + (r'([A-Z][\w.]*)(\s+)(hiding)(\s+)(\()', bygroups(Name.Namespace, Text, Keyword, Text, Punctuation), 'funclist'), # import X (functions) - (r'([A-Z][a-zA-Z0-9_.]*)(\s+)(\()', + (r'([A-Z][\w.]*)(\s+)(\()', bygroups(Name.Namespace, Text, Punctuation), 'funclist'), # import X - (r'[a-zA-Z0-9_.]+', Name.Namespace, '#pop'), + (r'[\w.]+', Name.Namespace, '#pop'), ], 'module': [ (r'\s+', Text), - (r'([A-Z][a-zA-Z0-9_.]*)(\s+)(\()', + (r'([A-Z][\w.]*)(\s+)(\()', bygroups(Name.Namespace, Text, Punctuation), 'funclist'), - (r'[A-Z][a-zA-Z0-9_.]*', Name.Namespace, '#pop'), + (r'[A-Z][\w.]*', Name.Namespace, '#pop'), ], 'funclist': [ (r'\s+', Text), - (r'[A-Z][a-zA-Z0-9_]*', Keyword.Type), + (r'[A-Z]\w*', Keyword.Type), (r'(_[\w\']+|[a-z][\w\']*)', Name.Function), # TODO: these don't match the comments in docs, remove. - #(r'--(?![!#$%&*+./<=>?@\^|_~:\\]).*?$', Comment.Single), + #(r'--(?![!#$%&*+./<=>?@^|_~:\\]).*?$', Comment.Single), #(r'{-', Comment.Multiline, 'comment'), (r',', Punctuation), (r'[:!#$%&*+.\\/<=>?@^|~-]+', Operator), @@ -425,10 +425,10 @@ class CryptolLexer(RegexLexer): ], 'comment': [ # Multiline Comments - (r'[^/\*]+', Comment.Multiline), + (r'[^/*]+', Comment.Multiline), (r'/\*', Comment.Multiline, '#push'), (r'\*/', Comment.Multiline, '#pop'), - (r'[\*/]', Comment.Multiline), + (r'[*/]', Comment.Multiline), ], 'character': [ # Allows multi-chars, incorrectly. @@ -443,7 +443,7 @@ class CryptolLexer(RegexLexer): ], 'escape': [ (r'[abfnrtv"\'&\\]', String.Escape, '#pop'), - (r'\^[][A-Z@\^_]', String.Escape, '#pop'), + (r'\^[][A-Z@^_]', String.Escape, '#pop'), ('|'.join(ascii), String.Escape, '#pop'), (r'o[0-7]+', String.Escape, '#pop'), (r'x[\da-fA-F]+', String.Escape, '#pop'), @@ -671,7 +671,7 @@ class KokaLexer(RegexLexer): ] # symbols that can be in an operator - symbols = '[\$%&\*\+@!/\\\^~=\.:\-\?\|<>]+' + symbols = r'[$%&*+@!/\\^~=.:\-?|<>]+' # symbol boundary: an operator keyword should not be followed by any of these sboundary = '(?!'+symbols+')' @@ -720,7 +720,7 @@ class KokaLexer(RegexLexer): (r'(%s)' % '|'.join(typekeywords) + boundary, Keyword.Type), (r'(%s)' % '|'.join(keywords) + boundary, Keyword), (r'(%s)' % '|'.join(builtin) + boundary, Keyword.Pseudo), - (r'::?|:=|\->|[=\.]' + sboundary, Keyword), + (r'::?|:=|\->|[=.]' + sboundary, Keyword), # names (r'((?:[a-z]\w*/)*)([A-Z]\w*)', @@ -734,12 +734,12 @@ class KokaLexer(RegexLexer): (r'@"', String.Double, 'litstring'), # operators - (symbols + "|/(?![\*/])", Operator), + (symbols + "|/(?![*/])", Operator), (r'`', Operator), - (r'[\{\}\(\)\[\];,]', Punctuation), + (r'[{}()\[\];,]', Punctuation), # literals. No check for literal characters with len > 1 - (r'[0-9]+\.[0-9]+([eE][\-\+]?[0-9]+)?', Number.Float), + (r'[0-9]+\.[0-9]+([eE][\-+]?[0-9]+)?', Number.Float), (r'0[xX][0-9a-fA-F]+', Number.Hex), (r'[0-9]+', Number.Integer), @@ -761,14 +761,14 @@ class KokaLexer(RegexLexer): # type started by colon 'type': [ - (r'[\(\[<]', tokenType, 'type-nested'), + (r'[(\[<]', tokenType, 'type-nested'), include('type-content') ], # type nested in brackets: can contain parameters, comma etc. 'type-nested': [ - (r'[\)\]>]', tokenType, '#pop'), - (r'[\(\[<]', tokenType, 'type-nested'), + (r'[)\]>]', tokenType, '#pop'), + (r'[(\[<]', tokenType, 'type-nested'), (r',', tokenType), (r'([a-z]\w*)(\s*)(:)(?!:)', bygroups(Name, Text, tokenType)), # parameter name @@ -796,7 +796,7 @@ class KokaLexer(RegexLexer): bygroups(Name.Namespace, tokenType)), # type keyword operators - (r'::|\->|[\.:|]', tokenType), + (r'::|->|[.:|]', tokenType), # catchall default('#pop') @@ -810,10 +810,10 @@ class KokaLexer(RegexLexer): (r'//.*$', Comment.Single) ], 'comment': [ - (r'[^/\*]+', Comment.Multiline), + (r'[^/*]+', Comment.Multiline), (r'/\*', Comment.Multiline, '#push'), (r'\*/', Comment.Multiline, '#pop'), - (r'[\*/]', Comment.Multiline), + (r'[*/]', Comment.Multiline), ], 'litstring': [ (r'[^"]+', String.Double), @@ -831,7 +831,7 @@ class KokaLexer(RegexLexer): (r'[\'\n]', String.Char, '#pop'), ], 'escape-sequence': [ - (r'\\[nrt\\\"\']', String.Escape), + (r'\\[nrt\\"\']', String.Escape), (r'\\x[0-9a-fA-F]{2}', String.Escape), (r'\\u[0-9a-fA-F]{4}', String.Escape), # Yes, \U literals are 6 hex digits. diff --git a/pygments/lexers/int_fiction.py b/pygments/lexers/int_fiction.py index 1d21eafa..7b004c2e 100644 --- a/pygments/lexers/int_fiction.py +++ b/pygments/lexers/int_fiction.py @@ -33,7 +33,7 @@ class Inform6Lexer(RegexLexer): flags = re.MULTILINE | re.DOTALL | re.UNICODE - _name = r'[a-zA-Z_][a-zA-Z_0-9]*' + _name = r'[a-zA-Z_]\w*' # Inform 7 maps these four character classes to their ASCII # equivalents. To support Inform 6 inclusions within Inform 7, @@ -227,7 +227,7 @@ class Inform6Lexer(RegexLexer): ], # Values after hashes 'obsolete-dictionary-word': [ - (r'\S[a-zA-Z_0-9]*', String.Other, '#pop') + (r'\S\w*', String.Other, '#pop') ], 'system-constant': [ include('_whitespace'), @@ -687,7 +687,7 @@ class Inform7Lexer(RegexLexer): Comment.Preproc), (r'(%s)@p( .*?)?([%s]|\Z)' % (_start, _newline), Generic.Heading, '+p'), - (r'(%s)@[a-zA-Z_0-9]*[ %s]' % (_start, _newline), Keyword), + (r'(%s)@\w*[ %s]' % (_start, _newline), Keyword), (r'![^%s]*' % _newline, Comment.Single), (r'(\{)([%s]endlines)(\})' % _dash, bygroups(Punctuation, Keyword, Punctuation), '#pop'), diff --git a/pygments/lexers/javascript.py b/pygments/lexers/javascript.py index 2957d86c..76cd2276 100644 --- a/pygments/lexers/javascript.py +++ b/pygments/lexers/javascript.py @@ -23,8 +23,8 @@ __all__ = ['JavascriptLexer', 'KalLexer', 'LiveScriptLexer', 'DartLexer', JS_IDENT_START = ('(?:[$_' + uni.combine('Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl') + ']|\\\\u[a-fA-F0-9]{4})') -JS_IDENT_PART = ('(?:[$_' + uni.combine('Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl', - 'Mn', 'Mc', 'Nd', 'Pc') + +JS_IDENT_PART = ('(?:[$' + uni.combine('Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl', + 'Mn', 'Mc', 'Nd', 'Pc') + u'\u200c\u200d]|\\\\u[a-fA-F0-9]{4})') JS_IDENT = JS_IDENT_START + '(?:' + JS_IDENT_PART + ')*' @@ -114,13 +114,13 @@ class KalLexer(RegexLexer): (r'#(?!##[^#]).*?\n', Comment.Single), ], 'functiondef': [ - (r'[$a-zA-Z_][\w\$]*\s*', Name.Function, '#pop'), + (r'[$a-zA-Z_][\w$]*\s*', Name.Function, '#pop'), include('commentsandwhitespace'), ], 'classdef': [ (r'\binherits\s+from\b', Keyword), - (r'[$a-zA-Z_][\w\$]*\s*\n', Name.Class, '#pop'), - (r'[$a-zA-Z_][\w\$]*\s*', Name.Class), + (r'[$a-zA-Z_][\w$]*\s*\n', Name.Class, '#pop'), + (r'[$a-zA-Z_][\w$]*\s*', Name.Class), include('commentsandwhitespace'), ], 'listcomprehension': [ @@ -144,18 +144,18 @@ class KalLexer(RegexLexer): (r'(?:\([^()]+\))?\s*>', Name.Function), (r'[{(]', Punctuation), (r'\[', Punctuation, 'listcomprehension'), - (r'[})\]\.\,]', Punctuation), + (r'[})\].,]', Punctuation), (r'\b(function|method|task)\b', Keyword.Declaration, 'functiondef'), (r'\bclass\b', Keyword.Declaration, 'classdef'), (r'\b(safe\s+)?wait\s+for\b', Keyword, 'waitfor'), - (r'\b(me|this)(\.[$a-zA-Z_][\w\.\$]*)?\b', Name.Variable.Instance), - (r'(?|' r'(?:\(?[^()\n]+\)?)?[ ]*<[~-]{1,2}', Name.Function), - (r'\+\+|&&|(?>>?|==?|!=?|' r'~(?!\~?>)|-(?!\-?>)|<(?!\[)|(?|' - r'[+*`%&\|\^/])=?', + r'[+*`%&|^/])=?', Operator, 'slashstartsregex'), (r'[{(\[;,]', Punctuation, 'slashstartsregex'), (r'[})\].]', Punctuation), - (r'(?>>?|==?|!=?|[-<>+*%&\|\^/])=?', Operator, 'slashstartsregex'), + r'(<<|>>>?|==?|!=?|[-<>+*%&|^/])=?', Operator, 'slashstartsregex'), (r'[{(\[;,]', Punctuation, 'slashstartsregex'), (r'[})\].]', Punctuation), (r'(for|in|while|do|break|return|continue|switch|case|default|if|else|' @@ -477,7 +478,7 @@ class TypeScriptLexer(RegexLexer): # Match stuff like: constructor (r'\b(constructor|declare|interface|as|AS)\b', Keyword.Reserved), # Match stuff like: super(argument, list) - (r'(super)(\s*)(\([a-zA-Z0-9,_?.$\s]+\s*\))', + (r'(super)(\s*)(\([\w,?.$\s]+\s*\))', bygroups(Keyword.Reserved, Text), 'slashstartsregex'), # Match stuff like: function() {...} (r'([a-zA-Z_?.$][\w?.$]*)\(\) \{', Name.Other, 'slashstartsregex'), @@ -672,7 +673,7 @@ class LassoLexer(RegexLexer): ], 'escape': [ (r'\\(U[\da-f]{8}|u[\da-f]{4}|x[\da-f]{1,2}|[0-7]{1,3}|:[^:]+:|' - r'[abefnrtv?\"\'\\]|$)', String.Escape), + r'[abefnrtv?"\'\\]|$)', String.Escape), ], 'signature': [ (r'=>', Operator, '#pop'), @@ -776,7 +777,7 @@ class ObjectiveJLexer(RegexLexer): include('whitespace'), # function definition - (r'^(' + _ws + r'[\+-]' + _ws + r')([\(a-zA-Z_].*?[^\(])(' + _ws + r'\{)', + (r'^(' + _ws + r'[+-]' + _ws + r')([(a-zA-Z_].*?[^(])(' + _ws + r'\{)', bygroups(using(this), using(this, state='function_signature'), using(this))), @@ -788,7 +789,7 @@ class ObjectiveJLexer(RegexLexer): (r'(\s*)(@end)(\s*)', bygroups(Text, Keyword, Text)), include('statements'), - ('[{\(\)}]', Punctuation), + ('[{()}]', Punctuation), (';', Punctuation), ], 'whitespace': [ @@ -836,7 +837,7 @@ class ObjectiveJLexer(RegexLexer): (r'^(?=\s|/|