newbie problem

Jan 14, 2010 at 5:58 PM

I am really new to Irony... and I would appreciate your help.

My code looks like this:

        var t_string = new StringLiteral("String","\"");

        t_string.AddStartEnd("{", "}", StringFlags.None);

And the following examples work ok:
"my string1"
{my string1}
Question 1:
However, when I try something like this, it doesn't work:
{my {test} string1}

As it is not counting the number of open brackets. How should I express that with Irony?
Thanks in advance.

Jan 14, 2010 at 6:24 PM

currently StringLiteral does not support nesting, it is quite an unusual case - what language is this? I will think about adding support for this. As for now, you'll have to write a custom Terminal class

Jan 14, 2010 at 6:30 PM

I am trying to parse bibtex entries.

  title = "A {bunch {of} braces {in}} title"

You can find some information here:

By the way, you've done an excellent work !

Jan 14, 2010 at 7:07 PM

Any tips on how should I start? I guess I could extend the StringLiteral class...

Do you have any documentation apart from the source code? I still don't have a complete idea of how the code is structured.


Jan 14, 2010 at 8:58 PM


I could solve the problem using this lines:

        // Check this link for more information:

        var t_string1 = new RegexBasedTerminal("String1", @"\{(?>[^{}]+|\{(?<Depth>)|\}(?<-Depth>))*(?(Depth)(?!))\}");

This line is matching any number of nested { } brackets.