summaryrefslogtreecommitdiff
path: root/pygments/lexers/matlab.py
diff options
context:
space:
mode:
Diffstat (limited to 'pygments/lexers/matlab.py')
-rw-r--r--pygments/lexers/matlab.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/pygments/lexers/matlab.py b/pygments/lexers/matlab.py
index 73d2eb62..f1f3555a 100644
--- a/pygments/lexers/matlab.py
+++ b/pygments/lexers/matlab.py
@@ -11,7 +11,8 @@
import re
-from pygments.lexer import Lexer, RegexLexer, bygroups, words, do_insertions
+from pygments.lexer import Lexer, RegexLexer, bygroups, default, words, \
+ do_insertions
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
Number, Punctuation, Generic, Whitespace
@@ -72,7 +73,7 @@ class MatlabLexer(RegexLexer):
"hilb", "invhilb", "magic", "pascal", "rosser", "toeplitz", "vander",
"wilkinson")
- _operators = r'-|==|~=|<=|>=|<|>|&&|&|~|\|\|?|\.\*|\*|\+|\.\^|\.\\|\.\/|\/|\\'
+ _operators = r'-|==|~=|<=|>=|<|>|&&|&|~|\|\|?|\.\*|\*|\+|\.\^|\.\\|\./|/|\\'
tokens = {
'root': [
@@ -104,7 +105,7 @@ class MatlabLexer(RegexLexer):
# is recognized if it is either surrounded by spaces or by no
# spaces on both sides; only the former case matters for us. (This
# allows distinguishing `cd ./foo` from `cd ./ foo`.)
- (r'(?:^|(?<=;))(\s*)(\w+)(\s+)(?!=|\(|(%s)\s+)' % _operators,
+ (r'(?:^|(?<=;))(\s*)(\w+)(\s+)(?!=|\(|(?:%s)\s+)' % _operators,
bygroups(Text, Name, Text), 'commandargs'),
# operators:
@@ -156,7 +157,8 @@ class MatlabLexer(RegexLexer):
(r"[ \t]+", Text),
("'[^']*'", String),
(r"[^';\s]+", String),
- (";?", Punctuation, '#pop'),
+ (";", Punctuation, '#pop'),
+ default('#pop'),
]
}