summaryrefslogtreecommitdiff
path: root/pygments/lexers/algebra.py
diff options
context:
space:
mode:
Diffstat (limited to 'pygments/lexers/algebra.py')
-rw-r--r--pygments/lexers/algebra.py14
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),
],