From 378937891cc1a985194e4fcd39a56e6685a2759e Mon Sep 17 00:00:00 2001
From: Jon Seidel <jseidel@edpci.com>
Date: Sun, 29 Mar 2015 17:07:43 -0700
Subject: [PATCH] Add cucumber/feature language definitions

---
 src/default.css         | 17 +++++++++--------
 src/default.style       | 11 ++++++++++-
 src/esc.style           | 11 ++++++++++-
 src/esc256.style        |  9 +++++++++
 src/feature.lang        | 26 ++++++++++++++++++++++++++
 src/lang.map            | 19 +++----------------
 tests/test.feature      | 40 ++++++++++++++++++++++++++++++++++++++++
 tests/test.feature.html | 31 +++++++++++++++++++++++++++++++
 8 files changed, 138 insertions(+), 26 deletions(-)
 create mode 100644 src/feature.lang
 create mode 100644 tests/test.feature
 create mode 100644 tests/test.feature.html

diff --git a/src/default.css b/src/default.css
index d58bfe8..09e496b 100644
--- a/src/default.css
+++ b/src/default.css
@@ -1,11 +1,7 @@
 body {  background-color: white;  }
 
-/* the color for context lines (when specified with line ranges) */
-.context {  color: gray; }
-
 .keyword { color: blue; font-weight: bold; }
-.type { color: darkgreen; }
-.usertype, .classname { color: teal; }
+.type, .classname { color: darkgreen; }
 .string { color: red; font-family: monospace; }
 .regexp { color: orange; }
 .specialchar { color: pink; font-family: monospace; }
@@ -50,6 +46,11 @@ body {  background-color: white;  }
 .property { color: blue; }
 .value { color: darkgreen; font-style: italic; }
 
-/* for Oz */
-.atom { color: orange; }
-.meta { font-style: italic; }
+/* for feature/cucumber files */
+.cuketag { color: green; }
+.gherken { color: blue; }
+.given { color: red; }
+.when { color: cyan; }
+.then { color: yellow; }
+.and_but { color: pink; }
+.table { color: white; }
diff --git a/src/default.style b/src/default.style
index 24d7886..d0f41be 100644
--- a/src/default.style
+++ b/src/default.style
@@ -69,4 +69,13 @@ label teal b;
 
 // for errors
 error purple;
-warning darkgreen;
\ No newline at end of file
+warning darkgreen;
+
+// for feature (Cucumber) files
+cuketag green ;
+gherken blue ;
+given red ;
+when cyan ;
+then yellow ;
+and_but pink ;
+table white ;
diff --git a/src/esc.style b/src/esc.style
index c9451d9..626659b 100644
--- a/src/esc.style
+++ b/src/esc.style
@@ -32,4 +32,13 @@ difflines blue;
 // for css
 selector purple;
 property blue;
-value darkgreen i;
\ No newline at end of file
+value darkgreen i;
+
+// for feature (Cucumber) files
+cuketag green ;
+gherken blue ;
+given red ;
+when cyan ;
+then yellow ;
+and_but pink ;
+table white ;
diff --git a/src/esc256.style b/src/esc256.style
index 7b1b720..5cde492 100644
--- a/src/esc256.style
+++ b/src/esc256.style
@@ -40,3 +40,12 @@ value green ;
 // specialchar
 // symbol
 // ====
+
+// for feature (Cucumber) files
+cuketag green ;
+gherken blue ;
+given red ;
+when cyan ;
+then yellow ;
+and_but pink ;
+table gray ;
diff --git a/src/feature.lang b/src/feature.lang
new file mode 100644
index 0000000..ff8ddf3
--- /dev/null
+++ b/src/feature.lang
@@ -0,0 +1,26 @@
+# Cucumber / feature file lang definition file
+# Probably can remove some definitions, since FFs are so simple
+
+include "number.lang"
+
+string delim "\"" "\"" escape "\\"
+string delim "'" "'"  escape "\\"
+string delim "<" ">"
+
+keyword ="Feature|Background|Scenario|Scenario Outline|Examples"
+
+# type = '(\$[#]?|@@|@)([[:word:]]+|\'|\"|/)'
+
+include "script_comment.lang"
+
+# Define cucumber tables
+table = '^\s*\|([^|]*)\|([^|]*)\|\s*$'
+ 
+# tags
+cuketag = '(?<!\S)(@[[:word:]]+)(?!\S)'
+
+# The Gherken statements
+given = '^\s*(Given)'
+when = '^\s*(When)'
+then = '^\s*(Then)'
+and_but = '^\s*(And|But)'
diff --git a/src/lang.map b/src/lang.map
index d555c00..86ffcfb 100644
--- a/src/lang.map
+++ b/src/lang.map
@@ -4,17 +4,12 @@ cpp = cpp.lang
 c = c.lang
 C = cpp.lang
 cc = cpp.lang
-cxx = cpp.lang
-coffee = coffeescript.lang
-coffeescript = coffeescript.lang
 cs = csharp.lang
 csharp = csharp.lang
