# Path: ifj2017/ide/settings.py
# class Expression(QObject):
#     class ExpressionTypes(IntEnum):
#         Instruction = 0
#         Variable = 1
#         Types = 2
#         Header = 3
# 
#     Q_ENUMS(ExpressionTypes)
# 
#     @staticmethod
#     def singletonProvider(engine: QQmlEngine, script_engine: QJSEngine) -> QObject:
#         return Expression()
# 
# HIGHLIGHT_RULES = (
#     (("".join(("(?i)", instruction)) for instruction in INSTRUCTIONS), "#1d73a3"),
#     ((r'[LGT]F@', ), '#930c80'),
#     ((r'(?<=[LGT]F@){identifier}'.format(identifier=IDENTIFIER_PATTERN), ), 'black'),
#     ((r'(?i)(call|label|JUMP|jumpifeq|jumpifneq|jumpifeqs|jumpifneqs)(\s+)({identifier})'.format(identifier=IDENTIFIER_PATTERN), ), ("#1d73a3", None ,'#4c4c4c')),
#     ((r'(float|int)(@)(-?[0-9.]+)', r'(bool)(@)((?i)(true|false))', r'(string)@(.*)'), '#1ed3a8'),
# 
#     ((r'#.*$', ), 'gray'),
#     (("([nN])([yY])([aA])([nN])",), "#ED1869 #F2BC1F #39BFC1 #672980".split()),
# )
# 
# EXPRESSION_SPLITTERS = set(" \n\t")
# 
# INSTRUCTIONS = tuple(sorted(list(Instruction._commands.keys())))


import re
from typing import Optional
from PyQt5.QtCore import QObject, QVariant, pyqtProperty, pyqtSignal
from PyQt5.QtQml import QQmlEngine, QJSEngine
from ifj2017.ide.settings import Expression, HIGHLIGHT_RULES, EXPRESSION_SPLITTERS, INSTRUCTIONS
    _instance = None
    completerModelChanged = pyqtSignal()

    VARIABLE_RE = re.compile(r'[GLT]F@[A-Za-z0-9_\-\$&%\*]+', re.IGNORECASE)

    def __init__(self, parent: Optional[QObject] = None):
        super().__init__(parent)

        self._code = ''

    @pyqtProperty(str)
    def code(self) -> str:
        return self._code

    @code.setter
    def code(self, v: str) -> None:
        self._code = v
        self.completerModelChanged.emit()

    @pyqtProperty(QVariant, notify=completerModelChanged)
    def completerModel(self) -> QVariant:
        return QVariant(
            [
                dict(
                    identifier='.IFJcode17',
                    type=Expression.ExpressionTypes.Header
                )
            ] if '.IFJcode17' not in self.code else [] + [
                dict(
                    identifier=match,

# Path: ifj2017/ide/settings.py
# class Expression(QObject):
#     class ExpressionTypes(IntEnum):
#         Instruction = 0
#         Variable = 1
#         Types = 2
#         Header = 3
# 
#     Q_ENUMS(ExpressionTypes)
# 
#     @staticmethod
#     def singletonProvider(engine: QQmlEngine, script_engine: QJSEngine) -> QObject:
#         return Expression()
# 
# HIGHLIGHT_RULES = (
#     (("".join(("(?i)", instruction)) for instruction in INSTRUCTIONS), "#1d73a3"),
#     ((r'[LGT]F@', ), '#930c80'),
#     ((r'(?<=[LGT]F@){identifier}'.format(identifier=IDENTIFIER_PATTERN), ), 'black'),
#     ((r'(?i)(call|label|JUMP|jumpifeq|jumpifneq|jumpifeqs|jumpifneqs)(\s+)({identifier})'.format(identifier=IDENTIFIER_PATTERN), ), ("#1d73a3", None ,'#4c4c4c')),
#     ((r'(float|int)(@)(-?[0-9.]+)', r'(bool)(@)((?i)(true|false))', r'(string)@(.*)'), '#1ed3a8'),
# 
#     ((r'#.*$', ), 'gray'),
#     (("([nN])([yY])([aA])([nN])",), "#ED1869 #F2BC1F #39BFC1 #672980".split()),
# )
# 
# EXPRESSION_SPLITTERS = set(" \n\t")
# 
# INSTRUCTIONS = tuple(sorted(list(Instruction._commands.keys())))


# Path: ifj2017/ide/code_analyzer.py
import re
from typing import Optional
from PyQt5.QtCore import QObject, QVariant, pyqtProperty, pyqtSignal
from PyQt5.QtQml import QQmlEngine, QJSEngine
from ifj2017.ide.settings import Expression, HIGHLIGHT_RULES, EXPRESSION_SPLITTERS, INSTRUCTIONS

    _instance = None
    completerModelChanged = pyqtSignal()

    VARIABLE_RE = re.compile(r'[GLT]F@[A-Za-z0-9_\-\$&%\*]+', re.IGNORECASE)

    def __init__(self, parent: Optional[QObject] = None):
        super().__init__(parent)

        self._code = ''

    @pyqtProperty(str)
    def code(self) -> str:
        return self._code

    @code.setter
    def code(self, v: str) -> None:
        self._code = v
        self.completerModelChanged.emit()

    @pyqtProperty(QVariant, notify=completerModelChanged)
    def completerModel(self) -> QVariant:
        return QVariant(
            [
                dict(
                    identifier='.IFJcode17',
                    type=Expression.ExpressionTypes.Header
                )
            ] if '.IFJcode17' not in self.code else [] + [
                dict(
                    identifier=match,

                    type=Expression.ExpressionTypes.Types