Re: [PATCH v3] userdiff.c & doc/gitattributes.txt: add Octave
- From
LI, BO XUAN <liboxuan@connect.hku.hk>
- Date
- May 15, 2019, 06:15 UTC
- Message-ID
- <CALM0=-n_=8K4RWE9MvwPFT26UwN-rAA09ryqdTfEF4GJ57YBjg@mail.gmail.com>
- In-Reply-To
- <aa86f483-9c73-eb6d-1a73-80fd4894c093@kdbg.org>
On Wed, May 15, 2019 at 1:57 PM Johannes Sixt <j6t@kdbg.org> wrote:
Show 25 quoted lines
>
> Am 11.05.19 um 06:13 schrieb Boxuan Li:
> > Octave pattern is almost the same as matlab. Besides,
> > octave also uses '%%%' or '##' to begin code sections.
> >
>
> > @@ -60,6 +60,11 @@ PATTERNS("java",
> > PATTERNS("matlab",
> > "^[[:space:]]*((classdef|function)[[:space:]].*)$|^%%[[:space:]].*$",
> > "[a-zA-Z_][a-zA-Z0-9_]*|[-+0-9.e]+|[=~<>]=|\\.[*/\\^']|\\|\\||&&"),
> > +PATTERNS("octave",
> > + /* Mostly the same as matlab. In addition, Octave
> > + * supports '##' and '%%%' for code sections */
> > + "^[[:space:]]*((classdef|function)[[:space:]].*)$|^(%%%?|##)[[:space:]].*$",
> > + "[a-zA-Z_][a-zA-Z0-9_]*|[-+0-9.e]+|[=~<>]=|\\.[*/\\^']|\\|\\||&&"),
> > PATTERNS("objc",
> > /* Negate C statements that can look like functions */
> > "!^[ \t]*(do|for|if|else|return|switch|while)\n"
> >
>
> In Matlab, are %%% and ## valid syntax? If not, instead of introducing a
> new language, please just extend the Matlab rule to treat %%% and ## as
> you need for Octave and mark your Octave files as Matlab.
>
> -- HannesHi Hannes,
'##' is not valid syntax in Matlab scripts.
'%%%' is valid syntax in Matlab. However, it is not used as a section divider.
ref: https://www.mathworks.com/help/matlab/matlab_prog/run-sections-of-programs.html ref: https://octave.org/doc/interpreter/Sections.html
Best regards, Boxuan