Commit graph

27 commits

Author SHA1 Message Date
Uwe Brauer f66183a5fe Add GPLvs3+ header to all files in tests directory 2023-07-25 18:44:32 +02:00
Eric Ludlam 61b24bec94 matlab.el:
(matlab--previous-line-indent-recommendation):
If scanning backwards finds empty line @ beginning of buffer,
then just return 0.

tests/indents.m:
Add blank first line to exercise above.
2021-04-02 20:55:46 -04:00
Eric Ludlam c934a0c0f9 matlab.el:
(matlab-indent-past-arg1-functions): Wrap expression
to only be whole-symbols.
(matlab-function-font-lock-keywords): Accomodate change
to above.

tests/indents.el:
Add test that used to indent as if it were a fcn that
indents past arg1, but shouldn't.
2021-04-02 20:43:01 -04:00
Eric Ludlam 41f3206733 matlab.el:
(matlab-calculate-indentation):
For continued from previous non-continued line, no arrays:
Include indent recommendation from the previous line to account for
indentation under ctrl blocks.
(matlab-next-line-indentation):
While computing startpt, be sure to move pt to the line that was
passed in.
2021-03-31 13:07:11 -04:00
Eric Ludlam e6e362a5a4 tests/indents.m, tests/mclass_cont.m:
Change indentation expecatations of some lines to match bug fix.
2021-03-30 22:17:39 -04:00
Eric Ludlam 9a8784af2a matlab-scan.el:
(matlab-previous-code-line): In case of no comments, also
hand skip over whitespace charts.

tests/metest.el:
Force empty lines to have no spaces, other lines stay the same.
This will exercise bug found above.

tests/indents.m:
Fix mlint error.
2021-03-25 19:02:27 -04:00
Eric Ludlam 7b49b6f447 matlab-syntax.el:
(matlab-syntax-support-command-dual): Default to t
(matlab-syntax-commanddual-functions): List of functions
commonly used with command line dual.
(matlab--scan-line-for-command-dual): Use above lists
instead of anti-keyword detection.

tests/fontlock.m, tests/indents.m:
Add tests for command dual.

tests/stringtest.m:
Command dual test updated to use 'disp'
2021-03-24 22:08:52 -04:00
Eric Ludlam fb674c7430 matlab.el:
(matlab-array-continuation-indent-level): New config variable.
(matlab-calculate-indentation-1):
When selecting indentation for within parens, add logic for 2 indent styles
depending on what kind of array continuation we find ourselves in.
Use new array-continuation indent level for inside arrays.
functions, arrays w/ open paren on a line by itself,
and nested arrays indent under their parens.

tests/indents.m:
Add examples of differnet kinds of array continuations.
2021-03-22 21:11:50 -04:00
Eric Ludlam ef7894cea5 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.
2021-03-20 12:11:39 -04:00
Eric Ludlam 099433517c matlab.el:
(matlab-lattr-block-close):
Stop decrementing for else type keywords.
(matlab-calculate-indentation-1):
Allow block comments to be help comments.

tests/continuations.m:
Add suite of previously failing tests.

tests/indents.m:
Block comments can now be help.
2021-03-20 01:15:00 -04:00
Eric Ludlam 81cc7718eb matlab-scane.el:
(matlab--buffer-block-tree): Delete
(matlab--scan-block-forward):
Handle case when `matlab-functions-have-end' is false.
(matlab-re-search-keyword-forward,matlab-re-search-keyword-backward):
Handle bounds correctly before restarting a scan.
(matlab-scan-before-change-fcn):
Only clear cached items AFTER the change.

matlab.el:
(matlab-in-command-restriction, matlab-with-current-command)
(matlab-lattr-local-end): DELETE
(matlab-backward-sexp, matlab-forward-sexp):
Reimplement using matlab--scan-block-forward/backward.
(matlab-lattr-block-cont, matlab-lattr-block-close):
Remove narrowing to current command, and use new search utils with bounds.
(matlab-lattr-middle-block-cont): Comment out

tests/metest.m:
(metest-sexp-traversal-test variable): better name.
(metest-sexp-traversal-test): Use new `matlab--scan-block-forward' / backward
instead of orig fcns.

tests/blocks.m:
Tweak a few test points to make them more challenging.
tests/continuations.m:
Added test with continuation, but disabled the problem.
tests/indents.m:
Brought in problem lines that break array sexp w/ ' in continuation
tests/mfuncnoend.m:
Fix whitespace.
tests/mfuncnoendblock.m:
Fix mlint warnings.
2021-03-19 23:28:51 -04:00
Eric Ludlam e0a7d52385 matlab-scan.el:
(matlab-compute-line-context): Don't change the match data.
(matlab-scan-end-of-command): New

matlab-syntax.el:
Doc string fixes.

matalb.el:
(matlab-find-prev-code-line): Now uses matlab-scan-beginning-of-command
instead of old version.
(matlab-with-current-command): Now uses matlab-scan-beginning-of-command AND
matlab-scan-end-of-command to build the narrowed region.
(matlab-cursor-on-valid-block-start): Make this immune to changes in
match-data from various conditions in the cond statement.
Use new matlab-scan-beginning-of-command instead of old version.
(matlab-beginning-of-command): Now use matlab-scan-beginning-of-command
as default impl.  Delete this fcn later.
(matlab-lattr-block-close):
Track original starting pos better, grab line context  after moving to start.

tests/metest.el:
Include new continuations.m test file.

tests/continuations.m:
New test file

