pyscript-programming-language 1.12.9__tar.gz → 1.12.10__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.
Files changed (92) hide show
  1. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/PKG-INFO +5 -5
  2. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/README.md +3 -4
  3. pyscript_programming_language-1.12.10/changelog.md +20 -0
  4. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyproject.toml +2 -1
  5. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/__main__.py +21 -21
  6. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/core/__init__.py +2 -2
  7. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/core/analyzer.py +24 -16
  8. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/core/checks.py +18 -12
  9. pyscript_programming_language-1.12.10/pyscript/core/constants.py +43 -0
  10. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/core/editor/bases.py +2 -2
  11. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/core/exceptions.py +4 -4
  12. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/core/handlers.py +1 -1
  13. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/core/highlight.py +16 -14
  14. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/core/interpreter.py +24 -26
  15. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/core/lexer.py +9 -5
  16. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/core/mapping.py +11 -9
  17. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/core/nodes.py +42 -40
  18. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/core/parser.py +15 -14
  19. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/core/position.py +7 -7
  20. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/core/pysbuiltins.py +12 -11
  21. pyscript_programming_language-1.12.9/pyscript/core/objects.py → pyscript_programming_language-1.12.10/pyscript/core/pystypes.py +38 -1
  22. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/core/runner.py +15 -11
  23. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/core/shell.py +26 -14
  24. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/core/symtab.py +5 -5
  25. pyscript_programming_language-1.12.9/pyscript/core/constants.py → pyscript_programming_language-1.12.10/pyscript/core/token.py +40 -54
  26. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/core/utils/__init__.py +0 -2
  27. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/core/utils/debug.py +1 -0
  28. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/core/utils/decorators.py +14 -12
  29. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/core/utils/module.py +2 -2
  30. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/core/version.py +2 -2
  31. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/lib/ast/ast_literal_eval.py +10 -16
  32. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/lib/ast/ast_unparse.py +1 -1
  33. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/lib/fpstimer/py_fpstimer.py +0 -5
  34. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/lib/history.pys +0 -1
  35. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/lib/inspect.pys +4 -4
  36. pyscript_programming_language-1.12.10/pyscript/lib/jsdict.pys +5 -0
  37. pyscript_programming_language-1.12.10/pyscript/lib/opcode.pys +1 -0
  38. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/lib/parser.pys +5 -5
  39. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/lib/tokenize/tok_untokenize.py +1 -2
  40. pyscript_programming_language-1.12.10/pyscript/other/PyScript.ico +0 -0
  41. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript_programming_language.egg-info/PKG-INFO +5 -5
  42. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript_programming_language.egg-info/SOURCES.txt +2 -2
  43. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/setup.py +3 -2
  44. pyscript_programming_language-1.12.9/changelog.md +0 -11
  45. pyscript_programming_language-1.12.9/pyscript/core/token.py +0 -25
  46. pyscript_programming_language-1.12.9/pyscript/core/utils/jsdict.py +0 -32
  47. pyscript_programming_language-1.12.9/pyscript/lib/jsdict.pys +0 -5
  48. pyscript_programming_language-1.12.9/pyscript/other/PyScript.ico +0 -0
  49. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/MANIFEST.in +0 -0
  50. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/__init__.py +0 -0
  51. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/__init__.pyi +0 -0
  52. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/core/bases.py +0 -0
  53. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/core/buffer.py +0 -0
  54. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/core/cache.py +0 -0
  55. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/core/context.py +0 -0
  56. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/core/editor/__init__.py +0 -0
  57. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/core/editor/gui.py +0 -0
  58. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/core/editor/terminal.py +0 -0
  59. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/core/results.py +0 -0
  60. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/core/utils/ansi.py +0 -0
  61. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/core/utils/generic.py +0 -0
  62. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/core/utils/path.py +0 -0
  63. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/core/utils/similarity.py +0 -0
  64. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/core/utils/string.py +0 -0
  65. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/lib/__hello__.pys +0 -0
  66. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/lib/ansi.pys +0 -0
  67. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/lib/ast/__init__.pys +0 -0
  68. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/lib/ast/ast_dump.py +0 -0
  69. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/lib/ast/ast_walk.py +0 -0
  70. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/lib/brainfuck.pys +0 -0
  71. /pyscript_programming_language-1.12.9/pyscript/lib/opcode.pys → /pyscript_programming_language-1.12.10/pyscript/lib/code.pys +0 -0
  72. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/lib/dis.pys +0 -0
  73. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/lib/explorer.pys +0 -0
  74. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/lib/fpstimer/__init__.pys +0 -0
  75. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/lib/getch/__init__.pys +0 -0
  76. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/lib/getch/py_getch.py +0 -0
  77. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/lib/keyword.pys +0 -0
  78. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/lib/pdisplay.pys +0 -0
  79. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/lib/site.pys +0 -0
  80. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/lib/symtable.pys +0 -0
  81. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/lib/token.pys +0 -0
  82. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/lib/tokenize/__init__.pys +0 -0
  83. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/other/.nomedia +0 -0
  84. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/other/copyright +0 -0
  85. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/other/credits +0 -0
  86. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/other/license +0 -0
  87. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/site-packages/this.pys +0 -0
  88. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript/this.py +0 -0
  89. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript_programming_language.egg-info/dependency_links.txt +0 -0
  90. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript_programming_language.egg-info/requires.txt +0 -0
  91. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/pyscript_programming_language.egg-info/top_level.txt +0 -0
  92. {pyscript_programming_language-1.12.9 → pyscript_programming_language-1.12.10}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyscript-programming-language
