From: | "Lex Spoon" <lex@cc.gatech.edu> |
Newsgroups: | comp.compilers |
Date: | 18 Oct 2002 23:22:50 -0400 |
Organization: | Georgia Institute of Technology |
References: | 02-09-087 02-09-110 02-09-121 02-09-128 02-09-141 02-09-156 02-10-010 |
Keywords: | lex |
Posted-Date: | 18 Oct 2002 23:22:50 EDT |
"Joachim Durchholz" <joachim_d@gmx.de> writes:
> Clint Olsen wrote:
> >
> > /* parse !$#%$# this! :) */
> >
> > I don't see how by your example the above snippet would work.
>
> The expletive would probably go into the <error> token. Which is there
> exactly for the purpose of parsing stuff that the scanner doesn't like.
Here's a harder example:
/* parse "this */ 10 /* and this" */
It will scan as four tokens:
/*
parse
"this */ 10 /* and this"
*/
The parser will be in trouble now if it wants to pull out the "10".
Thus, you seem to need a special scanner state to handle the meat of a
comment.
-Lex
Return to the
comp.compilers page.
Search the
comp.compilers archives again.