Nicholas Clark writes:
> Would it be sane to get the parser to return suitable information on the
> source to let a syntax analyser (such as a highlighting editor) know that
> character positions 5123 to 5146 are a qq() string (So it can change the
> font or the colour or whatever)

I think the problems with this that were raised in the past are:
 * parsing partial source
 * does this mean that the parser has to reparse the whole sourcefile
   every time you type a character?

I think the better solution is to make Perl just a little more regular
(as suggested in RFCs about making m in matches mandatory) so that it
becomes easier to parse.  Of course with

  $a = \"foo";

your text editor needs to learn a little more about Perl :-)  Or you
could write your own little language, so that you would write:

  $a = reference_to("foo");

Or, better yet, simply write in unambiguous XML:

  <operator name="=">
    <operand position=0>
      <variable type="scalar">a</variable>
    </operand>
    <operand position=1>
      <operator name="reference_to">
        <operand position=0>
          <constant type="string">foo</constant>
        </operand>
      </operator>
    </operand>
  </operator>

:-)

Nat

Reply via email to