Re: Need help lexing string literal

Ruud Mulder RAF448 85606 <mulder@dce.philips.nl>
1 Aug 1996 15:03:39 -0400

          From comp.compilers

Related articles
Need help lexing string literal doane@them.com (1996-07-31)
Re: Need help lexing string literal mulder@dce.philips.nl (Ruud Mulder RAF448 85606) (1996-08-01)
Re: Need help lexing string literal kanze@lts.sel.alcatel.de (1996-08-04)
Re: Need help lexing string literal henry@zoo.toronto.edu (Henry Spencer) (1996-08-04)
| List of all articles for this month |

From: Ruud Mulder RAF448 85606 <mulder@dce.philips.nl>
Newsgroups: comp.compilers
Date: 1 Aug 1996 15:03:39 -0400
Organization: Philips Electronics N.V.
References: 96-07-213
Keywords: lex

Jay Doane mentioned that he had trouble parsing a string literal.


I don't know anything about VisualParse++ and regular expressions in the
different LEX-variants tend to have their own quirks here and there (i.e.
are not that regular).


But the problem you keep having with the scheme you're trying to use is that
the backslash will stay in the comment you parsed.


The original LEX-manual by M.E.Lesk and E. Schmidt has the following advice when
using plain LEX:


> Example: Consider a language which defines a string as a set of characters between
> quotation (") marks, and provides that to include a " in a string it muat be
> preceede by a \. The regular expression which matches that is somewhat confusing,
> so that it might be preferable to write
>
> \"[^"]* {
> if (yytext[yyleng-1] == '\\')
> yymore();
> else
> .. normal user processing
> fi


I hope this helps.


--


Kind regards,
Ruud Mulder


--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.