develooper Front page | perl.perl6.internals.api.parser | Postings from December 2000

Re: Now, to try again...

Thread Previous | Thread Next
David Grove
December 17, 2000 10:21
Re: Now, to try again...
Message ID:

Nicholas Clark <> wrote:

 > On Sun, Dec 17, 2000 at 12:43:15PM +0000, Simon Cozens wrote:
 > > On Sun, Dec 17, 2000 at 01:20:07AM +0000, Nicholas Clark wrote:
 > > > I'm assuming we're all sort of thinking that input is certainly
 > > > [good stuff]
 > Thanks, but you were supposed to tell me what I'd missed :-)


 > I had a hairier thought last night.
 > Lots of people (well, certainly at least me and the person who wrote
 > use syntax highlighting editors.
 > The remarks I've seen in comments in several syntax highlighting modes
 > perl say that is that perl is pretty much the hardest language to
 > For example, the syntax highlighter I find myself using at the moment
 > doesn't like:
 >     $foo = \"abc";
 > It thinks that \" escapes that ". Oops.
 > Other nice things like s###; pod, __DATA__, here docs, not needed to
 > some otherwise "interesting" characters inside regexps all seem to be
 > to confusion. So one gets irritated, and either spend time trying to
 > the mode, or "fix" your perl to make the mode happy.
 > Neither of which is getting your real job done (or letting you use your
 > spare time to fix perl instead of the mode)
 > There's only 1 thing that really knows how to parse perl - perl  :-)
 > Would it be sane to get the parser to return suitable information on
 > source to let a syntax analyser (such as a highlighting editor) know
 > character positions 5123 to 5146 are a qq() string (So it can change
 > font or the colour or whatever)


As the maker of such an editor, I wouldn't mind getting any help from perl
that can be gotten in this area. It's not really the rules that are
gotchas, but the exceptions to the rules. The elements that you mentioned
(strings and regexen) are extremely difficult to find, especially in odd
contexts like grep {/[^.]/} where there's no leading =~ or !~ and in s///
where there's not a single ending but two, each with its own rules.

I'm not sure this is a parser issue, at least not when it comes to the
internal parsing of Perl for perl's sake. However, putting in db-like
(debug module) hooks that I can grab onto somewhere in the mix might be

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About