emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/d-mode 447515f 327/346: Merge pull request #93 from CyberS


From: ELPA Syncer
Subject: [nongnu] elpa/d-mode 447515f 327/346: Merge pull request #93 from CyberShadow/next
Date: Sun, 29 Aug 2021 11:00:54 -0400 (EDT)

branch: elpa/d-mode
commit 447515fdf36ee06ea3c214f519d29fb5d2f6ab3f
Merge: cfd1d08 6624fcb
Author: Vladimir Panteleev <CyberShadow@users.noreply.github.com>
Commit: GitHub <noreply@github.com>

    Merge pull request #93 from CyberShadow/next
    
    Major revision (complete overhaul of nearly everything)
---
 .gitignore                           |    1 +
 .travis.yml                          |   14 +-
 COPYING                              |  674 ++++++++++++++
 Cask                                 |    3 +-
 Makefile                             |   27 +-
 README.md                            |    5 +-
 coverage/.gitignore                  |    1 +
 coverage/undercover.el               |  564 +++++++++++
 d-mode-test.el                       |  156 ++--
 d-mode.el                            | 1694 +++++++++++++++++++++++++++-------
 gplv2.txt                            |  339 -------
 tests-todo/templated_enum.d          |   11 +
 tests/I0019.d                        |    8 +
 tests/I0030.d.html                   |    2 +-
 tests/I0054.d                        |   20 +
 tests/I0054.d.html                   |   20 +
 tests/I0058.d                        |   39 +
 tests/I0067.d                        |   19 +
 tests/I0070.d                        |    6 +
 tests/I0082.d                        |    9 +
 tests/I0082.d.html                   |    9 +
 tests/{fonts.d => I0090.d}           |    2 +-
 tests/I0090.d.html                   |    6 +
 tests/I0093_35907724.d               |    4 +
 tests/I0093_35907724.d.html          |    4 +
 tests/{fonts.d => I0093_541009399.d} |    5 +-
 tests/I0093_541009399.d.html         |    7 +
 tests/{fonts.d => I0093_546738540.d} |    3 +-
 tests/I0093_546738540.d.html         |    5 +
 tests/{fonts.d => I0093_552200397.d} |    6 +-
 tests/I0093_552200397.d.html         |    4 +
 tests/I0093_572717721.d              |    4 +
 tests/I0093_572717721.d.html         |    4 +
 tests/I0095.d                        |    9 +
 tests/I0095.d.html                   |    9 +
 tests/fonts.d                        |   62 ++
 tests/fonts.d.html                   |   62 ++
 tests/fonts_auto.d                   |   15 +
 tests/fonts_auto.d.html              |   15 +
 tests/fonts_enums.d                  |   22 +
 tests/fonts_enums.d.html             |   22 +
 tests/fonts_params.d                 |   24 +
 tests/fonts_params.d.html            |   24 +
 tests/fonts_protection.d             |   10 +
 tests/fonts_protection.d.html        |   11 +
 tests/fonts_types.d                  |   15 +
 tests/fonts_types.d.html             |   15 +
 tests/imenu.d                        |   31 +-
 tests/imenu2.d                       |   58 ++
 tests/indent_protection.d            |    8 +
 50 files changed, 3335 insertions(+), 752 deletions(-)

diff --git a/.gitignore b/.gitignore
index 1304fa2..9e02930 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
 *.elc
 /.cask/
