Function: reb-change-syntax
reb-change-syntax is an interactive and byte-compiled function defined
in re-builder.el.gz.
Signature
(reb-change-syntax &optional SYNTAX)
Documentation
Change the syntax used by the RE Builder.
Interactively, prompt for SYNTAX.
Re-Builder currently understands three different forms of input, namely
read, string, and rx syntax:
1. The string syntax is the same one used by functions such as
query-replace-regexp (C-M-% (query-replace-regexp)). There is no need to escape
backslashes and double quotes.
2. The read syntax is the syntax used when specifying the
regexp as a string in a Lisp program.
3. Finally, the rx syntax allows editing of symbolic regular
expressions supported by the package of the same name.
When called from Lisp, SYNTAX must be specified.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/re-builder.el.gz
(defun reb-change-syntax (&optional syntax)
"Change the syntax used by the RE Builder.
Interactively, prompt for SYNTAX.
Re-Builder currently understands three different forms of input, namely
`read', `string', and `rx' syntax:
1. The `string' syntax is the same one used by functions such as
`query-replace-regexp' (\\[query-replace-regexp]). There is no need to escape
backslashes and double quotes.
2. The `read' syntax is the syntax used when specifying the
regexp as a string in a Lisp program.
3. Finally, the `rx' syntax allows editing of symbolic regular
expressions supported by the package of the same name.
When called from Lisp, SYNTAX must be specified."
(interactive
(list (intern
(completing-read
(format-prompt "Select syntax" reb-re-syntax)
'(read string rx)
nil t nil nil (symbol-name reb-re-syntax)
'reb-change-syntax-hist))))
(if (memq syntax '(read string rx))
(let ((buffer (get-buffer reb-buffer)))
(setq reb-re-syntax syntax)
(when buffer
(with-current-buffer buffer
(reb-initialize-buffer))
(message "Switched syntax to `%s'" reb-re-syntax)))
(error "Invalid syntax: %s" syntax)))