pyscript-programming-language 1.13.3__tar.gz → 1.13.4__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 (89) hide show
  1. {pyscript_programming_language-1.13.3/pyscript_programming_language.egg-info → pyscript_programming_language-1.13.4}/PKG-INFO +15 -15
  2. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/README.md +14 -14
  3. pyscript_programming_language-1.13.4/changelog.md +20 -0
  4. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyproject.toml +1 -1
  5. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/__init__.py +4 -3
  6. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/__init__.pyi +2 -1
  7. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/__main__.py +18 -11
  8. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/core/cache.py +1 -0
  9. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/core/constants.py +7 -6
  10. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/core/context.py +6 -6
  11. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/core/editor/bases.py +4 -3
  12. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/core/editor/terminal.py +2 -2
  13. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/core/exceptions.py +0 -6
  14. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/core/highlight.py +7 -25
  15. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/core/lexer.py +3 -28
  16. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/core/mapping.py +52 -0
  17. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/core/parser.py +3 -3
  18. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/core/pysbuiltins.py +16 -15
  19. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/core/pystypes.py +5 -11
  20. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/core/runner.py +6 -5
  21. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/core/shell.py +5 -5
  22. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/core/symtab.py +1 -1
  23. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/core/utils/similarity.py +2 -3
  24. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/core/utils/string.py +4 -1
  25. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/core/version.py +5 -14
  26. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/lib/fpstimer/py_fpstimer.py +11 -1
  27. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/lib/history.pys +2 -3
  28. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/lib/parser.pys +5 -1
  29. pyscript_programming_language-1.13.4/pyscript/site-packages/anniversary.pys +4 -0
  30. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/this.py +2 -2
  31. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4/pyscript_programming_language.egg-info}/PKG-INFO +15 -15
  32. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript_programming_language.egg-info/SOURCES.txt +1 -0
  33. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/setup.py +1 -2
  34. pyscript_programming_language-1.13.3/changelog.md +0 -13
  35. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/MANIFEST.in +0 -0
  36. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/core/__init__.py +0 -0
  37. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/core/analyzer.py +0 -0
  38. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/core/bases.py +0 -0
  39. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/core/buffer.py +0 -0
  40. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/core/checks.py +0 -0
  41. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/core/editor/__init__.py +0 -0
  42. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/core/editor/gui.py +0 -0
  43. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/core/handlers.py +0 -0
  44. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/core/interpreter.py +0 -0
  45. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/core/nodes.py +0 -0
  46. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/core/position.py +0 -0
  47. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/core/results.py +0 -0
  48. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/core/token.py +0 -0
  49. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/core/utils/__init__.py +0 -0
  50. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/core/utils/ansi.py +0 -0
  51. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/core/utils/debug.py +0 -0
  52. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/core/utils/decorators.py +0 -0
  53. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/core/utils/generic.py +0 -0
  54. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/core/utils/module.py +0 -0
  55. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/core/utils/path.py +0 -0
  56. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/lib/__hello__.pys +0 -0
  57. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/lib/ansi.pys +0 -0
  58. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/lib/ast/__init__.pys +0 -0
  59. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/lib/ast/ast_dump.py +0 -0
  60. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/lib/ast/ast_literal_eval.py +0 -0
  61. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/lib/ast/ast_unparse.py +0 -0
  62. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/lib/ast/ast_walk.py +0 -0
  63. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/lib/brainfuck.pys +0 -0
  64. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/lib/code.pys +0 -0
  65. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/lib/dis.pys +0 -0
  66. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/lib/explorer.pys +0 -0
  67. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/lib/fpstimer/__init__.pys +0 -0
  68. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/lib/getch/__init__.pys +0 -0
  69. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/lib/getch/py_getch.py +0 -0
  70. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/lib/inspect.pys +0 -0
  71. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/lib/jsdict.pys +0 -0
  72. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/lib/keyword.pys +0 -0
  73. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/lib/opcode.pys +0 -0
  74. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/lib/pdisplay.pys +0 -0
  75. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/lib/site.pys +0 -0
  76. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/lib/symtable.pys +0 -0
  77. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/lib/token.pys +0 -0
  78. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/lib/tokenize/__init__.pys +0 -0
  79. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/lib/tokenize/tok_untokenize.py +0 -0
  80. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/other/.nomedia +0 -0
  81. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/other/PyScript.ico +0 -0
  82. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/other/copyright +0 -0
  83. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/other/credits +0 -0
  84. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/other/license +0 -0
  85. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript/site-packages/this.pys +0 -0
  86. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript_programming_language.egg-info/dependency_links.txt +0 -0
  87. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript_programming_language.egg-info/requires.txt +0 -0
  88. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/pyscript_programming_language.egg-info/top_level.txt +0 -0
  89. {pyscript_programming_language-1.13.3 → pyscript_programming_language-1.13.4}/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
