Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/t/t4034
diff options
context:
space:
mode:
authorAtharva Raykar <raykar.ath@gmail.com>2021-04-08 12:14:43 +0300
committerJunio C Hamano <gitster@pobox.com>2021-04-08 23:56:09 +0300
commita43739031092f951674d783ad3bdcbd603281851 (patch)
tree0ab0829481074a1151ec93cffe536c266699d4a1 /t/t4034
parent84d06cdc06389ae7c462434cb7b1db0980f63860 (diff)
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>
Diffstat (limited to 't/t4034')
-rw-r--r--t/t4034/scheme/expect11
-rw-r--r--t/t4034/scheme/post6
-rw-r--r--t/t4034/scheme/pre6
3 files changed, 23 insertions, 0 deletions
diff --git a/t/t4034/scheme/expect b/t/t4034/scheme/expect
new file mode 100644
index 0000000000..496cd5de8c
--- /dev/null
+++ b/t/t4034/scheme/expect
@@ -0,0 +1,11 @@
+<BOLD>diff --git a/pre b/post<RESET>
+<BOLD>index 74b6605..63b6ac4 100644<RESET>
+<BOLD>--- a/pre<RESET>
+<BOLD>+++ b/post<RESET>
+<CYAN>@@ -1,6 +1,6 @@<RESET>
+(define (<RED>myfunc a b<RESET><GREEN>my-func first second<RESET>)
+ ; This is a <RED>really<RESET><GREEN>(moderately)<RESET> cool function.
+ (<RED>this\place<RESET><GREEN>that\place<RESET> (+ 3 4))
+ (define <RED>some-text<RESET><GREEN>|a greeting|<RESET> "hello")
+ (let ((c (<RED>+ a b<RESET><GREEN>add1 first<RESET>)))
+ (format "one more than the total is %d" (<RED>add1<RESET><GREEN>+<RESET> c <GREEN>second<RESET>))))
diff --git a/t/t4034/scheme/post b/t/t4034/scheme/post
new file mode 100644
index 0000000000..63b6ac4f87
--- /dev/null
+++ b/t/t4034/scheme/post
@@ -0,0 +1,6 @@
+(define (my-func first second)
+ ; This is a (moderately) cool function.
+ (that\place (+ 3 4))
+ (define |a greeting| "hello")
+ (let ((c (add1 first)))
+ (format "one more than the total is %d" (+ c second))))
diff --git a/t/t4034/scheme/pre b/t/t4034/scheme/pre
new file mode 100644
index 0000000000..74b6605357
--- /dev/null
+++ b/t/t4034/scheme/pre
@@ -0,0 +1,6 @@
+(define (myfunc a b)
+ ; This is a really cool function.
+ (this\place (+ 3 4))
+ (define some-text "hello")
+ (let ((c (+ a b)))
+ (format "one more than the total is %d" (add1 c))))