Merge branch 'sb/userdiff-lisp-family'
The userdiff driver for the Scheme language has been extended to cover other Lisp dialects. * sb/userdiff-lisp-family: userdiff: extend Scheme support to cover other Lisp dialects userdiff: tighten word-diff test case of the scheme drivermain
commit
9b761be03c
|
|
@ -911,7 +911,8 @@ patterns are available:
|
|||
|
||||
- `rust` suitable for source code in the Rust language.
|
||||
|
||||
- `scheme` suitable for source code in the Scheme language.
|
||||
- `scheme` suitable for source code in most Lisp dialects,
|
||||
including Scheme, Emacs Lisp, Common Lisp, and Clojure.
|
||||
|
||||
- `tex` suitable for source code for LaTeX documents.
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
(defun some-func (x y z) RIGHT
|
||||
(let ((a x)
|
||||
(b y))
|
||||
(ChangeMe a b)))
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
(macrolet ((foo (x) `(bar ,x)))
|
||||
(defun mumble (x) ; RIGHT
|
||||
(when (> x 0)
|
||||
(foo x)))) ; ChangeMe
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
(eval-when (:compile-toplevel :load-toplevel :execute) ; RIGHT
|
||||
(set-macro-character #\?
|
||||
(lambda (stream char)
|
||||
`(make-pattern-variable ,(read stream))))) ; ChangeMe
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
(module A
|
||||
(export with-display-exception)
|
||||
(extern (display-exception display-exception))
|
||||
(def (with-display-exception thunk) RIGHT
|
||||
(with-catch (lambda (e) (display-exception e (current-error-port)) e)
|
||||
thunk ChangeMe)))
|
||||
|
|
@ -2,10 +2,11 @@
|
|||
<BOLD>index 74b6605..63b6ac4 100644<RESET>
|
||||
<BOLD>--- a/pre<RESET>
|
||||
<BOLD>+++ b/post<RESET>
|
||||
<CYAN>@@ -1,6 +1,6 @@<RESET>
|
||||
<CYAN>@@ -1,7 +1,7 @@<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")
|
||||
(define <RED>|the \| \greeting|<RESET><GREEN>|a \greeting|<RESET> |hello there|)
|
||||
({<RED>}<RESET>(([<RED>]<RESET>(func-n)<RED>[<RESET>]))<RED>{<RESET>})
|
||||
(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>))))
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
(define (my-func first second)
|
||||
; This is a (moderately) cool function.
|
||||
(that\place (+ 3 4))
|
||||
(define |a greeting| "hello")
|
||||
(define |a \greeting| |hello there|)
|
||||
({(([(func-n)]))})
|
||||
(let ((c (add1 first)))
|
||||
(format "one more than the total is %d" (+ c second))))
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
(define (myfunc a b)
|
||||
; This is a really cool function.
|
||||
(this\place (+ 3 4))
|
||||
(define some-text "hello")
|
||||
(define |the \| \greeting| |hello there|)
|
||||
({}(([](func-n)[])){})
|
||||
(let ((c (+ a b)))
|
||||
(format "one more than the total is %d" (add1 c))))
|
||||
|
|
|
|||
22
userdiff.c
22
userdiff.c
|
|
@ -344,14 +344,24 @@ PATTERNS("rust",
|
|||
"|[0-9][0-9_a-fA-Fiosuxz]*(\\.([0-9]*[eE][+-]?)?[0-9_fF]*)?"
|
||||
"|[-+*\\/<>%&^|=!:]=|<<=?|>>=?|&&|\\|\\||->|=>|\\.{2}=|\\.{3}|::"),
|
||||
PATTERNS("scheme",
|
||||
"^[\t ]*(\\(((define|def(struct|syntax|class|method|rules|record|proto|alias)?)[-*/ \t]|(library|module|struct|class)[*+ \t]).*)$",
|
||||
/*
|
||||
* R7RS valid identifiers include any sequence enclosed
|
||||
* within vertical lines having no backslashes
|
||||
* An unindented opening parenthesis identifies a top-level
|
||||
* expression in all Lisp dialects.
|
||||
*/
|
||||
"\\|([^\\\\]*)\\|"
|
||||
/* All other words should be delimited by spaces or parentheses */
|
||||
"|([^][)(}{[ \t])+"),
|
||||
"^(\\(.*)$\n"
|
||||
/* For Scheme: a possibly indented left paren followed by a keyword. */
|
||||
"^[\t ]*(\\(((define|def(struct|syntax|class|method|rules|record|proto|alias)?)[-*/ \t]|(library|module|struct|class)[*+ \t]).*)$\n"
|
||||
/*
|
||||
* For all Lisp dialects: a slightly indented line starting with "(def".
|
||||
*/
|
||||
"^ ?(\\([Dd][Ee][Ff].*)$",
|
||||
/*
|
||||
* The union of R7RS and Common Lisp symbol syntax: allows arbitrary
|
||||
* strings between vertical bars, including any escaped characters.
|
||||
*/
|
||||
"\\|([^|\\\\]|\\\\.)*\\|"
|
||||
/* All other words should be delimited by spaces or parentheses. */
|
||||
"|([^][)(}{ \t])+"),
|
||||
PATTERNS("tex", "^(\\\\((sub)*section|chapter|part)\\*{0,1}\\{.*)$",
|
||||
"\\\\[a-zA-Z@]+|\\\\.|([a-zA-Z0-9]|[^\x01-\x7f])+"),
|
||||
{ .name = "default", .binary = -1 },
|
||||
|
|
|
|||
Loading…
Reference in New Issue