Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Documentation/gitattributes.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -912,6 +912,7 @@ patterns are available:
- `rust` suitable for source code in the Rust language.

- `scheme` suitable for source code in the Scheme language.
Also handles Emacs Lisp, Common Lisp, and other dialects.

- `tex` suitable for source code for LaTeX documents.

Expand Down
4 changes: 4 additions & 0 deletions t/t4018/scheme-lisp-defun-a
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
(defun some-func (x y z) RIGHT
(let ((a x)
(b y))
(ChangeMe a b)))
4 changes: 4 additions & 0 deletions t/t4018/scheme-lisp-defun-b
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
(macrolet ((foo (x) `(bar ,x)))
(defun mumble (x) ; RIGHT
(when (> x 0)
(foo x)))) ; ChangeMe
4 changes: 4 additions & 0 deletions t/t4018/scheme-lisp-eval-when
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
(eval-when (:compile-toplevel :load-toplevel :execute) ; RIGHT
(set-macro-character #\?
(lambda (stream char)
`(make-pattern-variable ,(read stream))))) ; ChangeMe
File renamed without changes.
6 changes: 6 additions & 0 deletions t/t4018/scheme-module-b
Original file line number Diff line number Diff line change
@@ -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)))
Comment on lines +4 to +6
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This behavior is unchanged; I just thought it deserved a test case.

22 changes: 16 additions & 6 deletions userdiff.c
Original file line number Diff line number Diff line change
Expand Up @@ -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".
*/
"^ {1,2}(\\([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 },
Expand Down
Loading