3
+ Version: 1.13.4
4
4
  Summary: PyScript Programming Language
5
5
  Home-page: https://azzammuhyala.github.io/pyscript
6
6
  Author: AzzamMuhyala
@@ -39,7 +39,7 @@ Dynamic: requires-python
39
39
  <img src="https://static.pepy.tech/personalized-badge/pyscript-programming-language?period=total&units=NONE&left_color=GRAY&right_color=GREEN&left_text=downloads" alt="PyPI Downloads">
40
40
  </a>
41
41
  <a href="https://en.wikipedia.org/wiki/MIT_License">
42
- <img src="https://img.shields.io/badge/license-MIT-orange" alt="License MIT">
42
+ <img src="https://img.shields.io/badge/license-MIT-orange" alt="MIT License">
43
43
  </a>
44
44
  <a href="https://www.python.org/">
45
45
  <img src="https://img.shields.io/badge/python-3.10+-yellow" alt="Python 3.10+">
@@ -50,10 +50,10 @@ PyScript is a programming language built on top of Python. It combines some synt
50
50
  you're already familiar with Python, JavaScript or both, it should be quite easy to learn.
51
51
 
52
52
  ## Introduction 📖
53
- PyScript may not be the language we'll be discussing, but the name PyScript already exists, a flexible and platform for
54
- running Python in a browser. Since it's inception, the language was inspired by Python and JavaScript, which are
55
- relatively easy for humans to read. This name was chosen because it wasn't immediately known whether this name was
56
- already in use.
53
+ The name of "PyScript" was previously used by a well-known framework designed to run Python directly in the browser.
54
+ Designed from the outset with inspiration from both Python and JavaScript, this language emphasizes human readability.
55
+ Its name was derived by combining **Py**thon and Java**Script**. Please note that this language is an independent
56
+ programming language project written in Python and has no affiliation with the aforementioned PyScript framework.
57
57
 
58
58
  This language wasn't designed to compete with other modern programming languages, but rather as a learning for
59
59
  understanding how programming languages ​​work and how human written code can be understood by machines. Furthermore, this
@@ -105,15 +105,15 @@ Familiar? There it is!
105
105
  |:--:|:------------------|:----------------------:|
106
106
  | 1 | `argparse` | **required** |
107
107
  | 2 | `builtins` | **required** |
108
- | 3 | `collections.abc` | **required** |
109
- | 4 | `functools` | **required** |
110
- | 5 | `html` | **required** |
111
- | 6 | `importlib` | **required** |
112
- | 7 | `inspect` | **required** |
113
- | 8 | `io` | **required** |
114
- | 9 | `itertools` | **required** |
115
- | 10 | `json` | **required** |
116
- | 11 | `math` | **required** |
108
+ | 3 | `cmath` | **required** |
109
+ | 4 | `collections.abc` | **required** |
110
+ | 5 | `functools` | **required** |
111
+ | 6 | `html` | **required** |
112
+ | 7 | `importlib` | **required** |
113
+ | 8 | `inspect` | **required** |
114
+ | 9 | `io` | **required** |
115
+ | 10 | `itertools` | **required** |
116
+ | 11 | `json` | **required** |
117
117
  | 12 | `operator` | **required** |
118
118
  | 13 | `os` | **required** |
119
119
  | 14 | `re` | **required** |
@@ -7,7 +7,7 @@
7
7
  <img src="https://static.pepy.tech/personalized-badge/pyscript-programming-language?period=total&units=NONE&left_color=GRAY&right_color=GREEN&left_text=downloads" alt="PyPI Downloads">
8
8
  </a>
9
9
  <a href="https://en.wikipedia.org/wiki/MIT_License">
10
- <img src="https://img.shields.io/badge/license-MIT-orange" alt="License MIT">
10
+ <img src="https://img.shields.io/badge/license-MIT-orange" alt="MIT License">
11
11
  </a>
12
12
  <a href="https://www.python.org/">
13
13
  <img src="https://img.shields.io/badge/python-3.10+-yellow" alt="Python 3.10+">
