help-bison
[Top][All Lists]
Advanced

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

Re: Syntax error if paragraph contains more than 1 printable character


From: Steve Litt
Subject: Re: Syntax error if paragraph contains more than 1 printable character
Date: Thu, 14 Dec 2023 18:00:17 -0500

James K. Lowden said on Wed, 13 Dec 2023 12:42:20 -0500
>Rather than remove trailing blanks from the input, I would remove them
>in flex.  The problem can be solved with regular expressions but,
>since we're only matching one value, it's easily done in an action: 
>
>       .+      {
>               for( auto p = yytext + yyleng - 1; p >= yytext; p-- ) {
>                       if( *p != 0x20 ) break;
>                       *p = '\0';
>               }

Nice!

>
>
>To solve it with regex, 
>
>       ([[:blank:]]*[[:^space:]])+ { ... return LINE; }
>       [[:blank:]]+$   // ignore

Nice!

Thanks James. I'll be investigating your techniques in the near future.
As you can see, your suggestions contributed to my working text to HTML
baby Hello World.

SteveT

Steve Litt 

Autumn 2023 featured book: Rapid Learning for the 21st Century
http://www.troubleshooters.com/rl21



reply via email to

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