dshellInterpreter 1.2.5.0__tar.gz → 1.2.7.1__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 (54) hide show
  1. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/Dshell/DISCORD_COMMANDS/utils/utils_global.py +1 -1
  2. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/Dshell/DshellInterpreteur/dshell_interpreter.py +17 -3
  3. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/Dshell/DshellParser/ast_nodes.py +50 -1
  4. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/Dshell/DshellParser/dshell_parser.py +49 -27
  5. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/Dshell/DshellTokenizer/dshell_keywords.py +5 -2
  6. {dshellinterpreter-1.2.5.0/dshellInterpreter.egg-info → dshellinterpreter-1.2.7.1}/PKG-INFO +1 -1
  7. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1/dshellInterpreter.egg-info}/PKG-INFO +1 -1
  8. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/dshellInterpreter.egg-info/SOURCES.txt +0 -1
  9. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/setup.py +1 -1
  10. dshellinterpreter-1.2.5.0/Dshell/regex_test.py +0 -3
  11. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/Dshell/DISCORD_COMMANDS/__init__.py +0 -0
  12. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/Dshell/DISCORD_COMMANDS/dshell_channel.py +0 -0
  13. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/Dshell/DISCORD_COMMANDS/dshell_embed.py +0 -0
  14. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/Dshell/DISCORD_COMMANDS/dshell_file.py +0 -0
  15. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/Dshell/DISCORD_COMMANDS/dshell_interaction.py +0 -0
  16. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/Dshell/DISCORD_COMMANDS/dshell_member.py +0 -0
  17. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/Dshell/DISCORD_COMMANDS/dshell_message.py +0 -0
  18. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/Dshell/DISCORD_COMMANDS/dshell_pastbin.py +0 -0
  19. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/Dshell/DISCORD_COMMANDS/dshell_role.py +0 -0
  20. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/Dshell/DISCORD_COMMANDS/dshell_ui.py +0 -0
  21. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/Dshell/DISCORD_COMMANDS/utils/__init__.py +0 -0
  22. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/Dshell/DISCORD_COMMANDS/utils/utils_embed.py +0 -0
  23. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/Dshell/DISCORD_COMMANDS/utils/utils_file.py +0 -0
  24. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/Dshell/DISCORD_COMMANDS/utils/utils_list.py +0 -0
  25. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/Dshell/DISCORD_COMMANDS/utils/utils_member.py +0 -0
  26. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/Dshell/DISCORD_COMMANDS/utils/utils_message.py +0 -0
  27. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/Dshell/DISCORD_COMMANDS/utils/utils_numbers.py +0 -0
  28. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/Dshell/DISCORD_COMMANDS/utils/utils_permissions.py +0 -0
  29. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/Dshell/DISCORD_COMMANDS/utils/utils_string.py +0 -0
  30. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/Dshell/DISCORD_COMMANDS/utils/utils_thread.py +0 -0
  31. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/Dshell/DISCORD_COMMANDS/utils/utils_type_validation.py +0 -0
  32. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/Dshell/DshellInterpreteur/__init__.py +0 -0
  33. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/Dshell/DshellInterpreteur/cached_messages.py +0 -0
  34. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/Dshell/DshellInterpreteur/dshell_arguments.py +0 -0
  35. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/Dshell/DshellInterpreteur/dshell_global_variables.py +0 -0
  36. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/Dshell/DshellInterpreteur/dshell_iterators.py +0 -0
  37. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/Dshell/DshellInterpreteur/dshell_scope.py +0 -0
  38. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/Dshell/DshellInterpreteur/errors.py +0 -0
  39. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/Dshell/DshellInterpreteur/utils_interpreter.py +0 -0
  40. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/Dshell/DshellParser/__init__.py +0 -0
  41. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/Dshell/DshellParser/errors.py +0 -0
  42. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/Dshell/DshellPreProcess/__init__.py +0 -0
  43. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/Dshell/DshellPreProcess/dshell_preprocess.py +0 -0
  44. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/Dshell/DshellTokenizer/__init__.py +0 -0
  45. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/Dshell/DshellTokenizer/dshell_token_type.py +0 -0
  46. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/Dshell/DshellTokenizer/dshell_tokenizer.py +0 -0
  47. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/Dshell/__init__.py +0 -0
  48. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/Dshell/full_import.py +0 -0
  49. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/LICENSE +0 -0
  50. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/README.md +0 -0
  51. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/dshellInterpreter.egg-info/dependency_links.txt +0 -0
  52. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/dshellInterpreter.egg-info/requires.txt +0 -0
  53. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/dshellInterpreter.egg-info/top_level.txt +0 -0
  54. {dshellinterpreter-1.2.5.0 → dshellinterpreter-1.2.7.1}/setup.cfg +0 -0
