matlab-syntax.el:
(matlab--scan-line-for-unterminated-string): When comment found, disable all quote chars in the comment. (matlab--scan-line-comment-disable-strings): Find all syntax " chars and disable as whitespace. tests/indents.m: Add tests with ' in comments that impact indent.
This commit is contained in:
parent
12d9cfbfe3
commit
ef7894cea5
2 changed files with 21 additions and 3 deletions
|
@ -237,7 +237,9 @@ and `matlab--scan-line-for-unterminated-string' for specific details."
|
|||
(start-char (match-beginning 0)))
|
||||
(forward-char -1)
|
||||
(if (looking-at "\\s<")
|
||||
(forward-comment 1)
|
||||
(progn
|
||||
(matlab--scan-line-comment-disable-strings)
|
||||
(forward-comment 1))
|
||||
;; Else, check for valid string
|
||||
(if (or (bolp)
|
||||
(string= start-str "\"")
|
||||
|
@ -267,6 +269,16 @@ and `matlab--scan-line-for-unterminated-string' for specific details."
|
|||
(error
|
||||
t))))
|
||||
|
||||
(defun matlab--scan-line-comment-disable-strings ()
|
||||
"Disable bad string chars syntax from point to eol.
|
||||
Called when comments found in `matlab--scan-line-for-unterminated-string'."
|
||||
(save-excursion
|
||||
(while (re-search-forward "\\s\"" nil t)
|
||||
(save-excursion
|
||||
(forward-char -1)
|
||||
(matlab--put-char-category (point) 'matlab--transpose-syntax))
|
||||
)))
|
||||
|
||||
(defun matlab--scan-line-bad-blockcomment ()
|
||||
"Scan this line for invalid block comment starts."
|
||||
(when (and (re-search-forward "%{" (point-at-eol) t) (not (looking-at "\\s-*$")))
|
||||
|
|
|
@ -170,17 +170,23 @@ function out = array_constant_decls()
|
|||
|
||||
% This array has bad syntactic expression parsing due to the
|
||||
% apostrophy
|
||||
Closures = [ ...
|
||||
Closures = [
|
||||
755009 ; ... % 21-Feb-2067 Washington's Birthday (Mon)
|
||||
755010 ; ... % Another row.
|
||||
755010 ; % !!8
|
||||
];
|
||||
|
||||
dep = [
|
||||
root(info.function, factory, workspace, []), ... % likewise this isn't a keyword
|
||||
fcn3.finalize % the single quote used to break [] scanning
|
||||
];
|
||||
|
||||
% !!4
|
||||
out = { A %!!4
|
||||
Blong %!!12
|
||||
Csep %!!12
|
||||
multinest%!!12
|
||||
Closures%!!12
|
||||
dep %!!12
|
||||
}; %!!10
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue