git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Ryan Zoeller via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Ryan Zoeller <rtzoeller@rtzoeller.com>
Subject: Re: [PATCH] userdiff: add Julia to supported userdiff languages
Date: Fri, 10 Jan 2020 14:51:28 +0100 (CET)	[thread overview]
Message-ID: <nycvar.QRO.7.76.6.2001101449410.46@tvgsbejvaqbjf.bet> (raw)
In-Reply-To: <pull.521.git.1578625810098.gitgitgadget@gmail.com>

Hi,

On Fri, 10 Jan 2020, Ryan Zoeller via GitGitGadget wrote:

> Add xfuncname and word_regex patterns for Julia[1],
> which is a language used in numerical analysis and
> computational science.
>
> The default behavior for xfuncname did not allow
> functions to be indented, nor functions to have a
> macro applied, such as @inline or @generated.
>
> [1]: https://julialang.org
>
> Signed-off-by: Ryan Zoeller <rtzoeller@rtzoeller.com>
> ---
>     userdiff: add Julia to supported userdiff languages
>
>     Add xfuncname and word_regex patterns for Julia1 [https://julialang.org]
>     , which is a language used in numerical analysis and computational
>     science.
>
>     The default behavior for xfuncname did not allow functions to be
>     indented, nor functions to have a macro applied, such as @inline or
>     @generated.
>
>     Signed-off-by: Ryan Zoeller rtzoeller@rtzoeller.com
>     [rtzoeller@rtzoeller.com]

Sorry about that. In my recent work to fold in the cover letter into
single-patch contributions, it was mentioned that this could come back to
bite us: By default, GitHub uses the commit message of single-commit PRs
as PR description, and if contributors do not change that, it essentially
repeats the commit message.

Sadly, I won't be able to justify working even more on GitGitGadget this
week (it took a sizable chunk out of my time budget and I have to make up
for that first).

Ciao,
Johannes

>
> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-521%2Frtzoeller%2Fjulia_userdiff-v1
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-521/rtzoeller/julia_userdiff-v1
> Pull-Request: https://github.com/gitgitgadget/git/pull/521
>
>  Documentation/gitattributes.txt |  2 ++
>  t/t4018-diff-funcname.sh        |  1 +
>  t/t4018/julia-function          |  5 +++++
>  t/t4018/julia-indented-function |  8 ++++++++
>  t/t4018/julia-inline-function   |  5 +++++
>  t/t4018/julia-macro             |  5 +++++
>  t/t4018/julia-mutable-struct    |  5 +++++
>  t/t4018/julia-struct            |  5 +++++
>  userdiff.c                      | 15 +++++++++++++++
>  9 files changed, 51 insertions(+)
>  create mode 100644 t/t4018/julia-function
>  create mode 100644 t/t4018/julia-indented-function
>  create mode 100644 t/t4018/julia-inline-function
>  create mode 100644 t/t4018/julia-macro
>  create mode 100644 t/t4018/julia-mutable-struct
>  create mode 100644 t/t4018/julia-struct
>
> diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt
> index 508fe713c4..d39dc727e3 100644
> --- a/Documentation/gitattributes.txt
> +++ b/Documentation/gitattributes.txt
> @@ -824,6 +824,8 @@ patterns are available:
>
>  - `java` suitable for source code in the Java language.
>
> +- `julia` suitable for source code in the Julia language.
> +
>  - `matlab` suitable for source code in the MATLAB and Octave languages.
>
>  - `objc` suitable for source code in the Objective-C language.
> diff --git a/t/t4018-diff-funcname.sh b/t/t4018-diff-funcname.sh
> index c0f4839543..d4613eb7d2 100755
> --- a/t/t4018-diff-funcname.sh
> +++ b/t/t4018-diff-funcname.sh
> @@ -38,6 +38,7 @@ diffpatterns="
>  	golang
>  	html
>  	java
> +	julia
>  	matlab
>  	objc
>  	pascal
> diff --git a/t/t4018/julia-function b/t/t4018/julia-function
> new file mode 100644
> index 0000000000..a2eab83c27
> --- /dev/null
> +++ b/t/t4018/julia-function
> @@ -0,0 +1,5 @@
> +function RIGHT()
> +    # A comment
> +    # Another comment
> +    return ChangeMe
> +end
> diff --git a/t/t4018/julia-indented-function b/t/t4018/julia-indented-function
> new file mode 100644
> index 0000000000..2d48aabcdb
> --- /dev/null
> +++ b/t/t4018/julia-indented-function
> @@ -0,0 +1,8 @@
> +function outer_function()
> +    function RIGHT()
> +        for i = 1:10
> +            print(i)
> +        end
> +        # ChangeMe
> +    end
> +end
> diff --git a/t/t4018/julia-inline-function b/t/t4018/julia-inline-function
> new file mode 100644
> index 0000000000..5806f224fb
> --- /dev/null
> +++ b/t/t4018/julia-inline-function
> @@ -0,0 +1,5 @@
> +@inline function RIGHT()
> +    # Prints Hello, then something else.
> +    println("Hello")
> +    println("ChangeMe")
> +end
> diff --git a/t/t4018/julia-macro b/t/t4018/julia-macro
> new file mode 100644
> index 0000000000..1d18bc2750
> --- /dev/null
> +++ b/t/t4018/julia-macro
> @@ -0,0 +1,5 @@
> +macro RIGHT()
> +    # First comment
> +    # Second comment
> +    return :( println("ChangeMe") )
> +end
> diff --git a/t/t4018/julia-mutable-struct b/t/t4018/julia-mutable-struct
> new file mode 100644
> index 0000000000..db82017ba0
> --- /dev/null
> +++ b/t/t4018/julia-mutable-struct
> @@ -0,0 +1,5 @@
> +mutable struct RIGHT
> +    x
> +    y::Int
> +    ChangeMe
> +end
> diff --git a/t/t4018/julia-struct b/t/t4018/julia-struct
> new file mode 100644
> index 0000000000..d3d2bda8cb
> --- /dev/null
> +++ b/t/t4018/julia-struct
> @@ -0,0 +1,5 @@
> +struct RIGHT
> +    x
> +    y::Int
> +    ChangeMe
> +end
> diff --git a/userdiff.c b/userdiff.c
> index efbe05e5a5..b5e938b1c2 100644
> --- a/userdiff.c
> +++ b/userdiff.c
> @@ -79,6 +79,21 @@ PATTERNS("java",
>  	 "|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lL]?"
>  	 "|[-+*/<>%&^|=!]="
>  	 "|--|\\+\\+|<<=?|>>>?=?|&&|\\|\\|"),
> +PATTERNS("julia",
> +	 "^[ \t]*(((mutable[ \t]+)?struct|(@.+[ \t])?function|macro)[ \t].*)$",
> +	 /* -- */
> +	 /* Binary literals */
> +	 "[-+]?0b[01]+"
> +	 /* Hexadecimal literals */
> +	 "|[-+]?0x[0-9a-fA-F]+"
> +	 /* Real and complex literals */
> +	 "|[-+0-9.e_(im)]+"
> +	 /* Should theoretically allow Unicode characters as part of
> +	  * a word, such as U+2211. However, Julia reserves most of the
> +	  * U+2200-U+22FF range (as well as others) as user-defined operators,
> +	  * therefore they are not handled in this regex. */
> +	 "|[a-zA-Z_][a-zA-Z0-9_!]*"
> +	 "|--|\\+\\+|<<=?|>>>=?|>>=?|\\\\\\\\=?|//=?|&&|\\|\\||::|->|[-+*/<>%^&|=!$]=?"),
>  PATTERNS("matlab",
>  	 /*
>  	  * Octave pattern is mostly the same as matlab, except that '%%%' and
>
> base-commit: 042ed3e048af08014487d19196984347e3be7d1c
> --
> gitgitgadget
>

  reply	other threads:[~2020-01-10 13:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-10  3:10 [PATCH] userdiff: add Julia to supported userdiff languages Ryan Zoeller via GitGitGadget
2020-01-10 13:51 ` Johannes Schindelin [this message]
2020-01-10 17:43 ` Johannes Sixt
2020-01-10 18:15   ` Ryan Zoeller
2020-01-10 20:14     ` Johannes Sixt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=nycvar.QRO.7.76.6.2001101449410.46@tvgsbejvaqbjf.bet \
    --to=johannes.schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=rtzoeller@rtzoeller.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).