diff --git a/__pycache__/Dropdown.cpython-311.pyc b/__pycache__/Dropdown.cpython-311.pyc index f85d988..2e0eb7e 100644 Binary files a/__pycache__/Dropdown.cpython-311.pyc and b/__pycache__/Dropdown.cpython-311.pyc differ diff --git a/__pycache__/TerminalRedirect.cpython-311.pyc b/__pycache__/TerminalRedirect.cpython-311.pyc index c78f09f..6efa1ca 100644 Binary files a/__pycache__/TerminalRedirect.cpython-311.pyc and b/__pycache__/TerminalRedirect.cpython-311.pyc differ diff --git a/__pycache__/shell.cpython-311.pyc b/__pycache__/shell.cpython-311.pyc index bb4b98e..1e3f5bf 100644 Binary files a/__pycache__/shell.cpython-311.pyc and b/__pycache__/shell.cpython-311.pyc differ diff --git a/ast.json b/ast.json index db6f8cb..285682a 100644 --- a/ast.json +++ b/ast.json @@ -1 +1 @@ -{"kind": "program", "body": [{"kind": "variableDeclarationExpression", "datatype": "array", "identifier": "test", "value": {"kind": "arrayLiteral", "items": [{"kind": "itemLiteral", "index": 0, "value": {"kind": "integerLiteral", "value": 53}}, {"kind": "itemLiteral", "index": 1, "value": {"kind": "integerLiteral", "value": 34}}, {"kind": "itemLiteral", "index": 2, "value": {"kind": "integerLiteral", "value": 64}}, {"kind": "itemLiteral", "index": 3, "value": {"kind": "integerLiteral", "value": 31}}]}, "constant": "False"}, {"kind": "forEachStatement", "declaration": {"kind": "variableDeclarationExpression", "datatype": "int", "identifier": "i", "value": {"kind": "integerLiteral", "value": 0}, "constant": "False"}, "iterable": {"kind": "identifier", "symbol": "test"}, "body": [{"kind": "callExpression", "arguments": [{"kind": "identifier", "symbol": "i"}], "caller": {"kind": "identifier", "symbol": "output"}}]}]} \ No newline at end of file +{"kind": "program", "body": [{"kind": "variableDeclarationExpression", "datatype": "array", "identifier": "test", "value": {"kind": "arrayLiteral", "items": [{"kind": "itemLiteral", "index": 0, "value": {"kind": "integerLiteral", "value": 53}}, {"kind": "itemLiteral", "index": 1, "value": {"kind": "integerLiteral", "value": 34}}, {"kind": "itemLiteral", "index": 2, "value": {"kind": "integerLiteral", "value": 64}}, {"kind": "itemLiteral", "index": 3, "value": {"kind": "integerLiteral", "value": 31}}]}, "constant": "False"}, {"kind": "forEachStatement", "declaration": {"kind": "variableDeclarationExpression", "datatype": "int", "identifier": "i", "value": {"kind": "integerLiteral", "value": 0}, "constant": "False"}, "iterable": {"kind": "identifier", "symbol": "test"}, "body": [{"kind": "callExpression", "arguments": [{"kind": "identifier", "symbol": "i"}], "caller": {"kind": "identifier", "symbol": "output"}}]}, {"kind": "identifier", "symbol": "hello"}, {"kind": "identifier", "symbol": "world"}, {"kind": "identifier", "symbol": "how"}, {"kind": "identifier", "symbol": "are"}, {"kind": "identifier", "symbol": "you"}, {"kind": "identifier", "symbol": "ding"}]} \ No newline at end of file diff --git a/phIDE.py b/phIDE.py index bd6ed69..21dcc32 100644 --- a/phIDE.py +++ b/phIDE.py @@ -304,7 +304,7 @@ def bind_keys(self) -> None: # Double Character Sequence self.bind("", self.close_file) self.bind("", self.backspace_entire_word) - self.bind("", self.show_intelli_sense) + self.bind("", self.show_intelli_sense) self.bind("", self.next_tab) self.bind("", self.comment_line) self.bind("", self.show_snippets) @@ -765,7 +765,18 @@ def load_language_syntax(self) -> None: self.bell() def update_syntax(self) -> None: - if editor := self.current_tab: + while True: + if not (editor := self.current_tab): + continue + + current_code = editor.get("0.0", "end") + + if self.code == current_code: + continue + + self.code = current_code + self.get_warnings(editor, current_code) + for tag in self.language_syntax_patterns[self.current_language]: pattern = self.language_syntax_patterns[self.current_language][tag][1] editor.tag_remove(tag, "0.0", "end") @@ -776,14 +787,12 @@ def update_syntax(self) -> None: for line_number in range(int(first_visible_index.split(".")[0]), int(last_visible_index.split(".")[0]) + 1): text = editor.get(f"{line_number}.0", f"{line_number}.end") matches = [(match.start(), match.end()) - for match in re.finditer(pattern, text, re.MULTILINE)] + for match in re.finditer(pattern, text, re.MULTILINE)] for start, end in matches: editor.tag_add( tag, f"{line_number}.{start}", f"{line_number}.{end}") - - time.sleep(0.1) - self.update_syntax() + time.sleep(0.1) # IntelliSense def up_key_press(self, _=None) -> None: diff --git a/test.phi b/test.phi index e3a5271..d2d7e73 100644 --- a/test.phi +++ b/test.phi @@ -6,3 +6,7 @@ for each (int i in test){ output(i) } + + + +hello world how are you ding