+/tests/*.res.*
diff --git a/.travis.yml b/.travis.yml
index 236f500..0ceab33 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -10,15 +10,18 @@ matrix:
   allow_failures:
     - env: EMACS_VERSION=snapshot
 env:
-  - EMACS_VERSION=24.3
-  - EMACS_VERSION=24.5
   - EMACS_VERSION=25.1
+  - EMACS_VERSION=25.2
+  - EMACS_VERSION=25.3
+  - EMACS_VERSION=26.1
+  - EMACS_VERSION=26.2
+  - EMACS_VERSION=26.3
   - EMACS_VERSION=snapshot
 before_install:
   # Configure $PATH: Executables are installed to $HOME/bin
   - export PATH="$HOME/bin:$PATH"
   # Download the makefile to emacs-travis.mk
-  - wget 
'https://raw.githubusercontent.com/flycheck/emacs-travis/master/emacs-travis.mk'
+  - wget 
'https://raw.githubusercontent.com/CyberShadow/emacs-travis/patch-1/emacs-travis.mk'
   # Install Emacs (according to $EMACS_VERSION) and Cask
   - make -f emacs-travis.mk install_emacs
   - make -f emacs-travis.mk install_cask
@@ -27,5 +30,6 @@ install:
 script:
   # cask exec ert-runner
   - emacs --version
-  - make compile
-  - make test
+  - COVERALLS_PARALLEL=1 make test
+notifications:
+  webhooks: https://coveralls.io/webhook
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..f288702
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,674 @@
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
+ 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.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    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 <https://www.gnu.org/licenses/>.
+
+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:
+
+    <program>  Copyright (C) <year>  <name of author>
+    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
+<https://www.gnu.org/licenses/>.
+
+  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
+<https://www.gnu.org/licenses/why-not-lgpl.html>.
diff --git a/Cask b/Cask
index 5336cec..ef8cc9c 100644
--- a/Cask
+++ b/Cask
@@ -2,4 +2,5 @@
 (source melpa)
 
 (development
- (depends-on "undercover"))
+ (depends-on "dash")
+ (depends-on "shut-up"))
diff --git a/Makefile b/Makefile
index a51239f..3f70f0c 100644
--- a/Makefile
+++ b/Makefile
@@ -1,13 +1,32 @@
 emacs ?= emacs
 all: test
 
-test: clean
-       cask exec emacs -Q -batch -l d-mode-test.el -l d-mode.el -f 
ert-run-tests-batch-and-exit
+test: test-source test-compiled
+
+test-source: clean
+       cask exec emacs -Q -batch -l d-mode-test.el -l d-mode.el  -f 
ert-run-tests-batch-and-exit
+
+test-compiled: compile
+       D_MODE_NO_COVERAGE=1 cask exec emacs -Q -batch -l d-mode-test.el -l 
d-mode.elc -f ert-run-tests-batch-and-exit
+
+# Generate a coverage report viewable in Emacs.
+coverage: clean
+       rm -f d-mode.elc
+       D_MODE_COVERAGE=1 cask exec emacs -Q -batch -l d-mode-test.el -l 
d-mode.el  -f ert-run-tests-batch-and-exit
 
 compile:
-       $(emacs) -Q -batch -f batch-byte-compile d-mode.el
+       $(emacs) -Q -batch --eval '(setq byte-compile-error-on-warn t)' -f 
batch-byte-compile d-mode.el
 
 clean:
        rm -f d-mode.elc
+       find tests -name '*.res.*' -delete
+
+# Show just the differences between the actual and expected results.
+test-diff:
+       for f in tests/*.res.* ; do diff --color -u "$${f/.res/}" "$$f" ; done
+
+# Accept any mismatching actual output as the expected output.
+test-accept:
+       for f in tests/*.res.* ; do mv "$$f" "$${f/.res/}" ; done
 
-.PHONY:        all test
+.PHONY:        all test compile clean test-diff test-accept
diff --git a/README.md b/README.md
index d5fe2bd..b390766 100644
--- a/README.md
+++ b/README.md
@@ -8,9 +8,10 @@
 
 An Emacs major mode for editing D code.
 
-This mode is currently known to work with Emacs 24 and 25.
+This mode is currently known to work with Emacs 25 and 26.
+For best results, use Emacs 26.
 
-The best way of installing this major mode, at least for Emacs 24, is to use 
the packaging system. Add MELPA
+The best way of installing this major mode, at least for Emacs 26, is to use 
the packaging system. Add MELPA
 or MELPA Stable to the list of repositories to access this mode. For those who 
want only formal, tagged
 releases use MELPA Stable:
 
diff --git a/coverage/.gitignore b/coverage/.gitignore
new file mode 100644
index 0000000..f57d528
--- /dev/null
+++ b/coverage/.gitignore
@@ -0,0 +1 @@
+/.resultset.json*
diff --git a/coverage/undercover.el b/coverage/undercover.el
new file mode 100644
index 0000000..afd6624
--- /dev/null
+++ b/coverage/undercover.el
@@ -0,0 +1,564 @@
+;;; undercover.el --- Test coverage library for Emacs Lisp -*- 
lexical-binding: t -*-
+
+;; Copyright (c) 2014 Sviridov Alexander
+
+;; Author: Sviridov Alexander <sviridov.vmi@gmail.com>
+;; URL: https://github.com/sviridov/undercover.el
+;; Created: Sat Sep 27 2014
+;; Keywords: lisp, tests, coverage, tools
+;; Version: 0.6.1
+;; Package-Requires: ((emacs "24") (dash "2.0.0") (shut-up "0.3.2"))
+
+;;; Commentary:
+
+;; Provides a test coverage tools for Emacs packages.
+
+;;; Code:
+
+(eval-when-compile (require 'cl))
+
+(require 'edebug)
+(require 'json)
+(require 'dash)
+(require 'shut-up)
+
+(defconst undercover-version "0.6.1")
+
+(defvar undercover-force-coverage nil
+  "Always collect test coverage.
+
+If nil, test coverage will be collected only when running under a
+continuous integration service.
+
+Can also be set through the environment, by defining UNDERCOVER_FORCE.")
+(setq undercover-force-coverage (getenv "UNDERCOVER_FORCE"))
+
+(defvar undercover--report-format nil
+  "Indicates the format of the report file and CI service to submit to.
+
+If nil, autodetect from CI environment.")
+
+(defvar undercover--send-report t
+  "If not nil, test coverage report will be sent to coveralls.io.")
+
+(defvar undercover--report-file-path "/tmp/undercover_coveralls_report"
+  "Path to save coveralls.io report.")
+
+(defvar undercover--files nil
+  "List of files for test coverage check.")
+
+(defvar undercover--files-coverage-statistics (make-hash-table :test 'equal)
+  "Table of coverage statistics for each file in `undercover--files'.")
+
+(defvar undercover--old-edebug-make-form-wrapper
+  (symbol-function 'edebug-make-form-wrapper))
+
+;; Utilities
+
+(defun undercover--fill-hash-table (hash-table &rest keys-and-values)
+  "Fill HASH-TABLE from KEYS-AND-VALUES."
+  (loop for (key value) on keys-and-values by #'cddr
+        do (puthash key value hash-table))
+  hash-table)
+
+(defun undercover--make-hash-table (&rest keys-and-values)
+  "Create new hash-table and fill it from KEYS-AND-VALUES."
+  (apply #'undercover--fill-hash-table (make-hash-table :test 'equal) 
keys-and-values))
+
+(defun undercover--wildcards-to-files (wildcards)
+  "Return list of files matched by WILDCARDS.
+Example of WILDCARDS: (\"*.el\" \"subdir/*.el\" (:exclude \"exclude-*.el\"))."
+  (destructuring-bind (exclude-clauses include-wildcards)
+      (--separate (and (consp it) (eq :exclude (car it))) wildcards)
+    (let* ((exclude-wildcards (-mapcat #'cdr exclude-clauses))
+           (exclude-files (-mapcat #'file-expand-wildcards exclude-wildcards))
+           (include-files (-mapcat #'file-expand-wildcards include-wildcards)))
+      (-difference include-files exclude-files))))
+
+;; `edebug' related functions and hacks:
+
+;; http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6415
+(def-edebug-spec cl-destructuring-bind (sexp form body))
+(def-edebug-spec destructuring-bind (sexp form body))
+
+(def-edebug-spec cl-symbol-macrolet ((&rest (symbolp sexp)) cl-declarations 
body))
+(def-edebug-spec symbol-macrolet ((&rest (symbolp sexp)) cl-declarations body))
+
+(def-edebug-spec cl-type-spec sexp)
+
+(def-edebug-spec when-let ([&or (symbolp form) (&rest (symbolp form))] body))
+
+(defun undercover--fallback-file-handler (operation args)
+  "Handle any file OPERATION with ARGS."
+  (let ((inhibit-file-name-handlers
+         (cons 'undercover-file-handler
+               (and (eq inhibit-file-name-operation operation)
+                    inhibit-file-name-handlers)))
+        (inhibit-file-name-operation operation))
+    (apply operation args)))
+
+(defun undercover--load-file-handler (file)
+  "Handle `load' FILE operation."
+  (let ((edebug-all-defs (undercover--coverage-enabled-p))
+        (load-file-name (file-truename file))
+        (load-in-progress t))
+    (unwind-protect
+        (progn
+          (save-excursion (eval-buffer (find-file load-file-name)))
+          (push load-file-name undercover--files))
+      (switch-to-buffer (current-buffer)))))
+
+(defun undercover--show-load-file-error (filename)
+  (message "UNDERCOVER: error while covering %s" filename)
+  (message "UNDERCOVER: please open a new issue at 
https://github.com/sviridov/undercover.el/issues";))
+
+(defun undercover-file-handler (operation &rest args)
+  "Handle `load' OPERATION.  Ignore all ARGS except first."
+  (if (eq 'load operation)
+      (condition-case nil
+          (undercover--load-file-handler (car args))
+        (error
+         (undercover--show-load-file-error (car args))
+         (undercover--fallback-file-handler operation args)))
+    (undercover--fallback-file-handler operation args)))
+
+(defun undercover--edebug-files (files)
+  "Use `edebug' package to instrument all macros and functions in FILES."
+  (when files
+    (let ((regexp (->> files (regexp-opt) (format "/%s$"))))
+      (add-to-list 'file-name-handler-alist (cons regexp 
'undercover-file-handler)))))
+
+(setf (symbol-function 'undercover--stop-point-before)
+      (lambda (before-index)
+        "Increase number of times that stop point at BEFORE-INDEX was covered."
+        (when (boundp 'edebug-freq-count)
+          (incf (aref edebug-freq-count before-index)))
+        before-index))
+
+(setf (symbol-function 'undercover--stop-point-after)
+      (cons 'macro
+        (lambda (before-index after-index form)
+          "Increase number of times that stop point at AFTER-INDEX was 
covered."
+         `(let ((before-index ,before-index)
+                (after-index ,after-index))
+            (unwind-protect ,form
+              (when (boundp 'edebug-freq-count)
+                (aset edebug-freq-count after-index (+ 1 (aref 
edebug-freq-count after-index)))
+                (undercover--align-counts-between-stop-points before-index 
after-index)))))))
+
+(setf (symbol-function 'undercover--align-counts-between-stop-points)
+      (lambda (before-index after-index)
+        "Decrease number of times that stop points between BEFORE-INDEX and 
AFTER-INDEX are covered."
+        (do ((index (1+ before-index) (1+ index)))
+            ((>= index after-index))
+          (setf (aref edebug-freq-count index)
+                (min (aref edebug-freq-count index)
+                     (aref edebug-freq-count before-index))))))
+
+(defun undercover--stop-points (name)
+  "Return stop points ordered by position for NAME."
+  (append (nth 2 (get name 'edebug)) nil))
+
+(defun undercover--stop-points-covers (name)
+  "Return number of covers for each stop point ordered by position for NAME."
+  (append (get name 'edebug-freq-count) nil))
+
+(defun undercover--shut-up-edebug-message ()
+  "Muffle `edebug' message \"EDEBUG: function\"."
+  ;; HACK: I don't use `defadvice' because of cryptic error with 
`shut-up-sink'.
+  ;; https://travis-ci.org/sviridov/multiple-cursors.el/builds/37529750#L1387
+  ;; https://travis-ci.org/sviridov/expand-region.el/builds/37576813#L285
+  (setf (symbol-function 'edebug-make-form-wrapper)
+        (lambda (&rest args)
+          (shut-up (apply undercover--old-edebug-make-form-wrapper args)))))
+
+(defun undercover--set-edebug-handlers ()
+  "Replace and advice some `edebug' functions with `undercover' handlers."
+  (defalias 'edebug-before 'undercover--stop-point-before)
+  (defalias 'edebug-after 'undercover--stop-point-after)
+  (undercover--shut-up-edebug-message)
+  ;; HACK: Ensures that debugger is turned off.
+  ;; https://travis-ci.org/sviridov/multiple-cursors.el/builds/37672312#L350
+  ;; https://travis-ci.org/sviridov/expand-region.el/builds/37577423#L336
+  (setq debug-on-error  nil
+        debug-on-signal nil
+        edebug-on-error nil))
+
+;; Coverage statistics related functions:
+
+(defun undercover--symbol-coverage-statistics (edebug-symbol statistics)
+  "Collect coverage statistics for EDEBUG-SYMBOL into STATISTICS hash."
+  (let* ((start-marker (car (get edebug-symbol 'edebug)))
+         (points (undercover--stop-points edebug-symbol))
+         (points-covers (undercover--stop-points-covers edebug-symbol))
+         (points-and-covers (map 'list #'cons points points-covers)))
+    (dolist (point-and-cover points-and-covers)
+      (let* ((point (car point-and-cover))
+             (line  (line-number-at-pos (+ point start-marker)))
+             (cover (cdr point-and-cover))
+             (previous-score (gethash line statistics cover))
+             (new-score (min previous-score cover)))
+        (puthash line new-score statistics)))))
+
+(defun undercover--file-coverage-statistics ()
+  "Collect coverage statistics for current-file into hash.
+Keys of that hash are line numbers.
+Values of that hash are number of covers."
+  (let ((statistics (make-hash-table)))
+    (dolist (edebug-data edebug-form-data)
+      (let ((edebug-symbol (car edebug-data)))
+        (when (get edebug-symbol 'edebug)
+          (undercover--symbol-coverage-statistics edebug-symbol statistics))))
+    statistics))
+
+(defun undercover--collect-file-coverage (file)
+  "Collect coverage statistics for FILE."
+  (save-excursion
+    (find-file file)
+    (if edebug-form-data
+        (undercover--fill-hash-table undercover--files-coverage-statistics
+          file (undercover--file-coverage-statistics))
+      (setq undercover--files (delq file undercover--files)))))
+
+(defun undercover--collect-files-coverage (files)
+  "Collect coverage statistics for each file in FILES."
+  (dolist (file files)
+    (undercover--collect-file-coverage file)))
+
+;; Continuous integration related functions:
+
+(defun undercover--under-travic-ci-p ()
+  "Check that `undercover' running under Travis CI service."
+  (getenv "TRAVIS"))
+
+(defun undercover--coveralls-repo-token ()
+  "Return coveralls.io repo token provided by user."
+  (getenv "COVERALLS_REPO_TOKEN"))
+
+(defun undercover--under-ci-p ()
+  "Check that `undercover' running under continuous integration service."
+  (or
+   (undercover--coveralls-repo-token)
+   (undercover--under-travic-ci-p)
+   undercover-force-coverage))
+
+;;; Reports related functions:
+
+(defun undercover--determine-report-format ()
+  "Automatic report-format determination."
+  (and (undercover--under-ci-p) 'coveralls))
+
+(defun undercover--get-git-info (&rest args)
+  "Execute Git with ARGS, returning the first line of its output."
+  (with-temp-buffer
+    (apply #'process-file "git" nil t nil "--no-pager" args)
+    (goto-char (point-min))
+    (buffer-substring-no-properties
+     (line-beginning-position)
+     (line-end-position))))
+
+(defun undercover--get-git-info-from-log (format)
+  "Get first line of Git log in given FORMAT."
+  (undercover--get-git-info "log" "-1" (format "--pretty=format:%%%s" format)))
+
+(defun undercover--get-git-remotes ()
+  "Return list of Git remotes."
+  (with-temp-buffer
+    (process-file "git" nil t nil "--no-pager" "remote")
+    (let ((remotes (split-string (buffer-string) "\n" t))
+          (config-path-format (format "remote.%%s.url"))
+          (remotes-info nil))
+      (dolist (remote remotes remotes-info)
+        (let* ((remote-url (undercover--get-git-info "config" (format 
config-path-format remote)))
+               (remote-table (undercover--make-hash-table
+                              "name" remote
+                              "url"  remote-url)))
+          (push remote-table remotes-info))))))
+
+;; coveralls.io report:
+
+(defun undercover--update-coveralls-report-with-repo-token (report)
+  "Update test coverage REPORT for coveralls.io with repository token."
+  (puthash "repo_token" (undercover--coveralls-repo-token) report))
+
+(defun undercover--try-update-coveralls-report-with-shippable (report)
+  "Update test coverage REPORT for coveralls.io with Shippable service 
information."
+  (when (getenv "SHIPPABLE")
+    (undercover--fill-hash-table report
+      "service_name"   "shippable"
+      "service_job_id" (getenv "BUILD_NUMBER"))
+    (unless (string-equal "false" (getenv "PULL_REQUEST"))
+      (undercover--fill-hash-table report
+        "service_pull_request" (getenv "PULL_REQUEST")))))
+
+(defun undercover--update-coveralls-report-with-travis-ci (report)
+  "Update test coverage REPORT for coveralls.io with Travis CI service 
information."
+  (undercover--fill-hash-table report
+    "service_name"   "travis-ci"
+    "service_job_id" (getenv "TRAVIS_JOB_ID")))
+
+(defun undercover--update-coveralls-report-with-git (report)
+  "Update test coverage REPORT for coveralls.io with Git information."
+  (undercover--fill-hash-table report
+    "git" (undercover--make-hash-table
+           "branch"  (undercover--get-git-info "rev-parse" "--abbrev-ref" 
"HEAD")
+           "remotes" (undercover--get-git-remotes)
+           "head"    (undercover--make-hash-table
+                      "id"              (undercover--get-git-info-from-log "H")
+                      "author_name"     (undercover--get-git-info-from-log 
"aN")
+                      "author_email"    (undercover--get-git-info-from-log 
"ae")
+                      "committer_name"  (undercover--get-git-info-from-log 
"cN")
+                      "committer_email" (undercover--get-git-info-from-log 
"ce")
+                      "message"         (undercover--get-git-info-from-log 
"s")))))
+
+(defun undercover--coveralls-file-coverage-report (statistics)
+  "Translate file coverage STATISTICS into coveralls.io format."
+  (let (file-coverage)
+    (dotimes (line (count-lines (point-min) (point-max)))
+      (push (gethash (1+ line) statistics) file-coverage))
+    (nreverse file-coverage)))
+
+(defun undercover--coveralls-file-report (file)
+  "Create part of coveralls.io report for FILE."
+  (save-excursion
+    (find-file file)
+    (let ((file-name (file-relative-name file (locate-dominating-file 
default-directory ".git")))
+          (file-content (buffer-substring-no-properties (point-min) 
(point-max)))
+          (coverage-report (undercover--coveralls-file-coverage-report
+                            (gethash file 
undercover--files-coverage-statistics))))
+      (undercover--make-hash-table
+       "name"     file-name
+       "source"   file-content
+       "coverage" coverage-report))))
+
+(defun undercover--fill-coveralls-report (report)
+  "Fill test coverage REPORT for coveralls.io."
+  (undercover--fill-hash-table report
+    "source_files" (mapcar #'undercover--coveralls-file-report 
undercover--files)
+    "parallel" (if (getenv "COVERALLS_PARALLEL") t json-false)))
+
+(defun undercover--merge-coveralls-report-file-lines-coverage (old-coverage 
new-coverage)
+  "Merge test coverage for lines from OLD-COVERAGE and NEW-COVERAGE."
+  (loop for (old-line-coverage . new-line-coverage)
+        in (-zip-fill 0 old-coverage new-coverage)
+        collect (cond
+                 ((null old-line-coverage) new-line-coverage)
+                 ((null new-line-coverage) old-line-coverage)
+                 (t (+ new-line-coverage old-line-coverage)))))
+
+(defun undercover--merge-coveralls-report-file-coverage (old-file-hash 
source-files-report)
+  "Merge test coverage from OLD-FILE-HASH into SOURCE-FILES-REPORT."
+  (let* ((file-name (gethash "name" old-file-hash))
+         (old-coverage (gethash "coverage" old-file-hash))
+         (new-file-hash (--first (string-equal file-name (gethash "name" it))
+                                 source-files-report)))
+    (if new-file-hash
+        (undercover--fill-hash-table new-file-hash
+          "coverage" (undercover--merge-coveralls-report-file-lines-coverage
+                      old-coverage (gethash "coverage" new-file-hash)))
+      (rplacd (last source-files-report)
+              (cons old-file-hash nil)))))
+
+(defun undercover--merge-coveralls-reports (report)
+  "Merge test coverage REPORT with existing from 
`undercover--report-file-path'."
+  (ignore-errors
+    (let* ((json-object-type 'hash-table)
+           (json-array-type 'list)
+           (old-report (json-read-file undercover--report-file-path))
+           (new-source-files-report (gethash "source_files" report)))
+      (dolist (old-file-hash (gethash "source_files" old-report))
+        (undercover--merge-coveralls-report-file-coverage
+         old-file-hash new-source-files-report)))))
+
+(defun undercover--create-coveralls-report ()
+  "Create test coverage report for coveralls.io."
+  (undercover--collect-files-coverage undercover--files)
+  (let ((report (make-hash-table :test 'equal)))
+    (cond
+     ((undercover--coveralls-repo-token)
+      (undercover--update-coveralls-report-with-repo-token report)
+      (undercover--try-update-coveralls-report-with-shippable report))
+     ((undercover--under-travic-ci-p) 
(undercover--update-coveralls-report-with-travis-ci report))
+     (t (unless undercover-force-coverage
+          (error "Unsupported coveralls.io report"))))
+    (undercover--update-coveralls-report-with-git report)
+    (undercover--fill-coveralls-report report)
+    (undercover--merge-coveralls-reports report)
+    (json-encode report)))
+
+(defun undercover--save-coveralls-report (json-report)
+  "Save JSON-REPORT to `undercover--report-file-path'."
+  (save-excursion
+    (shut-up
+      (find-file undercover--report-file-path)
+      (erase-buffer)
+      (insert json-report)
+      (save-buffer))))
+
+(defun undercover--send-coveralls-report ()
+  "Send report to coveralls.io."
+  (let ((coveralls-url "https://coveralls.io/api/v1/jobs";))
+    (message "Sending: report to coveralls.io")
+    (shut-up
+     (shell-command
+      (format "curl -v --include --form json_file=@%s %s" 
undercover--report-file-path coveralls-url)))
+    (message "Sending: OK")))
+
+(defun undercover--coveralls-report ()
+  "Create and submit test coverage report to coveralls.io."
+  (undercover--save-coveralls-report (undercover--create-coveralls-report))
+  (when undercover--send-report
+    (undercover--send-coveralls-report)))
+
+;; SimpleCov report:
+
+(defconst undercover--simplecov-report-name "undercover.el"
+  "The name of the generated result in the SimpleCov result set report.")
+
+(defalias 'undercover--simplecov-file-coverage-report
+  #'undercover--coveralls-file-coverage-report
+  "Translate file coverage STATISTICS into SimpleCov format (same as 
coveralls.io).")
+
+(defalias 'undercover--merge-simplecov-report-file-lines-coverage
+  #'undercover--merge-coveralls-report-file-lines-coverage)
+
+(defun undercover--simplecov-file-report (file)
+  "Create part of SimpleCov report for FILE."
+  (save-excursion
+    (find-file file)
+    (list file (undercover--simplecov-file-coverage-report
+                (gethash file undercover--files-coverage-statistics)))))
+
+(defun undercover--fill-simplecov-report (report)
+  "Fill SimpleCov test coverage REPORT."
+  (undercover--fill-hash-table report
+    undercover--simplecov-report-name
+    (undercover--make-hash-table
+     "timestamp" (truncate (time-to-seconds))
+     "coverage" (apply #'undercover--make-hash-table
+                       (apply #'append
+                              (mapcar #'undercover--simplecov-file-report
+                                      undercover--files))))))
+
+(defun undercover--merge-simplecov-report-file-coverage (old-coverage 
file-name new-file-coverage)
+  "Merge into OLD-COVERAGE the FILE-NAME's coverage data NEW-FILE-COVERAGE."
+  (let ((old-file-coverage (gethash file-name old-coverage)))
+    (puthash file-name
+             (if old-file-coverage
+                 (undercover--merge-simplecov-report-file-lines-coverage
+                  old-file-coverage
+                  new-file-coverage)
+               new-file-coverage)
+             old-coverage)))
+
+(defun undercover--merge-simplecov-reports (report)
+  "Merge test coverage REPORT with existing from 
`undercover--report-file-path'."
+  (if (file-readable-p undercover--report-file-path)
+      (let* ((json-object-type 'hash-table)
+             (json-array-type 'list)
+             (old-report (json-read-file undercover--report-file-path))
+             (old-coverage
+              (gethash "coverage" (gethash undercover--simplecov-report-name 
old-report)))
+             (new-coverage
+              (gethash "coverage" (gethash undercover--simplecov-report-name 
report))))
+        (maphash
+         (lambda (name new-file-coverage)
+           (undercover--merge-simplecov-report-file-coverage old-coverage name 
new-file-coverage))
+         new-coverage)
+        old-report)
+    report))
+
+(defun undercover--create-simplecov-report ()
+  "Create SimpleCov test coverage report."
+  (undercover--collect-files-coverage undercover--files)
+  (let ((report (make-hash-table :test 'equal)))
+    (undercover--fill-simplecov-report report)
+    (undercover--merge-simplecov-reports report)
+    (json-encode report)))
+
+(defun undercover--save-simplecov-report (json-report)
+  "Save JSON-REPORT to `undercover--report-file-path'."
+  (with-temp-buffer
+    (insert json-report)
+    (write-region nil nil undercover--report-file-path)))
+
+(defun undercover--simplecov-report ()
+  "Create test coverage report in SimpleCov format."
+  (undercover--save-simplecov-report (undercover--create-simplecov-report)))
+
+;; `ert-runner' related functions:
+
+(defun undercover-safe-report ()
+  "Version of `undercover-report' that ignore errors."
+  (with-demoted-errors
+    (undercover-report)))
+
+(defun undercover-report-on-kill ()
+  "Add `undercover-safe-report' to `kill-emacs-hook'."
+  (add-hook 'kill-emacs-hook 'undercover-safe-report))
+
+;;; Main functions:
+
+(defun undercover--coverage-enabled-p ()
+  "Check that `undercover' is enabled."
+  (or undercover-force-coverage (undercover--under-ci-p)))
+
+(defun undercover-report (&optional report-format)
+  "Create and submit (if needed) test coverage report based on REPORT-FORMAT.
+Posible values of REPORT-FORMAT: coveralls."
+  (if undercover--files
+    (case (or report-format undercover--report-format 
(undercover--determine-report-format))
+      (coveralls (undercover--coveralls-report))
+      (simplecov (undercover--simplecov-report))
+      (t (error "Unsupported report-format")))
+    (message
+     "UNDERCOVER: No coverage information. Make sure that your files are not 
compiled?")))
+
+(defun undercover--env-configuration ()
+  "Read configuration from UNDERCOVER_CONFIG."
+  (let ((configuration (getenv "UNDERCOVER_CONFIG")))
+    (when configuration
+      (condition-case nil
+          (car (read-from-string configuration))
+        (error
+         (error "UNDERCOVER: error while parsing configuration"))))))
+
+(defun undercover--set-options (configuration)
+  "Read CONFIGURATION.
+Set `undercover--send-report' and `undercover--report-file-path'.
+Return wildcards."
+  (destructuring-bind (wildcards options)
+      (--separate (or (stringp it) (eq :exclude (car-safe it))) configuration)
+    (dolist (option options wildcards)
+      (case (car-safe option)
+        (:report-file (setq undercover--report-file-path (cadr option)))
+        (:report-format (setq undercover--report-format (cadr option)))
+        (:send-report (setq undercover--send-report (cadr option)))
+        (otherwise (error "Unsupported option: %s" option))))))
+
+(defun undercover--setup (configuration)
+  "Enable test coverage for files matched by CONFIGURATION."
+  (when (undercover--coverage-enabled-p)
+    (let ((env-configuration (undercover--env-configuration))
+          (default-configuration '("*.el")))
+      (undercover--set-edebug-handlers)
+      (undercover-report-on-kill)
+      (let ((wildcards (undercover--set-options
+                        (or (append configuration env-configuration)
+                            default-configuration))))
+        (undercover--edebug-files (undercover--wildcards-to-files 
wildcards))))))
+
+;;;###autoload
+(defmacro undercover (&rest configuration)
+  "Enable test coverage for files matched by CONFIGURATION.
+Example of CONFIGURATION: (\"*.el\" \"subdir/*.el\" (:exclude 
\"exclude-*.el\")).
+
+If running under Travic CI automatically generate report
+on `kill-emacs' and send it to coveralls.io."
+  `(undercover--setup
+    (list
+     ,@(--map (if (atom it) it `(list ,@it))
+              configuration))))
+
+(provide 'undercover)
+;;; undercover.el ends here
diff --git a/d-mode-test.el b/d-mode-test.el
index 6fddc64..d78f112 100644
--- a/d-mode-test.el
+++ b/d-mode-test.el
@@ -11,7 +11,7 @@
 
 ;; 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 2 of the License, or
+;; 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,
@@ -49,11 +49,26 @@
 ;;----------------------------------------------------------------------------
 ;;; Code:
 
-(when (require 'undercover nil t)
-  (undercover "d-mode.el"))
+(load (expand-file-name "coverage/undercover.el"))
+(if (getenv "D_MODE_COVERAGE")
+    (progn
+      ;; Generate a coverage report viewable in Emacs.
+      (require 'undercover)
+      (setq undercover-force-coverage t)
+      (undercover "d-mode.el"
+                  (:report-file "coverage/.resultset.json")
+                 (:report-format 'simplecov)
+                 (:send-report nil))
+      )
+  (unless (getenv "D_MODE_NO_COVERAGE")
+    (when (require 'undercover nil t)
+      (undercover "d-mode.el"))))
 
 (require 'd-mode nil t)
 
+(def-edebug-spec d--static-if (sexp form &optional form))
+(def-edebug-spec d--if-version>= (sexp form &optional form))
+
 (require 'htmlfontify)
 
 (defconst d-test-teststyle
@@ -84,7 +99,7 @@
         (inline-close          . 0)
         (func-decl-cont        . +)
         (topmost-intro         . 0)
-        (topmost-intro-cont    . c-lineup-topmost-intro-cont)
+        (topmost-intro-cont    . 1)
         (member-init-intro     . +)
         (member-init-cont      . c-lineup-multi-inher)
         (inher-intro           . +)
@@ -132,13 +147,16 @@
         (inlambda              . c-lineup-inexpr-block)
         (lambda-intro-cont     . +)
         (inexpr-statement      . +)
-        (inexpr-class          . +)))
+        (inexpr-class          . +)
+        (knr-argdecl-intro     . 0)))
     (c-echo-syntactic-information-p . t)
     (c-indent-comment-alist . nil))
   "Style for testing.")
 
 (c-add-style "teststyle" d-test-teststyle)
 
+(defvar-local d-test-orig-filename nil)
+
 (defun make-test-buffer (filename)
   (let ((testbuf (get-buffer-create "*d-mode-test*"))
         (enable-local-eval t))
@@ -157,6 +175,7 @@
           c-mode-common-hook)
       (d-mode))
     (hack-local-variables)
+    (setq-local d-test-orig-filename filename)
     testbuf))
 
 (defun kill-test-buffer ()
@@ -187,29 +206,19 @@
     (switch-to-buffer testbuf)
     (syntax-ppss (point-max))
 
-    (condition-case err
-       ;; extract the run command and expected output if any.
-       (let* ((contents (buffer-substring-no-properties 1 (point-max)))
-              (run-str (if (string-match "^// #run: \\(.+\\)$" contents)
-                           (match-string 1 contents)))
-              (out-str (if (string-match "^// #out: \\(.+\\)$" contents)
-                           (match-string 1 contents))))
-         (when run-str
-           (let ((result (eval (car (read-from-string run-str)))))
-             (when out-str
-               (let ((expect (car (read-from-string out-str))))
-                 (unless (equal result expect)
-                   (error "\nExpected: %s\nGot     : %s" expect result))))))
-         t)
-      (error
-       (set-buffer testbuf)
-       (buffer-enable-undo testbuf)
-       (set-buffer-modified-p nil)
-       (setq error-found-p t)
-
-       (message
-       "Regression found in file %s:\n%s"
-       filename (error-message-string err))))
+    ;; extract the run command and expected output if any.
+    (let* ((contents (buffer-substring-no-properties 1 (point-max)))
+           (run-str (if (string-match "^// #run: \\(.+\\)$" contents)
+                        (match-string 1 contents)))
+           (out-str (if (string-match "^// #out: \\(.+\\)$" contents)
+                        (match-string 1 contents))))
+      (when run-str
+        (let ((result (eval (car (read-from-string run-str)))))
+          (when out-str
+            (let ((expect (car (read-from-string out-str))))
+              (unless (equal result expect)
+                (error "\nExpected: %s\nGot     : %s" expect result))))))
+      t)
 
     (set-buffer save-buf)
     (goto-char save-point)
@@ -233,24 +242,29 @@ Called from the #run snippet of individual test files."
 
 (require 'imenu)
 
+(defun d-test--imenu-to-lines (x)
+  "Extracts line numbers from one possibly-nested imenu--index-alist element 
X."
+  (if (imenu--subalist-p x)
+      (apply #'append (mapcar #'d-test--imenu-to-lines (cdr x)))
+    (list (line-number-at-pos (cdr x)))))
+
 (defun d-test-get-imenu-lines ()
   "Get list of line numbers of lines recognized as imenu entries.
 
 Called from the #run snippet of individual test files."
   (imenu--make-index-alist t)
-  (sort
-   (apply
-    'append
-    (mapcar
-     (lambda (x)
-       (if (imenu--subalist-p x)
-          (mapcar
-           (lambda (x)
-             (line-number-at-pos (cdr x)))
-           (cdr x))
-        (list (line-number-at-pos (cdr x)))))
-     imenu--index-alist))
-   '<))
+  (sort (d-test--imenu-to-lines (cons nil imenu--index-alist)) '<))
+
+(defun d-test-save-result (filename)
+  "In case of an unexpected result, save it to a file.
+
+FILENAME is the original (versioned) file name."
+  (write-region
+   nil nil
+   (concat
+    (file-name-sans-extension filename)
+    ".res"
+    (file-name-extension filename t))))
 
 (defun d-test-indent ()
   "Re-indent the current file.
@@ -261,7 +275,8 @@ If the resulting indentation ends up being different, raise 
an error."
     (error
      (let ((orig (buffer-string)))
        (let (buffer-read-only)
-        (c-indent-region (point-min) (point-max)))
+        (c-indent-region (point-min) (point-max))
+         (d-test-save-result d-test-orig-filename))
        (error (concat "Test case has been indented differently.\n"
                      
"Expected:\n--------------------\n%s\n--------------------\n"
                      "Got:     
\n--------------------\n%s\n--------------------\n")
@@ -281,37 +296,50 @@ the reference file, raise an error."
          (default-value 'font-lock-fontify-region-function)))
 
   (let* ((hfy-optimisations '(body-text-only merge-adjacent-tags))
+         (html-filename (concat filename ".html"))
         (actual (with-current-buffer (htmlfontify-buffer nil "test.d") 
(buffer-string)))
         (expected (with-temp-buffer
-                    (insert-file-contents (concat filename ".html"))
+                    (insert-file-contents html-filename)
                     (buffer-string))))
     (unless (equal actual expected)
+      (with-temp-buffer (insert actual) (d-test-save-result html-filename))
       (error (concat "Test case has been fontified differently.\n"
                     
"Expected:\n--------------------\n%s\n--------------------\n"
                     "Got:     
\n--------------------\n%s\n--------------------\n")
             expected actual))))
 
-(defmacro d-test-deftest (name filename expected-result)
-  "Define a d-mode test using the given FILENAME.
-
-EXPECTED-RESULT should return t if the test
-is expected to succeed, and nil otherwise."
-  `(ert-deftest ,name ()
-     :expected-result (if ,expected-result :passed :failed)
-     (should (do-one-test ,filename))))
-
-;; Run the tests
-(d-test-deftest imenu "tests/imenu.d" t)
-(d-test-deftest fonts "tests/fonts.d" t)
-(d-test-deftest i0021 "tests/I0021.d" t)
-(d-test-deftest i0026 "tests/I0026.d" t)
-(d-test-deftest i0030 "tests/I0030.d" t)
-(d-test-deftest i0035 "tests/I0035.d" (version< "24.4" emacs-version))
-(d-test-deftest i0039 "tests/I0039.d" (version< "24.4" emacs-version))
-(d-test-deftest i0049 "tests/I0049.d" t)
-(d-test-deftest i0064 "tests/I0064.d" t)
-(d-test-deftest i0069 "tests/I0069.txt" t)
-(d-test-deftest i0072 "tests/I0072.txt" t)
+(defun d-test-get-expected-result (filename)
+  (with-temp-buffer
+    (insert-file-contents filename)
+    (let* ((min-ver
+            (if (re-search-forward "^// #min-version: \\(.+\\)$" nil t)
+                (match-string 1)
+              "0")))
+      (version<= min-ver emacs-version))))
+
+(defmacro d-test-dir (dir)
+  "Register all test files from DIR with ert."
+  (apply #'nconc
+         '(progn)
+         (mapcar
+          (lambda (filename)
+            (let ((path (expand-file-name filename dir)))
+              (cond
+               ((string-match-p "\\`\\.\\.?\\'" filename)
+                nil)
+               ((string-match-p "\\.res" filename)
+                nil)
+               ((string-match-p "\\.\\(d\\|txt\\)\\'" filename)
+                `((ert-deftest ,(intern (file-name-sans-extension filename)) ()
+                    :expected-result (if (d-test-get-expected-result ,path) 
:passed :failed)
+                    (should (do-one-test ,path)))))
+               ((string-match-p "\\.d\\.html\\'" filename)
+                nil)
+               (t
+                (message "Ignoring test file with unknown extension: %s" 
filename)
+                nil))))
+          (directory-files dir))))
+(d-test-dir "tests")
 
 ;;----------------------------------------------------------------------------
 
diff --git a/d-mode.el b/d-mode.el
index df72b8d..21abce7 100644
--- a/d-mode.el
+++ b/d-mode.el
@@ -7,9 +7,9 @@
 ;; Maintainer:  Russel Winder <russel@winder.org.uk>
 ;;              Vladimir Panteleev <vladimir@thecybershadow.net>
 ;; Created:  March 2007
-;; Version:  201908262243
+;; Version:  202003130913
 ;; Keywords:  D programming language emacs cc-mode
-;; Package-Requires: ((emacs "24.3"))
+;; Package-Requires: ((emacs "25.1"))
 
 ;;;; NB Version number is date and time yyyymmddhhMM UTC.
 ;;;; A hook to update it automatically on save is available here:
@@ -19,7 +19,7 @@
 
 ;; 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 2 of the License, or
+;; 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,
@@ -72,10 +72,16 @@
 ;;   History is tracked in the Git repository rather than in this file.
 ;;   See 
https://github.com/Emacs-D-Mode-Maintainers/Emacs-D-Mode/commits/master
 
-;;----------------------------------------------------------------------------
 ;;; Code:
 
+;; ----------------------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Required packages ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; ----------------------------------------------------------------------------
+
 (require 'cc-mode)
+(require 'cc-langs)
 
 ;; Needed to prevent
 ;;   "Symbol's value as variable is void: 
compilation-error-regexp-alist-alist" errors
@@ -86,9 +92,6 @@
   (when (and (= emacs-major-version 24) (>= emacs-minor-version 4))
     (require 'cl)))
 
-;; The set-difference function is used from the Common Lisp extensions.
-(require 'cl-lib)
-
 ;; Used to specify regular expressions in a sane way.
 (require 'rx)
 
@@ -99,9 +102,14 @@
 ;; necessary to get them compiled.)
 ;; Comment out 'when-compile part for debugging
 (eval-when-compile
-  (require 'cc-langs)
-  (require 'cc-fonts)
-)
+  (require 'cc-fonts))
+
+
+;; ----------------------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;; cc-mode configuration ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; ----------------------------------------------------------------------------
 
 (eval-and-compile
   ;; Make our mode known to the language constant system.  Use Java
@@ -118,19 +126,29 @@
 ;; D has pointers
 (c-lang-defconst c-type-decl-prefix-key
   d (concat "\\("
-                  "[*(]"
+                  "[*(~]"
                   "\\|"
                   (c-lang-const c-type-decl-prefix-key)
                   "\\)"
                   "\\([^=]\\|$\\)"))
 
+(c-lang-defconst c-decl-start-re
+  d "[[:alpha:]_@~.]")
+  ;; d "[[:alpha:]_@]")
+
+(c-lang-defconst d-decl-end-re
+  d "[,;=(]")
+
 ;; D has fixed arrays
 (c-lang-defconst c-opt-type-suffix-key
-  d "\\(\\[[^]]*\\]\\|\\.\\.\\.\\)")
+  d "\\(\\[[^]]*\\]\\|\\.\\.\\.\\|\\*\\)")
+
+(c-lang-defconst c-decl-prefix-re
+  d "\\([{}();:,=]+\\)")
 
 (c-lang-defconst c-identifier-ops
   ;; For recognizing "~this", ".foo", and "foo.bar.baz" as identifiers
-  d '((prefix "~")(prefix ".")(left-assoc ".")))
+  d '((left-assoc ".")))
 
 (c-lang-defconst c-after-id-concat-ops
   ;; Also for handling ~this
@@ -177,68 +195,11 @@ operators."
 
 (c-lang-defconst c-block-prefix-disallowed-chars
   ;; Allow ':' for inherit list starters.
-  d (cl-set-difference (c-lang-const c-block-prefix-disallowed-chars)
+  d (c--set-difference (c-lang-const c-block-prefix-disallowed-chars)
                       '(?:)))
 
-(defconst doxygen-font-lock-doc-comments
-  (let ((symbol "[a-zA-Z0-9_]+")
-       (header "^ \\* "))
-    `((,(concat header "\\("     symbol "\\):[ \t]*$")
-       1 ,c-doc-markup-face-name prepend nil)
-      (,(concat                  symbol     "()")
-       0 ,c-doc-markup-face-name prepend nil)
-      (,(concat header "\\(" "@" symbol "\\):")
-       1 ,c-doc-markup-face-name prepend nil)
-      (,(concat "[#%@]" symbol)
-       0 ,c-doc-markup-face-name prepend nil))
-    ))
-
-(defconst doxygen-font-lock-keywords
-  `((,(lambda (limit)
-       (c-font-lock-doc-comments "/\\+[+!]\\|/\\*[*!]\\|//[/!]" limit
-         doxygen-font-lock-doc-comments)))))
-
-
-;;; Patterns to recognize the compiler generated messages
-
-(defun d-mode-add-dmd-message-pattern (expr level symbol)
-  "Register DMD `compile' pattern for an error level.
-
-EXPR is the `rx' message sub-expression indicating the error level LEVEL.
-The expression is added to `compilation-error-regexp-alist' and
-`compilation-error-regexp-alist-alist' as SYMBOL."
-  (add-to-list
-   'compilation-error-regexp-alist-alist
-   `(,symbol
-     ,(rx-to-string
-      `(and
-       line-start
-       (group-n 1 (one-or-more any))           ; File name
-       "("
-       (group-n 2 (one-or-more digit))         ; Line number
-       (zero-or-one
-        ","
-        (group-n 3 (one-or-more digit)))       ; Column number
-       "): "
-       ,expr
-       (group-n 4 (one-or-more nonl))          ; Message
-       line-end))
-     1 2 3 ,level 4))
-  (add-to-list 'compilation-error-regexp-alist symbol))
-
-(d-mode-add-dmd-message-pattern "Error: "          2 'dmd-error       )
-(d-mode-add-dmd-message-pattern "Warning: "        1 'dmd-warning     )
-(d-mode-add-dmd-message-pattern "Deprecation: "    1 'dmd-deprecation )
-(d-mode-add-dmd-message-pattern '(one-or-more " ") 0 'dmd-continuation)
-
-;; The following regexp recognizes messages generated by the D runtime for
-;; unhandled exceptions (e.g. assert failures).
-
-(add-to-list 'compilation-error-regexp-alist-alist
-             '(d-exceptions
-               "^[a-zA-z0-9.]*?@\\(.*?\\)(\\([0-9]+\\)):"
-               1 2 nil 2))
-(add-to-list 'compilation-error-regexp-alist 'd-exceptions)
+(c-lang-defconst c-post-protection-token
+  d  ":")
 
 ;;----------------------------------------------------------------------------
 
@@ -247,14 +208,21 @@ The expression is added to 
`compilation-error-regexp-alist' and
   d '("bool" "byte" "ubyte" "char" "delegate" "double" "float"
       "function" "int" "long" "short" "uint" "ulong" "ushort"
       "cent" "ucent" "real" "ireal" "idouble" "ifloat" "creal" "cfloat" 
"cdouble"
-      "wchar" "dchar" "void" "string" "wstring" "dstring"))
-
-;; Keywords that can prefix normal declarations of identifiers
+      "wchar" "dchar" "void" "string" "wstring" "dstring" "__vector"))
+
+;; Keywords that can prefix normal declarations of identifiers.
+;; Union of StorageClass, Attribute, and ParameterAttributes in D grammar.
+;; References:
+;; - https://dlang.org/spec/grammar.html#Attribute
+;; - https://dlang.org/spec/declaration.html#StorageClass
+;; - https://dlang.org/spec/grammar.html#ParameterAttributes
 (c-lang-defconst c-modifier-kwds
-  d '("__gshared" "abstract" "deprecated" "extern"
-      "final" "in" "out" "inout" "lazy" "mixin" "override" "private"
-      "protected" "public" "ref" "scope" "shared" "static" "synchronized"
-      "volatile" "__vector"))
+  d '("__gshared" "abstract" "align" "auto" "const" "deprecated"
+      "enum" "export" "extern" "final" "immutable" "in" "inout" "lazy"
+      "nothrow" "out" "override" "package" "pragma" "private"
+      "protected" "public" "pure" "ref" "return" "scope" "shared"
+      "static" "synchronized"
+      "@property" "@safe" "@trusted" "@system" "@nogc" "@disable"))
 
 (c-lang-defconst c-class-decl-kwds
   ;; Keywords introducing declarations where the following block (if any)
@@ -265,8 +233,7 @@ The expression is added to `compilation-error-regexp-alist' 
and
 ;;   d '("enum"))
 
 (c-lang-defconst c-type-modifier-kwds
-  d '("__gshared" "inout" "lazy" "shared" "volatile"
-      "invariant" "enum" "__vector"))
+  d nil)
 
 (c-lang-defconst c-type-prefix-kwds
   ;; Keywords where the following name - if any - is a type name, and
@@ -274,19 +241,16 @@ The expression is added to 
`compilation-error-regexp-alist' and
   ;; declarations.  In this case, like "mixin foo!(x) bar;"
   d    '("mixin" "align"))
 
-;;(c-lang-defconst c-other-block-decl-kwds
-;;  ;; Keywords where the following block (if any) contains another
-;;  ;; declaration level that should not be considered a class.
-;;  ;; Each of these has associated offsets e.g.
-;;  ;;   'with-open', 'with-close' and 'inwith'
-;;  ;; that can be customized individually
-;;  ;;   TODO: maybe also do this for 'static if' ?  in/out?
-;;  ;;   TODO: figure out how to make this work properly
-;;  d '("with" "version" "extern"))
-
+;; Remove "enum" from d-mode's value.
+;; By default this c-typedef-decl-kwds includes c-brace-list-decl-kwds,
+;; which is '("enum") by default.
+;; Instead, parse enums manually (see d-font-lock-enum-body) to avoid
+;; confusion with manifest constants.
 (c-lang-defconst c-typedef-decl-kwds
- d (append (c-lang-const c-typedef-decl-kwds)
-           '("typedef" "alias")))
+  ;; Keywords introducing declarations where the identifier(s) being
+  ;; declared are types.
+ d (append (c-lang-const c-class-decl-kwds)
+          '("typedef" "alias")))
 
 (c-lang-defconst c-decl-hangon-kwds
   d '("export"))
@@ -294,21 +258,23 @@ The expression is added to 
`compilation-error-regexp-alist' and
 (c-lang-defconst c-protection-kwds
   ;; Access protection label keywords in classes.
   d '("deprecated" "static" "extern" "final" "synchronized" "override"
-      "abstract" "scope" "inout" "shared" "__gshared"
+      "abstract" "scope"
       "private" "package" "protected" "public" "export"))
 
-;;(c-lang-defconst c-postfix-decl-spec-kwds
-;;  ;Keywords introducing extra declaration specifiers in the region
-;;  ;between the header and the body (i.e. the "K&R-region") in
-;;  ;declarations.
-;;; This doesn't seem to have any effect.  They aren't exactly "K&R-regions".
-;;  d '("in" "out" "body"))
+(c-lang-defconst c-postfix-spec-kwds
+ ;Keywords introducing extra declaration specifiers in the region
+ ;between the header and the body (i.e. the "K&R-region") in
+ ;declarations.
+ d '("if" "in" "out" "body"))
+
+(c-lang-defconst c-recognize-knr-p
+  d t)
 
 (c-lang-defconst c-type-list-kwds
-  d '("import"))
+  d nil)
 
 (c-lang-defconst c-ref-list-kwds
-  d '("module"))
+  d '("import" "module"))
 
 (c-lang-defconst c-colon-type-list-kwds
   ;; Keywords that may be followed (not necessarily directly) by a colon
@@ -318,21 +284,74 @@ The expression is added to 
`compilation-error-regexp-alist' and
 (c-lang-defconst c-paren-nontype-kwds
   ;;Keywords that may be followed by a parenthesis expression that doesn't
   ;; contain type identifiers.
-  d '("version" "debug" "extern" "macro" "mixin"))
+  d '("version" "debug" "extern" "pragma" "__traits" "scope"))
+
+(c-lang-defconst d-type-modifier-kwds
+  ;; D's type modifiers.
+  d '("const" "immutable" "inout" "shared"))
+
+(c-lang-defconst d-type-modifier-key
+  ;; Regex of `d-type-modifier-kwds'.
+  d (c-make-keywords-re t
+      (c-lang-const d-type-modifier-kwds)))
+
+(c-lang-defconst d-common-storage-class-kwds
+  ;; D's storage classes (keywords that can prefix or entirely
+  ;; substitute a type in a parameter or variable declaration).
+  d `(;; Constness
+      ,@(c-lang-const d-type-modifier-kwds)
+      ;; Storage classes that apply to either parameters and declarations
+      "scope"))
+
+(c-lang-defconst d-decl-storage-class-kwds
+  d `(;; Common keywords
+      ,@(c-lang-const d-common-storage-class-kwds)
+      ;; auto (no-effect placeholder)
+      "auto"
+      ;; Storage class
+      "extern" "static" "__gshared"))
+
+(c-lang-defconst d-param-storage-class-kwds
+  d `(;; Common keywords
+      ,@(c-lang-const d-common-storage-class-kwds)
+      ;; Function parameters
+      "in" "out" "ref" "lazy"))
+
+(c-lang-defconst d-storage-class-kwds
+  d (c--delete-duplicates (append (c-lang-const d-decl-storage-class-kwds)
+                                 (c-lang-const d-param-storage-class-kwds))
+                         :test 'string-equal))
 
 (c-lang-defconst c-paren-type-kwds
   ;; Keywords that may be followed by a parenthesis expression containing
   ;; type identifiers separated by arbitrary tokens.
-  d  '("delete" "throw"))
+  d (append (list "delete" "throw" "cast")
+           (c-lang-const d-type-modifier-kwds)))
+
+;; D: Like `c-regular-keywords-regexp', but contains keywords which
+;; cannot occur in a function type.  For Emacs 25 imenu.
+(c-lang-defconst d-non-func-type-kwds-re
+  d (concat "\\<"
+           (c-make-keywords-re t
+             (c--set-difference (c-lang-const c-keywords)
+                                (append (c-lang-const c-primitive-type-kwds)
+                                        (c-lang-const 
d-decl-storage-class-kwds))
+                                :test 'string-equal))))
+
+;; D: Like `c-regular-keywords-regexp', but contains keywords which
+;; cannot occur in a function name.  For Emacs 25 imenu.
+(c-lang-defconst d-non-func-name-kwds-re
+  d (concat "\\<"
+           (c-make-keywords-re t (c-lang-const c-keywords))))
 
 (c-lang-defconst c-block-stmt-1-kwds
   ;; Statement keywords followed directly by a substatement.
-  d '("do" "else" "finally" "try" "in" "out" "body"))
+  d '("do" "else" "finally" "try" "in" "body"))
 
 (c-lang-defconst c-block-stmt-2-kwds
   ;; Statement keywords followed by a paren sexp and then by a substatement.
   d '("for" "if" "switch" "while" "catch" "synchronized" "scope"
-      "foreach" "foreach_reverse" "with" "unittest"))
+      "foreach" "foreach_reverse" "with" "out" "invariant" "unittest"))
 
 (c-lang-defconst c-simple-stmt-kwds
   ;; Statement keywords followed by an expression or nothing.
@@ -372,108 +391,968 @@ The expression is added to 
`compilation-error-regexp-alist' and
   d nil)
 
 (c-lang-defconst c-other-decl-kwds
-  d '("module" "import"))
+  d (c-lang-const d-storage-class-kwds))
+
+(c-lang-defconst c-decl-start-kwds
+  d '("debug" "else"))
 
 (c-lang-defconst c-other-kwds
   ;; Keywords not accounted for by any other `*-kwds' language constant.
-  d '("__gshared" "__traits" "assert" "cast" "is" "nothrow" "pure" "ref"
+  d '("__gshared" "__traits" "assert" "cast" "in" "is" "nothrow" "pure" "ref"
       "sizeof" "typeid" "typeof"))
 
 
-(defcustom d-font-lock-extra-types nil
-  "*List of extra types (aside from the type keywords) to recognize in D mode.
+(c-lang-defconst c-recognize-post-brace-list-type-p
+  ;; Set to t when we recognize a colon and then a type after an enum,
+  ;; e.g., enum foo : int { A, B, C };"
+  d t)
 
-Each list item should be a regexp matching a single identifier."
-  :type '(repeat regexp)
-  :group 'd-mode)
+;; Enabled for java-mode, but we don't need it.
+;; (We can't reuse this for D templates because this is hard-wired to
+;; the < and > characters.)
+(c-lang-defconst c-recognize-<>-arglists
+  d nil)
 
-(defconst d-font-lock-keywords-1 (c-lang-const c-matchers-1 d)
-  "Minimal highlighting for D mode.")
+;; ----------------------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; cc-mode patches ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; ----------------------------------------------------------------------------
 
-(defconst d-font-lock-keywords-2 (c-lang-const c-matchers-2 d)
-  "Fast normal highlighting for D mode.")
+(defmacro d-make-keywords-re (adorn list)
+  "Helper to precompute regular expressions for inline keyword lists." ;; 
checkdoc-params: (adorn list)
+  (eval `(c-make-keywords-re ,adorn ,list 'd)))
 
-(defconst d-font-lock-keywords-3 (c-lang-const c-matchers-3 d)
-  "Accurate normal highlighting for D mode.")
+(defmacro d--static-if (condition new-form &optional old-form)
+  "If CONDITION is non-nil at compile time, evaluate NEW-FORM, otherwise 
OLD-FORM."
+  (declare (indent 2))
+  (if (eval condition)
+      new-form
+    old-form))
 
-(defvar d-font-lock-keywords d-font-lock-keywords-3
-  "Default expressions to highlight in D mode.")
+(defmacro d--if-version>= (min-version new-form &optional old-form)
+  "Conditional compilation based on the current Emacs version.
 
-(defun d-font-lock-keywords-2 ()
-  "Function to get fast normal highlighting for D mode."
-  (c-compose-keywords-list d-font-lock-keywords-2))
-(defun d-font-lock-keywords-3 ()
-  "Function to get accurate normal highlighting for D mode."
-  (c-compose-keywords-list d-font-lock-keywords-3))
-(defun d-font-lock-keywords ()
-  "Function to get default expressions to highlight in D mode."
-  (c-compose-keywords-list d-font-lock-keywords))
+Evaluate OLD-FORM if the Emacs version is older than MIN-VERSION,
+  otherwise NEW-FORM."
+  (declare (indent 2))
+  `(d--static-if (version<= ,min-version emacs-version) ,new-form ,old-form))
 
-(defvar d-mode-syntax-table nil
-  "Syntax table used in d-mode buffers.")
-(or d-mode-syntax-table
-    (setq d-mode-syntax-table
-        (let ((table (funcall (c-lang-const c-make-mode-syntax-table d))))
-          ;; Make it recognize D `backquote strings`
-          (modify-syntax-entry ?` "\"" table)
+;;----------------------------------------------------------------------------
+;;; Workaround for special case of 'else static if' not being handled properly
+(defun d-special-case-looking-at (orig-fun &rest args)
+  ;; checkdoc-params: (orig-fun args)
+  "Advice function for fixing cc-mode indentation in certain D constructs."
+  (let ((rxp (car args)))
+    (if (and (stringp rxp) (string= rxp "if\\>[^_]"))
+        (or (apply orig-fun '("static\\>\\s-+if\\>[^_]"))
+            (apply orig-fun '("version\\>[^_]"))
+            (apply orig-fun '("debug\\>[^_]"))
+            (apply orig-fun args))
+      (apply orig-fun args))))
 
-          ;; Make it recognize D's nested /+ +/ comments
-          (modify-syntax-entry ?+  ". 23n"   table)
-          table)))
+(defun d-around--c-add-stmt-syntax (orig-fun &rest args)
+  ;; checkdoc-params: (orig-fun args)
+  "Advice function for fixing cc-mode indentation in certain D constructs."
+  (if (not (c-major-mode-is 'd-mode))
+      (apply orig-fun args)
+    (add-function :around (symbol-function 'looking-at)
+                 #'d-special-case-looking-at)
+    (unwind-protect
+       (apply orig-fun args)
+      (remove-function (symbol-function 'looking-at)
+                      #'d-special-case-looking-at))))
 
-(defvar d-mode-abbrev-table nil
-  "Abbreviation table used in d-mode buffers.")
-(c-define-abbrev-table 'd-mode-abbrev-table
-  ;; Use the abbrevs table to trigger indentation actions
-  ;; on keywords that, if they occur first on a line, might alter the
-  ;; syntactic context.
-  ;; Syntax for abbrevs is:
-  ;; ( pattern replacement command initial-count)
-  '(("else" "else" c-electric-continued-statement 0)
-    ("while" "while" c-electric-continued-statement 0)
-    ("catch" "catch" c-electric-continued-statement 0)
-    ("finally" "finally" c-electric-continued-statement 0)))
+(advice-add 'c-add-stmt-syntax :around #'d-around--c-add-stmt-syntax)
 
-(defvar d-mode-map ()
-  "Keymap used in d-mode buffers.")
-(if d-mode-map
-    nil
-  (setq d-mode-map (c-make-inherited-keymap))
-  ;; Add bindings which are only useful for D
-  ;; (define-key d-mode-map "\C-c\C-e"  'd-cool-function)
-  )
+;;----------------------------------------------------------------------------
 
-(c-lang-defconst c-mode-menu
-  ;; The definition for the mode menu.  The menu title is prepended to
-  ;; this before it's fed to `easy-menu-define'.
-  t `(["Comment Out Region"     comment-region
-       (c-fn-region-is-active-p)]
-      ["Uncomment Region"       (comment-region (region-beginning)
-                                               (region-end) '(4))
-       (c-fn-region-is-active-p)]
-      ["Indent Expression"      c-indent-exp
-       (memq (char-after) '(?\( ?\[ ?\{))]
-      ["Indent Line or Region"  c-indent-line-or-region t]
-      ["Fill Comment Paragraph" c-fill-paragraph t]
-      "----"
-      ["Backward Statement"     c-beginning-of-statement t]
-      ["Forward Statement"      c-end-of-statement t]
-      "----"
-      ("Toggle..."
-       ["Syntactic indentation" c-toggle-syntactic-indentation
-       :style toggle :selected c-syntactic-indentation]
-       ["Electric mode"         c-toggle-electric-state
-       :style toggle :selected c-electric-flag]
-       ["Auto newline"          c-toggle-auto-newline
-       :style toggle :selected c-auto-newline]
-       ["Hungry delete"         c-toggle-hungry-state
-       :style toggle :selected c-hungry-delete-key]
-       ["Subword mode"          c-subword-mode
-       :style toggle :selected (and (boundp 'c-subword-mode)
-                                     c-subword-mode)])))
+(defun d-forward-keyword-clause (match)
+  "D version (complement) of `c-forward-keyword-clause'." ;; checkdoc-params: 
match
+
+  (let ((kwd-sym (c-keyword-sym (match-string match))) safe-pos pos)
+
+    (when kwd-sym
+      (goto-char (match-end match))
+      (c-forward-syntactic-ws)
+      (setq safe-pos (point))
+
+      (cond
+       ;; module and import statements
+       ((c-keyword-member kwd-sym 'c-ref-list-kwds)
+       (while
+           (progn
+             (c-forward-syntactic-ws)
+             (setq safe-pos (point))
+             (cond
+              ((looking-at c-identifier-start)
+               ;; identifier
+               (setq c-last-identifier-range nil)
+               (forward-char)
+               (c-end-of-current-token)
+               (when c-record-type-identifiers
+                 (c-record-ref-id (cons safe-pos (point))))
+               t)
+              ;; . or , or = (keep fontifying)
+              ((memq (char-after) '(?. ?, ?=))
+               (forward-char)
+               t)
+              ;; ; or : or anything else weird
+              (t
+               nil))))
+       (goto-char safe-pos)
+       t)
+       ;; Special words after certain keywords
+       ((and (c-keyword-member kwd-sym 'c-paren-nontype-kwds)
+            (eq (char-after) ?\())
+       (forward-char)
+       (c-forward-syntactic-ws)
+       (c-forward-keyword-prefixed-id ref)
+       (goto-char safe-pos)
+       (c-forward-sexp)
+       (c-forward-syntactic-ws)
+       t)))))
+
+;----------------------------------------------------------------------------
+
+(defun d-forward-decl-or-cast-1 (preceding-token-end context last-cast-end)
+  "D version of `c-forward-decl-or-cast-1'." ;; checkdoc-params: 
(preceding-token-end context last-cast-end)
+  ;; (message "(d-forward-decl-or-cast-1 %S %S %S) @ %S" preceding-token-end 
context last-cast-end (point))
+
+  ;; D: Restore our context, if any
+  (when (memq context '(arglist decl))
+    (save-excursion
+      (c-backward-syntactic-ws)
+      (when (> (point) (point-min))
+       (setq context (or (c-get-char-property (1- (point)) 'd-context) 
context)))))
+
+  ;; D: Handle conditional compilation.
+  ;; The "debug" keyword, as well as the "else" keyword following a
+  ;; "version" or "static if", can start a declaration even without a
+  ;; { } block.
+  ;; For this reason, these keywords are in `c-decl-start-kwds'.
+  ;; However, `c-decl-start-kwds' are considered as part of the
+  ;; declaration, so `c-forward-decl-or-cast-1' will be invoked with
+  ;; point at the keyword.  Handle this case here.
+  ;; Note that other cases (e.g. static if) are handled implicitly by
+  ;; their requirement of a parenthesis (')' is in `c-decl-prefix-re').
+  (while (looking-at (d-make-keywords-re t (c-lang-const c-decl-start-kwds d)))
+    (goto-char (match-end 1))
+    (c-forward-syntactic-ws))
+
+  (let (maybe-auto enum decl-start type-start id-start make-top)
+
+    (let (kind)
+      (while (setq kind (d-forward-attribute-or-storage-class context))
+       (setq maybe-auto t
+             enum (eq kind 'enum))
+       ;; Skip over "public:" and similar specifiers.
+       ;; For some reason cc-mode wants us to do it here.
+       (when (looking-at ":")
+         (forward-char)
+         (c-forward-syntactic-ws))))
+
+    (setq decl-start (point))
+
+    ;; Discover what kind of enum declaration this is.
+    ;; (t if this is an actual list of enumerated values)
+    (setq enum
+         (and enum
+              (memq context '(top nil))
+              (save-excursion
+                (and
+                 (d-forward-type)
+                 (or (looking-at "[:{;]")
+                     (and
+                      (d-forward-identifier)
+                      (progn
+                        (c-forward-syntactic-ws)
+                        (looking-at "[:{;]"))))))))
+
+    (when
+       ;; The various kinds of declarations are handled here:
+       (cond
+
+        ;; Aggregate declaration (class/struct ...)
+        ;; Handle enumerations here too.
+        ((and (memq context '(top nil))
+              (or enum
+                  (looking-at (d-make-keywords-re t (c-lang-const 
c-class-decl-kwds d)))))
+
+         (unless enum
+           (goto-char (match-end 1))
+           (c-forward-syntactic-ws))
+         (setq type-start (point))
+         (setq id-start type-start)
+
+         (and
+          (d-forward-identifier)
+          (progn
+            (c-forward-syntactic-ws)
+            (looking-at "[:({;]"))))
+
+        ;; Mixin templates
+        ((and (memq context '(top nil))
+              (looking-at (d-make-keywords-re t '("mixin"))))
+         (goto-char (match-end 1))
+         (c-forward-syntactic-ws)
+         (and
+          (looking-at (d-make-keywords-re t '("template")))
+          (progn
+            (goto-char (match-end 1))
+            (c-forward-syntactic-ws)
+            (setq type-start (point))
+            (setq id-start type-start)
+            (d-forward-identifier))
+          (progn
+            (c-forward-syntactic-ws)
+            (looking-at "("))))
+
+        ;; Constructors/destructors
+        ((and (eq context 'top)
+              (looking-at (d-make-keywords-re t '("this" "~this"))))
+         (setq id-start decl-start)
+         (goto-char (match-end 1))
+         t)
+
+        ;; Alias declarations
+        ((and (memq context '(top nil))
+              (looking-at (d-make-keywords-re t '("alias"))))
+         (setq type-start decl-start)  ; indicate declaration type for e.g. 
imenu
+         (goto-char (match-end 1))
+         (c-forward-syntactic-ws)
+         (setq id-start (point))
+         (d-forward-type) ; alias name or value
+         (cond
+          ;; New style (alias name = value)
+          ((memq (char-after) '(?= ?\())
+           t)
+          ;; Old style (alias value name)
+          ((looking-at c-symbol-key)
+           (setq id-start (point))
+           t)))
+
+        ;; Lambda literal
+        ((and (memq context '(top nil arglist))
+              (save-excursion
+                (and
+                 (d-forward-identifier)
+                 (progn
+                   (c-forward-syntactic-ws)
+                   (looking-at "=>")))))
+         (setq id-start decl-start)
+         t)
+
+        ;; Function / variable / constant declaration, i.e. an
+        ;; (optional) type followed by an identifier.
+        ((and (memq context '(top nil))
+              ;; Declaration type, or identifier for auto
+              ;; declarations.  Note that all identifiers
+              ;; are also valid types.
+              (d-forward-type))
+
+         (setq type-start decl-start)
+         (setq id-start (point))
+
+         (cond
+          ;; auto-declaration
+          ((and maybe-auto
+                (looking-at (c-lang-const d-decl-end-re)))
+           (setq id-start type-start)
+           (setq type-start nil)
+           t)
+          ;; regular declaration
+          ((and (d-forward-identifier)
+                (progn
+                  (c-forward-syntactic-ws)
+                  (looking-at (c-lang-const d-decl-end-re))))
+           t)))
+
+        ;; Function parameter list.
+        ;; Note: single (type-less) identifiers in parameter lists
+        ;; mean different things for function and lambda parameter
+        ;; lists.  For functions, they indicate the type of an
+        ;; anonymous parameter; for lambdas, they indicate the name
+        ;; of a parameter with an inferred type.
+        ((and (memq context '(decl varlist))
+              (d-forward-type))
+         (setq type-start decl-start)
+         (setq id-start (point))
+         (cond
+          ;; Type or name only
+          ((looking-at "[,=);]")
+           (when (eq context 'varlist)
+             (setq id-start type-start)
+             (setq type-start nil))
+           t)
+          ;; Parameter name
+          ((d-forward-identifier)
+           (c-forward-syntactic-ws)
+           (looking-at "[,=);]")))))
+
+      ;; Valid declaration, process it.
+
+      (when (and c-record-type-identifiers type-start)
+       (let ((c-promote-possible-types t))
+         (save-excursion
+           (goto-char type-start)
+           (d-forward-type))))
+
+      (when (and (memq context '(decl varlist))
+                (eq (char-after) ?,))
+       ;; As in c-forward-decl-or-cast-1:
+       ;; Make sure to propagate the `c-decl-arg-start' property to
+       ;; the next argument if it's set in this one, to cope with
+       ;; interactive refontification.
+       (c-put-c-type-property (point) 'c-decl-arg-start)
+       ;; D: Also save whether we're in a varlist.
+       (c-put-char-property (point) 'd-context context))
+
+      (when (and (memq context '(top nil))
+                (eq (char-after) ?\())
+       ;; Move point past the parameter list (end of declaration) to
+       ;; communicate to cc-mode that the parens represent parameters,
+       ;; and not arguments.
+       (c-forward-sexp)
+       (c-forward-syntactic-ws)
+       ;; Template arguments?
+       (when (eq (char-after) ?\()
+         (c-forward-sexp)
+         (c-forward-syntactic-ws)))
+
+      (d--if-version>= "26.0"
+         (list id-start
+               nil
+               nil
+               type-start
+               (or (eq context 'top) make-top))
+       (list id-start)))))
+
+
+(defun d-around--c-forward-decl-or-cast-1 (orig-fun &rest args)
+  ;; checkdoc-params: (orig-fun args)
+  "Advice function for patching D support into cc-mode."
+  (apply
+   (if (c-major-mode-is 'd-mode)
+       #'d-forward-decl-or-cast-1
+     orig-fun)
+   args))
+(advice-add 'c-forward-decl-or-cast-1 :around 
#'d-around--c-forward-decl-or-cast-1)
+
+;----------------------------------------------------------------------------
+
+(defun d-forward-identifier ()
+  "Advance point by one D identifier."
+  (when (and (not (looking-at c-keywords-regexp))
+            (looking-at c-symbol-key))
+    (goto-char (match-end 0))
+    t))
+
+
+(defun d-forward-attribute-or-storage-class (context)
+  "Handle D attributes and storage classes in declarations.
+
+Advance point and return non-nil if looking at something that may prefix a
+declaration (or follow the argument list, in case of functions).
+
+CONTEXT is as in `c-forward-decl-or-cast-1'."
+  ;; Note that this includes UDAs.
+  (let ((start (point))
+       (kind t)
+       match-index)
+    (when
+       (cond
+        ((looking-at (d-make-keywords-re t '("enum")))
+         (setq match-index 1
+               kind 'enum))
+        ((looking-at (d-make-keywords-re t '("scope")))
+         (setq match-index 1
+               kind 'scope))
+        ((and (eq context nil)
+              (looking-at (d-make-keywords-re t '("return"))))
+         nil)
+        ((looking-at (d-make-keywords-re t (c-lang-const d-type-modifier-kwds 
d)))
+         (setq match-index 1
+               kind 'type-modifier))
+        ((looking-at (d-make-keywords-re t (c-lang-const c-modifier-kwds d)))
+         (setq match-index 1))
+        ((and (eq (char-after) ?@)
+              (looking-at c-symbol-key))
+         (setq match-index 0)))
+      (goto-char (match-end match-index))
+      (c-forward-syntactic-ws)
+      ;; Skip parameters, such as:
+      ;; - extern(C)
+      ;; - deprecated("...")
+      ;; - package(std)
+      ;; - @SomeUDA(...)
+      (if (looking-at "(")
+         ;; 1. Distinguish between "const x" and "const(x)".  In the
+         ;; former, "const" is an attribute, but in the latter it is
+         ;; part of a type.  This distinction is important when parsing
+         ;; constructs where a type is required; a greedy attribute
+         ;; match would leave only "(x)" which will not make sense.
+         ;; 2. Distinguish between scope variables (e.g. "scope x = new
+         ;; ...") and scope statements (e.g. "scope(exit) { ... }").
+         (if (memq kind '(type-modifier scope))
+             (progn
+               (goto-char start)
+               nil)
+           (c-go-list-forward)
+           (c-forward-syntactic-ws)
+           kind)
+       kind))))
 
-(easy-menu-define d-menu d-mode-map "D Mode Commands"
-  (cons "D" (c-lang-const c-mode-menu d)))
+;;----------------------------------------------------------------------------
+
+(defun d-around--c-get-fontification-context (orig-fun match-pos &rest args)
+  ;; checkdoc-params: (orig-fun match-pos args)
+  "Advice function for fixing cc-mode handling of D lambda parameter lists."
+  (let ((res (apply orig-fun match-pos args))
+       (type 'varlist))
+    ;; (message "(c-get-fontification-context %S) @ %S -> %S" args (point) res)
+    (when (and
+          (c-major-mode-is 'd-mode)
+          (memq (car res) '(nil arglist))
+          (save-excursion
+            (and
+             (progn
+               (goto-char match-pos)
+               (c-backward-syntactic-ws)
+               (eq (char-before) ?\())
+             (progn
+               (backward-char)
+               (or
+                (save-excursion
+                  (and
+                   (c-backward-token-2)
+                   (cond
+                    ((looking-at (d-make-keywords-re t '("if" "while" "for" 
"switch"
+                                                         "with" 
"synchronized")))
+                     (setq type nil)
+                     t)
+                    ((looking-at (d-make-keywords-re t '("foreach" 
"foreach_reverse")))
+                     t)
+                    ((looking-at (d-make-keywords-re t '("catch")))
+                     (setq type 'decl)
+                     t))))
+                (progn
+                  (c-forward-sexp)
+                  (c-forward-syntactic-ws)
+                  (while (d-forward-attribute-or-storage-class 'top))
+                  (or
+                   (eq (char-after) ?\{)
+                   (looking-at "=>"))))))))
+
+      (setq res (cons type t))
+      ;; (message "   patching -> %S" res)
+      )
+    res))
+(advice-add 'c-get-fontification-context :around 
#'d-around--c-get-fontification-context)
+
+;;----------------------------------------------------------------------------
+;; Borrowed from 
https://github.com/josteink/csharp-mode/blob/master/csharp-mode.el
+(defun d--syntax-propertize-function (beg end)
+  "Apply syntax table properties to special constructs in region BEG to END.
+Currently handles `-delimited string literals."
+  (save-excursion
+    (goto-char beg)
+    (while (search-forward "`" end t)
+      (let ((in-comment-or-string-p (save-excursion
+                                      (goto-char (match-beginning 0))
+                                      (or (nth 3 (syntax-ppss))
+                                          (nth 4 (syntax-ppss))))))
+        (when (not in-comment-or-string-p)
+          (let (done)
+            (while (and (not done) (< (point) end))
+              (skip-chars-forward "^`\\\\" end)
+              (cond
+               ((= (following-char) ?\\)
+                (put-text-property (point) (1+ (point))
+                                   'syntax-table (string-to-syntax "."))
+                (forward-char 1))
+               ((= (following-char) ?\`)
+                (forward-char 1)
+               (setq done t))))))))))
+
+;;----------------------------------------------------------------------------
+
+(defun d--on-func-identifier ()
+  "Version of `c-on-identifier', but also match D constructors."
+
+  (save-excursion
+    (skip-syntax-backward "w_")
+
+    ;; Check for a normal (non-keyword) identifier.
+    (and (looking-at c-symbol-start)
+        (or
+         (looking-at (d-make-keywords-re t '("this" "~this")))
+         (not (looking-at c-keywords-regexp)))
+        (point))))
+
+(defun d-in-knr-argdecl (&optional lim)
+  "Modified version of `c-in-knr-argdecl' for d-mode." ;; checkdoc-params: lim
+  (save-excursion
+    ;; If we're in a macro, our search range is restricted to it.  Narrow to
+    ;; the searchable range.
+    (let* ((start (point))
+          before-lparen
+          after-rparen
+          (pp-count-out 20)    ; Max number of paren/brace constructs before
+                               ; we give up.
+          knr-start
+          c-last-identifier-range)
+
+      (catch 'knr
+       (while (> pp-count-out 0) ; go back one paren/bracket pair each time.
+         (setq pp-count-out (1- pp-count-out))
+         (c-syntactic-skip-backward "^)]}=;")
+         (cond ((eq (char-before) ?\))
+                (setq after-rparen (point)))
+               ((eq (char-before) ?\])
+                (setq after-rparen nil))
+               (t ; either } (hit previous defun) or = or no more
+                                       ; parens/brackets.
+                (throw 'knr nil)))
+
+         (if after-rparen
+             ;; We're inside a paren.  Could it be our argument list....?
+             (if
+                 (and
+                  (progn
+                    (goto-char after-rparen)
+                    (unless (c-go-list-backward) (throw 'knr nil)) ;
+                    ;; FIXME!!!  What about macros between the parens?  
2007/01/20
+                    (setq before-lparen (point)))
+
+                  ;; It can't be the arg list if next token is ; or {
+                  (progn (goto-char after-rparen)
+                         (c-forward-syntactic-ws)
+                         (not (memq (char-after) '(?\; ?\{ ?\=))))
+
+                  ;; Is the thing preceding the list an identifier (the
+                  ;; function name), or a macro expansion?
+                  (progn
+                    (goto-char before-lparen)
+                    (eq (c-backward-token-2) 0)
+                    (or (eq (d--on-func-identifier) (point))
+                        (and (eq (char-after) ?\))
+                             (c-go-up-list-backward)
+                             (eq (c-backward-token-2) 0)
+                             (eq (d--on-func-identifier) (point)))))
+
+                  ;; Check that we're outside of the template arg list 
(D-specific).
+                  (progn
+                    (setq knr-start
+                          (progn (goto-char after-rparen)
+                                 (c-forward-syntactic-ws)
+                                 (when (eq (char-after) ?\()
+                                   (c-go-list-forward)
+                                   (c-forward-syntactic-ws))
+                                 (point)))
+                    (<= knr-start start))
+
+                  ;; (... original c-in-knr-argdecl logic omitted here ...)
+                  t)
+                 ;; ...Yes.  We've identified the function's argument list.
+                 (throw 'knr knr-start)
+               ;; ...No.  The current parens aren't the function's arg list.
+               (goto-char before-lparen))
+
+           (or (c-go-list-backward)    ; backwards over [ .... ]
+               (throw 'knr nil))))))))
+
+(defun d-around--c-in-knr-argdecl (orig-fun &rest args)
+  ;; checkdoc-params: (orig-fun args)
+  "Advice function for fixing cc-mode indentation in certain D constructs."
+  (apply
+   (if (c-major-mode-is 'd-mode)
+       #'d-in-knr-argdecl
+     orig-fun)
+   args))
+
+(advice-add 'c-in-knr-argdecl :around #'d-around--c-in-knr-argdecl)
+
+;;----------------------------------------------------------------------------
+
+(defun d-forward-type (&optional brace-block-too)
+  "Modified version of `c-forward-type' for d-mode." ;; checkdoc-params: 
brace-block-too
+  (let ((start (point)) pos res name-res id-start id-end id-range)
+
+    (cond
+     ;; D: "this" is not a type, even though it appears at the
+     ;; beginning of a "function" (constructor) declaration.
+     ((looking-at (d-make-keywords-re t '("this")))
+      nil)
+
+     ;; D: const/immutable/...(...)
+     ((looking-at (c-lang-const d-type-modifier-key))
+      (when
+         (and
+          ;; Followed by a ( ?
+          (progn
+            (goto-char (match-end 1))
+            (c-forward-syntactic-ws)
+            (looking-at "("))
+          ;; Followed by a type in the parens?
+          (progn
+            (forward-char)
+            (c-forward-syntactic-ws)
+            (d-forward-type))
+          ;; Followed by a closing ) ?
+          (progn
+            (c-forward-syntactic-ws)
+            (looking-at ")")))
+       (forward-char)
+       (c-forward-syntactic-ws)
+       (setq res 'prefix)))
+
+     ;; Identifier
+     ((progn
+       (setq pos nil)
+       (when (looking-at "[.]")
+         (forward-char)
+         (c-forward-syntactic-ws))
+       (if (looking-at c-identifier-start)
+           (save-excursion
+             (setq id-start (point)
+                   name-res (c-forward-name))
+             (when name-res
+               (setq id-end (point)
+                     id-range c-last-identifier-range))))
+       (and (cond ((looking-at c-primitive-type-key)
+                   (setq res t))
+                  ((c-with-syntax-table c-identifier-syntax-table
+                     (looking-at c-known-type-key))
+                   (setq res 'known)))
+            (or (not id-end)
+                (>= (save-excursion
+                      (save-match-data
+                        (goto-char (match-end 1))
+                        (c-forward-syntactic-ws)
+                        (setq pos (point))))
+                    id-end)
+                (setq res nil))))
+      ;; Looking at a primitive or known type identifier.  We've
+      ;; checked for a name first so that we don't go here if the
+      ;; known type match only is a prefix of another name.
+
+      (setq id-end (match-end 1))
+
+      (when (and c-record-type-identifiers
+                (or c-promote-possible-types (eq res t)))
+       (c-record-type-id (cons (match-beginning 1) (match-end 1))))
+
+      (unless (save-match-data (c-forward-keyword-clause 1))
+        (if pos
+            (goto-char pos)
+          (goto-char (match-end 1))
+          (c-forward-syntactic-ws))))
+
+     (name-res
+      (cond ((eq name-res t)
+            ;; A normal identifier.
+            (goto-char id-end)
+            (if (or res c-promote-possible-types)
+                (progn
+                  (c-add-type id-start id-end)
+                  (when (and c-record-type-identifiers id-range)
+                    (c-record-type-id id-range))
+                  (unless res
+                    (setq res 'found)))
+              (setq res (if (c-check-type id-start id-end)
+                            ;; It's an identifier that has been used as
+                            ;; a type somewhere else.
+                            'found
+                          ;; It's an identifier that might be a type.
+                          'maybe))))
+           (t
+            ;; Otherwise it's an operator identifier, which is not a type.
+            (goto-char start)
+            (setq res nil)))))
+
+    (when res
+      ;; D: Skip over template parameters, if any
+      (when (looking-at "!")
+       (forward-char)
+       (c-forward-syntactic-ws)
+       (c-forward-sexp)
+       (c-forward-syntactic-ws))
+
+      ;; D: Descend into scope names
+      (when (looking-at "[.]")
+       (unless (d-forward-type)
+         (setq res nil)))
+
+      ;; Step over any type suffix operator.  Do not let the existence
+      ;; of these alter the classification of the found type, since
+      ;; these operators typically are allowed in normal expressions
+      ;; too.
+      (when c-opt-type-suffix-key      ; e.g. "..."
+       (while (looking-at c-opt-type-suffix-key)
+         (goto-char (match-end 1))
+         (c-forward-syntactic-ws)))
+
+      (when (and c-record-found-types (memq res '(known found)) id-range)
+       (setq c-record-found-types
+             (cons id-range c-record-found-types))))
+
+    ;;(message "c-forward-type %s -> %s: %s" start (point) res)
+
+    res))
+
+(defun d-around--c-forward-type (orig-fun &rest args)
+  ;; checkdoc-params: (orig-fun args)
+  "Advice function for fixing fontification for D enums."
+  (apply
+   (if (c-major-mode-is 'd-mode)
+       #'d-forward-type
+     orig-fun)
+   args))
+
+(advice-add 'c-forward-type :around #'d-around--c-forward-type)
+
+;;----------------------------------------------------------------------------
+
+(c-lang-defconst d-flat-decl-maybe-block-kwds
+  ;; Keywords which don't introduce a scope, and may or may not be
+  ;; followed by a {...} block.
+  d (append (c-lang-const c-modifier-kwds)
+           (list "else" ; for version / static if
+                 "if" ; static if
+                 "version")))
+(c-lang-defconst d-flat-decl-maybe-block-re
+  d (c-make-keywords-re t (c-lang-const d-flat-decl-maybe-block-kwds)))
+
+(defun d-update-brace-stack (stack from to)
+  "Modified version of `c-update-brace-stack' for d-mode." ;; checkdoc-params: 
(stack from to)
+  (d--if-version>= "26.0"
+      ;; Given a brace-stack which has the value STACK at position FROM, 
update it
+      ;; to its value at position TO, where TO is after (or equal to) FROM.
+      ;; Return a cons of either TO (if it is outside a literal) and this new
+      ;; value, or of the next position after TO outside a literal and the new
+      ;; value.
+      (let (match kwd-sym (prev-match-pos 1)
+                 (s (cdr stack))
+                 (bound-<> (car stack)))
+       (save-excursion
+         (cond
+          ((and bound-<> (<= to bound-<>))
+           (goto-char to))                     ; Nothing to do.
+          (bound-<>
+           (goto-char bound-<>)
+           (setq bound-<> nil))
+          (t (goto-char from)))
+         (while (and (< (point) to)
+                     (c-syntactic-re-search-forward
+                      (if (<= (car s) 0)
+                          c-brace-stack-thing-key
+                        c-brace-stack-no-semi-key)
+                      to 'after-literal)
+                     (> (point) prev-match-pos)) ; prevent infinite loop.
+           (setq prev-match-pos (point))
+           (setq match (match-string-no-properties 1)
+                 kwd-sym (c-keyword-sym match))
+           (cond
+            ((and (equal match "{")
+                  (progn (backward-char)
+                         (prog1 (looking-at "\\s(")
+                           (forward-char))))
+             (setq s (if s
+                         ;; D: Constructs such as "version", "static if", or
+                         ;; "extern(...)" may or may not enclose their 
declarations
+                         ;; in a {...} block. For this reason, we can't blindly
+                         ;; update the cc-mode brace stack when we see these 
keywords
+                         ;; (otherwise, if they are not immediately succeeded 
by a
+                         ;; {...} block, then the brace stack change will 
apply to
+                         ;; the next encountered {...} block such as that of a
+                         ;; function's).
+                         (if (save-excursion
+                               (backward-char)
+                               (c-backward-syntactic-ws)
+                               (when (eq (char-before) ?\))
+                                 (c-backward-sexp)
+                                 (c-backward-syntactic-ws))
+                               (c-backward-token-2)
+                               (looking-at (c-lang-const 
d-flat-decl-maybe-block-re)))
+                             ;; D: Keep the brace stack state from the parent
+                             ;; context. I.e., the contents of a "static if" 
at the
+                             ;; top level should remain top-level, but in a 
function,
+                             ;; it should remain non-top-level.
+                             (if (<= (car s) 1)
+                                 (cons 1 s)
+                               (cons (1+ (car s)) (cdr s)))
+                           (cons (if (<= (car s) 0)
+                                     1
+                                   (1+ (car s)))
+                                 (cdr s)))
+                       (list 1))))
+            ((and (equal match "}")
+                  (progn (backward-char)
+                         (prog1 (looking-at "\\s)")
+                           (forward-char))))
+             (setq s
+                   (cond
+                    ((and s (> (car s) 1))
+                     (cons (1- (car s)) (cdr s)))
+                    ((and (cdr s) (eq (car s) 1))
+                     (cdr s))
+                    (t s))))
+            ((and (equal match ":")
+                  s
+                  (eq (car s) 0))
+             (setq s (cons -1 (cdr s))))
+            ((and (equal match ",")
+                  (eq (car s) -1)))    ; at "," in "class foo : bar, ..."
+            ;; D: Ignore ")", which can be part of parameter lists
+            ((member match '(";" ","))
+             (when (and s (cdr s) (<= (car s) 0))
+               (setq s (cdr s))))
+            ((c-keyword-member kwd-sym 'c-flat-decl-block-kwds)
+             (push 0 s))))
+         ;; The failing `c-syntactic-re-search-forward' may have left us in the
+         ;; middle of a token, which might be a significant token.  Fix this!
+         (c-beginning-of-current-token)
+         (cons (point)
+               (cons bound-<> s))))
+    (error "Unsupported Emacs version")))
+
+(defun d-around--c-update-brace-stack (orig-fun &rest args)
+  ;; checkdoc-params: (orig-fun args)
+  "Advice function for fixing cc-mode handling of certain D constructs."
+  (apply
+   (if (c-major-mode-is 'd-mode)
+       #'d-update-brace-stack
+     orig-fun)
+   args))
+
+(d--if-version>= "26.0"
+    (advice-add 'c-update-brace-stack :around 
#'d-around--c-update-brace-stack))
+
+;; ----------------------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;; compilation-mode support ;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; ----------------------------------------------------------------------------
+
+;;; Patterns to recognize the compiler generated messages
+
+(defun d-mode-add-dmd-message-pattern (expr level symbol)
+  "Register DMD `compile' pattern for an error level.
+
+EXPR is the `rx' message sub-expression indicating the error level LEVEL.
+The expression is added to `compilation-error-regexp-alist' and
+`compilation-error-regexp-alist-alist' as SYMBOL."
+  (add-to-list
+   'compilation-error-regexp-alist-alist
+   `(,symbol
+     ,(rx-to-string
+      `(and
+       line-start
+       (group-n 1 (one-or-more any))           ; File name
+       "("
+       (group-n 2 (one-or-more digit))         ; Line number
+       (zero-or-one
+        ","
+        (group-n 3 (one-or-more digit)))       ; Column number
+       "): "
+       ,expr
+       (group-n 4 (one-or-more nonl))          ; Message
+       line-end))
+     1 2 3 ,level 4))
+  (add-to-list 'compilation-error-regexp-alist symbol))
+
+(d-mode-add-dmd-message-pattern "Error: "          2 'dmd-error       )
+(d-mode-add-dmd-message-pattern "Warning: "        1 'dmd-warning     )
+(d-mode-add-dmd-message-pattern "Deprecation: "    1 'dmd-deprecation )
+(d-mode-add-dmd-message-pattern '(one-or-more " ") 0 'dmd-continuation)
+
+;; The following regexp recognizes messages generated by the D runtime for
+;; unhandled exceptions (e.g. assert failures).
+
+(add-to-list 'compilation-error-regexp-alist-alist
+             '(d-exceptions
+               "^[a-zA-Z0-9.]*?@\\(.*?\\)(\\([0-9]+\\)):"
+               1 2 nil 2))
+(add-to-list 'compilation-error-regexp-alist 'd-exceptions)
+
+
+;; ----------------------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; imenu support ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; ----------------------------------------------------------------------------
+
+;; Old imenu implementation - regular expressions:
+
+(eval-when-compile
+  (defconst d--imenu-rx-def-start
+    '(seq
+      ;; Conditionals
+      (zero-or-one
+       "else"
+       (zero-or-more space))
+      (zero-or-one
+       "version"
+       (zero-or-more space)
+       "("
+       (zero-or-more space)
+       (one-or-more (any "a-zA-Z0-9_"))
+       (zero-or-more space)
+       ")"
+       (zero-or-more space))
+
+      (zero-or-more
+       (or
+       word-start
+       (or
+        ;; StorageClass
+        "deprecated"
+        "static"
+        "extern"
+        "abstract"
+        "final"
+        "override"
+        "synchronized"
+        "scope"
+        "nothrow"
+        "pure"
+        "ref"
+        (seq
+         (or
+          "extern"
+          "deprecated"
+          "package"
+          )
+         (zero-or-more space)
+         "("
+         (zero-or-more space)
+         (one-or-more (not (any "()")))
+         (zero-or-more space)
+         ")")
+
+        ;; VisibilityAttribute
+        "private"
+        "package"
+        "protected"
+        "public"
+        "export"
+        )
+
+       ;; AtAttribute
+       (seq
+        "@"
+        (one-or-more (any "a-zA-Z0-9_"))
+        (zero-or-one
+         (zero-or-more space)
+         "("
+         (zero-or-more space)
+         (one-or-more (not (any "()")))
+         (zero-or-more space)
+         ")")))
+       (zero-or-more space))
+
+      )))
 
 (defconst d-imenu-method-name-pattern
   (rx
@@ -481,24 +1360,7 @@ Each list item should be a regexp matching a single 
identifier."
    bol
    (zero-or-more space)
 
-   ;; Conditionals
-   (zero-or-one
-    "else"
-    (zero-or-more space))
-   (zero-or-one
-    "version"
-    (zero-or-more space)
-    "("
-    (zero-or-more space)
-    (one-or-more (any "a-zA-Z0-9_"))
-    (zero-or-more space)
-    ")"
-    (zero-or-more space))
-
-   ;; Qualifiers
-   (zero-or-more
-    (one-or-more (any "a-z_@()C+"))
-    (one-or-more space))
+   (eval d--imenu-rx-def-start)
 
    ;; Type
    (group
@@ -513,7 +1375,7 @@ Each list item should be a regexp matching a single 
identifier."
    ;; Type arguments
    (zero-or-one
     "(" (zero-or-more (not (any ")"))) ")"
-    (zero-or-more space))
+    (zero-or-more (any " \t\n")))
 
    ;; Arguments
    "("
@@ -553,12 +1415,13 @@ Each list item should be a regexp matching a single 
identifier."
      ;; The method name regexp will match lines like
      ;; "return foo(x);" or "static if(x) {"
      ;; so we exclude type name 'static' or 'return' here
-     (while (let ((type (match-string 1)))
-              (and pt type
+     (while (let ((type (match-string 1))
+                 (name (match-string 2)))
+              (and pt name
                    (save-match-data
-                     (string-match
-                     (concat "\\<" (c-lang-const c-regular-keywords-regexp))
-                     type))))
+                    (or
+                     (string-match (c-lang-const d-non-func-type-kwds-re) type)
+                     (string-match (c-lang-const d-non-func-name-kwds-re) 
name)))))
        (setq pt (re-search-backward d-imenu-method-name-pattern nil t)))
      pt)
    ;; Do not count invisible definitions.
@@ -574,11 +1437,9 @@ Each list item should be a regexp matching a single 
identifier."
 (defvar d-imenu-generic-expression
   `(("*Classes*"
      ,(rx
-       line-start
-       (zero-or-more (syntax whitespace))
-       (zero-or-more
-       (or "final" "abstract" "private" "package" "protected" "public" 
"export" "static")
-       (one-or-more (syntax whitespace)))
+       bol
+       (zero-or-more space)
+       (eval d--imenu-rx-def-start)
        word-start
        "class"
        (one-or-more (syntax whitespace))
@@ -591,8 +1452,9 @@ Each list item should be a regexp matching a single 
identifier."
      1)
     ("*Interfaces*"
      ,(rx
-       line-start
-       (zero-or-more (syntax whitespace))
+       bol
+       (zero-or-more space)
+       (eval d--imenu-rx-def-start)
        word-start
        "interface"
        (one-or-more (syntax whitespace))
@@ -605,11 +1467,9 @@ Each list item should be a regexp matching a single 
identifier."
      1)
     ("*Structs*"
      ,(rx
-       line-start
-       (zero-or-more (syntax whitespace))
-       (zero-or-more
-       (or "private" "package" "protected" "public" "export" "static")
-       (one-or-more (syntax whitespace)))
+       bol
+       (zero-or-more space)
+       (eval d--imenu-rx-def-start)
        word-start
        "struct"
        (one-or-more (syntax whitespace))
@@ -622,8 +1482,9 @@ Each list item should be a regexp matching a single 
identifier."
      1)
     ("*Templates*"
      ,(rx
-       line-start
-       (zero-or-more (syntax whitespace))
+       bol
+       (zero-or-more space)
+       (eval d--imenu-rx-def-start)
        (zero-or-one
        "mixin"
        (one-or-more (syntax whitespace)))
@@ -639,8 +1500,9 @@ Each list item should be a regexp matching a single 
identifier."
      1)
     ("*Enums*"
      ,(rx
-       line-start
-       (zero-or-more (syntax whitespace))
+       bol
+       (zero-or-more space)
+       (eval d--imenu-rx-def-start)
        word-start
        "enum"
        (one-or-more (syntax whitespace))
@@ -658,7 +1520,8 @@ Each list item should be a regexp matching a single 
identifier."
     ;; declared at the beginning of lines.
     ("*Aliases*"
      ,(rx
-       line-start
+       bol
+       (eval d--imenu-rx-def-start)
        "alias"
        (one-or-more (syntax whitespace))
        (submatch
@@ -668,11 +1531,17 @@ Each list item should be a regexp matching a single 
identifier."
              (?A . ?Z)
              (?a . ?z))))
        (zero-or-more (syntax whitespace))
+       (zero-or-one
+        "("
+        (zero-or-more (not (any "()")))
+        ")"
+        (zero-or-more (syntax whitespace)))
        "=")
      1)
     ("*Aliases*"
      ,(rx
-       line-start
+       bol
+       (eval d--imenu-rx-def-start)
        "alias"
        (one-or-more (syntax whitespace))
        (one-or-more
@@ -696,35 +1565,248 @@ Each list item should be a regexp matching a single 
identifier."
     (nil d-imenu-method-index-function 2)))
 
 ;;----------------------------------------------------------------------------
-;;; Workaround for special case of 'else static if' not being handled properly
-(defun d-special-case-looking-at (orig-fun &rest args)
-  ;; checkdoc-params: (orig-fun args)
-  "Advice function for fixing cc-mode indentation in certain D constructs."
-  (let ((rxp (car args)))
-    (if (and (stringp rxp) (string= rxp "if\\>[^_]"))
-        (or (apply orig-fun '("static\\>\\s-+if\\>[^_]"))
-            (apply orig-fun '("version\\>[^_]"))
-            (apply orig-fun '("debug\\>[^_]"))
-            (apply orig-fun args))
-      (apply orig-fun args))))
+;; New imenu implementation - use cc-mode machinery:
+
+(defun d-imenu-create-index-function ()
+  "Create imenu entries for D-mode."
+  (d--if-version>= "26.0"
+      (progn
+       (goto-char (point-min))
+       (c-save-buffer-state
+           (d-spots last-spot (d-blocks (make-hash-table)))
+         (c-find-decl-spots
+          (point-max)
+          c-decl-start-re
+          (eval c-maybe-decl-faces)
+          (lambda (match-pos inside-macro toplev)
+            (when toplev
+              (let* ((got-context
+                      (c-get-fontification-context
+                       match-pos nil toplev))
+                     (context (car got-context))
+                     (decl-or-cast
+                      (when (eq context 'top)
+                        (d-forward-decl-or-cast-1
+                         match-pos
+                         context
+                         nil ; last-cast-end
+                         ))))
+                (when (and decl-or-cast (not (eq (car decl-or-cast) 
last-spot)))
+                  (let* ((decl-end (point))
+                         (id-start (progn
+                                     (goto-char (car decl-or-cast))
+                                     (when (eq (char-after) ?=)
+                                       (c-backward-syntactic-ws)
+                                       (c-simple-skip-symbol-backward))
+                                     (point)))
+                         (id-end (progn
+                                   (goto-char id-start)
+                                   (cond
+                                    ((d-forward-identifier)
+                                     (point))
+                                    ((looking-at (d-make-keywords-re t 
'("this" "~this")))
+                                     (match-end 1)))))
+                         (name (when id-end
+                                 (buffer-substring-no-properties id-start 
id-end)))
+                         (id-prev-token (progn
+                                          (goto-char id-start)
+                                          (c-backward-syntactic-ws)
+                                          (let ((end (point)))
+                                            (when 
(c-simple-skip-symbol-backward)
+                                              (buffer-substring-no-properties 
(point) end)))))
+                         (type-start (cadddr decl-or-cast))
+                         (type-token (and type-start
+                                          (progn
+                                            (goto-char type-start)
+                                            (looking-at c-symbol-key))
+                                          (match-string-no-properties 0)))
+                         (type-prev-token (when type-start
+                                            (goto-char type-start)
+                                            (c-backward-syntactic-ws)
+                                            (let ((end (point)))
+                                              (when 
(c-simple-skip-symbol-backward)
+                                                
(buffer-substring-no-properties (point) end)))))
+                         (next-char (when id-end
+                                      (goto-char id-end)
+                                      (c-forward-syntactic-ws)
+                                      (char-after)))
+                         (res (cond
+                               ((null name)
+                                nil)
+                               ((equal id-prev-token "else")
+                                nil) ; false positive after else
+                               ((equal name "{")
+                                nil) ; false positive with decl-start keyword 
and {...} group
+                               ((equal id-prev-token "enum")
+                                '("Enums" t))
+                               ((equal id-prev-token "class")
+                                '("Classes" t))
+                               ((equal id-prev-token "struct")
+                                '("Structs" t))
+                               ((equal id-prev-token "template")
+                                '("Templates" t))
+                               ((equal id-prev-token "alias")
+                                '("Aliases" nil))
+                               ((equal type-token "alias")
+                                '("Aliases" nil)) ; old-style alias
+                               ((memq next-char '(?\; ?= ?,))
+                                nil) ; '("variable" nil))
+                               ((member name '("import" "if"))
+                                nil) ; static import/if
+                               ((memq next-char '(?\())
+                                '(nil t)) ; function
+                               (t ; unknown
+                                (list id-prev-token nil))))
+                         (kind (car res))
+                         (have-block (cadr res))
+                         (paren-state (when res (c-parse-state)))
+                         (outer-brace match-pos)
+                         d-context
+                         d-fqname)
+
+                    (when res
+                      (when paren-state
+                        ;; Find brace with known context
+                        (while (and outer-brace
+                                    (not d-context))
+                          (setq outer-brace (c-most-enclosing-brace 
paren-state outer-brace))
+                          (setq d-context (gethash outer-brace d-blocks))))
+
+                      (setq d-fqname (if d-context (concat d-context "." name) 
name))
+
+                      (when have-block
+                        (goto-char decl-end)
+                        (when (and (c-syntactic-re-search-forward "[{};]" nil 
t)
+                                   (eq (char-before) ?{))
+                          (puthash (1- (point)) d-fqname d-blocks)))
+
+                      (setq last-spot (car decl-or-cast)
+                            d-spots
+                            (cons
+                             (if kind
+                                 (cons kind (list (cons d-fqname id-start)))
+                               (cons d-fqname id-start))
+                             d-spots)))))))))
+         (nreverse d-spots)))
+    (error "Unsupported Emacs version")))
+
+;; ----------------------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;; Major mode definition ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; ----------------------------------------------------------------------------
 
-(defun d-around--c-add-stmt-syntax (orig-fun &rest args)
-  ;; checkdoc-params: (orig-fun args)
-  "Advice function for fixing cc-mode indentation in certain D constructs."
-  (if (not (string= major-mode "d-mode"))
-      (apply orig-fun args)
-    (progn
-      (add-function :around (symbol-function 'looking-at)
-                    #'d-special-case-looking-at)
-      (unwind-protect
-          (apply orig-fun args)
-        (remove-function (symbol-function 'looking-at)
-                         #'d-special-case-looking-at)))))
+(defcustom d-font-lock-extra-types nil
+  "*List of extra types (aside from the type keywords) to recognize in D mode.
+
+Each list item should be a regexp matching a single identifier."
+  :type '(repeat regexp)
+  :group 'd-mode)
 
-(when (version<= "24.4" emacs-version)
-  (advice-add 'c-add-stmt-syntax :around #'d-around--c-add-stmt-syntax))
+(c-lang-defconst c-basic-matchers-after
+  d (append
+     ;; D keywords
+     (list (c-make-font-lock-BO-decl-search-function
+           (concat "\\_<"
+                   (c-make-keywords-re t (append (c-lang-const c-ref-list-kwds 
d)
+                                                 (c-lang-const 
c-paren-nontype-kwds d))
+                                       'd))
+            '((c-fontify-types-and-refs ()
+               (d-forward-keyword-clause 1)
+               (if (> (point) limit) (goto-char limit))))))
+     ;; cc-mode defaults
+     (c-lang-const c-basic-matchers-after)))
+
+(defconst d-font-lock-keywords-1 (c-lang-const c-matchers-1 d)
+  "Minimal highlighting for D mode.")
+
+(defconst d-font-lock-keywords-2 (c-lang-const c-matchers-2 d)
+  "Fast normal highlighting for D mode.")
+
+(defconst d-font-lock-keywords-3 (c-lang-const c-matchers-3 d)
+  "Accurate normal highlighting for D mode.")
+
+(defvar d-font-lock-keywords d-font-lock-keywords-3
+  "Default expressions to highlight in D mode.")
+
+(defun d-font-lock-keywords-2 ()
+  "Function to get fast normal highlighting for D mode."
+  (c-compose-keywords-list d-font-lock-keywords-2))
+(defun d-font-lock-keywords-3 ()
+  "Function to get accurate normal highlighting for D mode."
+  (c-compose-keywords-list d-font-lock-keywords-3))
+(defun d-font-lock-keywords ()
+  "Function to get default expressions to highlight in D mode."
+  (c-compose-keywords-list d-font-lock-keywords))
+
+(defvar d-mode-syntax-table nil
+  "Syntax table used in d-mode buffers.")
+(or d-mode-syntax-table
+    (setq d-mode-syntax-table
+        (let ((table (funcall (c-lang-const c-make-mode-syntax-table d))))
+          ;; Make it recognize D `backquote strings`
+          (modify-syntax-entry ?` "\"" table)
+
+          ;; Make it recognize D's nested /+ +/ comments
+          (modify-syntax-entry ?+  ". 23n"   table)
+          table)))
+
+(defvar d-mode-abbrev-table nil
+  "Abbreviation table used in d-mode buffers.")
+(c-define-abbrev-table 'd-mode-abbrev-table
+  ;; Use the abbrevs table to trigger indentation actions
+  ;; on keywords that, if they occur first on a line, might alter the
+  ;; syntactic context.
+  ;; Syntax for abbrevs is:
+  ;; ( pattern replacement command initial-count)
+  '(("else" "else" c-electric-continued-statement 0)
+    ("while" "while" c-electric-continued-statement 0)
+    ("catch" "catch" c-electric-continued-statement 0)
+    ("finally" "finally" c-electric-continued-statement 0)))
+
+(defvar d-mode-map ()
+  "Keymap used in d-mode buffers.")
+(if d-mode-map
+    nil
+  (setq d-mode-map (c-make-inherited-keymap))
+  ;; Add bindings which are only useful for D
+  ;; (define-key d-mode-map "\C-c\C-e"  'd-cool-function)
+  )
+
+(c-lang-defconst c-mode-menu
+  ;; The definition for the mode menu.  The menu title is prepended to
+  ;; this before it's fed to `easy-menu-define'.
+  d `(["Comment Out Region"     comment-region
+       (c-fn-region-is-active-p)]
+      ["Uncomment Region"       (comment-region (region-beginning)
+                                               (region-end) '(4))
+       (c-fn-region-is-active-p)]
+      ["Indent Expression"      c-indent-exp
+       (memq (char-after) '(?\( ?\[ ?\{))]
+      ["Indent Line or Region"  c-indent-line-or-region t]
+      ["Fill Comment Paragraph" c-fill-paragraph t]
+      "----"
+      ["Backward Statement"     c-beginning-of-statement t]
+      ["Forward Statement"      c-end-of-statement t]
+      "----"
+      ("Toggle..."
+       ["Syntactic indentation" c-toggle-syntactic-indentation
+       :style toggle :selected c-syntactic-indentation]
+       ["Electric mode"         c-toggle-electric-state
+       :style toggle :selected c-electric-flag]
+       ["Auto newline"          c-toggle-auto-newline
+       :style toggle :selected c-auto-newline]
+       ["Hungry delete"         c-toggle-hungry-state
+       :style toggle :selected c-hungry-delete-key]
+       ["Subword mode"          c-subword-mode
+       :style toggle :selected (and (boundp 'c-subword-mode)
+                                     c-subword-mode)])))
+
+(easy-menu-define d-menu d-mode-map "D Mode Commands"
+  (cons "D" (c-lang-const c-mode-menu d)))
 
 ;;----------------------------------------------------------------------------
+
 ;;;###autoload
 (add-to-list 'auto-mode-alist '("\\.d[i]?\\'" . d-mode))
 
@@ -758,81 +1840,24 @@ Key bindings:
   ;; Concretely, inside back-quoted string literals the backslash
   ;; character '\' is treated as a punctuation symbol.  See help for
   ;; syntax-propertize-rules function for more information.
-  (when (version<= "24.3" emacs-version)
-    (setq-local
-     syntax-propertize-function
-     (syntax-propertize-rules
-      ((rx
-       "`"
-       (minimal-match
-        (zero-or-more
-         (not (any "`\\"))))
-       (minimal-match
-        (zero-or-more
-         (submatch "\\")
-         (minimal-match
-          (zero-or-more
-           (not (any "`\\"))))))
-       "`")
-       (1 ".")))))
+  (setq-local
+   syntax-propertize-function
+   #'d--syntax-propertize-function)
 
   (c-common-init 'd-mode)
   (easy-menu-add d-menu)
   (c-run-mode-hooks 'c-mode-common-hook 'd-mode-hook)
   (c-update-modeline)
-  (cc-imenu-init d-imenu-generic-expression))
+  (d--if-version>= "26.0"
+      (cc-imenu-init nil #'d-imenu-create-index-function)
+    (cc-imenu-init d-imenu-generic-expression)))
 
-;;----------------------------------------------------------------------------
-;; "Hideous hacks" to support appropriate font-lock behaviour.
-;;
-;; * auto/const/immutable: If we leave them in c-modifier-kwds (like
-;;   c++-mode) then in the form "auto var;" var will be highlighted in
-;;   type name face. Moving auto/immutable to font-lock-add-keywords
-;;   lets cc-mode seeing them as a type name, so the next symbol can
-;;   be fontified as a variable.
-;;
-;; * public/protected/private appear both in c-modifier-kwds and in
-;;   c-protection-kwds. This causes cc-mode to fail parsing the first
-;;   declaration after an access level label (because cc-mode trys to
-;;   parse them as modifier but will fail due to the colon). But
-;;   unfortunately we cannot remove them from either c-modifier-kwds
-;;   or c-protection-kwds. Removing them from the former causes valid
-;;   syntax like "private int foo() {}" to fail. Removing them from
-;;   the latter cause indentation of the access level labels to
-;;   fail. The solution used here is to use font-lock-add-keywords to
-;;   add back the syntax highlight.
-
-(defconst d-var-decl-pattern "^[ \t]*\\(?:[_a-zA-Z0-9]+[ 
\t\n]+\\)*\\([_a-zA-Z0-9.!]+\\)\\(?:\\[[^]]*\\]\\|\\*\\)?[ 
\t\n]+\\([_a-zA-Z0-9]+\\)[ \t\n]*[;=]")
-(defconst d-fun-decl-pattern "^[ \t]*\\(?:[_a-zA-Z0-9]+[ 
\t\n]+\\)*\\([_a-zA-Z0-9.!]+\\)\\(?:\\[[^]]*\\]\\|\\*\\)?[ 
\t\n]+\\([_a-zA-Z0-9]+\\)[ \t\n]*(")
-(defmacro d-try-match-decl (regex)
-  "Helper macro." ;; checkdoc-params: regex
-  `(let ((pt))
-     (setq pt (re-search-forward ,regex limit t))
-     (while (let ((type (match-string 1)))
-              (and pt type
-                   (save-match-data
-                     (string-match (c-lang-const c-regular-keywords-regexp) 
type))))
-       (setq pt (re-search-forward ,regex limit t)))
-     pt))
-(defun d-match-var-decl (limit)
-  "Helper function." ;; checkdoc-params: limit
-  (d-try-match-decl d-var-decl-pattern))
-(defun d-match-fun-decl (limit)
-  "Helper function." ;; checkdoc-params: limit
-  (d-try-match-decl d-fun-decl-pattern))
-(defun d-match-auto (limit)
-  "Helper function." ;; checkdoc-params: limit
-  (c-syntactic-re-search-forward "\\<\\(auto\\|const\\|immutable\\)\\>" limit 
t))
-
-(font-lock-add-keywords
- 'd-mode
- '((d-match-auto 1 font-lock-keyword-face t)
-   (d-match-var-decl (1 font-lock-type-face) (2 font-lock-variable-name-face))
-   (d-match-fun-decl (1 font-lock-type-face) (2 font-lock-function-name-face)))
- t)
+;; ----------------------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Optional features ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; ----------------------------------------------------------------------------
 
-;;----------------------------------------------------------------------------
-;;
 ;; Support for "Adjusting Alignment Rules for UCFS-Chains in D",
 ;; cf. 
https://stackoverflow.com/questions/25797945/adjusting-alignment-rules-for-ucfs-chains-in-d
 ;;
@@ -903,6 +1928,23 @@ parameters in function calls." ;; checkdoc-params: 
langelem
 
 ;;----------------------------------------------------------------------------
 
+(defun d-lineup-arglists (elem)
+  "Line up runtime argument list with compile-time argument list.
+
+Works with: func-decl-cont." ;; checkdoc-params: (elem)
+  (save-excursion
+    (beginning-of-line)
+    (c-backward-syntactic-ws)
+    (let ((c (char-before)))
+      (cond
+       ((eq c ?\))
+       (c-go-list-backward)
+       (vector (current-column)))
+       (t
+       "+")))))
+
+;;----------------------------------------------------------------------------
+
 (provide 'd-mode)
 
 ;;; d-mode.el ends here
diff --git a/gplv2.txt b/gplv2.txt
deleted file mode 100644
index d511905..0000000
--- a/gplv2.txt
+++ /dev/null
@@ -1,339 +0,0 @@
-                   GNU GENERAL PUBLIC LICENSE
-                      Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-                           Preamble
-
-  The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users.  This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it.  (Some other Free Software Foundation software is covered by
-the GNU Lesser General Public License instead.)  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
-this service 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 make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
-  For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have.  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.
-
-  We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
-  Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software.  If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
-  Finally, any free program is threatened constantly by software
-patents.  We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary.  To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.
-
-                   GNU GENERAL PUBLIC LICENSE
-   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-  0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License.  The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language.  (Hereinafter, translation is included without limitation in
-the term "modification".)  Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope.  The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
-  1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
-  2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-    a) You must cause the modified files to carry prominent notices
-    stating that you changed the files and the date of any change.
-
-    b) You must cause any work that you distribute or publish, that in
-    whole or in part contains or is derived from the Program or any
-    part thereof, to be licensed as a whole at no charge to all third
-    parties under the terms of this License.
-
-    c) If the modified program normally reads commands interactively
-    when run, you must cause it, when started running for such
-    interactive use in the most ordinary way, to print or display an
-    announcement including an appropriate copyright notice and a
-    notice that there is no warranty (or else, saying that you provide
-    a warranty) and that users may redistribute the program under
-    these conditions, and telling the user how to view a copy of this
-    License.  (Exception: if the Program itself is interactive but
-    does not normally print such an announcement, your work based on
-    the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole.  If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works.  But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
-  3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
-    a) Accompany it with the complete corresponding machine-readable
-    source code, which must be distributed under the terms of Sections
-    1 and 2 above on a medium customarily used for software interchange; or,
-
-    b) Accompany it with a written offer, valid for at least three
-    years, to give any third party, for a charge no more than your
-    cost of physically performing source distribution, a complete
-    machine-readable copy of the corresponding source code, to be
-    distributed under the terms of Sections 1 and 2 above on a medium
-    customarily used for software interchange; or,
-
-    c) Accompany it with the information you received as to the offer
-    to distribute corresponding source code.  (This alternative is
-    allowed only for noncommercial distribution and only if you
-    received the program in object code or executable form with such
-    an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it.  For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable.  However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-  4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License.  Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
-  5. You are not required to accept this License, since you have not
-signed it.  However, nothing else grants you permission to modify or
-distribute the Program or its derivative works.  These actions are
-prohibited by law if you do not accept this License.  Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
-  6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions.  You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
-  7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-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
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all.  For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices.  Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-  8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded.  In such case, this License incorporates
-the limitation as if written in the body of this License.
-
-  9. The Free Software Foundation may publish revised and/or new versions
-of the 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 a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation.  If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
-  10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission.  For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this.  Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
-                           NO WARRANTY
-
-  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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.
-
-  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE 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.
-
-                    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
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the program's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-    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 2 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, write to the Free Software Foundation, Inc.,
-    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
-    Gnomovision version 69, Copyright (C) year name of author
-    Gnomovision 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, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary.  Here is a sample; alter the names:
-
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
-  `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
-  <signature of Ty Coon>, 1 April 1989
-  Ty Coon, President of Vice
-
-This 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.
diff --git a/tests-todo/templated_enum.d b/tests-todo/templated_enum.d
new file mode 100644
index 0000000..a340d0d
--- /dev/null
+++ b/tests-todo/templated_enum.d
@@ -0,0 +1,11 @@
+/*
+  The symbol here is mis-fontified as a function. The reason for this
+  is that c-forward-decl-or-cast-1 understands the statement as not
+  containing types, and then passes this information to
+  c-font-lock-declarators. We can't get away with merely patching
+  c-font-lock-declarators because at the moment it's called, it
+  doesn't have enough information to know that it's actually dealing
+  with an enum.
+ */
+
+enum bool isForwardRange(R) = 1;
diff --git a/tests/I0019.d b/tests/I0019.d
new file mode 100644
index 0000000..37c058a
--- /dev/null
+++ b/tests/I0019.d
@@ -0,0 +1,8 @@
+// #min-version: 25.1
+// #run: (d-test-indent)
+
+enum OtherValues2 : uint {
+  a = 2u,
+  b = 4u,
+  c
+}
diff --git a/tests/I0030.d.html b/tests/I0030.d.html
index 9a529ca..af79491 100644
--- a/tests/I0030.d.html
+++ b/tests/I0030.d.html
@@ -1,6 +1,6 @@
 <span class="comment-delimiter">// </span><span class="comment">#run: 
(d-test-fontification)
 </span>
-<span class="keyword">const class</span> C
+<span class="keyword">const class</span> <span class="type">C</span>
 {
        <span class="type">int</span> <span 
class="function-name">getFoo</span>() <span class="keyword">const</span> { 
<span class="keyword">return</span> 42; }
 
diff --git a/tests/I0054.d b/tests/I0054.d
new file mode 100644
index 0000000..1127930
--- /dev/null
+++ b/tests/I0054.d
@@ -0,0 +1,20 @@
+// #run: (d-test-fontification)
+
+module aaa;
+
+import bbb;
+
+module aaa.bbb.ccc;
+
+import aaa.bbb;
+import aaa.Bbb;
+import aaa.bbb.ccc;
+import Aaa.Bbb.ccc;
+import Aaa.Bbb.Ccc;
+import aaa.bbb.Ccc;
+
+import ddd = aaa.bbb.ccc, vvv = xxx.yyy.zzz;
+import aaa.bbb.ccc : x, y, z;
+import aaa.bbb.ccc : i = x, j = y, k = z;
+
+import a.b.c : d;
diff --git a/tests/I0054.d.html b/tests/I0054.d.html
new file mode 100644
index 0000000..933e5de
--- /dev/null
+++ b/tests/I0054.d.html
@@ -0,0 +1,20 @@
+<span class="comment-delimiter">// </span><span class="comment">#run: 
(d-test-fontification)
+</span>
+<span class="keyword">module</span> <span class="constant">aaa</span>;
+
+<span class="keyword">import</span> <span class="constant">bbb</span>;
+
+<span class="keyword">module</span> <span class="constant">aaa</span>.<span 
class="constant">bbb</span>.<span class="constant">ccc</span>;
+
+<span class="keyword">import</span> <span class="constant">aaa</span>.<span 
class="constant">bbb</span>;
+<span class="keyword">import</span> <span class="constant">aaa</span>.<span 
class="constant">Bbb</span>;
+<span class="keyword">import</span> <span class="constant">aaa</span>.<span 
class="constant">bbb</span>.<span class="constant">ccc</span>;
+<span class="keyword">import</span> <span class="constant">Aaa</span>.<span 
class="constant">Bbb</span>.<span class="constant">ccc</span>;
+<span class="keyword">import</span> <span class="constant">Aaa</span>.<span 
class="constant">Bbb</span>.<span class="constant">Ccc</span>;
+<span class="keyword">import</span> <span class="constant">aaa</span>.<span 
class="constant">bbb</span>.<span class="constant">Ccc</span>;
+
+<span class="keyword">import</span> <span class="constant">ddd</span> = <span 
class="constant">aaa</span>.<span class="constant">bbb</span>.<span 
class="constant">ccc</span>, <span class="constant">vvv</span> = <span 
class="constant">xxx</span>.<span class="constant">yyy</span>.<span 
class="constant">zzz</span>;
+<span class="keyword">import</span> <span class="constant">aaa</span>.<span 
class="constant">bbb</span>.<span class="constant">ccc</span> : x, y, z;
+<span class="keyword">import</span> <span class="constant">aaa</span>.<span 
class="constant">bbb</span>.<span class="constant">ccc</span> : i = x, j = y, k 
= z;
+
+<span class="keyword">import</span> <span class="constant">a</span>.<span 
class="constant">b</span>.<span class="constant">c</span> : d;
diff --git a/tests/I0058.d b/tests/I0058.d
new file mode 100644
index 0000000..8ad6833
--- /dev/null
+++ b/tests/I0058.d
@@ -0,0 +1,39 @@
+// #run: (d-test-indent)
+
+double foo(double b)
+in
+  {
+    assert(b == b);
+  }
+out (result)
+  {
+    assert(result == result);
+  }
+body
+  {
+    return b;
+  }
+
+double foo (double b)
+out (result)
+  {
+    assert(result == result);
+  }
+body
+  {
+    return b;
+  }
+
+double foo (double b)
+in
+  {
+    assert(b == b);
+  }
+body
+  {
+    return b;
+  }
+
+
+int fun() @nogc;
+int bar;
diff --git a/tests/I0067.d b/tests/I0067.d
new file mode 100644
index 0000000..159ac92
--- /dev/null
+++ b/tests/I0067.d
@@ -0,0 +1,19 @@
+// #min-version: 26.1
+// #run: (d-test-indent)
+
+void foo(T)(T stuff)
+if (isInputRange!T) {
+}
+
+struct S
+{
+  void foo()()
+  if (true)
+    {
+    }
+
+  this()()
+  if (true)
+    {
+    }
+}
diff --git a/tests/I0070.d b/tests/I0070.d
new file mode 100644
index 0000000..e9bb6df
--- /dev/null
+++ b/tests/I0070.d
@@ -0,0 +1,6 @@
+// #run: (progn (c-set-offset 'func-decl-cont #'d-lineup-arglists) 
(d-test-indent))
+
+auto foo(A, B, C)
+        (A a, B b, C c)
+{
+}
diff --git a/tests/I0082.d b/tests/I0082.d
new file mode 100644
index 0000000..b3d81eb
--- /dev/null
+++ b/tests/I0082.d
@@ -0,0 +1,9 @@
+// #min-version: 26.1
+// #run: (d-test-fontification)
+
+struct S
+{
+       this(Object o) {}
+       this(Object* o) {}
+       this(Object * o) {}
+}
diff --git a/tests/I0082.d.html b/tests/I0082.d.html
new file mode 100644
index 0000000..e2084b5
--- /dev/null
+++ b/tests/I0082.d.html
@@ -0,0 +1,9 @@
+<span class="comment-delimiter">// </span><span class="comment">#min-version: 
26.1
+</span><span class="comment-delimiter">// </span><span class="comment">#run: 
(d-test-fontification)
+</span>
+<span class="keyword">struct</span> <span class="type">S</span>
+{
+       <span class="keyword">this</span>(<span class="type">Object</span> 
<span class="variable-name">o</span>) {}
+       <span class="keyword">this</span>(<span class="type">Object</span>* 
<span class="variable-name">o</span>) {}
+       <span class="keyword">this</span>(<span class="type">Object</span> * 
<span class="variable-name">o</span>) {}
+}
diff --git a/tests/fonts.d b/tests/I0090.d
similarity index 54%
copy from tests/fonts.d
copy to tests/I0090.d
index 3c4ce87..86fa9f6 100644
--- a/tests/fonts.d
+++ b/tests/I0090.d
@@ -2,5 +2,5 @@
 
 void main()
 {
-       assert(true);
+       auto err = "`\"`"; // This is a comment
 }
diff --git a/tests/I0090.d.html b/tests/I0090.d.html
new file mode 100644
index 0000000..69382fa
--- /dev/null
+++ b/tests/I0090.d.html
@@ -0,0 +1,6 @@
+<span class="comment-delimiter">// </span><span class="comment">#run: 
(d-test-fontification)
+</span>
+<span class="type">void</span> <span class="function-name">main</span>()
+{
+       <span class="keyword">auto</span> <span 
class="variable-name">err</span> = <span 
class="string">&quot;`\&quot;`&quot;</span>; <span class="comment-delimiter">// 
</span><span class="comment">This is a comment
+</span>}
diff --git a/tests/I0093_35907724.d b/tests/I0093_35907724.d
new file mode 100644
index 0000000..96b1de3
--- /dev/null
+++ b/tests/I0093_35907724.d
@@ -0,0 +1,4 @@
+// #min-version: 26.1
+// #run: (d-test-fontification)
+
+foreach (const offset, const ref element; haystack) fun();
diff --git a/tests/I0093_35907724.d.html b/tests/I0093_35907724.d.html
new file mode 100644
index 0000000..7e5965a
--- /dev/null
+++ b/tests/I0093_35907724.d.html
@@ -0,0 +1,4 @@
+<span class="comment-delimiter">// </span><span class="comment">#min-version: 
26.1
+</span><span class="comment-delimiter">// </span><span class="comment">#run: 
(d-test-fontification)
+</span>
+<span class="keyword">foreach</span> (<span class="keyword">const</span> <span 
class="variable-name">offset</span>, <span class="keyword">const ref</span> 
<span class="variable-name">element</span>; haystack) fun();
diff --git a/tests/fonts.d b/tests/I0093_541009399.d
similarity index 56%
copy from tests/fonts.d
copy to tests/I0093_541009399.d
index 3c4ce87..5978e9a 100644
--- a/tests/fonts.d
+++ b/tests/I0093_541009399.d
@@ -1,6 +1,7 @@
 // #run: (d-test-fontification)
 
-void main()
+struct S
 {
-       assert(true);
+    @safe:
+    T x;
 }
diff --git a/tests/I0093_541009399.d.html b/tests/I0093_541009399.d.html
new file mode 100644
index 0000000..3063c02
--- /dev/null
+++ b/tests/I0093_541009399.d.html
@@ -0,0 +1,7 @@
+<span class="comment-delimiter">// </span><span class="comment">#run: 
(d-test-fontification)
+</span>
+<span class="keyword">struct</span> <span class="type">S</span>
+{
+    <span class="keyword">@safe</span>:
+    <span class="type">T</span> <span class="variable-name">x</span>;
+}
diff --git a/tests/fonts.d b/tests/I0093_546738540.d
similarity index 56%
copy from tests/fonts.d
copy to tests/I0093_546738540.d
index 3c4ce87..909a081 100644
--- a/tests/fonts.d
+++ b/tests/I0093_546738540.d
@@ -1,6 +1,5 @@
 // #run: (d-test-fontification)
 
-void main()
+void f(T)(scope return T x)
 {
-       assert(true);
 }
diff --git a/tests/I0093_546738540.d.html b/tests/I0093_546738540.d.html
new file mode 100644
index 0000000..7f39ecb
--- /dev/null
+++ b/tests/I0093_546738540.d.html
@@ -0,0 +1,5 @@
+<span class="comment-delimiter">// </span><span class="comment">#run: 
(d-test-fontification)
+</span>
+<span class="type">void</span> <span class="function-name">f</span>(<span 
class="type">T</span>)(<span class="keyword">scope return</span> <span 
class="type">T</span> <span class="variable-name">x</span>)
+{
+}
diff --git a/tests/fonts.d b/tests/I0093_552200397.d
similarity index 51%
copy from tests/fonts.d
copy to tests/I0093_552200397.d
index 3c4ce87..b9ff7f1 100644
--- a/tests/fonts.d
+++ b/tests/I0093_552200397.d
@@ -1,6 +1,4 @@
 // #run: (d-test-fontification)
 
