devtools.dialectLint
devtools: devtools.dialectLint (TARGET)
devtools: devtools.dialectLint (TARGET, DIALECT)
devtools: R = devtools.dialectLint (…)
Check which language a file is written in.
devtools.dialectLint (TARGET) prints every file that is not
written in Octave’s own dialect. TARGET is one file, the folder a
package’s source is in, or the name of an installed package.
devtools.dialectLint (TARGET, asks the other
question instead: whether MATLAB would accept the file. That is the check
to run on a probe before it is sent to a MATLAB machine, where Octave-only
syntax fails with a message naming nothing useful.
'matlab')
R = devtools.dialectLint (…) prints nothing and returns
the findings as a structure array holding file, line,
column, rule and message, empty where there is nothing
to report.
A file is read twice. Where it does not parse at all the finding is
'syntax' and names a fault the file has in any dialect; where it
parses but the dialect refuses it the finding is 'dialect-octave'
or 'dialect-matlab' and carries the line that stopped it. The two
are kept apart because a broken file is not a dialect question.
The two names are the two devtools.__parse__ takes, and there is no
lenient mode here: whether a file parses as either language is not a
dialect question, and is reported as 'syntax' instead.
'octave'# comments, ! and !=, and the
typed block terminators. A file that passes is one MATLAB cannot read.
The two spellings Octave has no alternative for are still accepted, a
~ standing for an ignored output and %! opening a test block.'matlab'% comments, ~ and ~=, and a bare end.
Rejected are the constructs Octave alone has, among them
do … until, unwind_protect, compound assignment,
++, an index chained onto a call and an assignment used as an
expression.The parser is a compiled file, so this raises where the package was installed without a working compiler rather than reporting a file clean because nothing read it.
See also: devtools.docLint
Source Code: devtools.dialectLint