@@ -386,7 +386,7 @@ def k_exit(self, command):
386
386
return True
387
387
388
388
def r_exit (self , command ):
389
- if self .program .graphics != None :
389
+ if self .program .parent == None and self . program . graphics != None :
390
390
self .program .graphics .force_exit (None )
391
391
return - 1
392
392
@@ -601,6 +601,7 @@ def k_import(self, command):
601
601
variable ['name' ] = name
602
602
variable ['keyword' ] = keyword
603
603
variable ['import' ] = None
604
+ variable ['used' ] = False
604
605
self .addCommand (variable )
605
606
if self .peek () != 'and' :
606
607
break
@@ -1203,9 +1204,9 @@ def k_run(self, command):
1203
1204
if record ['keyword' ] == 'module' :
1204
1205
name = record ['name' ]
1205
1206
command ['module' ] = name
1206
- else : RuntimeError (self .program , f'Symbol \' name\' is not a module' )
1207
- else : RuntimeError (self .program , 'Module name expected after \' as\' ' )
1208
- else : RuntimeError (self .program , '\' as {module name}\' expected' )
1207
+ else : FatalError (self .compiler , f'Symbol \' name\' is not a module' )
1208
+ else : FatalError (self .compiler , 'Module name expected after \' as\' ' )
1209
+ else : FatalError (self .compiler , '\' as {module name}\' expected' )
1209
1210
exports = []
1210
1211
if self .peek () == 'with' :
1211
1212
self .nextToken ()
@@ -1333,6 +1334,12 @@ def k_set(self, command):
1333
1334
command ['value' ] = self .nextValue ()
1334
1335
self .add (command )
1335
1336
return True
1337
+
1338
+ elif token == 'path' :
1339
+ command ['path' ] = self .nextValue ()
1340
+ self .add (command )
1341
+ return True
1342
+
1336
1343
return False
1337
1344
1338
1345
def r_set (self , command ):
@@ -1384,6 +1391,11 @@ def r_set(self, command):
1384
1391
self .encoding = self .getRuntimeValue (command ['encoding' ])
1385
1392
return self .nextPC ()
1386
1393
1394
+ elif cmdType == 'path' :
1395
+ path = self .getRuntimeValue (command ['path' ])
1396
+ os .chdir (path )
1397
+ return self .nextPC ()
1398
+
1387
1399
elif cmdType == 'property' :
1388
1400
value = self .getRuntimeValue (command ['value' ])
1389
1401
name = self .getRuntimeValue (command ['name' ])
@@ -1624,6 +1636,7 @@ def r_unlock(self, command):
1624
1636
target ['locked' ] = False
1625
1637
return self .nextPC ()
1626
1638
1639
+ # Use a plugin module
1627
1640
def k_use (self , command ):
1628
1641
if self .nextIs ('graphics' ):
1629
1642
print ('Loading graphics module' )
0 commit comments