-void main()
-{
-       assert(true);
-}
+@safe:
+class C { }
diff --git a/tests/I0093_552200397.d.html b/tests/I0093_552200397.d.html
new file mode 100644
index 0000000..a2a4397
--- /dev/null
+++ b/tests/I0093_552200397.d.html
@@ -0,0 +1,4 @@
+<span class="comment-delimiter">// </span><span class="comment">#run: 
(d-test-fontification)
+</span>
+<span class="keyword">@safe</span>:
+<span class="keyword">class</span> <span class="type">C</span> { }
diff --git a/tests/I0093_572717721.d b/tests/I0093_572717721.d
new file mode 100644
index 0000000..b8f1ebb
--- /dev/null
+++ b/tests/I0093_572717721.d
@@ -0,0 +1,4 @@
+// #run: (d-test-fontification)
+
+package class A {}
+package abstract class B {}
diff --git a/tests/I0093_572717721.d.html b/tests/I0093_572717721.d.html
new file mode 100644
index 0000000..6bca237
--- /dev/null
+++ b/tests/I0093_572717721.d.html
@@ -0,0 +1,4 @@
+<span class="comment-delimiter">// </span><span class="comment">#run: 
(d-test-fontification)
+</span>
+<span class="keyword">package class</span> <span class="type">A</span> {}
+<span class="keyword">package abstract class</span> <span 
class="type">B</span> {}
diff --git a/tests/I0095.d b/tests/I0095.d
new file mode 100644
index 0000000..4080419
--- /dev/null
+++ b/tests/I0095.d
@@ -0,0 +1,9 @@
+// #run: (d-test-fontification)
+
+alias Type = int;
+
+void foo(const(Type) param);
+
+const(Type) bar(const(Type) param);
+
+const(Type) baz(ref const(Type) param, lazy int param2);
diff --git a/tests/I0095.d.html b/tests/I0095.d.html
new file mode 100644
index 0000000..a9f7452
--- /dev/null
+++ b/tests/I0095.d.html
@@ -0,0 +1,9 @@
+<span class="comment-delimiter">// </span><span class="comment">#run: 
(d-test-fontification)
+</span>
+<span class="keyword">alias</span> <span class="variable-name">Type</span> = 
<span class="type">int</span>;
+
+<span class="type">void</span> <span class="function-name">foo</span>(<span 
class="keyword">const</span>(<span class="type">Type</span>) <span 
class="variable-name">param</span>);
+
+<span class="keyword">const</span>(<span class="type">Type</span>) <span 
class="function-name">bar</span>(<span class="keyword">const</span>(<span 
class="type">Type</span>) <span class="variable-name">param</span>);
+
+<span class="keyword">const</span>(<span class="type">Type</span>) <span 
class="function-name">baz</span>(<span class="keyword">ref const</span>(<span 
class="type">Type</span>) <span class="variable-name">param</span>, <span 
class="keyword">lazy</span> <span class="type">int</span> <span 
class="variable-name">param2</span>);
diff --git a/tests/fonts.d b/tests/fonts.d
index 3c4ce87..533eef0 100644
--- a/tests/fonts.d
+++ b/tests/fonts.d
@@ -3,4 +3,66 @@
 void main()
 {
        assert(true);
+
+       string[string] aa; string s;
+       assert(s in aa);
+
+       aa[s].length;
+
+       run(a ~ b);
+}
+
+version(none) string readLink();
+
+static if (true) {} else fun();
+static if (true) {} else void fun();
+
+scope(exit) fun();
+scope(exit) void fun();
+version(all) void fun();
+pragma(msg, "Hi!");
+enum x = true && __traits(compiles, true) && true;
+
+@property empty() { return false; }
+
+auto s = "enum Type {}";
+
+assert(a !in b);
+if (a.length * b.length) {}
+assert(a !is double.nan);
+if (a.b in c) {}
+write(s ~ "");
+
+invariant {}
+
+class Foo : Bar {}
+enum Foo : Bar {}
+
+.TopLevelType var;
+
+debug bool resolveNeeded = false;
+
+void fun()
+{
+       submodule.needHead(commit);
+       return gun();
+}
+
+void fun()
+{
+       if (a) {}
+       while (a) {}
+       for (a; b; c) {}
+       switch (a) {}
+       final switch (a) {}
+       with (a) {}
+       synchronized (a) {}
+       debug (a) {}
+}
+
+void fun()
+{
+       if (a) {}
+       auto x = cast(T)y;
+       return gun();
 }
