summaryrefslogtreecommitdiff
path: root/pygments/lexers/matlab.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2021-03-01 11:47:34 +0100
committerGeorg Brandl <georg@python.org>2021-03-01 11:47:34 +0100
commit506708f1f0ff9452fe7d0e2613cc54629903bb1a (patch)
treeab3eb9d754c89c7f476bf91292634e3130dbc943 /pygments/lexers/matlab.py
parentec83fdf152e35cb338bf2738d9ce2d6c1c38c2d5 (diff)
downloadpygments-git-506708f1f0ff9452fe7d0e2613cc54629903bb1a.tar.gz
octave: also allow percent block comments
Diffstat (limited to 'pygments/lexers/matlab.py')
-rw-r--r--pygments/lexers/matlab.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/pygments/lexers/matlab.py b/pygments/lexers/matlab.py
index 2e5db693..e12303dd 100644
--- a/pygments/lexers/matlab.py
+++ b/pygments/lexers/matlab.py
@@ -3145,7 +3145,8 @@ class OctaveLexer(RegexLexer):
tokens = {
'root': [
- (r'%\{\s*\n', Comment.Multiline, 'blockcomment'),
+ (r'%\{\s*\n', Comment.Multiline, 'percentblockcomment'),
+ (r'#\{\s*\n', Comment.Multiline, 'hashblockcomment'),
(r'[%#].*$', Comment),
(r'^\s*function\b', Keyword, 'deffunc'),
@@ -3192,13 +3193,19 @@ class OctaveLexer(RegexLexer):
(r'(?<![\w)\].])\'', String, 'string'),
(r'[a-zA-Z_]\w*', Name),
+ (r'\s+', Text),
(r'.', Text),
],
- 'blockcomment': [
+ 'percentblockcomment': [
(r'^\s*%\}', Comment.Multiline, '#pop'),
(r'^.*\n', Comment.Multiline),
(r'.', Comment.Multiline),
],
+ 'hashblockcomment': [
+ (r'^\s*#\}', Comment.Multiline, '#pop'),
+ (r'^.*\n', Comment.Multiline),
+ (r'.', Comment.Multiline),
+ ],
'string': [
(r"[^']*'", String, '#pop'),
],