Whitespace terminators & MakePlusRule in Irony

1k views Asked by At

I'm trying to create a fairly simple parser using Irony, but am coming to the conclusion that Irony may not be suitable in this particular case.

These is an example of what I'm trying to parse:

server_name  example.com  *.example.com  www.example.*; 

server_name  www.example.com   ~^www\d+\.example\.com$;

server_name   ~^(?<subdomain>.+?)\.(?<domain>.+)$;

I'm using FreeTextLiterals with either a space or semi-colon as a terminator

var serverNamevalue = new FreeTextLiteral("serverNameValue", FreeTextOptions.None, " ", ";");

I'm then using the MakePlusRule to pick up one or more server_name values:

httpCoreServerName.Rule = "server_name" + httpCoreServerNameItems + semicolon;
httpCoreServerNameItems.Rule = MakePlusRule(httpCoreServerNameItems, serverNamevalue);

However - I think there's a problem with having whitespace as a terminator for the FreeTextLiteral in this case. When I run this, I get a parser error. If I substitute the whitespace for another specific character to act as terminator (and also add this a delimiter in the call to MakePlusRule) - it works fine.

Does anyone have any ideas as to how I could deal with this in Irony?

1

There are 1 answers

0
Mark Kelly On BEST ANSWER

I posted this question over at the Irony project on Codeplex where Roman Ivantsov - the developer of Irony - confirmed there was an issue with the parser when using semi-colons with FreeTextLiterals.

Roman has helpfully fixed / patched this issue. I've dowloaded the latest source and can confirm it's fixed the issue.