diff --git a/tests/fonts.d.html b/tests/fonts.d.html
index 8096111..e26b7b7 100644
--- a/tests/fonts.d.html
+++ b/tests/fonts.d.html
@@ -3,4 +3,66 @@
 <span class="type">void</span> <span class="function-name">main</span>()
 {
        <span class="keyword">assert</span>(<span class="constant">true</span>);
+
+       <span class="type">string</span>[<span class="type">string</span>] 
<span class="variable-name">aa</span>; <span class="type">string</span> <span 
class="variable-name">s</span>;
+       <span class="keyword">assert</span>(s <span class="keyword">in</span> 
aa);
+
+       aa[s].length;
+
+       run(a ~ b);
+}
+
+<span class="keyword">version</span>(<span class="constant">none</span>) <span 
class="type">string</span> <span class="function-name">readLink</span>();
+
+<span class="keyword">static if</span> (<span class="constant">true</span>) {} 
<span class="keyword">else</span> fun();
+<span class="keyword">static if</span> (<span class="constant">true</span>) {} 
<span class="keyword">else</span> <span class="type">void</span> <span 
class="function-name">fun</span>();
+
+<span class="keyword">scope</span>(<span class="constant">exit</span>) fun();
+<span class="keyword">scope</span>(<span class="constant">exit</span>) <span 
class="type">void</span> <span class="function-name">fun</span>();
+<span class="keyword">version</span>(<span class="constant">all</span>) <span 
class="type">void</span> <span class="function-name">fun</span>();
+<span class="keyword">pragma</span>(<span class="constant">msg</span>, <span 
class="string">&quot;Hi!&quot;</span>);
+<span class="keyword">enum</span> <span class="variable-name">x</span> = <span 
class="constant">true</span> &amp;&amp; <span 
class="keyword">__traits</span>(<span class="constant">compiles</span>, <span 
class="constant">true</span>) &amp;&amp; <span class="constant">true</span>;
+
+<span class="keyword">@property</span> <span 
class="function-name">empty</span>() { <span class="keyword">return</span> 
<span class="constant">false</span>; }
+
+<span class="keyword">auto</span> <span class="variable-name">s</span> = <span 
class="string">&quot;enum Type {}&quot;</span>;
+
+<span class="keyword">assert</span>(a <span 
class="negation-char">!</span><span class="keyword">in</span> b);
+<span class="keyword">if</span> (a.length * b.length) {}
+<span class="keyword">assert</span>(a <span 
class="negation-char">!</span><span class="keyword">is</span> <span 
class="type">double</span>.nan);
+<span class="keyword">if</span> (a.b <span class="keyword">in</span> c) {}
+write(s ~ <span class="string">&quot;&quot;</span>);
+
+<span class="keyword">invariant</span> {}
+
+<span class="keyword">class</span> <span class="type">Foo</span> : <span 
class="type">Bar</span> {}
+<span class="keyword">enum</span> <span class="type">Foo</span> : <span 
class="type">Bar</span> {}
+
+.<span class="type">TopLevelType</span> <span class="variable-name">var</span>;
+
+<span class="keyword">debug</span> <span class="type">bool</span> <span 
class="variable-name">resolveNeeded</span> = <span 
class="constant">false</span>;
+
+<span class="type">void</span> <span class="function-name">fun</span>()
+{
+       submodule.needHead(commit);
+       <span class="keyword">return</span> gun();
+}
+
+<span class="type">void</span> <span class="function-name">fun</span>()
+{
+       <span class="keyword">if</span> (a) {}
+       <span class="keyword">while</span> (a) {}
+       <span class="keyword">for</span> (a; b; c) {}
+       <span class="keyword">switch</span> (a) {}
+       <span class="keyword">final switch</span> (a) {}
+       <span class="keyword">with</span> (a) {}
+       <span class="keyword">synchronized</span> (a) {}
+       <span class="keyword">debug</span> (<span class="constant">a</span>) {}
+}
+
+<span class="type">void</span> <span class="function-name">fun</span>()
+{
+       <span class="keyword">if</span> (a) {}
+       <span class="keyword">auto</span> <span class="variable-name">x</span> 
= <span class="keyword">cast</span>(<span class="type">T</span>)y;
+       <span class="keyword">return</span> gun();
 }