@@ -18,10 +18,10 @@ PyScript is a programming language built on top of Python. It combines some synt
18
18
  you're already familiar with Python, JavaScript or both, it should be quite easy to learn.
19
19
 
20
20
  ## Introduction 📖
21
- PyScript may not be the language we'll be discussing, but the name PyScript already exists, a flexible and platform for
22
- running Python in a browser. Since it's inception, the language was inspired by Python and JavaScript, which are
23
- relatively easy for humans to read. This name was chosen because it wasn't immediately known whether this name was
24
- already in use.
21
+ The name of "PyScript" was previously used by a well-known framework designed to run Python directly in the browser.
22
+ Designed from the outset with inspiration from both Python and JavaScript, this language emphasizes human readability.
23
+ Its name was derived by combining **Py**thon and Java**Script**. Please note that this language is an independent
24
+ programming language project written in Python and has no affiliation with the aforementioned PyScript framework.
25
25
 
26
26
  This language wasn't designed to compete with other modern programming languages, but rather as a learning for
27
27
  understanding how programming languages ​​work and how human written code can be understood by machines. Furthermore, this
@@ -73,15 +73,15 @@ Familiar? There it is!
73
73
  |:--:|:------------------|:----------------------:|
74
74
  | 1 | `argparse` | **required** |
75
75
  | 2 | `builtins` | **required** |
76
- | 3 | `collections.abc` | **required** |
77
- | 4 | `functools` | **required** |
78
- | 5 | `html` | **required** |
79
- | 6 | `importlib` | **required** |
80
- | 7 | `inspect` | **required** |
81
- | 8 | `io` | **required** |
82
- | 9 | `itertools` | **required** |
83
- | 10 | `json` | **required** |
84
- | 11 | `math` | **required** |
76
+ | 3 | `cmath` | **required** |
77
+ | 4 | `collections.abc` | **required** |
78
+ | 5 | `functools` | **required** |
79
+ | 6 | `html` | **required** |
80
+ | 7 | `importlib` | **required** |
81
+ | 8 | `inspect` | **required** |
82
+ | 9 | `io` | **required** |
83
+ | 10 | `itertools` | **required** |
84
+ | 11 | `json` | **required** |
85
85
  | 12 | `operator` | **required** |
86
86
  | 13 | `os` | **required** |
87
87
  | 14 | `re` | **required** |
@@ -0,0 +1,20 @@
1
+ # Change Logs
2
+
3
+ ## [1.13.4] - 01/09/2026
4
+
5
+ ### Added
6
+ - Added comparison support for complex objects in the builtin `ce` and `nce` functions.
7
+ - Default maximum input history lines for Pygments to 2048.
8
+ - Configured `open()` encoding based on `pys_sys.encoding` (PyScript `sys.encoding`).
9
+ - The `else` keyword is alias for `default` in `switch` statements.
10
+ - The `fpstimer` module now stores the default framerate value.
11
+ - Added `NO_WARNING` flag.
12
+ - _etc._
13
+
14
+ ### Fixed
15
+ - Fixed some bugs.
16
+ - The builtins `inf`, `infj`, `nan`, and `nanj` come from the `cmath` module.
17
+ - _etc._
18
+
19
+ ### Removed
20
+ - The attributes of `pys_sys` namely `last_type`, `last_value`, and `last_traceback`.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "pyscript-programming-language"
7
- version = "1.13.3"
7
+ version = "1.13.4"
8
8
  description = "PyScript Programming Language"
9
9
  readme = { file = "README.md", content-type = "text/markdown" }
10
10
  requires-python = ">=3.10"
@@ -9,8 +9,8 @@ if __import__('sys').version_info < (3, 10):
9
9
  from . import core
10
10
 
11
11
  from .core.constants import (
12
- DEFAULT, NO_COLOR, DEBUG, SILENT, RETURN_RESULT, DONT_SHOW_BANNER_ON_SHELL, CLASSIC_LINE_SHELL, NO_COLOR_PROMPT,
13
- NOTEBOOK, LEXER_HIGHLIGHT, DICT_TO_JSDICT
12
+ DEFAULT, NO_COLOR, NO_WARNING, SILENT, DEBUG, RETURN_RESULT, DONT_SHOW_BANNER_ON_SHELL, CLASSIC_LINE_SHELL,
13
+ NO_COLOR_PROMPT, NOTEBOOK, LEXER_HIGHLIGHT, DICT_TO_JSDICT
14
14
  )
15
15
  from .core.cache import undefined
