Skip to content

Commit ad86e7d

Browse files
committed
v241227.1
1 parent 7984b90 commit ad86e7d

16 files changed

+607
-652
lines changed
-30 KB
Binary file not shown.
30.2 KB
Binary file not shown.
2.51 MB
Binary file not shown.

easycoder/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'''EasyCoder for Python'''
22

3+
from .ec import Main
34
from .ec_classes import *
45
from .ec_compiler import *
56
from .ec_condition import *
@@ -8,6 +9,5 @@
89
from .ec_program import *
910
from .ec_timestamp import *
1011
from .ec_value import *
11-
from .ec_graphics import *
1212

13-
__version__ = "241218.1"
13+
__version__ = "241227.1"

easycoder/ec.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import sys
2+
from .ec_program import Program
3+
4+
# This is the program launcher
5+
def Main():
6+
print(f'Args: {sys.argv}')
7+
if (len(sys.argv) > 1):
8+
Program(sys.argv[1:]).start()
9+
else:
10+
print('Syntax: easycoder <scriptname>')

easycoder/ec_classes.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,6 @@ def __init__(self, lino, token):
5252

5353
class Condition():
5454
negate = False
55+
56+
class Object():
57+
pass

easycoder/ec_compiler.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ def __init__(self, program):
1616
self.warnings = []
1717
self.program.compiler = self
1818
self.addCommand = self.program.add
19+
self.compileConstant = self.value.compileConstant
1920

2021
def getPC(self):
2122
return len(self.program.code)
@@ -44,6 +45,11 @@ def peek(self):
4445
except:
4546
return None
4647

48+
# Get a constant
49+
def getConstant(self, token):
50+
self.index += 1
51+
return self.compileConstant(token)
52+
4753
# Get a value
4854
def getValue(self):
4955
return self.value.compileValue()
@@ -53,11 +59,6 @@ def nextValue(self):
5359
self.index += 1
5460
return self.value.compileValue()
5561

56-
# Get a constant
57-
def getConstant(self, token):
58-
self.index += 1
59-
return self.value.compileConstant(token)
60-
6162
# Get a condition
6263
def getCondition(self):
6364
return self.condition.compileCondition()
@@ -101,7 +102,7 @@ def warning(self, message):
101102

102103
def showWarnings(self):
103104
for warning in self.warnings:
104-
print(f'Warning: Line {self.getLino() + 1}: {warning}')
105+
print(f'Warning at line {self.getLino() + 1} from {warning}')
105106

106107
def getSymbolRecord(self):
107108
token = self.getToken()

easycoder/ec_core.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -724,8 +724,10 @@ def k_open(self, command):
724724
FatalError(self.program.compiler, 'Unknown file open mode {self.getToken()}')
725725
return False
726726
command['mode'] = mode
727-
self.add(command)
728-
return True
727+
else:
728+
command['mode'] = 'r'
729+
self.add(command)
730+
return True
729731
else:
730732
FatalError(self.compiler, f'Variable "{self.getToken()}" is not a file')
731733
else:

0 commit comments

Comments
 (0)