@@ -26,7 +26,7 @@ def k_add(self, command):
26
26
if self .nextToken () == 'to' :
27
27
if self .nextIsSymbol ():
28
28
symbolRecord = self .getSymbolRecord ()
29
- if symbolRecord ['valueHolder ' ]:
29
+ if symbolRecord ['hasValue ' ]:
30
30
if self .peek () == 'giving' :
31
31
# This variable must be treated as a second value
32
32
command ['value2' ] = self .getValue ()
@@ -57,7 +57,7 @@ def r_add(self, command):
57
57
except :
58
58
value2 = None
59
59
target = self .getVariable (command ['target' ])
60
- if not target ['valueHolder ' ]:
60
+ if not target ['hasValue ' ]:
61
61
self .variableDoesNotHoldAValueError (target ['name' ])
62
62
targetValue = self .getSymbolValue (target )
63
63
if targetValue == None :
@@ -87,7 +87,7 @@ def k_append(self, command):
87
87
if self .nextIs ('to' ):
88
88
if self .nextIsSymbol ():
89
89
symbolRecord = self .getSymbolRecord ()
90
- if symbolRecord ['valueHolder ' ]:
90
+ if symbolRecord ['hasValue ' ]:
91
91
command ['target' ] = symbolRecord ['name' ]
92
92
self .add (command )
93
93
return True
@@ -149,7 +149,7 @@ def k_begin(self, command):
149
149
def k_clear (self , command ):
150
150
if self .nextIsSymbol ():
151
151
target = self .getSymbolRecord ()
152
- if target ['valueHolder ' ]:
152
+ if target ['hasValue ' ]:
153
153
command ['target' ] = target ['name' ]
154
154
self .add (command )
155
155
return True
@@ -245,7 +245,7 @@ def r_debug(self, command):
245
245
def k_decrement (self , command ):
246
246
if self .nextIsSymbol ():
247
247
symbolRecord = self .getSymbolRecord ()
248
- if symbolRecord ['valueHolder ' ]:
248
+ if symbolRecord ['hasValue ' ]:
249
249
command ['target' ] = self .getToken ()
250
250
self .add (command )
251
251
return True
@@ -325,7 +325,7 @@ def r_divide(self, command):
325
325
except :
326
326
value2 = None
327
327
target = self .getVariable (command ['target' ])
328
- if not target ['valueHolder ' ]:
328
+ if not target ['hasValue ' ]:
329
329
self .variableDoesNotHoldAValueError (target ['name' ])
330
330
return None
331
331
value = self .getSymbolValue (target )
@@ -400,7 +400,7 @@ def r_fork(self, command):
400
400
def k_get (self , command ):
401
401
if self .nextIsSymbol ():
402
402
symbolRecord = self .getSymbolRecord ()
403
- if symbolRecord ['valueHolder ' ]:
403
+ if symbolRecord ['hasValue ' ]:
404
404
command ['target' ] = self .getToken ()
405
405
else :
406
406
FatalError (self .compiler , f'Variable "{ symbolRecord ["name" ]} " does not hold a value' )
@@ -610,7 +610,7 @@ def r_import(self, command):
610
610
def k_increment (self , command ):
611
611
if self .nextIsSymbol ():
612
612
symbolRecord = self .getSymbolRecord ()
613
- if symbolRecord ['valueHolder ' ]:
613
+ if symbolRecord ['hasValue ' ]:
614
614
command ['target' ] = self .getToken ()
615
615
self .add (command )
616
616
return True
@@ -701,7 +701,7 @@ def k_load(self, command):
701
701
return True
702
702
elif self .isSymbol ():
703
703
symbolRecord = self .getSymbolRecord ()
704
- if symbolRecord ['valueHolder ' ]:
704
+ if symbolRecord ['hasValue ' ]:
705
705
command ['target' ] = symbolRecord ['name' ]
706
706
if self .nextIs ('from' ):
707
707
command ['file' ] = self .nextValue ()
@@ -785,7 +785,7 @@ def r_multiply(self, command):
785
785
except :
786
786
value2 = None
787
787
target = self .getVariable (command ['target' ])
788
- if not target ['valueHolder ' ]:
788
+ if not target ['hasValue ' ]:
789
789
self .variableDoesNotHoldAValueError (target ['name' ])
790
790
return None
791
791
value = self .getSymbolValue (target )
@@ -810,7 +810,7 @@ def r_multiply(self, command):
810
810
def k_negate (self , command ):
811
811
if self .nextIsSymbol ():
812
812
symbolRecord = self .getSymbolRecord ()
813
- if symbolRecord ['valueHolder ' ]:
813
+ if symbolRecord ['hasValue ' ]:
814
814
command ['target' ] = self .getToken ()
815
815
self .add (command )
816
816
return True
@@ -819,7 +819,7 @@ def k_negate(self, command):
819
819
820
820
def r_negate (self , command ):
821
821
symbolRecord = self .getVariable (command ['target' ])
822
- if not symbolRecord ['valueHolder ' ]:
822
+ if not symbolRecord ['hasValue ' ]:
823
823
RuntimeError (self .program , f'{ symbolRecord ["name" ]} does not hold a value' )
824
824
return None
825
825
value = self .getSymbolValue (symbolRecord )
@@ -921,7 +921,7 @@ def k_pop(self, command):
921
921
922
922
def r_pop (self , command ):
923
923
symbolRecord = self .getVariable (command ['target' ])
924
- if not symbolRecord ['valueHolder ' ]:
924
+ if not symbolRecord ['hasValue ' ]:
925
925
RuntimeError (self .program , f'{ symbolRecord ["name" ]} does not hold a value' )
926
926
stackRecord = self .getVariable (command ['from' ])
927
927
stack = self .getSymbolValue (stackRecord )
@@ -1060,7 +1060,7 @@ def k_put(self, command):
1060
1060
if self .nextIsSymbol ():
1061
1061
symbolRecord = self .getSymbolRecord ()
1062
1062
command ['target' ] = symbolRecord ['name' ]
1063
- if 'valueholder ' in symbolRecord and symbolRecord ['valueHolder ' ] == False :
1063
+ if 'hasValue ' in symbolRecord and symbolRecord ['hasValue ' ] == False :
1064
1064
FatalError (self .compiler , f'Symbol { symbolRecord ["name" ]} is not a value holder' )
1065
1065
else :
1066
1066
self .add (command )
@@ -1074,7 +1074,7 @@ def r_put(self, command):
1074
1074
if value == None :
1075
1075
return - 1
1076
1076
symbolRecord = self .getVariable (command ['target' ])
1077
- if not symbolRecord ['valueHolder ' ]:
1077
+ if not symbolRecord ['hasValue ' ]:
1078
1078
RuntimeError (self .program , f'{ symbolRecord ["name" ]} does not hold a value' )
1079
1079
return - 1
1080
1080
self .putSymbolValue (symbolRecord , value )
@@ -1090,7 +1090,7 @@ def k_read(self, command):
1090
1090
command ['line' ] = False
1091
1091
if self .nextIsSymbol ():
1092
1092
symbolRecord = self .getSymbolRecord ()
1093
- if symbolRecord ['valueHolder ' ]:
1093
+ if symbolRecord ['hasValue ' ]:
1094
1094
if self .peek () == 'from' :
1095
1095
self .nextToken ()
1096
1096
if self .nextIsSymbol ():
@@ -1259,7 +1259,7 @@ def r_send(self, command):
1259
1259
def k_set (self , command ):
1260
1260
if self .nextIsSymbol ():
1261
1261
target = self .getSymbolRecord ()
1262
- if target ['valueHolder ' ]:
1262
+ if target ['hasValue ' ]:
1263
1263
command ['type' ] = 'set'
1264
1264
command ['target' ] = target ['name' ]
1265
1265
self .add (command )
@@ -1384,7 +1384,7 @@ def r_set(self, command):
1384
1384
def k_split (self , command ):
1385
1385
if self .nextIsSymbol ():
1386
1386
symbolRecord = self .getSymbolRecord ()
1387
- if symbolRecord ['valueHolder ' ]:
1387
+ if symbolRecord ['hasValue ' ]:
1388
1388
command ['target' ] = symbolRecord ['name' ]
1389
1389
value = {}
1390
1390
value ['type' ] = 'text'
@@ -1423,7 +1423,7 @@ def r_split(self, command):
1423
1423
def k_shuffle (self , command ):
1424
1424
if self .nextIsSymbol ():
1425
1425
symbolRecord = self .getSymbolRecord ()
1426
- if symbolRecord ['valueHolder ' ]:
1426
+ if symbolRecord ['hasValue ' ]:
1427
1427
command ['target' ] = self .getToken ()
1428
1428
self .add (command )
1429
1429
return True
@@ -1432,7 +1432,7 @@ def k_shuffle(self, command):
1432
1432
1433
1433
def r_shuffle (self , command ):
1434
1434
symbolRecord = self .getVariable (command ['target' ])
1435
- if not symbolRecord ['valueHolder ' ]:
1435
+ if not symbolRecord ['hasValue ' ]:
1436
1436
RuntimeError (self .program , f'{ symbolRecord ["name" ]} does not hold a value' )
1437
1437
return None
1438
1438
value = self .getSymbolValue (symbolRecord )
@@ -1495,7 +1495,7 @@ def k_take(self, command):
1495
1495
if self .nextToken () == 'from' :
1496
1496
if self .nextIsSymbol ():
1497
1497
symbolRecord = self .getSymbolRecord ()
1498
- if symbolRecord ['valueHolder ' ]:
1498
+ if symbolRecord ['hasValue ' ]:
1499
1499
if self .peek () == 'giving' :
1500
1500
# This variable must be treated as a second value
1501
1501
command ['value2' ] = self .getValue ()
@@ -1530,7 +1530,7 @@ def r_take(self, command):
1530
1530
except :
1531
1531
value2 = None
1532
1532
target = self .getVariable (command ['target' ])
1533
- if not target ['valueHolder ' ]:
1533
+ if not target ['hasValue ' ]:
1534
1534
self .variableDoesNotHoldAValueError (target ['name' ])
1535
1535
return None
1536
1536
value = self .getSymbolValue (target )
@@ -1552,7 +1552,7 @@ def r_take(self, command):
1552
1552
def k_toggle (self , command ):
1553
1553
if self .nextIsSymbol ():
1554
1554
target = self .getSymbolRecord ()
1555
- if target ['valueHolder ' ]:
1555
+ if target ['hasValue ' ]:
1556
1556
command ['target' ] = target ['name' ]
1557
1557
self .add (command )
1558
1558
return True
@@ -1712,7 +1712,7 @@ def r_write(self, command):
1712
1712
1713
1713
def incdec (self , command , mode ):
1714
1714
symbolRecord = self .getVariable (command ['target' ])
1715
- if not symbolRecord ['valueHolder ' ]:
1715
+ if not symbolRecord ['hasValue ' ]:
1716
1716
RuntimeError (self .program , f'{ symbolRecord ["name" ]} does not hold a value' )
1717
1717
return None
1718
1718
value = self .getSymbolValue (symbolRecord )
@@ -1781,7 +1781,7 @@ def compileValue(self):
1781
1781
if self .nextToken () == 'of' :
1782
1782
if self .nextIsSymbol ():
1783
1783
symbolRecord = self .getSymbolRecord ()
1784
- if symbolRecord ['valueHolder ' ]:
1784
+ if symbolRecord ['hasValue ' ]:
1785
1785
value ['target' ] = symbolRecord ['name' ]
1786
1786
return value
1787
1787
self .warning (f'Core.compileValue: Token \' { self .getToken ()} \' does not hold a value' )
@@ -1792,7 +1792,7 @@ def compileValue(self):
1792
1792
if self .nextToken () == 'of' :
1793
1793
if self .nextIsSymbol ():
1794
1794
symbolRecord = self .getSymbolRecord ()
1795
- if symbolRecord ['valueHolder ' ]:
1795
+ if symbolRecord ['hasValue ' ]:
1796
1796
value ['target' ] = symbolRecord ['name' ]
1797
1797
return value
1798
1798
FatalError (self .compiler , 'Variable does not hold a value' )
@@ -1838,8 +1838,9 @@ def compileValue(self):
1838
1838
if token == 'count' :
1839
1839
if self .nextIs ('of' ):
1840
1840
if self .nextIsSymbol ():
1841
- value ['name' ] = self .getToken ()
1842
- return value
1841
+ if self .getSymbolRecord ()['hasValue' ]:
1842
+ value ['name' ] = self .getToken ()
1843
+ return value
1843
1844
return None
1844
1845
1845
1846
if token == 'index' :
0 commit comments