diff options
author | Georg Brandl <georg@python.org> | 2014-10-07 23:06:10 +0200 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2014-10-07 23:06:10 +0200 |
commit | 21ce7e702dd2356d621347de68b9aa92f45813d2 (patch) | |
tree | 3909c26af14d86b4bff04c07546e18a724dbb398 | |
parent | 38038390f16371f3d25add9bf0569fc0d90b4f8b (diff) | |
download | pygments-21ce7e702dd2356d621347de68b9aa92f45813d2.tar.gz |
Mathematica: add comparison operators
-rw-r--r-- | pygments/lexers/algebra.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/pygments/lexers/algebra.py b/pygments/lexers/algebra.py index f2ac6f8e..dd5bfea4 100644 --- a/pygments/lexers/algebra.py +++ b/pygments/lexers/algebra.py @@ -11,7 +11,7 @@ import re -from pygments.lexer import RegexLexer, bygroups +from pygments.lexer import RegexLexer, bygroups, words from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ Number, Punctuation @@ -84,13 +84,13 @@ class MathematicaLexer(RegexLexer): 'application/vnd.wolfram.cdf'] # http://reference.wolfram.com/mathematica/guide/Syntax.html - operators = [ + operators = ( ";;", "=", "=.", "!=" "==", ":=", "->", ":>", "/.", "+", "-", "*", "/", "^", "&&", "||", "!", "<>", "|", "/;", "?", "@", "//", "/@", "@@", - "@@@", "~~", "===", "&"] - operators.sort(reverse=True) + "@@@", "~~", "===", "&", "<", ">", "<=", ">=", + ) - punctuation = [",", ";", "(", ")", "[", "]", "{", "}"] + punctuation = (",", ";", "(", ")", "[", "]", "{", "}") def _multi_escape(entries): return '(%s)' % ('|'.join(re.escape(entry) for entry in entries)) @@ -108,8 +108,8 @@ class MathematicaLexer(RegexLexer): (r'-?[0-9]*\.[0-9]+', Number.Float), (r'-?[0-9]+', Number.Integer), - (_multi_escape(operators), Operator), - (_multi_escape(punctuation), Punctuation), + (words(operators), Operator), + (words(punctuation), Punctuation), (r'".*?"', String), (r'\s+', Text.Whitespace), ], |