diff options
author | Georg Brandl <georg@python.org> | 2014-04-22 10:14:15 +0200 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2014-04-22 10:14:15 +0200 |
commit | 5b3057c00e88a7ba6999d03bc203b6ca35e359fe (patch) | |
tree | b8c55d44fd335eb46bc52368173181050ae9f459 /pygments | |
parent | 4393a40410fa23443311d3d03543bb558ad94ded (diff) | |
parent | 545b0f4ca5a80dea21142b538390378d1e48e2ce (diff) | |
download | pygments-5b3057c00e88a7ba6999d03bc203b6ca35e359fe.tar.gz |
Merged in jaingaurav2/pygments-main-975 (pull request #331)
Move order of comment match after operator match
Diffstat (limited to 'pygments')
-rw-r--r-- | pygments/lexers/agile.py | 16 | ||||
-rw-r--r-- | pygments/lexers/other.py | 15 |
2 files changed, 16 insertions, 15 deletions
diff --git a/pygments/lexers/agile.py b/pygments/lexers/agile.py index 0a780a3e..b575f29c 100644 --- a/pygments/lexers/agile.py +++ b/pygments/lexers/agile.py @@ -1720,7 +1720,7 @@ class FactorLexer(RegexLexer): (r'"""\s+(?:.|\n)*?\s+"""', String), (r'"(?:\\\\|\\"|[^"])*"', String), (r'\S+"\s+(?:\\\\|\\"|[^"])*"', String), - (r'CHAR:\s+(\\[\\abfnrstv]|[^\\]\S+)\s', String.Char), + (r'CHAR:\s+(?:\\[\\abfnrstv]|[^\\]\S*)\s', String.Char), # comments (r'!\s+.*$', Comment), @@ -1728,21 +1728,21 @@ class FactorLexer(RegexLexer): (r'/\*\s+(?:.|\n)*?\s\*/\s', Comment), # boolean constants - (r'(t|f)\s', Name.Constant), + (r'[tf]\s', Name.Constant), # symbols and literals (r'[\\$]\s+\S+', Name.Constant), (r'M\\\s+\S+\s+\S+', Name.Constant), # numbers - (r'[+-]?([\d,]*\d)?\.(\d([\d,]*\d)?)?([eE][+-]?\d+)?\s', Number), - (r'[+-]?\d([\d,]*\d)?([eE][+-]?\d+)?\s', Number), - (r'0x[a-fA-F\d]([a-fA-F\d,]*[a-fA-F\d])?(p\d([\d,]*\d)?)?\s', Number), - (r'NAN:\s+[a-fA-F\d]([a-fA-F\d,]*[a-fA-F\d])?(p\d([\d,]*\d)?)?\s', Number), + (r'[+-]?(?:[\d,]*\d)?\.(?:\d([\d,]*\d)?)?(?:[eE][+-]?\d+)?\s', Number), + (r'[+-]?\d(?:[\d,]*\d)?(?:[eE][+-]?\d+)?\s', Number), + (r'0x[a-fA-F\d](?:[a-fA-F\d,]*[a-fA-F\d])?(?:p\d([\d,]*\d)?)?\s', Number), + (r'NAN:\s+[a-fA-F\d](?:[a-fA-F\d,]*[a-fA-F\d])?(?:p\d([\d,]*\d)?)?\s', Number), (r'0b[01]+\s', Number), (r'0o[0-7]+\s', Number), - (r'(\d([\d,]*\d)?)?\+\d([\d,]*\d)?/\d([\d,]*\d)?\s', Number), - (r'(\-\d([\d,]*\d)?)?\-\d([\d,]*\d)?/\d([\d,]*\d)?\s', Number), + (r'(?:\d([\d,]*\d)?)?\+\d(?:[\d,]*\d)?/\d(?:[\d,]*\d)?\s', Number), + (r'(?:\-\d([\d,]*\d)?)?\-\d(?:[\d,]*\d)?/\d(?:[\d,]*\d)?\s', Number), # keywords (r'(?:deprecated|final|foldable|flushable|inline|recursive)\s', diff --git a/pygments/lexers/other.py b/pygments/lexers/other.py index c308c884..306ae326 100644 --- a/pygments/lexers/other.py +++ b/pygments/lexers/other.py @@ -1309,8 +1309,6 @@ class ModelicaLexer(RegexLexer): r'([\[\d,:\]]*)' r'(\.([a-zA-Z_][\w]*|[\'][^\']+[\']))+' r'([\[\d,:\]]*)', Name.Class), - (r'([a-zA-Z_][\w]*|[\'][^\']+[\'])' - r'([\[\d,:\]]+)', Name.Class), (r'(\'[\w\+\-\*\/\^]+\'|\w+)', Name), (r'[()\[\]{},.;]', Punctuation), (r'\'', Name, 'quoted_ident'), @@ -1335,9 +1333,11 @@ class ModelicaLexer(RegexLexer): ], 'functions': [ (r'(abs|acos|acosh|asin|asinh|atan|atan2|atan3|ceil|cos|cosh|' - r'cross|div|exp|floor|getInstanceName|log|log10|mod|rem|' - r'semiLinear|sign|sin|sinh|size|spatialDistribution|sqrt|tan|' - r'tanh|zeros)\b', Name.Function), + r'cross|diagonal|div|exp|fill|floor|getInstanceName|identity|' + r'linspace|log|log10|matrix|mod|max|min|ndims|ones|outerProduct|' + r'product|rem|scalar|semiLinear|skew|sign|sin|sinh|size|' + r'spatialDistribution|sum|sqrt|symmetric|tan|tanh|transpose|' + r'vector|zeros)\b', Name.Function), ], 'operators': [ (r'(actualStream|and|assert|backSample|cardinality|change|Clock|' @@ -1347,8 +1347,9 @@ class ModelicaLexer(RegexLexer): r'terminate)\b', Name.Builtin), ], 'classes': [ - (r'(operator)?(\s+)?(block|class|connector|end|function|model|operator|package|' - r'record|type)(\s+)((?!if|when|while)[A-Za-z_]\w*|[\'][^\']+[\'])([;]?)', + (r'(operator)?(\s+)?(block|class|connector|end|function|model|' + r'operator|package|record|type)(\s+)' + r'((?!if|for|when|while)[A-Za-z_]\w*|[\'][^\']+[\'])([;]?)', bygroups(Keyword, Text, Keyword, Text, Name.Class, Text)) ], 'quoted_ident': [ |