minecraft-datapack-language 16.0.11__py3-none-any.whl → 16.0.13__py3-none-any.whl
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.
- minecraft_datapack_language/_version.py +2 -2
- minecraft_datapack_language/mdl_compiler.py +31 -3
- minecraft_datapack_language/mdl_lexer.py +8 -0
- {minecraft_datapack_language-16.0.11.dist-info → minecraft_datapack_language-16.0.13.dist-info}/METADATA +1 -1
- {minecraft_datapack_language-16.0.11.dist-info → minecraft_datapack_language-16.0.13.dist-info}/RECORD +9 -9
- {minecraft_datapack_language-16.0.11.dist-info → minecraft_datapack_language-16.0.13.dist-info}/WHEEL +0 -0
- {minecraft_datapack_language-16.0.11.dist-info → minecraft_datapack_language-16.0.13.dist-info}/entry_points.txt +0 -0
- {minecraft_datapack_language-16.0.11.dist-info → minecraft_datapack_language-16.0.13.dist-info}/licenses/LICENSE +0 -0
- {minecraft_datapack_language-16.0.11.dist-info → minecraft_datapack_language-16.0.13.dist-info}/top_level.txt +0 -0
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
28
28
|
commit_id: COMMIT_ID
|
29
29
|
__commit_id__: COMMIT_ID
|
30
30
|
|
31
|
-
__version__ = version = '16.0.
|
32
|
-
__version_tuple__ = version_tuple = (16, 0,
|
31
|
+
__version__ = version = '16.0.13'
|
32
|
+
__version_tuple__ = version_tuple = (16, 0, 13)
|
33
33
|
|
34
34
|
__commit_id__ = commit_id = None
|
@@ -187,7 +187,10 @@ class MDLCompiler:
|
|
187
187
|
if macro_re.search(line):
|
188
188
|
stripped = line.lstrip()
|
189
189
|
if not stripped.startswith('$'):
|
190
|
-
|
190
|
+
# Insert '$' immediately after indentation so there is no space after '$'
|
191
|
+
leading_ws_len = len(line) - len(stripped)
|
192
|
+
leading_ws = line[:leading_ws_len]
|
193
|
+
return f"{leading_ws}${stripped}"
|
191
194
|
return line
|
192
195
|
if '\n' in text:
|
193
196
|
return '\n'.join(process_line(ln) for ln in text.split('\n'))
|
@@ -656,6 +659,12 @@ class MDLCompiler:
|
|
656
659
|
wrap_fn = self._generate_while_function_name() # e.g., fn__while_1
|
657
660
|
body_fn = f"{wrap_fn}__body"
|
658
661
|
tag = f"mdl_sched__{wrap_fn}"
|
662
|
+
# If inside a parent scheduledwhile, register this tag as a child so parent defers while child active
|
663
|
+
if hasattr(self, '_sched_child_tag_stack') and self._sched_child_tag_stack:
|
664
|
+
self._sched_child_tag_stack[-1].append(tag)
|
665
|
+
# Prepare nested scheduledwhile coordination
|
666
|
+
if not hasattr(self, '_sched_child_tag_stack'):
|
667
|
+
self._sched_child_tag_stack = []
|
659
668
|
|
660
669
|
# Build condition once
|
661
670
|
cond_str, invert_then = self._build_condition(while_loop.condition)
|
@@ -669,8 +678,21 @@ class MDLCompiler:
|
|
669
678
|
|
670
679
|
# Build per-entity body function
|
671
680
|
body_lines: List[str] = [f"# Function: {self.current_namespace}:{body_fn}"]
|
681
|
+
|
672
682
|
if not hasattr(self, '_temp_sink_stack'):
|
673
683
|
self._temp_sink_stack = []
|
684
|
+
|
685
|
+
# Push a new child tag collector for nested scheduledwhiles
|
686
|
+
self._sched_child_tag_stack.append([])
|
687
|
+
# Also expose this collector to nested calls via a convenience reference
|
688
|
+
current_child_list = self._sched_child_tag_stack[-1]
|
689
|
+
# Provide a hook for nested scheduledwhile to register their tag
|
690
|
+
if not hasattr(self, '_register_child_sched_tag'):
|
691
|
+
def _register(tag_name: str):
|
692
|
+
if self._sched_child_tag_stack:
|
693
|
+
self._sched_child_tag_stack[-1].append(tag_name)
|
694
|
+
self._register_child_sched_tag = _register
|
695
|
+
|
674
696
|
self._temp_sink_stack.append(body_lines)
|
675
697
|
for stmt in while_loop.body:
|
676
698
|
if isinstance(stmt, VariableAssignment):
|
@@ -697,14 +719,20 @@ class MDLCompiler:
|
|
697
719
|
cmd = self._function_call_to_command(stmt)
|
698
720
|
body_lines.append(cmd)
|
699
721
|
self._temp_sink_stack.pop()
|
722
|
+
# Pop collected child tags for this level
|
723
|
+
child_tags: List[str] = self._sched_child_tag_stack.pop() if hasattr(self, '_sched_child_tag_stack') and self._sched_child_tag_stack else []
|
700
724
|
self._store_generated_function(body_fn, body_lines)
|
701
725
|
|
702
726
|
# Build wrapper function that maintains the tag set and reschedules if needed
|
703
727
|
wrap_lines: List[str] = [f"# Function: {self.current_namespace}:{wrap_fn}"]
|
704
728
|
# Hint comment to aid tests expecting a plain 'execute if score' substring
|
705
729
|
wrap_lines.append(f"# execute {cond_true} ...")
|
706
|
-
# Run body for entities where condition holds
|
707
|
-
|
730
|
+
# Run body for entities where condition holds (but NOT currently inside any child scheduled loop)
|
731
|
+
selector = f"@e[tag={tag}"
|
732
|
+
for ct in child_tags:
|
733
|
+
selector += f",tag=!{ct}"
|
734
|
+
selector += "]"
|
735
|
+
wrap_lines.append(f"execute as {selector} {cond_true} run function {self.current_namespace}:{body_fn}")
|
708
736
|
# Remove tag when condition fails
|
709
737
|
wrap_lines.append(f"execute as @e[tag={tag}] {cond_false} run tag @s remove {tag}")
|
710
738
|
# Continue scheduling while any remain
|
@@ -357,6 +357,14 @@ class MDLLexer:
|
|
357
357
|
if (self.source[self.current:self.current + 5] == 'raw!$'):
|
358
358
|
# Found the end marker - extract the content
|
359
359
|
raw_content = self.source[content_start:self.current]
|
360
|
+
# Trim leading/trailing whitespace on each line within the raw block
|
361
|
+
try:
|
362
|
+
lines = raw_content.split('\n')
|
363
|
+
trimmed_lines = [ln.strip() for ln in lines]
|
364
|
+
raw_content = '\n'.join(trimmed_lines)
|
365
|
+
except Exception:
|
366
|
+
# If anything goes wrong, fall back to original content
|
367
|
+
pass
|
360
368
|
|
361
369
|
# Generate a single RAW_CONTENT token with all the content
|
362
370
|
self.tokens.append(Token(TokenType.RAW_CONTENT, raw_content, self.line, self.column))
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: minecraft-datapack-language
|
3
|
-
Version: 16.0.
|
3
|
+
Version: 16.0.13
|
4
4
|
Summary: Compile MDL language with explicit scoping into a Minecraft datapack (1.21+ ready). Features variables, control flow, error handling, and VS Code extension.
|
5
5
|
Project-URL: Homepage, https://www.mcmdl.com
|
6
6
|
Project-URL: Documentation, https://www.mcmdl.com/docs
|
@@ -1,18 +1,18 @@
|
|
1
1
|
minecraft_datapack_language/__init__.py,sha256=0KVXBE4ScRaRUrf83aA2tVB-y8A_jplyaxVvtHH6Uw0,1199
|
2
|
-
minecraft_datapack_language/_version.py,sha256=
|
2
|
+
minecraft_datapack_language/_version.py,sha256=zPid2C66t3qy7IALtBamczEZhSi2TvHUc9FEEgCFwOc,708
|
3
3
|
minecraft_datapack_language/ast_nodes.py,sha256=L5izavSeXDr766vsfRvJrcnflXNJyXcy0WSfyJPq2ZA,4484
|
4
4
|
minecraft_datapack_language/cli.py,sha256=R4QZYtox-Da9B8pr_kCg_9qc9aI-ORTah7kMkhsI5tw,10373
|
5
5
|
minecraft_datapack_language/dir_map.py,sha256=HmxFkuvWGkzHF8o_GFb4BpuMCRc6QMw8UbmcAI8JVdY,1788
|
6
|
-
minecraft_datapack_language/mdl_compiler.py,sha256
|
6
|
+
minecraft_datapack_language/mdl_compiler.py,sha256=-ZwjHgJ8jJej8iiMovkbE8ry0aiLmXHc5rJ5Agj3Ep4,52293
|
7
7
|
minecraft_datapack_language/mdl_errors.py,sha256=r0Gu3KhoX1YLPAVW_iO7Q_fPgaf_Dv9tOGSOdKNSzmw,16114
|
8
|
-
minecraft_datapack_language/mdl_lexer.py,sha256=
|
8
|
+
minecraft_datapack_language/mdl_lexer.py,sha256=bDzAj39-kfnX0uVlYQg1oQ7YDb-JO9UZx8jbODQqg6E,23902
|
9
9
|
minecraft_datapack_language/mdl_linter.py,sha256=z85xoAglENurCh30bR7kEHZ_JeMxcYaLDcGNRAl-RAI,17253
|
10
10
|
minecraft_datapack_language/mdl_parser.py,sha256=Krk7Y_E9OKNCcsDOCT7ATvQLbJII951AU2qzEY00GLE,26068
|
11
11
|
minecraft_datapack_language/python_api.py,sha256=Iao1jbdeW6ekeA80BZG6gNqHVjxQJEheB3DbpVsuTZQ,12304
|
12
12
|
minecraft_datapack_language/utils.py,sha256=Aq0HAGlXqj9BUTEjaEilpvzEW0EtZYYMMwOqG9db6dE,684
|
13
|
-
minecraft_datapack_language-16.0.
|
14
|
-
minecraft_datapack_language-16.0.
|
15
|
-
minecraft_datapack_language-16.0.
|
16
|
-
minecraft_datapack_language-16.0.
|
17
|
-
minecraft_datapack_language-16.0.
|
18
|
-
minecraft_datapack_language-16.0.
|
13
|
+
minecraft_datapack_language-16.0.13.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
14
|
+
minecraft_datapack_language-16.0.13.dist-info/METADATA,sha256=0JbN_CstF60oTN4ypgfcq1JbLE0Q2nO3dcL_NWfioS8,8344
|
15
|
+
minecraft_datapack_language-16.0.13.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
16
|
+
minecraft_datapack_language-16.0.13.dist-info/entry_points.txt,sha256=c6vjBeCiyQflvPHBRyBk2nJCSfYt3Oc7Sc9V87ySi_U,108
|
17
|
+
minecraft_datapack_language-16.0.13.dist-info/top_level.txt,sha256=ADtFI476tbKLLxEAA-aJQAfg53MA3k_DOb0KTFiggfw,28
|
18
|
+
minecraft_datapack_language-16.0.13.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|