found the runline code that calls qt.ijs 's ismultiline function,

https://github.com/jsoftware/qtide/blob/master/lib/base/run.cpp


The easy way to fix for the first "problem example" is to define a magic 
constant

ML_z_ =: Define_z_ =: 0

then include the magic constant in the ismultiline function.  It is a 
reasonably common pattern to have an adverb (sometimes verb) that takes as 
input either a string, or 0 to initiate multiline.


incidentally, I think it was a mistake to define the words 'define verb noun 
adverb' ...


Monad_z_ =: 3 :


and then combinining the above,

Define Monad  NB. instead of monad define

...

)



To address the 2nd problem example, if ismultiline returned the count of nested 
definitions, then probably the same mechanism that skips forward to ')' token 
would skip the number of times of the ismultiline value. 



Use of ML constant would be optional but ensure that utilities such as ctrl-r 
and code parsers would behave.



----- Original Message -----
From: 'Pascal Jasmin' via Programming <[email protected]>
To: "[email protected]" <[email protected]>
Sent: Wednesday, February 8, 2017 12:18 PM
Subject: Re: [Jprogramming] in script file, how to tell if line is top level?

I believe this approach is exposed in qt.ijs, as ismultiline function.  It 
doesn't handle all cases, as shown by ctrl-R and ctrl-return

for example,

V =: (3 :)

0 V
+: y
)



F =: 0 : 0 , 0 : 0
asdf
)
zxcv
)


----- Original Message -----
From: bill lam <[email protected]>
To: 'Pascal Jasmin' via Programming <[email protected]>
Sent: Wednesday, February 8, 2017 1:20 AM
Subject: Re: [Jprogramming] in script file, how to tell if line is top level?

For syntax coloring, it scans from the beginning and search
matching 3 : 0 (or other equivalents) and a line without only
the token ) .

Ср, 08 фев 2017, jprogramming написал(а):
> in 4 line script,
> 
> 2+2
> a =: 3 : 0
> nested definition line
> 
> )
> 
> the first 2 lines are "top level", but the last 2 are nested.
> 
> is there any undocumented foreign that will return this status?  How does the 
> console know that it is in " : 0 " mode?
> ----------------------------------------------------------------------
> 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
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to