scone/contrib/kde-syntax-highlighting/scoml.xml

202 lines
9.5 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2020, Olivier 'reivilibre'.
~
~ This file is part of Scone.
~
~ Scone 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.
~
~ Scone 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 Scone. If not, see <https://www.gnu.org/licenses/>.
-->
<!DOCTYPE language SYSTEM "language.dtd"
[
<!ENTITY more "(_\d+)*">
<!ENTITY int "[+-]?(0|[1-9]\d*)&more;">
<!ENTITY frac "\.\d+&more;">
<!ENTITY exp "[eE][+-]?\d+&more;">
<!ENTITY offset "[+-]\d\d:\d\d">
<!ENTITY time "\d\d:\d\d:\d\d(\.\d+)?(&offset;|Z)?">
<!ENTITY datetime "\d\d\d\d-\d\d-\d\d(T&time;)?">
]>
<!-- https://github.com/toml-lang/toml -->
<!-- This is a derivative of the TOML highlighter by flying-sheep@web.de under the LGPLv2+ -->
<language name="Scone Menu Language (ScoML)" section="Configuration" extensions="*.scoml" mimetype="text/x-scone-menu" version="1" kateversion="5.0" author="flying-sheep@web.de, Olivier 'reivilibre'" license="LGPLv2+">
<highlighting>
<list name="bools">
<item>true</item>
<item>false</item>
</list>
<list name="directives">
<item>@user</item>
<item>@sous</item>
<item>@for</item>
<item>@after</item>
</list>
<contexts>
<context attribute="Error" lineEndContext="#stay" name="Scoml">
<IncludeRules context="BlockCommon"/>
</context>
<!-- recipe headers -->
<context attribute="RecipeHeader" lineEndContext="Recipe" name="RecipeHeader">
<Detect2Chars attribute="RecipeHeader" context="RecipeHeaderHuman" char="]" char1="]" />
<DetectSpaces attribute="Whitespace"/>
<!-- <DetectChar attribute="TableHeader" context="#stay" char="."/> -->
<RegExpr attribute="RecipeName" context="#stay" String="[\w-]+"/>
<!--<DetectChar attribute="Key" context="QuotedKey" char="&quot;"/>-->
</context>
<context attribute="Human" name="RecipeHeaderHuman" lineEndContext="#pop!Recipe">
<RegExpr context="#stay" String="[^\n]+"/>
</context>
<context attribute="Error" name="Recipe" lineEndContext="#stay">
<DetectSpaces attribute="Whitespace"/>
<Detect2Chars attribute="RecipeHeader" context="#pop!RecipeHeader" char="[" char1="[" endRegion="Recipe" beginRegion="Recipe" />
<DetectChar attribute="SubBlockHeader" context="#pop!SubBlockHeader" char="{" beginRegion="SubBlock" endRegion="Recipe" />
<DetectChar context="#pop" char="}" endRegion="Recipe" lookAhead="true" />
<!--<DetectChar attribute="TableHeader" context="TableHeader" char="[" endRegion="Table"/>-->
<RegExpr attribute="Key" context="#stay" String="[\w-]+" firstNonSpace="true"/>
<DetectChar attribute="Key" context="QuotedKey" char="&quot;" firstNonSpace="true"/>
<DetectChar attribute="Assignment" context="Value" char="="/>
<DetectChar char="#" attribute="Comment" context="Comment"/>
<keyword attribute="Directive" String="directives" context="#stay"/> <!-- todo recognise the stuff after a directive too -->
</context>
<!-- sub blocks -->
<context attribute="Error" lineEndContext="#stay" name="SubBlock">
<DetectChar attribute="SubBlock" context="#pop" char="}" endRegion="SubBlock"/>
<IncludeRules context="BlockCommon"/>
</context>
<context attribute="SubBlockHeader" lineEndContext="SubBlock" name="SubBlockHeader">
<RegExpr attribute="Human" context="#stay" String="[^\n]+"/>
</context>
<context attribute="Block" lineEndContext="#stay" name="BlockCommon">
<DetectSpaces attribute="Whitespace"/>
<Detect2Chars attribute="RecipeHeader" context="RecipeHeader" char="[" char1="[" beginRegion="Recipe" />
<DetectChar attribute="SubBlockHeader" context="SubBlockHeader" char="{" beginRegion="SubBlock"/>
<!--<DetectChar attribute="TableHeader" context="TableHeader" char="[" endRegion="Table"/>-->
<RegExpr attribute="Key" context="#stay" String="[\w-]+" firstNonSpace="true"/>
<DetectChar attribute="Key" context="QuotedKey" char="&quot;" firstNonSpace="true"/>
<DetectChar attribute="Assignment" context="Value" char="="/>
<DetectChar char="#" attribute="Comment" context="Comment"/>
<keyword attribute="Directive" String="directives" context="#stay"/> <!-- todo recognise the stuff after a directive too -->
</context>
<!-- values -->
<context attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop" name="Value">
<DetectSpaces attribute="Whitespace"/>
<RegExpr attribute="Date" context="#stay" String="&datetime;"/>
<keyword attribute="Bool" String="bools" context="#stay"/>
<RegExpr attribute="Float" context="#stay" String="&int;(&frac;&exp;|&frac;|&exp;)"/>
<RegExpr attribute="Int" context="#stay" String="&int;"/>
<StringDetect attribute="String" context="MultilineString" String="&quot;&quot;&quot;"/>
<DetectChar attribute="String" context="String" char="&quot;"/>
<StringDetect attribute="String" context="LitMultilineString" String="'''"/>
<DetectChar attribute="String" context="LitString" char="'"/>
<DetectChar attribute="Array" context="Array" char="["/>
<DetectChar attribute="InlineTable" context="InlineTable" char="{"/>
<DetectChar char="#" attribute="Comment" context="Comment"/>
</context>
<context attribute="Comment" lineEndContext="#pop" name="Comment">
<DetectSpaces/>
<IncludeRules context="##Alerts" />
<IncludeRules context="##Modelines" />
<DetectIdentifier/>
</context>
<!-- Quoted keys and Strings -->
<context attribute="Key" lineEndContext="#pop" name="QuotedKey">
<LineContinue attribute="Escape" context="#stay"/>
<RegExpr attribute="Escape" String="\\[btnfr&quot;\\]" context="#stay" />
<RegExpr attribute="Escape" String="\\(u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})" context="#stay" />
<RegExpr attribute="Error" String="\\." context="#stay" />
<DetectChar attribute="Key" context="#pop" char="&quot;"/>
</context>
<context attribute="String" lineEndContext="#pop" name="String">
<LineContinue attribute="Escape" context="#stay"/>
<RegExpr attribute="Escape" String="\\[btnfr&quot;\\]" context="#stay" />
<RegExpr attribute="Escape" String="\\(u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})" context="#stay" />
<RegExpr attribute="Error" String="\\." context="#stay" />
<DetectChar attribute="String" context="#pop" char="&quot;"/>
</context>
<context attribute="String" lineEndContext="#stay" name="MultilineString">
<LineContinue attribute="Escape" context="#stay"/>
<RegExpr attribute="Escape" String="\\[btnfr&quot;\\]" context="#stay" />
<RegExpr attribute="Escape" String="\\(u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})" context="#stay" />
<RegExpr attribute="Error" String="\\." context="#stay" />
<StringDetect attribute="String" context="#pop" String="&quot;&quot;&quot;"/>
</context>
<context attribute="LitString" lineEndContext="#pop" name="LitString">
<DetectChar attribute="String" context="#pop" char="'"/>
</context>
<context attribute="LitString" lineEndContext="#stay" name="LitMultilineString">
<StringDetect attribute="String" context="#pop" String="'''"/>
</context>
<!-- Arrays -->
<context attribute="Array" lineEndContext="#stay" name="Array">
<IncludeRules context="Value" />
<DetectChar context="#pop" attribute="Array" char="]" />
<DetectChar context="#stay" attribute="NextEntry" char="," />
</context>
<context attribute="InlineTable" lineEndContext="#stay" name="InlineTable">
<RegExpr attribute="Key" context="#stay" String="[\w-]+"/>
<DetectChar attribute="Key" context="QuotedKey" char="&quot;"/>
<DetectChar attribute="Assignment" context="Value" char="="/>
<DetectChar char="#" attribute="Comment" context="Comment"/>
<DetectChar context="#pop" attribute="InlineTable" char="}" />
<DetectChar context="#stay" attribute="NextEntry" char="," />
</context>
</contexts>
<itemDatas>
<itemData name="Normal Text" defStyleNum="dsNormal"/>
<itemData name="Key" defStyleNum="dsDataType"/>
<itemData name="RecipeHeader" defStyleNum="dsKeyword"/>
<itemData name="RecipeName" defStyleNum="dsControlFlow"/>
<itemData name="Assignment" defStyleNum="dsOperator"/>
<itemData name="Comment" defStyleNum="dsComment"/>
<itemData name="Date" defStyleNum="dsBaseN"/>
<itemData name="Float" defStyleNum="dsFloat"/>
<itemData name="Int" defStyleNum="dsDecVal"/>
<itemData name="Bool" defStyleNum="dsConstant"/>
<itemData name="String" defStyleNum="dsString"/>
<itemData name="LitString" defStyleNum="dsVerbatimString"/>
<itemData name="Escape" defStyleNum="dsSpecialChar"/>
<itemData name="Array" defStyleNum="dsOperator"/>
<itemData name="InlineTable" defStyleNum="dsOperator"/>
<itemData name="NextEntry" defStyleNum="dsOperator"/>
<itemData name="SubBlockHeader" defStyleNum="dsKeyword"/>
<itemData name="Directive" defStyleNum="dsPreprocessor"/>
<itemData name="Human" defStyleNum="dsAnnotation"/>
<itemData name="Whitespace" defStyleNum="dsNormal"/>
<itemData name="Error" defStyleNum="dsError"/>
</itemDatas>
</highlighting>
<general>
<comments>
<comment name="singleLine" start="#" position="afterwhitespace" />
</comments>
</general>
</language>
<!-- kate: replace-tabs off; -->