help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Freeform text


From: Varga-Háli Dániel
Subject: Freeform text
Date: Mon, 4 Aug 2008 18:42:21 +0200

Hey everybody!
This is my first try of using this mail list. ^_^_

So here is my problem: I have a file that looks something like this:

{if $whatever == "string"}
       Freeform text to display
       {if $whatever == "string"}
          and here as well
       {/if}
{/if}

Think of it as smarty syntax. I would like to get the freeform text in
the block. I could match anything but that. My concept to create a
rule (using bison) for that was:

\}[^\{]*\{

This would match anything (maybe even newlines) from the end of the if
statement to the next statement. Here is the entire lex file:
"if"                {return IF;}
\/if                {return IF_END;}
"("                {return LBRA;}
")"                {return RBRA;}
"{"               {return BLOO;}
"}"               {return BLOC;}
\$[a-zA-Z]+   {return VAR;}
==               {return CMP;}
"<"              {return CMP;}
">"              {return CMP;}
"\""[^"]+"\""   {return STRING;}
";"                             {return ENDSTATEMENT;}
\}[^\{]*\{              {return FREEFORM_TEXT;}

How is it possible to make a rule or regex for the freeform text?

Thanx in advance




reply via email to

[Prev in Thread] Current Thread [Next in Thread]