summaryrefslogtreecommitdiff
path: root/pygments
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2014-04-22 10:14:45 +0200
committerGeorg Brandl <georg@python.org>2014-04-22 10:14:45 +0200
commitb6208b8eb613fd3e13446d6dda06e6a1cd796eb6 (patch)
tree73c8b9f7ba043adff63176abc0bd8c398bcfadc2 /pygments
parentd2db40e7b7ab2bc1e23c1d8d10b708d3bc57e839 (diff)
parent5b3057c00e88a7ba6999d03bc203b6ca35e359fe (diff)
downloadpygments-b6208b8eb613fd3e13446d6dda06e6a1cd796eb6.tar.gz
Merged in jaingaurav2/pygments-main-cmake (pull request #327)
Add analyse_text method to CMake lexer
Diffstat (limited to 'pygments')
-rw-r--r--pygments/lexers/agile.py16
-rw-r--r--pygments/lexers/functional.py2
-rw-r--r--pygments/lexers/other.py15
3 files changed, 17 insertions, 16 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/functional.py b/pygments/lexers/functional.py
index 122114fa..af9918a0 100644
--- a/pygments/lexers/functional.py
+++ b/pygments/lexers/functional.py
@@ -977,7 +977,7 @@ class HaskellLexer(RegexLexer):
(r'\s+', Text),
(r'[A-Z][a-zA-Z0-9_]*', Keyword.Type),
(r'(_[\w\']+|[a-z][\w\']*)', Name.Function),
- (r'--.*$', Comment.Single),
+ (r'--(?![!#$%&*+./<=>?@\^|_~:\\]).*?$', Comment.Single),
(r'{-', Comment.Multiline, 'comment'),
(r',', Punctuation),
(r'[:!#$%&*+.\\/<=>?@^|~-]+', Operator),
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': [