Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 (Tek) 9/28/84 based on 9/17/84; site orca.UUCP Path: utzoo!watmath!clyde!burl!ulysses!ucbvax!decvax!tektronix!orca!andrew From: andrew@orca.UUCP (Andrew Klossner) Newsgroups: net.unix Subject: Re: comments in lex Message-ID: <1614@orca.UUCP> Date: Sat, 13-Jul-85 20:52:26 EDT Article-I.D.: orca.1614 Posted: Sat Jul 13 20:52:26 1985 Date-Received: Wed, 17-Jul-85 04:53:34 EDT References: <114@emacs.uucp> <193@jendeh.UUCP> Organization: Tektronix, Wilsonville OR Lines: 17 >> How do you recognise a PL/1 style comment? > > "/*"([^*]|"*"[^/])*"*/" Two problems: 1) This pattern will incorrectly recognize "/***/ */" as a comment. 2) This approach to comment skipping is a bad idea in lex, because the generated lexer will try to accumulate the entire comment in the "yytext" buffer, which has a fixed size. (On our system, the size is 1024 bytes.) If ever a comment with more bytes than the buffer size is found, the lex driver will merrily overwrite the memory following the buffer and blow away your compile. -=- Andrew Klossner (decvax!tektronix!orca!andrew) [UUCP] (orca!andrew.tektronix@csnet-relay) [ARPA]