#140 Enhancements to NEdit macro parsing

open
nobody
None
5
2005-08-01
2005-08-01
No

This patch adds the following features to NEdit's
macro language:
- the conditional expression
( key ! in array )
acts as the logical opposite of
( key in array )
- the do ... while loop has been lifted from C, as
do block-or-statement while ( condition )
- N8 Gray's "optional semicolons for statement
termination" (SF patch 1185506) has been included
- added a few productions to group assignment
increment/decrement operators
- allowed for linebreaks in places where their
statement-terminating behaviour makes no sense, ie in
argument lists, after prefix or binary operators, after
keywords if, while, for and do (I intend to allow them
in the comma-separated simple-statements in the for
loop's initialisation and iteration phrases, but that's
not done yet) and after most opening parentheses; you
only need "\" in a few cases now, in particular when
concatenating strings on different lines
- general reformatting of the parse.y file to
"condense" the smaller code blocks (this undoes some of
Steve LoBasso's reformatting from some time ago) - I
think this enhances the grammar productions over the
injected code

Discussion

  • Tony Balinski

    Tony Balinski - 2005-08-03

    Logged In: YES
    user_id=618141

    fixed up the comma-separated statements in the for-loop to
    allow extra non-escaped newlines

     
  • Tony Balinski

    Tony Balinski - 2005-08-03

    modified parse.y file (after patching)

     
  • Thorsten Haude

    Thorsten Haude - 2005-11-22

    Logged In: YES
    user_id=119143

    Looks useful.

    One comment about "allowed for linebreaks in places where
    their statement-terminating behaviour makes no sense": The
    language uses the line break as a command seperator at the
    moment. With this change, it would have this meaning
    sometimes, but not always. I think this might be dangerous.

     
  • Tony Balinski

    Tony Balinski - 2005-12-01

    Logged In: YES
    user_id=618141

    About linebreaks: I got the idea from JavaScript, where new
    lines can terminate statements in most usual situations. My
    major concern was to avoid having to use a backslash where
    the syntax clearly requires something other than an end of
    statement. Using this patch new lines can be allowed in
    "surprising" places (pretty well anywhere in the for-loop
    parenthesised control part, say), but I think it actually
    makes macro code much easier to read if you, say, break a
    long list of parameters or a large expression over multiple
    lines.

     
  • Tony Balinski

    Tony Balinski - 2005-12-01

    Logged In: YES
    user_id=618141

    About linebreaks: I got the idea from JavaScript, where new
    lines can terminate statements in most usual situations. My
    major concern was to avoid having to use a backslash where
    the syntax clearly requires something other than an end of
    statement. Using this patch new lines can be allowed in
    "surprising" places (pretty well anywhere in the for-loop
    parenthesised control part, say), but I think it actually
    makes macro code much easier to read if you, say, break a
    long list of parameters or a large expression over multiple
    lines.

     

Log in to post a comment.