mattp511 / google-code-prettify

Automatically exported from code.google.com/p/google-code-prettify
Apache License 2.0
0 stars 0 forks source link

Add highlight of Cucumber scenarios #222

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Gherkin isn't in list of supported languages and is highlighted incorrectly by 
default (words that don't have special meaning in Gherkin are highlighted).

Gherkin scenarios should be highlighted as per section "Tool Developers" at 
https://github.com/cucumber/gherkin/wiki/tool-support

Original issue reported on code.google.com by botalov....@gmail.com on 9 Jun 2012 at 9:40

GoogleCodeExporter commented 8 years ago

Is Gherkin syntactically similar other supported languages?

Do you have a Gherkin grammar handly?  I notice some lexers at that link, but 
no keyword list.

Do you have a test snippet of Gherkin code and anything showing how you would 
like it highlighted?

Original comment by mikesamuel@gmail.com on 5 Feb 2013 at 2:31

GoogleCodeExporter commented 8 years ago
Gherkin has the following keywords:

Given
When
Then
And
But
*
Scenario:
Scenario Outline:
Examples:
Background:
Feature:

Those combinations of symbols are keywords only if there are no whitespace 
characters (spaces and tabs) before it.

So in row:
  Given word1 When word2 Then
only the first Given should be highlighted

Those keywords also have aliases and translations to most of the world 
languages (see 
https://github.com/cucumber/gherkin/blob/master/lib/gherkin/i18n.json) but I 
think supporting them will add a lot of code to JS library so maybe it's not 
necessary to support.

Also Gherkin supports comments. Comment is comment if "#" is the first 
non-whitespace character at the line. Gherkin doesn't support end of line 
comments.

Original comment by botalov....@gmail.com on 5 Feb 2013 at 8:10