@@ -67,7 +67,7 @@ async def utils_help(ctx: Message, command: StrNode) -> StrNode:
67
67
  raise ValueError(f"[HELP] command not found : '{command}'")
68
68
 
69
69
  sig = signature(dshell_commands[command])
70
- result = StrNode("## HELP `{command}`")
70
+ result = StrNode(f"## HELP `{command}`")
71
71
 
72
72
  for nom, param in sig.parameters.items():
73
73
  if nom == "ctx":
@@ -220,6 +220,16 @@ class DshellInterpreteur:
220
220
 
221
221
  await sleep(sleep_time)
222
222
 
223
+ async def _execute_catch_node(self, node: CatchNode):
224
+ """Execute a catch node."""
225
+ try:
226
+ await self.execute(node.body)
227
+ except Exception as e:
228
+ if self.end_program:
229
+ raise Exception(e)
230
+ self.env.set(node.variable.value, StrNode(e))
231
+ self.raise_error = False
232
+
223
233
  async def execute(self, ast: Optional[list[All_nodes]] = None):
224
234
  """
225
235
  Executes the abstract syntax tree (AST) generated from the Dshell code.
@@ -263,6 +273,9 @@ class DshellInterpreteur:
263
273
  elif isinstance(node, BreakNode):
264
274
  await self._execute_break_node(node)
265
275
 
276
+ elif isinstance(node, CatchNode):
277
+ await self._execute_catch_node(node)
278
+
266
279
  elif isinstance(node, VarNode):
267
280
  await self._execute_var_node(node)
268
281
 
@@ -270,17 +283,18 @@ class DshellInterpreteur:
270
283
  await self._execute_sleep_node(node)
271
284
 
272
285
  elif isinstance(node, EvalNode):
273
-
274
286
  self.env.set('__ret__', await eval_CodeNode(node, self))
275
287
 
276
288
  elif isinstance(node, ReturnNode):
277
289
  self.env.set('__ret__', await eval_expression(node.body, self))
278
290
 
291
+ elif isinstance(node, RaiseNode):
292
+ raise Exception(StrNode(await eval_expression(node.error, self)))
293
+
279
294
  elif isinstance(node, EndNode):
295
+ self.end_program = True
280
296
  if await self.eval_data_token(node.error_message):
281
297
  raise RuntimeError("Execution stopped - EndNode encountered")
282
- else:
283
- self.end_program = True
284
298
 
285
299
  except Exception as e:
286
300
  if not self.raise_error:
@@ -36,7 +36,9 @@ __all__ = [
36
36
  'UiSelectNode',
37
37
  'OptionUiSelectNode',
38
38
  'FileNode',
39
- 'FileStreamNode'
39
+ 'FileStreamNode',
40
+ 'CatchNode',
41
+ 'RaiseNode'
40
42
  ]
41
43
 
42
44
 
@@ -581,6 +583,53 @@ class SleepNode(ASTNode):
581
583
  "body": [token.to_dict() for token in self.body]
582
584
  }
583
585
 
586
+
587
+ class CatchNode(ASTNode):
588
+ """
589
+ Node representing a "try-except" python-like in Dshell.
590
+ """
591
+ def __init__(self, body: list[Token], variable: Token, line: int):
592
+ super().__init__(line)
593
+ self.body = body
594
+ self.variable = variable
595
+
596
+ def __repr__(self):
597
+ return StrNode(f"<CATCH> - line {self.start_line} to {self.end_line}")
598
+
599
+ def to_dict(self):
600
+ """
601
+ Convert the EvalGroupNode to a dictionary representation.
602
+ :return: Dictionary representation of the EvalGroupNode.
603
+ """
604
+ return {
605
+ "type": "CatchNode",
606
+ "variable": self.variable,
607
+ "body": [token.to_dict() for token in self.body]
608
+ }
609
+
610
+
611
+ class RaiseNode(ASTNode):
612
+ """
613
+ Node representing an Ecxeption raised by the user.
614
+ """
615
+ def __init__(self, error: list[Token], line: int):
616
+ super().__init__(line)
617
+ self.error = error
618
+
619
+ def __repr__(self):
620
+ return f"<RAISE> - {self.error}"
621
+
622
+ def to_dict(self):
623
+ """
624
+ Convert the RaiseNode to a dictionary representation.
625
+ :return: Dictionary representation of the EvalGroupNode.
626
+ """
627
+ return {
628
+ "type": "RaiseNode",
629
+ "error": self.error,
630
+ }
631
+
632
+
584
633
  class EvalGroupNode(ASTNode):
585
634
  """
