dshellInterpreter 0.2.13.16__py3-none-any.whl → 0.2.13.17__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.

Potentially problematic release.


This version of dshellInterpreter might be problematic. Click here for more details.

@@ -51,6 +51,8 @@ def parse(token_lines: list[list[Token]], start_node: ASTNode) -> tuple[list[AST
51
51
  last_block = blocks[-1]
52
52
 
53
53
  if first_token_line.type == DTT.COMMAND: # si le token est une comande
54
+ if len(tokens_by_line) <= 1:
55
+ raise Exception(f'[{first_token_line.value.upper()}] take one or more arguments on line {first_token_line.position} !')
54
56
  body = tokens_by_line[1:] # on récupère ses arguments
55
57
  last_block.body.append(CommandNode(first_token_line.value,
56
58
  ArgsCommandNode(body))) # on ajoute la commande au body du dernier bloc
@@ -62,6 +64,7 @@ def parse(token_lines: list[list[Token]], start_node: ASTNode) -> tuple[list[AST
62
64
  if first_token_line.value == 'if': # si c'est une condition
63
65
  if len(tokens_by_line) <= 1:
64
66
  raise SyntaxError(f'[IF] Take one or more arguments on line {first_token_line.position} !')
67
+
65
68
  if_node = IfNode(condition=tokens_by_line[1:],
66
69
  body=[]) # on crée la node avec les arguments de condition du if
67
70
  last_block.body.append(if_node)
@@ -96,7 +99,6 @@ def parse(token_lines: list[list[Token]], start_node: ASTNode) -> tuple[list[AST
96
99
  last_block.elif_nodes = [elif_node]
97
100
  else:
98
101
  last_block.elif_nodes.append(elif_node)
99
-
100
102
  blocks.append(elif_node)
101
103
 
102
104
  elif first_token_line.value == 'else':
@@ -107,7 +109,6 @@ def parse(token_lines: list[list[Token]], start_node: ASTNode) -> tuple[list[AST
107
109
  raise SyntaxError(f'[ELSE] already define !')
108
110
 
109
111
  else_node = ElseNode(body=[])
110
-
111
112
  if isinstance(last_block, ElifNode): # si le dernier bloc est un elif
112
113
  last_block.parent.else_body = else_node # on ajoute le bloc else à son parent (qui est le dernier if)
113
114
  else:
@@ -133,6 +134,7 @@ def parse(token_lines: list[list[Token]], start_node: ASTNode) -> tuple[list[AST
133
134
  elif first_token_line.value == '#loop': # si rencontré
134
135
  if not isinstance(last_block, LoopNode):
135
136
  raise SyntaxError(f'[#LOOP] No loop open on line {first_token_line.position} !')
137
+
136
138
  blocks.pop()
137
139
  return blocks, pointeur # on renvoie les informations parsé à la dernière loop ouverte
138
140
 
@@ -142,6 +144,7 @@ def parse(token_lines: list[list[Token]], start_node: ASTNode) -> tuple[list[AST
142
144
  if tokens_by_line[1].type != DTT.IDENT:
143
145
  raise TypeError(f'[VAR] the variable given must be a ident, '
144
146
  f'not {tokens_by_line[1].type} in line {tokens_by_line[1].position}')
147
+
145
148
  var_node = VarNode(name=tokens_by_line[1], body=[])
146
149
  last_block.body.append(var_node)
147
150
  result, status = parser_inline(tokens_by_line[
@@ -168,6 +171,7 @@ def parse(token_lines: list[list[Token]], start_node: ASTNode) -> tuple[list[AST
168
171
  if tokens_by_line[1].type != DTT.IDENT:
169
172
  raise TypeError(f'[PARAM] the variable given must be a ident, '
170
173
  f'not {tokens_by_line[1].type} in line {tokens_by_line[1].position}')
174
+
171
175
  param_node = ParamNode(body=[])
172
176
  last_block.body.append(param_node)
173
177
  _, p = parse(token_lines[pointeur + 1:], param_node)
@@ -176,6 +180,7 @@ def parse(token_lines: list[list[Token]], start_node: ASTNode) -> tuple[list[AST
176
180
  elif first_token_line.value == '#param':
177
181
  if not isinstance(last_block, ParamNode):
178
182
  raise SyntaxError(f'[#PARAM] No parameters open on line {first_token_line.position} !')
183
+
179
184
  blocks.pop() # on supprime le dernier bloc (le paramètre)
180
185
  return blocks, pointeur # on renvoie les informations parsé à la dernière paramètre ouverte
181
186
 
@@ -188,6 +193,7 @@ def parse(token_lines: list[list[Token]], start_node: ASTNode) -> tuple[list[AST
188
193
  raise SyntaxError(f"[LENGTH] Take 2 arguments on line {first_token_line.position} !")
189
194
  if first_token_line.type not in (DTT.IDENT, DTT.STR, DTT.LIST):
190
195
  raise SyntaxError(f"[LENGTH] Take an ident, str or list on line {first_token_line.position}, not {first_token_line.type} !")
196
+
191
197
  var_node = VarNode(tokens_by_line[1], body=[LengthNode(tokens_by_line[2])])
192
198
  last_block.body.append(var_node)
193
199
 
@@ -196,6 +202,12 @@ def parse(token_lines: list[list[Token]], start_node: ASTNode) -> tuple[list[AST
196
202
  elif first_token_line.type == DTT.DISCORD_KEYWORD:
197
203
 
198
204
  if first_token_line.value == 'embed':
205
+ if len(tokens_by_line) <= 1:
206
+ raise SyntaxError(f'[EMBED] Take one or more arguments on line {first_token_line.position} !')
207
+ if tokens_by_line[1].type != DTT.IDENT:
208
+ raise TypeError(f'[EMBED] the variable given must be a ident, '
209
+ f'not {tokens_by_line[1].type} in line {tokens_by_line[1].position}')
210
+
199
211
  embed_node = EmbedNode(body=[], fields=[])
200
212
  var_node = VarNode(tokens_by_line[1], body=[embed_node])
201
213
  last_block.body.append(var_node)
@@ -209,11 +221,20 @@ def parse(token_lines: list[list[Token]], start_node: ASTNode) -> tuple[list[AST
209
221
  return blocks, pointeur
210
222
 
211
223
  elif first_token_line.value == 'field':
224
+ if len(tokens_by_line) <= 1:
225
+ raise SyntaxError(f'[FIELD] Take one or more arguments on line {first_token_line.position} !')
212
226
  if not isinstance(last_block, EmbedNode):
213
227
  raise SyntaxError(f'[FIELD] No embed open on line {first_token_line.position} !')
228
+
214
229
  last_block.fields.append(FieldEmbedNode(tokens_by_line[1:]))
215
230
 
216
231
  elif first_token_line.value in ('perm', 'permission'):
232
+ if len(tokens_by_line) <= 1:
233
+ raise SyntaxError(f'[PERM] Take one argument on line {first_token_line.position} !')
234
+ if tokens_by_line[1].type != DTT.IDENT:
235
+ raise TypeError(f'[PERM] the variable given must be a ident, '
236
+ f'not {tokens_by_line[1].type} in line {tokens_by_line[1].position}')
237
+
217
238
  perm_node = PermissionNode(body=[])
218
239
  var_node = VarNode(tokens_by_line[1], body=[perm_node])
219
240
  last_block.body.append(var_node)
@@ -227,6 +248,12 @@ def parse(token_lines: list[list[Token]], start_node: ASTNode) -> tuple[list[AST
227
248
  return blocks, pointeur
228
249
 
229
250
  elif first_token_line.value == 'ui':
251
+ if len(tokens_by_line) <= 1:
252
+ raise SyntaxError(f'[UI] Take one argument on line {first_token_line.position} !')
253
+ if tokens_by_line[1].type != DTT.IDENT:
254
+ raise TypeError(f'[UI] the variable given must be a ident, '
255
+ f'not {tokens_by_line[1].type} in line {tokens_by_line[1].position}')
256
+
230
257
  ui_node = UiNode([])
231
258
  var_node = VarNode(tokens_by_line[1], body=[ui_node])
232
259
  last_block.body.append(var_node)
@@ -240,12 +267,17 @@ def parse(token_lines: list[list[Token]], start_node: ASTNode) -> tuple[list[AST
240
267
  return blocks, pointeur
241
268
 
242
269
  elif first_token_line.value == 'button':
270
+ if len(tokens_by_line) <= 1:
271
+ raise SyntaxError(f'[BUTTON] Take one or more arguments on line {first_token_line.position} !')
243
272
  if not isinstance(last_block, UiNode):
244
273
  raise SyntaxError(f'[BUTTON] No UI open on line {first_token_line.position} !')
274
+
245
275
  button_node = UiButtonNode(tokens_by_line[1:])
246
276
  last_block.buttons.append(button_node)
247
277
 
248
278
  elif first_token_line.value == 'select':
279
+ if len(tokens_by_line) <= 1:
280
+ raise SyntaxError(f'[SELECT] Take one or more arguments on line {first_token_line.position} !')
249
281
  if not isinstance(last_block, UiNode):
250
282
  raise SyntaxError(f'[SELECT] No UI open on line {first_token_line.position} !')
251
283
  select_node = UiSelectNode(tokens_by_line[1:])
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dshellInterpreter
3
- Version: 0.2.13.16
3
+ Version: 0.2.13.17
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
@@ -14,13 +14,13 @@ Dshell/_DshellInterpreteur/__init__.py,sha256=xy5-J-R3YmY99JF3NBHTRRLsComFxpjnCA
14
14
  Dshell/_DshellInterpreteur/dshell_interpreter.py,sha256=qHJ9WigNurvFvtEpVppNcHTV8hIiAA8AJLT_j0h4q-s,28862
15
15
  Dshell/_DshellParser/__init__.py,sha256=ONDfhZMvClqP_6tE8SLjp-cf3pXL-auQYnfYRrHZxC4,56
16
16
  Dshell/_DshellParser/ast_nodes.py,sha256=fU6BVe6w78ZhYib7SGR7iAfTqWqS2kvwZ0d4wMxxOHk,18366
17
- Dshell/_DshellParser/dshell_parser.py,sha256=VdobGNR1KU2oENJ66bTqAE8i3emqAdCXGMZLdOpOEJs,20396
17
+ Dshell/_DshellParser/dshell_parser.py,sha256=GsZg5srI84tDhEAQaJcvYSIP_PO4ITt4WnrqtLgwlnk,22288
18
18
  Dshell/_DshellTokenizer/__init__.py,sha256=LIQSRhDx2B9pmPx5ADMwwD0Xr9ybneVLhHH8qrJWw_s,172
19
19
  Dshell/_DshellTokenizer/dshell_keywords.py,sha256=euTckA4AsWBfBGMnFFi1YVz8dvXY1HNsQjNWtvARMR8,5878
20
20
  Dshell/_DshellTokenizer/dshell_token_type.py,sha256=gYIb2XN2YcgeRgmar_rBDS5CGmwfmxihu8mOW_d6lbE,1533
21
21
  Dshell/_DshellTokenizer/dshell_tokenizer.py,sha256=RrJA2XpcFH2vS6SnRIn5Own_uL5orIDvpq74t8xD3og,7350
22
- dshellinterpreter-0.2.13.16.dist-info/licenses/LICENSE,sha256=lNgcw1_xb7QENAQi3uHGymaFtbs0RV-ihiCd7AoLQjA,1082
23
- dshellinterpreter-0.2.13.16.dist-info/METADATA,sha256=cA0Lz0ryUiDX9tZxs8kLrOAtpqYHpod0vLWor0aFeL0,1152
24
- dshellinterpreter-0.2.13.16.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
25
- dshellinterpreter-0.2.13.16.dist-info/top_level.txt,sha256=B4CMhtmchGwPQJLuqUy0GhRG-0cUGxKL4GqEbCiB_vE,7
26
- dshellinterpreter-0.2.13.16.dist-info/RECORD,,
22
+ dshellinterpreter-0.2.13.17.dist-info/licenses/LICENSE,sha256=lNgcw1_xb7QENAQi3uHGymaFtbs0RV-ihiCd7AoLQjA,1082
23
+ dshellinterpreter-0.2.13.17.dist-info/METADATA,sha256=n4ENU63oc6Bozt0cKQO40HDX6FJ2hkGYVivE5AsH4jY,1152
24
+ dshellinterpreter-0.2.13.17.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
25
+ dshellinterpreter-0.2.13.17.dist-info/top_level.txt,sha256=B4CMhtmchGwPQJLuqUy0GhRG-0cUGxKL4GqEbCiB_vE,7
26
+ dshellinterpreter-0.2.13.17.dist-info/RECORD,,