« Return to Thread: Syntax Highlighting for Gherkin

Syntax Highlighting for Gherkin

by Torbjörn Klatt-2 :: Rate this Message:

| View in Thread

Hi all,

I just started writing a syntax highlighting file for Gherkin, a DSL used by
Cucumber for Behaviour Driven Development and software testing. [1, 2]

For defining the syntax highlighting rules (which color, font style etc. for
which keywords etc.) I got inspired by the nice pictures on [2]. ;-)

See http://paste.kde.org/184718/ for a semantic discription of the colors and
font styles. (I used square brakets) As well for a sample Gherkin script,
which should have the file extenstion .feature (above the dashed line).

Here is my current version of the gherkin_en.xml: http://paste.kde.org/184712/

However, I've got some truble getting the syntax highlighting file right.

The detection of the multiline strings (enclosed in triple quotes) does not
work as expected. How can this be achieved?

And the biggest problem so far I've got in defining the text after on of the
"words" {'In order', 'As', 'I want'} to be green and the words themself in
blue same to the step definitions {'Given', 'When', 'Then', 'And', 'But'}.
What am I missing?


The final problem however is Gherkin's localization. The keywords are defined
in over 40 spoken languages and my highlighting file here is only for English.
Is there a way of having one syntax highlighting file for all of Gherkin's
languages instead of one for each language and thus a overloaded menu in Kate?


Cheers,
Torbjörn

PS: This is my first highlighting file and I tried hard understanding the
documentation at [3].


[1] Gherkin: https://github.com/cucumber/cucumber/wiki/Gherkin
[2] Cucumber: http://cukes.info/
[3] http://kate-editor.org/2005/03/24/writing-a-syntax-highlighting-file/


_______________________________________________
KWrite-Devel mailing list
KWrite-Devel@...
https://mail.kde.org/mailman/listinfo/kwrite-devel

signature.asc (501 bytes) Download Attachment

 « Return to Thread: Syntax Highlighting for Gherkin