Friday 15 July 2011

regex - What's the official way to escape a comment (#) in Gherkin/Cucumber? -



regex - What's the official way to escape a comment (#) in Gherkin/Cucumber? -

i'm writing gherkin feature file, e.g.

given next # info , open page fields right

i don't want # in above interpreted comment, remove data afterward.

what's official gherkin way escape # symbol, if any? i've looked @ official documentation, , guide , neither seems reply question.

i've tried using invented html entity &hash; in parser, works , easy write regular look for. if utilize official html entity # or escape backslash (e.g. \#) either alternative include # symbol , create parsing harder. in end, however, i'd rather utilize official method, if possible, if it's bit harder implement.

thanks in advance!

the grammar used in ruby , java implementations can found here: https://github.com/cucumber/gherkin/blob/master/ragel/lexer_common.rl.erb

it not there escaping defined comments, since gherkin line-based syntax not expect comment recognized inline after step. contrary syntax highlighting in

given next # info when open page

i expect content of step contain including "# data" part.

that interpretation of description @ https://github.com/cucumber/cucumber/wiki/gherkin#gherkin-syntax

comment lines allowed anywhere in file. begin 0 or more spaces, followed hash sign (#) , amount of text.

regex escaping cucumber gherkin

No comments:

Post a Comment