home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!spool.mu.edu!wupost!emory!ogicse!das-news.harvard.edu!spdcc!iecc!compilers-sender
- From: vern@daffy.ee.lbl.gov (Vern Paxson)
- Newsgroups: comp.compilers
- Subject: Re: Input buffer overflow in lex...
- Keywords: lex
- Message-ID: <93-01-013@comp.compilers>
- Date: 5 Jan 93 18:30:07 GMT
- Article-I.D.: comp.93-01-013
- References: <93-01-009@comp.compilers> <93-01-010@comp.compilers>
- Sender: compilers-sender@iecc.cambridge.ma.us
- Reply-To: vern@daffy.ee.lbl.gov (Vern Paxson)
- Organization: Lawrence Berkeley Laboratory, Berkeley CA
- Lines: 26
- Approved: compilers@iecc.cambridge.ma.us
-
- John R. Levine <johnl@iecc.cambridge.ma.us> writes:
- > Well, the short answer is that you lose. No version of lex checks for
- > token buffer overflow, although it is less destructive in flex than it is
- > in lex. This can be called a lex design error, though it's hard to
- > check for overflow without making the lexer a lot slower.
-
- Let me clarify a bit. flex does detect token buffer overflow and
- generates a fatal run-time error when it occurs. It can do so cheaply
- because such overflow can only occur when new characters are being read
- into the input buffer. That's a rare operation in a flex scanner because
- input is block-oriented.
-
- > The other possibility is to use start states to build the string
- > yourself:
-
- Hear hear! This is in general a much better approach, as it also provides
- a natural way to deal with escape sequences and continued strings.
-
- Vern
-
- Vern Paxson vern@ee.lbl.gov
- Systems Engineering ucbvax!ee.lbl.gov!vern
- Lawrence Berkeley Laboratory (510) 486-7504
- --
- Send compilers articles to compilers@iecc.cambridge.ma.us or
- {ima | spdcc | world}!iecc!compilers. Meta-mail to compilers-request.
-