-go = go.lang
 h = cpp.lang
 hh = cpp.lang
 H = cpp.lang
 hpp = cpp.lang
-hxx = cpp.lang
 javascript = javascript.lang
 js = javascript.lang
 prolog = prolog.lang
@@ -51,14 +46,10 @@ syslog = log.lang
 log = log.lang
 pas = pascal.lang
 pascal = pascal.lang 	
-f = fortran.lang
+feature = feature.lang
 fortran = fortran.lang
 free-fortran = fortran.lang
 fixed-fortran = fixed-fortran.lang
-f77 = fortran.lang
-F77 = fortran.lang
-f90 = fortran.lang
-F90 = fortran.lang
 html = html.lang
 htm = html.lang
 tex = latex.lang
@@ -91,7 +82,6 @@ csh = sh.lang
 ksh = sh.lang
 tcsh = sh.lang
 shell = sh.lang
-zsh = zsh.lang
 tcl = tcl.lang
 tk = tcl.lang
 txt = nohilite.lang
@@ -134,8 +124,8 @@ haskell = haskell.lang
 manifest = manifest.lang
 mf = manifest.lang
 asm = asm.lang
-s = s.lang
-r = r.lang
+s = asm.lang
+r = asm.lang
 applescript = applescript.lang
 scpt = applescript.lang
 vbscript = vbscript.lang
@@ -166,6 +156,3 @@ upc = upc.lang
 tml = tml.lang
 lilypond = lilypond.lang
 ly = lilypond.lang
-groovy = groovy.lang
-json = json.lang
-
diff --git a/tests/test.feature b/tests/test.feature
new file mode 100644
index 0000000..d2db879
--- /dev/null
+++ b/tests/test.feature
@@ -0,0 +1,40 @@
+Feature: Accident Report Email notifications 
+  In order to keep track of what's going on
+  As the incident manager
+  I want to receive emails when a significant event occurs
+
+  Background:
+    Given I perform HTTP authentication as a "user"
+    When I go to the homepage
+    Then I should see "WARNING! This site is restricted"
+
+  @active  @testing @another
+  Scenario: Notification of a new Accident Report
+    Given a clear email queue
+    And I am on the new_accident_report page
+    Then I should see "New Accident Report"
+    #  When I build a "accident_report" instance from FactoryGirl
+    And I create an accident report
+      | field                 | value             |
+      | accident_date         | 2013-01-20        |
+      | accident_time         | 10:00             |
+      | accident_location     | Here and there    |
+      | accident_description  | I came, I saw, I hit him |
+      | drivers_name          | Bilbo Baggins     |
+      | drivers_license_no    | N4445555          |
+    And I press "Create Accident report"
+    Then I should see "Accident report was successfully created"
+    But I should not see "Error"
+
+  Scenario Outline: Send notification emails
+    Given a clear email queue
+    When I create an email template with <message>
+    And I email <addressee>
+    Then "manager@biz.com" should receive an email
+    And they should see <message> in the email
+
+    Examples:
+      | addressee | message |
+      | j@s.com | Finished  |
+      | b@j.com | All done! |
+
diff --git a/tests/test.feature.html b/tests/test.feature.html
new file mode 100644
index 0000000..e6f9793
--- /dev/null
+++ b/tests/test.feature.html
@@ -0,0 +1,31 @@
+<!-- Generator: GNU source-highlight 3.1.7
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite -->
+<pre><tt><i><font color="#9A1900"># Cucumber / feature file lang definition file</font></i>
+<i><font color="#9A1900"># Probably can remove some definitions, since FFs are so simple</font></i>
+
+include <font color="#FF0000">"number.lang"</font>
+
+string delim <font color="#FF0000">"\""</font> <font color="#FF0000">"\""</font> escape <font color="#FF0000">"\\"</font>
+string delim <font color="#FF0000">"'"</font> <font color="#FF0000">"'"</font>  escape <font color="#FF0000">"\\"</font>
+string delim <font color="#FF0000">"&lt;"</font> <font color="#FF0000">"&gt;"</font>
+
+keyword =<font color="#FF0000">"Feature|Background|Scenario|Scenario Outline|Examples"</font>
+
+<i><font color="#9A1900"># type = '(\$[#]?|@@|@)([[:word:]]+|\'|\"|/)'</font></i>
+
+include <font color="#FF0000">"script_comment.lang"</font>
+
+<i><font color="#9A1900"># Define cucumber tables</font></i>
+table = <font color="#FF0000">'^\s*\|([^|]*)\|([^|]*)\|\s*$'</font>
+ 
+<i><font color="#9A1900"># tags</font></i>
+cuketag = <font color="#FF0000">'(?&lt;!\S)(@[[:word:]]+)(?!\S)'</font>
+
+<i><font color="#9A1900"># The Gherken statements</font></i>
+given = <font color="#FF0000">'^\s*(Given)'</font>
+when = <font color="#FF0000">'^\s*(When)'</font>
+then = <font color="#FF0000">'^\s*(Then)'</font>
+and_but = <font color="#FF0000">'^\s*(And|But)'</font>
+</tt></pre>
-- 
2.3.4