586
635
  Node representing a group of evaluations in the AST.
@@ -28,20 +28,21 @@ def parse(token_lines: list[list[Token]], start_node: ASTNode) -> tuple[list[AST
28
28
  len_tokens_by_line = len(tokens_by_line)
29
29
  len_tokens_by_line_since_command_name = len_tokens_by_line - 1
30
30
  first_token_line = tokens_by_line[0] # get the first token of the line
31
+ first_token_line_value = first_token_line.value
31
32
  last_block = blocks[-1]
32
33
 
33
34
  line = first_token_line.position[0]
34
35
 
35
36
  if first_token_line.type == DTT.COMMAND: # if the token is a command
36
37
  body = tokens_by_line[1:] # get its arguments
37
- last_block.body.append(CommandNode(first_token_line.value,
38
+ last_block.body.append(CommandNode(first_token_line_value,
38
39
  ArgsCommandNode(body, line=line), line=line)) # add the command to the last block's body
39
40
 
40
41
  ############################## DSHELL KEYWORDS ##############################
41
42
 
42
43
  elif first_token_line.type == DTT.KEYWORD: # if it's a keyword
43
44
 
44
- if first_token_line.value == 'if': # if it's a condition
45
+ if first_token_line_value == 'if': # if it's a condition
45
46
  if len_tokens_by_line_since_command_name <= 0:
46
47
  raise SyntaxError(f'[IF] Take one or more arguments on line {first_token_line.position} !')
47
48
 
@@ -52,7 +53,7 @@ def parse(token_lines: list[list[Token]], start_node: ASTNode) -> tuple[list[AST
52
53
  if_node) # parse the rest of the code with if_node as the start of the new parsing
53
54
  pointer += p + 1 # essential to not parse already processed lines
54
55
 
55
- elif first_token_line.value == '#if':
56
+ elif first_token_line_value == '#if':
56
57
  if not isinstance(last_block, (IfNode, ElseNode, ElifNode)):
57
58
  raise SyntaxError(f'[#IF] No conditional bloc open on line {first_token_line.position} !')
58
59
 
@@ -64,7 +65,7 @@ def parse(token_lines: list[list[Token]], start_node: ASTNode) -> tuple[list[AST
64
65
  blocks.pop()
65
66
  return blocks, pointer
66
67
 
67
- elif first_token_line.value == 'elif':
68
+ elif first_token_line_value == 'elif':
68
69
  if not isinstance(last_block, (IfNode, ElifNode)):
69
70
  raise SyntaxError(f'[ELIF] No conditional bloc open on line {first_token_line.position} !')
70
71
  if len_tokens_by_line_since_command_name <= 0:
@@ -81,7 +82,7 @@ def parse(token_lines: list[list[Token]], start_node: ASTNode) -> tuple[list[AST
81
82
  last_block.elif_nodes.append(elif_node)
82
83
  blocks.append(elif_node)
83
84
 
84
- elif first_token_line.value == 'else':
85
+ elif first_token_line_value == 'else':
85
86
  if not isinstance(last_block, (IfNode, ElifNode)):
86
87
  raise SyntaxError(f'[ELSE] No conditional bloc open on line {first_token_line.position} !')
87
88
 
@@ -95,7 +96,7 @@ def parse(token_lines: list[list[Token]], start_node: ASTNode) -> tuple[list[AST
95
96
  last_block.else_body = else_node # once parsing is done, add it to the last block
96
97
  blocks.append(else_node)
97
98
 
98
- elif first_token_line.value == 'loop':
99
+ elif first_token_line_value == 'loop':
99
100
 
100
101
  if len_tokens_by_line <= 1:
101
102
  raise SyntaxError(f'[LOOP] Take one (or two) argument(s) on line {first_token_line.position} !')
@@ -126,19 +127,19 @@ def parse(token_lines: list[list[Token]], start_node: ASTNode) -> tuple[list[AST
126
127
  loop_node) # parse everything after the loop instruction
127
128
  pointer += p + 1
128
129
 
129
- elif first_token_line.value == '#loop': # if encountered
130
+ elif first_token_line_value == '#loop': # if encountered
130
131
  if not isinstance(last_block, LoopNode):
131
132
  raise SyntaxError(f'[#LOOP] No loop open on line {first_token_line.position} !')
132
133
 
133
134
  blocks.pop()
134
135
  return blocks, pointer # return the parsed information to the last opened loop
135
136
 
136
- elif first_token_line.value == 'break':
137
+ elif first_token_line_value == 'break':
137
138
 
138
139
  break_node = BreakNode(line=line)
139
140
  last_block.body.append(break_node)
140
141
 
141
- elif first_token_line.value == 'var':
142
+ elif first_token_line_value == 'var':
142
143
  if len(tokens_by_line) <= 2:
143
144
  raise SyntaxError(f'[VAR] Take two arguments on line {first_token_line.position} !')
144
145
  if tokens_by_line[1].type != DTT.IDENT:
@@ -155,7 +156,7 @@ def parse(token_lines: list[list[Token]], start_node: ASTNode) -> tuple[list[AST
155
156
  # var_node.body = parse(result, StartNode([]))[0][0].body
156
157
  var_node.body = result[0]
157
158
 
158
- elif first_token_line.value == 'sleep':
159
+ elif first_token_line_value == 'sleep':
159
160
  if len(tokens_by_line) <= 1:
160
161
  raise SyntaxError(f'[SLEEP] Take one arguments on line {first_token_line.position} !')
161
162
  if tokens_by_line[1].type != DTT.INT:
@@ -165,21 +166,21 @@ def parse(token_lines: list[list[Token]], start_node: ASTNode) -> tuple[list[AST
165
166
  sleep_node = SleepNode(tokens_by_line[1:], line=line)
166
167
  last_block.body.append(sleep_node)
167
168
 
168
- elif first_token_line.value == 'param':
169
+ elif first_token_line_value == 'param':
169
170
 
170
171
  param_node = ParamNode(body=[], line=line)
171
172
  last_block.body.append(param_node)
172
173
  _, p = parse(token_lines[pointer + 1:], param_node)
173
174
  pointer += p + 1 # advance the pointer to the next line
174
175
 
175
- elif first_token_line.value == '#param':
176
+ elif first_token_line_value == '#param':
176
177
  if not isinstance(last_block, ParamNode):
177
178
  raise SyntaxError(f'[#PARAM] No parameters open on line {first_token_line.position} !')
178
179
 
179
180
  blocks.pop() # remove the last block (the parameter)
180
181
  return blocks, pointer # return the parsed information to the last opened parameter
181
182
 
182
- elif first_token_line.value == 'code':
183
+ elif first_token_line_value == 'code':
183
184
 
184
185
  if len(tokens_by_line) < 2:
185
186
  raise SyntaxError(f"[CODE] take one argument on line {first_token_line.position}")
@@ -194,14 +195,14 @@ def parse(token_lines: list[list[Token]], start_node: ASTNode) -> tuple[list[AST
194
195
  _, p = parse(token_lines[pointer + 1:], code_node)
195
196
  pointer += p + 1
196
197
 
197
- elif first_token_line.value == '#code':
198
+ elif first_token_line_value == '#code':
198
199
  if not isinstance(last_block, CodeNode):
199
200
  raise SyntaxError(f"[#CODE] No code open on line {first_token_line.position}")
200
201
 
201
202
  blocks.pop()
202
203
  return blocks, pointer
203
204
 
204
- elif first_token_line.value == 'eval':
205
+ elif first_token_line_value == 'eval':
205
206
  if len_tokens_by_line_since_command_name < 1:
206
207
  raise SyntaxError(f"[EVAL] take one or more arguments on line {first_token_line.position}")
207
208
 
@@ -212,7 +213,7 @@ def parse(token_lines: list[list[Token]], start_node: ASTNode) -> tuple[list[AST
212
213
  eval_node = EvalNode(codeNode=tokens_by_line[1], argsNode=ArgsCommandNode(tokens_by_line[2:], line=line), line=line)
213
214
  last_block.body.append(eval_node)
214
215
 
215
- elif first_token_line.value == 'return':
216
+ elif first_token_line_value == 'return':
216
217
  if not isinstance(last_block, CodeNode):
217
218
  raise SyntaxError(f"[RETURN] No code open on line {first_token_line.position} !")
218
219
  if len_tokens_by_line_since_command_name < 1:
@@ -220,8 +221,29 @@ def parse(token_lines: list[list[Token]], start_node: ASTNode) -> tuple[list[AST
220
221
 
221
222
  return_node = ReturnNode(body=tokens_by_line[1:], line=line)
222
223
  last_block.body.append(return_node)
224
+
225
+ elif first_token_line_value == 'catch':
226
+ if len_tokens_by_line_since_command_name > 0:
227
+ if tokens_by_line[1].type != DTT.IDENT:
228
+ raise TypeError(f'[CATCH] the variable given must be an ident, not {tokens_by_line[1].type}')
229
+ catch_node = CatchNode(body=[], variable=tokens_by_line[1], line=line)
230
+ last_block.body.append(catch_node)
231
+ _, p = parse(token_lines[pointer + 1:], catch_node)
232
+ pointer += p + 1
233
+
234
+ elif first_token_line_value == '#catch':
235
+ if not isinstance(last_block, CatchNode):
236
+ raise Exception(f'[#CATCH] not catch open on line {first_token_line.position}')
237
+
238
+ blocks.pop()
239
+ return blocks, pointer
240
+
241
+ elif first_token_line_value == 'raise':
242
+
243
+ raise_node = RaiseNode(tokens_by_line[1:], line=line)
244
+ last_block.body.append(raise_node)
223
245
 
224
- elif first_token_line.value == '#end': # node pour arrêter le programme si elle est rencontré
246
+ elif first_token_line_value == '#end': # node pour arrêter le programme si elle est rencontré
225
247
  error_message = BoolNode(1)
226
248
  if len_tokens_by_line_since_command_name > 0:
227
249
  if tokens_by_line[1].type != DTT.BOOL:
@@ -235,7 +257,7 @@ def parse(token_lines: list[list[Token]], start_node: ASTNode) -> tuple[list[AST
235
257
 
236
258
  elif first_token_line.type == DTT.DISCORD_KEYWORD:
237
259
 
238
- if first_token_line.value == 'embed':
260
+ if first_token_line_value == 'embed':
239
261
  if len_tokens_by_line_since_command_name <= 0:
240
262
  raise SyntaxError(f'[EMBED] Take one or more arguments on line {first_token_line.position} !')
241
263
  if tokens_by_line[1].type != DTT.IDENT:
@@ -248,13 +270,13 @@ def parse(token_lines: list[list[Token]], start_node: ASTNode) -> tuple[list[AST
248
270
  _, p = parse(token_lines[pointer + 1:], embed_node)
249
271
  pointer += p + 1
250
272
 
251
- elif first_token_line.value == '#embed':
273
+ elif first_token_line_value == '#embed':
252
274
  if not isinstance(last_block, ConstructEmbedNode):
253
275
  raise SyntaxError(f'[#EMBED] No embed open on line {first_token_line.position} !')
254
276
  blocks.pop()
255
277
  return blocks, pointer
256
278
 
257
- elif first_token_line.value == 'field':
279
+ elif first_token_line_value == 'field':
258
280
  if len_tokens_by_line_since_command_name <= 0:
259
281
  raise SyntaxError(f'[FIELD] Take one or more arguments on line {first_token_line.position} !')
260
282
  if not isinstance(last_block, EmbedNode):
@@ -262,7 +284,7 @@ def parse(token_lines: list[list[Token]], start_node: ASTNode) -> tuple[list[AST
262
284
 
263
285
  last_block.fields.append(FieldEmbedNode(tokens_by_line[1:], line=line))
264
286
 
265
- elif first_token_line.value in ('perm', 'permission'):
287
+ elif first_token_line_value in ('perm', 'permission'):
266
288
  if len_tokens_by_line_since_command_name <= 0:
267
289
  raise SyntaxError(f'[PERM] Take one argument on line {first_token_line.position} !')
268
290
  if tokens_by_line[1].type != DTT.IDENT:
@@ -275,13 +297,13 @@ def parse(token_lines: list[list[Token]], start_node: ASTNode) -> tuple[list[AST
275
297
  _, p = parse(token_lines[pointer + 1:], perm_node)
276
298
  pointer += p + 1
277
299
 
278
- elif first_token_line.value in ('#perm', '#permission'):
300
+ elif first_token_line_value in ('#perm', '#permission'):
279
301
  if not isinstance(last_block, ConstructPermissionNode):
280
302
  raise SyntaxError(f'[#PERM] No permission open on line {first_token_line.position} !')
281
303
  blocks.pop()
282
304
  return blocks, pointer
283
305
 
284
- elif first_token_line.value == 'button':
306
+ elif first_token_line_value == 'button':
285
307
  if len_tokens_by_line_since_command_name <= 0:
286
308
  raise SyntaxError(f'[BUTTON] Take one or more arguments on line {first_token_line.position} !')
287
309
  if tokens_by_line[1].type != DTT.IDENT:
@@ -294,13 +316,13 @@ def parse(token_lines: list[list[Token]], start_node: ASTNode) -> tuple[list[AST
294
316
  _, p = parse(token_lines[pointer + 1:], button_node)
295
317
  pointer += p + 1
296
318
 
297
- elif first_token_line.value == '#button':
319
+ elif first_token_line_value == '#button':
298
320
  if not isinstance(last_block, UiButtonNode):
299
321
  raise SyntaxError(f'[#BUTTON] No UIButton open on line {first_token_line.position} !')
300
322
  blocks.pop()
301
323
  return blocks, pointer
302
324
 
303
- elif first_token_line.value == 'select':
325
+ elif first_token_line_value == 'select':
304
326
  if len_tokens_by_line_since_command_name <= 0:
305
327
  raise SyntaxError(f'[SELECT] Take one or more arguments on line {first_token_line.position} !')
306
328
  if tokens_by_line[1].type != DTT.IDENT:
@@ -313,13 +335,13 @@ def parse(token_lines: list[list[Token]], start_node: ASTNode) -> tuple[list[AST
313
335
  _, p = parse(token_lines[pointer + 1:], select_node)
314
336
  pointer += p + 1
315
337
 
316
- elif first_token_line.value == '#select':
338
+ elif first_token_line_value == '#select':
317
339
  if not isinstance(last_block, UiSelectNode):
318
340
  raise SyntaxError(f'[#SELECT] No UISelect open on line {first_token_line.position} !')
319
341
  blocks.pop()
320
342
  return blocks, pointer
321
343
 
322
- elif first_token_line.value == 'option':
344
+ elif first_token_line_value == 'option':
323
345
  if len_tokens_by_line_since_command_name <= 0:
324
346
  raise SyntaxError(f'[OPTION] Take one or more arguments on line {first_token_line.position} !')
325
347
  if not isinstance(last_block, UiSelectNode):
@@ -14,11 +14,14 @@ from ..full_import import Callable
14
14
  from ..DshellInterpreteur.dshell_iterators import IntIterator
15
15
 
16
16
  dshell_keyword: set[str] = {
17
- 'if', 'else', 'elif', 'loop', '#end', 'var', '#loop', '#if', 'sleep', 'param', '#param', 'code', '#code', 'eval', 'return', 'break'
17
+ 'if', 'else', 'elif', 'loop', '#end', 'var', '#loop', '#if', 'sleep',
18
+ 'param', '#param', 'code', '#code', 'eval', 'return', 'break',
19
+ 'catch', '#catch', 'raise'
18
20
  }
19
21
 
20
22
  dshell_discord_keyword: set[str] = {
21
- 'embed', '#embed', 'field', 'perm', 'permission', '#perm', '#permission', 'ui', '#ui', 'button', '#button', 'select', '#select', 'option'
23
+ 'embed', '#embed', 'field', 'perm', 'permission', '#perm', '#permission', 'ui', '#ui',
24
+ 'button', '#button', 'select', '#select', 'option'
22
25
  }
23
26
 
24
27
  async def dshell_debug(ctx, x):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dshellInterpreter
3
- Version: 1.2.5.0
3
+ Version: 1.2.7.1
4
4
  Summary: A Discord bot interpreter for creating custom commands and automations.
5
5
  Home-page: https://github.com/BOXERRMD/Dshell_Interpreter
6
6
  Author: Chronos
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dshellInterpreter
3
- Version: 1.2.5.0
3
+ Version: 1.2.7.1
4
4
  Summary: A Discord bot interpreter for creating custom commands and automations.
5
5
  Home-page: https://github.com/BOXERRMD/Dshell_Interpreter
6
6
  Author: Chronos
@@ -3,7 +3,6 @@ README.md
3
3
  setup.py
4
4
  Dshell/__init__.py
5
5
  Dshell/full_import.py
6
- Dshell/regex_test.py
7
6
  Dshell/DISCORD_COMMANDS/__init__.py
8
7
  Dshell/DISCORD_COMMANDS/dshell_channel.py
9
8
  Dshell/DISCORD_COMMANDS/dshell_embed.py
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
5
5
 
6
6
  setup(
7
7
  name="dshellInterpreter",
8
- version="1.2.5.0",
8
+ version="1.2.7.1",
9
9
  author="Chronos",
10
10
  author_email="vagabonwalybi@gmail.com",
11
11
  description="A Discord bot interpreter for creating custom commands and automations.",
@@ -1,3 +0,0 @@
1
- from re import sub, search
2
-
3
- print(sub(f"(?<![a-zA-Z])p(?![a-zA-Z])", "debug", "{p*2}"))