pcre2el-1.12/ 0000755 0001750 0001750 00000000000 14473140155 012627 5 ustar dogsleg dogsleg pcre2el-1.12/.elpaignore 0000644 0001750 0001750 00000000024 14473140155 014751 0 ustar dogsleg dogsleg .travis.yml
COPYING
pcre2el-1.12/Makefile 0000644 0001750 0001750 00000001012 14473140155 014261 0 ustar dogsleg dogsleg ELPA_DEPENDENCIES=a.el
ELPA_ARCHIVES=melpa gnu
TEST_ERT_FILES="pcre2el-tests.el"
LINT_CHECKDOC_FILES=$(wildcard *.el)
LINT_PACKAGE_LINT_FILES=$(wildcard *.el)
LINT_COMPILE_FILES=$(wildcard *.el)
makel.mk:
# Download makel
@if [ -f ../makel/makel.mk ]; then \
ln -s ../makel/makel.mk .; \
else \
curl \
--fail --silent --show-error --insecure --location \
--retry 9 --retry-delay 9 \
-O https://gitlab.petton.fr/DamienCassou/makel/raw/v0.7.1/makel.mk; \
fi
# Include makel.mk if present
-include makel.mk
pcre2el-1.12/.travis.yml 0000644 0001750 0001750 00000001701 14473140155 014737 0 ustar dogsleg dogsleg language: emacs
env:
- "EMACS=emacs25 CHECK_TARGET=test"
- "EMACS=emacs25 CHECK_TARGET=test-interactive"
- "EMACS=emacs-snapshot CHECK_TARGET=test"
- "EMACS=emacs-snapshot CHECK_TARGET=test-interactive"
matrix:
allow_failures:
- env: "EMACS=emacs-snapshot CHECK_TARGET=test"
- env: "EMACS=emacs-snapshot CHECK_TARGET=test-interactive"
install:
- if [ "$EMACS" = "emacs25" ]; then
sudo add-apt-repository -y ppa:cassou/emacs &&
sudo apt-get -qq update &&
sudo apt-get -qq -f install &&
sudo apt-get -qq install emacs25-nox;
fi
- if [ "$EMACS" = 'emacs-snapshot' ]; then
sudo add-apt-repository -y ppa:ubuntu-elisp/ppa &&
sudo apt-get -qq update &&
sudo apt-get -qq -f install &&
sudo apt-get -qq install emacs-snapshot &&
sudo apt-get -qq install emacs-snapshot-el;
fi
script:
- make $CHECK_TARGET EMACS=$EMACS
notifications:
email: false
pcre2el-1.12/COPYING 0000644 0001750 0001750 00000104515 14473140155 013670 0 ustar dogsleg dogsleg GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Copyright (C)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
Copyright (C)
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
.
pcre2el-1.12/README.org 0000644 0001750 0001750 00000037452 14473140155 014310 0 ustar dogsleg dogsleg * pcre2el: convert between PCRE, Emacs and rx regexp syntax
** Overview
=pcre2el= or =rxt= (RegeXp Translator or RegeXp Tools) is a utility
for working with regular expressions in Emacs, based on a
recursive-descent parser for regexp syntax. In addition to
converting (a subset of) PCRE syntax into its Emacs equivalent, it
can do the following:
- convert Emacs syntax to PCRE
- convert either syntax to =rx=, an S-expression based regexp
syntax
- untangle complex regexps by showing the parse tree in =rx= form
and highlighting the corresponding chunks of code
- show the complete list of strings (productions) matching a
regexp, provided the list is finite
- provide live font-locking of regexp syntax (so far only for
Elisp buffers -- other modes on the TODO list)
** Usage
Enable =rxt-mode= or its global equivalent =rxt-global-mode=
to get the default key-bindings. There are three sets of commands:
commands that take a PCRE regexp, commands which take an Emacs
regexp, and commands that try to do the right thing based on the
current mode. Currently, this means Emacs syntax in
=emacs-lisp-mode= and =lisp-interaction-mode=, and PCRE syntax
everywhere else.
The default key bindings all begin with =C-c /= and have a mnemonic
structure: =C-c / =, or just =C-c / = for
the "do what I mean" commands. The complete list of key bindings is
given here and explained in more detail below:
- "Do-what-I-mean" commands:
- =C-c / /= :: =rxt-explain=
- =C-c / c= :: =rxt-convert-syntax=
- =C-c / x= :: =rxt-convert-to-rx=
- =C-c / ′= :: =rxt-convert-to-strings=
- Commands that work on a PCRE regexp:
- =C-c / p e= :: =rxt-pcre-to-elisp=
- =C-c / %= :: =pcre-query-replace-regexp=
- =C-c / p x= :: =rxt-pcre-to-rx=
- =C-c / p s= :: =rxt-pcre-to-sre=
- =C-c / p ′= :: =rxt-pcre-to-strings=
- =C-c / p /= :: =rxt-explain-pcre=
- Commands that work on an Emacs regexp:
- =C-c / e /= :: =rxt-explain-elisp=
- =C-c / e p= :: =rxt-elisp-to-pcre=
- =C-c / e x= :: =rxt-elisp-to-rx=
- =C-c / e s= :: =rxt-elisp-to-sre=
- =C-c / e ′= :: =rxt-elisp-to-strings=
- =C-c / e t= :: =rxt-toggle-elisp-rx=
- =C-c / t= :: =rxt-toggle-elisp-rx=
*** Interactive input and output
When used interactively, the conversion commands can read a regexp
either from the current buffer or from the minibuffer. The output
is displayed in the minibuffer and copied to the kill-ring.
- When called with a prefix argument (=C-u=), they read a regular
expression from the minibuffer literally, without further
processing -- meaning there's no need to double the backslashes if
it's an Emacs regexp. This is the same way commands like
=query-replace-regexp= read input.
- When the region is active, they use they the region contents,
again literally (without any translation of string syntax).
- With neither a prefix arg nor an active region, the behavior
depends on whether the command expects an Emacs regexp or
a PCRE one.
Commands that take an Emacs regexp behave like =C-x C-e=: they
evaluate the sexp before point (which could be simply a string
literal) and use its value. This is designed for use in Elisp
buffers. As a special case, if point is *inside* a string, it's
first moved to the string end, so in practice they should work
as long as point is somewhere within the regexp literal.
Commands that take a PCRE regexp try to read a Perl-style
delimited regex literal *after* point in the current buffer,
including its flags. For example, putting point before the =m=
in the following example and doing =C-c / p e=
(=rxt-pcre-to-elisp=) displays =\(?:bar\|foo\)=, correctly
stripping out the whitespace and comment:
: $x =~ m/ foo | (?# comment) bar /x
The PCRE reader currently only works with =/ ... /= delimiters. It
will ignore any preceding =m=, =s=, or =qr= operator, as well as
the replacement part of an =s= construction.
Readers for other PCRE-using languages are on the TODO list.
The translation functions display their result in the minibuffer
and copy it to the kill ring. When translating something into
Elisp syntax, you might need to use the result either literally
(e.g. for interactive input to a command like
=query-replace-regexp=), or as a string to paste into Lisp code.
To allow both uses, =rxt-pcre-to-elisp= copies both versions
successively to the kill-ring. The literal regexp without string
quoting is the top element of the kill-ring, while the Lisp string
is the second-from-top. You can paste the literal regexp somewhere
by doing =C-y=, or the Lisp string by =C-y M-y=.
*** Syntax conversion commands
=rxt-convert-syntax= (=C-c / c=) converts between Emacs and PCRE
syntax, depending on the major mode in effect when called.
Alternatively, you can specify the conversion direction explicitly
by using either =rxt-pcre-to-elisp= (=C-c / p e=) or
=rxt-elisp-to-pcre= (=C-c / e p=).
Similarly, =rxt-convert-to-rx= (=C-c / x=) converts either kind of
syntax to =rx= form, while =rxt-convert-pcre-to-rx= (=C-c / p x=)
and =rxt-convert-elisp-to-rx= (=C-c / e x=) convert to =rx= from a
specified source type.
In Elisp buffers, you can use =rxt-toggle-elisp-rx= (=C-c / t= or
=C-c / e t=) to switch the regexp at point back and forth between
string and =rx= syntax. Point should either be within an =rx= or
=rx-to-string= form or a string literal for this to work.
*** PCRE mode (experimental)
If you want to use emulated PCRE regexp syntax in all Emacs
commands, try =pcre-mode=, which uses Emacs's advice system to
make all commands that read regexps using the minibuffer use
emulated PCRE syntax. It should also work with Isearch.
This feature is still fairly experimental. It may fail to work or
do the wrong thing with certain commands. Please report bugs.
=pcre-query-replace-regexp= was originally defined to do
query-replace using emulated PCRE regexps, and is now made
somewhat obsolete by =pcre-mode=. It is bound to =C-c / %= by
default, by analogy with =M-%=. Put the following in your
=.emacs= if you want to use PCRE-style query replacement
everywhere:
: (global-set-key [(meta %)] 'pcre-query-replace-regexp)
*** Explain regexps
When syntax-highlighting isn't enough to untangle some gnarly
regexp you find in the wild, try the 'explain' commands:
=rxt-explain= (=C-c / /=), =rxt-explain-pcre= (=C-c / p=) and
=rxt-explain-elisp= (=C-c / e=). These display the original regexp
along with its pretty-printed =rx= equivalent in a new buffer.
Moving point around either in the original regexp or the =rx=
translation highlights corresponding pieces of syntax, which can
aid in seeing things like the scope of quantifiers.
I call them "explain" commands because the =rx= form is close to a
plain syntax tree, and this plus the wordiness of the operators
usually helps to clarify what is going on. People who dislike
Lisp syntax might disagree with this assessment.
*** Generate all matching strings (productions)
Occasionally you come across a regexp which is designed to match a
finite set of strings, e.g. a set of keywords, and it would be
useful to recover the original set. (In Emacs you can generate
such regexps using =regexp-opt=). The commands
=rxt-convert-to-strings= (=C-c / ′=), =rxt-pcre-to-strings= (=C-c
/ p ′=) or =rxt-elisp-to-strings= (=C-c / e ′=) accomplish this by
generating all the matching strings ("productions") of a regexp.
(The productions are copied to the kill ring as a Lisp list).
An example in Lisp code:
: (regexp-opt '("cat" "caterpillar" "catatonic"))
: ;; => "\\(?:cat\\(?:atonic\\|erpillar\\)?\\)"
: (rxt-elisp-to-strings "\\(?:cat\\(?:atonic\\|erpillar\\)?\\)")
: ;; => '("cat" "caterpillar" "catatonic")
For obvious reasons, these commands only work with regexps that
don't include any unbounded quantifiers like =+= or =*=. They also
can't enumerate all the characters that match a named character
class like =[[:alnum:]]=. In either case they will give a (hopefully
meaningful) error message. Due to the nature of permutations, it's
still possible for a finite regexp to generate a huge number of
productions, which will eat memory and slow down your Emacs. Be
ready with =C-g= if necessary.
*** RE-Builder support
The Emacs RE-Builder is a useful visual tool which allows using
several different built-in syntaxes via =reb-change-syntax= (=C-c
TAB=). It supports Elisp read and literal syntax and =rx=, but it
can only convert from the symbolic forms to Elisp, not the other
way. This package hacks the RE-Builder to also work with emulated
PCRE syntax, and to convert transparently between Elisp, PCRE and
rx syntaxes. PCRE mode reads a delimited Perl-like literal of the
form =/ ... /=, and it should correctly support using the =x= and
=s= flags.
*** Use from Lisp
Example of using the conversion functions:
: (rxt-pcre-to-elisp "(abc|def)\\w+\\d+")
: ;; => "\\(\\(?:abc\\|def\\)\\)[_[:alnum:]]+[[:digit:]]+"
All the conversion functions take a single string argument, the
regexp to translate:
- =rxt-pcre-to-elisp=
- =rxt-pcre-to-rx=
- =rxt-pcre-to-sre=
- =rxt-pcre-to-strings=
- =rxt-elisp-to-pcre=
- =rxt-elisp-to-rx=
- =rxt-elisp-to-sre=
- =rxt-elisp-to-strings=
** Bugs and Limitations
*** Limitations on PCRE syntax
PCRE has a complicated syntax and semantics, only some of which
can be translated into Elisp. The following subset of PCRE should
be correctly parsed and converted:
- parenthesis grouping =( .. )=, including shy matches =(?: ... )=
- backreferences (various syntaxes), but only up to 9 per expression
- alternation =|=
- greedy and non-greedy quantifiers =*=, =*?=, =+=, =+?=, =?= and =??=
(all of which are the same in Elisp as in PCRE)
- numerical quantifiers ={M,N}=
- beginning/end of string =\A=, =\Z=
- string quoting =\Q .. \E=
- word boundaries =\b=, =\B= (these are the same in Elisp)
- single character escapes =\a=, =\c=, =\e=, =\f=, =\n=, =\r=,
=\t=, =\x=, and =\octal digits= (but see below about non-ASCII
characters)
- character classes =[...]= including Posix escapes
- character classes =\d=, =\D=, =\h=, =\H=, =\s=, =\S=, =\v=, =\V=
both within character class brackets and outside
- word and non-word characters =\w= and =\W=
(Emacs has the same syntax, but its meaning is different)
- =s= (single line) and =x= (extended syntax) flags, in regexp
literals, or set within the expression via =(?xs-xs)= or =(?xs-xs:
.... )= syntax
- comments =(?# ... )=
Most of the more esoteric PCRE features can't really be supported
by simple translation to Elisp regexps. These include the
different lookaround assertions, conditionals, and the
"backtracking control verbs" =(* ...)= . OTOH, there are a few
other syntaxes which are currently unsupported and possibly could be:
- =\L=, =\U=, =\l=, =\u= case modifiers
- =\g{...}= backreferences
*** Other limitations
- The order of alternatives and characters in char classes
sometimes gets shifted around, which is annoying.
- Although the string parser tries to interpret PCRE's octal and
hexadecimal escapes correctly, there are problems with matching
8-bit characters that I don't use enough to properly understand,
e.g.:
: (string-match-p (rxt-pcre-to-elisp "\\377") "\377") => nil
A fix for this would be welcome.
- Most of PCRE's rules for how =^=, =\A=, =$= and =\Z= interact
with newlines are not implemented, since they seem less relevant
to Emacs's buffer-oriented rather than line-oriented model.
However, the different meanings of the =.= metacharacter *are*
implemented (it matches newlines with the =/s= flag, but not
otherwise).
- Not currently namespace clean (both =rxt-= and a couple of
=pcre-= functions).
*** TODO:
- Python-specific extensions to PCRE?
- Language-specific stuff to enable regexp font-locking and
explaining in different modes. Each language would need two
functions, which could be kept in an alist:
1. A function to read PCRE regexps, taking the string syntax into
account. E.g., Python has single-quoted, double-quoted and raw
strings, each with different quoting rules. PHP has the kind
of belt-and-suspenders solution you would expect: regexps are
in strings, /and/ you have to include the =/ ... /=
delimiters! Duh.
2. A function to copy faces back from the parsed string to the
original buffer text. This has to recognize any escape
sequences so they can be treated as a single character.
** Internal details
Internally, =rxt= defines an abstract syntax tree data type for
regular expressions, parsers for Elisp and PCRE syntax, and
"unparsers" from to PCRE, rx, and SRE syntax. Converting from a
parsed syntax tree to Elisp syntax is a two-step process: first
convert to =rx= form, then let =rx-to-string= do the heavy lifting.
See =rxt-parse-re=, =rxt-adt->pcre=, =rxt-adt->rx=, and
=rxt-adt->sre=, and the section beginning "Regexp ADT" in
pcre2el.el for details.
This code is partially based on Olin Shivers' reference SRE
implementation in scsh, although it is simplified in some respects
and extended in others. See =scsh/re.scm=, =scsh/spencer.scm= and
=scsh/posixstr.scm= in the =scsh= source tree for details. In
particular, =pcre2el= steals the idea of an abstract data type for
regular expressions and the general structure of the string regexp
parser and unparser. The data types for character sets are extended
in order to support symbolic translation between character set
expressions without assuming a small (Latin1) character set. The
string parser is also extended to parse a bigger variety of
constructions, including POSIX character classes and various Emacs
and Perl regexp assertions. Otherwise, only the bare minimum of
scsh's abstract data type is implemented.
** Soapbox
Emacs regexps have their annoyances, but it is worth getting used
to them. The Emacs assertions for word boundaries, symbol
boundaries, and syntax classes depending on the syntax of the mode
in effect are especially useful. (PCRE has =\b= for word-boundary,
but AFAIK it doesn't have separate assertions for beginning-of-word
and end-of-word). Other things that might be done with huge regexps
in other languages can be expressed more understandably in Elisp
using combinations of `save-excursion' with the various searches
(regexp, literal, skip-syntax-forward, sexp-movement functions,
etc.).
There's not much point in using =rxt-pcre-to-elisp= to use PCRE
notation in a Lisp program you're going to maintain, since you
still have to double all the backslashes. Better to just use the
converted result (or better yet, the =rx= form).
** History and acknowledgments
This was originally created out of an answer to a stackoverflow
question:
http://stackoverflow.com/questions/9118183/elisp-mechanism-for-converting-pcre-regexps-to-emacs-regexps
Thanks to:
- Wes Hardaker (hardaker) for the initial inspiration and
subsequent hacking
- priyadarshan for requesting RX/SRE support
- Daniel Colascione (dcolascione) for a patch to support Emacs's
explicitly-numbered match groups
- Aaron Meurer (asmeurer) for requesting Isearch support
- Philippe Vaucher (silex) for a patch to support
=ibuffer-do-replace-regexp= in PCRE mode
pcre2el-1.12/pcre2el-tests.el 0000644 0001750 0001750 00001351463 14473140155 015662 0 ustar dogsleg dogsleg ;;; pcre2el.tests.el -- tests for pcre2el/rxt -*- lexical-binding: t; -*-
;;; The bulk of the tests for pcre->elisp conversion are adapted from
;;; part of the PCRE library's test suite. Therefore:
;; This file incorporates work covered by the following copyright and
;; permission notice:
;;
;;
;; PCRE LICENCE
;; ------------
;; PCRE is a library of functions to support regular expressions whose syntax
;; and semantics are as close as possible to those of the Perl 5 language.
;; Release 8 of PCRE is distributed under the terms of the "BSD" licence, as
;; specified below. The documentation for PCRE, supplied in the "doc"
;; directory, is distributed under the same terms as the software itself.
;; The basic library functions are written in C and are freestanding. Also
;; included in the distribution is a set of C++ wrapper functions, and a
;; just-in-time compiler that can be used to optimize pattern matching. These
;; are both optional features that can be omitted when the library is built.
;; THE BASIC LIBRARY FUNCTIONS
;; ---------------------------
;; Written by: Philip Hazel
;; Email local part: ph10
;; Email domain: cam.ac.uk
;; University of Cambridge Computing Service,
;; Cambridge, England.
;; Copyright (c) 1997-2012 University of Cambridge
;; All rights reserved.
;; PCRE JUST-IN-TIME COMPILATION SUPPORT
;; -------------------------------------
;; Written by: Zoltan Herczeg
;; Email local part: hzmester
;; Emain domain: freemail.hu
;; Copyright(c) 2010-2012 Zoltan Herczeg
;; All rights reserved.
;; STACK-LESS JUST-IN-TIME COMPILER
;; --------------------------------
;; Written by: Zoltan Herczeg
;; Email local part: hzmester
;; Emain domain: freemail.hu
;; Copyright(c) 2009-2012 Zoltan Herczeg
;; All rights reserved.
;; THE "BSD" LICENCE
;; -----------------
;; Redistribution and use in source and binary forms, with or without
;; modification, are permitted provided that the following conditions are met:
;; * Redistributions of source code must retain the above copyright notice,
;; this list of conditions and the following disclaimer.
;; * Redistributions in binary form must reproduce the above copyright
;; notice, this list of conditions and the following disclaimer in the
;; documentation and/or other materials provided with the distribution.
;; * Neither the name of the University of Cambridge nor the name of Google
;; Inc. nor the names of their contributors may be used to endorse or
;; promote products derived from this software without specific prior
;; written permission.
;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
;; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
;; ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
;; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
;; CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
;; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
;; POSSIBILITY OF SUCH DAMAGE.
;;;; Code:
(require 'pcre2el)
(require 'ert)
(require 'cl-lib)
;; Some older versions of ert lack `ert-skip'.
(defun rxt-skip-test (message)
(if (fboundp 'ert-skip)
(ert-skip message)
(message (concat "SKIPPING: " message))
(ert-pass)))
;;; Tests for source-location
(ert-deftest rxt-location ()
(let ((dummy-1 (cl-gensym))
(dummy-2 (cl-gensym))
(location-1 (make-rxt-location :source "dummy 1"
:start 2
:end 5))
(location-2 (make-rxt-location :source "dummy 2"
:start 0
:end 4)))
(setf (rxt-location dummy-1) location-1)
(setf (rxt-location dummy-2) location-2)
(should (eq (rxt-location dummy-1) location-1))
(should (eq (rxt-location dummy-2) location-2))))
(ert-deftest rxt-location-text ()
(let ((location-1 (make-rxt-location :source "dummy 1"
:start 2
:end 5))
(location-2 (make-rxt-location :source "dummy 2"
:start 0
:end 4)))
(should (string= (rxt-location-text location-1) "mmy"))
(should (string= (rxt-location-text location-2) "dumm"))))
(ert-deftest rxt-with-source-location ()
"Test recording of source location information"
(let ((string "dummy string")
(dummy-1 (cl-gensym))
(dummy-2 (cl-gensym))
value-1 value-2)
(let ((rxt-source-text-string string))
(with-temp-buffer
(insert rxt-source-text-string)
(goto-char (point-min))
(setq value-1
(rxt-with-source-location
(goto-char (point-max))
dummy-1)))
(with-temp-buffer
(insert rxt-source-text-string)
(goto-char (point-min))
(setq value-2
(rxt-with-source-location
(forward-word)
dummy-2))))
(should (eq value-1 dummy-1))
(should (eq value-2 dummy-2))
(let ((location (rxt-location value-1)))
(should (not (null location)))
(should (string= (rxt-location-source location) string))
(should (= 0 (rxt-location-start location)))
(should (= (length string) (rxt-location-end location)))
(should (string= string (rxt-location-text location))))
(let ((location (rxt-location value-2)))
(should (not (null location)))
(should (string= (rxt-location-source location) string))
(should (= 0 (rxt-location-start location)))
(should (= 5 (rxt-location-end location)))
(should (string= "dummy" (rxt-location-text location))))))
;;; Syntax-tree tests
(ert-deftest rxt-trivial-p ()
(should (rxt-trivial-p (rxt-empty-string))))
(ert-deftest rxt-string-concat ()
(let* ((source "dummy string")
(string-1 (rxt-string "dummy "))
(string-2 (rxt-string "string")))
(should (equal (rxt-string source)
(rxt-string-concat string-1 string-2)))
(setf (rxt-location string-1)
(make-rxt-location :source source :start 0 :end 6))
(setf (rxt-location string-2)
(make-rxt-location :source source :start 6 :end 12))
(let ((result (rxt-string-concat string-1 string-2)))
(should (equal (rxt-string source) result))
(let ((location (rxt-location result)))
(should (not (null location)))
(should (eq source (rxt-location-source location)))
(should (= 0 (rxt-location-start location)))
(should (= 12 (rxt-location-end location)))))))
;; Sequence constructor
(ert-deftest rxt-seq-empty ()
(should (equal (rxt-empty-string) (rxt-seq))))
(ert-deftest rxt-seq-singleton ()
(let* ((string (rxt-string "sample string"))
(sequence (rxt-seq string)))
(should (equal string sequence))))
(ert-deftest rxt-seq-join-strings ()
;; Strings with the same case-folding setting are folded together
(let* ((string-1 (rxt-string "first"))
(string-2 (rxt-string "second"))
(string-3 (rxt-string "third"))
(sequence (rxt-seq string-1 string-2 string-3)))
(should (equal sequence
(rxt-string (concat (rxt-string-chars string-1)
(rxt-string-chars string-2)
(rxt-string-chars string-3))))))
;; Strings with different case-folding behaviours are not folded
;; together
(let* ((string-1 (rxt-string "case-sensitive" nil))
(string-2 (rxt-string "case-insensitive" t))
(sequence (rxt-seq string-1 string-2)))
(should (rxt-seq-p sequence))
(should (equal (rxt-seq-elts sequence)
(list string-1 string-2)))))
(ert-deftest rxt-seq-flatten-sequences ()
(let* ((sequence-1
(rxt-seq (rxt-bol)
(rxt-string "word")))
(nested-sequence
(rxt-seq sequence-1
(rxt-anything)
(rxt-eol)))
(flat-sequence
(rxt-seq (rxt-bol)
(rxt-string "word")
(rxt-anything)
(rxt-eol))))
(should (equal nested-sequence flat-sequence)))
(let* ((sequence (rxt-seq (rxt-bol)
(rxt-anything)
(rxt-eol)))
(nested-1 (rxt-seq sequence))
(nested-2 (rxt-seq nested-1)))
(should (equal sequence nested-1))
(should (equal sequence nested-2))))
(ert-deftest rxt-seq-remove-empty ()
(let ((sequence-1 (rxt-seq (rxt-bow)
(rxt-string "lorem ipsum")
(rxt-anything)
(rxt-eow)))
(sequence-2 (rxt-seq (rxt-empty-string)
(rxt-empty-string)
(rxt-bow)
(rxt-seq)
(rxt-string "lorem ipsum")
(rxt-seq)
(rxt-empty-string)
(rxt-anything)
(rxt-empty-string)
(rxt-eow))))
(should (equal sequence-1 sequence-2))))
;;; Choice constructor
(ert-deftest rxt-choice ()
;; Singleton elements should be returned unchanged
(let ((element (rxt-string "example")))
(should (equal (rxt-choice element) element)))
;; Nested choices should be flattened
(should (equal (rxt-choice
(rxt-choice
(rxt-string "first")
(rxt-string "second"))
(rxt-string "third"))
(rxt-choice
(rxt-string "first")
(rxt-string "second")
(rxt-string "third"))))
;; Char sets with the same case-folding behaviour should be folded together
(let* ((char-set-1
(make-rxt-char-set-union :chars '(?a ?q ?x)))
(char-set-2
(make-rxt-char-set-union :chars '(?1 ?9 ?5)))
(choice
(rxt-choice char-set-1 char-set-2)))
(should (rxt-char-set-union-p choice))
(should
(rxt--char-set-equal
choice
(make-rxt-char-set-union :chars '(?a ?q ?x ?1 ?9 ?5)))))
;; Char-sets with different case-folding behaviour should NOT be
;; folded together
(let* ((char-set-1
(make-rxt-char-set-union :chars '(?a ?b ?c)
:case-fold nil))
(char-set-2
(make-rxt-char-set-union :chars '(?1 ?2 ?3)
:case-fold t))
(choice
(rxt-choice char-set-1 char-set-2)))
(should (rxt-choice-p choice))))
;;; Repeat
;; FIXME
;;; Character sets and case-folding
(defun rxt--set-equal (a b)
(null (cl-set-exclusive-or a b :test 'equal)))
(defun rxt--char-set-equal (a b)
(and (rxt--set-equal (rxt-char-set-union-chars a)
(rxt-char-set-union-chars b))
(rxt--set-equal (rxt-char-set-union-ranges a)
(rxt-char-set-union-ranges b))
(rxt--set-equal (rxt-char-set-union-classes a)
(rxt-char-set-union-classes b))
(eq (rxt-char-set-union-case-fold a)
(rxt-char-set-union-case-fold b))))
(ert-deftest rxt--all-char-set-union-chars ()
(should
(rxt--set-equal
(rxt--all-char-set-union-chars
(make-rxt-char-set-union :chars '(?a ?x ?t)))
'(?a ?x ?t)))
(should
(rxt--set-equal
(rxt--all-char-set-union-chars
(make-rxt-char-set-union :chars '(?a ?x ?t)
:ranges '((?0 . ?3) (?d . ?f))))
'(?a ?x ?t ?0 ?1 ?2 ?3 ?d ?e ?f))))
(ert-deftest rxt--remove-redundant-chars ()
(should
(rxt--set-equal (rxt--remove-redundant-chars '(?a ?q ?t ?\n) nil)
'(?a ?q ?t ?\n)))
(should
(rxt--set-equal (rxt--remove-redundant-chars '(?a ?b ?c ?0 ?1 ?2) '(digit))
'(?a ?b ?c)))
(should
(rxt--set-equal (rxt--remove-redundant-chars '(?a ?b ?c ?0 ?1 ?2) '(letter))
'(?0 ?1 ?2)))
(should
(rxt--set-equal (rxt--remove-redundant-chars '(?a ?b ?c ?0 ?1 ?2) '(space))
'(?a ?b ?c ?0 ?1 ?2))))
(ert-deftest rxt--simplify-char-set ()
;; [abcdq-z[:digit:]] is unchanged
(let ((char-set
(rxt--simplify-char-set
(make-rxt-char-set-union :chars '(?a ?b ?c ?d)
:ranges '((?q . ?z))
:classes '(digit)
))))
(should
(rxt--char-set-equal char-set
(rxt--simplify-char-set char-set))))
;; [abcd0-7[:alnum:]] => [[:alnum:]]
(should
(rxt--char-set-equal
(rxt--simplify-char-set
(make-rxt-char-set-union :chars '(?a ?b ?c ?d)
:ranges '((?0 . ?7))
:classes '(alnum)))
(make-rxt-char-set-union :classes '(alnum))))
;; [abcda-z0-9] => [a-z0-9]
(should
(rxt--char-set-equal
(rxt--simplify-char-set
(make-rxt-char-set-union :chars '(?a ?b ?c ?d)
:ranges '((?a . ?z) (?0 . ?9))))
(make-rxt-char-set-union :ranges '((?a . ?z) (?0 . ?9)))))
;; [g-za-f0-95-9] => [a-z0-9]
(should
(rxt--char-set-equal
(rxt--simplify-char-set
(make-rxt-char-set-union :ranges '((?g . ?z) (?a . ?f)
(?0 . ?9) (?5 . ?9))))
(make-rxt-char-set-union :ranges '((?a . ?z) (?0 . ?9)))))
;; Two-character ranges are unchanged
(let ((char-set (make-rxt-char-set-union :chars '(?a ?b ?8 ?9))))
(should
(rxt--char-set-equal
char-set
(rxt--simplify-char-set char-set)))))
(ert-deftest rxt--simplify-char-set-case-fold ()
;; /[[:digit:][:space:]]/i => [[:digit:][:space:]]
(let ((char-set (make-rxt-char-set-union :classes '(digit space))))
(should (rxt--char-set-equal
char-set
(rxt--simplify-char-set char-set t))))
;; /[ad]/i => [ADad]
(should (rxt--char-set-equal
(rxt--simplify-char-set (make-rxt-char-set-union :chars '(?a ?d)) t)
(make-rxt-char-set-union :chars '(?a ?d ?A ?D))))
;; /[abcd]/i => [A-Da-d]
(should (rxt--char-set-equal
(rxt--simplify-char-set
(make-rxt-char-set-union :chars '(?a ?b ?c ?d)) t)
(make-rxt-char-set-union :ranges '((?a . ?d) (?A . ?D)))))
;; /[W-c]/i => [A-CW-ca-c]
(should (rxt--char-set-equal
(rxt--simplify-char-set
(make-rxt-char-set-union :ranges '((?W . ?c))) t)
(make-rxt-char-set-union :ranges '((?W . ?c) (?A . ?C) (?w . ?z))))))
(ert-deftest rxt--extract-ranges ()
(should (equal (rxt--extract-ranges '()) '()))
(should (equal (rxt--extract-ranges '(1)) '((1 . 1))))
(should (equal (rxt--extract-ranges '(1 1)) '((1 . 1))))
(should (equal (rxt--extract-ranges '(1 1 1)) '((1 . 1))))
(should (equal (rxt--extract-ranges '(1 2)) '((1 . 2))))
(should (equal (rxt--extract-ranges '(1 2 3)) '((1 . 3))))
(should (equal (rxt--extract-ranges '(1 2 3 4)) '((1 . 4))))
(should (equal (rxt--extract-ranges '(1 2 3 4 5)) '((1 . 5))))
(should (equal (rxt--extract-ranges '(0 1)) '((0 . 1))))
(should (equal (rxt--extract-ranges '(0 0)) '((0 . 0))))
(should (equal (rxt--extract-ranges '(0 0 0)) '((0 . 0))))
(should (equal (rxt--extract-ranges '(-2 -1 0 1 2 3 4)) '((-2 . 4))))
(should (equal (rxt--extract-ranges '(0 3 4 5)) '((0 . 0) (3 . 5))))
(should (equal (rxt--extract-ranges '(0 0 0 3 3 4 5 0 3 4 5)) '((0 . 0) (3 . 5))))
(should (equal (rxt--extract-ranges '(10 9 8 7 6 5)) '((5 . 10)))))
(ert-deftest rxt-char-set-union-case-fold-1 ()
(should
(rxt--char-set-equal
(rxt-char-set-union
(make-rxt-char-set-union :chars '(?a) :case-fold t)
(make-rxt-char-set-union :case-fold t))
(make-rxt-char-set-union :chars '(?a) :case-fold t)))
(should
(rxt--char-set-equal
(rxt-char-set-union
?a
(make-rxt-char-set-union :case-fold t))
(make-rxt-char-set-union :chars '(?a) :case-fold t)))
(should
(rxt--char-set-equal
(rxt-char-set-union
"a"
(make-rxt-char-set-union :case-fold t))
(make-rxt-char-set-union :chars '(?a) :case-fold t)))
(should
(rxt--char-set-equal
(rxt-char-set-union
(make-rxt-char-set-union :case-fold t)
(rxt-string "a"))
(make-rxt-char-set-union :chars '(?a) :case-fold t))))
;;; PCRE parsing tests
(ert-deftest rxt-parse-pcre-simple-string ()
(let* ((string "simple string")
(parse (rxt-parse-pcre string)))
(should (equal (rxt-string string) parse))
(should (equal (rxt-source-text parse) string))))
(ert-deftest rxt-parse-pcre-quoted-string ()
(cl-flet ((pcre-quote (string) (concat "\\Q" string "\\E")))
(let* ((string "Simple string without metacharacters")
(re (pcre-quote string))
(parse (rxt-parse-pcre re)))
(should (equal (rxt-string string) parse))
(should (equal re (rxt-source-text parse))))
(let* ((string "String $ with (( ) regexp \\ special [a-z] characters")
(re (pcre-quote string))
(parse (rxt-parse-pcre re)))
(should (equal (rxt-string string) parse))
(should (equal re (rxt-source-text parse))))))
;;; Simple pcre->elisp tests
;; Regexp quoting
(ert-deftest rxt-pcre-special-chars ()
(let* ((string "String $ with (( ) regexp \\ special [a-z] characters")
(re (pcre-to-elisp (concat "(\\Q" string "\\E)"))))
(should (string-match re string))
(should (equal (match-string 1 string) string))
(should (equal (match-string 0 string) string))))
;; Grouping, alternation
(ert-deftest rxt-pcre-grouping ()
(let ((re (pcre-to-elisp "(foo|bar)")))
(should (string-match-p re "foo"))
(should (string-match-p re "bar"))))
;; Grouping and character classes
(ert-deftest rxt-pcre-char-classes ()
(let ((re (pcre-to-elisp "(\\D*):\\s*(\\d{3,5})$"))
(string "Answer: 3501"))
(should (string-match re string))
(should (equal (match-string 1 string) "Answer"))
(should (equal (match-string 2 string) "3501"))
(should (not (string-match re "bad: 23")))
(should (not (string-match re "also bad: 944732")))))
;;;; Weird rules for \digits
(ert-deftest rxt-pcre-digits ()
;; \040 is another way of writing a space
(should (string-match-p (pcre-to-elisp "\\040") " "))
;; \40 is the same, provided there are fewer than 40 previous capturing subpatterns
(should (string-match-p (pcre-to-elisp "\\40") " "))
;; \7 is always a back reference
(let ((re
(pcre-to-elisp
"(.)(.)(.)(.)(.)(.)(.)\\s*\\7")))
(should (string-match-p re "abcdefg g"))
(should (not (string-match-p re "abcdefg\th"))))
;;\11 might be a back reference, or another way of writing a tab
(should (string-match-p (pcre-to-elisp "\\11") "\t"))
;; Backreferences greater than 9 are unsupported in Emacs
(should-error (pcre-to-elisp "(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)\\11"))
;; \011 is always a tab
(should (string-match-p (pcre-to-elisp "\\011") "\t"))
;; \0113 is a tab followed by the character "3"
(should (string-match-p (pcre-to-elisp "\\0113") "\t3"))
;; \113 might be a back reference, otherwise the character with octal
;; code 113
(should (string-match-p (pcre-to-elisp "\\113") (char-to-string #o113)))
;; \377 might be a back reference, otherwise the byte consisting
;; entirely of 1 bits
(should (string-match-p (pcre-to-elisp "\\377") (char-to-string 255)))
;; \81 is either a back reference, or a binary zero followed by the
;; two characters "8" and "1"
(should (string-match-p (pcre-to-elisp "\\81") (concat (char-to-string 0) "81"))))
;; Character classes with special characters
(ert-deftest rxt-pcre-escapes-in-char-classes ()
(let ((re (pcre-to-elisp "^[\\d\\w]*$")))
(should (string-match-p re "012foo"))
(should (not (string-match-p re "numbers 847 and 23 words"))))
(let ((case-fold-search t))
(should (string-match-p (pcre-to-elisp "^[\\dA-Z]*$")
"235711deadbeef"))))
;; Negated specials in character classes
(ert-deftest rxt-pcre-negated-char-class-escapes ()
(let ((re (pcre-to-elisp "^[^\\d]*$")))
(should (string-match-p re "words without numbers"))
(should-not (string-match-p re "words 2 and 4 numbers 8"))))
;; Hexadecimal and octal escapes
(ert-deftest rxt-pcre-hex-octal ()
(should (string-match-p (pcre-to-elisp "\\xab") (char-to-string #xab)))
(should (string-match-p (pcre-to-elisp "[\\xab]") (char-to-string #xab)))
(should (string-match-p (pcre-to-elisp "\\x{237}") (char-to-string #x237)))
(should (string-match-p (pcre-to-elisp "[\\x{237}]") (char-to-string #x237)))
(should (string-match-p (pcre-to-elisp "[\\177]") (char-to-string #o177)))
(should (string-match-p (pcre-to-elisp "[\\7]") (char-to-string 7))))
;; Control characters
(ert-deftest rxt-pcre-control-chars ()
(should (string-match-p (pcre-to-elisp "\\cx") (kbd "C-x")))
(should (string-match-p (pcre-to-elisp "\\cC\\cn") (kbd "C-c C-n"))))
;; Double negation (intersection) in character classes - fixme?
(ert-deftest rxt-pcre-char-set-intersection ()
(should (string-match-p (pcre-to-elisp "^[^\\W]*$") "foo")))
(ert-deftest rxt-quote-pcre ()
(string=
(rxt-quote-pcre ".*[]foo+")
"\\.\\*\\[\\]foo\\+"))
;; String generation
(ert-deftest rxt-string-generation ()
(let* ((strings '("caterpillar" "cat" "catatonic" "catamaran" "carthage"
"calloo" "callay"))
(regexp (regexp-opt strings))
(strings* (rxt-elisp-to-strings regexp)))
(should (equal nil
(cl-set-exclusive-or strings strings*
:test #'string=)))))
;;;; Elisp -> PCRE translation
(ert-deftest rxt-pcre-repetitions ()
"Check that repetition and grouping have correct precedence in PCREs."
(should
(equal
(rxt-elisp-to-pcre (rx (repeat 3 5 "c")))
"c{3,5}"))
(should
(equal
(rxt-elisp-to-pcre (rx (repeat 3 5 "string")))
"(?:string){3,5}"))
(should
(equal
(rxt-elisp-to-pcre (rx (* "c")))
"c*"))
(should
(equal
(rxt-elisp-to-pcre (rx (* "string")))
"(?:string)*")))
;; Pretty-printing / explain tests
(ert-deftest rxt--print ()
;; Test that lists and dotted lists are printed correctly
(cl-flet ((print-to-string (form)
(with-temp-buffer
(rxt-print form)
(buffer-string))))
(should (string= (print-to-string '(normal list))
"(normal list)"))
(should (string= (print-to-string '(short-list))
"(short-list)"))
(should (string= (print-to-string '(dotted . pair))
"(dotted . pair)"))
(should (string= (print-to-string '(longer dotted . list))
"(longer dotted . list)"))
;; Test correct printing of some `rx' forms
(should (string= (print-to-string '(? (any digit)))
"(? (any digit))"))
(should (string= (print-to-string '(?? (any digit)))
"(?? (any digit))"))
(should (string= (print-to-string '(*? "some regexp"))
"(*? \"some regexp\")"))
(should (string= (print-to-string '(+? "some regexp"))
"(+? \"some regexp\")"))
(should (string= (print-to-string '(any ?a ?q ?z))
"(any ?a ?q ?z)"))
(should (string= (print-to-string '(any (?a . ?z) (?0 . ?3)))
"(any (?a . ?z) (?0 . ?3))"))
(should (string= (print-to-string '(repeat 2 5 ?x))
"(repeat 2 5 ?x)"))
(should (string= (print-to-string '(repeat 5 (any digit)))
"(repeat 5 (any digit))"))))
(ert-deftest rxt--propertize-whitespace ()
(let ((string (rxt--propertize-whitespace "\n\t\f\r")))
(should (equal (get-text-property 0 'display string) "\\n"))
(should (equal (get-text-property 1 'display string) "\\t"))
(should (equal (get-text-property 2 'display string) "\\f"))
(should (equal (get-text-property 3 'display string) "\\r")))
(let ((string (rxt--propertize-whitespace "String\n\twith\n\tnewlines and tabs")))
(should (equal (get-text-property 6 'display string) "\\n"))
(should (equal (get-text-property 7 'display string) "\\t"))
(should (equal (get-text-property 12 'display string) "\\n"))
(should (equal (get-text-property 13 'display string) "\\t"))))
;;;; Test PCRE reading
(ert-deftest rxt-read-delimited-pcre ()
(cl-flet ((read-pcre-from-string (string)
(with-temp-buffer
(save-excursion (insert string))
(rxt-read-delimited-pcre))))
(should (string= (read-pcre-from-string "/[a-z]/")
"[a-z]"))
(should (string= (read-pcre-from-string " m/\\d+/")
"\\d+"))
(should (string= (read-pcre-from-string " qr/embedded\\/delimiters/")
"embedded\\/delimiters"))
(should (string= (read-pcre-from-string
" s/several\\/embedded\\/delimiters/replacement/")
"several\\/embedded\\/delimiters"))
(should (string= (read-pcre-from-string
" s/several\\/embedded\\/delimiters/replacement\\/with\\/delimiters/")
"several\\/embedded\\/delimiters"))
(let ((pcre (read-pcre-from-string "/regexp/")))
(should (string= pcre "regexp")))
(let ((pcre (read-pcre-from-string "m/regexp/s")))
(should (string= pcre "(?s)regexp")))
(let ((pcre (read-pcre-from-string "s/regexp/replacement/sx")))
(should (string= pcre "(?sx)regexp")))
(let ((pcre (read-pcre-from-string "s/regexp/embedded\\/delimiters/x")))
(should (string= pcre "(?x)regexp")))))
(ert-deftest rxt--read-pcre ()
(when noninteractive (rxt-skip-test "Skipping interacive-only test"))
(let* ((unread-command-events
(string-to-list "regexp text\C-ci\C-cs\C-j"))
(result
(rxt--read-pcre "Test: ")))
(should (string= result "(?is)regexp text")))
(let* ((unread-command-events
(string-to-list "\C-ciregexp text\C-ci\C-j"))
(result
(rxt--read-pcre "Test: ")))
(should (string= result "regexp text"))))
(ert-deftest rxt--toggle-flag-string ()
(cl-macrolet
((should-toggle (string flag result)
`(should (string= (rxt--toggle-flag-string ,string ,flag) ,result))))
(should-toggle "foo" ?x "(?x)foo")
(should-toggle "(?x)foo" ?x "foo")
(should-toggle "(?xi)foo" ?x "(?i)foo")
(should-toggle "(?xi)foo" ?i "(?x)foo")
(should-toggle "(?xi)foo" ?s "(?isx)foo")))
(defmacro rxt-with-minor-mode (mode &rest body)
(declare (indent 1))
(cl-assert (symbolp mode))
(let ((saved-mode (make-symbol (concat "saved-" (symbol-name mode)))))
`(let ((,saved-mode ,mode))
(unwind-protect
(progn
(,mode +1)
,@body)
(,mode (if ,saved-mode +1 0))))))
(defmacro rxt-with-minor-modes (modes &rest body)
(declare (indent 1))
(cl-assert (listp modes))
(if (null modes)
(macroexp-progn body)
`(rxt-with-minor-modes ,(cdr modes)
(rxt-with-minor-mode ,(car modes)
,@body))))
;;; Test for repeated searching in evil-mode (issue #19)
(ert-deftest rxt-pcre-mode-evil-search ()
(when noninteractive
(rxt-skip-test "Skipping interactive test `pcre-mode-evil-search'"))
(unless (require 'evil nil t)
(rxt-skip-test "Skipping `pcre-mode-evil-search' since `evil-mode' is not installed"))
(cl-flet ((process-input (&rest keys)
(let ((unread-command-events
(listify-key-sequence
(apply #'vconcat `(,@keys ,(kbd "C-M-c"))))))
(recursive-edit))))
(rxt-with-minor-modes (pcre-mode evil-mode)
(save-window-excursion
(with-temp-buffer
(insert "\n\n(this) (that) (the other)")
(goto-char (point-min))
(set-window-buffer (selected-window) (current-buffer))
(process-input "/\\(th" (kbd "RET"))
(should (looking-at "(this)"))
(process-input "n")
(should (looking-at "(that)"))
(process-input "n")
(should (looking-at "(the other)"))
(process-input "N")
(should (looking-at "(that)"))
(process-input "N")
(should (looking-at "(this)")))))))
;; The following tests are adapted from the first set of tests
;; ("testinput1") in the PCRE library's test suite: see
;; http://www.pcre.org/ and the copyright notice at the beginning of
;; this file.
;; Each test converts a particular PCRE regexp to its (supposed) Elisp
;; equivalent, then compares the set of matches for the Elisp regexp
;; against the set of matches generated by Perl for a number of
;; subject strings. (The set of Perl matches to compare with was
;; statically generated by a script adapted from the PCRE test script
;; to create this file, so the tests don't actually call out to Perl).
;; Many of the tests currently fail -- a bit under half of them. This
;; obviously is not very good, but many of the failing tests are
;; features of PCRE which are not easily supported in Emacs, like the
;; (* ...) backtracking control verbs. Other failing tests are bugs
;; that might be worth fixing, so these are a good place to look for
;; anyone interested in improving the pcre->elisp code.
;; The failing tests are marked with the `:expected-result :failed'
;; property in their definitions, so the tests as a whole are still
;; useful to guard against regressions.
;;
(defun rxt-all-matches
(regexp input)
(if (string-match regexp input)
(let* ((match-count (- (/ (length (match-data)) 2) 1)))
(cl-loop for i from 0 to match-count
collect (match-string i input)))
nil))
(defmacro rxt-match-test
(regexp input perl-matches)
`(should
(equal
(rxt-all-matches ,regexp ,input)
,perl-matches)))
(ert-deftest rxt-pcre-test-00002 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "the quick brown fox" "")))
(rxt-match-test regexp "the quick brown fox"
'("the quick brown fox"))
(rxt-match-test regexp "The quick brown FOX" 'nil)
(rxt-match-test regexp "What do you know about the quick brown fox?"
'("the quick brown fox"))
(rxt-match-test regexp "What do you know about THE QUICK BROWN FOX?" 'nil)))
(ert-deftest rxt-pcre-test-00003 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "The quick brown fox" "i")))
(rxt-match-test regexp "the quick brown fox"
'("the quick brown fox"))
(rxt-match-test regexp "The quick brown FOX"
'("The quick brown FOX"))
(rxt-match-test regexp "What do you know about the quick brown fox?"
'("the quick brown fox"))
(rxt-match-test regexp "What do you know about THE QUICK BROWN FOX?"
'("THE QUICK BROWN FOX"))))
(ert-deftest rxt-pcre-test-00004 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "abcd\\t\\n\\r\\f\\a\\e\\071\\x3b\\$\\\\\\?caxyz" "")))
(rxt-match-test regexp "abcd \n
\f9;$\\?caxyz"
'("abcd \n
\f9;$\\?caxyz"))))
(ert-deftest rxt-pcre-test-00005 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz" "")))
(rxt-match-test regexp "abxyzpqrrrabbxyyyypqAzz"
'("abxyzpqrrrabbxyyyypqAzz"))
(rxt-match-test regexp "abxyzpqrrrabbxyyyypqAzz"
'("abxyzpqrrrabbxyyyypqAzz"))
(rxt-match-test regexp "aabxyzpqrrrabbxyyyypqAzz"
'("aabxyzpqrrrabbxyyyypqAzz"))
(rxt-match-test regexp "aaabxyzpqrrrabbxyyyypqAzz"
'("aaabxyzpqrrrabbxyyyypqAzz"))
(rxt-match-test regexp "aaaabxyzpqrrrabbxyyyypqAzz"
'("aaaabxyzpqrrrabbxyyyypqAzz"))
(rxt-match-test regexp "abcxyzpqrrrabbxyyyypqAzz"
'("abcxyzpqrrrabbxyyyypqAzz"))
(rxt-match-test regexp "aabcxyzpqrrrabbxyyyypqAzz"
'("aabcxyzpqrrrabbxyyyypqAzz"))
(rxt-match-test regexp "aaabcxyzpqrrrabbxyyyypAzz"
'("aaabcxyzpqrrrabbxyyyypAzz"))
(rxt-match-test regexp "aaabcxyzpqrrrabbxyyyypqAzz"
'("aaabcxyzpqrrrabbxyyyypqAzz"))
(rxt-match-test regexp "aaabcxyzpqrrrabbxyyyypqqAzz"
'("aaabcxyzpqrrrabbxyyyypqqAzz"))
(rxt-match-test regexp "aaabcxyzpqrrrabbxyyyypqqqAzz"
'("aaabcxyzpqrrrabbxyyyypqqqAzz"))
(rxt-match-test regexp "aaabcxyzpqrrrabbxyyyypqqqqAzz"
'("aaabcxyzpqrrrabbxyyyypqqqqAzz"))
(rxt-match-test regexp "aaabcxyzpqrrrabbxyyyypqqqqqAzz"
'("aaabcxyzpqrrrabbxyyyypqqqqqAzz"))
(rxt-match-test regexp "aaabcxyzpqrrrabbxyyyypqqqqqqAzz"
'("aaabcxyzpqrrrabbxyyyypqqqqqqAzz"))
(rxt-match-test regexp "aaaabcxyzpqrrrabbxyyyypqAzz"
'("aaaabcxyzpqrrrabbxyyyypqAzz"))
(rxt-match-test regexp "abxyzzpqrrrabbxyyyypqAzz"
'("abxyzzpqrrrabbxyyyypqAzz"))
(rxt-match-test regexp "aabxyzzzpqrrrabbxyyyypqAzz"
'("aabxyzzzpqrrrabbxyyyypqAzz"))
(rxt-match-test regexp "aaabxyzzzzpqrrrabbxyyyypqAzz"
'("aaabxyzzzzpqrrrabbxyyyypqAzz"))
(rxt-match-test regexp "aaaabxyzzzzpqrrrabbxyyyypqAzz"
'("aaaabxyzzzzpqrrrabbxyyyypqAzz"))
(rxt-match-test regexp "abcxyzzpqrrrabbxyyyypqAzz"
'("abcxyzzpqrrrabbxyyyypqAzz"))
(rxt-match-test regexp "aabcxyzzzpqrrrabbxyyyypqAzz"
'("aabcxyzzzpqrrrabbxyyyypqAzz"))
(rxt-match-test regexp "aaabcxyzzzzpqrrrabbxyyyypqAzz"
'("aaabcxyzzzzpqrrrabbxyyyypqAzz"))
(rxt-match-test regexp "aaaabcxyzzzzpqrrrabbxyyyypqAzz"
'("aaaabcxyzzzzpqrrrabbxyyyypqAzz"))
(rxt-match-test regexp "aaaabcxyzzzzpqrrrabbbxyyyypqAzz"
'("aaaabcxyzzzzpqrrrabbbxyyyypqAzz"))
(rxt-match-test regexp "aaaabcxyzzzzpqrrrabbbxyyyyypqAzz"
'("aaaabcxyzzzzpqrrrabbbxyyyyypqAzz"))
(rxt-match-test regexp "aaabcxyzpqrrrabbxyyyypABzz"
'("aaabcxyzpqrrrabbxyyyypABzz"))
(rxt-match-test regexp "aaabcxyzpqrrrabbxyyyypABBzz"
'("aaabcxyzpqrrrabbxyyyypABBzz"))
(rxt-match-test regexp ">>>aaabxyzpqrrrabbxyyyypqAzz"
'("aaabxyzpqrrrabbxyyyypqAzz"))
(rxt-match-test regexp ">aaaabxyzpqrrrabbxyyyypqAzz"
'("aaaabxyzpqrrrabbxyyyypqAzz"))
(rxt-match-test regexp ">>>>abcxyzpqrrrabbxyyyypqAzz"
'("abcxyzpqrrrabbxyyyypqAzz"))
(rxt-match-test regexp "*** Failers" 'nil)
(rxt-match-test regexp "abxyzpqrrabbxyyyypqAzz" 'nil)
(rxt-match-test regexp "abxyzpqrrrrabbxyyyypqAzz" 'nil)
(rxt-match-test regexp "abxyzpqrrrabxyyyypqAzz" 'nil)
(rxt-match-test regexp "aaaabcxyzzzzpqrrrabbbxyyyyyypqAzz" 'nil)
(rxt-match-test regexp "aaaabcxyzzzzpqrrrabbbxyyypqAzz" 'nil)
(rxt-match-test regexp "aaabcxyzpqrrrabbxyyyypqqqqqqqAzz" 'nil)))
(ert-deftest rxt-pcre-test-00006 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^(abc){1,2}zz" "")))
(rxt-match-test regexp "abczz"
'("abczz" "abc"))
(rxt-match-test regexp "abcabczz"
'("abcabczz" "abc"))
(rxt-match-test regexp "*** Failers" 'nil)
(rxt-match-test regexp "zz" 'nil)
(rxt-match-test regexp "abcabcabczz" 'nil)
(rxt-match-test regexp ">>abczz" 'nil)))
(ert-deftest rxt-pcre-test-00007 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^(b+?|a){1,2}?c" "")))
(rxt-match-test regexp "bc"
'("bc" "b"))
(rxt-match-test regexp "bbc"
'("bbc" "b"))
(rxt-match-test regexp "bbbc"
'("bbbc" "bb"))
(rxt-match-test regexp "bac"
'("bac" "a"))
(rxt-match-test regexp "bbac"
'("bbac" "a"))
(rxt-match-test regexp "aac"
'("aac" "a"))
(rxt-match-test regexp "abbbbbbbbbbbc"
'("abbbbbbbbbbbc" "bbbbbbbbbbb"))
(rxt-match-test regexp "bbbbbbbbbbbac"
'("bbbbbbbbbbbac" "a"))
(rxt-match-test regexp "*** Failers" 'nil)
(rxt-match-test regexp "aaac" 'nil)
(rxt-match-test regexp "abbbbbbbbbbbac" 'nil)))
(ert-deftest rxt-pcre-test-00008 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^(b+|a){1,2}c" "")))
(rxt-match-test regexp "bc"
'("bc" "b"))
(rxt-match-test regexp "bbc"
'("bbc" "bb"))
(rxt-match-test regexp "bbbc"
'("bbbc" "bbb"))
(rxt-match-test regexp "bac"
'("bac" "a"))
(rxt-match-test regexp "bbac"
'("bbac" "a"))
(rxt-match-test regexp "aac"
'("aac" "a"))
(rxt-match-test regexp "abbbbbbbbbbbc"
'("abbbbbbbbbbbc" "bbbbbbbbbbb"))
(rxt-match-test regexp "bbbbbbbbbbbac"
'("bbbbbbbbbbbac" "a"))
(rxt-match-test regexp "*** Failers" 'nil)
(rxt-match-test regexp "aaac" 'nil)
(rxt-match-test regexp "abbbbbbbbbbbac" 'nil)))
(ert-deftest rxt-pcre-test-00009 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^(b+|a){1,2}?bc" "")))
(rxt-match-test regexp "bbc"
'("bbc" "b"))))
(ert-deftest rxt-pcre-test-00010 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^(b*|ba){1,2}?bc" "")))
(rxt-match-test regexp "babc"
'("babc" "ba"))
(rxt-match-test regexp "bbabc"
'("bbabc" "ba"))
(rxt-match-test regexp "bababc"
'("bababc" "ba"))
(rxt-match-test regexp "*** Failers" 'nil)
(rxt-match-test regexp "bababbc" 'nil)
(rxt-match-test regexp "babababc" 'nil)))
(ert-deftest rxt-pcre-test-00011 nil
:expected-result :failed
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^(ba|b*){1,2}?bc" "")))
(rxt-match-test regexp "babc"
'("babc" "ba"))
(rxt-match-test regexp "bbabc"
'("bbabc" "ba"))
(rxt-match-test regexp "bababc"
'("bababc" "ba"))
(rxt-match-test regexp "*** Failers" 'nil)
(rxt-match-test regexp "bababbc" 'nil)
(rxt-match-test regexp "babababc" 'nil)))
(ert-deftest rxt-pcre-test-00012 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^\\ca\\cA\\c[\\c{\\c:" "")))
(rxt-match-test regexp ";z"
'(";z"))))
(ert-deftest rxt-pcre-test-00013 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^[ab\\]cde]" "")))
(rxt-match-test regexp "athing"
'("a"))
(rxt-match-test regexp "bthing"
'("b"))
(rxt-match-test regexp "]thing"
'("]"))
(rxt-match-test regexp "cthing"
'("c"))
(rxt-match-test regexp "dthing"
'("d"))
(rxt-match-test regexp "ething"
'("e"))
(rxt-match-test regexp "*** Failers" 'nil)
(rxt-match-test regexp "fthing" 'nil)
(rxt-match-test regexp "[thing" 'nil)
(rxt-match-test regexp "\\thing" 'nil)))
(ert-deftest rxt-pcre-test-00014 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^[]cde]" "")))
(rxt-match-test regexp "]thing"
'("]"))
(rxt-match-test regexp "cthing"
'("c"))
(rxt-match-test regexp "dthing"
'("d"))
(rxt-match-test regexp "ething"
'("e"))
(rxt-match-test regexp "*** Failers" 'nil)
(rxt-match-test regexp "athing" 'nil)
(rxt-match-test regexp "fthing" 'nil)))
(ert-deftest rxt-pcre-test-00015 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^[^ab\\]cde]" "")))
(rxt-match-test regexp "fthing"
'("f"))
(rxt-match-test regexp "[thing"
'("["))
(rxt-match-test regexp "\\thing"
'("\\"))
(rxt-match-test regexp "*** Failers"
'("*"))
(rxt-match-test regexp "athing" 'nil)
(rxt-match-test regexp "bthing" 'nil)
(rxt-match-test regexp "]thing" 'nil)
(rxt-match-test regexp "cthing" 'nil)
(rxt-match-test regexp "dthing" 'nil)
(rxt-match-test regexp "ething" 'nil)))
(ert-deftest rxt-pcre-test-00016 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^[^]cde]" "")))
(rxt-match-test regexp "athing"
'("a"))
(rxt-match-test regexp "fthing"
'("f"))
(rxt-match-test regexp "*** Failers"
'("*"))
(rxt-match-test regexp "]thing" 'nil)
(rxt-match-test regexp "cthing" 'nil)
(rxt-match-test regexp "dthing" 'nil)
(rxt-match-test regexp "ething" 'nil)))
(ert-deftest rxt-pcre-test-00017 nil
:expected-result :failed
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^\\\201" "")))
(rxt-match-test regexp "\201"
'("\201"))))
(ert-deftest rxt-pcre-test-00018 nil
:expected-result :failed
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^\377" "")))
(rxt-match-test regexp "\377"
'("\377"))))
(ert-deftest rxt-pcre-test-00019 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^[0-9]+$" "")))
(rxt-match-test regexp "0"
'("0"))
(rxt-match-test regexp "1"
'("1"))
(rxt-match-test regexp "2"
'("2"))
(rxt-match-test regexp "3"
'("3"))
(rxt-match-test regexp "4"
'("4"))
(rxt-match-test regexp "5"
'("5"))
(rxt-match-test regexp "6"
'("6"))
(rxt-match-test regexp "7"
'("7"))
(rxt-match-test regexp "8"
'("8"))
(rxt-match-test regexp "9"
'("9"))
(rxt-match-test regexp "10"
'("10"))
(rxt-match-test regexp "100"
'("100"))
(rxt-match-test regexp "*** Failers" 'nil)
(rxt-match-test regexp "abc" 'nil)))
(ert-deftest rxt-pcre-test-00020 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^.*nter" "")))
(rxt-match-test regexp "enter"
'("enter"))
(rxt-match-test regexp "inter"
'("inter"))
(rxt-match-test regexp "uponter"
'("uponter"))))
(ert-deftest rxt-pcre-test-00021 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^xxx[0-9]+$" "")))
(rxt-match-test regexp "xxx0"
'("xxx0"))
(rxt-match-test regexp "xxx1234"
'("xxx1234"))
(rxt-match-test regexp "*** Failers" 'nil)
(rxt-match-test regexp "xxx" 'nil)))
(ert-deftest rxt-pcre-test-00022 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^.+[0-9][0-9][0-9]$" "")))
(rxt-match-test regexp "x123"
'("x123"))
(rxt-match-test regexp "xx123"
'("xx123"))
(rxt-match-test regexp "123456"
'("123456"))
(rxt-match-test regexp "*** Failers" 'nil)
(rxt-match-test regexp "123" 'nil)
(rxt-match-test regexp "x1234"
'("x1234"))))
(ert-deftest rxt-pcre-test-00023 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^.+?[0-9][0-9][0-9]$" "")))
(rxt-match-test regexp "x123"
'("x123"))
(rxt-match-test regexp "xx123"
'("xx123"))
(rxt-match-test regexp "123456"
'("123456"))
(rxt-match-test regexp "*** Failers" 'nil)
(rxt-match-test regexp "123" 'nil)
(rxt-match-test regexp "x1234"
'("x1234"))))
(ert-deftest rxt-pcre-test-00024 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^([^!]+)!(.+)=apquxz\\.ixr\\.zzz\\.ac\\.uk$" "")))
(rxt-match-test regexp "abc!pqr=apquxz.ixr.zzz.ac.uk"
'("abc!pqr=apquxz.ixr.zzz.ac.uk" "abc" "pqr"))
(rxt-match-test regexp "*** Failers" 'nil)
(rxt-match-test regexp "!pqr=apquxz.ixr.zzz.ac.uk" 'nil)
(rxt-match-test regexp "abc!=apquxz.ixr.zzz.ac.uk" 'nil)
(rxt-match-test regexp "abc!pqr=apquxz:ixr.zzz.ac.uk" 'nil)
(rxt-match-test regexp "abc!pqr=apquxz.ixr.zzz.ac.ukk" 'nil)))
(ert-deftest rxt-pcre-test-00025 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp ":" "")))
(rxt-match-test regexp "Well, we need a colon: somewhere"
'(":"))
(rxt-match-test regexp "*** Fail if we don't" 'nil)))
(ert-deftest rxt-pcre-test-00026 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "([\\da-f:]+)$" "i")))
(rxt-match-test regexp "0abc"
'("0abc" "0abc"))
(rxt-match-test regexp "abc"
'("abc" "abc"))
(rxt-match-test regexp "fed"
'("fed" "fed"))
(rxt-match-test regexp "E"
'("E" "E"))
(rxt-match-test regexp "::"
'("::" "::"))
(rxt-match-test regexp "5f03:12C0::932e"
'("5f03:12C0::932e" "5f03:12C0::932e"))
(rxt-match-test regexp "fed def"
'("def" "def"))
(rxt-match-test regexp "Any old stuff"
'("ff" "ff"))
(rxt-match-test regexp "*** Failers" 'nil)
(rxt-match-test regexp "0zzz" 'nil)
(rxt-match-test regexp "gzzz" 'nil)
(rxt-match-test regexp "fed " 'nil)
(rxt-match-test regexp "Any old rubbish" 'nil)))
(ert-deftest rxt-pcre-test-00027 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^.*\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$" "")))
(rxt-match-test regexp ".1.2.3"
'(".1.2.3" "1" "2" "3"))
(rxt-match-test regexp "A.12.123.0"
'("A.12.123.0" "12" "123" "0"))
(rxt-match-test regexp "*** Failers" 'nil)
(rxt-match-test regexp ".1.2.3333" 'nil)
(rxt-match-test regexp "1.2.3" 'nil)
(rxt-match-test regexp "1234.2.3" 'nil)))
(ert-deftest rxt-pcre-test-00028 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^(\\d+)\\s+IN\\s+SOA\\s+(\\S+)\\s+(\\S+)\\s*\\(\\s*$" "")))
(rxt-match-test regexp "1 IN SOA non-sp1 non-sp2("
'("1 IN SOA non-sp1 non-sp2(" "1" "non-sp1" "non-sp2"))
(rxt-match-test regexp "1 IN SOA non-sp1 non-sp2 ("
'("1 IN SOA non-sp1 non-sp2 (" "1" "non-sp1" "non-sp2"))
(rxt-match-test regexp "*** Failers" 'nil)
(rxt-match-test regexp "1IN SOA non-sp1 non-sp2(" 'nil)))
(ert-deftest rxt-pcre-test-00029 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^[a-zA-Z\\d][a-zA-Z\\d\\-]*(\\.[a-zA-Z\\d][a-zA-z\\d\\-]*)*\\.$" "")))
(rxt-match-test regexp "a."
'("a."))
(rxt-match-test regexp "Z."
'("Z."))
(rxt-match-test regexp "2."
'("2."))
(rxt-match-test regexp "ab-c.pq-r."
'("ab-c.pq-r." ".pq-r"))
(rxt-match-test regexp "sxk.zzz.ac.uk."
'("sxk.zzz.ac.uk." ".uk"))
(rxt-match-test regexp "x-.y-."
'("x-.y-." ".y-"))
(rxt-match-test regexp "*** Failers" 'nil)
(rxt-match-test regexp "-abc.peq." 'nil)))
(ert-deftest rxt-pcre-test-00030 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^\\*\\.[a-z]([a-z\\-\\d]*[a-z\\d]+)?(\\.[a-z]([a-z\\-\\d]*[a-z\\d]+)?)*$" "")))
(rxt-match-test regexp "*.a"
'("*.a"))
(rxt-match-test regexp "*.b0-a"
'("*.b0-a" "0-a"))
(rxt-match-test regexp "*.c3-b.c"
'("*.c3-b.c" "3-b" ".c"))
(rxt-match-test regexp "*.c-a.b-c"
'("*.c-a.b-c" "-a" ".b-c" "-c"))
(rxt-match-test regexp "*** Failers" 'nil)
(rxt-match-test regexp "*.0" 'nil)
(rxt-match-test regexp "*.a-" 'nil)
(rxt-match-test regexp "*.a-b.c-" 'nil)
(rxt-match-test regexp "*.c-a.0-c" 'nil)))
(ert-deftest rxt-pcre-test-00031 nil
:expected-result :failed
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^(?=ab(de))(abd)(e)" "")))
(rxt-match-test regexp "abde"
'("abde" "de" "abd" "e"))))
(ert-deftest rxt-pcre-test-00032 nil
:expected-result :failed
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^(?!(ab)de|x)(abd)(f)" "")))
(rxt-match-test regexp "abdf"
'("abdf" nil "abd" "f"))))
(ert-deftest rxt-pcre-test-00033 nil
:expected-result :failed
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^(?=(ab(cd)))(ab)" "")))
(rxt-match-test regexp "abcd"
'("ab" "abcd" "cd" "ab"))))
(ert-deftest rxt-pcre-test-00034 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^[\\da-f](\\.[\\da-f])*$" "i")))
(rxt-match-test regexp "a.b.c.d"
'("a.b.c.d" ".d"))
(rxt-match-test regexp "A.B.C.D"
'("A.B.C.D" ".D"))
(rxt-match-test regexp "a.b.c.1.2.3.C"
'("a.b.c.1.2.3.C" ".C"))))
(ert-deftest rxt-pcre-test-00035 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^\\\".*\\\"\\s*(;.*)?$" "")))
(rxt-match-test regexp "\"1234\""
'("\"1234\""))
(rxt-match-test regexp "\"abcd\" ;"
'("\"abcd\" ;" ";"))
(rxt-match-test regexp "\"\" ; rhubarb"
'("\"\" ; rhubarb" "; rhubarb"))
(rxt-match-test regexp "*** Failers" 'nil)
(rxt-match-test regexp "\"1234\" : things" 'nil)))
(ert-deftest rxt-pcre-test-00036 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^$" "")))
(rxt-match-test regexp ""
'(""))
(rxt-match-test regexp "*** Failers" 'nil)))
(ert-deftest rxt-pcre-test-00037 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp " ^ a (?# begins with a) b\\sc (?# then b c) $ (?# then end)" "x")))
(rxt-match-test regexp "ab c"
'("ab c"))
(rxt-match-test regexp "*** Failers" 'nil)
(rxt-match-test regexp "abc" 'nil)
(rxt-match-test regexp "ab cde" 'nil)))
(ert-deftest rxt-pcre-test-00038 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "(?x) ^ a (?# begins with a) b\\sc (?# then b c) $ (?# then end)" "")))
(rxt-match-test regexp "ab c"
'("ab c"))
(rxt-match-test regexp "*** Failers" 'nil)
(rxt-match-test regexp "abc" 'nil)
(rxt-match-test regexp "ab cde" 'nil)))
(ert-deftest rxt-pcre-test-00039 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^ a\\ b[c ]d $" "x")))
(rxt-match-test regexp "a bcd"
'("a bcd"))
(rxt-match-test regexp "a b d"
'("a b d"))
(rxt-match-test regexp "*** Failers" 'nil)
(rxt-match-test regexp "abcd" 'nil)
(rxt-match-test regexp "ab d" 'nil)))
(ert-deftest rxt-pcre-test-00040 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^(a(b(c)))(d(e(f)))(h(i(j)))(k(l(m)))$" "")))
(rxt-match-test regexp "abcdefhijklm"
'("abcdefhijklm" "abc" "bc" "c" "def" "ef" "f" "hij" "ij" "j" "klm" "lm" "m"))))
(ert-deftest rxt-pcre-test-00041 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^(?:a(b(c)))(?:d(e(f)))(?:h(i(j)))(?:k(l(m)))$" "")))
(rxt-match-test regexp "abcdefhijklm"
'("abcdefhijklm" "bc" "c" "ef" "f" "ij" "j" "lm" "m"))))
(ert-deftest rxt-pcre-test-00042 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^[\\w][\\W][\\s][\\S][\\d][\\D][\\b][\\n][\\c]][\\022]" "")))
(rxt-match-test regexp "a+ Z0+\n"
'("a+ Z0+\n"))))
(ert-deftest rxt-pcre-test-00043 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^[.^$|()*+?{,}]+" "")))
(rxt-match-test regexp ".^$(*+)|{?,?}"
'(".^$(*+)|{?,?}"))))
(ert-deftest rxt-pcre-test-00044 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^a*\\w" "")))
(rxt-match-test regexp "z"
'("z"))
(rxt-match-test regexp "az"
'("az"))
(rxt-match-test regexp "aaaz"
'("aaaz"))
(rxt-match-test regexp "a"
'("a"))
(rxt-match-test regexp "aa"
'("aa"))
(rxt-match-test regexp "aaaa"
'("aaaa"))
(rxt-match-test regexp "a+"
'("a"))
(rxt-match-test regexp "aa+"
'("aa"))))
(ert-deftest rxt-pcre-test-00045 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^a*?\\w" "")))
(rxt-match-test regexp "z"
'("z"))
(rxt-match-test regexp "az"
'("a"))
(rxt-match-test regexp "aaaz"
'("a"))
(rxt-match-test regexp "a"
'("a"))
(rxt-match-test regexp "aa"
'("a"))
(rxt-match-test regexp "aaaa"
'("a"))
(rxt-match-test regexp "a+"
'("a"))
(rxt-match-test regexp "aa+"
'("a"))))
(ert-deftest rxt-pcre-test-00046 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^a+\\w" "")))
(rxt-match-test regexp "az"
'("az"))
(rxt-match-test regexp "aaaz"
'("aaaz"))
(rxt-match-test regexp "aa"
'("aa"))
(rxt-match-test regexp "aaaa"
'("aaaa"))
(rxt-match-test regexp "aa+"
'("aa"))))
(ert-deftest rxt-pcre-test-00047 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^a+?\\w" "")))
(rxt-match-test regexp "az"
'("az"))
(rxt-match-test regexp "aaaz"
'("aa"))
(rxt-match-test regexp "aa"
'("aa"))
(rxt-match-test regexp "aaaa"
'("aa"))
(rxt-match-test regexp "aa+"
'("aa"))))
(ert-deftest rxt-pcre-test-00048 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^\\d{8}\\w{2,}" "")))
(rxt-match-test regexp "1234567890"
'("1234567890"))
(rxt-match-test regexp "12345678ab"
'("12345678ab"))
(rxt-match-test regexp "12345678__"
'("12345678__"))
(rxt-match-test regexp "*** Failers" 'nil)
(rxt-match-test regexp "1234567" 'nil)))
(ert-deftest rxt-pcre-test-00049 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^[aeiou\\d]{4,5}$" "")))
(rxt-match-test regexp "uoie"
'("uoie"))
(rxt-match-test regexp "1234"
'("1234"))
(rxt-match-test regexp "12345"
'("12345"))
(rxt-match-test regexp "aaaaa"
'("aaaaa"))
(rxt-match-test regexp "*** Failers" 'nil)
(rxt-match-test regexp "123456" 'nil)))
(ert-deftest rxt-pcre-test-00050 nil
:expected-result :failed
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^[aeiou\\d]{4,5}?" "")))
(rxt-match-test regexp "uoie"
'("uoie"))
(rxt-match-test regexp "1234"
'("1234"))
(rxt-match-test regexp "12345"
'("1234"))
(rxt-match-test regexp "aaaaa"
'("aaaa"))
(rxt-match-test regexp "123456"
'("1234"))))
(ert-deftest rxt-pcre-test-00051 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "\\A(abc|def)=(\\1){2,3}\\Z" "")))
(rxt-match-test regexp "abc=abcabc"
'("abc=abcabc" "abc" "abc"))
(rxt-match-test regexp "def=defdefdef"
'("def=defdefdef" "def" "def"))
(rxt-match-test regexp "*** Failers" 'nil)
(rxt-match-test regexp "abc=defdef" 'nil)))
(ert-deftest rxt-pcre-test-00052 nil
:expected-result :failed
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\\11*(\\3\\4)\\1(?#)2$" "")))
(rxt-match-test regexp "abcdefghijkcda2"
'("abcdefghijkcda2" "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "cd"))
(rxt-match-test regexp "abcdefghijkkkkcda2"
'("abcdefghijkkkkcda2" "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "cd"))))
(ert-deftest rxt-pcre-test-00053 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "(cat(a(ract|tonic)|erpillar)) \\1()2(3)" "")))
(rxt-match-test regexp "cataract cataract23"
'("cataract cataract23" "cataract" "aract" "ract" "" "3"))
(rxt-match-test regexp "catatonic catatonic23"
'("catatonic catatonic23" "catatonic" "atonic" "tonic" "" "3"))
(rxt-match-test regexp "caterpillar caterpillar23"
'("caterpillar caterpillar23" "caterpillar" "erpillar" nil "" "3"))))
(ert-deftest rxt-pcre-test-00054 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^From +([^ ]+) +[a-zA-Z][a-zA-Z][a-zA-Z] +[a-zA-Z][a-zA-Z][a-zA-Z] +[0-9]?[0-9] +[0-9][0-9]:[0-9][0-9]" "")))
(rxt-match-test regexp "From abcd Mon Sep 01 12:33:02 1997"
'("From abcd Mon Sep 01 12:33" "abcd"))))
(ert-deftest rxt-pcre-test-00055 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^From\\s+\\S+\\s+([a-zA-Z]{3}\\s+){2}\\d{1,2}\\s+\\d\\d:\\d\\d" "")))
(rxt-match-test regexp "From abcd Mon Sep 01 12:33:02 1997"
'("From abcd Mon Sep 01 12:33" "Sep "))
(rxt-match-test regexp "From abcd Mon Sep 1 12:33:02 1997"
'("From abcd Mon Sep 1 12:33" "Sep "))
(rxt-match-test regexp "*** Failers" 'nil)
(rxt-match-test regexp "From abcd Sep 01 12:33:02 1997" 'nil)))
(ert-deftest rxt-pcre-test-00056 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^12.34" "s")))
(rxt-match-test regexp "12\n34"
'("12\n34"))
(rxt-match-test regexp "12
34"
'("12
34"))))
(ert-deftest rxt-pcre-test-00057 nil
:expected-result :failed
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "\\w+(?=\\t)" "")))
(rxt-match-test regexp "the quick brown fox"
'("brown"))))
(ert-deftest rxt-pcre-test-00058 nil
:expected-result :failed
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "foo(?!bar)(.*)" "")))
(rxt-match-test regexp "foobar is foolish see?"
'("foolish see?" "lish see?"))))
(ert-deftest rxt-pcre-test-00059 nil
:expected-result :failed
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "(?:(?!foo)...|^.{0,2})bar(.*)" "")))
(rxt-match-test regexp "foobar crowbar etc"
'("rowbar etc" " etc"))
(rxt-match-test regexp "barrel"
'("barrel" "rel"))
(rxt-match-test regexp "2barrel"
'("2barrel" "rel"))
(rxt-match-test regexp "A barrel"
'("A barrel" "rel"))))
(ert-deftest rxt-pcre-test-00060 nil
:expected-result :failed
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^(\\D*)(?=\\d)(?!123)" "")))
(rxt-match-test regexp "abc456"
'("abc" "abc"))
(rxt-match-test regexp "*** Failers" 'nil)
(rxt-match-test regexp "abc123" 'nil)))
(ert-deftest rxt-pcre-test-00061 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^1234(?# test newlines\n inside)" "")))
(rxt-match-test regexp "1234"
'("1234"))))
(ert-deftest rxt-pcre-test-00062 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^1234 #comment in extended re\n " "x")))
(rxt-match-test regexp "1234"
'("1234"))))
(ert-deftest rxt-pcre-test-00063 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "#rhubarb\n abcd" "x")))
(rxt-match-test regexp "abcd"
'("abcd"))))
(ert-deftest rxt-pcre-test-00064 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^abcd#rhubarb" "x")))
(rxt-match-test regexp "abcd"
'("abcd"))))
(ert-deftest rxt-pcre-test-00065 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^(a)\\1{2,3}(.)" "")))
(rxt-match-test regexp "aaab"
'("aaab" "a" "b"))
(rxt-match-test regexp "aaaab"
'("aaaab" "a" "b"))
(rxt-match-test regexp "aaaaab"
'("aaaaa" "a" "a"))
(rxt-match-test regexp "aaaaaab"
'("aaaaa" "a" "a"))))
(ert-deftest rxt-pcre-test-00066 nil
:expected-result :failed
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "(?!^)abc" "")))
(rxt-match-test regexp "the abc"
'("abc"))
(rxt-match-test regexp "*** Failers" 'nil)
(rxt-match-test regexp "abc" 'nil)))
(ert-deftest rxt-pcre-test-00067 nil
:expected-result :failed
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "(?=^)abc" "")))
(rxt-match-test regexp "abc"
'("abc"))
(rxt-match-test regexp "*** Failers" 'nil)
(rxt-match-test regexp "the abc" 'nil)))
(ert-deftest rxt-pcre-test-00068 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^[ab]{1,3}(ab*|b)" "")))
(rxt-match-test regexp "aabbbbb"
'("aabb" "b"))))
(ert-deftest rxt-pcre-test-00069 nil
:expected-result :failed
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^[ab]{1,3}?(ab*|b)" "")))
(rxt-match-test regexp "aabbbbb"
'("aabbbbb" "abbbbb"))))
(ert-deftest rxt-pcre-test-00070 nil
:expected-result :failed
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^[ab]{1,3}?(ab*?|b)" "")))
(rxt-match-test regexp "aabbbbb"
'("aa" "a"))))
(ert-deftest rxt-pcre-test-00071 nil
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp "^[ab]{1,3}(ab*?|b)" "")))
(rxt-match-test regexp "aabbbbb"
'("aabb" "b"))))
(ert-deftest rxt-pcre-test-00072 nil
:expected-result :failed
(let*
((case-fold-search nil)
(regexp
(rxt-pcre-to-elisp " (?: [\\040\\t] | \\(\n(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n\\) )* # optional leading comment\n(?: (?:\n[^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]+ # some number of atom characters...\n(?![^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]) # ..not followed by something that could be part of an atom\n|\n\" (?: # opening quote...\n[^\\\\\\x80-\\xff\\n\\015\"] # Anything except backslash and quote\n| # or\n\\\\ [^\\x80-\\xff] # Escaped something (something != CR)\n)* \" # closing quote\n) # initial word\n(?: (?: [\\040\\t] | \\(\n(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n\\) )* \\. (?: [\\040\\t] | \\(\n(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n\\) )* (?:\n[^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]+ # some number of atom characters...\n(?![^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]) # ..not followed by something that could be part of an atom\n|\n\" (?: # opening quote...\n[^\\\\\\x80-\\xff\\n\\015\"] # Anything except backslash and quote\n| # or\n\\\\ [^\\x80-\\xff] # Escaped something (something != CR)\n)* \" # closing quote\n) )* # further okay, if led by a period\n(?: [\\040\\t] | \\(\n(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n\\) )* @ (?: [\\040\\t] | \\(\n(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n\\) )* (?:\n[^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]+ # some number of atom characters...\n(?![^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]) # ..not followed by something that could be part of an atom\n| \\[ # [\n(?: [^\\\\\\x80-\\xff\\n\\015\\[\\]] | \\\\ [^\\x80-\\xff] )* # stuff\n\\] # ]\n) # initial subdomain\n(?: #\n(?: [\\040\\t] | \\(\n(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n\\) )* \\. # if led by a period...\n(?: [\\040\\t] | \\(\n(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n\\) )* (?:\n[^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]+ # some number of atom characters...\n(?![^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]) # ..not followed by something that could be part of an atom\n| \\[ # [\n(?: [^\\\\\\x80-\\xff\\n\\015\\[\\]] | \\\\ [^\\x80-\\xff] )* # stuff\n\\] # ]\n) # ...further okay\n)*\n# address\n| # or\n(?:\n[^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]+ # some number of atom characters...\n(?![^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]) # ..not followed by something that could be part of an atom\n|\n\" (?: # opening quote...\n[^\\\\\\x80-\\xff\\n\\015\"] # Anything except backslash and quote\n| # or\n\\\\ [^\\x80-\\xff] # Escaped something (something != CR)\n)* \" # closing quote\n) # one word, optionally followed by....\n(?:\n[^()<>@,;:\".\\\\\\[\\]\\x80-\\xff\\000-\\010\\012-\\037] | # atom and space parts, or...\n\\(\n(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n\\) | # comments, or...\n\n\" (?: # opening quote...\n[^\\\\\\x80-\\xff\\n\\015\"] # Anything except backslash and quote\n| # or\n\\\\ [^\\x80-\\xff] # Escaped something (something != CR)\n)* \" # closing quote\n# quoted strings\n)*\n< (?: [\\040\\t] | \\(\n(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n\\) )* # leading <\n(?: @ (?: [\\040\\t] | \\(\n(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n\\) )* (?:\n[^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]+ # some number of atom characters...\n(?![^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]) # ..not followed by something that could be part of an atom\n| \\[ # [\n(?: [^\\\\\\x80-\\xff\\n\\015\\[\\]] | \\\\ [^\\x80-\\xff] )* # stuff\n\\] # ]\n) # initial subdomain\n(?: #\n(?: [\\040\\t] | \\(\n(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n\\) )* \\. # if led by a period...\n(?: [\\040\\t] | \\(\n(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n\\) )* (?:\n[^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]+ # some number of atom characters...\n(?![^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]) # ..not followed by something that could be part of an atom\n| \\[ # [\n(?: [^\\\\\\x80-\\xff\\n\\015\\[\\]] | \\\\ [^\\x80-\\xff] )* # stuff\n\\] # ]\n) # ...further okay\n)*\n\n(?: (?: [\\040\\t] | \\(\n(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n\\) )* , (?: [\\040\\t] | \\(\n(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n\\) )* @ (?: [\\040\\t] | \\(\n(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n\\) )* (?:\n[^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]+ # some number of atom characters...\n(?![^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]) # ..not followed by something that could be part of an atom\n| \\[ # [\n(?: [^\\\\\\x80-\\xff\\n\\015\\[\\]] | \\\\ [^\\x80-\\xff] )* # stuff\n\\] # ]\n) # initial subdomain\n(?: #\n(?: [\\040\\t] | \\(\n(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n\\) )* \\. # if led by a period...\n(?: [\\040\\t] | \\(\n(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n\\) )* (?:\n[^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]+ # some number of atom characters...\n(?![^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]) # ..not followed by something that could be part of an atom\n| \\[ # [\n(?: [^\\\\\\x80-\\xff\\n\\015\\[\\]] | \\\\ [^\\x80-\\xff] )* # stuff\n\\] # ]\n) # ...further okay\n)*\n)* # further okay, if led by comma\n: # closing colon\n(?: [\\040\\t] | \\(\n(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n\\) )* )? # optional route\n(?:\n[^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]+ # some number of atom characters...\n(?![^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]) # ..not followed by something that could be part of an atom\n|\n\" (?: # opening quote...\n[^\\\\\\x80-\\xff\\n\\015\"] # Anything except backslash and quote\n| # or\n\\\\ [^\\x80-\\xff] # Escaped something (something != CR)\n)* \" # closing quote\n) # initial word\n(?: (?: [\\040\\t] | \\(\n(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n\\) )* \\. (?: [\\040\\t] | \\(\n(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n\\) )* (?:\n[^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]+ # some number of atom characters...\n(?![^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]) # ..not followed by something that could be part of an atom\n|\n\" (?: # opening quote...\n[^\\\\\\x80-\\xff\\n\\015\"] # Anything except backslash and quote\n| # or\n\\\\ [^\\x80-\\xff] # Escaped something (something != CR)\n)* \" # closing quote\n) )* # further okay, if led by a period\n(?: [\\040\\t] | \\(\n(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n\\) )* @ (?: [\\040\\t] | \\(\n(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n\\) )* (?:\n[^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]+ # some number of atom characters...\n(?![^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]) # ..not followed by something that could be part of an atom\n| \\[ # [\n(?: [^\\\\\\x80-\\xff\\n\\015\\[\\]] | \\\\ [^\\x80-\\xff] )* # stuff\n\\] # ]\n) # initial subdomain\n(?: #\n(?: [\\040\\t] | \\(\n(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n\\) )* \\. # if led by a period...\n(?: [\\040\\t] | \\(\n(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n\\) )* (?:\n[^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]+ # some number of atom characters...\n(?![^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]) # ..not followed by something that could be part of an atom\n| \\[ # [\n(?: [^\\\\\\x80-\\xff\\n\\015\\[\\]] | \\\\ [^\\x80-\\xff] )* # stuff\n\\] # ]\n) # ...further okay\n)*\n# address spec\n(?: [\\040\\t] | \\(\n(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n\\) )* > # trailing >\n# name and address\n) (?: [\\040\\t] | \\(\n(?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] | \\( (?: [^\\\\\\x80-\\xff\\n\\015()] | \\\\ [^\\x80-\\xff] )* \\) )*\n\\) )* # optional trailing comment\n" "x")))
(rxt-match-test regexp "Alan Other "
'("Alan Other "))
(rxt-match-test regexp ""
'("user@dom.ain"))
(rxt-match-test regexp "user@dom.ain"
'("user@dom.ain"))
(rxt-match-test regexp "\"A. Other\" (a comment)"
'("\"A. Other\" (a comment)"))
(rxt-match-test regexp "A. Other (a comment)"
'(" Other (a comment)"))
(rxt-match-test regexp "\"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"@x400-re.lay"
'("\"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"@x400-re.lay"))
(rxt-match-test regexp "A missing angle @,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]+ # some number of atom characters...\n(?![^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]) # ..not followed by something that could be part of an atom\n# Atom\n| # or\n\" # \"\n[^\\\\\\x80-\\xff\\n\\015\"] * # normal\n(?: \\\\ [^\\x80-\\xff] [^\\\\\\x80-\\xff\\n\\015\"] * )* # ( special normal* )*\n\" # \"\n# Quoted string\n)\n[\\040\\t]* # Nab whitespace.\n(?:\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: # (\n(?: \\\\ [^\\x80-\\xff] |\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: \\\\ [^\\x80-\\xff] [^\\\\\\x80-\\xff\\n\\015()] * )* # (special normal*)*\n\\) # )\n) # special\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n)* # )*\n\\) # )\n[\\040\\t]* )* # If comment found, allow more spaces.\n(?:\n\\.\n[\\040\\t]* # Nab whitespace.\n(?:\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: # (\n(?: \\\\ [^\\x80-\\xff] |\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: \\\\ [^\\x80-\\xff] [^\\\\\\x80-\\xff\\n\\015()] * )* # (special normal*)*\n\\) # )\n) # special\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n)* # )*\n\\) # )\n[\\040\\t]* )* # If comment found, allow more spaces.\n(?:\n[^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]+ # some number of atom characters...\n(?![^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]) # ..not followed by something that could be part of an atom\n# Atom\n| # or\n\" # \"\n[^\\\\\\x80-\\xff\\n\\015\"] * # normal\n(?: \\\\ [^\\x80-\\xff] [^\\\\\\x80-\\xff\\n\\015\"] * )* # ( special normal* )*\n\" # \"\n# Quoted string\n)\n[\\040\\t]* # Nab whitespace.\n(?:\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: # (\n(?: \\\\ [^\\x80-\\xff] |\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: \\\\ [^\\x80-\\xff] [^\\\\\\x80-\\xff\\n\\015()] * )* # (special normal*)*\n\\) # )\n) # special\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n)* # )*\n\\) # )\n[\\040\\t]* )* # If comment found, allow more spaces.\n# additional words\n)*\n@\n[\\040\\t]* # Nab whitespace.\n(?:\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: # (\n(?: \\\\ [^\\x80-\\xff] |\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: \\\\ [^\\x80-\\xff] [^\\\\\\x80-\\xff\\n\\015()] * )* # (special normal*)*\n\\) # )\n) # special\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n)* # )*\n\\) # )\n[\\040\\t]* )* # If comment found, allow more spaces.\n(?:\n[^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]+ # some number of atom characters...\n(?![^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]) # ..not followed by something that could be part of an atom\n|\n\\[ # [\n(?: [^\\\\\\x80-\\xff\\n\\015\\[\\]] | \\\\ [^\\x80-\\xff] )* # stuff\n\\] # ]\n)\n[\\040\\t]* # Nab whitespace.\n(?:\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: # (\n(?: \\\\ [^\\x80-\\xff] |\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: \\\\ [^\\x80-\\xff] [^\\\\\\x80-\\xff\\n\\015()] * )* # (special normal*)*\n\\) # )\n) # special\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n)* # )*\n\\) # )\n[\\040\\t]* )* # If comment found, allow more spaces.\n# optional trailing comments\n(?:\n\\.\n[\\040\\t]* # Nab whitespace.\n(?:\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: # (\n(?: \\\\ [^\\x80-\\xff] |\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: \\\\ [^\\x80-\\xff] [^\\\\\\x80-\\xff\\n\\015()] * )* # (special normal*)*\n\\) # )\n) # special\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n)* # )*\n\\) # )\n[\\040\\t]* )* # If comment found, allow more spaces.\n(?:\n[^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]+ # some number of atom characters...\n(?![^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]) # ..not followed by something that could be part of an atom\n|\n\\[ # [\n(?: [^\\\\\\x80-\\xff\\n\\015\\[\\]] | \\\\ [^\\x80-\\xff] )* # stuff\n\\] # ]\n)\n[\\040\\t]* # Nab whitespace.\n(?:\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: # (\n(?: \\\\ [^\\x80-\\xff] |\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: \\\\ [^\\x80-\\xff] [^\\\\\\x80-\\xff\\n\\015()] * )* # (special normal*)*\n\\) # )\n) # special\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n)* # )*\n\\) # )\n[\\040\\t]* )* # If comment found, allow more spaces.\n# optional trailing comments\n)*\n# address\n| # or\n(?:\n[^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]+ # some number of atom characters...\n(?![^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]) # ..not followed by something that could be part of an atom\n# Atom\n| # or\n\" # \"\n[^\\\\\\x80-\\xff\\n\\015\"] * # normal\n(?: \\\\ [^\\x80-\\xff] [^\\\\\\x80-\\xff\\n\\015\"] * )* # ( special normal* )*\n\" # \"\n# Quoted string\n)\n# leading word\n[^()<>@,;:\".\\\\\\[\\]\\x80-\\xff\\000-\\010\\012-\\037] * # \"normal\" atoms and or spaces\n(?:\n(?:\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: # (\n(?: \\\\ [^\\x80-\\xff] |\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: \\\\ [^\\x80-\\xff] [^\\\\\\x80-\\xff\\n\\015()] * )* # (special normal*)*\n\\) # )\n) # special\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n)* # )*\n\\) # )\n|\n\" # \"\n[^\\\\\\x80-\\xff\\n\\015\"] * # normal\n(?: \\\\ [^\\x80-\\xff] [^\\\\\\x80-\\xff\\n\\015\"] * )* # ( special normal* )*\n\" # \"\n) # \"special\" comment or quoted string\n[^()<>@,;:\".\\\\\\[\\]\\x80-\\xff\\000-\\010\\012-\\037] * # more \"normal\"\n)*\n<\n[\\040\\t]* # Nab whitespace.\n(?:\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: # (\n(?: \\\\ [^\\x80-\\xff] |\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: \\\\ [^\\x80-\\xff] [^\\\\\\x80-\\xff\\n\\015()] * )* # (special normal*)*\n\\) # )\n) # special\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n)* # )*\n\\) # )\n[\\040\\t]* )* # If comment found, allow more spaces.\n# <\n(?:\n@\n[\\040\\t]* # Nab whitespace.\n(?:\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: # (\n(?: \\\\ [^\\x80-\\xff] |\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: \\\\ [^\\x80-\\xff] [^\\\\\\x80-\\xff\\n\\015()] * )* # (special normal*)*\n\\) # )\n) # special\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n)* # )*\n\\) # )\n[\\040\\t]* )* # If comment found, allow more spaces.\n(?:\n[^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]+ # some number of atom characters...\n(?![^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]) # ..not followed by something that could be part of an atom\n|\n\\[ # [\n(?: [^\\\\\\x80-\\xff\\n\\015\\[\\]] | \\\\ [^\\x80-\\xff] )* # stuff\n\\] # ]\n)\n[\\040\\t]* # Nab whitespace.\n(?:\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: # (\n(?: \\\\ [^\\x80-\\xff] |\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: \\\\ [^\\x80-\\xff] [^\\\\\\x80-\\xff\\n\\015()] * )* # (special normal*)*\n\\) # )\n) # special\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n)* # )*\n\\) # )\n[\\040\\t]* )* # If comment found, allow more spaces.\n# optional trailing comments\n(?:\n\\.\n[\\040\\t]* # Nab whitespace.\n(?:\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: # (\n(?: \\\\ [^\\x80-\\xff] |\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: \\\\ [^\\x80-\\xff] [^\\\\\\x80-\\xff\\n\\015()] * )* # (special normal*)*\n\\) # )\n) # special\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n)* # )*\n\\) # )\n[\\040\\t]* )* # If comment found, allow more spaces.\n(?:\n[^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]+ # some number of atom characters...\n(?![^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]) # ..not followed by something that could be part of an atom\n|\n\\[ # [\n(?: [^\\\\\\x80-\\xff\\n\\015\\[\\]] | \\\\ [^\\x80-\\xff] )* # stuff\n\\] # ]\n)\n[\\040\\t]* # Nab whitespace.\n(?:\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: # (\n(?: \\\\ [^\\x80-\\xff] |\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: \\\\ [^\\x80-\\xff] [^\\\\\\x80-\\xff\\n\\015()] * )* # (special normal*)*\n\\) # )\n) # special\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n)* # )*\n\\) # )\n[\\040\\t]* )* # If comment found, allow more spaces.\n# optional trailing comments\n)*\n(?: ,\n[\\040\\t]* # Nab whitespace.\n(?:\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: # (\n(?: \\\\ [^\\x80-\\xff] |\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: \\\\ [^\\x80-\\xff] [^\\\\\\x80-\\xff\\n\\015()] * )* # (special normal*)*\n\\) # )\n) # special\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n)* # )*\n\\) # )\n[\\040\\t]* )* # If comment found, allow more spaces.\n@\n[\\040\\t]* # Nab whitespace.\n(?:\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: # (\n(?: \\\\ [^\\x80-\\xff] |\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: \\\\ [^\\x80-\\xff] [^\\\\\\x80-\\xff\\n\\015()] * )* # (special normal*)*\n\\) # )\n) # special\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n)* # )*\n\\) # )\n[\\040\\t]* )* # If comment found, allow more spaces.\n(?:\n[^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]+ # some number of atom characters...\n(?![^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]) # ..not followed by something that could be part of an atom\n|\n\\[ # [\n(?: [^\\\\\\x80-\\xff\\n\\015\\[\\]] | \\\\ [^\\x80-\\xff] )* # stuff\n\\] # ]\n)\n[\\040\\t]* # Nab whitespace.\n(?:\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: # (\n(?: \\\\ [^\\x80-\\xff] |\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: \\\\ [^\\x80-\\xff] [^\\\\\\x80-\\xff\\n\\015()] * )* # (special normal*)*\n\\) # )\n) # special\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n)* # )*\n\\) # )\n[\\040\\t]* )* # If comment found, allow more spaces.\n# optional trailing comments\n(?:\n\\.\n[\\040\\t]* # Nab whitespace.\n(?:\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: # (\n(?: \\\\ [^\\x80-\\xff] |\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: \\\\ [^\\x80-\\xff] [^\\\\\\x80-\\xff\\n\\015()] * )* # (special normal*)*\n\\) # )\n) # special\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n)* # )*\n\\) # )\n[\\040\\t]* )* # If comment found, allow more spaces.\n(?:\n[^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]+ # some number of atom characters...\n(?![^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]) # ..not followed by something that could be part of an atom\n|\n\\[ # [\n(?: [^\\\\\\x80-\\xff\\n\\015\\[\\]] | \\\\ [^\\x80-\\xff] )* # stuff\n\\] # ]\n)\n[\\040\\t]* # Nab whitespace.\n(?:\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: # (\n(?: \\\\ [^\\x80-\\xff] |\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: \\\\ [^\\x80-\\xff] [^\\\\\\x80-\\xff\\n\\015()] * )* # (special normal*)*\n\\) # )\n) # special\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n)* # )*\n\\) # )\n[\\040\\t]* )* # If comment found, allow more spaces.\n# optional trailing comments\n)*\n)* # additional domains\n:\n[\\040\\t]* # Nab whitespace.\n(?:\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: # (\n(?: \\\\ [^\\x80-\\xff] |\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: \\\\ [^\\x80-\\xff] [^\\\\\\x80-\\xff\\n\\015()] * )* # (special normal*)*\n\\) # )\n) # special\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n)* # )*\n\\) # )\n[\\040\\t]* )* # If comment found, allow more spaces.\n# optional trailing comments\n)? # optional route\n(?:\n[^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]+ # some number of atom characters...\n(?![^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]) # ..not followed by something that could be part of an atom\n# Atom\n| # or\n\" # \"\n[^\\\\\\x80-\\xff\\n\\015\"] * # normal\n(?: \\\\ [^\\x80-\\xff] [^\\\\\\x80-\\xff\\n\\015\"] * )* # ( special normal* )*\n\" # \"\n# Quoted string\n)\n[\\040\\t]* # Nab whitespace.\n(?:\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: # (\n(?: \\\\ [^\\x80-\\xff] |\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: \\\\ [^\\x80-\\xff] [^\\\\\\x80-\\xff\\n\\015()] * )* # (special normal*)*\n\\) # )\n) # special\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n)* # )*\n\\) # )\n[\\040\\t]* )* # If comment found, allow more spaces.\n(?:\n\\.\n[\\040\\t]* # Nab whitespace.\n(?:\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: # (\n(?: \\\\ [^\\x80-\\xff] |\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: \\\\ [^\\x80-\\xff] [^\\\\\\x80-\\xff\\n\\015()] * )* # (special normal*)*\n\\) # )\n) # special\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n)* # )*\n\\) # )\n[\\040\\t]* )* # If comment found, allow more spaces.\n(?:\n[^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]+ # some number of atom characters...\n(?![^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]) # ..not followed by something that could be part of an atom\n# Atom\n| # or\n\" # \"\n[^\\\\\\x80-\\xff\\n\\015\"] * # normal\n(?: \\\\ [^\\x80-\\xff] [^\\\\\\x80-\\xff\\n\\015\"] * )* # ( special normal* )*\n\" # \"\n# Quoted string\n)\n[\\040\\t]* # Nab whitespace.\n(?:\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: # (\n(?: \\\\ [^\\x80-\\xff] |\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: \\\\ [^\\x80-\\xff] [^\\\\\\x80-\\xff\\n\\015()] * )* # (special normal*)*\n\\) # )\n) # special\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n)* # )*\n\\) # )\n[\\040\\t]* )* # If comment found, allow more spaces.\n# additional words\n)*\n@\n[\\040\\t]* # Nab whitespace.\n(?:\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: # (\n(?: \\\\ [^\\x80-\\xff] |\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: \\\\ [^\\x80-\\xff] [^\\\\\\x80-\\xff\\n\\015()] * )* # (special normal*)*\n\\) # )\n) # special\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n)* # )*\n\\) # )\n[\\040\\t]* )* # If comment found, allow more spaces.\n(?:\n[^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]+ # some number of atom characters...\n(?![^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]) # ..not followed by something that could be part of an atom\n|\n\\[ # [\n(?: [^\\\\\\x80-\\xff\\n\\015\\[\\]] | \\\\ [^\\x80-\\xff] )* # stuff\n\\] # ]\n)\n[\\040\\t]* # Nab whitespace.\n(?:\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: # (\n(?: \\\\ [^\\x80-\\xff] |\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: \\\\ [^\\x80-\\xff] [^\\\\\\x80-\\xff\\n\\015()] * )* # (special normal*)*\n\\) # )\n) # special\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n)* # )*\n\\) # )\n[\\040\\t]* )* # If comment found, allow more spaces.\n# optional trailing comments\n(?:\n\\.\n[\\040\\t]* # Nab whitespace.\n(?:\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: # (\n(?: \\\\ [^\\x80-\\xff] |\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: \\\\ [^\\x80-\\xff] [^\\\\\\x80-\\xff\\n\\015()] * )* # (special normal*)*\n\\) # )\n) # special\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n)* # )*\n\\) # )\n[\\040\\t]* )* # If comment found, allow more spaces.\n(?:\n[^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]+ # some number of atom characters...\n(?![^(\\040)<>@,;:\".\\\\\\[\\]\\000-\\037\\x80-\\xff]) # ..not followed by something that could be part of an atom\n|\n\\[ # [\n(?: [^\\\\\\x80-\\xff\\n\\015\\[\\]] | \\\\ [^\\x80-\\xff] )* # stuff\n\\] # ]\n)\n[\\040\\t]* # Nab whitespace.\n(?:\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: # (\n(?: \\\\ [^\\x80-\\xff] |\n\\( # (\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n(?: \\\\ [^\\x80-\\xff] [^\\\\\\x80-\\xff\\n\\015()] * )* # (special normal*)*\n\\) # )\n) # special\n[^\\\\\\x80-\\xff\\n\\015()] * # normal*\n)* # )*\n\\) # )\n[\\040\\t]* )* # If comment found, allow more spaces.\n# optional trailing comments\n)*\n# address spec\n> # >\n# name and address\n)\n" "x")))
(rxt-match-test regexp "Alan Other "
'("Alan Other "))
(rxt-match-test regexp ""
'("user@dom.ain"))
(rxt-match-test regexp "user@dom.ain"
'("user@dom.ain"))
(rxt-match-test regexp "\"A. Other\" (a comment)"
'("\"A. Other\" "))
(rxt-match-test regexp "A. Other (a comment)"
'(" Other "))
(rxt-match-test regexp "\"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"@x400-re.lay"
'("\"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"@x400-re.lay"))
(rxt-match-test regexp "A missing angle