Web lists-archives.com

Re: [PATCH] doc/gitattributes: add Octave




On Fri, May 10 2019, Boxuan Li wrote:

> `matlab` pattern is also suitable for source code
> in the GNU Octave language.
>
> Signed-off-by: Boxuan Li <liboxuan@xxxxxxxxxxxxxx>
> ---
>  Documentation/gitattributes.txt | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt
> index 4fb20cd0e9..1b28381bda 100644
> --- a/Documentation/gitattributes.txt
> +++ b/Documentation/gitattributes.txt
> @@ -819,7 +819,7 @@ patterns are available:
>
>  - `java` suitable for source code in the Java language.
>
> -- `matlab` suitable for source code in the MATLAB language.
> +- `matlab` suitable for source code in the MATLAB/Octave language.
>
>  - `objc` suitable for source code in the Objective-C language.

I've never used either, but browsing our patterns I see:

         "^[[:space:]]*((classdef|function)[[:space:]].*)$|^%%[[:space:]].*$",

I.e. that last bit matches ^%%, and then here:
https://en.wikibooks.org/wiki/MATLAB_Programming/Differences_between_Octave_and_MATLAB

    MATLAB uses the percent sign '%' to begin a comment. Octave uses
    both the hash symbol # and the percent sign % interchangeably.

So here we have the "function" pattern matching a comment, right? (this
doesn't have any tests) and we'd want to add "#" to Octave, but not
MATLAB.

I see both tend to use the ".m" extension. Anyway, isn't it better to
add an "octave" pattern, and document that they're mostly the same
(although it looks like we can add #-comments, to future-proof
ourselves?