shell-lite 0.4.5__tar.gz → 0.4.6.1__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 (24) hide show
  1. {shell_lite-0.4.5/shell_lite.egg-info → shell_lite-0.4.6.1}/PKG-INFO +1 -1
  2. {shell_lite-0.4.5 → shell_lite-0.4.6.1}/pyproject.toml +1 -1
  3. {shell_lite-0.4.5 → shell_lite-0.4.6.1}/shell_lite/interpreter.py +17 -8
  4. {shell_lite-0.4.5 → shell_lite-0.4.6.1}/shell_lite/main.py +2 -2
  5. {shell_lite-0.4.5 → shell_lite-0.4.6.1}/shell_lite/parser.py +3 -8
  6. {shell_lite-0.4.5 → shell_lite-0.4.6.1/shell_lite.egg-info}/PKG-INFO +1 -1
  7. {shell_lite-0.4.5 → shell_lite-0.4.6.1}/LICENSE +0 -0
  8. {shell_lite-0.4.5 → shell_lite-0.4.6.1}/README.md +0 -0
  9. {shell_lite-0.4.5 → shell_lite-0.4.6.1}/setup.cfg +0 -0
  10. {shell_lite-0.4.5 → shell_lite-0.4.6.1}/shell_lite/__init__.py +0 -0
  11. {shell_lite-0.4.5 → shell_lite-0.4.6.1}/shell_lite/ast_nodes.py +0 -0
  12. {shell_lite-0.4.5 → shell_lite-0.4.6.1}/shell_lite/cli.py +0 -0
  13. {shell_lite-0.4.5 → shell_lite-0.4.6.1}/shell_lite/compiler.py +0 -0
  14. {shell_lite-0.4.5 → shell_lite-0.4.6.1}/shell_lite/lexer.py +0 -0
  15. {shell_lite-0.4.5 → shell_lite-0.4.6.1}/shell_lite/runtime.py +0 -0
  16. {shell_lite-0.4.5 → shell_lite-0.4.6.1}/shell_lite.egg-info/SOURCES.txt +0 -0
  17. {shell_lite-0.4.5 → shell_lite-0.4.6.1}/shell_lite.egg-info/dependency_links.txt +0 -0
  18. {shell_lite-0.4.5 → shell_lite-0.4.6.1}/shell_lite.egg-info/entry_points.txt +0 -0
  19. {shell_lite-0.4.5 → shell_lite-0.4.6.1}/shell_lite.egg-info/requires.txt +0 -0
  20. {shell_lite-0.4.5 → shell_lite-0.4.6.1}/shell_lite.egg-info/top_level.txt +0 -0
  21. {shell_lite-0.4.5 → shell_lite-0.4.6.1}/tests/test_interpreter.py +0 -0
  22. {shell_lite-0.4.5 → shell_lite-0.4.6.1}/tests/test_lexer.py +0 -0
  23. {shell_lite-0.4.5 → shell_lite-0.4.6.1}/tests/test_parser.py +0 -0
  24. {shell_lite-0.4.5 → shell_lite-0.4.6.1}/tests/test_stdlib.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: shell-lite
3
- Version: 0.4.5
3
+ Version: 0.4.6.1
4
4
  Summary: A lightweight, English-like scripting language.
5
5
  Author-email: Shrey Naithani <contact@shelllite.tech>
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "shell-lite"
7
- version = "0.04.5"
7
+ version = "0.04.6.1"
8
8
  description = "A lightweight, English-like scripting language."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.8"
@@ -1457,6 +1457,10 @@ class Interpreter:
1457
1457
  def visit_Listen(self, node: Listen):
1458
1458
  port_val = self.visit(node.port)
1459
1459
  interpreter_ref = self
1460
+
1461
+ class ReusableHTTPServer(HTTPServer):
1462
+ allow_reuse_address = True
1463
+
1460
1464
  class ShellLiteHandler(BaseHTTPRequestHandler):
1461
1465
  def log_message(self, format, *args): pass
1462
1466
  def do_GET(self):
@@ -1508,7 +1512,9 @@ class Interpreter:
1508
1512
  self.send_header('Content-Type', ct)
1509
1513
  self.end_headers()
1510
1514
  if self.command != 'HEAD':
1511
- with open(file_path, 'rb') as f: self.wfile.write(f.read())
1515
+ try:
1516
+ with open(file_path, 'rb') as f: self.wfile.write(f.read())
1517
+ except (BrokenPipeError, ConnectionResetError): pass
1512
1518
  return
1513
1519
  matched_body = None
1514
1520
  path_params = {}
@@ -1542,24 +1548,27 @@ class Interpreter:
1542
1548
  self.send_header('Content-Type', 'text/html')
1543
1549
  self.end_headers()
1544
1550
  if self.command != 'HEAD':
1545
- self.wfile.write(response_body.encode())
1551
+ try:
1552
+ self.wfile.write(response_body.encode())
1553
+ except (BrokenPipeError, ConnectionResetError): pass
1546
1554
  else:
1547
1555
  self.send_response(404)
1548
1556
  self.end_headers()
1549
1557
  if self.command != 'HEAD':
1550
- self.wfile.write(b'Not Found')
1558
+ try:
1559
+ self.wfile.write(b'Not Found')
1560
+ except (BrokenPipeError, ConnectionResetError): pass
1561
+ except (BrokenPipeError, ConnectionResetError):
1562
+ pass
1551
1563
  except Exception as e:
1552
- print(f"DEBUG: Server Exception: {e}")
1553
- import traceback
1554
- traceback.print_exc()
1555
1564
  try:
1556
1565
  self.send_response(500)
1557
1566
  self.end_headers()
1558
1567
  if self.command != 'HEAD':
1559
1568
  self.wfile.write(str(e).encode())
1560
1569
  except: pass
1561
- server = HTTPServer(('0.0.0.0', port_val), ShellLiteHandler)
1562
- print(f"\n ShellLite Server v0.04.5 is running!")
1570
+ server = ReusableHTTPServer(('0.0.0.0', port_val), ShellLiteHandler)
1571
+ print(f"\n ShellLite Server v0.04.6.1 is running!")
1563
1572
  print(f" \u001b[1;36m➜\u001b[0m Local: \u001b[1;4;36mhttp://localhost:{port_val}/\u001b[0m\n")
1564
1573
  try: server.serve_forever()
1565
1574
  except KeyboardInterrupt:
@@ -71,7 +71,7 @@ def run_repl():
71
71
  print("\n" + "="*40)
72
72
  print(" ShellLite REPL - English Syntax")
73
73
  print("="*40)
74
- print("Version: v0.04.5 | Made by Shrey Naithani")
74
+ print("Version: v0.04.6.1 | Made by Shrey Naithani")
75
75
  print("Commands: Type 'exit' to quit, 'help' for examples.")
76
76
  print("Note: Terminal commands (like 'shl install') must be run in CMD/PowerShell, not here.")
77
77
 
@@ -202,7 +202,7 @@ def install_globally():
202
202
  ps_cmd = f'$oldPath = [Environment]::GetEnvironmentVariable("Path", "User"); if ($oldPath -notlike "*ShellLite*") {{ [Environment]::SetEnvironmentVariable("Path", "$oldPath;{install_dir}", "User") }}'
203
203
  subprocess.run(["powershell", "-Command", ps_cmd], capture_output=True)
204
204
 
205
- print(f"\n[SUCCESS] ShellLite (v0.04.5) is installed!")
205
+ print(f"\n[SUCCESS] ShellLite (v0.04.6.1) is installed!")
206
206
  print(f"Location: {install_dir}")
207
207
  print("\nIMPORTANT STEP REQUIRED:")
208
208
  print("1. Close ALL open terminal windows (CMD, PowerShell, VS Code).")
@@ -752,7 +752,7 @@ class Parser:
752
752
  is_named_arg = False
753
753
  if self.peek(1).type == 'ASSIGN':
754
754
  t_type = self.peek().type
755
- if t_type in ('ID', 'STRUCTURE', 'TYPE', 'FOR', 'IN', 'WHILE', 'IF', 'ELSE', 'FROM', 'TO', 'STRING', 'EXTENDS', 'WITH', 'PLACEHOLDER', 'NAME', 'VALUE', 'ACTION', 'METHOD', 'HREF', 'SRC', 'CLASS', 'STYLE'):
755
+ if t_type in ('ID', 'STRUCTURE', 'TYPE', 'FOR', 'IN', 'WHILE', 'IF', 'ELSE', 'FROM', 'TO', 'STRING', 'EXTENDS', 'WITH', 'PLACEHOLDER', 'NAME', 'VALUE', 'ACTION', 'METHOD', 'HREF', 'SRC', 'CLASS', 'STYLE', 'ONCLICK', 'REL', 'CHARSET', 'CONTENT'):
756
756
  is_named_arg = True
757
757
  if is_named_arg:
758
758
  key_token = self.consume()
@@ -1469,12 +1469,7 @@ class Parser:
1469
1469
  node = Spawn(right)
1470
1470
  node.line = op.line
1471
1471
  return node
1472
- elif token.type == 'EXECUTE':
1473
- op = self.consume()
1474
- right = self.parse_expression()
1475
- node = Call('run', [right])
1476
- node.line = op.line
1477
- return node
1472
+
1478
1473
  elif token.type == 'COUNT' or token.type == 'HOW':
1479
1474
  token = self.consume()
1480
1475
  if token.type == 'HOW':
@@ -1560,7 +1555,7 @@ class Parser:
1560
1555
  return self.parse_list()
1561
1556
  elif token.type == 'LBRACE':
1562
1557
  return self.parse_dict()
1563
- elif token.type == 'ID':
1558
+ elif token.type == 'ID' or token.type in ('EXECUTE', 'BUTTON', 'ROW', 'COLUMN', 'SIZE', 'HEADING', 'TEXT', 'IMAGE', 'TITLE', 'START', 'SERVE', 'APP', 'PAGE', 'NAVBAR', 'FOOTER', 'SECTION', 'DIV', 'SPAN', 'LINK'):
1564
1559
  if token.value == 'a':
1565
1560
  if self.peek(1).type == 'LIST' and self.peek(2).type == 'OF':
1566
1561
  return self._parse_natural_list()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: shell-lite
3
- Version: 0.4.5
3
+ Version: 0.4.6.1
4
4
  Summary: A lightweight, English-like scripting language.
5
5
  Author-email: Shrey Naithani <contact@shelllite.tech>
6
6
  License: MIT
File without changes
File without changes
File without changes