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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: beancode
3
- Version: 0.3.2
3
+ Version: 0.3.3
4
4
  Summary: A cursed IGCSE pseudocode interpreter/transpiler
5
5
  License: MPL-2.0
6
6
  Author: ezntek
@@ -1,4 +1,4 @@
1
- __version__ = "0.3.2"
1
+ __version__ = "0.3.3"
2
2
 
3
3
 
4
4
  def error(msg: str):
@@ -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
- from typing import NoReturn
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
- indicator = f"{spaces()}\033[31;1m∟ \033[0m\033[1merror at line {line} column {col}\033[0m"
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∟ \033[0m\033[1mwarning at line {line} column {col}\033[0m"
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
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "beancode"
3
- version = "0.3.2"
3
+ version = "0.3.3"
4
4
  description = "A cursed IGCSE pseudocode interpreter/transpiler"
5
5
  authors = [
6
6
  {name = "ezntek", email = "eason@ezntek.com"}
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes