JBehave
  1. JBehave
  2. JBEHAVE-88

Allow for comments and newlines in story text files

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0, 1.0.1
    • Fix Version/s: 1.1
    • Component/s: Core
    • Labels:
      None
    • Number of attachments :
      0

      Description

      Se below for a working example of sablecc grammar that allows comments starting with '#'. Please make a more robust grammar if you implement this improvement.

      ...
      Helpers
      letter = [['a'..'z'] + ['A'..'Z']];
      digit = ['0'..'9'];
      space = ' ';
      tab = 9;
      cr = 13;
      lf = 10;
      endl = cr | lf | cr lf;
      commentchar = '#';
      specialchar = '/' | '?' | '-' | '.' | '*' | '(' | ')';
      norwegianchar = ''|''|''|''|''|'';
      commentchars = space | tab | letter | digit | specialchar | norwegianchar;

      Tokens
      title_keyword = 'Title:';
      scenario_keyword = 'Scenario:';
      as_a = 'As a';
      i_want = 'I want';
      so_that = 'So that';
      given = 'Given';
      when = 'When';
      then = 'Then';
      space = space;
      word = letter+;
      endl = endl;
      commentline = commentchar commentchars* endl;

      Ignored Tokens
      commentline;

      Productions

      story =
      title
      role?
      feature?
      benefit?
      scenario*;
      ...

        Activity

        Mauro Talevi made changes -
        Field Original Value New Value
        Assignee Mauro Talevi [ maurotalevi ]
        Mauro Talevi made changes -
        Fix Version/s 1.1 [ 13339 ]
        Hide
        Mauro Talevi added a comment -

        Eric - applied patch and rebuilt sablecc generator code.

        Added a behaviour to verify the use of comments.

        What do you mean by "Please make a more robust grammar if you implement this improvement." Can you elaborate?

        Thanks

        Show
        Mauro Talevi added a comment - Eric - applied patch and rebuilt sablecc generator code. Added a behaviour to verify the use of comments. What do you mean by "Please make a more robust grammar if you implement this improvement." Can you elaborate? Thanks
        Hide
        Eric Lewin added a comment -

        Mauro, Thanks for applying the patch.

        To your question: I suppose I was thinking about letting comments include all kind of special characters and letting phrases include all possible characters that a class can have, for instance numbers.

        I think there has been some problem with the encoding of the Norwegian characters because when I open the new story.ssc I get this ''|''|''|''|''|''; instead of this ''|''|''|''|''|'';

        The other feature that I do not understand sablecc well enough to implement is how to make it ignore blank lines.

        Show
        Eric Lewin added a comment - Mauro, Thanks for applying the patch. To your question: I suppose I was thinking about letting comments include all kind of special characters and letting phrases include all possible characters that a class can have, for instance numbers. I think there has been some problem with the encoding of the Norwegian characters because when I open the new story.ssc I get this ''|''|''|''|''|''; instead of this ''|''|''|''|''|''; The other feature that I do not understand sablecc well enough to implement is how to make it ignore blank lines.
        Hide
        Mauro Talevi added a comment -

        Eric, norwegian chars seem to render fine in my IDE (Eclipse). Not sure if it's a question of some svn config or what.

        But - that said - do you need these chars? In the sense that we don't support any other non-standard latin chars. I'd be almost tempted to stay with the LCD (lowest common denominator) unless there is a strong call for them.

        For blank lines I did have a stab at them but sablecc was getting all confused. For the moment, you can use '#' for blank lines (a bit like Fortran of old - very old - that required a char on column 6 ... ah those were the days :

        1. This is a comment with 'blank lines'
        Show
        Mauro Talevi added a comment - Eric, norwegian chars seem to render fine in my IDE (Eclipse). Not sure if it's a question of some svn config or what. But - that said - do you need these chars? In the sense that we don't support any other non-standard latin chars. I'd be almost tempted to stay with the LCD (lowest common denominator) unless there is a strong call for them. For blank lines I did have a stab at them but sablecc was getting all confused. For the moment, you can use '#' for blank lines (a bit like Fortran of old - very old - that required a char on column 6 ... ah those were the days : This is a comment with 'blank lines'
        Hide
        Mauro Talevi added a comment -

        Doh, jira trying to be clever converted the comment char to a number. But hopefully you got the message.

        Show
        Mauro Talevi added a comment - Doh, jira trying to be clever converted the comment char to a number. But hopefully you got the message.
        Mauro Talevi made changes -
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Closed [ 6 ]
        Mauro Talevi made changes -
        Component/s Core [ 11086 ]
        Component/s Story runner [ 11084 ]

          People

          • Assignee:
            Mauro Talevi
            Reporter:
            Eric Lewin
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: