easycoder 241218.1__py2.py3-none-any.whl → 241231.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/README.md +6 -0
- easycoder/__init__.py +2 -2
- easycoder/ec.py +10 -0
- easycoder/ec_classes.py +3 -0
- easycoder/ec_compiler.py +7 -6
- easycoder/ec_core.py +29 -4
- easycoder/ec_graphics.py +275 -222
- easycoder/ec_handler.py +1 -0
- easycoder/ec_program.py +72 -58
- easycoder/ec_renderer.py +235 -325
- easycoder/ec_screenspec.py +77 -0
- easycoder/ec_value.py +10 -10
- {easycoder-241218.1.dist-info → easycoder-241231.1.dist-info}/METADATA +11 -3
- easycoder-241231.1.dist-info/RECORD +19 -0
- easycoder-241218.1.dist-info/RECORD +0 -16
- {easycoder-241218.1.dist-info → easycoder-241231.1.dist-info}/LICENSE +0 -0
- {easycoder-241218.1.dist-info → easycoder-241231.1.dist-info}/WHEEL +0 -0
- {easycoder-241218.1.dist-info → easycoder-241231.1.dist-info}/entry_points.txt +0 -0
easycoder/README.md
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# EasyCode source code
|
|
2
|
+
These are the Python files that comprise **_EasyCoder_**.
|
|
3
|
+
|
|
4
|
+
**_EasyCoder_** has a small number of third-party dependencies. A minor one is `pytz`, which handles timezones. The biggest one by far is `kivy`, a comprehensive Python graphics library.
|
|
5
|
+
|
|
6
|
+
If an **_EasyCoder_** script filename ends with `.ecs` it's a command-line script. If it ends with `.ecg` it's a script for a graphical application and will cause `kivy` to be imported. Obviously this will only work on a GUI-based system, whereas command-line scripts will run anywhere there is Python.
|
easycoder/__init__.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'''EasyCoder for Python'''
|
|
2
2
|
|
|
3
|
+
from .ec import Main
|
|
3
4
|
from .ec_classes import *
|
|
4
5
|
from .ec_compiler import *
|
|
5
6
|
from .ec_condition import *
|
|
@@ -8,6 +9,5 @@ from .ec_handler import *
|
|
|
8
9
|
from .ec_program import *
|
|
9
10
|
from .ec_timestamp import *
|
|
10
11
|
from .ec_value import *
|
|
11
|
-
from .ec_graphics import *
|
|
12
12
|
|
|
13
|
-
__version__ = "
|
|
13
|
+
__version__ = "241231.1"
|
easycoder/ec.py
ADDED
easycoder/ec_classes.py
CHANGED
easycoder/ec_compiler.py
CHANGED
|
@@ -16,6 +16,7 @@ class Compiler:
|
|
|
16
16
|
self.warnings = []
|
|
17
17
|
self.program.compiler = self
|
|
18
18
|
self.addCommand = self.program.add
|
|
19
|
+
self.compileConstant = self.value.compileConstant
|
|
19
20
|
|
|
20
21
|
def getPC(self):
|
|
21
22
|
return len(self.program.code)
|
|
@@ -44,6 +45,11 @@ class Compiler:
|
|
|
44
45
|
except:
|
|
45
46
|
return None
|
|
46
47
|
|
|
48
|
+
# Get a constant
|
|
49
|
+
def getConstant(self, token):
|
|
50
|
+
self.index += 1
|
|
51
|
+
return self.compileConstant(token)
|
|
52
|
+
|
|
47
53
|
# Get a value
|
|
48
54
|
def getValue(self):
|
|
49
55
|
return self.value.compileValue()
|
|
@@ -53,11 +59,6 @@ class Compiler:
|
|
|
53
59
|
self.index += 1
|
|
54
60
|
return self.value.compileValue()
|
|
55
61
|
|
|
56
|
-
# Get a constant
|
|
57
|
-
def getConstant(self, token):
|
|
58
|
-
self.index += 1
|
|
59
|
-
return self.value.compileConstant(token)
|
|
60
|
-
|
|
61
62
|
# Get a condition
|
|
62
63
|
def getCondition(self):
|
|
63
64
|
return self.condition.compileCondition()
|
|
@@ -101,7 +102,7 @@ class Compiler:
|
|
|
101
102
|
|
|
102
103
|
def showWarnings(self):
|
|
103
104
|
for warning in self.warnings:
|
|
104
|
-
print(f'Warning
|
|
105
|
+
print(f'Warning at line {self.getLino() + 1} from {warning}')
|
|
105
106
|
|
|
106
107
|
def getSymbolRecord(self):
|
|
107
108
|
token = self.getToken()
|
easycoder/ec_core.py
CHANGED
|
@@ -696,6 +696,29 @@ class Core(Handler):
|
|
|
696
696
|
self.putSymbolValue(target, value)
|
|
697
697
|
return self.nextPC()
|
|
698
698
|
|
|
699
|
+
# Negate a variable
|
|
700
|
+
def k_negate(self, command):
|
|
701
|
+
if self.nextIsSymbol():
|
|
702
|
+
symbolRecord = self.getSymbolRecord()
|
|
703
|
+
if symbolRecord['valueHolder']:
|
|
704
|
+
command['target'] = self.getToken()
|
|
705
|
+
self.add(command)
|
|
706
|
+
return True
|
|
707
|
+
self.warning(f'Core.negate: Variable "{symbolRecord["name"]}" does not hold a value')
|
|
708
|
+
return False
|
|
709
|
+
|
|
710
|
+
def r_negate(self, command):
|
|
711
|
+
symbolRecord = self.getVariable(command['target'])
|
|
712
|
+
if not symbolRecord['valueHolder']:
|
|
713
|
+
RuntimeError(self.program, f'{symbolRecord["name"]} does not hold a value')
|
|
714
|
+
return None
|
|
715
|
+
value = self.getSymbolValue(symbolRecord)
|
|
716
|
+
if value == None:
|
|
717
|
+
RuntimeError(self.program, f'{symbolRecord["name"]} has not been initialised')
|
|
718
|
+
value['content'] *= -1
|
|
719
|
+
self.putSymbolValue(symbolRecord, value)
|
|
720
|
+
return self.nextPC()
|
|
721
|
+
|
|
699
722
|
# Define an object variable
|
|
700
723
|
def k_object(self, command):
|
|
701
724
|
return self.compileVariable(command)
|
|
@@ -724,8 +747,10 @@ class Core(Handler):
|
|
|
724
747
|
FatalError(self.program.compiler, 'Unknown file open mode {self.getToken()}')
|
|
725
748
|
return False
|
|
726
749
|
command['mode'] = mode
|
|
727
|
-
|
|
728
|
-
|
|
750
|
+
else:
|
|
751
|
+
command['mode'] = 'r'
|
|
752
|
+
self.add(command)
|
|
753
|
+
return True
|
|
729
754
|
else:
|
|
730
755
|
FatalError(self.compiler, f'Variable "{self.getToken()}" is not a file')
|
|
731
756
|
else:
|
|
@@ -974,7 +999,7 @@ class Core(Handler):
|
|
|
974
999
|
content = self.getSymbolValue(templateRecord)['content']
|
|
975
1000
|
original = self.getRuntimeValue(command['original'])
|
|
976
1001
|
replacement = self.getRuntimeValue(command['replacement'])
|
|
977
|
-
content = content.replace(original, replacement)
|
|
1002
|
+
content = content.replace(original, str(replacement))
|
|
978
1003
|
value = {}
|
|
979
1004
|
value['type'] = 'text'
|
|
980
1005
|
value['numeric'] = False
|
|
@@ -1415,7 +1440,7 @@ class Core(Handler):
|
|
|
1415
1440
|
# Compile a value in this domain
|
|
1416
1441
|
def compileValue(self):
|
|
1417
1442
|
value = {}
|
|
1418
|
-
value['domain'] =
|
|
1443
|
+
value['domain'] = self.getName()
|
|
1419
1444
|
token = self.getToken()
|
|
1420
1445
|
if self.isSymbol():
|
|
1421
1446
|
value['name'] = token
|