pyscript-programming-language 1.5.0__tar.gz → 1.6.0__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.6.0/MANIFEST.in +3 -0
- {pyscript_programming_language-1.5.0/pyscript_programming_language.egg-info → pyscript_programming_language-1.6.0}/PKG-INFO +23 -3
- pyscript_programming_language-1.6.0/README.md +48 -0
- {pyscript_programming_language-1.5.0 → pyscript_programming_language-1.6.0}/pyscript/__init__.py +2 -1
- {pyscript_programming_language-1.5.0 → pyscript_programming_language-1.6.0}/pyscript/__init__.pyi +1 -0
- {pyscript_programming_language-1.5.0 → pyscript_programming_language-1.6.0}/pyscript/__main__.py +31 -45
- {pyscript_programming_language-1.5.0 → pyscript_programming_language-1.6.0}/pyscript/core/__init__.py +4 -2
- {pyscript_programming_language-1.5.0 → pyscript_programming_language-1.6.0}/pyscript/core/analyzer.py +167 -119
- pyscript_programming_language-1.6.0/pyscript/core/buffer.py +34 -0
- {pyscript_programming_language-1.5.0 → pyscript_programming_language-1.6.0}/pyscript/core/cache.py +11 -15
- pyscript_programming_language-1.6.0/pyscript/core/checks.py +51 -0
- pyscript_programming_language-1.6.0/pyscript/core/constants.py +142 -0
- {pyscript_programming_language-1.5.0 → pyscript_programming_language-1.6.0}/pyscript/core/context.py +1 -1
- {pyscript_programming_language-1.5.0 → pyscript_programming_language-1.6.0}/pyscript/core/exceptions.py +16 -11
- pyscript_programming_language-1.6.0/pyscript/core/handlers.py +117 -0
- {pyscript_programming_language-1.5.0 → pyscript_programming_language-1.6.0}/pyscript/core/highlight.py +24 -22
- {pyscript_programming_language-1.5.0 → pyscript_programming_language-1.6.0}/pyscript/core/interpreter.py +592 -462
- {pyscript_programming_language-1.5.0 → pyscript_programming_language-1.6.0}/pyscript/core/lexer.py +113 -93
- pyscript_programming_language-1.6.0/pyscript/core/mapping.py +125 -0
- {pyscript_programming_language-1.5.0 → pyscript_programming_language-1.6.0}/pyscript/core/nodes.py +150 -64
- {pyscript_programming_language-1.5.0 → pyscript_programming_language-1.6.0}/pyscript/core/objects.py +11 -44
- {pyscript_programming_language-1.5.0 → pyscript_programming_language-1.6.0}/pyscript/core/parser.py +489 -469
- {pyscript_programming_language-1.5.0 → pyscript_programming_language-1.6.0}/pyscript/core/position.py +13 -11
- {pyscript_programming_language-1.5.0 → pyscript_programming_language-1.6.0}/pyscript/core/pysbuiltins.py +144 -110
- {pyscript_programming_language-1.5.0 → pyscript_programming_language-1.6.0}/pyscript/core/runner.py +111 -96
- {pyscript_programming_language-1.5.0 → pyscript_programming_language-1.6.0}/pyscript/core/symtab.py +38 -34
- {pyscript_programming_language-1.5.0 → pyscript_programming_language-1.6.0}/pyscript/core/token.py +1 -1
- pyscript_programming_language-1.6.0/pyscript/core/utils/__init__.py +21 -0
- pyscript_programming_language-1.6.0/pyscript/core/utils/ansi.py +37 -0
- {pyscript_programming_language-1.5.0 → pyscript_programming_language-1.6.0}/pyscript/core/utils/debug.py +7 -13
- {pyscript_programming_language-1.5.0 → pyscript_programming_language-1.6.0}/pyscript/core/utils/decorators.py +7 -7
- pyscript_programming_language-1.6.0/pyscript/core/utils/generic.py +34 -0
- pyscript_programming_language-1.6.0/pyscript/core/utils/module.py +25 -0
- pyscript_programming_language-1.6.0/pyscript/core/utils/path.py +26 -0
- pyscript_programming_language-1.6.0/pyscript/core/utils/similarity.py +22 -0
- pyscript_programming_language-1.6.0/pyscript/core/utils/string.py +40 -0
- pyscript_programming_language-1.6.0/pyscript/core/version.py +95 -0
- pyscript_programming_language-1.6.0/pyscript/lib/ast/__init__.pys +31 -0
- pyscript_programming_language-1.6.0/pyscript/lib/ast/ast_dump.py +406 -0
- pyscript_programming_language-1.6.0/pyscript/lib/ast/ast_unparse.py +554 -0
- pyscript_programming_language-1.6.0/pyscript/lib/ast/ast_walk.py +242 -0
- {pyscript_programming_language-1.5.0 → pyscript_programming_language-1.6.0}/pyscript/lib/brainfuck.pys +15 -10
- pyscript_programming_language-1.6.0/pyscript/lib/dis.pys +11 -0
- pyscript_programming_language-1.6.0/pyscript/lib/explorer.pys +225 -0
- pyscript_programming_language-1.6.0/pyscript/lib/fpstimer.pys +70 -0
- pyscript_programming_language-1.6.0/pyscript/lib/getch.pys +28 -0
- pyscript_programming_language-1.6.0/pyscript/lib/inspect.pys +42 -0
- pyscript_programming_language-1.6.0/pyscript/lib/jsdict.pys +34 -0
- pyscript_programming_language-1.6.0/pyscript/lib/keyword.pys +2 -0
- {pyscript_programming_language-1.5.0 → pyscript_programming_language-1.6.0}/pyscript/lib/parser.pys +82 -55
- pyscript_programming_language-1.6.0/pyscript/lib/site.pys +58 -0
- pyscript_programming_language-1.6.0/pyscript/lib/symtable.pys +5 -0
- pyscript_programming_language-1.6.0/pyscript/lib/sys.pys +25 -0
- {pyscript_programming_language-1.5.0 → pyscript_programming_language-1.6.0}/pyscript/lib/this.pys +1 -1
- pyscript_programming_language-1.6.0/pyscript/lib/token.pys +1 -0
- pyscript_programming_language-1.6.0/pyscript/lib/tokenize/__init__.pys +12 -0
- pyscript_programming_language-1.6.0/pyscript/lib/tokenize/tok_untokenize.py +85 -0
- pyscript_programming_language-1.6.0/pyscript/site-packages/67.pys +1 -0
- {pyscript_programming_language-1.5.0 → pyscript_programming_language-1.6.0/pyscript_programming_language.egg-info}/PKG-INFO +23 -3
- {pyscript_programming_language-1.5.0 → pyscript_programming_language-1.6.0}/pyscript_programming_language.egg-info/SOURCES.txt +23 -4
- {pyscript_programming_language-1.5.0 → pyscript_programming_language-1.6.0}/setup.py +1 -1
- pyscript_programming_language-1.5.0/MANIFEST.in +0 -3
- pyscript_programming_language-1.5.0/README.md +0 -28
- pyscript_programming_language-1.5.0/pyscript/core/buffer.py +0 -33
- pyscript_programming_language-1.5.0/pyscript/core/constants.py +0 -157
- pyscript_programming_language-1.5.0/pyscript/core/handlers.py +0 -82
- pyscript_programming_language-1.5.0/pyscript/core/utils/__init__.py +0 -13
- pyscript_programming_language-1.5.0/pyscript/core/utils/constants.py +0 -151
- pyscript_programming_language-1.5.0/pyscript/core/utils/general.py +0 -139
- pyscript_programming_language-1.5.0/pyscript/core/version.py +0 -36
- pyscript_programming_language-1.5.0/pyscript/lib/67.pys +0 -1
- pyscript_programming_language-1.5.0/pyscript/lib/clock.pys +0 -49
- pyscript_programming_language-1.5.0/pyscript/lib/getch.pys +0 -24
- pyscript_programming_language-1.5.0/pyscript/lib/jsdict.pys +0 -54
- pyscript_programming_language-1.5.0/pyscript/lib/sys.pys +0 -17
- {pyscript_programming_language-1.5.0 → pyscript_programming_language-1.6.0}/pyscript/core/bases.py +0 -0
- {pyscript_programming_language-1.5.0 → pyscript_programming_language-1.6.0}/pyscript/core/results.py +0 -0
- {pyscript_programming_language-1.5.0 → pyscript_programming_language-1.6.0}/pyscript/lib/__hello__.pys +0 -0
- {pyscript_programming_language-1.5.0 → pyscript_programming_language-1.6.0}/pyscript/this.py +0 -0
- {pyscript_programming_language-1.5.0 → pyscript_programming_language-1.6.0}/pyscript_programming_language.egg-info/dependency_links.txt +0 -0
- {pyscript_programming_language-1.5.0 → pyscript_programming_language-1.6.0}/pyscript_programming_language.egg-info/requires.txt +0 -0
- {pyscript_programming_language-1.5.0 → pyscript_programming_language-1.6.0}/pyscript_programming_language.egg-info/top_level.txt +0 -0
- {pyscript_programming_language-1.5.0 → pyscript_programming_language-1.6.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyscript-programming-language
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.6.0
|
|
4
4
|
Summary: PyScript Programming Language
|
|
5
5
|
Home-page: https://github.com/azzammuhyala/pyscript
|
|
6
6
|
Author: azzammuhyala
|
|
@@ -53,8 +53,28 @@ language was created as a relatively complex project. Using Python as the founda
|
|
|
53
53
|
understand syntax makes it easy to understand how the language is built without having to understand complex
|
|
54
54
|
instructions like those in C, C++, and other low-level languages.
|
|
55
55
|
|
|
56
|
-
To learn more about PyScript, you can see on [PyScript documentation
|
|
57
|
-
[PyScript repository](https://github.com/azzammuhyala/pyscript).
|
|
56
|
+
To learn more about PyScript, you can see on [PyScript documentation](https://azzammuhyala.github.io/pyscript) or
|
|
57
|
+
[PyScript repository](https://github.com/azzammuhyala/pyscript) for full source code.
|
|
58
|
+
|
|
59
|
+
## Installation
|
|
60
|
+
First, you'll need to download Python. Make sure you're using the latest version above `3.10`, to ensure the code runs
|
|
61
|
+
correctly. Visit the official [Python website](https://python.org) to download it.
|
|
62
|
+
|
|
63
|
+
Next, after downloading and configuring the Python application, you can download the PyScript interpreter from
|
|
64
|
+
[PyScript releases](https://github.com/azzammuhyala/pyscript/releases) or from Python Pip with this command
|
|
65
|
+
(_Recommended_):
|
|
66
|
+
```sh
|
|
67
|
+
python -m pip install -U pyscript-programming-language
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
After that, you can run the PyScript shell (_REPL_) with this command:
|
|
71
|
+
```sh
|
|
72
|
+
python -m pyscript
|
|
73
|
+
```
|
|
74
|
+
If successful, you can see the version, release date, and a `>>>` like Python shell (_REPL_).
|
|
75
|
+
|
|
76
|
+
## Syntax
|
|
77
|
+
<pre><span style="color:#C586C0">func</span><span style="color:#D4D4D4"> </span><span style="color:#DCDCAA">greet</span><span style="color:#FFD705">(</span><span style="color:#8CDCFE">name</span><span style="color:#FFD705">)</span><span style="color:#D4D4D4"> </span><span style="color:#FFD705">{</span><br><span style="color:#D4D4D4"> </span><span style="color:#DCDCAA">print</span><span style="color:#D45DBA">(</span><span style="color:#CE9178">"Hello, "</span><span style="color:#D4D4D4"> + </span><span style="color:#8CDCFE">name</span><span style="color:#D4D4D4">.</span><span style="color:#DCDCAA">title</span><span style="color:#1A9FFF">()</span><span style="color:#D4D4D4"> + </span><span style="color:#CE9178">"!"</span><span style="color:#D45DBA">)</span><br><span style="color:#FFD705">}</span><br><br><span style="color:#DCDCAA">greet</span><span style="color:#FFD705">(</span><span style="color:#CE9178">"charlie klik"</span><span style="color:#FFD705">)</span></pre>
|
|
58
78
|
|
|
59
79
|
## Behind it
|
|
60
80
|
This language created from based up on a
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# PyScript
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="https://github.com/azzammuhyala/pyscript/blob/main/PyScript.png?raw=true" alt="PyScript Logo" width="200">
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
PyScript is a simple programming language built on top of Python. It combines some syntax from Python and JavaScript,
|
|
8
|
+
so if you're already familiar with Python or JavaScript, or both, it should be quite easy to learn.
|
|
9
|
+
|
|
10
|
+
## Introduction PyScript
|
|
11
|
+
PyScript may not be the language we'll be discussing, but the name PyScript already exists, a flexible and platform for
|
|
12
|
+
running Python in a browser. Since it's inception, the language was inspired by Python and JavaScript, which are
|
|
13
|
+
relatively easy for humans to read. This name was chosen because it wasn't immediately known whether this name was
|
|
14
|
+
already in use.
|
|
15
|
+
|
|
16
|
+
This language wasn't designed to compete with other modern programming languages, but rather as a learning for
|
|
17
|
+
understanding how programming languages work and how human written code can be understood by machines. Furthermore, this
|
|
18
|
+
language was created as a relatively complex project. Using Python as the foundation for PyScript, it's easy to
|
|
19
|
+
understand syntax makes it easy to understand how the language is built without having to understand complex
|
|
20
|
+
instructions like those in C, C++, and other low-level languages.
|
|
21
|
+
|
|
22
|
+
To learn more about PyScript, you can see on [PyScript documentation](https://azzammuhyala.github.io/pyscript) or
|
|
23
|
+
[PyScript repository](https://github.com/azzammuhyala/pyscript) for full source code.
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
First, you'll need to download Python. Make sure you're using the latest version above `3.10`, to ensure the code runs
|
|
27
|
+
correctly. Visit the official [Python website](https://python.org) to download it.
|
|
28
|
+
|
|
29
|
+
Next, after downloading and configuring the Python application, you can download the PyScript interpreter from
|
|
30
|
+
[PyScript releases](https://github.com/azzammuhyala/pyscript/releases) or from Python Pip with this command
|
|
31
|
+
(_Recommended_):
|
|
32
|
+
```sh
|
|
33
|
+
python -m pip install -U pyscript-programming-language
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
After that, you can run the PyScript shell (_REPL_) with this command:
|
|
37
|
+
```sh
|
|
38
|
+
python -m pyscript
|
|
39
|
+
```
|
|
40
|
+
If successful, you can see the version, release date, and a `>>>` like Python shell (_REPL_).
|
|
41
|
+
|
|
42
|
+
## Syntax
|
|
43
|
+
<pre><span style="color:#C586C0">func</span><span style="color:#D4D4D4"> </span><span style="color:#DCDCAA">greet</span><span style="color:#FFD705">(</span><span style="color:#8CDCFE">name</span><span style="color:#FFD705">)</span><span style="color:#D4D4D4"> </span><span style="color:#FFD705">{</span><br><span style="color:#D4D4D4"> </span><span style="color:#DCDCAA">print</span><span style="color:#D45DBA">(</span><span style="color:#CE9178">"Hello, "</span><span style="color:#D4D4D4"> + </span><span style="color:#8CDCFE">name</span><span style="color:#D4D4D4">.</span><span style="color:#DCDCAA">title</span><span style="color:#1A9FFF">()</span><span style="color:#D4D4D4"> + </span><span style="color:#CE9178">"!"</span><span style="color:#D45DBA">)</span><br><span style="color:#FFD705">}</span><br><br><span style="color:#DCDCAA">greet</span><span style="color:#FFD705">(</span><span style="color:#CE9178">"charlie klik"</span><span style="color:#FFD705">)</span></pre>
|
|
44
|
+
|
|
45
|
+
## Behind it
|
|
46
|
+
This language created from based up on a
|
|
47
|
+
[YouTube tutorial](https://www.youtube.com/playlist?list=PLZQftyCk7_SdoVexSmwy_tBgs7P0b97yD). At least, it takes
|
|
48
|
+
about 6 months to learn it, and also need to learn general things that exist in other programming languages.
|
{pyscript_programming_language-1.5.0 → pyscript_programming_language-1.6.0}/pyscript/__init__.py
RENAMED
|
@@ -10,7 +10,7 @@ from . import core
|
|
|
10
10
|
|
|
11
11
|
from .core.constants import DEFAULT, DEBUG, SILENT, RETRES, COMMENT, NO_COLOR, REVERSE_POW_XOR
|
|
12
12
|
from .core.cache import undefined
|
|
13
|
-
from .core.highlight import HLFMT_HTML, HLFMT_ANSI, pys_highlight
|
|
13
|
+
from .core.highlight import HLFMT_HTML, HLFMT_ANSI, HLFMT_BBCODE, pys_highlight
|
|
14
14
|
from .core.runner import pys_exec, pys_eval, pys_shell
|
|
15
15
|
from .core.version import version_info, __version__, __date__
|
|
16
16
|
|
|
@@ -25,6 +25,7 @@ __all__ = (
|
|
|
25
25
|
'REVERSE_POW_XOR',
|
|
26
26
|
'HLFMT_HTML',
|
|
27
27
|
'HLFMT_ANSI',
|
|
28
|
+
'HLFMT_BBCODE',
|
|
28
29
|
'undefined',
|
|
29
30
|
'version_info',
|
|
30
31
|
'pys_highlight',
|
{pyscript_programming_language-1.5.0 → pyscript_programming_language-1.6.0}/pyscript/__main__.py
RENAMED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
from .core.buffer import PysFileBuffer
|
|
2
|
-
from .core.cache import undefined
|
|
2
|
+
from .core.cache import path, undefined
|
|
3
3
|
from .core.constants import DEFAULT, DEBUG, NO_COLOR
|
|
4
4
|
from .core.handlers import handle_execute
|
|
5
|
-
from .core.highlight import HLFMT_HTML, HLFMT_ANSI, pys_highlight
|
|
5
|
+
from .core.highlight import HLFMT_HTML, HLFMT_ANSI, HLFMT_BBCODE, pys_highlight
|
|
6
6
|
from .core.runner import pys_runner, pys_shell
|
|
7
|
-
from .core.symtab import
|
|
8
|
-
from .core.utils.
|
|
7
|
+
from .core.symtab import new_symbol_table
|
|
8
|
+
from .core.utils.module import get_module_name_from_path, set_python_path
|
|
9
|
+
from .core.utils.path import getcwd, normpath
|
|
9
10
|
from .core.version import __version__
|
|
10
11
|
|
|
11
12
|
from argparse import ArgumentParser
|
|
12
|
-
|
|
13
|
-
from sys import executable, version_info, exit, setrecursionlimit
|
|
14
|
-
from os.path import basename, splitext
|
|
13
|
+
from sys import executable, stderr, version_info, exit, setrecursionlimit
|
|
15
14
|
|
|
16
15
|
parser = ArgumentParser(
|
|
17
|
-
prog=
|
|
16
|
+
prog=get_module_name_from_path(executable) + ' -m pyscript',
|
|
18
17
|
description='PyScript Launcher for Python Version ' + '.'.join(map(str, version_info))
|
|
19
18
|
)
|
|
20
19
|
|
|
@@ -53,7 +52,7 @@ parser.add_argument(
|
|
|
53
52
|
|
|
54
53
|
parser.add_argument(
|
|
55
54
|
'-l', '--highlight',
|
|
56
|
-
choices=('html', 'ansi'),
|
|
55
|
+
choices=('html', 'ansi', 'bbcode'),
|
|
57
56
|
default=None,
|
|
58
57
|
help='generate PyScript highlight code from a file'
|
|
59
58
|
)
|
|
@@ -71,16 +70,20 @@ parser.add_argument(
|
|
|
71
70
|
help="set a python recursion limit"
|
|
72
71
|
)
|
|
73
72
|
|
|
73
|
+
def argument_error(argument, message):
|
|
74
|
+
parser.print_usage(stderr)
|
|
75
|
+
parser.exit(2, f"{parser.prog}: error: argument {argument}: {message}\n")
|
|
76
|
+
|
|
74
77
|
args = parser.parse_args()
|
|
75
78
|
|
|
76
79
|
if args.highlight and args.file is None:
|
|
77
|
-
|
|
80
|
+
argument_error("-l/--highlight", "file path require")
|
|
78
81
|
|
|
79
82
|
if args.py_recursion is not None:
|
|
80
83
|
try:
|
|
81
84
|
setrecursionlimit(args.py_recursion)
|
|
82
85
|
except BaseException as e:
|
|
83
|
-
|
|
86
|
+
argument_error("-r/--py-recursion", e)
|
|
84
87
|
|
|
85
88
|
code = 0
|
|
86
89
|
flags = DEFAULT
|
|
@@ -90,83 +93,66 @@ if args.debug:
|
|
|
90
93
|
if args.no_color:
|
|
91
94
|
flags |= NO_COLOR
|
|
92
95
|
|
|
96
|
+
set_python_path(getcwd())
|
|
97
|
+
|
|
93
98
|
if args.file is not None:
|
|
94
|
-
path =
|
|
99
|
+
path = normpath(args.file)
|
|
95
100
|
|
|
96
101
|
try:
|
|
97
|
-
with open(path, 'r') as file:
|
|
102
|
+
with open(path, 'r', encoding='utf-8') as file:
|
|
98
103
|
file = PysFileBuffer(file, path)
|
|
99
|
-
|
|
100
104
|
except FileNotFoundError:
|
|
101
105
|
parser.error(f"can't open file {path!r}: No such file or directory")
|
|
102
|
-
|
|
103
106
|
except PermissionError:
|
|
104
107
|
parser.error(f"can't open file {path!r}: Permission denied.")
|
|
105
|
-
|
|
106
108
|
except IsADirectoryError:
|
|
107
109
|
parser.error(f"can't open file {path!r}: Path is not a file.")
|
|
108
|
-
|
|
109
110
|
except NotADirectoryError:
|
|
110
111
|
parser.error(f"can't open file {path!r}: Attempting to access directory from file.")
|
|
111
|
-
|
|
112
112
|
except (OSError, IOError):
|
|
113
113
|
parser.error(f"can't open file {path!r}: Attempting to access a system directory or file.")
|
|
114
|
-
|
|
115
114
|
except UnicodeDecodeError:
|
|
116
115
|
parser.error(f"can't read file {path!r}: Bad file.")
|
|
117
|
-
|
|
118
116
|
except BaseException as e:
|
|
119
117
|
parser.error(f"file {path!r}: Unexpected error: {e}")
|
|
120
118
|
|
|
121
119
|
if args.highlight:
|
|
120
|
+
format_map = {
|
|
121
|
+
'html': HLFMT_HTML,
|
|
122
|
+
'ansi': HLFMT_ANSI,
|
|
123
|
+
'bbcode': HLFMT_BBCODE
|
|
124
|
+
}
|
|
125
|
+
|
|
122
126
|
try:
|
|
123
|
-
print(
|
|
124
|
-
pys_highlight(
|
|
125
|
-
file,
|
|
126
|
-
HLFMT_HTML if args.highlight == 'html' else HLFMT_ANSI
|
|
127
|
-
)
|
|
128
|
-
)
|
|
127
|
+
print(pys_highlight(file, format_map[args.highlight]))
|
|
129
128
|
except BaseException as e:
|
|
130
129
|
parser.error(f"file {path!r}: Tokenize error: {e}")
|
|
131
130
|
|
|
132
131
|
else:
|
|
133
|
-
symtab = build_symbol_table(file)
|
|
134
|
-
symtab.set('__name__', '__main__')
|
|
135
|
-
|
|
136
132
|
result = pys_runner(
|
|
137
133
|
file=file,
|
|
138
134
|
mode='exec',
|
|
139
|
-
symbol_table=
|
|
135
|
+
symbol_table=new_symbol_table(file=file.name, name='__main__')[0],
|
|
140
136
|
flags=flags
|
|
141
137
|
)
|
|
142
138
|
|
|
143
|
-
code = handle_execute(result)
|
|
144
|
-
|
|
145
139
|
if args.inspect:
|
|
146
|
-
code = pys_shell(
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
)
|
|
140
|
+
code = pys_shell(result.context.symbol_table, result.context.flags)
|
|
141
|
+
else:
|
|
142
|
+
code = handle_execute(result)
|
|
150
143
|
|
|
151
144
|
elif args.command is not None:
|
|
152
145
|
file = PysFileBuffer(args.command)
|
|
153
|
-
|
|
154
|
-
symtab = build_symbol_table(file)
|
|
155
|
-
symtab.set('__name__', '__main__')
|
|
156
|
-
|
|
157
146
|
code = handle_execute(
|
|
158
147
|
pys_runner(
|
|
159
148
|
file=file,
|
|
160
149
|
mode='exec',
|
|
161
|
-
symbol_table=
|
|
150
|
+
symbol_table=new_symbol_table(file=file.name, name='__main__')[0],
|
|
162
151
|
flags=flags
|
|
163
152
|
)
|
|
164
153
|
)
|
|
165
154
|
|
|
166
155
|
else:
|
|
167
|
-
code = pys_shell(
|
|
168
|
-
globals=undefined,
|
|
169
|
-
flags=flags
|
|
170
|
-
)
|
|
156
|
+
code = pys_shell(undefined, flags)
|
|
171
157
|
|
|
172
158
|
exit(code)
|
|
@@ -7,6 +7,7 @@ from . import (
|
|
|
7
7
|
bases,
|
|
8
8
|
buffer,
|
|
9
9
|
cache,
|
|
10
|
+
checks,
|
|
10
11
|
constants,
|
|
11
12
|
context,
|
|
12
13
|
exceptions,
|
|
@@ -14,6 +15,7 @@ from . import (
|
|
|
14
15
|
highlight,
|
|
15
16
|
interpreter,
|
|
16
17
|
lexer,
|
|
18
|
+
mapping,
|
|
17
19
|
nodes,
|
|
18
20
|
objects,
|
|
19
21
|
parser,
|
|
@@ -32,14 +34,15 @@ __all__ = (
|
|
|
32
34
|
'bases',
|
|
33
35
|
'buffer',
|
|
34
36
|
'cache',
|
|
37
|
+
'checks',
|
|
35
38
|
'constants',
|
|
36
39
|
'context',
|
|
37
40
|
'exceptions',
|
|
38
41
|
'handlers',
|
|
39
42
|
'highlight',
|
|
40
|
-
'immutables',
|
|
41
43
|
'interpreter',
|
|
42
44
|
'lexer',
|
|
45
|
+
'mapping',
|
|
43
46
|
'nodes',
|
|
44
47
|
'objects',
|
|
45
48
|
'parser',
|
|
@@ -47,7 +50,6 @@ __all__ = (
|
|
|
47
50
|
'pysbuiltins',
|
|
48
51
|
'results',
|
|
49
52
|
'runner',
|
|
50
|
-
'singletons',
|
|
51
53
|
'symtab',
|
|
52
54
|
'token',
|
|
53
55
|
'utils',
|