Skip to content

Instantly share code, notes, and snippets.

@ivey
Created October 10, 2008 21:29
Show Gist options
  • Save ivey/16162 to your computer and use it in GitHub Desktop.
Save ivey/16162 to your computer and use it in GitHub Desktop.
;;; very basic cucumber mode for plain text stories
;;; send updates to ivey@gweezlebur.com and maybe I'll
;;; release this on github
(defvar cucumber-mode-story-regexp
"^ *\\(Story:\\) *\\(.*\\)")
(defvar cucumber-mode-scenario-regexp
"^ *\\(Scenario:\\) *\\(.*\\)")
(defvar cucumber-mode-asiwantto-regexp
"^ *\\(As \\(an\\|a\\)\\|I want to\\|So that\\) *\\(.*\\)")
(defvar cucumber-mode-givenwhen-regexp
"^ *\\(Given\\|When\\|And\\|Then\\)")
(define-generic-mode cucumber-mode
()
()
`(
("\\(\\(.\\|[
]\\)+\\)Story:" 1 'font-lock-comment-face)
(,cucumber-mode-story-regexp 1 'font-lock-keyword-face)
(,cucumber-mode-story-regexp 2 'font-lock-string-face)
(,cucumber-mode-scenario-regexp 1 'font-lock-keyword-face)
(,cucumber-mode-scenario-regexp 2 'font-lock-string-face)
(,cucumber-mode-asiwantto-regexp 1 'font-lock-keyword-face)
(,cucumber-mode-asiwantto-regexp 3 'font-lock-string-face)
(,cucumber-mode-givenwhen-regexp 1 'font-lock-function-name-face)
)
'(".feature\\'")
nil)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment