beancode 0.3.2__tar.gz → 0.3.3__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.
- {beancode-0.3.2 → beancode-0.3.3}/PKG-INFO +1 -1
- {beancode-0.3.2 → beancode-0.3.3}/beancode/__init__.py +1 -1
- {beancode-0.3.2 → beancode-0.3.3}/beancode/__main__.py +4 -2
- {beancode-0.3.2 → beancode-0.3.3}/beancode/error.py +15 -3
- {beancode-0.3.2 → beancode-0.3.3}/pyproject.toml +1 -1
- {beancode-0.3.2 → beancode-0.3.3}/LICENSE.md +0 -0
- {beancode-0.3.2 → beancode-0.3.3}/README.md +0 -0
- {beancode-0.3.2 → beancode-0.3.3}/beancode/bean_ast.py +0 -0
- {beancode-0.3.2 → beancode-0.3.3}/beancode/bean_ffi.py +0 -0
- {beancode-0.3.2 → beancode-0.3.3}/beancode/interpreter.py +0 -0
- {beancode-0.3.2 → beancode-0.3.3}/beancode/lexer.py +0 -0
- {beancode-0.3.2 → beancode-0.3.3}/beancode/modules/__init__.py +0 -0
- {beancode-0.3.2 → beancode-0.3.3}/beancode/modules/beanray.py +0 -0
- {beancode-0.3.2 → beancode-0.3.3}/beancode/modules/beanstd.py +0 -0
- {beancode-0.3.2 → beancode-0.3.3}/beancode/modules/demo_ffimod.py +0 -0
- {beancode-0.3.2 → beancode-0.3.3}/beancode/parser.py +0 -0
- {beancode-0.3.2 → beancode-0.3.3}/beancode/repl.py +0 -0
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import io
|
|
1
2
|
import os
|
|
2
3
|
import sys
|
|
3
4
|
import argparse
|
|
5
|
+
from typing import NoReturn
|
|
4
6
|
|
|
5
7
|
from .repl import Repl
|
|
6
8
|
|
|
@@ -10,7 +12,6 @@ from .parser import Parser
|
|
|
10
12
|
from .error import *
|
|
11
13
|
from . import __version__
|
|
12
14
|
|
|
13
|
-
|
|
14
15
|
def _error(s: str) -> NoReturn:
|
|
15
16
|
error(s)
|
|
16
17
|
exit(1)
|
|
@@ -104,10 +105,11 @@ def real_main():
|
|
|
104
105
|
|
|
105
106
|
|
|
106
107
|
def main():
|
|
108
|
+
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors="replace")
|
|
109
|
+
sys.stderr = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors="replace")
|
|
107
110
|
try:
|
|
108
111
|
if len(sys.argv) == 1:
|
|
109
112
|
sys.exit(Repl().repl())
|
|
110
|
-
|
|
111
113
|
real_main()
|
|
112
114
|
except KeyboardInterrupt:
|
|
113
115
|
warn("caught keyboard interrupt")
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import sys
|
|
2
|
-
|
|
2
|
+
import os
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
class BCError(Exception):
|
|
@@ -69,7 +69,14 @@ class BCError(Exception):
|
|
|
69
69
|
|
|
70
70
|
tildes = f"{spaces()}\033[31;1m{'~' * self.len}\033[0m"
|
|
71
71
|
print(tildes)
|
|
72
|
-
|
|
72
|
+
|
|
73
|
+
indicator = f"{spaces()}\033[31;1m"
|
|
74
|
+
if os.name == "nt":
|
|
75
|
+
indicator += "+-"
|
|
76
|
+
else:
|
|
77
|
+
indicator += "∟"
|
|
78
|
+
|
|
79
|
+
indicator += f" \033[0m\033[1merror at line {line} column {col}\033[0m"
|
|
73
80
|
print(indicator)
|
|
74
81
|
|
|
75
82
|
|
|
@@ -117,7 +124,12 @@ class BCWarning(Exception):
|
|
|
117
124
|
|
|
118
125
|
tildes = f"{spaces()}\033[35;1m{'~' * self.len}\033[0m"
|
|
119
126
|
print(tildes)
|
|
120
|
-
indicator = f"{spaces()}\033[35;1m
|
|
127
|
+
indicator = f"{spaces()}\033[35;1m"
|
|
128
|
+
if os.name == "nt":
|
|
129
|
+
indicator += "+-"
|
|
130
|
+
else:
|
|
131
|
+
indicator += "∟"
|
|
132
|
+
indicator += f" \033[0m\033[1mwarning at line {line} column {col}\033[0m"
|
|
121
133
|
print(indicator)
|
|
122
134
|
|
|
123
135
|
|
|
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
|
|
File without changes
|