diff --git a/ifj2017/ide/assets/styles/UIStyles.qml b/ifj2017/ide/assets/styles/UIStyles.qml index 12e2b53..61f4349 100644 --- a/ifj2017/ide/assets/styles/UIStyles.qml +++ b/ifj2017/ide/assets/styles/UIStyles.qml @@ -17,6 +17,7 @@ QtObject { typeColors[0] = "#00bff2" typeColors[1] = "#ffe20d" typeColors[2] = "white" + typeColors[3] = "orange" } } } diff --git a/ifj2017/ide/code_analyzer.py b/ifj2017/ide/code_analyzer.py index d9d3b11..0c1986f 100644 --- a/ifj2017/ide/code_analyzer.py +++ b/ifj2017/ide/code_analyzer.py @@ -1,6 +1,7 @@ # coding=utf-8 import re from typing import Optional + from PyQt5.QtCore import QObject, QVariant, pyqtProperty, pyqtSignal from PyQt5.QtQml import QQmlEngine, QJSEngine @@ -31,6 +32,11 @@ def code(self, v: str) -> None: 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 diff --git a/ifj2017/ide/settings.py b/ifj2017/ide/settings.py index f95bff2..c42ff4a 100644 --- a/ifj2017/ide/settings.py +++ b/ifj2017/ide/settings.py @@ -15,6 +15,7 @@ class ExpressionTypes(IntEnum): Instruction = 0 Variable = 1 Types = 2 + Header = 3 Q_ENUMS(ExpressionTypes) diff --git a/ifj2017/interpreter/operand.py b/ifj2017/interpreter/operand.py index a9010ba..079ab1e 100644 --- a/ifj2017/interpreter/operand.py +++ b/ifj2017/interpreter/operand.py @@ -65,13 +65,15 @@ def __init__(self, value): raise InvalidCodeException(InvalidCodeException.INVALID_OPERAND) - def _resolve_constant(self, constant_match): # type: (Match) -> None type_, value = constant_match.groups() - self.value = self.CONSTANT_MAPPING.get(type_.lower())(value) - if type_.lower() == self.CONSTANT_MAPPING_REVERSE.get(bool): - self.value = self.BOOL_LITERAL_MAPPING.get(value.lower()) + try: + self.value = self.CONSTANT_MAPPING.get(type_.lower())(value) + if type_.lower() == self.CONSTANT_MAPPING_REVERSE.get(bool): + self.value = self.BOOL_LITERAL_MAPPING.get(value.lower()) + except ValueError: + pass if self.value is None: raise InvalidCodeException(type_=InvalidCodeException.INVALID_OPERAND) self.type = TypeOperand.CONSTANT diff --git a/setup.py b/setup.py index 0267eae..dc31807 100644 --- a/setup.py +++ b/setup.py @@ -32,7 +32,7 @@ def setup(): core.setup( name='IFJcode17-toolkit', - version='1.1.4', + version='1.1.6', license='GNU GENERAL PUBLIC LICENSE Version 3', description='Toolkit for IFJ17 language compiler (as project at FIT BUT in Brno) with ' 'interactive debugger and automatic tests.',