florianschanda / miss_hit

MATLAB Independent, Small & Safe, High Integrity Tools - code formatter and more
GNU General Public License v3.0
160 stars 21 forks source link

fix parse issues in https://github.com/spm/spm12 #219

Closed florianschanda closed 3 years ago

florianschanda commented 3 years ago

Separate out the parse issues indirectly reported in #218

florianschanda commented 3 years ago

@Remi-Gau I have fixed all of these now, except for one:

In external/fieldtrip/preproc/ft_preproc_online_downsample_init.m, line 27
| if factor < 1 or factor~=round(factor)
|                  ^^^^^^ error: expected end of statement, found IDENTIFIER instead

I believe this is actually a syntax error on their side, and indeed in upstream this has been fixed: https://github.com/fieldtrip/fieldtrip/blob/master/preproc/ft_preproc_online_downsample_init.m#L30

if factor < 1 || factor~=round(factor)

I have reported this to the SPM12 authors.

florianschanda commented 3 years ago

@Remi-Gau This error is actually hilarious:

In external/fieldtrip/preproc/ft_preproc_online_downsample_init.m, line 27
| if factor < 1 or factor~=round(factor)
|                  ^^^^^^ error: expected end of statement, found IDENTIFIER instead

This "parses" in MATLAB, but not really. Because what it means is this:

if factor < 1
   or('factor~=round(factor)');

Command form is evil. And the language design that permits an expression after a bracket-less expression is either dumb or careless.

So I think in the original library factor was just never less than 1, otherwise they would have gotten a run-time error.