commit d66a859bb372a029a5741238e93752fe38e16abe
Author: Mauro Talevi <[email protected]>
AuthorDate: Wed Mar 28 14:22:32 2012 +0200
Commit: Mauro Talevi <[email protected]>
CommitDate: Wed Mar 28 14:22:32 2012 +0200
JBEHAVE-751: Updated EBNF grammar.
diff --git a/distribution/src/site/content/grammar.html
b/distribution/src/site/content/grammar.html
index c320f78..58b044d 100755
--- a/distribution/src/site/content/grammar.html
+++ b/distribution/src/site/content/grammar.html
@@ -13,7 +13,7 @@
; JBehave Grammar expressed in EBNF
(http://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_Form)
; The story describes a feature via description, narrative and a set of
scenarios
-Story := Description? Narrative? Scenario+ ;
+Story := Description? Meta? Narrative? Scenario+ ;
; The Description is expressed by any sequence of words that must not contain
any keywords at start of lines.
Description := (Word Space?)* ;
@@ -22,6 +22,14 @@ Description := (Word Space?)* ;
; It is followed by the narrative elements
Narrative:= "Narrative:" InOrderTo AsA IWantTo ;
+; The meta is identified by keyword "Meta:" (or equivalent in I18n-ed locale),
+; It is followed by any number of meta elements
+Meta:= "Meta:" (MetaElement)* ;
+
+; The meta element is identified by keyword "@" (or equivalent in I18n-ed
locale),
+; It is followed by a name-value pair, where the value can be empty or have
multiple words
+MetaElement:= "@" Space? Word Space (Word Space?)* ;
+
; The narrative elements
InOrderTo:= "In order to" NarrativeElementContent ;
AsA:= "As a" NarrativeElementContent ;
@@ -42,7 +50,7 @@ NarrativeStartingWord :== ("In order to" | "As a" | "I want
to" ) ;
; that must not contain any keywords at start of lines.
; It is followed by one or more Steps.
; Finally the optional Examples table, which if present will execute the
scenario for as many table rows present
-Scenario := "Scenario:"? Title? GivenStories? Step+ Examples? ;
+Scenario := "Scenario:"? Title? Meta? GivenStories? Step+ Examples? ;
; The free-text description
Title := (Word Space?)* ;
diff --git a/jbehave-core/src/main/java/org/jbehave/core/parsers/grammar.ebnf
b/jbehave-core/src/main/java/org/jbehave/core/parsers/grammar.ebnf
index cfc8544..cee1cf2 100755
--- a/jbehave-core/src/main/java/org/jbehave/core/parsers/grammar.ebnf
+++ b/jbehave-core/src/main/java/org/jbehave/core/parsers/grammar.ebnf
@@ -1,7 +1,7 @@
; JBehave Grammar expressed in EBNF
(http://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_Form)
-; The story describes a feature via optional description and narrative, and a
set of scenarios
-Story := Description? Narrative? Scenario+ ;
+; The story describes a feature via description, narrative and a set of
scenarios
+Story := Description? Meta? Narrative? Scenario+ ;
; The Description is expressed by any sequence of words that must not contain
any keywords at start of lines.
Description := (Word Space?)* ;
@@ -10,6 +10,14 @@ Description := (Word Space?)* ;
; It is followed by the narrative elements
Narrative:= "Narrative:" InOrderTo AsA IWantTo ;
+; The meta is identified by keyword "Meta:" (or equivalent in I18n-ed locale),
+; It is followed by any number of meta elements
+Meta:= "Meta:" (MetaElement)* ;
+
+; The meta element is identified by keyword "@" (or equivalent in I18n-ed
locale),
+; It is followed by a name-value pair, where the value can be empty or have
multiple words
+MetaElement:= "@" Space? Word Space (Word Space?)* ;
+
; The narrative elements
InOrderTo:= "In order to" NarrativeElementContent ;
AsA:= "As a" NarrativeElementContent ;
@@ -30,7 +38,7 @@ NarrativeStartingWord :== ("In order to" | "As a" | "I want
to" ) ;
; that must not contain any keywords at start of lines.
; It is followed by one or more Steps.
; Finally the optional Examples table, which if present will execute the
scenario for as many table rows present
-Scenario := "Scenario:"? Title? GivenStories? Step+ Examples? ;
+Scenario := "Scenario:"? Title? Meta? GivenStories? Step+ Examples? ;
; The free-text description
Title := (Word Space?)* ;