inscript-lang 1.8.4__tar.gz → 1.9.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 (31) hide show
  1. {inscript_lang-1.8.4 → inscript_lang-1.9.4}/PKG-INFO +1 -1
  2. {inscript_lang-1.8.4 → inscript_lang-1.9.4}/analyzer.py +20 -3
  3. inscript_lang-1.9.4/inscript.py +2210 -0
  4. {inscript_lang-1.8.4 → inscript_lang-1.9.4}/inscript_lang.egg-info/PKG-INFO +1 -1
  5. {inscript_lang-1.8.4 → inscript_lang-1.9.4}/pyproject.toml +1 -1
  6. {inscript_lang-1.8.4 → inscript_lang-1.9.4}/repl.py +1 -1
  7. {inscript_lang-1.8.4 → inscript_lang-1.9.4}/setup.py +19 -4
  8. inscript_lang-1.8.4/inscript.py +0 -852
  9. {inscript_lang-1.8.4 → inscript_lang-1.9.4}/README.md +0 -0
  10. {inscript_lang-1.8.4 → inscript_lang-1.9.4}/ast_nodes.py +0 -0
  11. {inscript_lang-1.8.4 → inscript_lang-1.9.4}/compiler.py +0 -0
  12. {inscript_lang-1.8.4 → inscript_lang-1.9.4}/environment.py +0 -0
  13. {inscript_lang-1.8.4 → inscript_lang-1.9.4}/errors.py +0 -0
  14. {inscript_lang-1.8.4 → inscript_lang-1.9.4}/inscript_fmt.py +0 -0
  15. {inscript_lang-1.8.4 → inscript_lang-1.9.4}/inscript_lang.egg-info/SOURCES.txt +0 -0
  16. {inscript_lang-1.8.4 → inscript_lang-1.9.4}/inscript_lang.egg-info/dependency_links.txt +0 -0
  17. {inscript_lang-1.8.4 → inscript_lang-1.9.4}/inscript_lang.egg-info/entry_points.txt +0 -0
  18. {inscript_lang-1.8.4 → inscript_lang-1.9.4}/inscript_lang.egg-info/requires.txt +0 -0
  19. {inscript_lang-1.8.4 → inscript_lang-1.9.4}/inscript_lang.egg-info/top_level.txt +0 -0
  20. {inscript_lang-1.8.4 → inscript_lang-1.9.4}/inscript_test.py +0 -0
  21. {inscript_lang-1.8.4 → inscript_lang-1.9.4}/interpreter.py +0 -0
  22. {inscript_lang-1.8.4 → inscript_lang-1.9.4}/lexer.py +0 -0
  23. {inscript_lang-1.8.4 → inscript_lang-1.9.4}/parser.py +0 -0
  24. {inscript_lang-1.8.4 → inscript_lang-1.9.4}/pygame_backend.py +0 -0
  25. {inscript_lang-1.8.4 → inscript_lang-1.9.4}/setup.cfg +0 -0
  26. {inscript_lang-1.8.4 → inscript_lang-1.9.4}/stdlib.py +0 -0
  27. {inscript_lang-1.8.4 → inscript_lang-1.9.4}/stdlib_extended.py +0 -0
  28. {inscript_lang-1.8.4 → inscript_lang-1.9.4}/stdlib_extended_2.py +0 -0
  29. {inscript_lang-1.8.4 → inscript_lang-1.9.4}/stdlib_game.py +0 -0
  30. {inscript_lang-1.8.4 → inscript_lang-1.9.4}/stdlib_values.py +0 -0
  31. {inscript_lang-1.8.4 → inscript_lang-1.9.4}/vm.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: inscript-lang
3
- Version: 1.8.4
3
+ Version: 1.9.4
4
4
  Summary: InScript — a game-focused scripting language with 59 game modules and a bytecode VM
5
5
  Author: Shreyasi Sarkar
6
6
  License: MIT
@@ -82,6 +82,8 @@ BUILTIN_TYPES: Dict[str, InScriptType] = {
82
82
  "Texture": T_TEXTURE,
83
83
  # tuple / array shorthand
84
84
  "Tuple": T_ANY, "List": T_ANY, "Dict": T_ANY, "Map": T_ANY,
85
+ # v1.9.1: bare 'array' without element type (deprecated — use [T] in v2.0.0)
86
+ "array": InScriptType("Array", [T_ANY]),
85
87
  }
86
88
 
87
89
  def array_type(elem: InScriptType) -> InScriptType:
@@ -254,7 +256,8 @@ class Analyzer(Visitor):
254
256
  multi_error: bool = True,
255
257
  warn_as_error: bool = False,
256
258
  no_warn: bool = False,
257
- no_warn_unused: bool = False):
259
+ no_warn_unused: bool = False,
260
+ strict: bool = False):
258
261
  self._src = source_lines or []
259
262
  self._scope = Scope(kind="global")
260
263
  self._errors: List[SemanticError] = [] # collected (multi-error)
@@ -263,6 +266,7 @@ class Analyzer(Visitor):
263
266
  self._warn_as_error = warn_as_error
264
267
  self._no_warn = no_warn
265
268
  self._no_warn_unused = no_warn_unused
269
+ self._strict = strict # v1.9.1: enables extra v2.0.0-readiness errors
266
270
  self._dispatch: dict = {} # v1.3.0: cached dispatch
267
271
 
268
272
  # State for context-sensitive checks
@@ -386,7 +390,15 @@ class Analyzer(Visitor):
386
390
  return fn_type(params, ret)
387
391
 
388
392
  if ann.name in BUILTIN_TYPES:
389
- return BUILTIN_TYPES[ann.name]
393
+ t = BUILTIN_TYPES[ann.name]
394
+ # v1.9.1: bare `array` without element type is a hard error in strict mode
395
+ if ann.name == "array" and not ann.generics and self._strict:
396
+ self._error(
397
+ "Bare 'array' type without element type is a breaking change in v2.0.0. "
398
+ "Use '[T]' (e.g. '[int]') or annotate the element type.",
399
+ ann.line, ann.col
400
+ )
401
+ return t
390
402
 
391
403
  # v1.8.2: registered type aliases
392
404
  if ann.name in self._type_aliases:
@@ -604,7 +616,8 @@ class Analyzer(Visitor):
604
616
  )
605
617
  # Infer type from initializer if no annotation
606
618
  if declared_type == T_ANY and node.initializer:
607
- declared_type = init_type
619
+ # v1.8.2: literal_type("hello") is a string value — store as T_STRING
620
+ declared_type = T_STRING if is_literal_type(init_type) else init_type
608
621
 
609
622
  self._define(Symbol(
610
623
  node.name, declared_type,
@@ -1143,6 +1156,10 @@ class Analyzer(Visitor):
1143
1156
  right = self.visit(node.right)
1144
1157
  op = node.op
1145
1158
 
1159
+ # v1.8.2: literal string types act as T_STRING in all operations
1160
+ if is_literal_type(left): left = T_STRING
1161
+ if is_literal_type(right): right = T_STRING
1162
+
1146
1163
  # Comparison operators always return bool
1147
1164
  if op in ("==", "!=", "<", ">", "<=", ">="):
1148
1165
  return T_BOOL