MLizard 0.0.1__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.
- mlizard/__init__.py +46 -0
- mlizard/interpreter.py +517 -0
- mlizard-0.0.1.dist-info/METADATA +32 -0
- mlizard-0.0.1.dist-info/RECORD +7 -0
- mlizard-0.0.1.dist-info/WHEEL +5 -0
- mlizard-0.0.1.dist-info/licenses/LICENSE +22 -0
- mlizard-0.0.1.dist-info/top_level.txt +1 -0
mlizard/__init__.py
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
import inspect
|
|
4
|
+
import keyword
|
|
5
|
+
|
|
6
|
+
from . import interpreter
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class MertCode:
|
|
10
|
+
_variables = {}
|
|
11
|
+
_auto = False
|
|
12
|
+
_python_globals = None
|
|
13
|
+
|
|
14
|
+
@staticmethod
|
|
15
|
+
def Auto(enabled=True):
|
|
16
|
+
"""Mert Code değişkenlerini Python'a otomatik aktarır."""
|
|
17
|
+
MertCode._auto = bool(enabled)
|
|
18
|
+
|
|
19
|
+
if MertCode._auto:
|
|
20
|
+
frame = inspect.currentframe().f_back
|
|
21
|
+
MertCode._python_globals = frame.f_globals
|
|
22
|
+
else:
|
|
23
|
+
MertCode._python_globals = None
|
|
24
|
+
|
|
25
|
+
@staticmethod
|
|
26
|
+
def Run(code):
|
|
27
|
+
"""Mert Code kodunu çalıştırır."""
|
|
28
|
+
MertCode._variables = interpreter.run(code, {})
|
|
29
|
+
|
|
30
|
+
if MertCode._auto and MertCode._python_globals is not None:
|
|
31
|
+
for name, value in MertCode._variables.items():
|
|
32
|
+
if name.isidentifier() and not keyword.iskeyword(name):
|
|
33
|
+
MertCode._python_globals[name] = value
|
|
34
|
+
|
|
35
|
+
return MertCode._variables
|
|
36
|
+
|
|
37
|
+
@staticmethod
|
|
38
|
+
def Convert(name=None):
|
|
39
|
+
"""Mert Code değişkenlerini Python değerlerine dönüştürür."""
|
|
40
|
+
if name is None:
|
|
41
|
+
return MertCode._variables.copy()
|
|
42
|
+
|
|
43
|
+
if name not in MertCode._variables:
|
|
44
|
+
raise KeyError(f"[{name}] adlı Mert Code değişkeni yok.")
|
|
45
|
+
|
|
46
|
+
return MertCode._variables[name]
|
mlizard/interpreter.py
ADDED
|
@@ -0,0 +1,517 @@
|
|
|
1
|
+
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
|
|
4
|
+
import ast
|
|
5
|
+
import operator
|
|
6
|
+
import re
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
AYARLAR = {
|
|
10
|
+
"yazi_buyuklugu": 16,
|
|
11
|
+
"yazi_rengi": "black",
|
|
12
|
+
"yazi_tipi": "Arial",
|
|
13
|
+
"yazi_arkaplan": None,
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
ISLEMLER = {
|
|
17
|
+
ast.Add: operator.add,
|
|
18
|
+
ast.Sub: operator.sub,
|
|
19
|
+
ast.Mult: operator.mul,
|
|
20
|
+
ast.Div: operator.truediv,
|
|
21
|
+
ast.FloorDiv: operator.floordiv,
|
|
22
|
+
ast.Mod: operator.mod,
|
|
23
|
+
ast.Pow: operator.pow,
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
KARSILASTIRMALAR = {
|
|
27
|
+
ast.Eq: operator.eq,
|
|
28
|
+
ast.NotEq: operator.ne,
|
|
29
|
+
ast.Gt: operator.gt,
|
|
30
|
+
ast.GtE: operator.ge,
|
|
31
|
+
ast.Lt: operator.lt,
|
|
32
|
+
ast.LtE: operator.le,
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
RENKLER = {
|
|
36
|
+
"kırmızı": "red",
|
|
37
|
+
"kirmizi": "red",
|
|
38
|
+
"mavi": "blue",
|
|
39
|
+
"yeşil": "green",
|
|
40
|
+
"yesil": "green",
|
|
41
|
+
"sarı": "yellow",
|
|
42
|
+
"sari": "yellow",
|
|
43
|
+
"siyah": "black",
|
|
44
|
+
"beyaz": "white",
|
|
45
|
+
"mor": "purple",
|
|
46
|
+
"turuncu": "orange",
|
|
47
|
+
"pembe": "pink",
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def remove_comment(line):
|
|
52
|
+
"""Tırnak içindeki yıldızları yorum olarak algılamaz."""
|
|
53
|
+
quote = None
|
|
54
|
+
escaped = False
|
|
55
|
+
i = 0
|
|
56
|
+
|
|
57
|
+
while i < len(line):
|
|
58
|
+
char = line[i]
|
|
59
|
+
|
|
60
|
+
if escaped:
|
|
61
|
+
escaped = False
|
|
62
|
+
i += 1
|
|
63
|
+
continue
|
|
64
|
+
|
|
65
|
+
if char == "\\" and quote:
|
|
66
|
+
escaped = True
|
|
67
|
+
i += 1
|
|
68
|
+
continue
|
|
69
|
+
|
|
70
|
+
if quote:
|
|
71
|
+
if char == quote:
|
|
72
|
+
quote = None
|
|
73
|
+
i += 1
|
|
74
|
+
continue
|
|
75
|
+
|
|
76
|
+
if char in ("'", '"'):
|
|
77
|
+
quote = char
|
|
78
|
+
i += 1
|
|
79
|
+
continue
|
|
80
|
+
|
|
81
|
+
if line.startswith("***", i):
|
|
82
|
+
return line[:i]
|
|
83
|
+
|
|
84
|
+
if line.startswith("**", i):
|
|
85
|
+
return line[:i]
|
|
86
|
+
|
|
87
|
+
i += 1
|
|
88
|
+
|
|
89
|
+
return line
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def safe_eval(node):
|
|
93
|
+
"""Yalnızca izin verilen matematik ve karşılaştırma işlemlerini yapar."""
|
|
94
|
+
if isinstance(node, ast.Constant):
|
|
95
|
+
if isinstance(node.value, (int, float, str, bool)):
|
|
96
|
+
return node.value
|
|
97
|
+
raise ValueError("Desteklenmeyen değer.")
|
|
98
|
+
|
|
99
|
+
if isinstance(node, ast.BinOp) and type(node.op) in ISLEMLER:
|
|
100
|
+
left = safe_eval(node.left)
|
|
101
|
+
right = safe_eval(node.right)
|
|
102
|
+
|
|
103
|
+
if isinstance(node.op, ast.Pow) and abs(right) > 100:
|
|
104
|
+
raise ValueError("Üs değeri çok büyük.")
|
|
105
|
+
|
|
106
|
+
return ISLEMLER[type(node.op)](left, right)
|
|
107
|
+
|
|
108
|
+
if isinstance(node, ast.UnaryOp):
|
|
109
|
+
value = safe_eval(node.operand)
|
|
110
|
+
|
|
111
|
+
if isinstance(node.op, ast.USub):
|
|
112
|
+
return -value
|
|
113
|
+
if isinstance(node.op, ast.UAdd):
|
|
114
|
+
return +value
|
|
115
|
+
if isinstance(node.op, ast.Not):
|
|
116
|
+
return not value
|
|
117
|
+
|
|
118
|
+
if isinstance(node, ast.Compare):
|
|
119
|
+
left = safe_eval(node.left)
|
|
120
|
+
|
|
121
|
+
for op, comparator in zip(
|
|
122
|
+
node.ops, node.comparators
|
|
123
|
+
):
|
|
124
|
+
right = safe_eval(comparator)
|
|
125
|
+
|
|
126
|
+
if type(op) not in KARSILASTIRMALAR:
|
|
127
|
+
raise ValueError("Desteklenmeyen karşılaştırma.")
|
|
128
|
+
|
|
129
|
+
if not KARSILASTIRMALAR[type(op)](left, right):
|
|
130
|
+
return False
|
|
131
|
+
|
|
132
|
+
left = right
|
|
133
|
+
|
|
134
|
+
return True
|
|
135
|
+
|
|
136
|
+
if isinstance(node, ast.BoolOp):
|
|
137
|
+
if isinstance(node.op, ast.And):
|
|
138
|
+
return all(safe_eval(v) for v in node.values)
|
|
139
|
+
|
|
140
|
+
if isinstance(node.op, ast.Or):
|
|
141
|
+
return any(safe_eval(v) for v in node.values)
|
|
142
|
+
|
|
143
|
+
raise ValueError("Geçersiz veya desteklenmeyen ifade.")
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
def calculate(expression, variables):
|
|
147
|
+
expression = expression.strip().replace("mod", "%")
|
|
148
|
+
|
|
149
|
+
def replace_variable(match):
|
|
150
|
+
name = match.group(1).strip()
|
|
151
|
+
|
|
152
|
+
if name not in variables:
|
|
153
|
+
raise KeyError(f"[{name}] değişkeni tanımlı değil.")
|
|
154
|
+
|
|
155
|
+
return repr(variables[name])
|
|
156
|
+
|
|
157
|
+
expression = re.sub(
|
|
158
|
+
r"\[([^\]]+)\]", replace_variable, expression
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
tree = ast.parse(expression, mode="eval")
|
|
162
|
+
return safe_eval(tree.body)
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
def get_value(expression, variables):
|
|
167
|
+
expression = expression.strip()
|
|
168
|
+
|
|
169
|
+
# Kullanıcıdan veri al
|
|
170
|
+
if expression == "Girdi":
|
|
171
|
+
value = input()
|
|
172
|
+
return convert_input(value)
|
|
173
|
+
|
|
174
|
+
if not expression:
|
|
175
|
+
return ""
|
|
176
|
+
|
|
177
|
+
# Değişken
|
|
178
|
+
if expression.startswith("[") and expression.endswith("]"):
|
|
179
|
+
name = expression[1:-1].strip()
|
|
180
|
+
|
|
181
|
+
if name not in variables:
|
|
182
|
+
raise KeyError(f"[{name}] değişkeni tanımlı değil.")
|
|
183
|
+
|
|
184
|
+
return variables[name]
|
|
185
|
+
|
|
186
|
+
# Sayı, matematik işlemi veya metin
|
|
187
|
+
try:
|
|
188
|
+
return calculate(expression, variables)
|
|
189
|
+
except (SyntaxError, ValueError, TypeError, ZeroDivisionError):
|
|
190
|
+
import ast
|
|
191
|
+
|
|
192
|
+
try:
|
|
193
|
+
return ast.literal_eval(expression)
|
|
194
|
+
except (ValueError, SyntaxError):
|
|
195
|
+
return expression
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
def convert_input(value):
|
|
199
|
+
"""Girdi değerini mümkünse sayıya dönüştürür."""
|
|
200
|
+
value = value.strip()
|
|
201
|
+
|
|
202
|
+
if value == "":
|
|
203
|
+
return ""
|
|
204
|
+
|
|
205
|
+
try:
|
|
206
|
+
return int(value)
|
|
207
|
+
except ValueError:
|
|
208
|
+
pass
|
|
209
|
+
|
|
210
|
+
try:
|
|
211
|
+
return float(value)
|
|
212
|
+
except ValueError:
|
|
213
|
+
pass
|
|
214
|
+
|
|
215
|
+
return value
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
def execute_simple(line, variables):
|
|
220
|
+
line = line.strip()
|
|
221
|
+
|
|
222
|
+
if not line:
|
|
223
|
+
return
|
|
224
|
+
|
|
225
|
+
# Eski ve yeni değişken tanımlama biçimleri
|
|
226
|
+
match = re.fullmatch(
|
|
227
|
+
r"Ayarla\.Değişken:\s*\[([^\]]+)\]\s*=\s*(.+)",
|
|
228
|
+
line,
|
|
229
|
+
)
|
|
230
|
+
|
|
231
|
+
if not match:
|
|
232
|
+
match = re.fullmatch(
|
|
233
|
+
r"\[([^\]]+)\]\s*=\s*(.+)",
|
|
234
|
+
line,
|
|
235
|
+
)
|
|
236
|
+
|
|
237
|
+
if match:
|
|
238
|
+
name = match.group(1).strip()
|
|
239
|
+
value = get_value(match.group(2), variables)
|
|
240
|
+
variables[name] = value
|
|
241
|
+
return
|
|
242
|
+
|
|
243
|
+
# Ekrana yazdırma
|
|
244
|
+
if line.startswith("Yaz:"):
|
|
245
|
+
content = line[4:].strip()
|
|
246
|
+
|
|
247
|
+
try:
|
|
248
|
+
print(get_value(content, variables))
|
|
249
|
+
except Exception:
|
|
250
|
+
# Yan yana yazılan metinleri ve değişkenleri destekle.
|
|
251
|
+
tokens = re.findall(
|
|
252
|
+
r'"(?:\\.|[^"\\])*"|'
|
|
253
|
+
r"'(?:\\.|[^'\\])*'|"
|
|
254
|
+
r"\[[^\]]+\]|\S+",
|
|
255
|
+
content,
|
|
256
|
+
)
|
|
257
|
+
|
|
258
|
+
output = []
|
|
259
|
+
|
|
260
|
+
for token in tokens:
|
|
261
|
+
output.append(str(get_value(token, variables)))
|
|
262
|
+
|
|
263
|
+
print("".join(output))
|
|
264
|
+
|
|
265
|
+
return
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
if line.startswith("Girdi:"):
|
|
269
|
+
name = line[6:].strip().strip("[]")
|
|
270
|
+
|
|
271
|
+
if not name:
|
|
272
|
+
raise ValueError("Girdi komutu için değişken adı gerekli.")
|
|
273
|
+
|
|
274
|
+
variables[name] = convert_input(input())
|
|
275
|
+
return
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
# Yazı ayarları
|
|
279
|
+
settings = {
|
|
280
|
+
"Yazı.Büyüklük:": "yazi_buyuklugu",
|
|
281
|
+
"Yazı.Renk:": "yazi_rengi",
|
|
282
|
+
"Yazı.Tip:": "yazi_tipi",
|
|
283
|
+
"Yazı.ArkaPlan:": "yazi_arkaplan",
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
for prefix, setting in settings.items():
|
|
287
|
+
if line.startswith(prefix):
|
|
288
|
+
value = get_value(line[len(prefix):], variables)
|
|
289
|
+
|
|
290
|
+
if setting == "yazi_rengi":
|
|
291
|
+
value = RENKLER.get(
|
|
292
|
+
str(value).lower(), value
|
|
293
|
+
)
|
|
294
|
+
|
|
295
|
+
AYARLAR[setting] = value
|
|
296
|
+
return
|
|
297
|
+
|
|
298
|
+
raise ValueError(f"Tanınmayan komut: {line}")
|
|
299
|
+
|
|
300
|
+
def parse_block(lines, index=0, expected_indent=0):
|
|
301
|
+
"""Eğer / Diğer koşul zincirlerini ve girintili blokları ayrıştırır."""
|
|
302
|
+
nodes = []
|
|
303
|
+
|
|
304
|
+
def get_indent(i):
|
|
305
|
+
return len(lines[i]) - len(lines[i].lstrip())
|
|
306
|
+
|
|
307
|
+
def parse_body(i, parent_indent, line_number):
|
|
308
|
+
while i < len(lines) and not lines[i].strip():
|
|
309
|
+
i += 1
|
|
310
|
+
|
|
311
|
+
if i >= len(lines) or get_indent(i) <= parent_indent:
|
|
312
|
+
raise SyntaxError(
|
|
313
|
+
f"{line_number}. satırın altında girintili kod bulunmalı."
|
|
314
|
+
)
|
|
315
|
+
|
|
316
|
+
return parse_block(lines, i, get_indent(i))
|
|
317
|
+
|
|
318
|
+
while index < len(lines):
|
|
319
|
+
raw = lines[index]
|
|
320
|
+
|
|
321
|
+
if not raw.strip():
|
|
322
|
+
index += 1
|
|
323
|
+
continue
|
|
324
|
+
|
|
325
|
+
indent = get_indent(index)
|
|
326
|
+
line = raw.strip()
|
|
327
|
+
|
|
328
|
+
if indent < expected_indent:
|
|
329
|
+
break
|
|
330
|
+
|
|
331
|
+
if indent > expected_indent:
|
|
332
|
+
raise SyntaxError(
|
|
333
|
+
f"{index + 1}. satırda beklenmeyen girinti."
|
|
334
|
+
)
|
|
335
|
+
|
|
336
|
+
if line == "Değilse" or line.startswith("Diğer"):
|
|
337
|
+
break
|
|
338
|
+
|
|
339
|
+
if line.startswith("Eğer "):
|
|
340
|
+
line_number = index + 1
|
|
341
|
+
condition = line[len("Eğer "):].strip()
|
|
342
|
+
|
|
343
|
+
if not condition:
|
|
344
|
+
raise SyntaxError(
|
|
345
|
+
f"{line_number}. satırda koşul eksik."
|
|
346
|
+
)
|
|
347
|
+
|
|
348
|
+
index += 1
|
|
349
|
+
body, index = parse_body(
|
|
350
|
+
index, expected_indent, line_number
|
|
351
|
+
)
|
|
352
|
+
|
|
353
|
+
branches = [(condition, body)]
|
|
354
|
+
else_seen = False
|
|
355
|
+
|
|
356
|
+
while index < len(lines):
|
|
357
|
+
while index < len(lines) and not lines[index].strip():
|
|
358
|
+
index += 1
|
|
359
|
+
|
|
360
|
+
if index >= len(lines):
|
|
361
|
+
break
|
|
362
|
+
|
|
363
|
+
if get_indent(index) != expected_indent:
|
|
364
|
+
break
|
|
365
|
+
|
|
366
|
+
next_line = lines[index].strip()
|
|
367
|
+
|
|
368
|
+
if next_line.startswith("Diğer "):
|
|
369
|
+
if else_seen:
|
|
370
|
+
raise SyntaxError(
|
|
371
|
+
"Değilse bloğundan sonra Diğer kullanılamaz."
|
|
372
|
+
)
|
|
373
|
+
|
|
374
|
+
other_condition = next_line[len("Diğer "):].strip()
|
|
375
|
+
|
|
376
|
+
if not other_condition:
|
|
377
|
+
raise SyntaxError(
|
|
378
|
+
f"{index + 1}. satırda Diğer koşulu eksik."
|
|
379
|
+
)
|
|
380
|
+
|
|
381
|
+
other_line_number = index + 1
|
|
382
|
+
index += 1
|
|
383
|
+
other_body, index = parse_body(
|
|
384
|
+
index, expected_indent, other_line_number
|
|
385
|
+
)
|
|
386
|
+
|
|
387
|
+
branches.append((other_condition, other_body))
|
|
388
|
+
continue
|
|
389
|
+
|
|
390
|
+
if next_line == "Değilse":
|
|
391
|
+
if else_seen:
|
|
392
|
+
raise SyntaxError(
|
|
393
|
+
"Bir koşul zincirinde yalnızca bir Değilse olabilir."
|
|
394
|
+
)
|
|
395
|
+
|
|
396
|
+
else_seen = True
|
|
397
|
+
else_line_number = index + 1
|
|
398
|
+
index += 1
|
|
399
|
+
else_body, index = parse_body(
|
|
400
|
+
index, expected_indent, else_line_number
|
|
401
|
+
)
|
|
402
|
+
|
|
403
|
+
branches.append((None, else_body))
|
|
404
|
+
continue
|
|
405
|
+
|
|
406
|
+
if next_line == "Diğer":
|
|
407
|
+
raise SyntaxError(
|
|
408
|
+
f"{index + 1}. satırda Diğer bir koşul almalı."
|
|
409
|
+
)
|
|
410
|
+
|
|
411
|
+
break
|
|
412
|
+
|
|
413
|
+
nodes.append((
|
|
414
|
+
"if_chain", branches, line_number
|
|
415
|
+
))
|
|
416
|
+
continue
|
|
417
|
+
|
|
418
|
+
if line.startswith("Tekrarla "):
|
|
419
|
+
line_number = index + 1
|
|
420
|
+
count = line[len("Tekrarla "):].strip()
|
|
421
|
+
index += 1
|
|
422
|
+
|
|
423
|
+
body, index = parse_body(
|
|
424
|
+
index, expected_indent, line_number
|
|
425
|
+
)
|
|
426
|
+
|
|
427
|
+
nodes.append(("repeat", count, body, line_number))
|
|
428
|
+
continue
|
|
429
|
+
|
|
430
|
+
if line == "Değilse":
|
|
431
|
+
raise SyntaxError(
|
|
432
|
+
f"{index + 1}. satırda Değilse için bir Eğer gerekli."
|
|
433
|
+
)
|
|
434
|
+
|
|
435
|
+
nodes.append(("line", line, index + 1))
|
|
436
|
+
index += 1
|
|
437
|
+
|
|
438
|
+
return nodes, index
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
def execute_nodes(nodes, variables):
|
|
442
|
+
for node in nodes:
|
|
443
|
+
kind = node[0]
|
|
444
|
+
|
|
445
|
+
try:
|
|
446
|
+
if kind == "line":
|
|
447
|
+
execute_simple(node[1], variables)
|
|
448
|
+
|
|
449
|
+
elif kind == "if_chain":
|
|
450
|
+
branches = node[1]
|
|
451
|
+
|
|
452
|
+
for condition, body in branches:
|
|
453
|
+
if condition is None or calculate(
|
|
454
|
+
condition, variables
|
|
455
|
+
):
|
|
456
|
+
execute_nodes(body, variables)
|
|
457
|
+
break
|
|
458
|
+
|
|
459
|
+
elif kind == "repeat":
|
|
460
|
+
_, count, body, _ = node
|
|
461
|
+
amount = int(get_value(count, variables))
|
|
462
|
+
|
|
463
|
+
if amount < 0:
|
|
464
|
+
raise ValueError(
|
|
465
|
+
"Tekrar sayısı negatif olamaz."
|
|
466
|
+
)
|
|
467
|
+
|
|
468
|
+
if amount > 100000:
|
|
469
|
+
raise ValueError(
|
|
470
|
+
"Tekrar sayısı çok büyük."
|
|
471
|
+
)
|
|
472
|
+
|
|
473
|
+
for _ in range(amount):
|
|
474
|
+
execute_nodes(body, variables)
|
|
475
|
+
|
|
476
|
+
except Exception as error:
|
|
477
|
+
line_number = node[-1]
|
|
478
|
+
|
|
479
|
+
raise RuntimeError(
|
|
480
|
+
f"{line_number}. satır: {error}"
|
|
481
|
+
) from error
|
|
482
|
+
|
|
483
|
+
def run(code, initial_variables=None):
|
|
484
|
+
variables = dict(initial_variables or {})
|
|
485
|
+
|
|
486
|
+
# Her çalıştırmada ayarları başlangıç durumuna getir.
|
|
487
|
+
AYARLAR.update({
|
|
488
|
+
"yazi_buyuklugu": 16,
|
|
489
|
+
"yazi_rengi": "black",
|
|
490
|
+
"yazi_tipi": "Arial",
|
|
491
|
+
"yazi_arkaplan": None,
|
|
492
|
+
})
|
|
493
|
+
|
|
494
|
+
lines = []
|
|
495
|
+
in_multiline_comment = False
|
|
496
|
+
|
|
497
|
+
for raw in code.splitlines():
|
|
498
|
+
stripped = raw.strip()
|
|
499
|
+
|
|
500
|
+
if stripped == "***":
|
|
501
|
+
in_multiline_comment = not in_multiline_comment
|
|
502
|
+
continue
|
|
503
|
+
|
|
504
|
+
if in_multiline_comment:
|
|
505
|
+
continue
|
|
506
|
+
|
|
507
|
+
line = remove_comment(raw)
|
|
508
|
+
|
|
509
|
+
if line.strip():
|
|
510
|
+
lines.append(line)
|
|
511
|
+
else:
|
|
512
|
+
lines.append("")
|
|
513
|
+
|
|
514
|
+
nodes, _ = parse_block(lines)
|
|
515
|
+
execute_nodes(nodes, variables)
|
|
516
|
+
|
|
517
|
+
return variables
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mlizard
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: A Python library for Mert Code and additional tools
|
|
5
|
+
Author: Pylizard
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Requires-Python: >=3.10
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Dynamic: license-file
|
|
11
|
+
|
|
12
|
+
# MLizard 🦎
|
|
13
|
+
|
|
14
|
+
MLizard, çeşitli araçların Python projelerinde çalıştırılmasını sağlamak için geliştirilen bir Python kütüphanesidir.
|
|
15
|
+
|
|
16
|
+
## Kurulum
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
python -m pip install MLizard
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Kullanım
|
|
23
|
+
|
|
24
|
+
```python
|
|
25
|
+
from mlizard import LibraryName
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Geliştirici
|
|
31
|
+
|
|
32
|
+
Pylizard tarafından geliştirilmektedir.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
mlizard/__init__.py,sha256=tmdmm5J9wCRk-nV7g6UXZfJgPVcJBUh2aJIwaJvbq44,1349
|
|
2
|
+
mlizard/interpreter.py,sha256=k0ERTI-ri9ZfF69u4RG-BHlxPYzqKNnwgjyjammnO4s,13605
|
|
3
|
+
mlizard-0.0.1.dist-info/licenses/LICENSE,sha256=b5f_EKetFbYR1QDEKbU1rD-D1qpb3Lz-VrU6V1L9oEk,1088
|
|
4
|
+
mlizard-0.0.1.dist-info/METADATA,sha256=QcfEAIO6eMkhcjsoo6YrAqTaMbboUJFN54EA9eGtw14,622
|
|
5
|
+
mlizard-0.0.1.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
6
|
+
mlizard-0.0.1.dist-info/top_level.txt,sha256=BJWUd80fovOwxsqweDFE_10uDoMmaZX7p_HLe3e3lDM,8
|
|
7
|
+
mlizard-0.0.1.dist-info/RECORD,,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
|
|
2
|
+
MIT License
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2026 PyLizard
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
mlizard
|