Variable: cperl--ws-rx
cperl--ws-rx is a variable defined in cperl-mode.el.gz.
Value
(sequence
(or space "\n"))
Documentation
Regular expression for a single whitespace in Perl.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/cperl-mode.el.gz
;;; Perl Grammar Components
;;
;; The following regular expressions are building blocks for a
;; minimalistic Perl grammar, to be used instead of individual (and
;; not always consistent) literal regular expressions.
;; This is necessary to compile this file under Emacs 26.1
;; (there's no rx-define which would help)
(eval-and-compile
(defconst cperl--basic-identifier-rx
'(sequence (or alpha "_") (* (or word "_")))
"A regular expression for the name of a \"basic\" Perl variable.
Neither namespace separators nor sigils are included. As is,
this regular expression applies to labels,subroutine calls where
the ampersand sigil is not required, and names of subroutine
attributes.")
(defconst cperl--label-rx
`(sequence symbol-start
,cperl--basic-identifier-rx
(0+ space)
":")
"A regular expression for a Perl label.
By convention, labels are uppercase alphabetics, but this isn't
enforced.")
(defconst cperl--false-label-rx
'(sequence (or (in "sym") "tr") (0+ space) ":")
"A regular expression which is similar to a label, but might as
well be a quote-like operator with a colon as delimiter.")
(defconst cperl--normal-identifier-rx
`(or (sequence (1+ (sequence
(opt ,cperl--basic-identifier-rx)
"::"))
(opt ,cperl--basic-identifier-rx))
,cperl--basic-identifier-rx)
"A regular expression for a Perl variable name with optional namespace.
Examples are `foo`, `Some::Module::VERSION`, and `::` (yes, that
is a legal variable name).")
(defconst cperl--special-identifier-rx
'(or
(1+ digit) ; $0, $1, $2, ...
(sequence "^" (any "A-Z" "]^_?\\")) ; $^V
(sequence "{" (0+ space) ; ${^MATCH}
"^" (any "A-Z" "]^_?\\")
(0+ (any "A-Z" "_" digit))
(0+ space) "}")
(in "!\"$%&'()+,-./:;<=>?@\\]^_`|~")) ; $., $|, $", ... but not $^ or ${
"The list of Perl \"punctuation\" variables, as listed in perlvar.")
(defconst cperl--ws-rx
'(sequence (or space "\n"))
"Regular expression for a single whitespace in Perl.")
(defconst cperl--eol-comment-rx
'(sequence "#" (0+ (not (in "\n"))) "\n")
"Regular expression for a single end-of-line comment in Perl")
(defconst cperl--ws-or-comment-rx
`(or ,cperl--ws-rx
,cperl--eol-comment-rx)
"A regular expression for either whitespace or comment")
(defconst cperl--ws*-rx
`(0+ ,cperl--ws-or-comment-rx)
"Regular expression for optional whitespaces or comments in Perl")
(defconst cperl--ws+-rx
`(1+ ,cperl--ws-or-comment-rx)
"Regular expression for a sequence of whitespace and comments in Perl.")
;; This is left as a string regexp. There are many version schemes in
;; the wild, so people might want to fiddle with this variable.
(defconst cperl--version-regexp
(rx-to-string
`(or
(sequence (optional "v")
(>= 2 (sequence (1+ digit) "."))
(1+ digit)
(optional (sequence "_" (1+ word))))
(sequence (1+ digit)
(optional (sequence "." (1+ digit)))
(optional (sequence "_" (1+ word))))))
"A sequence for recommended version number schemes in Perl.")
(defconst cperl--package-rx
`(sequence (group "package")
,cperl--ws+-rx
(group ,cperl--normal-identifier-rx)
(optional (sequence ,cperl--ws+-rx
(group (regexp ,cperl--version-regexp)))))
"A regular expression for package NAME VERSION in Perl.
Contains three groups for the keyword \"package\", for the
package name and for the version.")
(defconst cperl--package-for-imenu-rx
`(sequence symbol-start
(group-n 1 "package")
,cperl--ws*-rx
(group-n 2 ,cperl--normal-identifier-rx)
(optional (sequence ,cperl--ws+-rx
(regexp ,cperl--version-regexp)))
,cperl--ws*-rx
(group-n 3 (or ";" "{")))
"A regular expression to collect package names for `imenu'.
Catches \"package NAME;\", \"package NAME VERSION;\", \"package
NAME BLOCK\" and \"package NAME VERSION BLOCK.\" Contains three
groups: One for the keyword \"package\", one for the package
name, and one for the discovery of a following BLOCK.")
(defconst cperl--sub-name-for-imenu-rx
`(sequence symbol-start
(optional (sequence (group-n 3 (or "my" "state" "our"))
,cperl--ws+-rx))
(group-n 1 "sub")
,cperl--ws+-rx
(group-n 2 ,cperl--normal-identifier-rx))
"A regular expression to detect a subroutine start.
Contains three groups: One to distinguish lexical from
\"normal\" subroutines, for the keyword \"sub\", and one for the
subroutine name.")
(defconst cperl--block-declaration-rx
`(sequence
(or "package" "sub") ; "class" and "method" coming soon
(1+ ,cperl--ws-or-comment-rx)
,cperl--normal-identifier-rx)
"A regular expression to find a declaration for a named block.
Used for indentation. These declarations introduce a block which
does not need a semicolon to terminate the statement.")
(defconst cperl--pod-heading-rx
`(sequence line-start
(group-n 1 "=head")
(group-n 3 (in "1-4"))
(1+ (in " \t"))
(group-n 2 (1+ (not (in "\n")))))
"A regular expression to detect a POD heading.
Contains two groups: One for the heading level, and one for the
heading text.")
(defconst cperl--imenu-entries-rx
`(or ,cperl--package-for-imenu-rx
,cperl--sub-name-for-imenu-rx
,cperl--pod-heading-rx)
"A regular expression to collect stuff that goes into the `imenu' index.
Covers packages, subroutines, and POD headings.")
;; end of eval-and-compiled stuff
)