No announcement yet.

Rule for Ruby strings

  • Filter
  • Time
  • Show
Clear All
new posts

  • Rule for Ruby strings


    I try to build a grammar for ruby and I have a problem with a specific string definition..

    An example
    text = <<helloworld
    This is some Text, saying Hello World
    A 2nd line is possible (and a 3rd, 4th…)
    puts text
    I made a grammar to mark the string. The strings starts with << followed by a free delimiter (in my example I used 'helloworld'). The delimiter must be repeated later on a single line to finish the string

    I tried <<(\w+)$ and wanted to finish it with \1 or ^\1$
    BC3 recognize the start of the string, but not the end.
    Is there an error, or is the usage of \1 in the to-text not possible?

    Attached my rule and a bit ruby-code to test (including some more string definitions in ruby).

  • #2
    I too am interested in Beyond Compare support for Ruby.
    I looked at your attached ruby grammar and it looks like a good start for open-sourcing.
    Would you like to start a repository on somewhere like
    If not I would be willing to create a repository on github, add the file BCFileFormats.xml,
    and start a wiki of general information.
    It would also be interesting to create an erb format as a merging of this ruby file and
    the existing one for HTML.