]> git.ipfire.org Git - thirdparty/git.git/commit - userdiff.c
userdiff: add support for Scheme
authorAtharva Raykar <raykar.ath@gmail.com>
Thu, 8 Apr 2021 09:14:43 +0000 (14:44 +0530)
committerJunio C Hamano <gitster@pobox.com>
Thu, 8 Apr 2021 20:56:09 +0000 (13:56 -0700)
commita43739031092f951674d783ad3bdcbd603281851
tree0ab0829481074a1151ec93cffe536c266699d4a1
parent84d06cdc06389ae7c462434cb7b1db0980f63860
userdiff: add support for Scheme

Add a diff driver for Scheme-like languages which recognizes top level
and local `define` forms, whether it is a function definition, binding,
syntax definition or a user-defined `define-xyzzy` form.

Also supports R6RS `library` forms, `module` forms along with class and
struct declarations used in Racket (PLT Scheme).

Alternate "def" syntax such as those in Gerbil Scheme are also
supported, like defstruct, defsyntax and so on.

The rationale for picking `define` forms for the hunk headers is because
it is usually the only significant form for defining the structure of
the program, and it is a common pattern for schemers to have local
function definitions to hide their visibility, so it is not only the top
level `define`'s that are of interest. Schemers also extend the language
with macros to provide their own define forms (for example, something
like a `define-test-suite`) which is also captured in the hunk header.

Since it is common practice to extend syntax with variants of a form
like `module+`, `class*` etc, those have been supported as well.

The word regex is a best-effort attempt to conform to R7RS[1] valid
identifiers, symbols and numbers.

[1] https://small.r7rs.org/attachment/r7rs.pdf (section 2.1)

Signed-off-by: Atharva Raykar <raykar.ath@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
18 files changed:
Documentation/gitattributes.txt
t/t4018-diff-funcname.sh
t/t4018/scheme-class [new file with mode: 0644]
t/t4018/scheme-def [new file with mode: 0644]
t/t4018/scheme-def-variant [new file with mode: 0644]
t/t4018/scheme-define-slash-public [new file with mode: 0644]
t/t4018/scheme-define-syntax [new file with mode: 0644]
t/t4018/scheme-define-variant [new file with mode: 0644]
t/t4018/scheme-library [new file with mode: 0644]
t/t4018/scheme-local-define [new file with mode: 0644]
t/t4018/scheme-module [new file with mode: 0644]
t/t4018/scheme-top-level-define [new file with mode: 0644]
t/t4018/scheme-user-defined-define [new file with mode: 0644]
t/t4034-diff-words.sh
t/t4034/scheme/expect [new file with mode: 0644]
t/t4034/scheme/post [new file with mode: 0644]
t/t4034/scheme/pre [new file with mode: 0644]
userdiff.c