3
- Version: 1.12.9
3
+ Version: 1.12.10
4
4
  Summary: PyScript Programming Language
5
5
  Home-page: https://azzammuhyala.github.io/pyscript
6
6
  Author: azzammuhyala
@@ -9,6 +9,7 @@ License-Expression: MIT
9
9
  Project-URL: Homepage, https://azzammuhyala.github.io/pyscript
10
10
  Project-URL: Source, https://github.com/azzammuhyala/pyscript
11
11
  Project-URL: Bug Tracker, https://github.com/azzammuhyala/pyscript/issues
12
+ Project-URL: Change Log, https://github.com/azzammuhyala/pyscript/blob/main/changelog.md
12
13
  Keywords: pyscript,pyslang,pys,programming,language,programming language
13
14
  Classifier: Programming Language :: Python
14
15
  Classifier: Programming Language :: Python :: 3
@@ -32,8 +33,8 @@ Dynamic: requires-python
32
33
  <img src="https://github.com/azzammuhyala/pyscript/blob/main/PyScript.png?raw=true" alt="PyScript Logo" width="200">
33
34
  </div>
34
35
 
35
- PyScript is a simple programming language built on top of Python. It combines some syntax from Python and JavaScript,
36
- so if you're already familiar with Python, JavaScript or both, it should be quite easy to learn.
36
+ PyScript is a programming language built on top of Python. It combines some syntax from Python and JavaScript, so if
37
+ you're already familiar with Python, JavaScript or both, it should be quite easy to learn.
37
38
 
38
39
  ## Introduction 📖
39
40
  PyScript may not be the language we'll be discussing, but the name PyScript already exists, a flexible and platform for
@@ -55,8 +56,7 @@ First, you'll need to download Python. Make sure you're using the latest version
55
56
  correctly. Visit the official [Python website](https://python.org) to download it.
56
57
 
57
58
  Next, after downloading and configuring the Python application, you can download the PyScript from
58
- [PyScript releases](https://github.com/azzammuhyala/pyscript/releases) or from Python Pip with this command
59
- (_Recommended_):
59
+ [PyScript releases](https://github.com/azzammuhyala/pyscript/releases) or from PIP with this command (_Recommended_):
60
60
  ```sh
61
61
  pip install -U pyscript-programming-language
62
62
  ```
@@ -4,8 +4,8 @@
4
4
  <img src="https://github.com/azzammuhyala/pyscript/blob/main/PyScript.png?raw=true" alt="PyScript Logo" width="200">
5
5
  </div>
6
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, JavaScript or both, it should be quite easy to learn.
7
+ PyScript is a programming language built on top of Python. It combines some syntax from Python and JavaScript, so if
8
+ you're already familiar with Python, JavaScript or both, it should be quite easy to learn.
9
9
 
10
10
  ## Introduction 📖
11
11
  PyScript may not be the language we'll be discussing, but the name PyScript already exists, a flexible and platform for
@@ -27,8 +27,7 @@ First, you'll need to download Python. Make sure you're using the latest version
27
27
  correctly. Visit the official [Python website](https://python.org) to download it.
28
28
 
29
29
  Next, after downloading and configuring the Python application, you can download the PyScript from
30
- [PyScript releases](https://github.com/azzammuhyala/pyscript/releases) or from Python Pip with this command
31
- (_Recommended_):
30
+ [PyScript releases](https://github.com/azzammuhyala/pyscript/releases) or from PIP with this command (_Recommended_):
32
31
  ```sh
33
32
  pip install -U pyscript-programming-language
34
33
  ```
@@ -0,0 +1,20 @@
1
+ # Change Log
2
+
3
+ ## [1.12.10] - 08/04/2026
4
+
5
+ ### Added
6
+ - Operator `<>` (same as `!=`).
7
+ - Allows `PYSCRIPT_MAXIMUM_HISTORY_LINE` to be less than 5 or negative (does not have a maximum history line value).
8
+ - Builtins `infj` and `nanj`.
9
+ - _etc._
10
+
11
+ ### Fixed
12
+ - Fixed some bugs.
13
+ - Change file name from `pyscript.core.objects` to `pyscript.core.pystypes`.
14
+ - New PyScript logo.
15
+ - _etc._
16
+
17
+ ### Removed
18
+ - Builtins `infinity`, `Infinity`, `nonanumber`, `NaN`, `NotANumber`, and `ellipsis`.
19
+ - Keywords `def` and `define`.
20
+ - _etc._
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "pyscript-programming-language"
7
- version = "1.12.9"
7
+ version = "1.12.10"
8
8
  description = "PyScript Programming Language"
9
9
  readme = { file = "README.md", content-type = "text/markdown" }
10
10
  requires-python = ">=3.10"
@@ -36,6 +36,7 @@ classifiers = [
36
36
  Homepage = "https://azzammuhyala.github.io/pyscript"
37
37
  Source = "https://github.com/azzammuhyala/pyscript"
38
38
  "Bug Tracker" = "https://github.com/azzammuhyala/pyscript/issues"
39
+ "Change Log" = "https://github.com/azzammuhyala/pyscript/blob/main/changelog.md"
39
40
 
40
41
  [project.optional-dependencies]
41
42
  other = [
@@ -23,7 +23,7 @@ if PYGMENTS:
23
23
  Terminal256Formatter
24
24
  )
25
25
 
26
- FORMAT_PYGMENTS_MAP = {
26
+ FORMATER_PYGMENTS_MAP = {
27
27
  'pm-bbcode': BBCodeFormatter,
28
28
  'pm-html': HtmlFormatter,
29
29
  'pm-latex': LatexFormatter,
@@ -36,7 +36,7 @@ from argparse import OPTIONAL, REMAINDER, ArgumentParser
36
36
 
37
37
  import sys
38
38
 
39
- FORMAT_HIGHLIGHT_MAP = {
39
+ FORMATER_HIGHLIGHT_MAP = {
40
40
  'html': HLFMT_HTML,
41
41
  'ansi': HLFMT_ANSI,
42
42
  'bbcode': HLFMT_BBCODE
@@ -66,13 +66,13 @@ parser.add_argument(
66
66
  '-c', '--command',
67
67
  type=str,
68
68
  default=None,
69
- help="Execute program from a string argument",
69
+ help="execute program from a string argument",
70
70
  )
71
71
 
72
72
  parser.add_argument(
73
73
  '-d', '-O', '--debug',
74
74
  action='store_true',
75
- help="Set a debug flag, this will ignore assert statement. Check the flag is active with the __debug__ keyword"
75
+ help="set a debug flag, this will ignore assert statement. Check the flag is active with the __debug__ keyword"
76
76
  )
77
77
 
78
78
  if EDITOR_MAP:
@@ -80,57 +80,57 @@ if EDITOR_MAP:
80
80
  '-e', '--editor',
81
81
  choices=tuple(EDITOR_MAP.keys()),
82
82
  default=None,
83
- help="Open the editor panel from a 'file'",
83
+ help="open the editor panel from a 'file'",
84
84
  )
85
85
 
86
86
  parser.add_argument(
87
87
  '-i', '--inspect',
88
88
  action='store_true',
89
- help="Inspect interactively after running a code",
89
+ help="inspect interactively after running a code",
90
90
  )
91
91
 
92
92
  parser.add_argument(
93
93
  '-k', '--classic-line-shell',
94
94
  action='store_true',
95
- help="Use a classic command line shell"
95
+ help="use a classic command line shell"
96
96
  )
97
97
 
98
98
  parser.add_argument(
99
99
  '-l', '--highlight',
100
- choices=tuple(FORMAT_HIGHLIGHT_MAP.keys()) + tuple(FORMAT_PYGMENTS_MAP.keys() if PYGMENTS else ()),
100
+ choices=tuple(FORMATER_HIGHLIGHT_MAP.keys()) + tuple(FORMATER_PYGMENTS_MAP.keys() if PYGMENTS else ()),
101
101
  default=None,
102
- help="Generate highlight code from a 'file'"
102
+ help="generate highlight code from a 'file'"
103
103
  )
104
104
 
105
105
  parser.add_argument(
106
106
  '-n', '--no-color',
107
107
  action='store_true',
108
- help="Suppress colored output"
108
+ help="suppress colored output"
109
109
  )
110
110
 
111
111
  parser.add_argument(
112
112
  '-p', '--no-color-prompt',
113
113
  action='store_true',
114
- help="Suppress colored prompt output"
114
+ help="suppress colored prompt output"
115
115
  )
116
116
 
117
117
  parser.add_argument(
118
118
  '-r', '--py-recursion',
119
119
  type=int,
120
120
  default=None,
121
- help="Set a Python recursion limit"
121
+ help="set a Python recursion limit"
122
122
  )
123
123
 
124
124
  parser.add_argument(
125
125
  '-t', '--terminal',
126
126
  action='store_true',
127
- help="Configure terminal encoding to UTF-8 and enable ANSI escape code processing on Windows"
127
+ help="configure terminal encoding to UTF-8 and enable ANSI escape code processing on Windows"
128
128
  )
129
129
 
130
130
  parser.add_argument(
131
131
  '-q',
132
132
  action='store_true',
133
- help="Don't print version and copyright messages on interactive startup"
133
+ help="don't print version and copyright messages on interactive startup"
134
134
  )
135
135
 
136
136
  parser.add_argument(
@@ -142,7 +142,7 @@ parser.add_argument(
142
142
  parser.add_argument(
143
143
  '-P',
144
144
  action='store_true',
145
- help="Don't prepend a potentially unsafe path to sys.path (python sys.path)"
145
+ help="don't prepend a potentially unsafe path to sys.path (python sys.path)"
146
146
  )
147
147
 
148
148
  parser.add_argument(
@@ -150,13 +150,13 @@ parser.add_argument(
150
150
  type=str,
151
151
  nargs=OPTIONAL,
152
152
  default=None,
153
- help="File path to be executed"
153
+ help="file path to be executed"
154
154
  )
155
155
 
156
156
  parser.add_argument(
157
157
  'arg',
158
158
  nargs=REMAINDER,
159
- help="Remaining arguments stored in pys_sys.argv (pyscript sys.argv)"
159
+ help="remaining arguments stored in pys_sys.argv (pyscript sys.argv)"
160
160
  )
161
161
 
162
162
  def argument_error(argument, message):
@@ -281,11 +281,11 @@ if args.file is not None:
281
281
 
282
282
  elif args.highlight:
283
283
  try:
284
- if args.highlight in FORMAT_HIGHLIGHT_MAP:
284
+ if args.highlight in FORMATER_HIGHLIGHT_MAP:
285
285
  print(
286
286
  pys_highlight(
287
287
  source=file,
288
- formatter=FORMAT_HIGHLIGHT_MAP[args.highlight]
288
+ formatter=FORMATER_HIGHLIGHT_MAP[args.highlight]
289
289
  )
290
290
  )
291
291
  else:
@@ -293,7 +293,7 @@ if args.file is not None:
293
293
  highlight(
294
294
  code=file.text,
295
295
  lexer=PygmentsPyScriptLexer(),
296
- formatter=FORMAT_PYGMENTS_MAP[args.highlight](style=PygmentsPyScriptStyle, full=True)
296
+ formatter=FORMATER_PYGMENTS_MAP[args.highlight](style=PygmentsPyScriptStyle, full=True)
297
297
  )
298
298
  )
299
299
  except BaseException as e:
@@ -354,5 +354,5 @@ else:
354
354
  flags=flags
355
355
  )
356
356
 
357
- # goodbye :>
357
+ # goodbye ;)
358
358
  sys.exit(code)
@@ -18,10 +18,10 @@ from . import (
18
18
  lexer,
19
19
  mapping,
20
20
  nodes,
21
- objects,
22
21
  parser,
23
22
  position,
24
23
  pysbuiltins,
24
+ pystypes,
25
25
  results,
26
26
  runner,
27
27
  shell,
@@ -47,10 +47,10 @@ __all__ = (
47
47
  'lexer',
48
48
  'mapping',
49
49
  'nodes',
50
- 'objects',
51
50
  'parser',
52
51
  'position',
53
52
  'pysbuiltins',
53
+ 'pystypes',
54
54
  'results',
55
55
  'runner',
56
56
  'shell',
@@ -1,17 +1,18 @@
1
1
  from .bases import Pys
2
- from .checks import is_list
3
- from .constants import TOKENS, DEFAULT
2
+ from .checks import is_sequence
3
+ from .constants import DEFAULT
4
4
  from .context import PysContext
5
5
  from .exceptions import PysTraceback
6
6
  from .nodes import *
7
7
  from .position import PysPosition
8
- from .utils.decorators import typechecked
8
+ from .token import TOKENS
9
+ from .utils.decorators import typecheck
9
10
 
10
11
  from typing import Optional
11
12
 
12
13
  class PysAnalyzer(Pys):
13
14
 
14
- @typechecked
15
+ @typecheck
15
16
  def __init__(
16
17
  self,
17
18
  node: PysNode,
@@ -25,7 +26,7 @@ class PysAnalyzer(Pys):
25
26
  self.context_parent = context_parent
26
27
  self.context_parent_entry_position = context_parent_entry_position
27
28
 
28
- @typechecked
29
+ @typecheck
29
30
  def analyze(self) -> PysTraceback | None:
30
31
  self.in_loop = 0
31
32
  self.in_function = 0
@@ -92,7 +93,7 @@ class PysAnalyzer(Pys):
92
93
  if self.error:
93
94
  return
94
95
 
95
- self.visit_slice_SubscriptNode(node.slice)
96
+ self.visit_slice_from_SubscriptNode(node.slice)
96
97
 
97
98
  def visit_CallNode(self, node: PysCallNode) -> None:
98
99
  self.visit(node.target)
@@ -159,7 +160,7 @@ class PysAnalyzer(Pys):
159
160
 
160
161
  def visit_IncrementalNode(self, node: PysIncrementalNode) -> None:
161
162
  operator = 'increase' if node.operand.type == TOKENS['DOUBLE_PLUS'] else 'decrease'
162
- self.visit_declaration_AssignmentNode(node.target, f"cannot {operator} literal", operator)
163
+ self.visit_declaration_from_AssignmentNode(node.target, f"cannot {operator} literal", operator)
163
164
 
164
165
  def visit_StatementsNode(self, node: PysStatementsNode) -> None:
165
166
  for element in node.body:
@@ -168,7 +169,7 @@ class PysAnalyzer(Pys):
168
169
  return
169
170
 
170
171
  def visit_AssignmentNode(self, node: PysAssignmentNode) -> None:
171
- self.visit_declaration_AssignmentNode(
172
+ self.visit_declaration_from_AssignmentNode(
172
173
  node.target,
173
174
  "cannot assign to expression here. Maybe you meant '==' instead of '='?"
174
175
  )
@@ -261,7 +262,7 @@ class PysAnalyzer(Pys):
261
262
  if len(node.header) == 2:
262
263
  declaration, iteration = node.header
263
264
 
264
- self.visit_declaration_AssignmentNode(declaration, "cannot assign to expression")
265
+ self.visit_declaration_from_AssignmentNode(declaration, "cannot assign to expression")
265
266
  if self.error:
266
267
  return
267
268
 
@@ -459,7 +460,7 @@ class PysAnalyzer(Pys):
459
460
  if self.error:
460
461
  return
461
462
 
462
- self.visit_slice_SubscriptNode(target.slice)
463
+ self.visit_slice_from_SubscriptNode(target.slice)
463
464
  if self.error:
464
465
  return
465
466
 
@@ -467,6 +468,10 @@ class PysAnalyzer(Pys):
467
468
  self.throw(f"cannot delete {target.name.value}", target.position)
468
469
  return
469
470
 
471
+ elif type is PysDebugNode:
472
+ self.throw("cannot delete to __debug__", node.position)
473
+ return
474
+
470
475
  elif type is not PysIdentifierNode:
471
476
  self.throw("cannot delete literal", target.position)
472
477
  return
@@ -479,7 +484,7 @@ class PysAnalyzer(Pys):
479
484
  if self.in_loop == 0 and self.in_switch == 0:
480
485
  self.throw("break outside of loop or switch case", node.position)
481
486
 
482
- def visit_slice_SubscriptNode(self, node: PysNode | slice | tuple[PysNode | slice, ...]) -> None:
487
+ def visit_slice_from_SubscriptNode(self, node: PysNode | slice | tuple[PysNode | slice, ...]) -> None:
483
488
  type = node.__class__
484
489
 
485
490
  if type is slice:
@@ -500,14 +505,14 @@ class PysAnalyzer(Pys):
500
505
 
501
506
  elif type is tuple:
502
507
  for element in node:
503
- self.visit_slice_SubscriptNode(element)
508
+ self.visit_slice_from_SubscriptNode(element)
504
509
  if self.error:
505
510
  return
506
511
 
507
512
  else:
508
513
  self.visit(node)
509
514
 
510
- def visit_declaration_AssignmentNode(
515
+ def visit_declaration_from_AssignmentNode(
511
516
  self,
512
517
  node: PysIdentifierNode | PysAttributeNode | PysSubscriptNode | PysSetNode | PysListNode | PysTupleNode,
513
518
  message: str,
@@ -524,16 +529,19 @@ class PysAnalyzer(Pys):
524
529
  if self.error:
525
530
  return
526
531
 
527
- self.visit_slice_SubscriptNode(node.slice)
532
+ self.visit_slice_from_SubscriptNode(node.slice)
528
533
 
529
- elif is_list(type):
534
+ elif is_sequence(type):
530
535
  for element in node.elements:
531
- self.visit_declaration_AssignmentNode(element, message, operator_name)
536
+ self.visit_declaration_from_AssignmentNode(element, message, operator_name)
532
537
  if self.error:
533
538
  return
534
539
 
535
540
  elif type is PysKeywordNode:
536
541
  self.throw(f"cannot {operator_name} to {node.name.value}", node.position)
537
542
 
543
+ elif type is PysDebugNode:
544
+ self.throw(f"cannot {operator_name} to __debug__", node.position)
545
+
538
546
  elif type is not PysIdentifierNode:
539
547
  self.throw(message, node.position)
@@ -1,11 +1,13 @@
1
- from .constants import TOKENS, KEYWORDS, CONSTANT_KEYWORDS
1
+ from .constants import KEYWORDS, CONSTANT_KEYWORDS
2
2
  from .mapping import BRACKETS_MAP
3
3
  from .nodes import *
4
+ from .token import TOKENS
4
5
 
5
6
  is_expression = frozenset([
6
- PysNumberNode, PysStringNode, PysKeywordNode, PysIdentifierNode, PysDictionaryNode, PysSetNode, PysListNode,
7
- PysTupleNode, PysAttributeNode, PysSubscriptNode, PysCallNode, PysChainOperatorNode, PysTernaryOperatorNode,
8
- PysBinaryOperatorNode, PysUnaryOperatorNode, PysIncrementalNode, PysMatchNode, PysFunctionNode, PysEllipsisNode
7
+ PysNumberNode, PysStringNode, PysKeywordNode, PysDebugNode, PysIdentifierNode, PysDictionaryNode, PysSetNode,
8
+ PysListNode, PysTupleNode, PysAttributeNode, PysSubscriptNode, PysCallNode, PysChainOperatorNode,
9
+ PysTernaryOperatorNode, PysBinaryOperatorNode, PysUnaryOperatorNode, PysIncrementalNode, PysMatchNode,
10
+ PysFunctionNode, PysEllipsisNode
9
11
  ]).__contains__
10
12
 
11
13
  is_statement = frozenset([
@@ -14,26 +16,30 @@ is_statement = frozenset([
14
16
  PysAssertNode, PysDeleteNode, PysContinueNode, PysBreakNode
15
17
  ]).__contains__
16
18
 
17
- is_list = frozenset([
19
+ is_sequence = frozenset([
18
20
  PysSetNode, PysListNode, PysTupleNode
19
21
  ]).__contains__
20
22
 
21
- is_keyword = frozenset(KEYWORDS).__contains__
22
- is_constant_keywords = frozenset(CONSTANT_KEYWORDS).__contains__
23
+ is_constant = frozenset([
24
+ PysKeywordNode, PysDebugNode
25
+ ])
23
26
 
24
- is_python_extensions = frozenset([
25
- '.py', '.ipy', '.pyc', '.pyd', '.pyi', '.pyo', '.pyp', '.pyw', '.pyz', '.rpy', '.xpy', '.pyproj'
26
- ]).__contains__
27
+ is_keyword = frozenset(KEYWORDS).__contains__
28
+ is_constant_keyword = frozenset(CONSTANT_KEYWORDS).__contains__
27
29
 
28
- is_equals = frozenset([
30
+ is_equal = frozenset([
29
31
  TOKENS['EQUAL'], TOKENS['EQUAL_COLON']
30
32
  ]).__contains__
31
33
 
32
- is_blacklist_python_builtins = frozenset([
34
+ is_blacklist_python_builtin = frozenset([
33
35
  'IndentationError', 'TabError', 'breakpoint', 'compile', 'copyright', 'credits', 'dir', 'eval', 'exec', 'help',
34
36
  'globals', 'license', 'locals', 'vars'
35
37
  ]).__contains__
36
38
 
39
+ is_python_extension = frozenset([
40
+ '.py', '.ipy', '.pyc', '.pyd', '.pyi', '.pyo', '.pyp', '.pyw', '.pyz', '.rpy', '.xpy', '.pyproj'
41
+ ]).__contains__
42
+
37
43
  is_left_bracket = frozenset(BRACKETS_MAP.keys()).__contains__
38
44
  is_right_bracket = frozenset(BRACKETS_MAP.values()).__contains__
39
45
  is_bracket = frozenset(BRACKETS_MAP.keys() | BRACKETS_MAP.values()).__contains__
@@ -0,0 +1,43 @@
1
+ import os
2
+
3
+ PYSCRIPT_PATH = os.path.sep.join(__file__.split(os.path.sep)[:-2])
4
+ CORE_PATH = os.path.join(PYSCRIPT_PATH, 'core')
5
+ LIBRARIES_PATH = os.path.join(PYSCRIPT_PATH, 'lib')
6
+ OTHER_PATH = os.path.join(PYSCRIPT_PATH, 'other')
7
+ SITE_PACKAGES_PATH = os.path.join(PYSCRIPT_PATH, 'site-packages')
8
+ ICON_PATH = os.path.join(OTHER_PATH, 'PyScript.ico')
9
+
10
+ ENV_PYSCRIPT_NO_EXCEPTHOOK = 'PYSCRIPT_NO_EXCEPTHOOK'
11
+ ENV_PYSCRIPT_NO_GIL = 'PYSCRIPT_NO_GIL'
12
+ ENV_PYSCRIPT_NO_READLINE = 'PYSCRIPT_NO_READLINE'
13
+ ENV_PYSCRIPT_NO_TYPECHECK = 'PYSCRIPT_NO_TYPECHECK'
14
+ ENV_PYSCRIPT_NO_COLOR_PROMPT = 'PYSCRIPT_NO_COLOR_PROMPT'
15
+ ENV_PYSCRIPT_MAXIMUM_TRACEBACK_LINE = 'PYSCRIPT_MAXIMUM_TRACEBACK_LINE'
16
+ ENV_PYSCRIPT_CLASSIC_LINE_SHELL = 'PYSCRIPT_CLASSIC_LINE_SHELL'
17
+ ENV_PYSCRIPT_HISTORY_PATH = 'PYSCRIPT_HISTORY_PATH'
18
+ ENV_PYSCRIPT_MAXIMUM_HISTORY_LINE = 'PYSCRIPT_MAXIMUM_HISTORY_LINE'
19
+
20
+ KEYWORDS = (
21
+ '__debug__', 'False', 'None', 'True', 'and', 'as', 'assert', 'break', 'case', 'catch', 'class', 'constructor',
22
+ 'continue', 'default', 'del', 'delete', 'do', 'elif', 'else', 'elseif', 'except', 'extends', 'false', 'finally',
23
+ 'for', 'from', 'func', 'function', 'global', 'if', 'import', 'in', 'is', 'match', 'nil', 'none', 'null', 'not',
24
+ 'true', 'typeof', 'of', 'or', 'raise', 'repeat', 'return', 'switch', 'throw', 'try', 'until', 'while', 'with'
25
+ )
26
+
27
+ CONSTANT_KEYWORDS = (
28
+ '__debug__', 'False', 'None', 'True', 'and', 'class', 'constructor', 'extends', 'func', 'function', 'false',
29
+ 'global', 'in', 'is', 'not', 'nil', 'none', 'null', 'of', 'or', 'true', 'typeof'
30
+ )
31
+
32
+ DEFAULT = 0
33
+ NO_COLOR = 1 << 0
34
+ DEBUG = 1 << 1
35
+ SILENT = 1 << 2
36
+ RETURN_RESULT = 1 << 3
37
+ DONT_SHOW_BANNER_ON_SHELL = 1 << 4
38
+ CLASSIC_LINE_SHELL = 1 << 5
39
+ NO_COLOR_PROMPT = 1 << 6
40
+ NOTEBOOK = CLASSIC_LINE_SHELL | NO_COLOR_PROMPT
41
+
42
+ LEXER_HIGHLIGHT = 1 << 0
43
+ DICT_TO_JSDICT = 1 << 1
@@ -1,6 +1,6 @@
1
1
  from ..bases import Pys
2
2
  from ..buffer import PysFileBuffer
3
- from ..utils.decorators import typechecked, inheritable
3
+ from ..utils.decorators import typecheck, inheritable
4
4
  from ..utils.generic import setimuattr
5
5
  from ..utils.string import normstr
6
6
 
@@ -8,7 +8,7 @@ import os
8
8
 
9
9
  class PysEditor(Pys):
10
10
 
11
- @typechecked
11
+ @typecheck
12
12
  def __init__(self, file: PysFileBuffer, colored: bool = True) -> None:
13
13
  self.file = file
14
14
  self.colored = bool(colored)
@@ -36,7 +36,7 @@ class PysTraceback(Pys):
36
36
 
37
37
  def string_traceback(self) -> str:
38
38
  # circular import problem solved
39
- from .mapping import GET_ACOLORS
39
+ from .mapping import GET_ACOLOR
40
40
  from .position import format_error_arrow
41
41
 
42
42
  context = self.context
@@ -44,9 +44,9 @@ class PysTraceback(Pys):
44
44
  colored = not (context.flags & NO_COLOR)
45
45
 
46
46
  if colored:
47
- reset = GET_ACOLORS('reset')
48
- magenta = GET_ACOLORS('magenta')
49
- bmagenta = GET_ACOLORS('bold-magenta')
47
+ reset = GET_ACOLOR('reset')
48
+ magenta = GET_ACOLOR('magenta')
49
+ bmagenta = GET_ACOLOR('bold-magenta')
50
50
  else:
51
51
  reset = ''
52
52
  magenta = ''
@@ -1,8 +1,8 @@
1
1
  from .cache import pys_sys
2
2
  from .constants import ENV_PYSCRIPT_NO_GIL
3
3
  from .context import PysContext
4
- from .objects import PysFunction
5
4
  from .position import PysPosition
5
+ from .pystypes import PysFunction
6
6
  from .utils.generic import is_environ
7
7
 
8
8
  from types import MethodType