your verb seemed to find unmatched ) only, e.g. failed for
'(()' or '(()('
also a line of ) and whitespace belongs to class 'close definition' and
should not be flagged as mismatch.On 27 Dec, 2016 2:42 am, "Raul Miller" <[email protected]> wrote: > I'm not sure what you mean by "containing control words" but code > readability issues are usually a call for better code. > > For this, perhaps (warning: lightly tested code): > > firstunmatched=:3 :0 > q=. unquoted=. -.~:/\y='''' > c=. uncommented=. -. +./\ q * 'NB.' E. y > n=. parendepth=. +/\q*c*-/'()'=/y > if. 0 < {: n do. > (n i. _1) <. 1+1 i:~0 1 E. n > else. > n i. _1 > end. > ) > > In other words: ignoring quoted and commented parenthesis, look for > the first occurrence of either an unbalanced right parenthesis or an > unbalanced left parenthesis. > > Let me know, though, if you see any flaws in this implementation. > > Thanks, > > -- > Raul > > > On Mon, Dec 26, 2016 at 12:57 PM, Henry Rich <[email protected]> wrote: > > I don't think it is reasonable to treat ')' and 'NB.' as containing > control > > words. It makes the code very hard to read. > > > > Showing the mismatched parenthesis is important enough that it might be > > better to have it even with this deficiency, but it IS a deficiency and > > should be treated as a bug to be fixed someday. > > > > Henry Rich > > > > On 12/26/2016 11:48 AM, bill lam wrote: > >> > >> I double checked with j602, it has no problem in high lighting > >> the unmatched )( in > >> > >> a '+' ((mno - rst) % b NB. )unmatched paren > >> ^ > >> a '+' ((mno - rst) % b ')' NB. )unmatched paren > >> ^ > >> and > >> > >> '(' (=:)) > >> ^ > >> But this is matched and is correct > >> a '+' ((mno - rst) % b ')') NB. )unmatched paren > >> > >> I think it is reasonable to omit this pattern for > >> syntax high-lighting. > >> > > > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
