Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

In defense of simpleminded parenthesis-matching edit macros

1 view
Skip to first unread message

Stephen E. Bacher

unread,
May 23, 2003, 3:56:35 PM5/23/03
to
In defense of simpleminded parenthesis-matching edit macros:

First of all, edit macros are not limited to editing REXX execs;
they must be able to edit all sorts of programming language text.
That means they would need to be sensitive to various styles of
quoting syntaxes - double-quoted strings, single-quoted strings,
etc. Some programming languages, from 370 assembler to Lisp,
make heavy syntactic use of unison single quotes, so that can
confuse an edit macro right there. Then there is the question
of how quotes imbedded in quoted strings are escaped. Are they
doubled, preceded by backslashes, encased in some other set of
bracketing characters, or not handled at all?

And it's not just quoted strings you need to worry about.
There are also comment sequences. Even REXX and PL/1 and C
differ in their handling of /* and */ (nested or not?).
Then there are the // ; # ... comment delimiters that render
everything up to the end of line as a comment. Not to mention
assembler again, where the position of the data determines
whether random characters are parts of comments or not.

So if you want to write a sufficiently general edit macro that matches
parentheses (and brackets and braces), just how far do you want to go?

Oh, and I use vi on REXX execs too (for Unix System Services scripts).
vi has a very basic parenthesis matcher in its '%' command. It's not
sensitive to any of the above.

So, it's usually easier just to do the balancing yourself in your code,
by inserting extra brackets of the desired kind where possible (say,
in comment strings), than to try to second-guess what the parenthesis
matcher is going to make of it.

- seb

----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to LIST...@VM.MARIST.EDU with the message: INFO TSO-REXX

Frank Clarke

unread,
May 23, 2003, 10:24:25 PM5/23/03
to
On 23 May 2003 12:56:35 -0700, s...@DRAPER.COM (Stephen E. Bacher)
wrote:
<200305231956...@support1.draper.com>

>In defense of simpleminded parenthesis-matching edit macros:
>
>First of all, edit macros are not limited to editing REXX execs;
>they must be able to edit all sorts of programming language text.

There are other languages?


0 new messages