[antlr-interest] Parsing a Cucumber-like language in ANTLR

Wesley Ripley wripley at WPI.EDU
Sun Nov 18 19:56:43 PST 2012


Hello,
I am a student at Worcester Polytechnic Institute working on a project
where we are attempting to use ANTLR to write a Domain Specific Language.
If you know the testing tool Cucumber it has a very nice DSL for specifying
executable requirement specifications. Our language is similar in its
format but different enough that we can't just use Cucumber.

The problem I am having is in capturing muli-line blocks of text. So here
is a short example:

Description:
Multi line text goes here
to specifiy the description

Scenario:
Given size between 10 and 20
   And location is spread out
Then add 2 confidence

We want ANTLR to see the Description: keyword and know to capture
everything between that and the next keyword. But for other keywords like
scenario we actually want it to parse things inside to make sure it is in
the right format. I have had trouble getting the Lexer to turn the
multiline text into one token without it getting all of the text.

Thank you for your help, and let me know if you need more information or if
I have emailed to this to the wrong place
--
Wesley Ripley
Class of 2013
Computer Science Major


More information about the antlr-interest mailing list