16
16
  from .core.highlight import (
@@ -24,8 +24,9 @@ __all__ = (
24
24
  'core',
25
25
  'DEFAULT',
26
26
  'NO_COLOR',
27
- 'DEBUG',
27
+ 'NO_WARNING',
28
28
  'SILENT',
29
+ 'DEBUG',
29
30
  'RETURN_RESULT',
30
31
  'DONT_SHOW_BANNER_ON_SHELL',
31
32
  'CLASSIC_LINE_SHELL',
@@ -22,8 +22,9 @@ from .core.highlight import (
22
22
 
23
23
  DEFAULT: int
24
24
  NO_COLOR: int
25
- DEBUG: int
25
+ NO_WARNING: int
26
26
  SILENT: int
27
+ DEBUG: int
27
28
  RETURN_RESULT: int
28
29
  DONT_SHOW_BANNER_ON_SHELL: int
29
30
  CLASSIC_LINE_SHELL: int
@@ -1,8 +1,8 @@
1
1
  from .core.buffer import PysFileBuffer
2
2
  from .core.cache import pys_sys, undefined
3
3
  from .core.constants import (
4
- ENV_PYSCRIPT_NO_COLOR_PROMPT, ENV_PYSCRIPT_CLASSIC_LINE_SHELL, DEFAULT, DEBUG, NO_COLOR, DONT_SHOW_BANNER_ON_SHELL,
5
- CLASSIC_LINE_SHELL, NO_COLOR_PROMPT, NOTEBOOK
4
+ ENV_PYSCRIPT_NO_COLOR_PROMPT, ENV_PYSCRIPT_CLASSIC_LINE_SHELL, DEFAULT, NO_COLOR, NO_WARNING, DEBUG,
5
+ DONT_SHOW_BANNER_ON_SHELL, CLASSIC_LINE_SHELL, NO_COLOR_PROMPT, NOTEBOOK
6
6
  )
7
7
  from .core.editor.gui import PysGUIEditor, GUI_SUPPORT
8
8
  from .core.editor.terminal import PysTerminalEditor, TERMINAL_SUPPORT
@@ -100,7 +100,7 @@ parser.add_argument(
100
100
 
101
101
  parser.add_argument(
102
102
  '-l', '--highlight',
103
- choices=tuple(FORMATER_HIGHLIGHT_MAP.keys()) + tuple(FORMATER_PYGMENTS_MAP.keys() if PYGMENTS else ()),
103
+ choices=tuple(FORMATER_HIGHLIGHT_MAP.keys()) + (tuple(FORMATER_PYGMENTS_MAP.keys()) if PYGMENTS else ()),
104
104
  default=None,
105
105
  help="generate highlight code from a 'file'"
106
106
  )
@@ -139,6 +139,12 @@ parser.add_argument(
139
139
  help="configure terminal encoding to UTF-8 and enable ANSI escape code processing on Windows"
140
140
  )
141
141
 
142
+ parser.add_argument(
143
+ '-w', '--no-warning',
144
+ action='store_true',
145
+ help="disabled warning (especially syntax warnings)"
146
+ )
147
+
142
148
  parser.add_argument(
143
149
  '-q',
144
150
  action='store_true',
@@ -240,6 +246,7 @@ for condition, flag in [
240
246
  (args.no_color or is_environ('NO_COLOR'), NO_COLOR),
241
247
  (args.no_color_prompt or is_environ(ENV_PYSCRIPT_NO_COLOR_PROMPT), NO_COLOR_PROMPT),
242
248
  (args.debug, DEBUG),
249
+ (args.no_warning, NO_WARNING),
243
250
  (args.q, DONT_SHOW_BANNER_ON_SHELL)
244
251
  ]:
245
252
  if condition:
@@ -258,13 +265,13 @@ def clean_up() -> None:
258
265
  'ArgumentParser', 'BBCodeFormatter', 'CLASSIC_LINE_SHELL', 'DEBUG', 'DEFAULT', 'EDITOR_MAP',
259
266
  'ENV_PYSCRIPT_CLASSIC_LINE_SHELL', 'ENV_PYSCRIPT_NO_COLOR_PROMPT', 'FORMATER_HIGHLIGHT_MAP',
260
267
  'FORMATER_PYGMENTS_MAP', 'GUI_SUPPORT', 'HLFMT_ANSI', 'HLFMT_BBCODE', 'HLFMT_HTML', 'HtmlFormatter',
261
- 'LatexFormatter', 'NOTEBOOK', 'NO_COLOR', 'NO_COLOR_PROMPT', 'OPTIONAL', 'PYGMENTS', 'PygmentsPyScriptLexer',
262
- 'PygmentsPyScriptStyle', 'PysFileBuffer', 'PysGUIEditor', 'PysTerminalEditor', 'REMAINDER', 'TERMINAL_SUPPORT',
263
- 'Terminal256Formatter', 'TerminalFormatter', 'TerminalTrueColorFormatter', 'USE_NOTEBOOK', '__version__',
264
- '_namespace_to_symbol_table', 'arg', 'arg_index', 'argc', 'args', 'argument_error', 'arguments_requiring_value',
265
- 'argv', 'base', 'clean_up', 'condition', 'ctypes', 'execute', 'fd', 'file', 'find_module_path', 'flag',
266
- 'getcwd', 'highlight', 'i', 'index', 'is_environ', 'kernel32', 'load_file', 'module_path', 'parser',
267
- 'pys_highlight', 'pys_sys', 'remove_python_path'
268
+ 'LatexFormatter', 'NOTEBOOK', 'NO_COLOR', 'NO_WARNING', 'NO_COLOR_PROMPT', 'OPTIONAL', 'PYGMENTS',
269
+ 'PygmentsPyScriptLexer', 'PygmentsPyScriptStyle', 'PysFileBuffer', 'PysGUIEditor', 'PysTerminalEditor',
270
+ 'REMAINDER', 'TERMINAL_SUPPORT', 'Terminal256Formatter', 'TerminalFormatter', 'TerminalTrueColorFormatter',
271
+ 'USE_NOTEBOOK', '__version__', '_namespace_to_symbol_table', 'arg', 'arg_index', 'argc', 'args',
272
+ 'argument_error', 'arguments_requiring_value', 'argv', 'base', 'clean_up', 'condition', 'ctypes', 'execute',
273
+ 'fd', 'file', 'find_module_path', 'flag', 'getcwd', 'highlight', 'i', 'index', 'is_environ', 'kernel32',
274
+ 'load_file', 'module_path', 'parser', 'pys_highlight', 'pys_sys', 'remove_python_path'
268
275
  }:
269
276
  try:
270
277
  del g[name]
@@ -274,7 +281,7 @@ def clean_up() -> None:
274
281
  def load_file(path) -> PysFileBuffer:
275
282
  normalized = normpath(path)
276
283
  try:
277
- with open(normalized, 'r', encoding='utf-8') as file:
284
+ with open(normalized, 'r', encoding=pys_sys.encoding) as file:
278
285
  return PysFileBuffer(file, normalized)
279
286
  except FileNotFoundError:
280
287
  if not (EDITOR_MAP and args.editor):
@@ -31,6 +31,7 @@ pys_sys.modules = {}
31
31
  pys_sys.interns = {}
32
32
  pys_sys.singletons = {}
33
33
  pys_sys.argv = ['']
34
+ pys_sys.encoding = 'utf-8'
34
35
  pys_sys.flags = DEFAULT
35
36
  pys_sys.displayhook = print_display
36
37
  pys_sys.excepthook = print_traceback
@@ -34,12 +34,13 @@ CONSTANT_KEYWORDS = (
34
34
 
35
35
  DEFAULT = 0
36
36
  NO_COLOR = 1 << 0
37
- DEBUG = 1 << 1
38
- SILENT = 1 << 2
39
- RETURN_RESULT = 1 << 3
40
- DONT_SHOW_BANNER_ON_SHELL = 1 << 4
41
- CLASSIC_LINE_SHELL = 1 << 5
42
- NO_COLOR_PROMPT = 1 << 6
37
+ NO_WARNING = 1 << 1
38
+ SILENT = 1 << 2 | NO_WARNING
39
+ DEBUG = 1 << 3
40
+ RETURN_RESULT = 1 << 4
41
+ DONT_SHOW_BANNER_ON_SHELL = 1 << 5
42
+ CLASSIC_LINE_SHELL = 1 << 6
43
+ NO_COLOR_PROMPT = 1 << 7
43
44
  NOTEBOOK = CLASSIC_LINE_SHELL | NO_COLOR_PROMPT
44
45
 
45
46
  LEXER_HIGHLIGHT = 1 << 0
@@ -28,12 +28,12 @@ class PysContext(Pys):
28
28
  if flags is None and parent:
29
29
  flags = parent.flags
30
30
 
31
- setimuattr(self, 'file', file)
32
- setimuattr(self, 'name', name)
33
- setimuattr(self, 'qualname', qualname)
34
- setimuattr(self, 'flags', DEFAULT if flags is None else flags)
35
- setimuattr(self, 'symbol_table', symbol_table)
36
- setimuattr(self, 'parent', parent)
31
+ setimuattr(self, 'file', file)
32
+ setimuattr(self, 'name', name)
33
+ setimuattr(self, 'qualname', qualname)
34
+ setimuattr(self, 'flags', DEFAULT if flags is None else flags)
35
+ setimuattr(self, 'symbol_table', symbol_table)
36
+ setimuattr(self, 'parent', parent)
37
37
  setimuattr(self, 'parent_entry_position', parent_entry_position)
38
38
 
39
39
  class PysClassContext(PysContext):
@@ -1,5 +1,6 @@
1
1
  from ..bases import Pys
2
2
  from ..buffer import PysFileBuffer
3
+ from ..cache import pys_sys
3
4
  from ..constants import CONFIGURATIONS_PATH
4
5
  from ..utils.decorators import typecheck, inheritable
5
6
  from ..utils.generic import setimuattr
@@ -26,7 +27,7 @@ class PysEditor(Pys):
26
27
 
27
28
  def load_configuration(self) -> None:
28
29
  try:
29
- with open(CONFIGURATIONS_PATH, 'r', encoding='utf-8') as file:
30
+ with open(CONFIGURATIONS_PATH, 'r', encoding=pys_sys.encoding) as file:
30
31
  result = load(file)
31
32
  if not isinstance(result, dict):
32
33
  raise ValueError
@@ -48,7 +49,7 @@ class PysEditor(Pys):
48
49
 
49
50
  def save_configuration(self) -> None:
50
51
  try:
51
- with open(CONFIGURATIONS_PATH, 'w', encoding='utf-8') as file:
52
+ with open(CONFIGURATIONS_PATH, 'w', encoding=pys_sys.encoding) as file:
52
53
  dump(self.configurations, file, separators=(',', ':'))
53
54
  except:
54
55
  pass
@@ -56,7 +57,7 @@ class PysEditor(Pys):
56
57
  def save(self, text) -> None:
57
58
  try:
58
59
  text = normstr(text)
59
- with open(self.file.name, 'w', encoding='utf-8') as file:
60
+ with open(self.file.name, 'w', encoding=pys_sys.encoding) as file:
60
61
  file.write(text)
61
62
  setimuattr(self.file, 'text', text)
62
63
  except:
@@ -181,8 +181,8 @@ try:
181
181
  floats=[
182
182
  Float(
183
183
  content=self.exit_container,
184
- left=2,
185
- bottom=1
184
+ width=43,
185
+ height=2,
186
186
  )
187
187
  ]
188
188
  )
@@ -25,8 +25,6 @@ class PysTraceback(Pys):
25
25
  primary: Optional['PysTraceback'] = None,
26
26
  implicit: bool = False
27
27
  ) -> None:
28
- # circular import problem solved
29
- from .cache import pys_sys
30
28
 
31
29
  setimuattr(self, 'exception', exception)
32
30
  setimuattr(self, 'context', context)
@@ -34,10 +32,6 @@ class PysTraceback(Pys):
34
32
  setimuattr(self, 'primary', primary)
35
33
  setimuattr(self, 'implicit', implicit)
36
34
 
37
- pys_sys.last_type = type(exception) if isinstance(exception, BaseException) else exception
38
- pys_sys.last_value = exception if isinstance(exception, BaseException) else None
39
- pys_sys.last_traceback = self
40
-
41
35
  def __repr__(self) -> str:
42
36
  return f'<traceback of {self.exception!r}>'
43
37
 
@@ -3,7 +3,7 @@ from .buffer import PysFileBuffer
3
3
  from .checks import is_constant_keyword, is_left_bracket, is_bracket, is_public_attribute
4
4
  from .constants import KEYWORDS, CONSTANT_KEYWORDS, LEXER_HIGHLIGHT
5
5
  from .lexer import PysLexer
6
- from .mapping import BRACKETS_MAP
6
+ from .mapping import HIGHLIGHT_MAP, BRACKETS_MAP
7
7
  from .position import PysPosition
8
8
  from .pysbuiltins import pys_builtins
9
9
  from .token import TOKENS
@@ -12,28 +12,8 @@ from .utils.decorators import typecheck
12
12
  from .utils.string import normstr
13
13
 
14
14
  from html import escape as html_escape
15
- from types import MappingProxyType
16
15
  from typing import Callable, Optional
17
16
 
18
- HIGHLIGHT_MAP = MappingProxyType({
19
- 'default': '#D4D4D4',
20
- 'keyword': '#C586C0',
21
- 'keyword-constant': '#307CD6',
22
- 'keyword-other': '#1F52B3',
23
- 'identifier': '#8CDCFE',
24
- 'identifier-constant': '#2EA3FF',
25
- 'identifier-function': '#DCDCAA',
26
- 'identifier-type': '#4EC9B0',
27
- 'number': '#B5CEA8',
28
- 'string': '#CE9178',
29
- 'escape': '#D7BA71',
30
- 'brackets-0': '#FFD705',
31
- 'brackets-1': '#D45DBA',
32
- 'brackets-2': '#1A9FFF',
33
- 'comment': '#549952',
34
- 'invalid': '#B51819'
35
- })
36
-
37
17
  BUILTIN_TYPES = frozenset(
38
18
  name
39
19
  for name, object in pys_builtins.__dict__.items()
@@ -448,6 +428,7 @@ def pys_highlight(
448
428
  formatter: Optional[Callable[[str, PysPosition, str], str]] = None,
449
429
  max_bracket_level: int = 3
450
430
  ) -> str:
431
+
451
432
  """
452
433
  Highlight a PyScript code from source given.
453
434
 
@@ -498,6 +479,7 @@ def pys_highlight(
498
479
  for i, token in enumerate(tokens):
499
480
  ttype = token.type
500
481
  tvalue = token.value
482
+ tposition = token.position
501
483
 
502
484
  if ttype == T_NULL:
503
485
  type_format = 'end'
@@ -553,13 +535,13 @@ def pys_highlight(
553
535
  else:
554
536
  type_format = 'default'
555
537
 
556
- if space := text[last_index:token.position.start]:
557
- result += formatter('default', PysPosition(file, last_index, token.position.start), space)
558
- result += formatter(type_format, token.position, text[token.position.start:token.position.end])
538
+ if space := text[last_index:tposition.start]:
539
+ result += formatter('default', PysPosition(file, last_index, tposition.start), space)
540
+ result += formatter(type_format, tposition, text[tposition.start:tposition.end])
559
541
 
560
542
  if ttype == T_NULL:
561
543
  break
562
544
 
563
- last_index = token.position.end
545
+ last_index = tposition.end
564
546
 
565
547
  return result
@@ -2,45 +2,20 @@ from .bases import Pys
2
2
  from .buffer import PysFileBuffer
3
3
  from .cache import intern_object
4
4
  from .checks import is_keyword
5
- from .constants import DEFAULT, SILENT, LEXER_HIGHLIGHT, NO_COLOR
5
+ from .constants import DEFAULT, NO_COLOR, NO_WARNING, LEXER_HIGHLIGHT
6
6
  from .context import PysContext
7
7
  from .exceptions import PysTraceback
8
+ from .mapping import ESCAPE_CHARACTERS_MAP, BASE_INTEGER_LITERAL, ESCAPE_LITERAL_LENGTH
8
9
  from .position import PysPosition, format_error_arrow
9
10
  from .token import TOKENS, PysToken
10
11
  from .utils.decorators import typecheck
11
12
  from .utils.string import indent
12
13
 
13
14
  from unicodedata import lookup as unicode_lookup
14
- from types import MappingProxyType
15
15
  from typing import Any, Optional
16
16
 
17
17
  import sys
18
18
 
19
- ESCAPE_CHARACTERS_MAP = MappingProxyType({
20
- '\\': '\\',
21
- "'": "'",
22
- '"': '"',
23
- 'n': '\n',
24
- 'r': '\r',
25
- 't': '\t',
26
- 'b': '\b',
27
- 'f': '\f',
28
- 'a': '\a',
29
- 'v': '\v'
30
- })
31
-
32
- BASE_INTEGER_LITERAL = MappingProxyType({
33
- 'b': (2, '01'),
34
- 'o': (8, '01234567'),
35
- 'x': (16, '0123456789abcdefABCDEF')
36
- })
37
-
38
- ESCAPE_LITERAL_LENGTH = MappingProxyType({
39
- 'x': 2,
40
- 'u': 4,
41
- 'U': 8
42
- })
43
-
44
19
  class PysLexer(Pys):
45
20
 
46
21
  @typecheck
@@ -232,7 +207,7 @@ class PysLexer(Pys):
232
207
  )
233
208
 
234
209
  def warning(self, message: str) -> None:
235
- if not (self.flags & SILENT or self.parser_flags & LEXER_HIGHLIGHT):
210
+ if not (self.flags & NO_WARNING or self.parser_flags & LEXER_HIGHLIGHT):
236
211
  print(message, file=sys.stderr)
237
212
 
238
213
  def throw(self, start: int, end: int, message: str, add_token: bool = True) -> None:
@@ -83,6 +83,58 @@ GET_ACOLOR = {
83
83
  'bold-red': acolor('red', style=BOLD)
84
84
  }.__getitem__
85
85
 
86
+ HIGHLIGHT_MAP = MappingProxyType({
87
+ 'default': '#D4D4D4',
88
+ 'keyword': '#C586C0',
89
+ 'keyword-constant': '#307CD6',
90
+ 'keyword-other': '#1F52B3',
91
+ 'identifier': '#8CDCFE',
92
+ 'identifier-constant': '#2EA3FF',
93
+ 'identifier-function': '#DCDCAA',
94
+ 'identifier-type': '#4EC9B0',
95
+ 'number': '#B5CEA8',
96
+ 'string': '#CE9178',
97
+ 'escape': '#D7BA71',
98
+ 'brackets-0': '#FFD705',
99
+ 'brackets-1': '#D45DBA',
100
+ 'brackets-2': '#1A9FFF',
101
+ 'comment': '#549952',
102
+ 'invalid': '#B51819'
103
+ })
104
+
105
+ TAG_VERSION_MAP = MappingProxyType({
106
+ 'a': 'alpha',
107
+ 'b': 'beta',
108
+ 'rc': 'release candidate',
109
+ 'dev': 'development',
110
+ 'post': 'post'
111
+ })
112
+
113
+ ESCAPE_CHARACTERS_MAP = MappingProxyType({
114
+ '\\': '\\',
115
+ "'": "'",
116
+ '"': '"',
117
+ 'n': '\n',
118
+ 'r': '\r',
119
+ 't': '\t',
120
+ 'b': '\b',
121
+ 'f': '\f',
122
+ 'a': '\a',
123
+ 'v': '\v'
124
+ })
125
+
126
+ BASE_INTEGER_LITERAL = MappingProxyType({
127
+ 'b': (2, '01'),
128
+ 'o': (8, '01234567'),
129
+ 'x': (16, '0123456789abcdefABCDEF')
130
+ })
131
+
132
+ ESCAPE_LITERAL_LENGTH = MappingProxyType({
133
+ 'x': 2,
134
+ 'u': 4,
135
+ 'U': 8
136
+ })
137
+
86
138
  BRACKETS_MAP = MappingProxyType({
87
139
  TOKENS['LEFT_PARENTHESIS']: TOKENS['RIGHT_PARENTHESIS'],
88
140
  TOKENS['LEFT_SQUARE']: TOKENS['RIGHT_SQUARE'],
@@ -1,7 +1,7 @@
1
1
  from .bases import Pys
2
2
  from .cache import intern_object
3
3
  from .checks import is_sequence, is_literal, is_left_bracket, is_right_bracket
4
- from .constants import DEFAULT, NO_COLOR, SILENT, DICT_TO_JSDICT
4
+ from .constants import DEFAULT, NO_COLOR, NO_WARNING, DICT_TO_JSDICT
5
5
  from .context import PysContext
6
6
  from .exceptions import PysTraceback
7
7
  from .mapping import BRACKETS_MAP
@@ -78,7 +78,7 @@ class PysParser(Pys):
78
78
  self.update_current_token()
79
79
 
80
80
  def warning(self, message: str) -> None:
81
- if not (self.flags & SILENT):
81
+ if not (self.flags & NO_WARNING):
82
82
  print(message, file=sys.stderr)
83
83
 
84
84
  def new_error(self, message: str, position: Optional[PysPosition] = None) -> PysTraceback:
@@ -1229,7 +1229,7 @@ class PysParser(Pys):
1229
1229
 
1230
1230
  cases.append((case, body))
1231
1231
 
1232
- elif self.current_token.match(TOKENS['KEYWORD'], 'default'):
1232
+ elif self.current_token.match(TOKENS['KEYWORD'], 'default', 'else'):
1233
1233
  result.register_advancement()
1234
1234
  self.advance()
1235
1235
  self.skip(result)