dshellInterpreter 0.1.22__tar.gz → 0.1.23__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.

Potentially problematic release.


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

Files changed (24) hide show
  1. {dshellinterpreter-0.1.22 → dshellinterpreter-0.1.23}/Dshell/_DshellTokenizer/dshell_tokenizer.py +17 -4
  2. {dshellinterpreter-0.1.22 → dshellinterpreter-0.1.23}/PKG-INFO +1 -1
  3. {dshellinterpreter-0.1.22 → dshellinterpreter-0.1.23}/dshellInterpreter.egg-info/PKG-INFO +1 -1
  4. {dshellinterpreter-0.1.22 → dshellinterpreter-0.1.23}/setup.py +1 -1
  5. {dshellinterpreter-0.1.22 → dshellinterpreter-0.1.23}/Dshell/DISCORD_COMMANDS/__init__.py +0 -0
  6. {dshellinterpreter-0.1.22 → dshellinterpreter-0.1.23}/Dshell/DISCORD_COMMANDS/dshell_channel.py +0 -0
  7. {dshellinterpreter-0.1.22 → dshellinterpreter-0.1.23}/Dshell/DISCORD_COMMANDS/dshell_member.py +0 -0
  8. {dshellinterpreter-0.1.22 → dshellinterpreter-0.1.23}/Dshell/DISCORD_COMMANDS/dshell_message.py +0 -0
  9. {dshellinterpreter-0.1.22 → dshellinterpreter-0.1.23}/Dshell/_DshellInterpreteur/__init__.py +0 -0
  10. {dshellinterpreter-0.1.22 → dshellinterpreter-0.1.23}/Dshell/_DshellInterpreteur/dshell_interpreter.py +0 -0
  11. {dshellinterpreter-0.1.22 → dshellinterpreter-0.1.23}/Dshell/_DshellParser/__init__.py +0 -0
  12. {dshellinterpreter-0.1.22 → dshellinterpreter-0.1.23}/Dshell/_DshellParser/ast_nodes.py +0 -0
  13. {dshellinterpreter-0.1.22 → dshellinterpreter-0.1.23}/Dshell/_DshellParser/dshell_parser.py +0 -0
  14. {dshellinterpreter-0.1.22 → dshellinterpreter-0.1.23}/Dshell/_DshellTokenizer/__init__.py +0 -0
  15. {dshellinterpreter-0.1.22 → dshellinterpreter-0.1.23}/Dshell/_DshellTokenizer/dshell_keywords.py +0 -0
  16. {dshellinterpreter-0.1.22 → dshellinterpreter-0.1.23}/Dshell/_DshellTokenizer/dshell_token_type.py +0 -0
  17. {dshellinterpreter-0.1.22 → dshellinterpreter-0.1.23}/Dshell/__init__.py +0 -0
  18. {dshellinterpreter-0.1.22 → dshellinterpreter-0.1.23}/LICENSE +0 -0
  19. {dshellinterpreter-0.1.22 → dshellinterpreter-0.1.23}/README.md +0 -0
  20. {dshellinterpreter-0.1.22 → dshellinterpreter-0.1.23}/dshellInterpreter.egg-info/SOURCES.txt +0 -0
  21. {dshellinterpreter-0.1.22 → dshellinterpreter-0.1.23}/dshellInterpreter.egg-info/dependency_links.txt +0 -0
  22. {dshellinterpreter-0.1.22 → dshellinterpreter-0.1.23}/dshellInterpreter.egg-info/requires.txt +0 -0
  23. {dshellinterpreter-0.1.22 → dshellinterpreter-0.1.23}/dshellInterpreter.egg-info/top_level.txt +0 -0
  24. {dshellinterpreter-0.1.22 → dshellinterpreter-0.1.23}/setup.cfg +0 -0
@@ -14,11 +14,11 @@ from .dshell_token_type import Token
14
14
  MASK_CHARACTER = '§'
15
15
 
16
16
  table_regex: dict[DTT, Pattern] = {
17
- DTT.COMMENT: compile(r"::(.*)"),
17
+ DTT.COMMENT: compile(r"::(.*?)"),
18
18
  # DTT.DICT: compile(r"\{(.*?)\}"),
19
- DTT.CALL_ARGS: compile(r"\((.*?)\)"),
19
+ DTT.STR: compile(r'"(.*?)"', flags=DOTALL),
20
20
  DTT.LIST: compile(r"\[(.*?)\]"),
21
- DTT.STR: compile(r"\"(.*?)\"", flags=DOTALL),
21
+ DTT.CALL_ARGS: compile(r"\((.*?)\)"),
22
22
  DTT.MENTION: compile(r'<(?:@!?|@&|#)([0-9]+)>'),
23
23
  DTT.KEYWORD: compile(rf"(?<!\w)(#?{'|'.join(dshell_keyword)})(?!\w)"),
24
24
  DTT.DISCORD_KEYWORD: compile(rf"(?<!\w|-)(#?{'|'.join(dshell_discord_keyword)})(?!\w|-)"),
@@ -72,11 +72,22 @@ class DshellTokenizer:
72
72
 
73
73
  if token_type in (
74
74
  DTT.LIST,
75
- DTT.CALL_ARGS): # si c'est un regrouppement de donnée, on tokenize ce qu'il contient
75
+ DTT.CALL_ARGS): # si c'est un regroupement de donnée, on tokenize ce qu'il contient
76
76
  result = self.tokenizer([token.value])
77
77
  token.value = result[0] if len(
78
78
  result) > 0 else result # gère si la structure de donnée est vide ou non
79
79
 
80
+ for token_in_list in token.value:
81
+ token_in_list.position = (line_number, token_in_list.position[1])
82
+
83
+ for token_in_line in range(len(tokens_par_ligne)-1):
84
+ if tokens_par_ligne[token_in_line].position[1] > match.start():
85
+ str_tokens_in_list = tokens_par_ligne[token_in_line:-1]
86
+ tokens_par_ligne = tokens_par_ligne[:token_in_line] + [tokens_par_ligne[-1]]
87
+ token.value.extend(str_tokens_in_list)
88
+ token.value.sort(key=lambda t: t.position[1]) # trie les tokens par rapport à leur position
89
+ break
90
+
80
91
  len_match = len(match.group(0))
81
92
  ligne = ligne[:match.start()] + (MASK_CHARACTER * len_match) + ligne[
82
93
  match.end():] # remplace la match qui vient d'avoir lieu pour ne pas le rematch une seconde fois
@@ -86,6 +97,8 @@ class DshellTokenizer:
86
97
  if tokens_par_ligne:
87
98
  tokens.append(tokens_par_ligne)
88
99
 
100
+ line_number += 1 # incrémente le numéro de ligne pour la prochaine ligne
101
+
89
102
  return tokens
90
103
 
91
104
  @staticmethod
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dshellInterpreter
3
- Version: 0.1.22
3
+ Version: 0.1.23
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: 0.1.22
3
+ Version: 0.1.23
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
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
5
5
 
6
6
  setup(
7
7
  name="dshellInterpreter",
8
- version="0.1.22",
8
+ version="0.1.23",
9
9
  author="Chronos",
10
10
  author_email="vagabonwalybi@gmail.com",
11
11
  description="A Discord bot interpreter for creating custom commands and automations.",