{"thread":{"id":"52608","subject":"[PATCH] userdiff: add Julia to supported userdiff languages","startedAt":"2020-01-10T03:10:14Z","lastAt":"2020-01-10T20:14:40Z","messageCount":5,"participants":["Ryan Zoeller via GitGitGadget","Johannes Schindelin","Johannes Sixt","Ryan Zoeller"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"389564","messageId":"pull.521.git.1578625810098.gitgitgadget@gmail.com","threadId":"52608","inReplyTo":null,"subject":"[PATCH] userdiff: add Julia to supported userdiff languages","fromName":"Ryan Zoeller via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2020-01-10T03:10:09Z","receivedAt":"2020-01-10T03:10:14Z","isPatch":true,"sender":{"key":"rtzoeller@rtzoeller.com","avatar":"https://avatars.githubusercontent.com/u/573497?v=4"},"body":"Add xfuncname and word_regex patterns for Julia[1],\nwhich is a language used in numerical analysis and\ncomputational science.\n\nThe default behavior for xfuncname did not allow\nfunctions to be indented, nor functions to have a\nmacro applied, such as @inline or @generated.\n\n[1]: https://julialang.org\n\nSigned-off-by: Ryan Zoeller <rtzoeller@rtzoeller.com>\n---\n    userdiff: add Julia to supported userdiff languages\n    \n    Add xfuncname and word_regex patterns for Julia1 [https://julialang.org]\n    , which is a language used in numerical analysis and computational\n    science.\n    \n    The default behavior for xfuncname did not allow functions to be\n    indented, nor functions to have a macro applied, such as @inline or\n    @generated.\n    \n    Signed-off-by: Ryan Zoeller rtzoeller@rtzoeller.com\n    [rtzoeller@rtzoeller.com]\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-521%2Frtzoeller%2Fjulia_userdiff-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-521/rtzoeller/julia_userdiff-v1\nPull-Request: https://github.com/gitgitgadget/git/pull/521\n\n Documentation/gitattributes.txt |  2 ++\n t/t4018-diff-funcname.sh        |  1 +\n t/t4018/julia-function          |  5 +++++\n t/t4018/julia-indented-function |  8 ++++++++\n t/t4018/julia-inline-function   |  5 +++++\n t/t4018/julia-macro             |  5 +++++\n t/t4018/julia-mutable-struct    |  5 +++++\n t/t4018/julia-struct            |  5 +++++\n userdiff.c                      | 15 +++++++++++++++\n 9 files changed, 51 insertions(+)\n create mode 100644 t/t4018/julia-function\n create mode 100644 t/t4018/julia-indented-function\n create mode 100644 t/t4018/julia-inline-function\n create mode 100644 t/t4018/julia-macro\n create mode 100644 t/t4018/julia-mutable-struct\n create mode 100644 t/t4018/julia-struct\n\ndiff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt\nindex 508fe713c4..d39dc727e3 100644\n--- a/Documentation/gitattributes.txt\n+++ b/Documentation/gitattributes.txt\n@@ -824,6 +824,8 @@ patterns are available:\n \n - `java` suitable for source code in the Java language.\n \n+- `julia` suitable for source code in the Julia language.\n+\n - `matlab` suitable for source code in the MATLAB and Octave languages.\n \n - `objc` suitable for source code in the Objective-C language.\ndiff --git a/t/t4018-diff-funcname.sh b/t/t4018-diff-funcname.sh\nindex c0f4839543..d4613eb7d2 100755\n--- a/t/t4018-diff-funcname.sh\n+++ b/t/t4018-diff-funcname.sh\n@@ -38,6 +38,7 @@ diffpatterns=\"\n \tgolang\n \thtml\n \tjava\n+\tjulia\n \tmatlab\n \tobjc\n \tpascal\ndiff --git a/t/t4018/julia-function b/t/t4018/julia-function\nnew file mode 100644\nindex 0000000000..a2eab83c27\n--- /dev/null\n+++ b/t/t4018/julia-function\n@@ -0,0 +1,5 @@\n+function RIGHT()\n+    # A comment\n+    # Another comment\n+    return ChangeMe\n+end\ndiff --git a/t/t4018/julia-indented-function b/t/t4018/julia-indented-function\nnew file mode 100644\nindex 0000000000..2d48aabcdb\n--- /dev/null\n+++ b/t/t4018/julia-indented-function\n@@ -0,0 +1,8 @@\n+function outer_function()\n+    function RIGHT()\n+        for i = 1:10\n+            print(i)\n+        end\n+        # ChangeMe\n+    end\n+end\ndiff --git a/t/t4018/julia-inline-function b/t/t4018/julia-inline-function\nnew file mode 100644\nindex 0000000000..5806f224fb\n--- /dev/null\n+++ b/t/t4018/julia-inline-function\n@@ -0,0 +1,5 @@\n+@inline function RIGHT()\n+    # Prints Hello, then something else.\n+    println(\"Hello\")\n+    println(\"ChangeMe\")\n+end\ndiff --git a/t/t4018/julia-macro b/t/t4018/julia-macro\nnew file mode 100644\nindex 0000000000..1d18bc2750\n--- /dev/null\n+++ b/t/t4018/julia-macro\n@@ -0,0 +1,5 @@\n+macro RIGHT()\n+    # First comment\n+    # Second comment\n+    return :( println(\"ChangeMe\") )\n+end\ndiff --git a/t/t4018/julia-mutable-struct b/t/t4018/julia-mutable-struct\nnew file mode 100644\nindex 0000000000..db82017ba0\n--- /dev/null\n+++ b/t/t4018/julia-mutable-struct\n@@ -0,0 +1,5 @@\n+mutable struct RIGHT\n+    x\n+    y::Int\n+    ChangeMe\n+end\ndiff --git a/t/t4018/julia-struct b/t/t4018/julia-struct\nnew file mode 100644\nindex 0000000000..d3d2bda8cb\n--- /dev/null\n+++ b/t/t4018/julia-struct\n@@ -0,0 +1,5 @@\n+struct RIGHT\n+    x\n+    y::Int\n+    ChangeMe\n+end\ndiff --git a/userdiff.c b/userdiff.c\nindex efbe05e5a5..b5e938b1c2 100644\n--- a/userdiff.c\n+++ b/userdiff.c\n@@ -79,6 +79,21 @@ PATTERNS(\"java\",\n \t \"|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lL]?\"\n \t \"|[-+*/<>%&^|=!]=\"\n \t \"|--|\\\\+\\\\+|<<=?|>>>?=?|&&|\\\\|\\\\|\"),\n+PATTERNS(\"julia\",\n+\t \"^[ \\t]*(((mutable[ \\t]+)?struct|(@.+[ \\t])?function|macro)[ \\t].*)$\",\n+\t /* -- */\n+\t /* Binary literals */\n+\t \"[-+]?0b[01]+\"\n+\t /* Hexadecimal literals */\n+\t \"|[-+]?0x[0-9a-fA-F]+\"\n+\t /* Real and complex literals */\n+\t \"|[-+0-9.e_(im)]+\"\n+\t /* Should theoretically allow Unicode characters as part of\n+\t  * a word, such as U+2211. However, Julia reserves most of the\n+\t  * U+2200-U+22FF range (as well as others) as user-defined operators,\n+\t  * therefore they are not handled in this regex. */\n+\t \"|[a-zA-Z_][a-zA-Z0-9_!]*\"\n+\t \"|--|\\\\+\\\\+|<<=?|>>>=?|>>=?|\\\\\\\\\\\\\\\\=?|//=?|&&|\\\\|\\\\||::|->|[-+*/<>%^&|=!$]=?\"),\n PATTERNS(\"matlab\",\n \t /*\n \t  * Octave pattern is mostly the same as matlab, except that '%%%' and\n\nbase-commit: 042ed3e048af08014487d19196984347e3be7d1c\n-- \ngitgitgadget\n"},{"id":"389580","messageId":"nycvar.QRO.7.76.6.2001101449410.46@tvgsbejvaqbjf.bet","threadId":"52608","inReplyTo":"pull.521.git.1578625810098.gitgitgadget@gmail.com","subject":"Re: [PATCH] userdiff: add Julia to supported userdiff languages","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2020-01-10T13:51:28Z","receivedAt":"2020-01-10T13:51:33Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Fri, 10 Jan 2020, Ryan Zoeller via GitGitGadget wrote:\n\n> Add xfuncname and word_regex patterns for Julia[1],\n> which is a language used in numerical analysis and\n> computational science.\n>\n> The default behavior for xfuncname did not allow\n> functions to be indented, nor functions to have a\n> macro applied, such as @inline or @generated.\n>\n> [1]: https://julialang.org\n>\n> Signed-off-by: Ryan Zoeller <rtzoeller@rtzoeller.com>\n> ---\n>     userdiff: add Julia to supported userdiff languages\n>\n>     Add xfuncname and word_regex patterns for Julia1 [https://julialang.org]\n>     , which is a language used in numerical analysis and computational\n>     science.\n>\n>     The default behavior for xfuncname did not allow functions to be\n>     indented, nor functions to have a macro applied, such as @inline or\n>     @generated.\n>\n>     Signed-off-by: Ryan Zoeller rtzoeller@rtzoeller.com\n>     [rtzoeller@rtzoeller.com]\n\nSorry about that. In my recent work to fold in the cover letter into\nsingle-patch contributions, it was mentioned that this could come back to\nbite us: By default, GitHub uses the commit message of single-commit PRs\nas PR description, and if contributors do not change that, it essentially\nrepeats the commit message.\n\nSadly, I won't be able to justify working even more on GitGitGadget this\nweek (it took a sizable chunk out of my time budget and I have to make up\nfor that first).\n\nCiao,\nJohannes\n\n>\n> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-521%2Frtzoeller%2Fjulia_userdiff-v1\n> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-521/rtzoeller/julia_userdiff-v1\n> Pull-Request: https://github.com/gitgitgadget/git/pull/521\n>\n>  Documentation/gitattributes.txt |  2 ++\n>  t/t4018-diff-funcname.sh        |  1 +\n>  t/t4018/julia-function          |  5 +++++\n>  t/t4018/julia-indented-function |  8 ++++++++\n>  t/t4018/julia-inline-function   |  5 +++++\n>  t/t4018/julia-macro             |  5 +++++\n>  t/t4018/julia-mutable-struct    |  5 +++++\n>  t/t4018/julia-struct            |  5 +++++\n>  userdiff.c                      | 15 +++++++++++++++\n>  9 files changed, 51 insertions(+)\n>  create mode 100644 t/t4018/julia-function\n>  create mode 100644 t/t4018/julia-indented-function\n>  create mode 100644 t/t4018/julia-inline-function\n>  create mode 100644 t/t4018/julia-macro\n>  create mode 100644 t/t4018/julia-mutable-struct\n>  create mode 100644 t/t4018/julia-struct\n>\n> diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt\n> index 508fe713c4..d39dc727e3 100644\n> --- a/Documentation/gitattributes.txt\n> +++ b/Documentation/gitattributes.txt\n> @@ -824,6 +824,8 @@ patterns are available:\n>\n>  - `java` suitable for source code in the Java language.\n>\n> +- `julia` suitable for source code in the Julia language.\n> +\n>  - `matlab` suitable for source code in the MATLAB and Octave languages.\n>\n>  - `objc` suitable for source code in the Objective-C language.\n> diff --git a/t/t4018-diff-funcname.sh b/t/t4018-diff-funcname.sh\n> index c0f4839543..d4613eb7d2 100755\n> --- a/t/t4018-diff-funcname.sh\n> +++ b/t/t4018-diff-funcname.sh\n> @@ -38,6 +38,7 @@ diffpatterns=\"\n>  \tgolang\n>  \thtml\n>  \tjava\n> +\tjulia\n>  \tmatlab\n>  \tobjc\n>  \tpascal\n> diff --git a/t/t4018/julia-function b/t/t4018/julia-function\n> new file mode 100644\n> index 0000000000..a2eab83c27\n> --- /dev/null\n> +++ b/t/t4018/julia-function\n> @@ -0,0 +1,5 @@\n> +function RIGHT()\n> +    # A comment\n> +    # Another comment\n> +    return ChangeMe\n> +end\n> diff --git a/t/t4018/julia-indented-function b/t/t4018/julia-indented-function\n> new file mode 100644\n> index 0000000000..2d48aabcdb\n> --- /dev/null\n> +++ b/t/t4018/julia-indented-function\n> @@ -0,0 +1,8 @@\n> +function outer_function()\n> +    function RIGHT()\n> +        for i = 1:10\n> +            print(i)\n> +        end\n> +        # ChangeMe\n> +    end\n> +end\n> diff --git a/t/t4018/julia-inline-function b/t/t4018/julia-inline-function\n> new file mode 100644\n> index 0000000000..5806f224fb\n> --- /dev/null\n> +++ b/t/t4018/julia-inline-function\n> @@ -0,0 +1,5 @@\n> +@inline function RIGHT()\n> +    # Prints Hello, then something else.\n> +    println(\"Hello\")\n> +    println(\"ChangeMe\")\n> +end\n> diff --git a/t/t4018/julia-macro b/t/t4018/julia-macro\n> new file mode 100644\n> index 0000000000..1d18bc2750\n> --- /dev/null\n> +++ b/t/t4018/julia-macro\n> @@ -0,0 +1,5 @@\n> +macro RIGHT()\n> +    # First comment\n> +    # Second comment\n> +    return :( println(\"ChangeMe\") )\n> +end\n> diff --git a/t/t4018/julia-mutable-struct b/t/t4018/julia-mutable-struct\n> new file mode 100644\n> index 0000000000..db82017ba0\n> --- /dev/null\n> +++ b/t/t4018/julia-mutable-struct\n> @@ -0,0 +1,5 @@\n> +mutable struct RIGHT\n> +    x\n> +    y::Int\n> +    ChangeMe\n> +end\n> diff --git a/t/t4018/julia-struct b/t/t4018/julia-struct\n> new file mode 100644\n> index 0000000000..d3d2bda8cb\n> --- /dev/null\n> +++ b/t/t4018/julia-struct\n> @@ -0,0 +1,5 @@\n> +struct RIGHT\n> +    x\n> +    y::Int\n> +    ChangeMe\n> +end\n> diff --git a/userdiff.c b/userdiff.c\n> index efbe05e5a5..b5e938b1c2 100644\n> --- a/userdiff.c\n> +++ b/userdiff.c\n> @@ -79,6 +79,21 @@ PATTERNS(\"java\",\n>  \t \"|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lL]?\"\n>  \t \"|[-+*/<>%&^|=!]=\"\n>  \t \"|--|\\\\+\\\\+|<<=?|>>>?=?|&&|\\\\|\\\\|\"),\n> +PATTERNS(\"julia\",\n> +\t \"^[ \\t]*(((mutable[ \\t]+)?struct|(@.+[ \\t])?function|macro)[ \\t].*)$\",\n> +\t /* -- */\n> +\t /* Binary literals */\n> +\t \"[-+]?0b[01]+\"\n> +\t /* Hexadecimal literals */\n> +\t \"|[-+]?0x[0-9a-fA-F]+\"\n> +\t /* Real and complex literals */\n> +\t \"|[-+0-9.e_(im)]+\"\n> +\t /* Should theoretically allow Unicode characters as part of\n> +\t  * a word, such as U+2211. However, Julia reserves most of the\n> +\t  * U+2200-U+22FF range (as well as others) as user-defined operators,\n> +\t  * therefore they are not handled in this regex. */\n> +\t \"|[a-zA-Z_][a-zA-Z0-9_!]*\"\n> +\t \"|--|\\\\+\\\\+|<<=?|>>>=?|>>=?|\\\\\\\\\\\\\\\\=?|//=?|&&|\\\\|\\\\||::|->|[-+*/<>%^&|=!$]=?\"),\n>  PATTERNS(\"matlab\",\n>  \t /*\n>  \t  * Octave pattern is mostly the same as matlab, except that '%%%' and\n>\n> base-commit: 042ed3e048af08014487d19196984347e3be7d1c\n> --\n> gitgitgadget\n>\n"},{"id":"389588","messageId":"49decf8e-87a9-120f-4c2b-cafc5aa1d466@kdbg.org","threadId":"52608","inReplyTo":"pull.521.git.1578625810098.gitgitgadget@gmail.com","subject":"Re: [PATCH] userdiff: add Julia to supported userdiff languages","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2020-01-10T17:43:42Z","receivedAt":"2020-01-10T17:43:47Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 10.01.20 um 04:10 schrieb Ryan Zoeller via GitGitGadget:\n> Add xfuncname and word_regex patterns for Julia[1],\n> which is a language used in numerical analysis and\n> computational science.\n> \n> The default behavior for xfuncname did not allow\n> functions to be indented, nor functions to have a\n> macro applied, such as @inline or @generated.\n> \n> [1]: https://julialang.org\n> \n> Signed-off-by: Ryan Zoeller <rtzoeller@rtzoeller.com>\n> ---\n> \n> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-521%2Frtzoeller%2Fjulia_userdiff-v1\n> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-521/rtzoeller/julia_userdiff-v1\n> Pull-Request: https://github.com/gitgitgadget/git/pull/521\n> \n>  Documentation/gitattributes.txt |  2 ++\n>  t/t4018-diff-funcname.sh        |  1 +\n>  t/t4018/julia-function          |  5 +++++\n>  t/t4018/julia-indented-function |  8 ++++++++\n>  t/t4018/julia-inline-function   |  5 +++++\n>  t/t4018/julia-macro             |  5 +++++\n>  t/t4018/julia-mutable-struct    |  5 +++++\n>  t/t4018/julia-struct            |  5 +++++\n>  userdiff.c                      | 15 +++++++++++++++\n>  9 files changed, 51 insertions(+)\n>  create mode 100644 t/t4018/julia-function\n>  create mode 100644 t/t4018/julia-indented-function\n>  create mode 100644 t/t4018/julia-inline-function\n>  create mode 100644 t/t4018/julia-macro\n>  create mode 100644 t/t4018/julia-mutable-struct\n>  create mode 100644 t/t4018/julia-struct\n\nThe tests all look good.\n\n> diff --git a/userdiff.c b/userdiff.c\n> index efbe05e5a5..b5e938b1c2 100644\n> --- a/userdiff.c\n> +++ b/userdiff.c\n> @@ -79,6 +79,21 @@ PATTERNS(\"java\",\n>  \t \"|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lL]?\"\n>  \t \"|[-+*/<>%&^|=!]=\"\n>  \t \"|--|\\\\+\\\\+|<<=?|>>>?=?|&&|\\\\|\\\\|\"),\n> +PATTERNS(\"julia\",\n> +\t \"^[ \\t]*(((mutable[ \\t]+)?struct|(@.+[ \\t])?function|macro)[ \\t].*)$\",\n\nLooks good to me.\n\n> +\t /* -- */\n> +\t /* Binary literals */\n> +\t \"[-+]?0b[01]+\"\n> +\t /* Hexadecimal literals */\n> +\t \"|[-+]?0x[0-9a-fA-F]+\"\n\nThese two could be merged into\n\n\t/* Binary and hexadecimal literals */\n\t\"|0[bx][0-9a-fA-F]+\"\n\nNote that I did not insert [-+]? at the front. Even though most if not\nall patterns allow a sign, they are usually wrong to do so, because they\nmisclassify a change from 'a+1' to 'a+2' as 'a[-+1-]{++2+}' instead of\nthe correct 'a+[-1-]{+2+}'.\n\n> +\t /* Real and complex literals */\n> +\t \"|[-+0-9.e_(im)]+\"\n\nI am curious: is '(1+2i)' a single literal -- including the parentheses?\nThe expression would also mistake the character sequence '-1)+(2+' as a\nsingle word; is it intended?\n\n> +\t /* Should theoretically allow Unicode characters as part of\n> +\t  * a word, such as U+2211. However, Julia reserves most of the\n> +\t  * U+2200-U+22FF range (as well as others) as user-defined operators,\n> +\t  * therefore they are not handled in this regex. */\n> +\t \"|[a-zA-Z_][a-zA-Z0-9_!]*\"\n> +\t \"|--|\\\\+\\\\+|<<=?|>>>=?|>>=?|\\\\\\\\\\\\\\\\=?|//=?|&&|\\\\|\\\\||::|->|[-+*/<>%^&|=!$]=?\"),\n\nThe last sub-expression permits single-character operators in addition\nto their forms with a '=' appended (computing assignment, I presume).\nYou could remove the trailing ? because single non-whitespace characters\nare always a word of their own, even if they are not caught by the word\nregexp.\n\n>  PATTERNS(\"matlab\",\n>  \t /*\n>  \t  * Octave pattern is mostly the same as matlab, except that '%%%' and\n> \n> base-commit: 042ed3e048af08014487d19196984347e3be7d1c\n> \n\n-- Hannes\n"},{"id":"389589","messageId":"YqXJB_En1hjDpzUmawtrEYBztOGh_1uSmwxsQyQ646RtwGnYppq-xg26rwM0x5pu6E8PMVq22HwfSSFXN9aaD9BowSUH1YfztHRUomhOe6E=@rtzoeller.com","threadId":"52608","inReplyTo":"49decf8e-87a9-120f-4c2b-cafc5aa1d466@kdbg.org","subject":"Re: [PATCH] userdiff: add Julia to supported userdiff languages","fromName":"Ryan Zoeller","fromEmail":"rtzoeller@rtzoeller.com","sentAt":"2020-01-10T18:15:32Z","receivedAt":"2020-01-10T18:15:39Z","isPatch":true,"sender":{"key":"rtzoeller@rtzoeller.com","avatar":"https://avatars.githubusercontent.com/u/573497?v=4"},"body":"On Friday, January 10, 2020 11:43 AM, Johannes Sixt <j6t@kdbg.org> wrote:\n\n> Am 10.01.20 um 04:10 schrieb Ryan Zoeller via GitGitGadget:\n>\n> > Add xfuncname and word_regex patterns for Julia1,\n> > which is a language used in numerical analysis and\n> > computational science.\n> > The default behavior for xfuncname did not allow\n> > functions to be indented, nor functions to have a\n> > macro applied, such as @inline or @generated.\n> >\n> > Signed-off-by: Ryan Zoeller rtzoeller@rtzoeller.com\n> >\n> > ----------------------------------------------------\n> >\n> > Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-521%2Frtzoeller%2Fjulia_userdiff-v1\n> > Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-521/rtzoeller/julia_userdiff-v1\n> > Pull-Request: https://github.com/gitgitgadget/git/pull/521\n> > Documentation/gitattributes.txt | 2 ++\n> > t/t4018-diff-funcname.sh | 1 +\n> > t/t4018/julia-function | 5 +++++\n> > t/t4018/julia-indented-function | 8 ++++++++\n> > t/t4018/julia-inline-function | 5 +++++\n> > t/t4018/julia-macro | 5 +++++\n> > t/t4018/julia-mutable-struct | 5 +++++\n> > t/t4018/julia-struct | 5 +++++\n> > userdiff.c | 15 +++++++++++++++\n> > 9 files changed, 51 insertions(+)\n> > create mode 100644 t/t4018/julia-function\n> > create mode 100644 t/t4018/julia-indented-function\n> > create mode 100644 t/t4018/julia-inline-function\n> > create mode 100644 t/t4018/julia-macro\n> > create mode 100644 t/t4018/julia-mutable-struct\n> > create mode 100644 t/t4018/julia-struct\n>\n> The tests all look good.\n>\n> > diff --git a/userdiff.c b/userdiff.c\n> > index efbe05e5a5..b5e938b1c2 100644\n> > --- a/userdiff.c\n> > +++ b/userdiff.c\n> > @@ -79,6 +79,21 @@ PATTERNS(\"java\",\n> > \"|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lL]?\"\n> > \"|[-+*/<>%&^|=!]=\"\n> > \"|--|\\\\+\\\\+|<<=?|>>>?=?|&&|\\\\|\\\\|\"),\n> > +PATTERNS(\"julia\",\n> >\n> > -   \"^[ \\t](((mutable[ \\t]+)?struct|(@.+[ \\t])?function|macro)[ \\t].)$\",\n>\n> Looks good to me.\n>\n> > -   /* -- */\n> > -   /* Binary literals */\n> > -   \"[-+]?0b[01]+\"\n> > -   /* Hexadecimal literals */\n> > -   \"|[-+]?0x[0-9a-fA-F]+\"\n>\n> These two could be merged into\n>\n> /* Binary and hexadecimal literals */\n> \"|0[bx][0-9a-fA-F]+\"\n\nI was trying to avoid `0b` being followed by hex characters from being recognized, e.g. 0bFF. This is admittedly not really a concern, so I'm fine making this change to simplify the regular expression.\n\n>\n> Note that I did not insert [-+]? at the front. Even though most if not\n> all patterns allow a sign, they are usually wrong to do so, because they\n> misclassify a change from 'a+1' to 'a+2' as 'a[-+1-]{++2+}' instead of\n> the correct 'a+[-1-]{+2+}'.\n\nI'm fine dropping the leading `[-+]?`.\n\n>\n> > -   /* Real and complex literals */\n> > -   \"|[-+0-9.e_(im)]+\"\n>\n> I am curious: is '(1+2i)' a single literal -- including the parentheses?\n> The expression would also mistake the character sequence '-1)+(2+' as a\n> single word; is it intended?\n\nThis part of the regular expression has a pretty major mistake due to me misunderstanding how the parentheses were being interpreted. It should be something along the lines of `([-+0-9.e_]|im)+`.\n\nJulia uses `im` as the designation for an imaginary value; this regex was intended to admit e.g. 1+2im, in addition other numeric values such as 1_000_000 and 1e10.\n\n>\n> > -   /* Should theoretically allow Unicode characters as part of\n> > -   -   a word, such as U+2211. However, Julia reserves most of the\n> > -   -   U+2200-U+22FF range (as well as others) as user-defined operators,\n> > -   -   therefore they are not handled in this regex. */\n> > -   \"|[a-zA-Z_][a-zA-Z0-9_!]*\"\n> > -   \"|--|\\\\+\\\\+|<<=?|>>>=?|>>=?|\\\\\\\\\\\\\\\\=?|//=?|&&|\\\\|\\\\||::|->|[-+*/<>%^&|=!$]=?\"),\n>\n> The last sub-expression permits single-character operators in addition\n> to their forms with a '=' appended (computing assignment, I presume).\n> You could remove the trailing ? because single non-whitespace characters\n> are always a word of their own, even if they are not caught by the word\n> regexp.\n\nAgreed, I'll drop the trailing ?.\n\n>\n> > PATTERNS(\"matlab\",\n> > /*\n> > * Octave pattern is mostly the same as matlab, except that '%%%' and\n> > base-commit: 042ed3e048af08014487d19196984347e3be7d1c\n>\n> -- Hannes\n\nThanks for the feedback,\nRyan Zoeller\n\n"},{"id":"389595","messageId":"cf486cb7-0ea5-92e8-1454-5059ea009ddf@kdbg.org","threadId":"52608","inReplyTo":"YqXJB_En1hjDpzUmawtrEYBztOGh_1uSmwxsQyQ646RtwGnYppq-xg26rwM0x5pu6E8PMVq22HwfSSFXN9aaD9BowSUH1YfztHRUomhOe6E=@rtzoeller.com","subject":"Re: [PATCH] userdiff: add Julia to supported userdiff languages","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2020-01-10T20:14:36Z","receivedAt":"2020-01-10T20:14:40Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 10.01.20 um 19:15 schrieb Ryan Zoeller:\n> On Friday, January 10, 2020 11:43 AM, Johannes Sixt <j6t@kdbg.org> wrote:\n>> Am 10.01.20 um 04:10 schrieb Ryan Zoeller via GitGitGadget:\n>>> -   /* Real and complex literals */\n>>> -   \"|[-+0-9.e_(im)]+\"\n>>\n>> I am curious: is '(1+2i)' a single literal -- including the parentheses?\n>> The expression would also mistake the character sequence '-1)+(2+' as a\n>> single word; is it intended?\n> \n> This part of the regular expression has a pretty major mistake due\n> to me misunderstanding how the parentheses were being interpreted.\n> It should be something along the lines of `([-+0-9.e_]|im)+`.\n> \n> Julia uses `im` as the designation for an imaginary value; this regex\n> was intended to admit e.g. 1+2im, in addition other numeric values\n> such as 1_000_000 and 1e10.\nI see. I suggest to treat 1+2im as three words '1', '+', and '2im', and\nto model numbers in this way:\n\n\t|[0-9][0-9_.]*(e[-+]?[0-9_]*)?(im)?\n\nIn particular, require a digit at the begin, and do not allow '-' and\n'+' an arbitrary number of times, because it would catch 1+2+3+4 as a\nsingle word.\n\n-- Hannes\n"}]}