From: Francis Cianfrocca Date: 2006-09-15T11:22:59+09:00 Subject: Re: Regular expression question. ------=_Part_6844_16150192.1158286931439 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 9/14/06, Tom Copeland wrote: > > I'm not sure if it's impossible to parse out C-style comments using a > regular expression, but the various JavaCC grammars I've seen all use > lexical states to do it instead. Another complication is trigraphs (*), > although I think those are unrecognized by default in most C > preprocessors. A C-style block comment can indeed be recognized by a regex. In fact, that's how lexical states are generally invoked in scanners generated by tools like flex. However, a *nested* C-style block comment can not be detected by a regex. A (theoretical) language supporting such a construct would be a context-free language, not a regular language. ------=_Part_6844_16150192.1158286931439--