dshellInterpreter 1.2.0.9__tar.gz → 1.2.0.11__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.
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DshellInterpreteur/dshell_interpreter.py +8 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DshellParser/ast_nodes.py +20 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DshellParser/dshell_parser.py +13 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DshellTokenizer/dshell_keywords.py +1 -1
- {dshellinterpreter-1.2.0.9/dshellInterpreter.egg-info → dshellinterpreter-1.2.0.11}/PKG-INFO +1 -1
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11/dshellInterpreter.egg-info}/PKG-INFO +1 -1
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/setup.py +1 -1
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DISCORD_COMMANDS/__init__.py +0 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DISCORD_COMMANDS/dshell_channel.py +0 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DISCORD_COMMANDS/dshell_embed.py +0 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DISCORD_COMMANDS/dshell_file.py +0 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DISCORD_COMMANDS/dshell_interaction.py +0 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DISCORD_COMMANDS/dshell_member.py +0 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DISCORD_COMMANDS/dshell_message.py +0 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DISCORD_COMMANDS/dshell_pastbin.py +0 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DISCORD_COMMANDS/dshell_role.py +0 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DISCORD_COMMANDS/dshell_ui.py +0 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DISCORD_COMMANDS/utils/__init__.py +0 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DISCORD_COMMANDS/utils/utils_embed.py +0 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DISCORD_COMMANDS/utils/utils_file.py +0 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DISCORD_COMMANDS/utils/utils_global.py +0 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DISCORD_COMMANDS/utils/utils_list.py +0 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DISCORD_COMMANDS/utils/utils_member.py +0 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DISCORD_COMMANDS/utils/utils_message.py +0 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DISCORD_COMMANDS/utils/utils_numbers.py +0 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DISCORD_COMMANDS/utils/utils_permissions.py +0 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DISCORD_COMMANDS/utils/utils_string.py +0 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DISCORD_COMMANDS/utils/utils_thread.py +0 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DISCORD_COMMANDS/utils/utils_type_validation.py +0 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DshellInterpreteur/__init__.py +0 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DshellInterpreteur/cached_messages.py +0 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DshellInterpreteur/dshell_arguments.py +0 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DshellInterpreteur/dshell_global_variables.py +0 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DshellInterpreteur/dshell_scope.py +0 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DshellInterpreteur/errors.py +0 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DshellInterpreteur/utils_interpreter.py +0 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DshellParser/__init__.py +0 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DshellParser/errors.py +0 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DshellPreProcess/__init__.py +0 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DshellPreProcess/dshell_preprocess.py +0 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DshellTokenizer/__init__.py +0 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DshellTokenizer/dshell_token_type.py +0 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DshellTokenizer/dshell_tokenizer.py +0 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/__init__.py +0 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/full_import.py +0 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/regex_test.py +0 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/LICENSE +0 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/README.md +0 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/dshellInterpreter.egg-info/SOURCES.txt +0 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/dshellInterpreter.egg-info/dependency_links.txt +0 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/dshellInterpreter.egg-info/requires.txt +0 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/dshellInterpreter.egg-info/top_level.txt +0 -0
- {dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/setup.cfg +0 -0
|
@@ -52,6 +52,7 @@ class DshellInterpreteur:
|
|
|
52
52
|
self.env.update({
|
|
53
53
|
'__ret__': None, # environment variables, '__ret__' is used to store the return value of commands
|
|
54
54
|
'__loop__': None, # used to store the current loop variable in loop nodes if the loop identifier is not specified
|
|
55
|
+
'__break__': BoolNode(0), # used to break a loop
|
|
55
56
|
|
|
56
57
|
'__author__': IntNode(message.author.id),
|
|
57
58
|
'__author_name__': StrNode(message.author.name),
|
|
@@ -150,6 +151,13 @@ class DshellInterpreteur:
|
|
|
150
151
|
self.env.set(node.variable.name.value, i)
|
|
151
152
|
await self.execute(node.body)
|
|
152
153
|
|
|
154
|
+
if self.env.get('__break__'):
|
|
155
|
+
self.env.set('__break__', BoolNode(0))
|
|
156
|
+
break
|
|
157
|
+
|
|
158
|
+
async def _execute_break_node(self, node: BreakNode):
|
|
159
|
+
"""Execute a break node."""
|
|
160
|
+
self.env.set('__break__', BoolNode(1))
|
|
153
161
|
|
|
154
162
|
async def _execute_var_node(self, node: VarNode):
|
|
155
163
|
"""Execute a variable assignment node."""
|
|
@@ -17,6 +17,7 @@ __all__ = [
|
|
|
17
17
|
'ElifNode',
|
|
18
18
|
'IfNode',
|
|
19
19
|
'LoopNode',
|
|
20
|
+
'BreakNode',
|
|
20
21
|
'ArgsCommandNode',
|
|
21
22
|
'CommandNode',
|
|
22
23
|
'VarNode',
|
|
@@ -293,6 +294,25 @@ class LoopNode(ASTNode):
|
|
|
293
294
|
"body": [token.to_dict() for token in self.body]
|
|
294
295
|
}
|
|
295
296
|
|
|
297
|
+
class BreakNode(ASTNode):
|
|
298
|
+
"""
|
|
299
|
+
Node representing a break loop structure in the AST.
|
|
300
|
+
"""
|
|
301
|
+
|
|
302
|
+
def __init__(self, line: int):
|
|
303
|
+
super().__init__(line)
|
|
304
|
+
|
|
305
|
+
def __repr__(self):
|
|
306
|
+
return "<Break>"
|
|
307
|
+
|
|
308
|
+
def to_dict(self):
|
|
309
|
+
"""
|
|
310
|
+
Convert the BreakNode to a dictionary representation.
|
|
311
|
+
:return:
|
|
312
|
+
"""
|
|
313
|
+
return {
|
|
314
|
+
"type": "Break",
|
|
315
|
+
}
|
|
296
316
|
|
|
297
317
|
class ArgsCommandNode(ASTNode):
|
|
298
318
|
"""
|
{dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DshellParser/dshell_parser.py
RENAMED
|
@@ -133,6 +133,19 @@ def parse(token_lines: list[list[Token]], start_node: ASTNode) -> tuple[list[AST
|
|
|
133
133
|
blocks.pop()
|
|
134
134
|
return blocks, pointer # return the parsed information to the last opened loop
|
|
135
135
|
|
|
136
|
+
elif first_token_line == 'break':
|
|
137
|
+
last_loop_block = None
|
|
138
|
+
|
|
139
|
+
for i in blocks:
|
|
140
|
+
if isinstance(i, LoopNode):
|
|
141
|
+
last_loop_block = i
|
|
142
|
+
|
|
143
|
+
if last_loop_block is None:
|
|
144
|
+
raise SyntaxError(f'[BREAK] No loop open on line {first_token_line.position} !')
|
|
145
|
+
|
|
146
|
+
break_node = BreakNode(line=line)
|
|
147
|
+
last_loop_block.body.append(break_node)
|
|
148
|
+
|
|
136
149
|
elif first_token_line.value == 'var':
|
|
137
150
|
if len(tokens_by_line) <= 2:
|
|
138
151
|
raise SyntaxError(f'[VAR] Take two arguments on line {first_token_line.position} !')
|
{dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DshellTokenizer/dshell_keywords.py
RENAMED
|
@@ -14,7 +14,7 @@ from Dshell.full_import import Callable
|
|
|
14
14
|
from ..DISCORD_COMMANDS.dshell_file import dshell_read_file, dshell_write_file, dshell_get_message_files
|
|
15
15
|
|
|
16
16
|
dshell_keyword: set[str] = {
|
|
17
|
-
'if', 'else', 'elif', 'loop', '#end', 'var', '#loop', '#if', 'sleep', 'param', '#param', 'code', '#code', 'eval', 'return'
|
|
17
|
+
'if', 'else', 'elif', 'loop', '#end', 'var', '#loop', '#if', 'sleep', 'param', '#param', 'code', '#code', 'eval', 'return', 'break'
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
dshell_discord_keyword: set[str] = {
|
|
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
|
|
|
5
5
|
|
|
6
6
|
setup(
|
|
7
7
|
name="dshellInterpreter",
|
|
8
|
-
version="1.2.0.
|
|
8
|
+
version="1.2.0.11",
|
|
9
9
|
author="Chronos",
|
|
10
10
|
author_email="vagabonwalybi@gmail.com",
|
|
11
11
|
description="A Discord bot interpreter for creating custom commands and automations.",
|
{dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DISCORD_COMMANDS/__init__.py
RENAMED
|
File without changes
|
{dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DISCORD_COMMANDS/dshell_channel.py
RENAMED
|
File without changes
|
{dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DISCORD_COMMANDS/dshell_embed.py
RENAMED
|
File without changes
|
{dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DISCORD_COMMANDS/dshell_file.py
RENAMED
|
File without changes
|
|
File without changes
|
{dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DISCORD_COMMANDS/dshell_member.py
RENAMED
|
File without changes
|
{dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DISCORD_COMMANDS/dshell_message.py
RENAMED
|
File without changes
|
{dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DISCORD_COMMANDS/dshell_pastbin.py
RENAMED
|
File without changes
|
{dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DISCORD_COMMANDS/dshell_role.py
RENAMED
|
File without changes
|
{dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DISCORD_COMMANDS/dshell_ui.py
RENAMED
|
File without changes
|
{dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DISCORD_COMMANDS/utils/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DISCORD_COMMANDS/utils/utils_file.py
RENAMED
|
File without changes
|
|
File without changes
|
{dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DISCORD_COMMANDS/utils/utils_list.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DshellInterpreteur/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DshellInterpreteur/dshell_scope.py
RENAMED
|
File without changes
|
{dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DshellInterpreteur/errors.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DshellPreProcess/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DshellTokenizer/dshell_token_type.py
RENAMED
|
File without changes
|
{dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/Dshell/DshellTokenizer/dshell_tokenizer.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/dshellInterpreter.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/dshellInterpreter.egg-info/requires.txt
RENAMED
|
File without changes
|
{dshellinterpreter-1.2.0.9 → dshellinterpreter-1.2.0.11}/dshellInterpreter.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|