easycoder 250210.1__py2.py3-none-any.whl → 250216.1__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of easycoder might be problematic. Click here for more details.
- easycoder/__init__.py +1 -1
- easycoder/ec_compiler.py +5 -6
- easycoder/ec_condition.py +1 -0
- easycoder/ec_core.py +34 -16
- easycoder/ec_program.py +9 -7
- {easycoder-250210.1.dist-info → easycoder-250216.1.dist-info}/METADATA +2 -2
- easycoder-250216.1.dist-info/RECORD +17 -0
- {easycoder-250210.1.dist-info → easycoder-250216.1.dist-info}/WHEEL +1 -1
- easycoder-250210.1.dist-info/RECORD +0 -17
- {easycoder-250210.1.dist-info → easycoder-250216.1.dist-info}/LICENSE +0 -0
- {easycoder-250210.1.dist-info → easycoder-250216.1.dist-info}/entry_points.txt +0 -0
easycoder/__init__.py
CHANGED
easycoder/ec_compiler.py
CHANGED
|
@@ -13,7 +13,6 @@ class Compiler:
|
|
|
13
13
|
self.tokens = self.script.tokens
|
|
14
14
|
self.symbols = self.program.symbols
|
|
15
15
|
self.code = self.program.code
|
|
16
|
-
self.warnings = []
|
|
17
16
|
self.program.compiler = self
|
|
18
17
|
self.addCommand = self.program.add
|
|
19
18
|
self.compileConstant = self.value.compileConstant
|
|
@@ -107,11 +106,10 @@ class Compiler:
|
|
|
107
106
|
def getSymbolRecord(self):
|
|
108
107
|
token = self.getToken()
|
|
109
108
|
symbol = self.symbols[token]
|
|
110
|
-
if symbol
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
return None
|
|
109
|
+
if symbol == None: return None
|
|
110
|
+
symbolRecord = self.code[symbol]
|
|
111
|
+
symbolRecord['used'] = True
|
|
112
|
+
return symbolRecord
|
|
115
113
|
|
|
116
114
|
def compileLabel(self, command):
|
|
117
115
|
return self.compileSymbol(command, self.getToken(), False)
|
|
@@ -144,6 +142,7 @@ class Compiler:
|
|
|
144
142
|
|
|
145
143
|
# Compile the current token
|
|
146
144
|
def compileToken(self):
|
|
145
|
+
self.warnings = []
|
|
147
146
|
token = self.getToken()
|
|
148
147
|
# print(f'Compile {token}')
|
|
149
148
|
if not token:
|
easycoder/ec_condition.py
CHANGED
easycoder/ec_core.py
CHANGED
|
@@ -696,22 +696,28 @@ class Core(Handler):
|
|
|
696
696
|
self.program.importPlugin(f'{source}:{clazz}')
|
|
697
697
|
return True
|
|
698
698
|
elif self.isSymbol():
|
|
699
|
-
|
|
700
|
-
if
|
|
701
|
-
command['
|
|
702
|
-
self.
|
|
703
|
-
|
|
699
|
+
symbolRecord = self.getSymbolRecord()
|
|
700
|
+
if symbolRecord['valueHolder']:
|
|
701
|
+
command['target'] = symbolRecord['name']
|
|
702
|
+
if self.nextIs('from'):
|
|
703
|
+
command['file'] = self.nextValue()
|
|
704
|
+
self.add(command)
|
|
705
|
+
return True
|
|
706
|
+
else:
|
|
707
|
+
FatalError(self.program.compiler, f'I don\'t understand \'{self.getToken()}\'')
|
|
704
708
|
return False
|
|
705
709
|
|
|
706
710
|
def r_load(self, command):
|
|
707
711
|
target = self.getVariable(command['target'])
|
|
708
|
-
|
|
712
|
+
filename = self.getRuntimeValue(command['file'])
|
|
713
|
+
try:
|
|
714
|
+
with open(filename) as f: content = f.read()
|
|
715
|
+
except:
|
|
716
|
+
RuntimeError(self.program, f'File \'{filename}\' not found')
|
|
709
717
|
try:
|
|
710
|
-
|
|
711
|
-
content = f.read()
|
|
718
|
+
if filename.endswith('.json'): content = json.loads(content)
|
|
712
719
|
except:
|
|
713
|
-
|
|
714
|
-
if content != None and file.endswith('.json'): content = json.loads(content)
|
|
720
|
+
RuntimeError(self.program, 'Bad or null JSON string')
|
|
715
721
|
value = {}
|
|
716
722
|
value['type'] = 'text'
|
|
717
723
|
value['content'] = content
|
|
@@ -1219,10 +1225,9 @@ class Core(Handler):
|
|
|
1219
1225
|
|
|
1220
1226
|
def r_save(self, command):
|
|
1221
1227
|
content = self.getRuntimeValue(command['content'])
|
|
1222
|
-
|
|
1223
|
-
if
|
|
1224
|
-
with open(
|
|
1225
|
-
f.write(content)
|
|
1228
|
+
filename = self.getRuntimeValue(command['file'])
|
|
1229
|
+
if filename.endswith('.json'): content = json.dumps(content)
|
|
1230
|
+
with open(filename, 'w') as f: f.write(content)
|
|
1226
1231
|
return self.nextPC()
|
|
1227
1232
|
|
|
1228
1233
|
# Send a message to a module
|
|
@@ -1691,6 +1696,7 @@ class Core(Handler):
|
|
|
1691
1696
|
value['name'] = token
|
|
1692
1697
|
symbolRecord = self.getSymbolRecord()
|
|
1693
1698
|
keyword = symbolRecord['keyword']
|
|
1699
|
+
|
|
1694
1700
|
if keyword == 'module':
|
|
1695
1701
|
value['type'] = 'module'
|
|
1696
1702
|
return value
|
|
@@ -2375,6 +2381,7 @@ class Core(Handler):
|
|
|
2375
2381
|
# Compile a condition
|
|
2376
2382
|
def compileCondition(self):
|
|
2377
2383
|
condition = Condition()
|
|
2384
|
+
|
|
2378
2385
|
if self.getToken() == 'not':
|
|
2379
2386
|
condition.type = 'not'
|
|
2380
2387
|
condition.value = self.nextValue()
|
|
@@ -2406,6 +2413,18 @@ class Core(Handler):
|
|
|
2406
2413
|
return condition
|
|
2407
2414
|
return None
|
|
2408
2415
|
|
|
2416
|
+
if token == 'does':
|
|
2417
|
+
self.nextToken()
|
|
2418
|
+
if self.nextIs('not'):
|
|
2419
|
+
if self.nextIs('have'):
|
|
2420
|
+
if self.nextToken() == 'property':
|
|
2421
|
+
prop = self.nextValue()
|
|
2422
|
+
condition.type = 'hasProperty'
|
|
2423
|
+
condition.property = prop
|
|
2424
|
+
condition.negate = not condition.negate
|
|
2425
|
+
return condition
|
|
2426
|
+
return None
|
|
2427
|
+
|
|
2409
2428
|
if token in ['starts', 'ends']:
|
|
2410
2429
|
self.nextToken()
|
|
2411
2430
|
if self.nextToken() == 'with':
|
|
@@ -2498,7 +2517,7 @@ class Core(Handler):
|
|
|
2498
2517
|
hasProp = True
|
|
2499
2518
|
except:
|
|
2500
2519
|
hasProp = False
|
|
2501
|
-
return hasProp
|
|
2520
|
+
return not hasProp if condition.negate else hasProp
|
|
2502
2521
|
|
|
2503
2522
|
def c_includes(self, condition):
|
|
2504
2523
|
value1 = self.getRuntimeValue(condition.value1)
|
|
@@ -2543,4 +2562,3 @@ class Core(Handler):
|
|
|
2543
2562
|
def c_string(self, condition):
|
|
2544
2563
|
comparison = type(self.getRuntimeValue(condition.value1)) is str
|
|
2545
2564
|
return not comparison if condition.negate else comparison
|
|
2546
|
-
# xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
easycoder/ec_program.py
CHANGED
|
@@ -149,17 +149,19 @@ class Program:
|
|
|
149
149
|
elif valType == 'symbol':
|
|
150
150
|
name = value['name']
|
|
151
151
|
symbolRecord = self.getSymbolRecord(name)
|
|
152
|
-
if symbolRecord['
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
152
|
+
if symbolRecord['valueHolder']:
|
|
153
|
+
handler = self.domainIndex[symbolRecord['domain']].valueHandler('symbol')
|
|
154
|
+
result = handler(symbolRecord)
|
|
155
|
+
else:
|
|
156
|
+
# Call the given domain to handle a value
|
|
157
|
+
domain = self.domainIndex[value['domain']]
|
|
158
|
+
handler = domain.valueHandler(value['type'])
|
|
159
|
+
if handler: result = handler(value)
|
|
157
160
|
else:
|
|
158
161
|
# Call the given domain to handle a value
|
|
159
162
|
domain = self.domainIndex[value['domain']]
|
|
160
163
|
handler = domain.valueHandler(value['type'])
|
|
161
|
-
if handler:
|
|
162
|
-
result = handler(value)
|
|
164
|
+
if handler: result = handler(value)
|
|
163
165
|
|
|
164
166
|
return result
|
|
165
167
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
2
|
Name: easycoder
|
|
3
|
-
Version:
|
|
3
|
+
Version: 250216.1
|
|
4
4
|
Summary: Rapid scripting in English
|
|
5
5
|
Keywords: compiler,scripting,prototyping,programming,coding,python,low code,hypertalk,computer language,learn to code
|
|
6
6
|
Author-email: Graham Trott <gtanyware@gmail.com>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
easycoder/README.md,sha256=BVXmYphcTJ6q6RN_9L6HtQukgCnOjSLVIsTM3lk-9aM,587
|
|
2
|
+
easycoder/__init__.py,sha256=-pc2f7yBRNQSVv_vxSCGD8fzrKymQryhZ04rM0h58e0,262
|
|
3
|
+
easycoder/ec_classes.py,sha256=xnWBNak8oKydkFoxHLlq9wo3lIsB3aMnTDrqbtCfoWo,1512
|
|
4
|
+
easycoder/ec_compiler.py,sha256=rtxFEWnhW0550MtWEDvYHOw9cYkeTcR0oG3t-kmgnBk,4795
|
|
5
|
+
easycoder/ec_condition.py,sha256=YXvSBQKEzKGCcgUGo3Qp8iHolXmm2BpEm0NimSDszIM,785
|
|
6
|
+
easycoder/ec_core.py,sha256=a3MEos2gaMre263Qgh_xyrTGYji5IZa1H-9wauHxtUI,88558
|
|
7
|
+
easycoder/ec_graphics.py,sha256=K44SbPb81KBGCe4wpl6VR4lt93AAGOZysFO2tkUuilY,13380
|
|
8
|
+
easycoder/ec_gutils.py,sha256=BHDsRgXR5XTO2nYhdBbC4OQW-9xU0czyFyee0tZ595E,6096
|
|
9
|
+
easycoder/ec_handler.py,sha256=IJvxcrJJSR53d6DS_8H5qPHKhp9y5-GV4WXAjhZxu_o,2250
|
|
10
|
+
easycoder/ec_program.py,sha256=BDwU7aGHiaw6WdbQvVFDhGVaHsvwQ1CWa4wb5MPmOe8,10013
|
|
11
|
+
easycoder/ec_timestamp.py,sha256=_3QFJPzIWZ9Rzk3SQOQJ-gwmvB07pg78k23SPntoZtY,288
|
|
12
|
+
easycoder/ec_value.py,sha256=zgDJTJhIg3yOvmnnKIfccIizmIhGbtvL_ghLTL1T5fg,2516
|
|
13
|
+
easycoder-250216.1.dist-info/entry_points.txt,sha256=JXAZbenl0TnsIft2FcGJbJ-4qoztVu2FuT8PFmWFexM,44
|
|
14
|
+
easycoder-250216.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
15
|
+
easycoder-250216.1.dist-info/WHEEL,sha256=ssQ84EZ5gH1pCOujd3iW7HClo_O_aDaClUbX4B8bjKY,100
|
|
16
|
+
easycoder-250216.1.dist-info/METADATA,sha256=8_9eLSJjEnzrZqAFyrzIgfkA78HaLkQu2zF976W3zBY,6162
|
|
17
|
+
easycoder-250216.1.dist-info/RECORD,,
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
easycoder/README.md,sha256=BVXmYphcTJ6q6RN_9L6HtQukgCnOjSLVIsTM3lk-9aM,587
|
|
2
|
-
easycoder/__init__.py,sha256=YspQLjTQ3whwCu_q14qOpSkxVrmHY4zhYFoKZLeiJ-Q,262
|
|
3
|
-
easycoder/ec_classes.py,sha256=xnWBNak8oKydkFoxHLlq9wo3lIsB3aMnTDrqbtCfoWo,1512
|
|
4
|
-
easycoder/ec_compiler.py,sha256=dFJEA_uOhD-HeSiAdBzmmA6q3LHThUVoJpSETanmSHs,4800
|
|
5
|
-
easycoder/ec_condition.py,sha256=WSbONo4zs2sX1icOVpscZDFSCAEFmTsquoc2RGcLx_k,763
|
|
6
|
-
easycoder/ec_core.py,sha256=ESs-at9iRXSMIhYh3C5NGPoB45ytciSa-HcsPTtkZJM,87759
|
|
7
|
-
easycoder/ec_graphics.py,sha256=K44SbPb81KBGCe4wpl6VR4lt93AAGOZysFO2tkUuilY,13380
|
|
8
|
-
easycoder/ec_gutils.py,sha256=BHDsRgXR5XTO2nYhdBbC4OQW-9xU0czyFyee0tZ595E,6096
|
|
9
|
-
easycoder/ec_handler.py,sha256=IJvxcrJJSR53d6DS_8H5qPHKhp9y5-GV4WXAjhZxu_o,2250
|
|
10
|
-
easycoder/ec_program.py,sha256=R8zMukA-pfRsOpcy9WqTw7fE_190dQfrMt2la23Yrs4,9904
|
|
11
|
-
easycoder/ec_timestamp.py,sha256=_3QFJPzIWZ9Rzk3SQOQJ-gwmvB07pg78k23SPntoZtY,288
|
|
12
|
-
easycoder/ec_value.py,sha256=zgDJTJhIg3yOvmnnKIfccIizmIhGbtvL_ghLTL1T5fg,2516
|
|
13
|
-
easycoder-250210.1.dist-info/entry_points.txt,sha256=JXAZbenl0TnsIft2FcGJbJ-4qoztVu2FuT8PFmWFexM,44
|
|
14
|
-
easycoder-250210.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
15
|
-
easycoder-250210.1.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
|
|
16
|
-
easycoder-250210.1.dist-info/METADATA,sha256=53M2wkLlEc1e2t4HKzG3jYSafGYHetGMBY4aJEkFDEw,6162
|
|
17
|
-
easycoder-250210.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|