pyscript-programming-language 1.13.0__tar.gz → 1.13.1__tar.gz
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.
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/PKG-INFO +5 -5
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/README.md +4 -4
- pyscript_programming_language-1.13.1/changelog.md +12 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyproject.toml +1 -1
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/__main__.py +3 -4
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/core/cache.py +2 -1
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/core/constants.py +1 -1
- pyscript_programming_language-1.13.1/pyscript/core/editor/bases.py +70 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/core/editor/gui.py +37 -44
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/core/editor/terminal.py +7 -2
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/core/parser.py +6 -6
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/core/pysbuiltins.py +1 -1
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/core/runner.py +1 -1
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/core/symtab.py +11 -5
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/core/utils/generic.py +3 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/core/version.py +2 -2
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/lib/ast/ast_literal_eval.py +6 -7
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/lib/brainfuck.pys +2 -2
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/lib/inspect.pys +5 -5
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/lib/parser.pys +18 -9
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/lib/pdisplay.pys +3 -3
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/lib/site.pys +1 -1
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/site-packages/this.pys +5 -10
- pyscript_programming_language-1.13.1/pyscript/this.py +11 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript_programming_language.egg-info/PKG-INFO +5 -5
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/setup.py +1 -1
- pyscript_programming_language-1.13.0/changelog.md +0 -27
- pyscript_programming_language-1.13.0/pyscript/core/editor/bases.py +0 -38
- pyscript_programming_language-1.13.0/pyscript/this.py +0 -8
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/MANIFEST.in +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/__init__.py +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/__init__.pyi +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/core/__init__.py +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/core/analyzer.py +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/core/bases.py +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/core/buffer.py +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/core/checks.py +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/core/context.py +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/core/editor/__init__.py +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/core/exceptions.py +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/core/handlers.py +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/core/highlight.py +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/core/interpreter.py +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/core/lexer.py +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/core/mapping.py +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/core/nodes.py +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/core/position.py +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/core/pystypes.py +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/core/results.py +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/core/shell.py +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/core/token.py +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/core/utils/__init__.py +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/core/utils/ansi.py +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/core/utils/debug.py +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/core/utils/decorators.py +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/core/utils/module.py +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/core/utils/path.py +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/core/utils/similarity.py +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/core/utils/string.py +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/lib/__hello__.pys +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/lib/ansi.pys +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/lib/ast/__init__.pys +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/lib/ast/ast_dump.py +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/lib/ast/ast_unparse.py +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/lib/ast/ast_walk.py +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/lib/code.pys +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/lib/dis.pys +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/lib/explorer.pys +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/lib/fpstimer/__init__.pys +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/lib/fpstimer/py_fpstimer.py +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/lib/getch/__init__.pys +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/lib/getch/py_getch.py +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/lib/history.pys +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/lib/jsdict.pys +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/lib/keyword.pys +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/lib/opcode.pys +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/lib/symtable.pys +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/lib/token.pys +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/lib/tokenize/__init__.pys +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/lib/tokenize/tok_untokenize.py +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/other/.nomedia +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/other/PyScript.ico +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/other/copyright +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/other/credits +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/other/license +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript_programming_language.egg-info/SOURCES.txt +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript_programming_language.egg-info/dependency_links.txt +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript_programming_language.egg-info/requires.txt +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript_programming_language.egg-info/top_level.txt +0 -0
- {pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyscript-programming-language
|
|
3
|
-
Version: 1.13.
|
|
3
|
+
Version: 1.13.1
|
|
4
4
|
Summary: PyScript Programming Language
|
|
5
5
|
Home-page: https://azzammuhyala.github.io/pyscript
|
|
6
6
|
Author: Azzam Muhyala
|
|
@@ -42,7 +42,7 @@ Dynamic: requires-python
|
|
|
42
42
|
<img src="https://img.shields.io/badge/license-MIT-orange" alt="License MIT">
|
|
43
43
|
</a>
|
|
44
44
|
<a href="https://www.python.org/">
|
|
45
|
-
<img src="https://img.shields.io/badge/python-3.10
|
|
45
|
+
<img src="https://img.shields.io/badge/python-3.10+-yellow" alt="Python 3.10+">
|
|
46
46
|
</a>
|
|
47
47
|
</div>
|
|
48
48
|
|
|
@@ -144,12 +144,12 @@ Familiar? There it is!
|
|
|
144
144
|
import it.
|
|
145
145
|
- **optional**: Not required, but if it is present, some features can be used without issue.
|
|
146
146
|
|
|
147
|
-
## Highlights
|
|
148
|
-
- [PyScript plugin for Acode](https://
|
|
147
|
+
## Highlights 🎨
|
|
148
|
+
- [PyScript plugin for Acode (Ace Editor)](https://github.com/azzammuhyala/pyscript/releases/download/v1.13.1/plugin.zip)
|
|
149
149
|
- [PyScript nano for Linux](https://github.com/azzammuhyala/pyscript/tree/main/highlight/nano)
|
|
150
150
|
- [PyScript extension for VSCode](https://marketplace.visualstudio.com/items?itemName=azzammuhyala.pyslang)
|
|
151
151
|
|
|
152
|
-
## Behind
|
|
152
|
+
## Behind It 🕰️
|
|
153
153
|
This language created from based up on a
|
|
154
154
|
[YouTube tutorial](https://www.youtube.com/playlist?list=PLZQftyCk7_SdoVexSmwy_tBgs7P0b97yD) (check more on GitHub
|
|
155
155
|
[here](https://github.com/davidcallanan/py-myopl-code) by **@davidcallanan**). At least, it takes about 6 months to
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<img src="https://img.shields.io/badge/license-MIT-orange" alt="License MIT">
|
|
11
11
|
</a>
|
|
12
12
|
<a href="https://www.python.org/">
|
|
13
|
-
<img src="https://img.shields.io/badge/python-3.10
|
|
13
|
+
<img src="https://img.shields.io/badge/python-3.10+-yellow" alt="Python 3.10+">
|
|
14
14
|
</a>
|
|
15
15
|
</div>
|
|
16
16
|
|
|
@@ -112,12 +112,12 @@ Familiar? There it is!
|
|
|
112
112
|
import it.
|
|
113
113
|
- **optional**: Not required, but if it is present, some features can be used without issue.
|
|
114
114
|
|
|
115
|
-
## Highlights
|
|
116
|
-
- [PyScript plugin for Acode](https://
|
|
115
|
+
## Highlights 🎨
|
|
116
|
+
- [PyScript plugin for Acode (Ace Editor)](https://github.com/azzammuhyala/pyscript/releases/download/v1.13.1/plugin.zip)
|
|
117
117
|
- [PyScript nano for Linux](https://github.com/azzammuhyala/pyscript/tree/main/highlight/nano)
|
|
118
118
|
- [PyScript extension for VSCode](https://marketplace.visualstudio.com/items?itemName=azzammuhyala.pyslang)
|
|
119
119
|
|
|
120
|
-
## Behind
|
|
120
|
+
## Behind It 🕰️
|
|
121
121
|
This language created from based up on a
|
|
122
122
|
[YouTube tutorial](https://www.youtube.com/playlist?list=PLZQftyCk7_SdoVexSmwy_tBgs7P0b97yD) (check more on GitHub
|
|
123
123
|
[here](https://github.com/davidcallanan/py-myopl-code) by **@davidcallanan**). At least, it takes about 6 months to
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Change Logs
|
|
2
|
+
|
|
3
|
+
## [1.13.1] - 16/05/2026
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- `__builtins__` is available in the module namespace.
|
|
7
|
+
- The editor can save multiple configurations.
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
- Changed the order of `instanceof` operation.
|
|
11
|
+
- Fixed some bugs.
|
|
12
|
+
- _etc._
|
{pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyproject.toml
RENAMED
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "pyscript-programming-language"
|
|
7
|
-
version = "1.13.
|
|
7
|
+
version = "1.13.1"
|
|
8
8
|
description = "PyScript Programming Language"
|
|
9
9
|
readme = { file = "README.md", content-type = "text/markdown" }
|
|
10
10
|
requires-python = ">=3.10"
|
{pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/__main__.py
RENAMED
|
@@ -255,8 +255,8 @@ def clean_up() -> None:
|
|
|
255
255
|
g = globals()
|
|
256
256
|
|
|
257
257
|
for name in {
|
|
258
|
-
'ArgumentParser', 'BBCodeFormatter', 'CLASSIC_LINE_SHELL', 'DEBUG', 'DEFAULT', '
|
|
259
|
-
'
|
|
258
|
+
'ArgumentParser', 'BBCodeFormatter', 'CLASSIC_LINE_SHELL', 'DEBUG', 'DEFAULT', 'EDITOR_MAP',
|
|
259
|
+
'ENV_PYSCRIPT_CLASSIC_LINE_SHELL', 'ENV_PYSCRIPT_NO_COLOR_PROMPT', 'FORMATER_HIGHLIGHT_MAP',
|
|
260
260
|
'FORMATER_PYGMENTS_MAP', 'GUI_SUPPORT', 'HLFMT_ANSI', 'HLFMT_BBCODE', 'HLFMT_HTML', 'HtmlFormatter',
|
|
261
261
|
'LatexFormatter', 'NOTEBOOK', 'NO_COLOR', 'NO_COLOR_PROMPT', 'OPTIONAL', 'PYGMENTS', 'PygmentsPyScriptLexer',
|
|
262
262
|
'PygmentsPyScriptStyle', 'PysFileBuffer', 'PysGUIEditor', 'PysTerminalEditor', 'REMAINDER', 'TERMINAL_SUPPORT',
|
|
@@ -295,7 +295,6 @@ def load_file(path) -> PysFileBuffer:
|
|
|
295
295
|
def execute(file: PysFileBuffer) -> None:
|
|
296
296
|
global code
|
|
297
297
|
|
|
298
|
-
not_show_banner_flag = DONT_SHOW_BANNER_ON_SHELL
|
|
299
298
|
inspect = args.inspect
|
|
300
299
|
symtab = _namespace_to_symbol_table(undefined, file)
|
|
301
300
|
|
|
@@ -319,7 +318,7 @@ def execute(file: PysFileBuffer) -> None:
|
|
|
319
318
|
else:
|
|
320
319
|
code = pys_shell(
|
|
321
320
|
globals=result.context.symbol_table,
|
|
322
|
-
flags=result.context.flags |
|
|
321
|
+
flags=result.context.flags | DONT_SHOW_BANNER_ON_SHELL,
|
|
323
322
|
parser_flags=result.parser_flags
|
|
324
323
|
)
|
|
325
324
|
|
{pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/core/cache.py
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from .bases import Pys
|
|
2
|
-
from .constants import PYSCRIPT_PATH, CORE_PATH, LIBRARIES_PATH, SITE_PACKAGES_PATH, DEFAULT
|
|
2
|
+
from .constants import PYSCRIPT_PATH, CORE_PATH, LIBRARIES_PATH, SITE_PACKAGES_PATH, CONFIGURATIONS_PATH, DEFAULT
|
|
3
3
|
from .utils.debug import print_display, print_traceback, clear_shell
|
|
4
4
|
from .utils.decorators import inheritable, singleton
|
|
5
5
|
from .utils.path import base
|
|
@@ -31,6 +31,7 @@ pys_sys.pyscript_path = PYSCRIPT_PATH
|
|
|
31
31
|
pys_sys.core_path = CORE_PATH
|
|
32
32
|
pys_sys.libraries_path = LIBRARIES_PATH
|
|
33
33
|
pys_sys.site_packages_path = SITE_PACKAGES_PATH
|
|
34
|
+
pys_sys.configurations_path = CONFIGURATIONS_PATH
|
|
34
35
|
pys_sys.executable = f'{base(sys.executable)} -m pyscript'
|
|
35
36
|
pys_sys.ps1 = '>>> '
|
|
36
37
|
pys_sys.ps2 = '... '
|
|
@@ -7,7 +7,7 @@ OTHER_PATH = os.path.join(PYSCRIPT_PATH, 'other')
|
|
|
7
7
|
SITE_PACKAGES_PATH = os.path.join(PYSCRIPT_PATH, 'site-packages')
|
|
8
8
|
ICON_PATH = os.path.join(OTHER_PATH, 'PyScript.ico')
|
|
9
9
|
GLOBAL_HISTORY_PATH = os.path.join(os.path.expanduser('~'), '.pyscript_history')
|
|
10
|
-
|
|
10
|
+
CONFIGURATIONS_PATH = os.path.join(OTHER_PATH, 'configurations.json')
|
|
11
11
|
|
|
12
12
|
ENV_PYSCRIPT_NO_EXCEPTHOOK = 'PYSCRIPT_NO_EXCEPTHOOK'
|
|
13
13
|
ENV_PYSCRIPT_NO_GIL = 'PYSCRIPT_NO_GIL'
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
from ..bases import Pys
|
|
2
|
+
from ..buffer import PysFileBuffer
|
|
3
|
+
from ..constants import CONFIGURATIONS_PATH
|
|
4
|
+
from ..utils.decorators import typecheck, inheritable
|
|
5
|
+
from ..utils.generic import setimuattr
|
|
6
|
+
from ..utils.string import normstr
|
|
7
|
+
|
|
8
|
+
from json import dump, load
|
|
9
|
+
from typing import Any
|
|
10
|
+
|
|
11
|
+
import os
|
|
12
|
+
|
|
13
|
+
class PysEditor(Pys):
|
|
14
|
+
|
|
15
|
+
@typecheck
|
|
16
|
+
def __init__(self, file: PysFileBuffer, colored: bool = True) -> None:
|
|
17
|
+
self.file = file
|
|
18
|
+
self.colored = bool(colored)
|
|
19
|
+
self.basename = os.path.basename(self.file.name)
|
|
20
|
+
self.used = False
|
|
21
|
+
self.modified = False
|
|
22
|
+
|
|
23
|
+
def __init_subclass__(cls, **kwargs) -> None:
|
|
24
|
+
super().__init_subclass__(**kwargs)
|
|
25
|
+
inheritable(cls)
|
|
26
|
+
|
|
27
|
+
def load_configuration(self) -> None:
|
|
28
|
+
try:
|
|
29
|
+
with open(CONFIGURATIONS_PATH, 'r', encoding='utf-8') as file:
|
|
30
|
+
result = load(file)
|
|
31
|
+
if not isinstance(result, dict):
|
|
32
|
+
raise ValueError
|
|
33
|
+
for key in result:
|
|
34
|
+
if not isinstance(key, str):
|
|
35
|
+
raise ValueError
|
|
36
|
+
self.configurations = result
|
|
37
|
+
except:
|
|
38
|
+
self.configurations = {}
|
|
39
|
+
|
|
40
|
+
def get_configuration(self, configuration: str, default: Any) -> Any:
|
|
41
|
+
if configuration in self.configurations:
|
|
42
|
+
return self.configurations[configuration]
|
|
43
|
+
self.configurations[configuration] = default
|
|
44
|
+
return default
|
|
45
|
+
|
|
46
|
+
def set_configuration(self, configuration: str, value: Any) -> None:
|
|
47
|
+
self.configurations[configuration] = value
|
|
48
|
+
|
|
49
|
+
def save_configuration(self) -> None:
|
|
50
|
+
try:
|
|
51
|
+
with open(CONFIGURATIONS_PATH, 'w', encoding='utf-8') as file:
|
|
52
|
+
dump(self.configurations, file, separators=(',', ':'))
|
|
53
|
+
except:
|
|
54
|
+
pass
|
|
55
|
+
|
|
56
|
+
def save(self, text) -> None:
|
|
57
|
+
try:
|
|
58
|
+
text = normstr(text)
|
|
59
|
+
with open(self.file.name, 'w', encoding='utf-8') as file:
|
|
60
|
+
file.write(text)
|
|
61
|
+
setimuattr(self.file, 'text', text)
|
|
62
|
+
except:
|
|
63
|
+
pass
|
|
64
|
+
else:
|
|
65
|
+
self.modified = False
|
|
66
|
+
|
|
67
|
+
def run(self) -> None:
|
|
68
|
+
if self.used:
|
|
69
|
+
raise RuntimeError("one application object can only be used once")
|
|
70
|
+
self.used = True
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
from .bases import PysEditor
|
|
2
2
|
from ..buffer import PysFileBuffer
|
|
3
|
-
from ..constants import
|
|
3
|
+
from ..constants import ICON_PATH
|
|
4
4
|
from ..highlight import PygmentsPyScriptStyle, PygmentsPyScriptLexer
|
|
5
|
+
from ..utils.generic import boundary
|
|
5
6
|
from ..version import __version__
|
|
6
7
|
|
|
7
|
-
import re
|
|
8
|
-
|
|
9
8
|
try:
|
|
10
9
|
from tkinter import Tk, Scrollbar, Text, messagebox
|
|
11
10
|
from tkinter.font import Font
|
|
@@ -16,6 +15,8 @@ try:
|
|
|
16
15
|
PysEditor.__init__(self, file, colored)
|
|
17
16
|
Tk.__init__(self)
|
|
18
17
|
|
|
18
|
+
self.load_configuration()
|
|
19
|
+
|
|
19
20
|
def on_save(event=None):
|
|
20
21
|
text = self.text.get('1.0', 'end')
|
|
21
22
|
self.save(text[:-1] if text.endswith(('\r\n', '\r', '\n')) else text)
|
|
@@ -27,15 +28,24 @@ try:
|
|
|
27
28
|
answer = messagebox.askyesnocancel('Unsaved changes', 'File has been modified. Save before exit?')
|
|
28
29
|
if answer is True:
|
|
29
30
|
on_save()
|
|
31
|
+
self.save_configuration()
|
|
30
32
|
self.destroy()
|
|
31
33
|
elif answer is False:
|
|
34
|
+
self.save_configuration()
|
|
32
35
|
self.destroy()
|
|
33
36
|
else:
|
|
37
|
+
self.save_configuration()
|
|
34
38
|
self.destroy()
|
|
35
39
|
|
|
36
40
|
def on_configure(event):
|
|
37
41
|
if event.widget == self:
|
|
38
|
-
|
|
42
|
+
zoom = self.wm_state() == 'zoomed'
|
|
43
|
+
self.set_configuration('zoom', zoom)
|
|
44
|
+
if not zoom:
|
|
45
|
+
self.set_configuration(
|
|
46
|
+
'gui-geometry',
|
|
47
|
+
f'{event.width}x{event.height}+{event.x}+{event.y}'
|
|
48
|
+
)
|
|
39
49
|
|
|
40
50
|
def on_modified(event=None):
|
|
41
51
|
text = self.text
|
|
@@ -44,18 +54,19 @@ try:
|
|
|
44
54
|
update()
|
|
45
55
|
text.edit_modified(False)
|
|
46
56
|
|
|
47
|
-
def on_change_font(value
|
|
57
|
+
def on_change_font(value):
|
|
48
58
|
def wrapper(event=None):
|
|
49
59
|
font = self.font
|
|
50
|
-
size = font.cget('size')
|
|
51
|
-
|
|
52
|
-
|
|
60
|
+
size = boundary(font.cget('size') + value, 1, 127)
|
|
61
|
+
font.config(size=size)
|
|
62
|
+
self.set_configuration('gui-size-font', size)
|
|
53
63
|
return 'break'
|
|
54
64
|
return wrapper
|
|
55
65
|
|
|
56
66
|
def on_toggle_wrap(event=None):
|
|
57
|
-
|
|
58
|
-
self.text.configure(wrap='char' if
|
|
67
|
+
wrap = self.text.cget('wrap') != 'char'
|
|
68
|
+
self.text.configure(wrap='char' if wrap else 'none')
|
|
69
|
+
self.set_configuration('wrap', wrap)
|
|
59
70
|
return 'break'
|
|
60
71
|
|
|
61
72
|
def on_page_up(event=None):
|
|
@@ -76,27 +87,17 @@ try:
|
|
|
76
87
|
text.insert('insert', '\n' + line[:len(line) - len(line.lstrip())])
|
|
77
88
|
return 'break'
|
|
78
89
|
|
|
79
|
-
def save_geometry(left, top, width, height, zoom):
|
|
80
|
-
try:
|
|
81
|
-
with open(GUI_GEOMETRY_PATH, 'w') as f:
|
|
82
|
-
zoom = bool(zoom)
|
|
83
|
-
if not zoom:
|
|
84
|
-
self.last_geometry = f'{width}x{height}+{left}+{top}'
|
|
85
|
-
f.write(f'{self.last_geometry},{int(zoom)}')
|
|
86
|
-
except:
|
|
87
|
-
pass
|
|
88
|
-
|
|
89
90
|
self.lexer = PygmentsPyScriptLexer()
|
|
90
|
-
self.font = Font(family='Consolas', size=10)
|
|
91
|
+
self.font = Font(family='Consolas', size=boundary(self.get_configuration('gui-size-font', 10), 1, 127))
|
|
91
92
|
self.scrollbar = Scrollbar(self)
|
|
92
93
|
self.text = Text(
|
|
93
94
|
self,
|
|
94
95
|
undo=True,
|
|
95
96
|
width=120,
|
|
96
97
|
font=self.font,
|
|
97
|
-
wrap='char',
|
|
98
|
-
bg='#
|
|
99
|
-
fg='#
|
|
98
|
+
wrap='char' if self.get_configuration('wrap', True) else 'none',
|
|
99
|
+
bg='#000000',
|
|
100
|
+
fg='#ffffff',
|
|
100
101
|
insertbackground='white',
|
|
101
102
|
yscrollcommand=self.scrollbar.set
|
|
102
103
|
)
|
|
@@ -119,34 +120,26 @@ try:
|
|
|
119
120
|
self.bind_all('<Control-s>', on_save)
|
|
120
121
|
self.bind_all('<Control-W>', on_toggle_wrap)
|
|
121
122
|
self.bind_all('<Control-w>', on_toggle_wrap)
|
|
122
|
-
self.bind_all('<Control-minus>', on_change_font(-1
|
|
123
|
-
self.bind_all('<Control-underscore>', on_change_font(-5
|
|
124
|
-
self.bind_all('<Control-equal>', on_change_font(1
|
|
125
|
-
self.bind_all('<Control-plus>', on_change_font(5
|
|
126
|
-
|
|
127
|
-
try:
|
|
128
|
-
with open(GUI_GEOMETRY_PATH, 'r') as f:
|
|
129
|
-
width, height, left, top, zoom = map(
|
|
130
|
-
int,
|
|
131
|
-
re.match(r'(\d{1,7})x(\d{1,7})\+(-?\d{1,7})\+(-?\d{1,7}),(0|1)', f.read(64)).groups()
|
|
132
|
-
)
|
|
133
|
-
self.last_geometry = f'{width}x{height}+{left}+{top}'
|
|
134
|
-
except:
|
|
135
|
-
left = self.winfo_screenwidth() // 2 - 250
|
|
136
|
-
top = self.winfo_screenheight() // 2 - 250
|
|
137
|
-
zoom = False
|
|
138
|
-
self.last_geometry = f'500x500+{left}+{top}'
|
|
139
|
-
save_geometry(left, top, 500, 500, zoom)
|
|
123
|
+
self.bind_all('<Control-minus>', on_change_font(-1))
|
|
124
|
+
self.bind_all('<Control-underscore>', on_change_font(-5))
|
|
125
|
+
self.bind_all('<Control-equal>', on_change_font(1))
|
|
126
|
+
self.bind_all('<Control-plus>', on_change_font(5))
|
|
140
127
|
|
|
141
128
|
try:
|
|
142
129
|
self.wm_iconbitmap(ICON_PATH)
|
|
143
130
|
except:
|
|
144
131
|
pass
|
|
145
132
|
|
|
146
|
-
if zoom:
|
|
133
|
+
if self.get_configuration('zoom', False):
|
|
147
134
|
self.wm_state('zoomed')
|
|
148
135
|
|
|
149
|
-
self.wm_geometry(
|
|
136
|
+
self.wm_geometry(
|
|
137
|
+
self.get_configuration(
|
|
138
|
+
'gui-geometry',
|
|
139
|
+
f'500x500+{self.winfo_screenwidth() // 2 - 250}+{self.winfo_screenheight() // 2 - 250}'
|
|
140
|
+
)
|
|
141
|
+
)
|
|
142
|
+
|
|
150
143
|
self.wm_minsize(300, 250)
|
|
151
144
|
self.wm_protocol('WM_DELETE_WINDOW', on_close)
|
|
152
145
|
|
|
@@ -22,11 +22,13 @@ try:
|
|
|
22
22
|
def __init__(self, file: PysFileBuffer, colored: bool = True) -> None:
|
|
23
23
|
PysEditor.__init__(self, file, colored)
|
|
24
24
|
|
|
25
|
+
self.load_configuration()
|
|
26
|
+
|
|
25
27
|
self.show_exit_window = False
|
|
26
28
|
|
|
27
29
|
on_edit = Condition(lambda: not self.show_exit_window)
|
|
28
30
|
on_exit = Condition(lambda: self.show_exit_window)
|
|
29
|
-
on_wrap = Condition(lambda: self.
|
|
31
|
+
on_wrap = Condition(lambda: self.get_configuration('wrap', True))
|
|
30
32
|
|
|
31
33
|
def on_change(buffer):
|
|
32
34
|
self.modified = True
|
|
@@ -125,7 +127,7 @@ try:
|
|
|
125
127
|
|
|
126
128
|
@key_bindings.add('c-w', filter=on_edit, eager=True)
|
|
127
129
|
def _(event):
|
|
128
|
-
self.
|
|
130
|
+
self.set_configuration('wrap', not self.get_configuration('wrap', False))
|
|
129
131
|
|
|
130
132
|
@key_bindings.add('c-y', filter=on_edit, eager=True)
|
|
131
133
|
def _(event):
|
|
@@ -147,17 +149,20 @@ try:
|
|
|
147
149
|
self.output.hide_cursor()
|
|
148
150
|
self.layout.focus(self.close_window)
|
|
149
151
|
else:
|
|
152
|
+
self.save_configuration()
|
|
150
153
|
self.exit()
|
|
151
154
|
|
|
152
155
|
@key_bindings.add('y', filter=on_exit)
|
|
153
156
|
def _(event):
|
|
154
157
|
self.save(self.text.buffer.text)
|
|
155
158
|
self.show_exit_window = False
|
|
159
|
+
self.save_configuration()
|
|
156
160
|
self.exit()
|
|
157
161
|
|
|
158
162
|
@key_bindings.add('n', filter=on_exit)
|
|
159
163
|
def _(event):
|
|
160
164
|
self.show_exit_window = False
|
|
165
|
+
self.save_configuration()
|
|
161
166
|
self.exit()
|
|
162
167
|
|
|
163
168
|
@key_bindings.add('c', filter=on_exit)
|
|
@@ -405,12 +405,15 @@ class PysParser(Pys):
|
|
|
405
405
|
)
|
|
406
406
|
|
|
407
407
|
return self.chain_operator(
|
|
408
|
-
self.
|
|
408
|
+
self.instanceof,
|
|
409
409
|
TOKENS['DOUBLE_EQUAL'], TOKENS['EQUAL_EXCLAMATION'], TOKENS['EQUAL_TILDE'], TOKENS['EXCLAMATION_TILDE'],
|
|
410
410
|
TOKENS['LESS_THAN'], TOKENS['GREATER_THAN'], TOKENS['EQUAL_LESS_THAN'], TOKENS['EQUAL_GREATER_THAN'],
|
|
411
411
|
TOKENS['LESS_THAN_GREATER_THAN']
|
|
412
412
|
)
|
|
413
413
|
|
|
414
|
+
def instanceof(self) -> PysParserResult:
|
|
415
|
+
return self.binary_operator(self.bitwise, (TOKENS['KEYWORD'], 'instanceof'), instanceof=True)
|
|
416
|
+
|
|
414
417
|
def bitwise(self) -> PysParserResult:
|
|
415
418
|
return self.binary_operator(
|
|
416
419
|
self.arithmetic,
|
|
@@ -481,7 +484,7 @@ class PysParser(Pys):
|
|
|
481
484
|
self.advance()
|
|
482
485
|
self.skip_expression(result)
|
|
483
486
|
|
|
484
|
-
node = result.register(self.
|
|
487
|
+
node = result.register(self.primary())
|
|
485
488
|
if result.error:
|
|
486
489
|
return result
|
|
487
490
|
|
|
@@ -493,7 +496,7 @@ class PysParser(Pys):
|
|
|
493
496
|
)
|
|
494
497
|
)
|
|
495
498
|
|
|
496
|
-
node = result.register(self.
|
|
499
|
+
node = result.register(self.primary())
|
|
497
500
|
if result.error:
|
|
498
501
|
return result
|
|
499
502
|
|
|
@@ -512,9 +515,6 @@ class PysParser(Pys):
|
|
|
512
515
|
|
|
513
516
|
return result.success(node)
|
|
514
517
|
|
|
515
|
-
def instanceof(self) -> PysParserResult:
|
|
516
|
-
return self.binary_operator(self.primary, (TOKENS['KEYWORD'], 'instanceof'), instanceof=True)
|
|
517
|
-
|
|
518
518
|
def primary(self) -> PysParserResult:
|
|
519
519
|
result = PysParserResult()
|
|
520
520
|
start = self.current_token.position.start
|
|
@@ -115,7 +115,7 @@ class PysHelper(PysPrinter):
|
|
|
115
115
|
if not (args or kwargs):
|
|
116
116
|
print(
|
|
117
117
|
"Welcome to the PyScript programming language! "
|
|
118
|
-
"This is the help utility directly to the Python help.\n\n"
|
|
118
|
+
"This is the help utility directly to the Python's help.\n\n"
|
|
119
119
|
"To get help on a specific object, type 'help(object)'.\n"
|
|
120
120
|
"To get the list of builtin functions, types, exceptions, and other objects, type 'help(\"builtins\")'."
|
|
121
121
|
)
|
|
@@ -85,7 +85,7 @@ def pys_runner(
|
|
|
85
85
|
error, and the context after execution.
|
|
86
86
|
"""
|
|
87
87
|
|
|
88
|
-
if (context_parent is None) != (context_parent_entry_position is None):
|
|
88
|
+
if TYPECHECK_STACK > 0 and (context_parent is None) != (context_parent_entry_position is None):
|
|
89
89
|
raise TypeError("context_parent and context_parent_entry_position both must be filled in")
|
|
90
90
|
|
|
91
91
|
context = PysContext(
|
|
@@ -103,14 +103,20 @@ def new_module_namespace(
|
|
|
103
103
|
module = ModuleType(kwargs['name'], kwargs.get('doc'))
|
|
104
104
|
setimuattr(symbol_table, 'symbols', module.__dict__)
|
|
105
105
|
setimuattr(symbol_table, 'builtins', dict_builtins)
|
|
106
|
+
symbol_table.set('__builtins__', pys_builtins)
|
|
106
107
|
symbol_table.set('__file__', kwargs['file'])
|
|
108
|
+
|
|
107
109
|
else:
|
|
108
110
|
module = None
|
|
109
|
-
builtins = dget(symbols, '__builtins__',
|
|
111
|
+
builtins = dget(symbols, '__builtins__', undefined)
|
|
110
112
|
setimuattr(symbol_table, 'symbols', symbols)
|
|
111
|
-
|
|
112
|
-
symbol_table, 'builtins',
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
if builtins is undefined:
|
|
114
|
+
setimuattr(symbol_table, 'builtins', dict_builtins)
|
|
115
|
+
symbol_table.set('__builtins__', dict_builtins)
|
|
116
|
+
else:
|
|
117
|
+
setimuattr(
|
|
118
|
+
symbol_table, 'builtins',
|
|
119
|
+
builtins if isinstance(builtins, dict) else getattr(builtins, '__dict__', dict_builtins)
|
|
120
|
+
)
|
|
115
121
|
|
|
116
122
|
return symbol_table, module
|
|
@@ -40,6 +40,9 @@ def get_sequence(object: Sequence, key: Any, default: Optional[Any] = None) -> A
|
|
|
40
40
|
except LookupError:
|
|
41
41
|
return default
|
|
42
42
|
|
|
43
|
+
def boundary(value: Any, min_value: Any, max_value: Any) -> Any:
|
|
44
|
+
return max(min_value, min(max_value, value))
|
|
45
|
+
|
|
43
46
|
def is_environ(key: str) -> bool:
|
|
44
47
|
return os.environ.get(key) is not None
|
|
45
48
|
|
|
@@ -6,8 +6,8 @@ from types import MappingProxyType
|
|
|
6
6
|
|
|
7
7
|
import re
|
|
8
8
|
|
|
9
|
-
__version__ = '1.13.
|
|
10
|
-
__date__ = '
|
|
9
|
+
__version__ = '1.13.1'
|
|
10
|
+
__date__ = '16 May 2026, 21:00 UTC+7'
|
|
11
11
|
__author__ = ('Azzam Muhyala',)
|
|
12
12
|
|
|
13
13
|
version = pys_sys.version = f'{__version__} ({__date__})'
|
|
@@ -4,6 +4,7 @@ from pyscript.core.nodes import (
|
|
|
4
4
|
PysNode, PysNumberNode, PysStringNode, PysKeywordNode, PysIdentifierNode, PysDictionaryNode, PysSetNode,
|
|
5
5
|
PysListNode, PysTupleNode, PysCallNode, PysUnaryOperatorNode, PysBinaryOperatorNode, PysEllipsisNode
|
|
6
6
|
)
|
|
7
|
+
from pyscript.core.position import PysPosition
|
|
7
8
|
from pyscript.core.pysbuiltins import pys_builtins
|
|
8
9
|
from pyscript.core.token import TOKENS, REVERSE_TOKENS
|
|
9
10
|
|
|
@@ -21,13 +22,11 @@ get_identifier = {
|
|
|
21
22
|
'nanj': pys_builtins.nanj
|
|
22
23
|
}.get
|
|
23
24
|
|
|
24
|
-
def _error(exception, position):
|
|
25
|
-
return
|
|
26
|
-
'
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
position.start_column
|
|
30
|
-
)
|
|
25
|
+
def _error(exception: type[BaseException] | BaseException, position: PysPosition) -> BaseException:
|
|
26
|
+
return (
|
|
27
|
+
exception(f'(ln {position.start_line}, col {position.start_column})')
|
|
28
|
+
if isinstance(exception, type) else
|
|
29
|
+
type(exception)(f'{exception} (ln {position.start_line}, col {position.start_column})')
|
|
31
30
|
)
|
|
32
31
|
|
|
33
32
|
def visit(node: PysNode) -> Any:
|
|
@@ -25,7 +25,7 @@ class BFInterpreter {
|
|
|
25
25
|
fin = fin ?? default_input
|
|
26
26
|
fout = fout ?? default_output
|
|
27
27
|
|
|
28
|
-
if (!
|
|
28
|
+
if (!(cells instanceof (int, type(none))))
|
|
29
29
|
throw TypeError("BFInterpreter() cells must be integer or none")
|
|
30
30
|
if (!callable(fin))
|
|
31
31
|
throw TypeError("BFInterpreter() fin must be callable")
|
|
@@ -174,7 +174,7 @@ class BFInterpreter {
|
|
|
174
174
|
|
|
175
175
|
case ',':
|
|
176
176
|
new = self.fin()
|
|
177
|
-
if (!(
|
|
177
|
+
if (!(new instanceof int && 0 <= new <= 255))
|
|
178
178
|
throw TypeError("BFInterpreter() fin must be returns unsigned 8-bit integer")
|
|
179
179
|
memory[pointer] = new
|
|
180
180
|
break
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import _pyscript
|
|
2
2
|
|
|
3
|
-
func iscontext(object) =>
|
|
4
|
-
func issymtab(object) =>
|
|
5
|
-
func istraceback(object) =>
|
|
6
|
-
func iscode(object) =>
|
|
7
|
-
func isfunction(object) =>
|
|
3
|
+
func iscontext(object) => object instanceof _pyscript.context.PysContext
|
|
4
|
+
func issymtab(object) => object instanceof _pyscript.symtab.PysSymbolTable
|
|
5
|
+
func istraceback(object) => object instanceof _pyscript.exceptions.PysTraceback
|
|
6
|
+
func iscode(object) => object instanceof _pyscript.pystypes.PysCode
|
|
7
|
+
func isfunction(object) => object instanceof _pyscript.pystypes.PysFunction
|
|
8
8
|
|
|
9
9
|
getcontext = _pyscript.pystypes.PysPythonFunction(func(context, position) => context)
|
|
10
10
|
getsymtab = _pyscript.pystypes.PysPythonFunction(func(context, position) => context.symbol_table)
|
|
@@ -4,11 +4,20 @@ import _pyscript # get a PyScript core module (pyscript.core)
|
|
|
4
4
|
func _error(traceback) {
|
|
5
5
|
exception = traceback.exception
|
|
6
6
|
position = traceback.position
|
|
7
|
-
return
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
return (
|
|
8
|
+
exception instanceof type ?
|
|
9
|
+
exception(
|
|
10
|
+
'(ln {}, col {})'.format(
|
|
11
|
+
position.start_line,
|
|
12
|
+
position.start_column
|
|
13
|
+
)
|
|
14
|
+
) :
|
|
15
|
+
type(exception)(
|
|
16
|
+
'{} (ln {}, col {})'.format(
|
|
17
|
+
exception,
|
|
18
|
+
position.start_line,
|
|
19
|
+
position.start_column
|
|
20
|
+
)
|
|
12
21
|
)
|
|
13
22
|
)
|
|
14
23
|
}
|
|
@@ -42,12 +51,12 @@ class Parser {
|
|
|
42
51
|
func __init__(self, source, flags=DEFAULT) {
|
|
43
52
|
|
|
44
53
|
# source is a list of tokens
|
|
45
|
-
if (
|
|
54
|
+
if (source instanceof tuple) {
|
|
46
55
|
if (!source)
|
|
47
56
|
throw ValueError("Parser(): source got empty tuple")
|
|
48
57
|
|
|
49
58
|
for (i, token of enumerate(source)) {
|
|
50
|
-
if (!
|
|
59
|
+
if (!(token instanceof _pyscript.token.PysToken))
|
|
51
60
|
throw TypeError("Parser(): source must be tuple of tokens")
|
|
52
61
|
if (token.type in (TOKENS['COMMENT'], TOKENS['NONE']))
|
|
53
62
|
throw ValueError("Parser(): source token with comment or none token is invalid")
|
|
@@ -58,7 +67,7 @@ class Parser {
|
|
|
58
67
|
}
|
|
59
68
|
|
|
60
69
|
# source is an AST
|
|
61
|
-
elif (
|
|
70
|
+
elif (source instanceof _pyscript.nodes.PysNode) {
|
|
62
71
|
file = source.position.file
|
|
63
72
|
compiled = 'ast'
|
|
64
73
|
}
|
|
@@ -69,7 +78,7 @@ class Parser {
|
|
|
69
78
|
compiled = 'none'
|
|
70
79
|
}
|
|
71
80
|
|
|
72
|
-
if (!
|
|
81
|
+
if (!(flags instanceof int))
|
|
73
82
|
throw TypeError("Parser(): flags must be integer")
|
|
74
83
|
|
|
75
84
|
_pyscript.utils.generic.setimuattr(self, 'source', source)
|
|
@@ -6,11 +6,11 @@ pyast = pyimport('ast')
|
|
|
6
6
|
indent = 2
|
|
7
7
|
|
|
8
8
|
sys.displayhook = func(value) {
|
|
9
|
-
if value is none
|
|
9
|
+
if (value is none)
|
|
10
10
|
return
|
|
11
|
-
elif
|
|
11
|
+
elif (value instanceof pyast.AST)
|
|
12
12
|
print(pyast.dump(value, indent=indent))
|
|
13
|
-
elif
|
|
13
|
+
elif (value instanceof ast.Node)
|
|
14
14
|
print(ast.dump(value, indent=indent))
|
|
15
15
|
else
|
|
16
16
|
pprint.pprint(value, indent=indent)
|
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
try {
|
|
2
2
|
file = open(pyimport('os').path.join(require('sys>pyscript_path'), 'this.py'), 'r')
|
|
3
|
-
local =
|
|
4
|
-
|
|
3
|
+
local = dict()
|
|
5
4
|
try {
|
|
6
|
-
pyimport('builtins').exec(file.read(),
|
|
5
|
+
pyimport('builtins').exec(file.read(), dict(), local)
|
|
7
6
|
s = local['s']
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
finally {
|
|
7
|
+
} finally {
|
|
11
8
|
file.close()
|
|
12
9
|
del file, local
|
|
13
10
|
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
catch {
|
|
17
|
-
s = "Uh, something is wrong!"
|
|
11
|
+
} catch {
|
|
12
|
+
s = "Ouh fuck! Something is wrong!"
|
|
18
13
|
print(s)
|
|
19
14
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
s = """PyScript - Azzam Muhyala
|
|
2
|
+
|
|
3
|
+
Work won't get done without that grind.
|
|
4
|
+
Digital snake is not as fast as California.
|
|
5
|
+
Big projects can happen with a tiny crew.
|
|
6
|
+
Too much yapping makes it hard to read.
|
|
7
|
+
If it works, don't touch it.
|
|
8
|
+
Optimization is key.
|
|
9
|
+
Copy and paste."""
|
|
10
|
+
|
|
11
|
+
print(s)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyscript-programming-language
|
|
3
|
-
Version: 1.13.
|
|
3
|
+
Version: 1.13.1
|
|
4
4
|
Summary: PyScript Programming Language
|
|
5
5
|
Home-page: https://azzammuhyala.github.io/pyscript
|
|
6
6
|
Author: Azzam Muhyala
|
|
@@ -42,7 +42,7 @@ Dynamic: requires-python
|
|
|
42
42
|
<img src="https://img.shields.io/badge/license-MIT-orange" alt="License MIT">
|
|
43
43
|
</a>
|
|
44
44
|
<a href="https://www.python.org/">
|
|
45
|
-
<img src="https://img.shields.io/badge/python-3.10
|
|
45
|
+
<img src="https://img.shields.io/badge/python-3.10+-yellow" alt="Python 3.10+">
|
|
46
46
|
</a>
|
|
47
47
|
</div>
|
|
48
48
|
|
|
@@ -144,12 +144,12 @@ Familiar? There it is!
|
|
|
144
144
|
import it.
|
|
145
145
|
- **optional**: Not required, but if it is present, some features can be used without issue.
|
|
146
146
|
|
|
147
|
-
## Highlights
|
|
148
|
-
- [PyScript plugin for Acode](https://
|
|
147
|
+
## Highlights 🎨
|
|
148
|
+
- [PyScript plugin for Acode (Ace Editor)](https://github.com/azzammuhyala/pyscript/releases/download/v1.13.1/plugin.zip)
|
|
149
149
|
- [PyScript nano for Linux](https://github.com/azzammuhyala/pyscript/tree/main/highlight/nano)
|
|
150
150
|
- [PyScript extension for VSCode](https://marketplace.visualstudio.com/items?itemName=azzammuhyala.pyslang)
|
|
151
151
|
|
|
152
|
-
## Behind
|
|
152
|
+
## Behind It 🕰️
|
|
153
153
|
This language created from based up on a
|
|
154
154
|
[YouTube tutorial](https://www.youtube.com/playlist?list=PLZQftyCk7_SdoVexSmwy_tBgs7P0b97yD) (check more on GitHub
|
|
155
155
|
[here](https://github.com/davidcallanan/py-myopl-code) by **@davidcallanan**). At least, it takes about 6 months to
|
|
@@ -9,7 +9,7 @@ with open('./README.md', 'r', encoding='utf-8') as file:
|
|
|
9
9
|
|
|
10
10
|
setup(
|
|
11
11
|
name='pyscript-programming-language',
|
|
12
|
-
version='1.13.
|
|
12
|
+
version='1.13.1',
|
|
13
13
|
description='PyScript Programming Language',
|
|
14
14
|
long_description=long_description,
|
|
15
15
|
long_description_content_type='text/markdown',
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
# Change Logs
|
|
2
|
-
|
|
3
|
-
## [1.13.0] - 14/05/2026
|
|
4
|
-
|
|
5
|
-
### Added
|
|
6
|
-
- The `else` keyword is used in `match` as an alias for the `default` keyword.
|
|
7
|
-
- The `pyscript.core.pystypes.PysPythonFunction` passes two parameters, `context` and `position`, instead of passing one
|
|
8
|
-
parameter to itself.
|
|
9
|
-
- In the symbol table object, `__builtins__` has its own namespace named `builtins`.
|
|
10
|
-
- Direct deletion of the global namespace with the `/clean` command. This allows the _Python Garbage Collector_ to
|
|
11
|
-
immediately delete all objects in that namespace.
|
|
12
|
-
- A single statement will directly provide that single node instead of providing a
|
|
13
|
-
`pyscript.core.nodes.PysStatementsNode`.
|
|
14
|
-
- A new mechanism for getting built-in module import functions in `import` and `from` statements.
|
|
15
|
-
- The keywords `in`, `is`, `and`, `or`, `not`, and `typeof` are not available in `PysToken` (new token types).
|
|
16
|
-
- The `instanceof` keyword (same as the built-in `isinstance()` function).
|
|
17
|
-
- _etc._
|
|
18
|
-
|
|
19
|
-
### Fixed
|
|
20
|
-
- Add word boundary `'\b'` to number regex.
|
|
21
|
-
- Add of information in the parser in the form of rows and columns.
|
|
22
|
-
- Fixed some bugs.
|
|
23
|
-
- _etc._
|
|
24
|
-
|
|
25
|
-
### Deleted
|
|
26
|
-
- `pyscript.core.mapping.EMPTY_MAP`.
|
|
27
|
-
- _etc._
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
from ..bases import Pys
|
|
2
|
-
from ..buffer import PysFileBuffer
|
|
3
|
-
from ..utils.decorators import typecheck, inheritable
|
|
4
|
-
from ..utils.generic import setimuattr
|
|
5
|
-
from ..utils.string import normstr
|
|
6
|
-
|
|
7
|
-
import os
|
|
8
|
-
|
|
9
|
-
class PysEditor(Pys):
|
|
10
|
-
|
|
11
|
-
@typecheck
|
|
12
|
-
def __init__(self, file: PysFileBuffer, colored: bool = True) -> None:
|
|
13
|
-
self.file = file
|
|
14
|
-
self.colored = bool(colored)
|
|
15
|
-
self.used = False
|
|
16
|
-
self.modified = False
|
|
17
|
-
self.wrapped = True
|
|
18
|
-
self.basename = os.path.basename(self.file.name)
|
|
19
|
-
|
|
20
|
-
def __init_subclass__(cls, **kwargs) -> None:
|
|
21
|
-
super().__init_subclass__(**kwargs)
|
|
22
|
-
inheritable(cls)
|
|
23
|
-
|
|
24
|
-
def save(self, text) -> None:
|
|
25
|
-
try:
|
|
26
|
-
text = normstr(text)
|
|
27
|
-
with open(self.file.name, 'w', encoding='utf-8') as file:
|
|
28
|
-
file.write(text)
|
|
29
|
-
setimuattr(self.file, 'text', text)
|
|
30
|
-
except:
|
|
31
|
-
pass
|
|
32
|
-
else:
|
|
33
|
-
self.modified = False
|
|
34
|
-
|
|
35
|
-
def run(self) -> None:
|
|
36
|
-
if self.used:
|
|
37
|
-
raise RuntimeError("one application object can only be used once")
|
|
38
|
-
self.used = True
|
|
File without changes
|
{pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/__init__.py
RENAMED
|
File without changes
|
{pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/__init__.pyi
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/core/bases.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/core/lexer.py
RENAMED
|
File without changes
|
|
File without changes
|
{pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/core/nodes.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/core/shell.py
RENAMED
|
File without changes
|
{pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/core/token.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/lib/ansi.pys
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/lib/code.pys
RENAMED
|
File without changes
|
{pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/lib/dis.pys
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/lib/token.pys
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/other/credits
RENAMED
|
File without changes
|
{pyscript_programming_language-1.13.0 → pyscript_programming_language-1.13.1}/pyscript/other/license
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|