easycoder 251105.1__py2.py3-none-any.whl → 260111.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.
Files changed (51) hide show
  1. easycoder/__init__.py +6 -3
  2. easycoder/debugger/__init__.py +5 -0
  3. easycoder/debugger/ec_dbg_value_display copy.py +195 -0
  4. easycoder/debugger/ec_dbg_value_display.py +24 -0
  5. easycoder/debugger/ec_dbg_watch_list copy.py +219 -0
  6. easycoder/debugger/ec_dbg_watchlist.py +293 -0
  7. easycoder/debugger/ec_debug.py +1025 -0
  8. easycoder/ec_classes.py +487 -11
  9. easycoder/ec_compiler.py +81 -44
  10. easycoder/ec_condition.py +1 -1
  11. easycoder/ec_core.py +1042 -1081
  12. easycoder/ec_gclasses.py +236 -0
  13. easycoder/ec_graphics.py +1683 -0
  14. easycoder/ec_handler.py +18 -14
  15. easycoder/ec_mqtt.py +248 -0
  16. easycoder/ec_program.py +297 -168
  17. easycoder/ec_psutil.py +48 -0
  18. easycoder/ec_value.py +65 -47
  19. easycoder/pre/README.md +3 -0
  20. easycoder/pre/__init__.py +17 -0
  21. easycoder/pre/debugger/__init__.py +5 -0
  22. easycoder/pre/debugger/ec_dbg_value_display copy.py +195 -0
  23. easycoder/pre/debugger/ec_dbg_value_display.py +24 -0
  24. easycoder/pre/debugger/ec_dbg_watch_list copy.py +219 -0
  25. easycoder/pre/debugger/ec_dbg_watchlist.py +293 -0
  26. easycoder/{ec_debug.py → pre/debugger/ec_debug.py} +418 -185
  27. easycoder/pre/ec_border.py +67 -0
  28. easycoder/pre/ec_classes.py +470 -0
  29. easycoder/pre/ec_compiler.py +291 -0
  30. easycoder/pre/ec_condition.py +27 -0
  31. easycoder/pre/ec_core.py +2772 -0
  32. easycoder/pre/ec_gclasses.py +230 -0
  33. easycoder/{ec_pyside.py → pre/ec_graphics.py} +583 -433
  34. easycoder/pre/ec_handler.py +79 -0
  35. easycoder/pre/ec_keyboard.py +439 -0
  36. easycoder/pre/ec_program.py +557 -0
  37. easycoder/pre/ec_psutil.py +48 -0
  38. easycoder/pre/ec_timestamp.py +11 -0
  39. easycoder/pre/ec_value.py +124 -0
  40. easycoder/pre/icons/close.png +0 -0
  41. easycoder/pre/icons/exit.png +0 -0
  42. easycoder/pre/icons/run.png +0 -0
  43. easycoder/pre/icons/step.png +0 -0
  44. easycoder/pre/icons/stop.png +0 -0
  45. easycoder/pre/icons/tick.png +0 -0
  46. {easycoder-251105.1.dist-info → easycoder-260111.1.dist-info}/METADATA +11 -1
  47. easycoder-260111.1.dist-info/RECORD +59 -0
  48. easycoder-251105.1.dist-info/RECORD +0 -24
  49. {easycoder-251105.1.dist-info → easycoder-260111.1.dist-info}/WHEEL +0 -0
  50. {easycoder-251105.1.dist-info → easycoder-260111.1.dist-info}/entry_points.txt +0 -0
  51. {easycoder-251105.1.dist-info → easycoder-260111.1.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,124 @@
1
+ from typing import Optional, List
2
+ from .ec_classes import ECObject, FatalError, ECValue
3
+
4
+ # Create a constant
5
+ def getConstant(str):
6
+ return ECValue(type=str, content=str)
7
+
8
+ class Value:
9
+
10
+ def __init__(self, compiler):
11
+ self.compiler = compiler
12
+ self.getToken = compiler.getToken
13
+ self.nextToken = compiler.nextToken
14
+ self.peek = compiler.peek
15
+ self.skip = compiler.skip
16
+ self.tokenIs = compiler.tokenIs
17
+
18
+ def getItem(self) -> Optional[ECValue]:
19
+ token = self.getToken()
20
+ if not token:
21
+ return None
22
+
23
+ value = ECValue()
24
+
25
+ if token == 'true':
26
+ value.setValue(bool, True)
27
+ return value
28
+
29
+ if token == 'false':
30
+ value.setValue(bool, False)
31
+ return value
32
+
33
+ # Check for a string constant
34
+ if token[0] == '`':
35
+ if token[len(token) - 1] == '`':
36
+ value.setValue(type=str, content=token[1 : len(token) - 1])
37
+ return value
38
+ FatalError(self.compiler, f'Unterminated string "{token}"')
39
+ return None
40
+
41
+ # Check for a numeric constant
42
+ if token.isnumeric() or (token[0] == '-' and token[1:].isnumeric):
43
+ val = eval(token)
44
+ if isinstance(val, int):
45
+ value.setValue(int, val)
46
+ return value
47
+ FatalError(self.compiler, f'{token} is not an integer')
48
+
49
+ # See if any of the domains can handle it
50
+ mark = self.compiler.getIndex()
51
+ for domain in self.compiler.program.getDomains():
52
+ item = domain.compileValue()
53
+ if item != None: return item
54
+ self.compiler.rewindTo(mark)
55
+ # self.compiler.warning(f'I don\'t understand \'{token}\'')
56
+ return None
57
+
58
+ # Get a list of items following 'the cat of ...'
59
+ def getCatItems(self) -> Optional[List[ECValue]]:
60
+ items: List[ECValue] = []
61
+ item = self.getItem()
62
+ if item == None: return None
63
+ items.append(item)
64
+ while self.peek() in ['cat', 'and']:
65
+ self.nextToken()
66
+ self.nextToken()
67
+ element = self.getItem()
68
+ if element != None:
69
+ items.append(element) # pyright: ignore[reportOptionalMemberAccess]
70
+ return items
71
+
72
+ # Check if any domain has something to add to the value
73
+ def checkDomainAdditions(self, value):
74
+ for domain in self.compiler.program.getDomains():
75
+ value = domain.modifyValue(value)
76
+ return value
77
+
78
+ # Compile a value
79
+ def compileValue(self) -> Optional[ECValue]:
80
+ token = self.getToken()
81
+ # Special-case the plugin-safe full form: "the cat of ..."
82
+ if token == 'the' and self.peek() == 'cat':
83
+ self.nextToken() # move to 'cat'
84
+ self.skip('of')
85
+ self.nextToken()
86
+ items = self.getCatItems()
87
+ value = ECValue(type='cat', content=items)
88
+ return self.checkDomainAdditions(value)
89
+
90
+ # Otherwise, consume any leading articles before normal parsing
91
+ self.compiler.skipArticles()
92
+ token = self.getToken()
93
+
94
+ item: ECValue|None = self.getItem()
95
+ if item == None:
96
+ self.compiler.warning(f'ec_value.compileValue: Cannot get the value of "{token}"')
97
+ return None
98
+ if item.getType() == 'symbol':
99
+ object = self.compiler.getSymbolRecord(item.getContent())['object']
100
+ if not object.hasRuntimeValue(): return None
101
+
102
+ if self.peek() == 'cat':
103
+ self.nextToken() # consume 'cat'
104
+ self.nextToken()
105
+ items = self.getCatItems()
106
+ if items != None: items.insert(0, item)
107
+ value = ECValue(type='cat', content=items)
108
+ else:
109
+ value = item
110
+
111
+ return self.checkDomainAdditions(value)
112
+
113
+ def compileConstant(self, token):
114
+ value = ECValue()
115
+ if type(token) == str:
116
+ token = eval(token)
117
+ if isinstance(token, int):
118
+ value.setValue(type=int, content=token)
119
+ return value
120
+ if isinstance(token, float):
121
+ value.setValue(type=float, content=token)
122
+ return value
123
+ value.setValue(type=str, content=token)
124
+ return value
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: easycoder
3
- Version: 251105.1
3
+ Version: 260111.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>
@@ -108,9 +108,19 @@ Here in the repository is a folder called `scripts` containing some sample scrip
108
108
 
109
109
  **_EasyCoder_** comprises a set of modules to handle tokenisation, compilation and runtime control. Syntax and grammar are defined by [packages](doc/README.md), of which there are currently two; the [core](doc/core/README.md) package, which implements a comprehensive set of command-line programming features, and and the [graphics](doc/graphics/README.md) package, which adds graphical features in a windowing environment.
110
110
 
111
+ See also [How it works](doc/README.md)
112
+
111
113
  ## Extending the language
112
114
 
113
115
  **_EasyCoder_** can be extended to add new functionality with the use of 'plugins'. These contain compiler and runtime modules for the added language features. **_EasyCoder_** can use the added keywords, values and conditions freely; the effect is completely seamless. There is an outline example in the `plugins` directory called `example.py`, which comprises a module called `Points` with new language syntax to deal with two-valued items such as coordinates. In the `scripts` directory there is `points.ecs`, which exercises the new functionality.
114
116
 
115
117
  A plugin can act as a wrapper around any Python functionality that has a sensible API, thereby hiding its complexity. The only challenge is to devise an unambiguous syntax that doesn't clash with anything already existing in **_EasyCoder_**.
116
118
 
119
+ ## Contributing
120
+
121
+ We welcome contributions to EasyCoder-py! Please see our [CONTRIBUTING.md](CONTRIBUTING.md) guide for:
122
+ - Getting started with development
123
+ - How to work with Git branches and merge changes
124
+ - Resolving merge conflicts
125
+ - Testing and submitting pull requests
126
+
@@ -0,0 +1,59 @@
1
+ easycoder/__init__.py,sha256=nYFlZb7sZP9gFyo_yeDT7JB4_d6NJeHMCDMYscMzhuM,416
2
+ easycoder/ec_border.py,sha256=2qgGYxB-tIk_ZM0CmW3Yt7TotlUwxwrN9fL3cCvn8eE,2599
3
+ easycoder/ec_classes.py,sha256=LWxB8T2n8KYmVdmz9uqRJWfZ8gcwHg-UsledXz0PHTA,16869
4
+ easycoder/ec_compiler.py,sha256=nAWaWvswTZpzNB_J--UWNVP7s7i7XuUnjKw8ZQ3ZHy4,7706
5
+ easycoder/ec_condition.py,sha256=BU59phivUDEAjmhBZTVziJ510MswXAPV1kMTa2I8QoQ,785
6
+ easycoder/ec_core.py,sha256=5ayL3zPn3JTRFERrgJKb8LKUp1v2w6r9ZVWQknKYt4o,103164
7
+ easycoder/ec_gclasses.py,sha256=MQumyaZp0WFcEXOlhKvLV-RjO2osFpZ-ja-EPw8Qsgg,6808
8
+ easycoder/ec_graphics.py,sha256=7rbn2HBAbS6r88jCnwOo9svGfMLs-pBV0Hnj2QHEDrI,67371
9
+ easycoder/ec_handler.py,sha256=K_Md0SRx3AzzDD7PEaBs9FkA4qXSTL59tzhgv8CVuHE,2659
10
+ easycoder/ec_keyboard.py,sha256=R6JvgUwvgj4pJiGwXbPrFmhC-DSxJbZQnPQ9pzabrMM,19705
11
+ easycoder/ec_mqtt.py,sha256=cJxdmkSRZiJaaIFbWuA8EWtBXoze__Ob5eT3G4nLHqA,8575
12
+ easycoder/ec_program.py,sha256=M5nFyfN66jtRPbrF_swXqCeFDhnBEwNrBOnhKhpsHkA,16370
13
+ easycoder/ec_psutil.py,sha256=4rs6BT4gzzNsD3VZP4-p1B55HiOVK6rASyPYylUU8bI,1543
14
+ easycoder/ec_timestamp.py,sha256=z-HonUY7BDjgVVf2W_qQynnFjwGc_dAYultFjAmrXpg,307
15
+ easycoder/ec_value.py,sha256=EbWNhvK4PNX-1rW0ky8TLS4krQS5NDkwsJ7aJ4iZxx4,3554
16
+ easycoder/debugger/__init__.py,sha256=qWN02-1SoiXHCn85B_AQ7NCS8sNVvnXoAZTWpDFCvcs,88
17
+ easycoder/debugger/ec_dbg_value_display copy.py,sha256=VrKIrO53uGPEzUOj4Wj3Ztu2aMbG7KcDIAeb_PM6riA,7505
18
+ easycoder/debugger/ec_dbg_value_display.py,sha256=obT2AYNH00BZCzWIRh91LdXTmDNa6mLkExjP8tYNBJ4,769
19
+ easycoder/debugger/ec_dbg_watch_list copy.py,sha256=ul294vjdApBVEWkfB3T5YZUjNAKoLXjmraklpmSRt90,10323
20
+ easycoder/debugger/ec_dbg_watchlist.py,sha256=wWq2Exw_5crxdo-JMIPAcsptBi7L_3rIYYqPz3ZsOgo,10813
21
+ easycoder/debugger/ec_debug.py,sha256=GStorXvJ9eypSbHnlyV7SoYu4xDzL8jE8xDDZmVa-Vo,41995
22
+ easycoder/icons/close.png,sha256=3B9ueRNtEu9E4QNmZhdyC4VL6uqKvGmdfeFxIV9aO_Y,9847
23
+ easycoder/icons/exit.png,sha256=mVQQhMQQfboJTf4p11S0TR-8qwLgO9cFaCDxf20SsfI,3408
24
+ easycoder/icons/run.png,sha256=5hDyMPMlY9ypA_rR5gqM5hb4vGIg2A4_pcEmPCq0iaM,3937
25
+ easycoder/icons/step.png,sha256=r4XW-2GBVrYm7kb-xvth7jHMX3g9Ge-3onfpdOHyhyE,8224
26
+ easycoder/icons/stop.png,sha256=MoK6EbWFxDBdCH_ojTehjb7ty_Ax27n-8fKK_yBonfs,1832
27
+ easycoder/icons/tick.png,sha256=OedASXJJTYvnza4J6Kv5m5lz6DrBfy667zX_WGgtbmM,9127
28
+ easycoder/pre/README.md,sha256=77nlI4WkrDpBVmqrxcT97nwPPQ2HqgRSb0Vp_guxIPY,202
29
+ easycoder/pre/__init__.py,sha256=ynArzRbAS4I7DSb7NWXFP_6e21QJfljH4IFzCXEBUy0,393
30
+ easycoder/pre/ec_border.py,sha256=2qgGYxB-tIk_ZM0CmW3Yt7TotlUwxwrN9fL3cCvn8eE,2599
31
+ easycoder/pre/ec_classes.py,sha256=msSX9jCyK4xFvNjlDtiNznZG7tRntIIfW_YmMk128fQ,14693
32
+ easycoder/pre/ec_compiler.py,sha256=nAWaWvswTZpzNB_J--UWNVP7s7i7XuUnjKw8ZQ3ZHy4,7706
33
+ easycoder/pre/ec_condition.py,sha256=BU59phivUDEAjmhBZTVziJ510MswXAPV1kMTa2I8QoQ,785
34
+ easycoder/pre/ec_core.py,sha256=uA5B7_5Tj6UstGBHgBcf2uIKJN_KaBdpesLApe-68eg,101138
35
+ easycoder/pre/ec_gclasses.py,sha256=j5zBhsyUGt2lpR-G3YSXk4VRiK4w7IvoAbmBvAug7-0,6627
36
+ easycoder/pre/ec_graphics.py,sha256=XnWX0qF82V46wIt2rkYldeIa3QSmwyZyU9wq26lEIpY,67364
37
+ easycoder/pre/ec_handler.py,sha256=b0mn9UkVOTa-RwWK_HyNqCv-s16LDgClUpMHT2yLOK4,2669
38
+ easycoder/pre/ec_keyboard.py,sha256=R6JvgUwvgj4pJiGwXbPrFmhC-DSxJbZQnPQ9pzabrMM,19705
39
+ easycoder/pre/ec_program.py,sha256=mcT6ZYX5EyQBr7VUMbJ4qUxdI_sMIGQ1-PFcX7ncYlM,16187
40
+ easycoder/pre/ec_psutil.py,sha256=4rs6BT4gzzNsD3VZP4-p1B55HiOVK6rASyPYylUU8bI,1543
41
+ easycoder/pre/ec_timestamp.py,sha256=z-HonUY7BDjgVVf2W_qQynnFjwGc_dAYultFjAmrXpg,307
42
+ easycoder/pre/ec_value.py,sha256=7gQTGekp0zm67RAsk-wDigSv0w63-9Vgg2wkRyyZjSc,3544
43
+ easycoder/pre/debugger/__init__.py,sha256=qWN02-1SoiXHCn85B_AQ7NCS8sNVvnXoAZTWpDFCvcs,88
44
+ easycoder/pre/debugger/ec_dbg_value_display copy.py,sha256=VrKIrO53uGPEzUOj4Wj3Ztu2aMbG7KcDIAeb_PM6riA,7505
45
+ easycoder/pre/debugger/ec_dbg_value_display.py,sha256=obT2AYNH00BZCzWIRh91LdXTmDNa6mLkExjP8tYNBJ4,769
46
+ easycoder/pre/debugger/ec_dbg_watch_list copy.py,sha256=ul294vjdApBVEWkfB3T5YZUjNAKoLXjmraklpmSRt90,10323
47
+ easycoder/pre/debugger/ec_dbg_watchlist.py,sha256=wWq2Exw_5crxdo-JMIPAcsptBi7L_3rIYYqPz3ZsOgo,10813
48
+ easycoder/pre/debugger/ec_debug.py,sha256=BWesUUiFzbNvwMY1uz-A74kd_QS2d9QhAF60wgi8r8A,41432
49
+ easycoder/pre/icons/close.png,sha256=3B9ueRNtEu9E4QNmZhdyC4VL6uqKvGmdfeFxIV9aO_Y,9847
50
+ easycoder/pre/icons/exit.png,sha256=mVQQhMQQfboJTf4p11S0TR-8qwLgO9cFaCDxf20SsfI,3408
51
+ easycoder/pre/icons/run.png,sha256=5hDyMPMlY9ypA_rR5gqM5hb4vGIg2A4_pcEmPCq0iaM,3937
52
+ easycoder/pre/icons/step.png,sha256=r4XW-2GBVrYm7kb-xvth7jHMX3g9Ge-3onfpdOHyhyE,8224
53
+ easycoder/pre/icons/stop.png,sha256=MoK6EbWFxDBdCH_ojTehjb7ty_Ax27n-8fKK_yBonfs,1832
54
+ easycoder/pre/icons/tick.png,sha256=OedASXJJTYvnza4J6Kv5m5lz6DrBfy667zX_WGgtbmM,9127
55
+ easycoder-260111.1.dist-info/entry_points.txt,sha256=JXAZbenl0TnsIft2FcGJbJ-4qoztVu2FuT8PFmWFexM,44
56
+ easycoder-260111.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
57
+ easycoder-260111.1.dist-info/WHEEL,sha256=Dyt6SBfaasWElUrURkknVFAZDHSTwxg3PaTza7RSbkY,100
58
+ easycoder-260111.1.dist-info/METADATA,sha256=sb-1heqiCpMuP8K19umPd9EYnzuktav-xHLSIenAyJA,7210
59
+ easycoder-260111.1.dist-info/RECORD,,
@@ -1,24 +0,0 @@
1
- easycoder/__init__.py,sha256=J24CvAOLaN6hXFU-dc1p6uzIScRoi-d26Fz4wHGfPrI,339
2
- easycoder/ec_border.py,sha256=2qgGYxB-tIk_ZM0CmW3Yt7TotlUwxwrN9fL3cCvn8eE,2599
3
- easycoder/ec_classes.py,sha256=EWpB3Wta_jvKZ8SNIWua_ElIbw1FzKMyM3_IiXBn-lg,1995
4
- easycoder/ec_compiler.py,sha256=Q6a9nMmZogJzHu8OB4VeMzmBBarVEl3-RkqH2gW4LiU,6599
5
- easycoder/ec_condition.py,sha256=uamZrlW3Ej3R4bPDuduGB2f00M80Z1D0qV8muDx4Qfw,784
6
- easycoder/ec_core.py,sha256=TocIp8uyhT210OyF4Nj5nOswXywO0zl3mkh5HT2AmXk,100499
7
- easycoder/ec_debug.py,sha256=nzcFxzFSbFkmCR6etGeSOAR7YeVkjGfk3rsY-3tPY2U,31877
8
- easycoder/ec_handler.py,sha256=WRuvnUtaz71eiRHR5LTJHqUW8CcKjlLKDUcDp_Gtdyc,2351
9
- easycoder/ec_keyboard.py,sha256=R6JvgUwvgj4pJiGwXbPrFmhC-DSxJbZQnPQ9pzabrMM,19705
10
- easycoder/ec_program.py,sha256=jBTMaHab3k-3w9nLRNiT3tWdYx2psLcsNOKf0I1AC04,11422
11
- easycoder/ec_pyside.py,sha256=sWGDtOInd0471M5ZpQpXPLTZPRNpmINa7KmiYD8e55I,59119
12
- easycoder/ec_timestamp.py,sha256=z-HonUY7BDjgVVf2W_qQynnFjwGc_dAYultFjAmrXpg,307
13
- easycoder/ec_value.py,sha256=zgDJTJhIg3yOvmnnKIfccIizmIhGbtvL_ghLTL1T5fg,2516
14
- easycoder/icons/close.png,sha256=3B9ueRNtEu9E4QNmZhdyC4VL6uqKvGmdfeFxIV9aO_Y,9847
15
- easycoder/icons/exit.png,sha256=mVQQhMQQfboJTf4p11S0TR-8qwLgO9cFaCDxf20SsfI,3408
16
- easycoder/icons/run.png,sha256=5hDyMPMlY9ypA_rR5gqM5hb4vGIg2A4_pcEmPCq0iaM,3937
17
- easycoder/icons/step.png,sha256=r4XW-2GBVrYm7kb-xvth7jHMX3g9Ge-3onfpdOHyhyE,8224
18
- easycoder/icons/stop.png,sha256=MoK6EbWFxDBdCH_ojTehjb7ty_Ax27n-8fKK_yBonfs,1832
19
- easycoder/icons/tick.png,sha256=OedASXJJTYvnza4J6Kv5m5lz6DrBfy667zX_WGgtbmM,9127
20
- easycoder-251105.1.dist-info/entry_points.txt,sha256=JXAZbenl0TnsIft2FcGJbJ-4qoztVu2FuT8PFmWFexM,44
21
- easycoder-251105.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
22
- easycoder-251105.1.dist-info/WHEEL,sha256=Dyt6SBfaasWElUrURkknVFAZDHSTwxg3PaTza7RSbkY,100
23
- easycoder-251105.1.dist-info/METADATA,sha256=bdVSksUKoHrEQCtq6NDDC4KMD08pzWe2JHi4TiuMBfs,6897
24
- easycoder-251105.1.dist-info/RECORD,,