summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pygments/lexers/matlab.py12
-rw-r--r--tests/examplefiles/matlab_sample4
2 files changed, 13 insertions, 3 deletions
diff --git a/pygments/lexers/matlab.py b/pygments/lexers/matlab.py
index badc1fa3..b7436cd1 100644
--- a/pygments/lexers/matlab.py
+++ b/pygments/lexers/matlab.py
@@ -112,7 +112,7 @@ class MatlabLexer(RegexLexer):
(r'\d+', Number.Integer),
(r'(?<![\w\)\].])\'', String, 'string'),
- ('[a-zA-Z_]\w*', Name),
+ (r'[a-zA-Z_]\w*', Name),
(r'.', Text),
],
'string': [
@@ -128,6 +128,8 @@ class MatlabLexer(RegexLexer):
bygroups(Whitespace, Text, Whitespace, Punctuation,
Whitespace, Name.Function, Punctuation, Text,
Punctuation, Whitespace), '#pop'),
+ # function with no args
+ (r'(\s*)([a-zA-Z_]\w*)', bygroups(Text, Name.Function), '#pop'),
],
}
@@ -576,7 +578,7 @@ class OctaveLexer(RegexLexer):
(r'(?<=[\w\)\].])\'+', Operator),
(r'(?<![\w\)\].])\'', String, 'string'),
- ('[a-zA-Z_]\w*', Name),
+ (r'[a-zA-Z_]\w*', Name),
(r'.', Text),
],
'string': [
@@ -587,6 +589,8 @@ class OctaveLexer(RegexLexer):
bygroups(Whitespace, Text, Whitespace, Punctuation,
Whitespace, Name.Function, Punctuation, Text,
Punctuation, Whitespace), '#pop'),
+ # function with no args
+ (r'(\s*)([a-zA-Z_]\w*)', bygroups(Text, Name.Function), '#pop'),
],
}
@@ -641,7 +645,7 @@ class ScilabLexer(RegexLexer):
(r'\d+[eEf][+-]?[0-9]+', Number.Float),
(r'\d+', Number.Integer),
- ('[a-zA-Z_]\w*', Name),
+ (r'[a-zA-Z_]\w*', Name),
(r'.', Text),
],
'string': [
@@ -653,5 +657,7 @@ class ScilabLexer(RegexLexer):
bygroups(Whitespace, Text, Whitespace, Punctuation,
Whitespace, Name.Function, Punctuation, Text,
Punctuation, Whitespace), '#pop'),
+ # function with no args
+ (r'(\s*)([a-zA-Z_]\w*)', bygroups(Text, Name.Function), '#pop'),
],
}
diff --git a/tests/examplefiles/matlab_sample b/tests/examplefiles/matlab_sample
index 4f61afe8..bb00b517 100644
--- a/tests/examplefiles/matlab_sample
+++ b/tests/examplefiles/matlab_sample
@@ -28,3 +28,7 @@ y = exp(x);
{%
a block comment
%}
+
+function no_arg_func
+fprintf('%s\n', 'function with no args')
+end