Update font-lock keywords for functions so that
scanning for inputs works across multiple lines. Add fontlock.m test file.
This commit is contained in:
parent
bfbd689d2f
commit
1a6a3f6a42
2 changed files with 26 additions and 2 deletions
|
@ -1197,7 +1197,9 @@ Uses `regex-opt' if available. Otherwise creates a 'dumb' expression."
|
|||
(list (concat "^\\s-*function\\>[ \t\n.]*"
|
||||
"\\(\\(\\[[^]]*\\]\\|\\sw+\\)[ \t\n.]*=[ \t\n.]*\\)?"
|
||||
"\\sw+\\s-*(")
|
||||
'("\\s-*\\(\\sw+\\)\\s-*[,)]" nil nil
|
||||
'("\\s-*\\(\\sw+\\)\\s-*[,)]"
|
||||
(save-excursion (matlab-end-of-command) (point))
|
||||
nil
|
||||
(1 font-lock-variable-name-face)))
|
||||
;; I like variables for FOR loops
|
||||
'("\\<\\(\\(?:par\\)?for\\)\\s-+\\(\\sw+\\)\\s-*=\\s-*\
|
||||
|
@ -2101,7 +2103,8 @@ Optional BEGINNING is where the command starts from."
|
|||
;; becomes visible.
|
||||
(not (save-excursion
|
||||
(beginning-of-line)
|
||||
(looking-at (matlab-block-scan-re))))
|
||||
(and (looking-at (matlab-block-scan-re))
|
||||
(not (looking-at (matlab-match-function-re))))))
|
||||
;; If we hit the end of the buffer unexpectedly, this test
|
||||
;; will fail and we'll avoid looping forever. (E.g., this
|
||||
;; is triggered if a continuation line is the last one in
|
||||
|
|
21
tests/fontlock.m
Normal file
21
tests/fontlock.m
Normal file
|
@ -0,0 +1,21 @@
|
|||
function [a, b, c] = fontlock(input1, ...
|
||||
input2, ...
|
||||
input3)
|
||||
% FONTLOCK testing function for Emacs & MATLAB.
|
||||
|
||||
nested(input1);
|
||||
|
||||
q = input2;
|
||||
r = input3;
|
||||
|
||||
function nested(ni1)
|
||||
% Nest function comment
|
||||
|
||||
b = ni1;
|
||||
a = q;
|
||||
c = r;
|
||||
|
||||
end
|
||||
|
||||
|
||||
end
|
Loading…
Reference in a new issue