minecraft-datapack-language 15.1.51__py3-none-any.whl → 15.1.53__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/cli_build.py +13 -7
- minecraft_datapack_language/cli_check.py +34 -5
- minecraft_datapack_language/cli_help.py +44 -44
- minecraft_datapack_language/cli_new.py +14 -14
- minecraft_datapack_language/linter.py +3 -3
- minecraft_datapack_language/mdl_linter.py +41 -0
- minecraft_datapack_language/mdl_parser_js.py +1 -1
- {minecraft_datapack_language-15.1.51.dist-info → minecraft_datapack_language-15.1.53.dist-info}/METADATA +1 -1
- minecraft_datapack_language-15.1.53.dist-info/RECORD +24 -0
- minecraft_datapack_language-15.1.51.dist-info/RECORD +0 -24
- {minecraft_datapack_language-15.1.51.dist-info → minecraft_datapack_language-15.1.53.dist-info}/WHEEL +0 -0
- {minecraft_datapack_language-15.1.51.dist-info → minecraft_datapack_language-15.1.53.dist-info}/entry_points.txt +0 -0
- {minecraft_datapack_language-15.1.51.dist-info → minecraft_datapack_language-15.1.53.dist-info}/licenses/LICENSE +0 -0
- {minecraft_datapack_language-15.1.51.dist-info → minecraft_datapack_language-15.1.53.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 = '15.1.
|
32
|
-
__version_tuple__ = version_tuple = (15, 1,
|
31
|
+
__version__ = version = '15.1.53'
|
32
|
+
__version_tuple__ = version_tuple = (15, 1, 53)
|
33
33
|
|
34
34
|
__commit_id__ = commit_id = None
|
@@ -709,10 +709,16 @@ def build_mdl(input_path: str, output_path: str, verbose: bool = False, pack_for
|
|
709
709
|
# Generate pack.mcmeta
|
710
710
|
_generate_pack_mcmeta(ast, output_dir)
|
711
711
|
|
712
|
-
# Get namespace from
|
713
|
-
namespace = ast.get('pack', {}).get('name', 'mdl_pack')
|
712
|
+
# Get namespace from AST or fall back to pack name
|
713
|
+
namespace = ast.get('namespace', {}).get('name', ast.get('pack', {}).get('name', 'mdl_pack'))
|
714
714
|
namespace = _slugify(namespace)
|
715
715
|
|
716
|
+
# Debug: Show what namespace we're using
|
717
|
+
if verbose:
|
718
|
+
print(f"DEBUG: AST namespace: {ast.get('namespace', {})}")
|
719
|
+
print(f"DEBUG: AST pack: {ast.get('pack', {})}")
|
720
|
+
print(f"DEBUG: Using namespace: {namespace}")
|
721
|
+
|
716
722
|
# Generate functions
|
717
723
|
build_context = BuildContext()
|
718
724
|
_generate_function_file(ast, output_dir, namespace, verbose, build_context)
|
@@ -725,15 +731,15 @@ def build_mdl(input_path: str, output_path: str, verbose: bool = False, pack_for
|
|
725
731
|
|
726
732
|
# Create zip file if wrapper is specified
|
727
733
|
if wrapper:
|
728
|
-
zip_path = output_dir
|
734
|
+
zip_path = output_dir / f"{wrapper}.zip"
|
729
735
|
_create_zip_file(output_dir, zip_path)
|
730
736
|
if verbose:
|
731
|
-
print(f"
|
737
|
+
print(f"[ZIP] Created zip file: {zip_path}")
|
732
738
|
|
733
|
-
print(f"
|
739
|
+
print(f"[OK] Successfully built datapack: {output_path}")
|
734
740
|
if verbose:
|
735
|
-
print(f"
|
736
|
-
print(f"
|
741
|
+
print(f"[DIR] Output directory: {output_dir}")
|
742
|
+
print(f"[NS] Namespace: {namespace}")
|
737
743
|
|
738
744
|
except MDLLexerError as e:
|
739
745
|
error_collector.add_error(e)
|
@@ -42,9 +42,38 @@ def lint_mdl_file_wrapper(file_path: str, verbose: bool = False, ignore_warnings
|
|
42
42
|
|
43
43
|
# Perform linting
|
44
44
|
try:
|
45
|
-
lint_mdl_file(str(path))
|
46
|
-
|
47
|
-
|
45
|
+
issues = lint_mdl_file(str(path))
|
46
|
+
|
47
|
+
# Check if there are any errors
|
48
|
+
errors = [issue for issue in issues if issue.severity == 'error']
|
49
|
+
warnings = [issue for issue in issues if issue.severity == 'warning']
|
50
|
+
|
51
|
+
if errors:
|
52
|
+
# Report errors
|
53
|
+
print(f"[CHECK] Found {len(errors)} error(s) in: {file_path}")
|
54
|
+
for i, issue in enumerate(errors, 1):
|
55
|
+
print(f"Error {i}: {issue.message}")
|
56
|
+
if issue.suggestion:
|
57
|
+
print(f" Suggestion: {issue.suggestion}")
|
58
|
+
if issue.code:
|
59
|
+
print(f" Code: {issue.code}")
|
60
|
+
print()
|
61
|
+
|
62
|
+
# Exit with error code
|
63
|
+
sys.exit(1)
|
64
|
+
elif warnings and not ignore_warnings:
|
65
|
+
# Report warnings
|
66
|
+
print(f"[CHECK] Found {len(warnings)} warning(s) in: {file_path}")
|
67
|
+
for i, issue in enumerate(warnings, 1):
|
68
|
+
print(f"Warning {i}: {issue.message}")
|
69
|
+
if issue.suggestion:
|
70
|
+
print(f" Suggestion: {issue.suggestion}")
|
71
|
+
if issue.code:
|
72
|
+
print(f" Code: {issue.code}")
|
73
|
+
print()
|
74
|
+
|
75
|
+
print(f"[CHECK] Successfully checked: {file_path}")
|
76
|
+
print("[OK] No errors found!")
|
48
77
|
|
49
78
|
except Exception as e:
|
50
79
|
error_collector.add_error(create_error(
|
@@ -101,8 +130,8 @@ def lint_mdl_directory_wrapper(directory_path: str, verbose: bool = False, ignor
|
|
101
130
|
# Perform directory linting
|
102
131
|
try:
|
103
132
|
lint_mdl_directory(str(directory), verbose)
|
104
|
-
print(f"
|
105
|
-
print("
|
133
|
+
print(f"[CHECK] Successfully checked directory: {directory_path}")
|
134
|
+
print("[OK] No errors found!")
|
106
135
|
|
107
136
|
except Exception as e:
|
108
137
|
error_collector.add_error(create_error(
|
@@ -12,21 +12,21 @@ def show_main_help():
|
|
12
12
|
version = "unknown"
|
13
13
|
|
14
14
|
print(f"""
|
15
|
-
|
15
|
+
[GAME] MDL (Minecraft Datapack Language) CLI - v{version}
|
16
16
|
====================================================
|
17
17
|
|
18
18
|
MDL is a simplified language for creating Minecraft datapacks with variables,
|
19
19
|
control structures, and easy syntax. This CLI tool compiles MDL files into
|
20
20
|
standard Minecraft datapacks.
|
21
21
|
|
22
|
-
|
22
|
+
[CMD] Available Commands:
|
23
23
|
=====================
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
[BUILD] build - Compile MDL files into a Minecraft datapack
|
26
|
+
[CHECK] check - Validate MDL files for syntax and semantic errors
|
27
|
+
[NEW] new - Create a new MDL project with template files
|
28
28
|
|
29
|
-
|
29
|
+
[DOC] Detailed Help:
|
30
30
|
================
|
31
31
|
|
32
32
|
For detailed information about any command, use:
|
@@ -37,7 +37,7 @@ Examples:
|
|
37
37
|
mdl check --help - Show check command options
|
38
38
|
mdl new --help - Show new project options
|
39
39
|
|
40
|
-
|
40
|
+
[NEXT] Quick Start:
|
41
41
|
==============
|
42
42
|
|
43
43
|
1. Create a new project:
|
@@ -49,7 +49,7 @@ Examples:
|
|
49
49
|
3. Check for errors:
|
50
50
|
mdl check my_project.mdl
|
51
51
|
|
52
|
-
|
52
|
+
[INFO] Documentation:
|
53
53
|
================
|
54
54
|
|
55
55
|
• Language Reference: https://www.mcmdl.com/docs/language-reference
|
@@ -72,18 +72,18 @@ For support and bug reports, visit: https://github.com/aaron777collins/Minecraft
|
|
72
72
|
def show_build_help():
|
73
73
|
"""Display detailed help for the build command."""
|
74
74
|
print("""
|
75
|
-
|
75
|
+
[BUILD] MDL Build Command - Compile MDL Files to Minecraft Datapacks
|
76
76
|
===============================================================
|
77
77
|
|
78
78
|
The build command compiles MDL files into standard Minecraft datapacks that can
|
79
79
|
be loaded directly into Minecraft.
|
80
80
|
|
81
|
-
|
81
|
+
[CMD] Usage:
|
82
82
|
========
|
83
83
|
|
84
84
|
mdl build --mdl <input> -o <output> [options]
|
85
85
|
|
86
|
-
|
86
|
+
[DIR] Arguments:
|
87
87
|
============
|
88
88
|
|
89
89
|
--mdl, -m <input> Input MDL file or directory containing .mdl files
|
@@ -92,7 +92,7 @@ be loaded directly into Minecraft.
|
|
92
92
|
-o, --output <output> Output directory for the generated datapack
|
93
93
|
Example: -o dist, -o build/my_pack
|
94
94
|
|
95
|
-
|
95
|
+
[OPT] Options:
|
96
96
|
==========
|
97
97
|
|
98
98
|
--verbose, -v Enable verbose output with detailed build information
|
@@ -108,7 +108,7 @@ be loaded directly into Minecraft.
|
|
108
108
|
--ignore-warnings Suppress warning messages during build
|
109
109
|
Only show errors, hide all warnings
|
110
110
|
|
111
|
-
|
111
|
+
[EX] Examples:
|
112
112
|
===========
|
113
113
|
|
114
114
|
1. Build a single MDL file:
|
@@ -126,7 +126,7 @@ be loaded directly into Minecraft.
|
|
126
126
|
5. Build multiple files in a directory:
|
127
127
|
mdl build --mdl examples/ -o output --verbose
|
128
128
|
|
129
|
-
|
129
|
+
[OUT] Output Structure:
|
130
130
|
===================
|
131
131
|
|
132
132
|
The build command creates a standard Minecraft datapack structure:
|
@@ -144,7 +144,7 @@ The build command creates a standard Minecraft datapack structure:
|
|
144
144
|
├── load.json
|
145
145
|
└── tick.json
|
146
146
|
|
147
|
-
|
147
|
+
[FEAT] Features:
|
148
148
|
===========
|
149
149
|
|
150
150
|
• Multi-file compilation - Merge multiple .mdl files into one datapack
|
@@ -155,7 +155,7 @@ The build command creates a standard Minecraft datapack structure:
|
|
155
155
|
• Error handling - Detailed error reporting with suggestions
|
156
156
|
• Progress tracking - Verbose mode shows build progress
|
157
157
|
|
158
|
-
|
158
|
+
[CHECK] Error Handling:
|
159
159
|
=================
|
160
160
|
|
161
161
|
The build command provides comprehensive error reporting:
|
@@ -171,24 +171,24 @@ For more information, visit: https://www.mcmdl.com/docs/cli-reference#build
|
|
171
171
|
def show_check_help():
|
172
172
|
"""Display detailed help for the check command."""
|
173
173
|
print("""
|
174
|
-
|
174
|
+
[CHECK] MDL Check Command - Validate MDL Files for Errors
|
175
175
|
====================================================
|
176
176
|
|
177
177
|
The check command validates MDL files for syntax errors, semantic issues, and
|
178
178
|
potential problems without generating any output files.
|
179
179
|
|
180
|
-
|
180
|
+
[CMD] Usage:
|
181
181
|
========
|
182
182
|
|
183
183
|
mdl check <input> [options]
|
184
184
|
|
185
|
-
|
185
|
+
[DIR] Arguments:
|
186
186
|
============
|
187
187
|
|
188
188
|
<input> Input MDL file or directory containing .mdl files
|
189
189
|
Examples: project.mdl, src/, .
|
190
190
|
|
191
|
-
|
191
|
+
[OPT] Options:
|
192
192
|
==========
|
193
193
|
|
194
194
|
--verbose, -v Enable verbose output with detailed validation information
|
@@ -197,7 +197,7 @@ potential problems without generating any output files.
|
|
197
197
|
--ignore-warnings Suppress warning messages during check
|
198
198
|
Only show errors, hide all warnings
|
199
199
|
|
200
|
-
|
200
|
+
[EX] Examples:
|
201
201
|
===========
|
202
202
|
|
203
203
|
1. Check a single MDL file:
|
@@ -212,23 +212,23 @@ potential problems without generating any output files.
|
|
212
212
|
4. Check multiple files:
|
213
213
|
mdl check examples/ --verbose
|
214
214
|
|
215
|
-
|
215
|
+
[CHECK] Validation Types:
|
216
216
|
===================
|
217
217
|
|
218
218
|
The check command performs comprehensive validation:
|
219
219
|
|
220
|
-
|
220
|
+
[EX] Syntax Validation:
|
221
221
|
• Lexical analysis - Token recognition and validation
|
222
222
|
• Parsing - AST construction and syntax structure
|
223
223
|
• Grammar validation - Language rule compliance
|
224
224
|
|
225
|
-
|
225
|
+
[OPT] Semantic Validation:
|
226
226
|
• Variable declarations - Proper variable naming and scope
|
227
227
|
• Function definitions - Valid function signatures
|
228
228
|
• Control structures - Proper if/else and while loop syntax
|
229
229
|
• Command validation - Minecraft command syntax checking
|
230
230
|
|
231
|
-
|
231
|
+
[WARN] Error Detection:
|
232
232
|
• Missing semicolons and braces
|
233
233
|
• Invalid variable names or references
|
234
234
|
• Unclosed strings and comments
|
@@ -236,25 +236,25 @@ The check command performs comprehensive validation:
|
|
236
236
|
• Invalid selector syntax
|
237
237
|
• Undefined function calls
|
238
238
|
|
239
|
-
|
239
|
+
[REP] Error Reporting:
|
240
240
|
==================
|
241
241
|
|
242
242
|
The check command provides detailed error information:
|
243
243
|
|
244
|
-
|
244
|
+
[FEAT] Error Details:
|
245
245
|
• File path and exact location (line, column)
|
246
246
|
• Error type and description
|
247
247
|
• Context lines showing the problematic code
|
248
248
|
• Helpful suggestions for fixing issues
|
249
249
|
|
250
|
-
|
250
|
+
[CMD] Error Types:
|
251
251
|
• MDLSyntaxError - Basic syntax violations
|
252
252
|
• MDLLexerError - Token recognition issues
|
253
253
|
• MDLParserError - Parsing and structure problems
|
254
254
|
• MDLValidationError - Semantic validation failures
|
255
255
|
• MDLFileError - File access and I/O issues
|
256
256
|
|
257
|
-
|
257
|
+
[TIP] Example Error Output:
|
258
258
|
========================
|
259
259
|
|
260
260
|
Error 1: MDLSyntaxError in test.mdl:15:8
|
@@ -267,7 +267,7 @@ The check command provides detailed error information:
|
|
267
267
|
|
268
268
|
Suggestion: Add closing brace '}' after line 15
|
269
269
|
|
270
|
-
|
270
|
+
[CHECK] Advanced Features:
|
271
271
|
====================
|
272
272
|
|
273
273
|
• Multi-file validation - Check entire projects at once
|
@@ -276,7 +276,7 @@ The check command provides detailed error information:
|
|
276
276
|
• Context preservation - Show surrounding code for better debugging
|
277
277
|
• Suggestion system - Provide helpful fix recommendations
|
278
278
|
|
279
|
-
|
279
|
+
[NEXT] Integration:
|
280
280
|
==============
|
281
281
|
|
282
282
|
The check command is perfect for:
|
@@ -292,25 +292,25 @@ For more information, visit: https://www.mcmdl.com/docs/cli-reference#check
|
|
292
292
|
def show_new_help():
|
293
293
|
"""Display detailed help for the new command."""
|
294
294
|
print("""
|
295
|
-
|
295
|
+
[NEW] MDL New Command - Create New MDL Projects
|
296
296
|
============================================
|
297
297
|
|
298
298
|
The new command creates a new MDL project with template files and proper
|
299
299
|
structure to get you started quickly.
|
300
300
|
|
301
|
-
|
301
|
+
[CMD] Usage:
|
302
302
|
========
|
303
303
|
|
304
304
|
mdl new <project_name> [options]
|
305
305
|
|
306
|
-
|
306
|
+
[DIR] Arguments:
|
307
307
|
============
|
308
308
|
|
309
309
|
<project_name> Name for your new MDL project
|
310
310
|
This will be used for the project directory and pack name
|
311
311
|
Example: my_awesome_pack, hello_world, magic_system
|
312
312
|
|
313
|
-
|
313
|
+
[OPT] Options:
|
314
314
|
==========
|
315
315
|
|
316
316
|
--pack-name <name> Custom name for the datapack (defaults to project name)
|
@@ -321,7 +321,7 @@ structure to get you started quickly.
|
|
321
321
|
Default: 82 (Minecraft 1.20+)
|
322
322
|
Example: --pack-format 15 (for older versions)
|
323
323
|
|
324
|
-
|
324
|
+
[EX] Examples:
|
325
325
|
===========
|
326
326
|
|
327
327
|
1. Create a basic project:
|
@@ -336,7 +336,7 @@ structure to get you started quickly.
|
|
336
336
|
4. Create project with all custom options:
|
337
337
|
mdl new my_project --pack-name "My Project" --pack-format 82
|
338
338
|
|
339
|
-
|
339
|
+
[OUT] Generated Structure:
|
340
340
|
======================
|
341
341
|
|
342
342
|
The new command creates a complete project structure:
|
@@ -345,12 +345,12 @@ The new command creates a complete project structure:
|
|
345
345
|
├── README.md # Project documentation
|
346
346
|
└── <project_name>.mdl # Main MDL file with template code
|
347
347
|
|
348
|
-
|
348
|
+
[FILE] Template Content:
|
349
349
|
===================
|
350
350
|
|
351
351
|
The generated MDL file includes:
|
352
352
|
|
353
|
-
|
353
|
+
[CMD] Pack Declaration:
|
354
354
|
```mdl
|
355
355
|
pack {
|
356
356
|
name: "project_name"
|
@@ -359,7 +359,7 @@ pack {
|
|
359
359
|
}
|
360
360
|
```
|
361
361
|
|
362
|
-
|
362
|
+
[OPT] Example Functions:
|
363
363
|
```mdl
|
364
364
|
function main {
|
365
365
|
say "Hello from MDL!"
|
@@ -382,7 +382,7 @@ function load {
|
|
382
382
|
}
|
383
383
|
```
|
384
384
|
|
385
|
-
|
385
|
+
[FEAT] Features:
|
386
386
|
===========
|
387
387
|
|
388
388
|
• Complete project setup - Ready-to-use structure
|
@@ -391,7 +391,7 @@ function load {
|
|
391
391
|
• Documentation - README with usage instructions
|
392
392
|
• Best practices - Follows MDL conventions
|
393
393
|
|
394
|
-
|
394
|
+
[NEXT] Getting Started:
|
395
395
|
==================
|
396
396
|
|
397
397
|
After creating a new project:
|
@@ -411,7 +411,7 @@ After creating a new project:
|
|
411
411
|
5. Load in Minecraft:
|
412
412
|
# Copy the dist folder to your world's datapacks directory
|
413
413
|
|
414
|
-
|
414
|
+
[TIP] Tips:
|
415
415
|
========
|
416
416
|
|
417
417
|
• Use descriptive project names - They become your namespace
|
@@ -420,7 +420,7 @@ After creating a new project:
|
|
420
420
|
• Use version control - Git is great for tracking changes
|
421
421
|
• Read the documentation - Learn about all available features
|
422
422
|
|
423
|
-
|
423
|
+
[INFO] Next Steps:
|
424
424
|
=============
|
425
425
|
|
426
426
|
• Language Reference: https://www.mcmdl.com/docs/language-reference
|
@@ -54,18 +54,18 @@ def create_new_project(project_name: str, pack_name: str = None, pack_format: in
|
|
54
54
|
with open(readme_file, 'w', encoding='utf-8') as f:
|
55
55
|
f.write(readme_content)
|
56
56
|
|
57
|
-
print(f"
|
58
|
-
print(f"
|
59
|
-
print(f"
|
60
|
-
print(f"
|
57
|
+
print(f"[OK] Successfully created new MDL project: {clean_name}")
|
58
|
+
print(f"[DIR] Project directory: {project_dir.absolute()}")
|
59
|
+
print(f"[FILE] Main file: {mdl_file}")
|
60
|
+
print(f"[DOC] Documentation: {readme_file}")
|
61
61
|
print()
|
62
|
-
print("
|
62
|
+
print("[NEXT] Next steps:")
|
63
63
|
print(f" 1. cd {clean_name}")
|
64
64
|
print(f" 2. Edit {clean_name}.mdl with your code")
|
65
65
|
print(f" 3. mdl build --mdl {clean_name}.mdl -o dist")
|
66
66
|
print(f" 4. mdl check {clean_name}.mdl")
|
67
67
|
print()
|
68
|
-
print("
|
68
|
+
print("[INFO] Learn more:")
|
69
69
|
print(" • Language Reference: https://www.mcmdl.com/docs/language-reference")
|
70
70
|
print(" • Examples: https://www.mcmdl.com/docs/examples")
|
71
71
|
print(" • CLI Reference: https://www.mcmdl.com/docs/cli-reference")
|
@@ -116,7 +116,7 @@ var num lives = 3;
|
|
116
116
|
|
117
117
|
// Load function - this runs when the datapack loads
|
118
118
|
function "load" {{
|
119
|
-
say
|
119
|
+
say [GAME] {pack_name} loaded successfully!;
|
120
120
|
say Type: /function {project_name}:main;
|
121
121
|
}}
|
122
122
|
|
@@ -159,11 +159,11 @@ def _generate_readme_template(project_name: str, pack_name: str) -> str:
|
|
159
159
|
|
160
160
|
A Minecraft datapack created with MDL (Minecraft Datapack Language).
|
161
161
|
|
162
|
-
##
|
162
|
+
## [GAME] About
|
163
163
|
|
164
164
|
This datapack was generated using the MDL CLI tool. MDL is a simplified language for creating Minecraft datapacks with variables, control structures, and easy syntax.
|
165
165
|
|
166
|
-
##
|
166
|
+
## [DIR] Project Structure
|
167
167
|
|
168
168
|
```
|
169
169
|
{project_name}/
|
@@ -171,7 +171,7 @@ This datapack was generated using the MDL CLI tool. MDL is a simplified language
|
|
171
171
|
└── {project_name}.mdl # Main MDL source file
|
172
172
|
```
|
173
173
|
|
174
|
-
##
|
174
|
+
## [NEXT] Getting Started
|
175
175
|
|
176
176
|
### Prerequisites
|
177
177
|
|
@@ -203,7 +203,7 @@ This datapack was generated using the MDL CLI tool. MDL is a simplified language
|
|
203
203
|
2. The datapack will automatically load
|
204
204
|
3. Run the main function: `/function {project_name}:main`
|
205
205
|
|
206
|
-
##
|
206
|
+
## [OPT] Development
|
207
207
|
|
208
208
|
### Editing the Code
|
209
209
|
|
@@ -240,7 +240,7 @@ if (score > 5) {{
|
|
240
240
|
}}
|
241
241
|
```
|
242
242
|
|
243
|
-
##
|
243
|
+
## [INFO] Resources
|
244
244
|
|
245
245
|
- **Language Reference**: https://www.mcmdl.com/docs/language-reference
|
246
246
|
- **CLI Reference**: https://www.mcmdl.com/docs/cli-reference
|
@@ -270,11 +270,11 @@ if (score > 5) {{
|
|
270
270
|
- Visit the documentation: https://www.mcmdl.com/docs
|
271
271
|
- Report bugs: https://github.com/aaron777collins/MinecraftDatapackLanguage/issues
|
272
272
|
|
273
|
-
##
|
273
|
+
## [FILE] License
|
274
274
|
|
275
275
|
This project is licensed under the MIT License - see the LICENSE file for details.
|
276
276
|
|
277
277
|
---
|
278
278
|
|
279
|
-
Happy coding!
|
279
|
+
Happy coding! [GAME]
|
280
280
|
'''
|
@@ -373,13 +373,13 @@ def lint_mcfunction_directory(directory_path: str) -> Dict[str, List[LintIssue]]
|
|
373
373
|
def format_lint_report(issues: List[LintIssue], file_path: str = None) -> str:
|
374
374
|
"""Format lint issues into a readable report"""
|
375
375
|
if not issues:
|
376
|
-
return "
|
376
|
+
return "[OK] No linting issues found!"
|
377
377
|
|
378
378
|
report = []
|
379
379
|
if file_path:
|
380
|
-
report.append(f"
|
380
|
+
report.append(f"[DIR] Linting Report for: {file_path}")
|
381
381
|
else:
|
382
|
-
report.append("
|
382
|
+
report.append("[DIR] Linting Report")
|
383
383
|
|
384
384
|
report.append("=" * 50)
|
385
385
|
|
@@ -42,6 +42,47 @@ class MDLLinter:
|
|
42
42
|
return self.issues
|
43
43
|
|
44
44
|
try:
|
45
|
+
# First, try to parse the file with the actual parser to catch syntax errors
|
46
|
+
try:
|
47
|
+
from .mdl_parser_js import parse_mdl_js
|
48
|
+
with open(file_path, 'r', encoding='utf-8') as f:
|
49
|
+
source = f.read()
|
50
|
+
|
51
|
+
# Parse the file - this will catch syntax errors like missing semicolons
|
52
|
+
parse_mdl_js(source, file_path)
|
53
|
+
|
54
|
+
except Exception as parse_error:
|
55
|
+
# If parsing fails, add the error to our issues
|
56
|
+
error_message = str(parse_error)
|
57
|
+
if "Expected SEMICOLON" in error_message:
|
58
|
+
# Extract line and column from the error message
|
59
|
+
import re
|
60
|
+
line_match = re.search(r'Line: (\d+)', error_message)
|
61
|
+
column_match = re.search(r'Column: (\d+)', error_message)
|
62
|
+
line_num = int(line_match.group(1)) if line_match else 1
|
63
|
+
column_num = int(column_match.group(1)) if column_match else 1
|
64
|
+
|
65
|
+
self.issues.append(MDLLintIssue(
|
66
|
+
line_number=line_num,
|
67
|
+
severity='error',
|
68
|
+
category='syntax',
|
69
|
+
message="Missing semicolon",
|
70
|
+
suggestion="Add a semicolon (;) at the end of the statement",
|
71
|
+
code=source.split('\n')[line_num - 1] if line_num <= len(source.split('\n')) else ""
|
72
|
+
))
|
73
|
+
else:
|
74
|
+
# For other parsing errors, add them as well
|
75
|
+
self.issues.append(MDLLintIssue(
|
76
|
+
line_number=1,
|
77
|
+
severity='error',
|
78
|
+
category='syntax',
|
79
|
+
message=f"Parsing error: {error_message}",
|
80
|
+
suggestion="Check the syntax and fix the reported error",
|
81
|
+
code=""
|
82
|
+
))
|
83
|
+
return self.issues
|
84
|
+
|
85
|
+
# If parsing succeeds, do additional linting checks
|
45
86
|
with open(file_path, 'r', encoding='utf-8') as f:
|
46
87
|
lines = f.readlines()
|
47
88
|
|
@@ -159,7 +159,7 @@ class MDLParser:
|
|
159
159
|
|
160
160
|
self._match(TokenType.SEMICOLON)
|
161
161
|
|
162
|
-
return {"type": "
|
162
|
+
return {"type": "namespace_declaration", "name": name}
|
163
163
|
|
164
164
|
def _parse_function_declaration(self) -> FunctionDeclaration:
|
165
165
|
"""Parse function declaration."""
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: minecraft-datapack-language
|
3
|
-
Version: 15.1.
|
3
|
+
Version: 15.1.53
|
4
4
|
Summary: Compile JavaScript-style MDL language or Python API 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
|
@@ -0,0 +1,24 @@
|
|
1
|
+
minecraft_datapack_language/__init__.py,sha256=i-qCchbe5b2Fshgc6yCU9mddOLs2UBt9SAcLqfUIrT0,606
|
2
|
+
minecraft_datapack_language/_version.py,sha256=0QU6KmGcKCvzbXF6wwbr58E2UubWbW8QVOP3o5kZY98,708
|
3
|
+
minecraft_datapack_language/ast_nodes.py,sha256=pgjI2Nlap3ixFPgWqGSkqncG9zB91h5BKgRjtcJqMew,2118
|
4
|
+
minecraft_datapack_language/cli.py,sha256=p5A_tEEXugN2NhQFbbgfwi4FxbWYD91RWeKR_A3Vuec,6263
|
5
|
+
minecraft_datapack_language/cli_build.py,sha256=-VXlRE3BSLrzNVHNtQzrcsX71XSWGF1Gs3f-yyRXQUU,32108
|
6
|
+
minecraft_datapack_language/cli_check.py,sha256=4cKc3HpHLpuGLJ8SDJS6Dr3kl3zv1Rz4-Eu1EhkbxDc,6266
|
7
|
+
minecraft_datapack_language/cli_help.py,sha256=jUTHUQBONAZKVTdQK9tNPXq4c_6xpsafNOvHDjkEldg,12243
|
8
|
+
minecraft_datapack_language/cli_new.py,sha256=KGbKcZW3POwZFAS0nzcwl2NoTUygXzwcUe-iWYyPKEg,8268
|
9
|
+
minecraft_datapack_language/cli_utils.py,sha256=gLGe2nAn8pLiSJhn-DpNvMxo0th_Gj89I-oSeyPx4zU,9293
|
10
|
+
minecraft_datapack_language/dir_map.py,sha256=HmxFkuvWGkzHF8o_GFb4BpuMCRc6QMw8UbmcAI8JVdY,1788
|
11
|
+
minecraft_datapack_language/expression_processor.py,sha256=GN6cuRNvgI8TrV6YnEHrA9P0X-ACTT7rCBh4WlOPjSI,20140
|
12
|
+
minecraft_datapack_language/linter.py,sha256=7UqbygC5JPCGg-BSOq65NB2xEJBu_OUOYIIgmHItO2M,16567
|
13
|
+
minecraft_datapack_language/mdl_errors.py,sha256=a_-683gjF3gfGRpDMbRgCXmXD9_aYYBmLodNH6fe29A,11596
|
14
|
+
minecraft_datapack_language/mdl_lexer_js.py,sha256=G2leNsQz7792uiGig7d1AcQCOFNnmACJD_pXI0wTxGc,26169
|
15
|
+
minecraft_datapack_language/mdl_linter.py,sha256=z85xoAglENurCh30bR7kEHZ_JeMxcYaLDcGNRAl-RAI,17253
|
16
|
+
minecraft_datapack_language/mdl_parser_js.py,sha256=Ng22mKVbMNC4412Xb09i8fcNFPTPrW4NxFeK7Tv7EBQ,38539
|
17
|
+
minecraft_datapack_language/pack.py,sha256=nYiXQ3jgJlDfc4m-65f7C2LFhDRioaUU_XVy6Na4SJI,34625
|
18
|
+
minecraft_datapack_language/utils.py,sha256=Aq0HAGlXqj9BUTEjaEilpvzEW0EtZYYMMwOqG9db6dE,684
|
19
|
+
minecraft_datapack_language-15.1.53.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
20
|
+
minecraft_datapack_language-15.1.53.dist-info/METADATA,sha256=VjIb87PUyKBa4peGpo8Pzng9dxT5arUjHTlAuNH2lS0,35230
|
21
|
+
minecraft_datapack_language-15.1.53.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
22
|
+
minecraft_datapack_language-15.1.53.dist-info/entry_points.txt,sha256=c6vjBeCiyQflvPHBRyBk2nJCSfYt3Oc7Sc9V87ySi_U,108
|
23
|
+
minecraft_datapack_language-15.1.53.dist-info/top_level.txt,sha256=ADtFI476tbKLLxEAA-aJQAfg53MA3k_DOb0KTFiggfw,28
|
24
|
+
minecraft_datapack_language-15.1.53.dist-info/RECORD,,
|
@@ -1,24 +0,0 @@
|
|
1
|
-
minecraft_datapack_language/__init__.py,sha256=i-qCchbe5b2Fshgc6yCU9mddOLs2UBt9SAcLqfUIrT0,606
|
2
|
-
minecraft_datapack_language/_version.py,sha256=MlQ87D5L6b1xOHURoeHWf1bDb5aS5QwTIGncb39ZEvg,708
|
3
|
-
minecraft_datapack_language/ast_nodes.py,sha256=pgjI2Nlap3ixFPgWqGSkqncG9zB91h5BKgRjtcJqMew,2118
|
4
|
-
minecraft_datapack_language/cli.py,sha256=p5A_tEEXugN2NhQFbbgfwi4FxbWYD91RWeKR_A3Vuec,6263
|
5
|
-
minecraft_datapack_language/cli_build.py,sha256=l6N6yHToLfpInD0PMiv4u1eNpCeYiHp2KmuQ1RCZCm0,31805
|
6
|
-
minecraft_datapack_language/cli_check.py,sha256=6efsMm6VAtp31KCH0ruXBnsNTKd13zuxuPltqOeqiyk,4942
|
7
|
-
minecraft_datapack_language/cli_help.py,sha256=2m1yKPCBKroJJ1wxJo1J_lHulMG-2pTpedckMBkCL_Q,12181
|
8
|
-
minecraft_datapack_language/cli_new.py,sha256=PpC-vzwC-KjJjlwQkjKu8b9OIfilSdZpl_X2kdkGRUA,8245
|
9
|
-
minecraft_datapack_language/cli_utils.py,sha256=gLGe2nAn8pLiSJhn-DpNvMxo0th_Gj89I-oSeyPx4zU,9293
|
10
|
-
minecraft_datapack_language/dir_map.py,sha256=HmxFkuvWGkzHF8o_GFb4BpuMCRc6QMw8UbmcAI8JVdY,1788
|
11
|
-
minecraft_datapack_language/expression_processor.py,sha256=GN6cuRNvgI8TrV6YnEHrA9P0X-ACTT7rCBh4WlOPjSI,20140
|
12
|
-
minecraft_datapack_language/linter.py,sha256=7rqESqMUxUjnjjXpjU_ixUNhezArBHV2PoL3XVNnIN4,16564
|
13
|
-
minecraft_datapack_language/mdl_errors.py,sha256=a_-683gjF3gfGRpDMbRgCXmXD9_aYYBmLodNH6fe29A,11596
|
14
|
-
minecraft_datapack_language/mdl_lexer_js.py,sha256=G2leNsQz7792uiGig7d1AcQCOFNnmACJD_pXI0wTxGc,26169
|
15
|
-
minecraft_datapack_language/mdl_linter.py,sha256=pa1BGx9UWXkF-iKh4XNHpuh0zIaOEYt9pwMa-NjxWaw,15129
|
16
|
-
minecraft_datapack_language/mdl_parser_js.py,sha256=8BaNo96r5uwUwXAajTqyeRgpF-aQ8nkppMcA2L8RHps,38531
|
17
|
-
minecraft_datapack_language/pack.py,sha256=nYiXQ3jgJlDfc4m-65f7C2LFhDRioaUU_XVy6Na4SJI,34625
|
18
|
-
minecraft_datapack_language/utils.py,sha256=Aq0HAGlXqj9BUTEjaEilpvzEW0EtZYYMMwOqG9db6dE,684
|
19
|
-
minecraft_datapack_language-15.1.51.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
20
|
-
minecraft_datapack_language-15.1.51.dist-info/METADATA,sha256=BDkB_HYcg9zG2U34B6i4cPJMalfNqyFmfmgjee1bGnY,35230
|
21
|
-
minecraft_datapack_language-15.1.51.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
22
|
-
minecraft_datapack_language-15.1.51.dist-info/entry_points.txt,sha256=c6vjBeCiyQflvPHBRyBk2nJCSfYt3Oc7Sc9V87ySi_U,108
|
23
|
-
minecraft_datapack_language-15.1.51.dist-info/top_level.txt,sha256=ADtFI476tbKLLxEAA-aJQAfg53MA3k_DOb0KTFiggfw,28
|
24
|
-
minecraft_datapack_language-15.1.51.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|