(flex.info)ERASEME56


Next: ERASEME57 Prev: ERASEME55 Up: FAQ
Enter node , (file) or (file)node

ERASEME56
=========

     To: Mikael.Latvala@lmf.ericsson.se
     Subject: Re: Possible mistake in Flex v2.5 document
     In-reply-to: Your message of Fri, 05 Sep 1997 16:07:24 PDT.
     Date: Fri, 05 Sep 1997 10:01:54 PDT
     From: Vern Paxson <vern>
     
     > In that example you show how to count comment lines when using
     > C style /* ... */ comments. My question is, shouldn't you take into
     > account a scenario where end of a comment marker occurs inside
     > character or string literals?
     
     The scanner certainly needs to also scan character and string literals.
     However it does that (there's an example in the man page for strings), the
     lexer will recognize the beginning of the literal before it runs across the
     embedded "/*".  Consequently, it will finish scanning the literal before it
     even considers the possibility of matching "/*".
     
     Example:
     
     	'([^']*|{ESCAPE_SEQUENCE})'
     
     will match all the text between the ''s (inclusive).  So the lexer
     considers this as a token beginning at the first ', and doesn't even
     attempt to match other tokens inside it.
     
     I thinnk this subtlety is not worth putting in the manual, as I suspect
     it would confuse more people than it would enlighten.
     
     		Vern


automatically generated by info2www version 1.2.2.9