Skip to content

Commit

Permalink
New rx implementation
Browse files Browse the repository at this point in the history
* lisp/emacs-lisp/rx.el:
* test/lisp/emacs-lisp/rx-tests.el:
* doc/lispref/searching.texi (Rx Constructs):
Rewrite rx for correctness, clarity, and performance.  The new
implementation retains full compatibility and has more comprehensive
tests.

* lisp/emacs-lisp/re-builder.el (reb-rx-font-lock-keywords):
Adapt to changes in internal variables in rx.el.
  • Loading branch information
mattiase authored and eggert committed Sep 25, 2019
1 parent a773a64 commit 2ed7122
Show file tree
Hide file tree
Showing 4 changed files with 1,091 additions and 1,067 deletions.
4 changes: 1 addition & 3 deletions doc/lispref/searching.texi
Original file line number Diff line number Diff line change
Expand Up @@ -1044,11 +1044,9 @@ customisation.

The various forms in @code{rx} regexps are described below. The
shorthand @var{rx} represents any @code{rx} form, and @var{rx}@dots{}
means one or more @code{rx} forms. Where the corresponding string
means zero or more @code{rx} forms. Where the corresponding string
regexp syntax is given, @var{A}, @var{B}, @dots{} are string regexp
subexpressions.
@c With the new implementation of rx, this can be changed from
@c 'one or more' to 'zero or more'.

@subsubheading Literals

Expand Down
9 changes: 4 additions & 5 deletions lisp/emacs-lisp/re-builder.el
Original file line number Diff line number Diff line change
Expand Up @@ -816,13 +816,12 @@ If SUBEXP is non-nil mark only the corresponding sub-expressions."

(require 'rx)
(defconst reb-rx-font-lock-keywords
(let ((constituents (mapcar (lambda (rec)
(symbol-name (car rec)))
rx-constituents))
(syntax (mapcar (lambda (rec) (symbol-name (car rec))) rx-syntax))
(let ((constituents (mapcar #'symbol-name rx--builtin-forms))
(syntax (mapcar (lambda (rec) (symbol-name (car rec)))
rx--syntax-codes))
(categories (mapcar (lambda (rec)
(symbol-name (car rec)))
rx-categories)))
rx--categories)))
`(
(,(concat "(" (regexp-opt (list "rx-to-string") t) "[[:space:]]")
(1 font-lock-function-name-face))
Expand Down
Loading

0 comments on commit 2ed7122

Please sign in to comment.