Skip to content

Commit 86315aa

Browse files
committed
merge with Scheme regexp; fix bugs
This commit merges (by disjoining) the new generic Lisp regexp into the existing Scheme regexp. It also fixes two bugs: the new regexp was unintentionally allowing tabs, and the matching of "(def" should be case-insensitive. Signed-off-by: Scott L. Burson <[email protected]>
1 parent da99bb0 commit 86315aa

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

userdiff.c

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -249,14 +249,6 @@ PATTERNS("kotlin",
249249
"|[.][0-9][0-9_]*([Ee][-+]?[0-9]+)?[fFlLuU]?"
250250
/* unary and binary operators */
251251
"|[-+*/<>%&^|=!]==?|--|\\+\\+|<<=|>>=|&&|\\|\\||->|\\.\\*|!!|[?:.][.:]"),
252-
PATTERNS("lisp",
253-
/* Either an unindented left paren, or a slightly indented line
254-
* starting with "(def" */
255-
"^((\\(|:space:{1,2}\\(def).*)$",
256-
/* Common Lisp symbol syntax allows arbitrary strings between vertical bars */
257-
"\\|([^\\\\]|\\\\\\\\|\\\\\\|)*\\|"
258-
/* All other words are delimited by spaces or parentheses/brackets/braces */
259-
"|([^][(){} \t])+"),
260252
PATTERNS("markdown",
261253
"^ {0,3}#{1,6}[ \t].*",
262254
/* -- */
@@ -352,14 +344,21 @@ PATTERNS("rust",
352344
"|[0-9][0-9_a-fA-Fiosuxz]*(\\.([0-9]*[eE][+-]?)?[0-9_fF]*)?"
353345
"|[-+*\\/<>%&^|=!:]=|<<=?|>>=?|&&|\\|\\||->|=>|\\.{2}=|\\.{3}|::"),
354346
PATTERNS("scheme",
355-
"^[\t ]*(\\(((define|def(struct|syntax|class|method|rules|record|proto|alias)?)[-*/ \t]|(library|module|struct|class)[*+ \t]).*)$",
347+
/* A possibly indented left paren followed by a Scheme keyword. */
348+
"^[\t ]*(\\(((define|def(struct|syntax|class|method|rules|record|proto|alias)?)[-*/ \t]|(library|module|struct|class)[*+ \t]).*)$\n"
349+
/*
350+
* For other Lisp dialects: either an unindented left paren, or a
351+
* slightly indented line starting with "(def".
352+
*/
353+
"^((\\(| {1,2}\\([Dd][Ee][Ff]).*)$",
356354
/*
357-
* R7RS valid identifiers include any sequence enclosed
358-
* within vertical lines having no backslashes
355+
* The union of R7RS and Common Lisp symbol syntax: allows arbitrary
356+
* strings between vertical bars, including escaped backslashes and
357+
* vertical bars.
359358
*/
360-
"\\|([^\\\\]*)\\|"
359+
"\\|([^\\\\]|\\\\\\\\|\\\\\\|)*\\|"
361360
/* All other words should be delimited by spaces or parentheses */
362-
"|([^][)(}{[ \t])+"),
361+
"|([^][)(}{ \t])+"),
363362
PATTERNS("tex", "^(\\\\((sub)*section|chapter|part)\\*{0,1}\\{.*)$",
364363
"\\\\[a-zA-Z@]+|\\\\.|([a-zA-Z0-9]|[^\x01-\x7f])+"),
365364
{ .name = "default", .binary = -1 },

0 commit comments

Comments
 (0)