Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6b41e4f

Browse files
committed
Added multi-line mode.
1 parenta3d29f1 commit6b41e4f

File tree

1 file changed

+15
-20
lines changed

1 file changed

+15
-20
lines changed

‎dyalog_kernel/kernel.py‎

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ def __init__(self, **kwargs):
229229
0]+"\\dyalog.exe"
230230
CloseKey(dyalogKey)
231231
CloseKey(lastKey)
232-
self.dyalog_subprocess=subprocess.Popen([dyalogPath,"RIDE_SPAWNED=1","DYALOGQUIETUCMDBUILD=1",'RIDE_INIT=SERVE::'+str(
232+
self.dyalog_subprocess=subprocess.Popen([dyalogPath,"RIDE_SPAWNED=1","DYALOGQUIETUCMDBUILD=1","Dyalog_LineEditor_Mode=1",'RIDE_INIT=SERVE::'+str(
233233
self._port).strip(),'LOG_FILE=nul',os.path.dirname(os.path.abspath(__file__))+'/init.dws'])
234234
else:
235235
# linux, darwin... etc
@@ -239,6 +239,7 @@ def __init__(self, **kwargs):
239239
dyalog_env['DYALOGQUIETUCMDBUILD']='1'
240240
dyalog_env['ENABLE_CEF']='0'
241241
dyalog_env['LOG_FILE']='/dev/null'
242+
dyalog_env['DYALOG_LINEEDITOR_MODE']='1'
242243
ifsys.platform.lower()=="darwin":
243244
fordinsorted(os.listdir('/Applications')):
244245
ifre.match('^Dyalog-\d+\.\d+\.app$',d):
@@ -336,7 +337,6 @@ def do_execute(self, code, silent, store_history=True, user_expressions=None,
336337
ifself.connected:
337338
lines=code.split('\n')
338339
match=re.search('^%suspend\s+(\w+)$',lines[0].lower(),re.IGNORECASE)
339-
nsmatch=re.match('^\\s*:namespace|:class|:interface',lines[0].lower())
340340
ifmatch:
341341
suspend=match.group(1)
342342
ifsuspend=='on':
@@ -354,26 +354,11 @@ def do_execute(self, code, silent, store_history=True, user_expressions=None,
354354
self.out_error(
355355
'JUPYTER NOTEBOOK: UNDEFINED ARGUMENT TO %suspend, USE EITHER on OR off')
356356
lines=lines[1:]
357-
elifre.match('^\\s*∇',lines[0]):
358-
ifnotre.match('\\s*∇$',lines[-1]):
359-
self.out_error('DEFN ERROR: Missing closing ∇')
360-
else:
361-
lines[0]=re.sub('^\\s*∇','',lines[0])
362-
lines=lines[:-1]
363-
self.define_function(lines)
364-
lines= []
365357
eliflines[0].lower()==']dinput':
366-
self.define_function(lines[1:])
367-
lines= []
368-
elifnsmatch:
369-
ifnotre.match(":end"+re.sub("^\\s*:",'',nsmatch.group(0)),lines[-1].lower()):
370-
self.out_error("DEFN ERROR: No "+":End"+re.sub("^\\s*:",'',nsmatch.group(0)))
371-
lines= []
372-
else:
373-
self.define_function(lines)
374-
lines= []
358+
lines=lines[1:]
375359
try:
376360
# the windows interpreter can only handle ~125 chacaters at a time, so we do one line at a time
361+
pt=None
377362
forlineinlines:
378363
line=line+'\n'
379364
self.execute_line(line)
@@ -393,7 +378,7 @@ def do_execute(self, code, silent, store_history=True, user_expressions=None,
393378
received=dq.pop()
394379

395380
ifreceived[0]=='AppendSessionOutput':
396-
ifnotPROMPT_AVAILABLE:
381+
if(notPROMPT_AVAILABLE)and (received[1].get('type')!=14):
397382
data_collection=data_collection+ \
398383
received[1].get('result')
399384
elifreceived[0]=='SetPromptType':
@@ -413,6 +398,8 @@ def do_execute(self, code, silent, store_history=True, user_expressions=None,
413398
self.execute_line("→\n")
414399
raiseValueError(
415400
'JUPYTER NOTEBOOK: Input through ⎕ is not supported')
401+
elifpt==3:
402+
break
416403
elifpt==4:
417404
time.sleep(1)
418405
raiseValueError(
@@ -434,6 +421,14 @@ def do_execute(self, code, silent, store_history=True, user_expressions=None,
434421
self.ride_send(
435422
["ReplyOptionsDialog", {"index":-1,"token":received[1].get('token')}])
436423
# self.pa(received[1].get('input'))
424+
ifpt==3:
425+
self.ride_send(["WeakInterrupt", {}])#should be StrongInterrupt, which is not working
426+
ifnotSUSPEND:
427+
self.execute_line("→\n")
428+
self.out_error('INPUT INTERRUPT: Incomplete code block')
429+
self.ride_receive_wait()
430+
dq.clear()
431+
437432
exceptKeyboardInterrupt:
438433
self.ride_send(["StrongInterrupt", {}])
439434
ifnotSUSPEND:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp