[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 3f4c92e: * sm-c-mode.el (sm-c--comment-regexp): Fix excess
From: |
Stefan Monnier |
Subject: |
[elpa] master 3f4c92e: * sm-c-mode.el (sm-c--comment-regexp): Fix excessive backtracking |
Date: |
Fri, 22 Jul 2016 13:08:02 +0000 (UTC) |
branch: master
commit 3f4c92e372035fd2d4b2e935ec87c063e7c053cb
Author: Stefan Monnier <address@hidden>
Commit: Stefan Monnier <address@hidden>
* sm-c-mode.el (sm-c--comment-regexp): Fix excessive backtracking
(sm-c-mode-syntax-table): Add + and -.
---
packages/sm-c-mode/sm-c-mode.el | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/packages/sm-c-mode/sm-c-mode.el b/packages/sm-c-mode/sm-c-mode.el
index 54b9a54..deaf952 100644
--- a/packages/sm-c-mode/sm-c-mode.el
+++ b/packages/sm-c-mode/sm-c-mode.el
@@ -1,6 +1,6 @@
;;; sm-c-mode.el --- Experimental C major mode based on SMIE -*-
lexical-binding: t; -*-
-;; Copyright (C) 2015 Free Software Foundation, Inc.
+;; Copyright (C) 2015, 2016 Free Software Foundation, Inc.
;; Author: Stefan Monnier <address@hidden>
;; Version: 0
@@ -266,6 +266,8 @@ E.g. a #define nested within 2 #ifs will be turned into \"#
define\"."
(modify-syntax-entry ?\" "\"" st)
(modify-syntax-entry ?\' "\"" st)
(modify-syntax-entry ?= "." st)
+ (modify-syntax-entry ?+ "." st)
+ (modify-syntax-entry ?- "." st)
(modify-syntax-entry ?< "." st)
(modify-syntax-entry ?> "." st)
st))
@@ -812,7 +814,7 @@ if INNER is non-nil, it stops at the innermost one."
;;; Font-lock support
(defconst sm-c--comment-regexp
- "/\\(?:/.*\n\\|\\*\\(?:[^*]+\\(?:\\*+[^/*]\\)*\\)*\\*/\\)")
+ "/\\(?:/.*\n\\|\\*[^*]*\\(?:\\*+[^/*][^*]*\\)*\\*+/\\)")
(defconst sm-c--defun-regexp
(let* ((spc0 (concat "\\(?:\n?[ \t]\\|" sm-c--comment-regexp "\\)*"))
@@ -825,9 +827,9 @@ if INNER is non-nil, it stops at the innermost one."
(1 "")))))
(concat
"^\\(?:"
- (repeat '* "\\*" spc0)
- (repeat '* id (repeat 1 spc1 "\\|" spc0 "\\*" spc0))
- "\\(" id "\\)[ \t\n]*("
+ (repeat '* "\\*" spc0) ;Pointer symbols.
+ (repeat '* id (repeat 1 spc1 "\\|" spc0 "\\*" spc0)) ;Type(s).
+ "\\(" id "\\)[ \t\n]*(" ;Function name.
"\\|"
"[ \t]*#[ \t]*define[ \t]+\\(?1:" id "\\)("
"\\)"))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] master 3f4c92e: * sm-c-mode.el (sm-c--comment-regexp): Fix excessive backtracking,
Stefan Monnier <=