Multiline Statement

Apr 8, 2010 at 4:05 PM

Hi thanks lot for this library .

i m trying to create a little script language .

Basically i extend the expression evaluator example by adding new feature.

Each statement ends with newline like VB.

So i want to add line break with underscore. 

I follow instruction found on forum

var comment = new CommentTerminal("comment", "#", "\n", "\r");
var comment2 = new CommentTerminal("comment2", "_", "\r\n");

But that seems not work. 

Can u help me please ?

thank u in advance !!!

 

Apr 8, 2010 at 4:48 PM

i found one solution

var comma = ToTerm(",") + (Empty | "\r" | "\n" | "\r\n");       
comma.Name = "comma"; var stmtsep = ToTerm(";") + (Empty | "\r" | "\n" | "\r\n");
stmtsep.Name = "statement_separator";
It seems work. But i m not sure its the good solution .

What u think about ?

Coordinator
Apr 8, 2010 at 6:14 PM

declare explicit non-terminals, what you have is BnfExpression objects.

Like this:

var stmtSep = new NonTerminal("stmtSep"); 

stmtSep.Rule = ToTerm(";") + .. ... .. 

Not sure why you need to re-define comma...