Skip to content

Instantly share code, notes, and snippets.

@openbrian
Created February 22, 2018 18:20
Show Gist options
  • Save openbrian/b979f993cffd1c44e3b61036c6615d46 to your computer and use it in GitHub Desktop.
Save openbrian/b979f993cffd1c44e3b61036c6615d46 to your computer and use it in GitHub Desktop.
Gherkin syntax highlighting for KWrite, Kate, KDevelop
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd">
<!-- Gherkin, syntax definition based on sql-postgresql.xml by Yury Lebedev -->
<language name="Gherkin" version="0.1" kateversion="2.4" section="Other" extensions="*.feature;*.FEATURE" mimetype="text/x-gherkin" casesensitive="0" author="Brian DeRocher (brian@derocher)" license="GPL">
<highlighting>
<list name="keywords">
<item> FEATURE: </item>
<item> SCENARIO: </item>
<item> SCENARIO OUTLINE: </item>
<item> BACKGROUND: </item>
<item> EXAMPLES: </item>
</list>
<list name="functions">
<item> GIVEN </item>
<item> WHEN </item>
<item> THEN </item>
<item> AND </item>
<item> BUT </item>
</list>
<contexts>
<context name="Normal" attribute="Normal Text" lineEndContext="#stay">
<keyword attribute="Keyword" context="#stay" String="keywords"/>
<keyword attribute="Function" context="#stay" String="functions"/>
<RegExpr attribute="Annotation" context="#stay" String="@[_\w]+"/>
<Float attribute="Float" context="#stay"/>
<Int attribute="Decimal" context="#stay"/>
<DetectChar attribute="String" context="String" char="'"/>
<DetectChar attribute="String" context="String" char="&quot;"/>
<DetectChar attribute="Comment" context="SingleLineComment" char="#"/>
</context>
<context name="String" attribute="String" lineEndContext="#stay">
<DetectChar attribute="String" context="#pop" char="'"/>
<DetectChar attribute="String" context="#pop" char="&quot;"/>
</context>
<context name="SingleLineComment" attribute="Comment" lineEndContext="#pop"/>
<context name="Identifier" attribute="Identifier" lineEndContext="#pop">
<DetectChar attribute="Identifier" context="#pop" char="&quot;"/>
</context>
</contexts>
<itemDatas>
<itemData name="Annotation" defStyleNum="dsAttribute"/>
<itemData name="Normal Text" defStyleNum="dsNormal"/>
<itemData name="Keyword" defStyleNum="dsKeyword"/>
<itemData name="Function" defStyleNum="dsFunction"/>
<itemData name="Decimal" defStyleNum="dsDecVal"/>
<itemData name="Float" defStyleNum="dsFloat"/>
<itemData name="String" defStyleNum="dsString"/>
<itemData name="String Char" defStyleNum="dsChar"/>
<itemData name="Comment" defStyleNum="dsComment"/>
<itemData name="Identifier" defStyleNum="dsOthers"/>
</itemDatas>
</highlighting>
<general>
<comments>
<comment name="singleLine" start="#"/>
</comments>
<keywords casesensitive="0" weakDeliminator="+-*/|=!&lt;&gt;~^:.@&amp;#%?"/>
</general>
</language>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment