The primary reason is efficiency. Every change or scrolling in text will trigger a highlighting routine to refresh. If a file contains several thousand of lines, and if it takes several seconds to refresh, the editor would become un-usable.
Пн, 26 дек 2016, Devon McCormick написал(а): > Is there a particular reason to do this with regex? There are a couple of > essays about doing this in J like this one - > http://code.jsoftware.com/wiki/Essays/Parentheses_Matching - and my own > contribution: > http://code.jsoftware.com/wiki/User:Devon_McCormick/ArrayThinking/JConferenceTalk2014#Simplifying_Code_with_Array_Thinking > . > > > On Mon, Dec 26, 2016 at 2:26 PM, Henry Rich <[email protected]> wrote: > > > I meant 'punctuation' instead of 'control word' for ) and NB. . > > > > Henry Rich > > > > > > On 12/26/2016 2:25 PM, Henry Rich wrote: > > > >> The parenthesis and comment delimiter in J have the part of speech > >> 'control word'. > >> > >> I didn't mean readable in the usual > >> why-can't-anybody-write-comments-any-more > >> sense, but as a reference to the Qt IDE's habit of treating quoted control > >> words as active, and giving the wrong font to everything that follows. Half > >> a line can get formatted as comments. If you actually DO have lots of > >> comments, this is hard to sort out. > >> > >> Henry rich > >> > >> On 12/26/2016 1:42 PM, Raul Miller 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, > >>> > >>> > >> ---------------------------------------------------------------------- > >> For information about J forums see http://www.jsoftware.com/forums.htm > >> > > > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm > > > > > > -- > > Devon McCormick, CFA > > Quantitative Consultant > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm -- regards, ==================================================== GPG key 1024D/4434BAB3 2008-08-24 gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3 gpg --keyserver subkeys.pgp.net --armor --export 4434BAB3 ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