tests/indents.m:
Move a couple tests into continuations.m
2021-03-18 21:48:16 -04:00
Eric Ludlam dbb6fc6757 matlab-scan.el:
(matlab-block-keyword-list): Add more keywords.
(matlab-compute-line-context-lvl-1): improve keyword detection
to handle the new types of keywords that don't start blocks.
Improve end of line detection to distinguish command dual from ellipsis.
(matlab-line-commanddual-p): New
(matlab-scan-previous-line-ellipsis-p): Improve how ellipsis is found
to be more explicit.
(matlab-describe-line-indent-context): Show command dual in output.

matlab.el:
(matlab-lattr-cont): Improve how ellipsis is found to be more
explicit.

indents.el:
Add more keyword styles around to deal with command dual problems.
2021-03-15 23:31:17 -04:00
Eric Ludlam 880e1837b1 matlab.el:
(matlab-calculate-indentation-1):
when inside parentheticals; capture indentation
of start as our previous indentation.
Later, ignore all that and just use paren column.
Left notes about what else to fix.

tests/indents.m:
Updated to match new indentation logic.
2021-03-14 19:54:46 -04:00
Eric Ludlam 6fe7da0a62 tests/metest.el
(metest-all-syntax-tests): Force files used for intenting to be
pre-spaced incorrectly.
(metest-condition-case-error-msg): Fix how caught errors are thrown.
(met-indents-files): Add mfuncnoendblock.m
(metest-indents-randomize-files): New
Not really random.
(metest-error): Add a buffer excerpt before throwing an error.

tests/indents.m, tests/mfuncends:
Added more indent tests.
tests/mfuncnoendblock.m:
Add more content.
Enable for use in indentation test.
2021-03-14 19:28:48 -04:00
Eric Ludlam 6fecb01874 tests/blocks.m:
Indented blank lines.
tests/indents.m:
Indent blank lines.
Added sample for fcn with very long name that
uses array continuation in the argument list.
2021-03-12 22:09:44 -05:00
Eric Ludlam 0fb21cfebf matlab.el:
(matlab-calculate-indentation-1):
Replace old -ltype- API calls with new API from matlab-scan.el.
Delete chunks of block comment handlers, replaced with simpler
code using matlab-scan stuff.

matlab-scan.el:
(matlab-compute-line-context-lvl-1):
Rename block comment stype values.
When a keyword is found, only enable iff not in parens.
Trailing comment section, if line starts with a comment,
assume it ends with a comment, and compute key values.
(matlab-line-comment-style, matlab-line-end-comment-column)
(matlab-line-ellipsis-p):
New
(matlab-line-end-p, matlab-line-block-middle-p)
(matlab-line-block-case-p):
New
(matlab-line-close-paren-p, matlab-line-close-paren-char)
(matlab-line-close-paren-col):
New
(matlab-describe-line-indent-context):
Fixup for various changes.
2021-03-10 21:37:51 -05:00
Eric Ludlam 7f6f729fd3 matlab.el:
(matlab-calc-indent):
If current line detects we are in an array continuation, then
it is not necessary to compute next-line indentation from it's context
since you can't have if/end type code in there.
Also, array continuation detection is now very fast.
tests/indents.m:
Added a bunch of misc indenttion tests around nested arrays, cell arrays, etc.
2021-03-09 12:50:59 -05:00
Eric Ludlam 6126f39548 tests/indents.m:
(array_constant-decls): Add a bunch of ways to have arrays be indented.
2021-03-07 11:55:13 -05:00
Eric Ludlam 26875b9517 matlab.el:
(matlab-block-end-pre): Reverse choice of regex used if functions have end.
This appears to have been backwards for a very long time.
(tests/blocks.m, tests/indents/m, tests/mclass.m):
Save with correct indentation for blank lines.
Add tests with function ... end on the same line.
2021-03-04 15:28:46 -05:00
Eric Ludlam 8294034489 matlab.el (matlab-lattr-cont):
Improve regexp matching ellipsis and check for if it is in a string.
tests/indents.m:
Add test for ellipsis in a string by itself.
2020-05-15 01:23:26 -04:00
Eric Ludlam fea089e220 matlab.el:
(matlab-block-comment-start-re, matlab-block-comment-end-re):
New regular expressions used to find the start/end of a block comment.
(matlab-ltype-block-comment-start, matlab-ltype-block-comment-end):
New predicates to check for block comment features.
(matlab-find-block-comments, matlab-ltype-block-comm-1):
Use new block comment expressions instead of hand-written regexps.
(matlab-ltype-block-comm-at-start, matlab-ltype-block-comm-at-end)
(matlab-electric-block-comment):
Use new block comment predicates.

indents.m:
Add some block comment indentation tests with valid and invalid block
comment starts.
2020-04-22 18:00:00 -04:00
Eric Ludlam 9eee3937ba matlab.el:
(matlab-keyword-list): Add `arguments' to list.
(matlab-class-font-lock-keywords): Add 'arguments' to regex where 'properties' are.
(matlab-mcos-regexp): Add `arguments' to expression.

tests/indents.el:
Add sample arguments block with indentation checks.
2020-02-24 10:42:10 -05:00
Eric Ludlam 42ae40f8e8 tests/indents.m:
Added tests to verify the above.
2019-12-14 19:45:50 -05:00
Eric Ludlam 73dff40bfa tests/indents.el
Added more block comment patterns.
2019-12-07 10:24:31 -05:00
Eric Ludlam 1e6a2bbd38 indents.m:
Add wide range of additional tests.
This should have a mostly complete set of features
from matlab.el's indentation engine now.
2019-12-06 22:58:34 -05:00
Eric Ludlam a58df74bf1 metest.el - add metest-indents-test and support functions.
Tweak how all the test status msgs are printed to be better seperated.
Add indentation tokens to mclass.
Add new indents.m
2019-10-03 21:15:41 -04:00