1
0
mirror of https://github.com/alecthomas/chroma.git synced 2025-02-05 13:05:18 +02:00

cfengine3 (#766)

* Fix CommentPreproc

Macros (i.e.) CommentPreproc need to be anchored as they are only
allowed to be put on the start of the line. This also solved the
conflict with nakedvar @(....).

Signed-off-by: Miek Gieben <miek@miek.nl>

* Fix NameClass

NameClass (`xxx::`) can _also_ contain variables, so add " and $ to the
allowed list in the regexp. This now also needs to be put earlier to
match before any strings.

Signed-off-by: Miek Gieben <miek@miek.nl>

---------

Signed-off-by: Miek Gieben <miek@miek.nl>
This commit is contained in:
Miek Gieben 2023-03-17 08:08:27 +01:00 committed by GitHub
parent 7e30655df1
commit cc132eda75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -38,7 +38,7 @@
<rule pattern="#.*?\n">
<token type="Comment"/>
</rule>
<rule pattern="@.*?\n">
<rule pattern="^@.*?\n">
<token type="CommentPreproc"/>
</rule>
<rule pattern="(body)(\s+)(\S+)(\s+)(control)">
@ -78,6 +78,12 @@
<token type="Text"/>
</bygroups>
</rule>
<rule pattern="([\w.!&amp;|()&#34;&#36;]+)(::)">
<bygroups>
<token type="NameClass"/>
<token type="Punctuation"/>
</bygroups>
</rule>
<rule pattern="&#34;">
<token type="LiteralString"/>
<push state="doublequotestring"/>
@ -96,12 +102,6 @@
<token type="Punctuation"/>
</bygroups>
</rule>
<rule pattern="([\w.!&amp;|()]+)(::)">
<bygroups>
<token type="NameClass"/>
<token type="Punctuation"/>
</bygroups>
</rule>
<rule pattern="(\w+)(:)">
<bygroups>
<token type="KeywordDeclaration"/>