[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Solution to a Flex problem
From: |
Chris verBurg |
Subject: |
Re: Solution to a Flex problem |
Date: |
Tue, 12 Dec 2023 19:01:21 -0800 |
Indeed - note that flex is more aligned with posix-style patterns than
perl-style patterns, so it would rather have "[:space:]", and "\s" just
means "s".
-Chris
On Tue, Dec 12, 2023 at 12:07 AM Steve Litt <slitt@troubleshooters.com>
wrote:
> Hi all,
>
> I know this is a Bison and not a Flex venue, but just in case somebody
> experiences the deletion of the letter "s" from their Bison output,
> here's how I solved this symptom by changing my Flex program...
>
> Originally my Flex program had the following:
>
> \s*\n {strcpy (yylval.y_char, yytext); return NL; }
>
> I was ignoring all whitespace at the end of every line. But my parser
> deleted the letter "s" from the output. So I made the following change:
>
> [ \t]*\n {strcpy (yylval.y_char, yytext); return NL; }
>
> After the preceding change, all occurrences of "s" were passed through.
>
> I hope this helps somebody.
>
> SteveT
>
> Steve Litt
>
> Autumn 2023 featured book: Rapid Learning for the 21st Century
> http://www.troubleshooters.com/rl21
>
>