git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v3] userdiff.c & doc/gitattributes.txt: add Octave

From
Johannes Sixt <j6t@kdbg.org>
Date
May 15, 2019, 17:46 UTC
Message-ID
<a2455214-9ce5-71e3-74bc-114af6fcfca7@kdbg.org>
In-Reply-To
<CALM0=-n_=8K4RWE9MvwPFT26UwN-rAA09ryqdTfEF4GJ57YBjg@mail.gmail.com>
Am 15.05.19 um 08:15 schrieb LI, BO XUAN:
Show 28 quoted lines
> On Wed, May 15, 2019 at 1:57 PM Johannes Sixt <j6t@kdbg.org> wrote:
>>
>> 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.
> 
> '##' is not valid syntax in Matlab scripts.
> 
> '%%%' is valid syntax in Matlab. However, it is not used as a section divider.

In Matlab, is %%% followed by space at the beginning of a line *commonly* used for something different? If I were to make a guess, I would say no. If I'm right, it does not hurt to merge the Octave rules into the Matlab rules.

-- Hannes
Previous: LI, BO XUANNext: Junio C Hamano
Message 10 of 22 in “doc/gitattributes: add Octave”
  1. doc/gitattributes: add OctaveBoxuan Li, May 10, 2019
  2. Philip OakleyMay 10, 2019
  3. Ævar Arnfjörð BjarmasonMay 10, 2019
  4. LI, BO XUANMay 11, 2019
  5. userdiff.c & doc/gitattributes.txt: add OctaveBoxuan Li, May 11, 2019
  6. userdiff.c & doc/gitattributes.txt: add OctaveBoxuan Li, May 11, 2019
  7. Junio C HamanoMay 15, 2019
  8. Johannes SixtMay 15, 2019
  9. LI, BO XUANMay 15, 2019
  10. Johannes SixtMay 15, 2019
  11. Junio C HamanoMay 16, 2019
  12. Johannes SixtMay 16, 2019
  13. Junio C HamanoMay 16, 2019
  14. LI, BO XUANMay 17, 2019
  15. Johannes SixtMay 17, 2019
  16. userdiff.c & doc/gitattributes.txt: add OctaveBoxuan Li, May 15, 2019
  17. userdiff: add OctaveBoxuan Li, May 18, 2019
  18. Johannes SixtMay 20, 2019
  19. userdiff: add OctaveBoxuan Li, May 21, 2019
  20. Junio C HamanoMay 28, 2019
  21. Johannes SixtMay 28, 2019
  22. userdiff: fix grammar and style issuesBoxuan Li, May 29, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.