diff --git a/tests/fonts_auto.d b/tests/fonts_auto.d
new file mode 100644
index 0000000..3f66f8b
--- /dev/null
+++ b/tests/fonts_auto.d
@@ -0,0 +1,15 @@
+// #run: (d-test-fontification)
+
+/*
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+auto
+*/
diff --git a/tests/fonts_auto.d.html b/tests/fonts_auto.d.html
new file mode 100644
index 0000000..50cf818
--- /dev/null
+++ b/tests/fonts_auto.d.html
@@ -0,0 +1,15 @@
+<span class="comment-delimiter">// </span><span class="comment">#run: 
(d-test-fontification)
+</span>
+<span class="comment-delimiter">/*</span><span class="comment">
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+auto
+*/</span>
diff --git a/tests/fonts_enums.d b/tests/fonts_enums.d
new file mode 100644
index 0000000..547bffc
--- /dev/null
+++ b/tests/fonts_enums.d
@@ -0,0 +1,22 @@
+// #run: (d-test-fontification)
+
+auto var = true;
+enum var = true;
+enum int var = true;
+
+enum
+{
+       a = 1
+}
+enum : int
+{
+       a = 1
+}
+enum Foo
+{
+       a = 1
+}
+enum Foo : int
+{
+       a = 1
+}
diff --git a/tests/fonts_enums.d.html b/tests/fonts_enums.d.html
new file mode 100644
index 0000000..16bb4b9
--- /dev/null
+++ b/tests/fonts_enums.d.html
@@ -0,0 +1,22 @@
+<span class="comment-delimiter">// </span><span class="comment">#run: 
(d-test-fontification)
+</span>
+<span class="keyword">auto</span> <span class="variable-name">var</span> = 
<span class="constant">true</span>;
+<span class="keyword">enum</span> <span class="variable-name">var</span> = 
<span class="constant">true</span>;
+<span class="keyword">enum</span> <span class="type">int</span> <span 
class="variable-name">var</span> = <span class="constant">true</span>;
+
+<span class="keyword">enum</span>
+{
+       <span class="variable-name">a</span> = 1
+}
+<span class="keyword">enum</span> : <span class="type">int</span>
+{
+       <span class="variable-name">a</span> = 1
+}
+<span class="keyword">enum</span> <span class="type">Foo</span>
+{
+       <span class="variable-name">a</span> = 1
+}
+<span class="keyword">enum</span> <span class="type">Foo</span> : <span 
class="type">int</span>
+{
+       <span class="variable-name">a</span> = 1
+}
diff --git a/tests/fonts_params.d b/tests/fonts_params.d
new file mode 100644
index 0000000..578ce38
--- /dev/null
+++ b/tests/fonts_params.d
@@ -0,0 +1,24 @@
+// #min-version: 26.1
+// #run: (d-test-fontification)
+
+auto dg = (Object a, Object b) {};
+alias dg2 = (a, b) {};
+
+alias dg3 = a => a + 1;
+alias dg4 = fun(a => a + 1);
+alias dg5 = fun(a, b => b + 1);
+
+void fun()
+{
+       each!((key) {});
+
+       foreach (a; c) foo();
+       foreach (a, b; c) foo();
+       foreach (a; c) {}
+       foreach (a, b; c) {}
+
+       try {} catch (Exception e) {}
+       try {} catch (Exception) {}
+       try {} catch (Exception e) run();
+       try {} catch (Exception) run();
+}
diff --git a/tests/fonts_params.d.html b/tests/fonts_params.d.html
new file mode 100644
index 0000000..447f8e1
--- /dev/null
+++ b/tests/fonts_params.d.html
@@ -0,0 +1,24 @@
+<span class="comment-delimiter">// </span><span class="comment">#min-version: 
26.1
+</span><span class="comment-delimiter">// </span><span class="comment">#run: 
(d-test-fontification)
+</span>
+<span class="keyword">auto</span> <span class="variable-name">dg</span> = 
(<span class="type">Object</span> <span class="variable-name">a</span>, <span 
class="type">Object</span> <span class="variable-name">b</span>) {};
+<span class="keyword">alias</span> <span class="variable-name">dg2</span> = 
(<span class="variable-name">a</span>, <span class="variable-name">b</span>) {};
+
+<span class="keyword">alias</span> <span class="variable-name">dg3</span> = 
<span class="variable-name">a</span> =&gt; a + 1;
+<span class="keyword">alias</span> <span class="variable-name">dg4</span> = 
fun(<span class="variable-name">a</span> =&gt; a + 1);
+<span class="keyword">alias</span> <span class="variable-name">dg5</span> = 
fun(a, <span class="variable-name">b</span> =&gt; b + 1);
+
+<span class="type">void</span> <span class="function-name">fun</span>()
+{
+       each<span class="negation-char">!</span>((<span 
class="variable-name">key</span>) {});
+
+       <span class="keyword">foreach</span> (<span 
class="variable-name">a</span>; c) foo();
+       <span class="keyword">foreach</span> (<span 
class="variable-name">a</span>, <span class="variable-name">b</span>; c) foo();
+       <span class="keyword">foreach</span> (<span 
class="variable-name">a</span>; c) {}
+       <span class="keyword">foreach</span> (<span 
class="variable-name">a</span>, <span class="variable-name">b</span>; c) {}
+
+       <span class="keyword">try</span> {} <span class="keyword">catch</span> 
(<span class="type">Exception</span> <span class="variable-name">e</span>) {}
+       <span class="keyword">try</span> {} <span class="keyword">catch</span> 
(<span class="type">Exception</span>) {}
+       <span class="keyword">try</span> {} <span class="keyword">catch</span> 
(<span class="type">Exception</span> <span class="variable-name">e</span>) 
run();
+       <span class="keyword">try</span> {} <span class="keyword">catch</span> 
(<span class="type">Exception</span>) run();
+}
diff --git a/tests/fonts_protection.d b/tests/fonts_protection.d
new file mode 100644
index 0000000..c7960bc
--- /dev/null
+++ b/tests/fonts_protection.d
@@ -0,0 +1,10 @@
+// #run: (d-test-fontification)
+
+class C
+{
+       Type var1, var2;
+public:
+       Type var3, var4;
+}
+
+// package: // TODO!
diff --git a/tests/fonts_protection.d.html b/tests/fonts_protection.d.html
new file mode 100644
index 0000000..e2d82be
--- /dev/null
+++ b/tests/fonts_protection.d.html
@@ -0,0 +1,11 @@
+<span class="comment-delimiter">// </span><span class="comment">#run: 
(d-test-fontification)
+</span>
+<span class="keyword">class</span> <span class="type">C</span>
+{
+       <span class="type">Type</span> <span class="variable-name">var1</span>, 
<span class="variable-name">var2</span>;
+<span class="keyword">public</span>:
+       <span class="type">Type</span> <span class="variable-name">var3</span>, 
<span class="variable-name">var4</span>;
+}
+
+<span class="comment-delimiter">// </span><span class="comment">package: // 
TODO!
+</span>
\ No newline at end of file
diff --git a/tests/fonts_types.d b/tests/fonts_types.d
new file mode 100644
index 0000000..64432c5
--- /dev/null
+++ b/tests/fonts_types.d
@@ -0,0 +1,15 @@
+// #run: (d-test-fontification)
+
+const(Tpl!int) var1;
+const(Tpl!(int, "", [1, 2, 3])*) var2;
+
+assert(to!string(d) == to!string(double.max));
+
+private void resetFile(string name, scope const(char)[] stdioOpenmode, bool 
isPopened) @trusted {}
+
+Parameter!("foo()").Foo var;
+
+void foo(in Type var);
+void foo(out Type var);
+
+static string[string] applyEnv(in string[string] target, in string[string] 
source);
diff --git a/tests/fonts_types.d.html b/tests/fonts_types.d.html
new file mode 100644
index 0000000..70c0372
--- /dev/null
+++ b/tests/fonts_types.d.html
@@ -0,0 +1,15 @@
+<span class="comment-delimiter">// </span><span class="comment">#run: 
(d-test-fontification)
+</span>
+<span class="keyword">const</span>(<span class="type">Tpl</span><span 
class="negation-char">!</span><span class="type">int</span>) <span 
class="variable-name">var1</span>;
+<span class="keyword">const</span>(<span class="type">Tpl</span><span 
class="negation-char">!</span>(<span class="type">int</span>, <span 
class="string">&quot;&quot;</span>, [1, 2, 3])*) <span 
class="variable-name">var2</span>;
+
+<span class="keyword">assert</span>(to<span 
class="negation-char">!</span><span class="type">string</span>(d) == to<span 
class="negation-char">!</span><span class="type">string</span>(<span 
class="type">double</span>.max));
+
+<span class="keyword">private</span> <span class="type">void</span> <span 
class="function-name">resetFile</span>(<span class="type">string</span> <span 
class="variable-name">name</span>, <span class="keyword">scope 
const</span>(<span class="type">char</span>)[] <span 
class="variable-name">stdioOpenmode</span>, <span class="type">bool</span> 
<span class="variable-name">isPopened</span>) <span 
class="keyword">@trusted</span> {}
+
+<span class="type">Parameter</span><span class="negation-char">!</span>(<span 
class="string">&quot;foo()&quot;</span>).<span class="type">Foo</span> <span 
class="variable-name">var</span>;
+
+<span class="type">void</span> <span class="function-name">foo</span>(<span 
class="keyword">in</span> <span class="type">Type</span> <span 
class="variable-name">var</span>);
+<span class="type">void</span> <span class="function-name">foo</span>(<span 
class="keyword">out</span> <span class="type">Type</span> <span 
class="variable-name">var</span>);
+
+<span class="keyword">static</span> <span class="type">string</span>[<span 
class="type">string</span>] <span class="function-name">applyEnv</span>(<span 
class="keyword">in</span> <span class="type">string</span>[<span 
class="type">string</span>] <span class="variable-name">target</span>, <span 
class="keyword">in</span> <span class="type">string</span>[<span 
class="type">string</span>] <span class="variable-name">source</span>);
diff --git a/tests/imenu.d b/tests/imenu.d
index 9559331..14d0616 100644
--- a/tests/imenu.d
+++ b/tests/imenu.d
@@ -1,5 +1,5 @@
 // #run: (d-test-get-imenu-lines)
-// #out: (4 6 11 14 17 19 22 25 33 34 37 40 43 46 49 52 54 56 67)
+// #out: (4 6 11 14 17 19 22 25 33 34 37 40 43 46 49 52 54 56 67 75 78 81 84 
87 89 93 94 96 98 101)
 
 void foo(int x) {}
 
@@ -70,3 +70,32 @@ Entry getLog()
                return foo(x);
        }
 }
+
+// Conditional declarations
+version(CoreDdoc) enum ClockType {}
+
+// Extern declarations
+extern (D) void peekSlice() {}
+
+// Aliases with VisibilityAttribute / StorageClass
+public alias foo=bar;
+
+// alias template
+public alias Regex(Char) = std.regex.internal.ir.Regex!(Char);
+
+// AtAttribute
+@trusted public struct RegexMatch(R, alias Engine = ThompsonMatcher) {}
+
+string relativePath(CaseSensitive cs = CaseSensitive.osDefault)
+    (string path, lazy string base = getcwd())
+{}
+
+inout(ubyte) bytes(){}
+immutable(ubyte) bytes(){}
+
+mixin template MT()
+{
+       void fun() {}
+}
+
+package string fillParameters(string name, string[] arguments) {}
diff --git a/tests/imenu2.d b/tests/imenu2.d
new file mode 100644
index 0000000..7607d68
--- /dev/null
+++ b/tests/imenu2.d
@@ -0,0 +1,58 @@
+// #min-version: 26.1
+// #run: (d-test-get-imenu-lines)
+// #out: (5 6 13 18 20 24 28 33 37 40 42 46 49 50 51 52 54 56)
+
+void run(Parameter!("foo()") command) {}
+Parameter!("foo()") run(string command) {}
+
+string[string] environment;
+
+static import std.process;
+
+alias
+       Number
+       =
+       int;
+
+static if (false)
+       int fun();
+else
+       int gun();
+
+version (all)
+{
+       int fun();
+}
+else
+{
+       int gun();
+}
+
+static if (true)
+{
+       int fun();
+}
+else
+{
+       int gun();
+}
+
+class S
+{
+       int fun();
+
+       private
+       {
+               int gun();
+       }
+
+       this() {}
+       ~this() {}
+       static this() {}
+       static ~this() {}
+
+       struct X
+       {
+               int nun();
+       }
+}
diff --git a/tests/indent_protection.d b/tests/indent_protection.d
new file mode 100644
index 0000000..75ac3b6
--- /dev/null
+++ b/tests/indent_protection.d
@@ -0,0 +1,8 @@
+// #run: (d-test-indent)
+
+class C
+{
+  Type var1, var2;
+public:
+  Type var3, var4;
+}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]