Browse Source

Merge branch 'expressions' of LInE/ivprog into master

Lucas de Souza 5 years ago
parent
commit
801a6d296c

+ 1 - 0
css/ivprog-term.css

@@ -36,6 +36,7 @@
   margin-top: -30px;
   position: relative;
   padding: 5px;
+  z-index: 999;
 }
 #ivprog-term i {
   margin-left: 5px;

+ 128 - 3
css/ivprog-visual-1.0.css

@@ -154,7 +154,7 @@ body {
 .expression_operand_1, .expression_operand_2, .operator, .div_comment_text, .value_rendered, .parameters_function_called, .parameters_function_called div, .expression_elements,
 .expression_element, .var_rendered, .menu_add_item, .component_element, .component_element, .conditional_expression, .variable_attribution, .attribution_expression, .var_value_expression,
 .incrementation_field, .incrementation_variable, .first_operand, .operator, .second_operand, .variable_to_switch, .variable_case, .button_remove_case, .editing_name_var, .parameter_div_edit,
-.all_elements_write, .container_var_element_control, .inline_add_command, .restart_expression, .div_parent_handler, .div_drag_writer {
+.all_elements_write, .container_var_element_control, .inline_add_command, .restart_expression, .div_parent_handler, .div_drag_writer, .single_element_expression, .ghost_parenthesis {
 	display: inline;
 }
 
@@ -559,7 +559,8 @@ div.function_name_div_updated:active,
 .incrementation_field .incrementation_variable,
 .incrementation_field .first_operand:not(:empty),
 .incrementation_field .operator:not(:empty),
-.incrementation_field .second_operand:not(:empty) {
+.incrementation_field .second_operand:not(:empty),
+.single_element_expression, .ghost_parenthesis {
 	background: #e8e8e8;
 	border-radius: 5px;
 	min-width: 40px;
@@ -860,11 +861,135 @@ div.ui.checkbox.transition.visible {
 }
 
 .ghost_div {
-
     height: 20px;
     background-color: #ffffff;
     margin: 5px;
     border: 2px dotted #000000;
     box-shadow: 1px 1px;
     height: 28px;
+    border: 2px solid green;
+}
+.ghost_element, .ghost_parenthesis {
+	opacity: 0;
+}
+.expression_elements:hover .ghost_element, .expression_elements:hover .ghost_parenthesis {
+	
+}
+.ghost_element:hover, .ghost_parenthesis:hover {
+	opacity: 1.0 !important;
+}
+
+.usepointer, .ghost_element, .ghost_parenthesis, .add_parentheses {
+	cursor: pointer !important;
+}
+
+.add_parentheses {
+	margin-left: 20px;
+}
+
+.temp_class {
+	opacity: 0;
+}
+
+.parentheses_ghost {
+	display: inline;
+	background-color: #2ecc40;
+	padding: 1px 4px;
+    font-size: 120%;
+    padding-bottom: 2px;
+    font-weight: bold;
+    margin: 0px 4px;
+    border-radius: 4px;
+    box-shadow: 4px black;
+    box-shadow: 1px 1px;
+    border: 1px solid gray;
+}
+
+.single_element_expression {
+	position: relative;
+}
+
+.floating_parenthesis {
+	padding: 3px 2px;
+    border: 1px solid gray;
+    background-color: #e8e8e8;
+    width: 30px;
+    text-align: center;
+    border-radius: 5px;
+    font-weight: bold;
+    box-shadow: 2px 2px grey;
+}
+
+.remove_element_expression {
+	display: inline;
+	position: absolute;
+    top: -15px;
+    right: -5px;
+}
+
+.mouse_distance {
+
+}
+
+.mouse_distance_hidden {
+	display: none !important;
+}
+
+.mouse_distance_except {
+	display: inline !important;
+}
+
+.higher_element {
+	display: inline;
+	min-width: 10px !important;
+	min-height: 10px;
+
+    position: absolute;
+    margin-left: -10px;
+    margin-top: -5px;
+    padding-left: 5px;
+}
+
+.ghost_element {
+    border: 2px solid green !important;
+    box-shadow: #8f8f8f 2px 2px !important;
+    background: #d8ffd8 !important;
+}
+
+.ui.button.green.add_expression {
+	padding: 2px;
+    padding-top: 5px;
+    padding-bottom: 5px;
+    margin-left: 5px;
+    padding-left: 10px;
+}
+.ui.button.green.add_expression i {
+	font-size: 110%;
+}
+.simple_add {
+	display: inline;
+}
+.lixeira {
+	position: absolute;
+	top: 300px;
+	left: 200px;
+	height: 100px;
+	background-image: url('../img/trash-icon.png');
+	width: 125px !important;
+    background-position: 0;
+    background-repeat: no-repeat;
+    display: none;
+}
+.lixeira .trash {
+	font-size: 3em;
+}
+.color_test {
+	background-color: green;
+}
+.parentheses_fixed {
+	background-color: #617063 !important;
+	color: white !important;
+}
+.parentheses_in_expression {
+	cursor: pointer;
 }

BIN
img/trash-icon.png


+ 5 - 1
js/processor/compatibilityTable.js

@@ -204,7 +204,11 @@ export function resultTypeAfterUnaryOp (operator, leftExpressionType) {
     if(leftExpressionType instanceof MultiType){
       return leftExpressionType;
     }
-    return unaryMap.get(operator)[leftExpressionType.ord];
+    const resultType = unaryMap.get(operator)[leftExpressionType.ord];
+    if (resultType == null) {
+      return Types.UNDEFINED;
+    }
+    return resultType;
   } catch (e) {
     if (e instanceof TypeError) {
       return Types.UNDEFINED;

+ 83 - 33
js/visualUI/code_generator.js

@@ -80,9 +80,9 @@ function functionsCode (function_obj) {
 	}
 
 	for (var j = 0; j < function_obj.commands.length; j++) {
-		try {
+		//try {
 			ret += commandsCode(function_obj.commands[j]);
-		} catch (err) {
+		/*} catch (err) {
 
 			has_error = true;
 
@@ -97,7 +97,7 @@ function functionsCode (function_obj) {
 				}
 			}
 			
-		}
+		}*/
 		
 	}
 
@@ -161,7 +161,8 @@ function returnsCode (command_obj, indentation) {
 
 	if (command_obj.variable_value_menu) {
 		try {
-			ret += ' ' + variableValueMenuCode(command_obj.variable_value_menu, true);
+			ret += ' ' + elementExpressionCode(command_obj.variable_value_menu);
+			//ret += ' ' + variableValueMenuCode(command_obj.variable_value_menu, true);
 		} catch(err) {}
 	}
 
@@ -247,14 +248,16 @@ function repeatNtimesCode (command_obj, indentation) {
 
 
 	if (command_obj.expression2) {
-		switch (command_obj.expression2.expression.type) {
+		/*switch (command_obj.expression2.expression.type) {
 			case Models.EXPRESSION_TYPES.exp_logic:
 				ret += logicExpressionCode(command_obj.expression2.expression);
 				break;
 			case Models.EXPRESSION_TYPES.exp_arithmetic:
 				ret += arithmeticExpressionCode(command_obj.expression2.expression);
 				break;
-		}
+		}*/
+
+		ret += elementExpressionCode(command_obj.expression2);
 	}
 
 	ret += ' ; ';
@@ -311,18 +314,22 @@ function iftruesCode (command_obj, indentation) {
 
 	ret += LocalizedStrings.getUI('text_if');
 
-	if (!command_obj.expression.expression) {
+	if (!command_obj.expression) {
 		Utils.renderErrorMessage(command_obj.expression.dom_object, LocalizedStrings.getUI('inform_valid_expression'));
+	} else {
+		ret += ' ( ';
+		ret += elementExpressionCode(command_obj.expression);
+		ret += ' ) ';
 	}
 
-	switch (command_obj.expression.expression.type) {
+	/*switch (command_obj.expression.expression.type) {
 		case Models.EXPRESSION_TYPES.exp_logic:
 			ret += logicExpressionCode(command_obj.expression.expression);
 			break;
 		case Models.EXPRESSION_TYPES.exp_arithmetic:
 			ret += arithmeticExpressionCode(command_obj.expression.expression);
 			break;
-	}
+	}*/
 
 	ret += ' { ';
 
@@ -378,17 +385,23 @@ function doWhilesCode (command_obj, indentation) {
 
 	ret += '} ' + LocalizedStrings.getUI('text_code_while');
 
-	if (!command_obj.expression.expression) {
+	if (!command_obj.expression) {
 		Utils.renderErrorMessage(command_obj.expression.dom_object, LocalizedStrings.getUI('inform_valid_expression'));
 	}
 
-	switch (command_obj.expression.expression.type) {
+	/*switch (command_obj.expression.expression.type) {
 		case Models.EXPRESSION_TYPES.exp_logic:
 			ret += logicExpressionCode(command_obj.expression.expression);
 			break;
 		case Models.EXPRESSION_TYPES.exp_arithmetic:
 			ret += arithmeticExpressionCode(command_obj.expression.expression);
 			break;
+	}*/
+
+	if (command_obj.expression) {
+		ret += ' ( ';
+		ret += elementExpressionCode(command_obj.expression);
+		ret += ' ) ';
 	}
 
 	return ret;
@@ -404,17 +417,22 @@ function whiletruesCode (command_obj, indentation) {
 
 	ret += LocalizedStrings.getUI('text_code_while');
 
-	if (!command_obj.expression.expression) {
+	if (!command_obj.expression) {
 		Utils.renderErrorMessage(command_obj.expression.dom_object, LocalizedStrings.getUI('inform_valid_expression'));
 	}
 
-	switch (command_obj.expression.expression.type) {
+	/*switch (command_obj.expression.expression.type) {
 		case Models.EXPRESSION_TYPES.exp_logic:
 			ret += logicExpressionCode(command_obj.expression.expression);
 			break;
 		case Models.EXPRESSION_TYPES.exp_arithmetic:
 			ret += arithmeticExpressionCode(command_obj.expression.expression);
 			break;
+	}*/
+	if (command_obj.expression) {
+		ret += ' ( ';
+		ret += elementExpressionCode(command_obj.expression);
+		ret += ' ) ';
 	}
 
 	ret += ' { ';
@@ -531,9 +549,10 @@ function attributionsCode (command_obj, indentation) {
 
 	ret += variableValueMenuCode(command_obj.variable) + ' = ';
 
-	for (var i = 0; i < command_obj.expression.length; i++) {
+	/*for (var i = 0; i < command_obj.expression.length; i++) {
 		ret += elementExpressionCode(command_obj.expression[i]);
-	}
+	}*/
+	ret += elementExpressionCode(command_obj.expression);
 
 	return ret;
 }
@@ -542,28 +561,17 @@ function elementExpressionCode (expression_obj) {
 
 	var ret = ''; 
 
-	for (var i = 0; i < expression_obj.itens.length; i++) {
+	for (var i = 0; i < expression_obj.length; i++) {
 
 
-		if (expression_obj.itens[i].type) {
+		if (expression_obj[i].type) {
 
-			ret += variableValueMenuCode(expression_obj.itens[i]);
+			ret += variableValueMenuCode(expression_obj[i]);
 
-		} else if (expression_obj.itens[i].type_exp) {
-
-			if (expression_obj.itens[i].type_exp == Models.EXPRESSION_ELEMENTS.par_exp_par) {
-				ret += ' ( ';
-			}
+		} else if (expression_obj[i].type_op) {
 
-			ret += elementExpressionCode(expression_obj.itens[i]);
+			switch(expression_obj[i].item) {
 
-			if (expression_obj.itens[i].type_exp == Models.EXPRESSION_ELEMENTS.par_exp_par) {
-				ret += ' ) ';
-			}
-
-		} else {
-
-			switch (expression_obj.itens[i]) {
 				case Models.ARITHMETIC_TYPES.plus:
 					ret += ' + ';
 					break;
@@ -579,7 +587,47 @@ function elementExpressionCode (expression_obj) {
 				case Models.ARITHMETIC_TYPES.module:
 					ret += ' % ';
 					break;
+
+				case Models.LOGIC_COMPARISON.equals_to:
+					ret += ' == ';
+					break;
+
+				case Models.LOGIC_COMPARISON.not_equals_to:
+					ret += ' != ';
+					break;
+
+				case Models.LOGIC_COMPARISON.and:
+					ret += ' ' + LocalizedStrings.getUI('and') + ' ';
+					break;
+
+				case Models.LOGIC_COMPARISON.or:
+					ret += ' ' + LocalizedStrings.getUI('or') + ' ';
+					break;
+
+				case Models.LOGIC_COMPARISON.not:
+					ret += ' ' + LocalizedStrings.getUI('not') + ' ';
+					break;
+
+				case Models.ARITHMETIC_COMPARISON.greater_than:
+					ret += ' > ';
+					break;
+
+				case Models.ARITHMETIC_COMPARISON.less_than:
+					ret += ' < ';
+					break;
+
+				case Models.ARITHMETIC_COMPARISON.greater_than_or_equals_to:
+					ret += ' >= ';
+					break;
+
+				case Models.ARITHMETIC_COMPARISON.less_than_or_equals_to:
+					ret += ' <= ';
+					break;
 			}
+
+		} else {
+
+			ret += ' ' + expression_obj[i] + ' ';
 			
 		}
 
@@ -680,13 +728,15 @@ function writersCode (command_obj, indentation) {
 	
 	ret += LocalizedStrings.getUI('text_command_write') + ' ( ';
 
-	for (var i = 0; i < command_obj.content.length; i++) {
+	/*for (var i = 0; i < command_obj.content.length; i++) {
 		ret += variableValueMenuCode(command_obj.content[i]);
 
 		if ((i + 1) < command_obj.content.length) {
 			ret += ' + ';
 		}
-	}
+	}*/
+
+	ret += elementExpressionCode(command_obj.content);
 
 	ret += ' ) ';
 	return ret;

+ 5 - 5
js/visualUI/commands.js

@@ -478,18 +478,18 @@ export function genericCreateCommand (command_type) {
 			return new Models.FunctionCall(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_function, null, null, null, false), null);
 
 		case Models.COMMAND_TYPES.iftrue:
-			return new Models.IfTrue(new Models.ConditionalExpression(null), null, null);
+			return new Models.IfTrue([new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
 
 		case Models.COMMAND_TYPES.repeatNtimes:
 			return new Models.RepeatNTimes(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_variable, null, null, null, false), 
 											new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_variable, null, null, null, false),
-										     null, new Models.ConditionalExpression(null), null, null);
+										     null, [new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, null);
 
 		case Models.COMMAND_TYPES.whiletrue:
-			return new Models.WhileTrue(new Models.ConditionalExpression(null), null);
+			return new Models.WhileTrue([new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null);
 
 		case Models.COMMAND_TYPES.dowhiletrue:
-			return new Models.DoWhileTrue(new Models.ConditionalExpression(null), null);
+			return new Models.DoWhileTrue([new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null);
 
 		case Models.COMMAND_TYPES.switch:
 
@@ -498,7 +498,7 @@ export function genericCreateCommand (command_type) {
 			return new Models.Switch(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.variable_and_function, null, null, null, true), sc);
 
 		case Models.COMMAND_TYPES.return:
-			return new Models.Return(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
+			return new Models.Return([new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
 	}
 }
 

+ 5 - 4
js/visualUI/commands/attribution.js

@@ -3,6 +3,7 @@ import { LocalizedStrings } from '../../services/localizedStringsService';
 import * as VariableValueMenu from './variable_value_menu';
 import * as VariableValueMenuManagement from './variable_value_menu';
 import * as CommandsManagement from '../commands';
+import * as ExpressionManagement from './generic_expression';
 
 export function createFloatingCommand () {
 	return $('<div class="ui attribution created_element"> <i class="ui icon small arrow left"></i> <span> x = 1 + 1 </span></div>');
@@ -17,15 +18,15 @@ export function renderCommand (command, function_obj) {
 	VariableValueMenu.renderMenu(command, command.variable, el.find('.var_attributed'), function_obj);
 
 	if (!command.expression || command.expression.length < 1) {
-		var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.op_exp, [Models.ARITHMETIC_TYPES.none, 
-		new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
-
+		var exp = new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true);
 		command.expression.push(exp);
 	}
 
 	addHandlers(command, function_obj, el);
 
-	renderExpressionElements(command, function_obj, el);
+	ExpressionManagement.renderExpression(command, function_obj, el.find('.expression_elements'), command.expression);
+
+	//renderExpressionElements(command, function_obj, el);
 
 	return el;
 

+ 6 - 1
js/visualUI/commands/dowhiletrue.js

@@ -2,6 +2,7 @@ import { LocalizedStrings } from '../../services/localizedStringsService';
 import * as CommandsManagement from '../commands';
 import * as ConditionalExpressionManagement from './conditional_expression';
 import * as ContextualizedMenu from './contextualized_menu';
+import * as GenericExpressionManagement from './generic_expression';
 
 export function createFloatingCommand () {
 	return $('<div class="ui dowhiletrue created_element"> <i class="ui icon small sync"></i> <span> '+ LocalizedStrings.getUI('text_command_do') +' <br> ' + LocalizedStrings.getUI('text_code_while') +'(x < 10) </span></div>');
@@ -23,7 +24,11 @@ export function renderCommand (command, function_obj) {
 
 	ContextualizedMenu.renderMenu(command, el.find('.context_menu'), function_obj, el);
 
-	ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
+	//ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
+
+	if (command.expression) {
+		GenericExpressionManagement.renderExpression(command, function_obj, el.find('.conditional_expression'), command.expression);
+	}
 
 	if (command.commands_block) {
 		for (var j = 0; j < command.commands_block.length; j++) {

+ 814 - 0
js/visualUI/commands/generic_expression.js

@@ -0,0 +1,814 @@
+import { Types } from '../types';
+import * as Models from '../ivprog_elements';
+import { LocalizedStrings } from '../../services/localizedStringsService';
+import * as VariableValueMenuManagement from './variable_value_menu';
+import WatchJS from 'melanke-watchjs';
+
+export function renderExpression (command, function_obj, div_to_render, expression_array) {
+
+	div_to_render.empty();
+
+	if (command.type === Models.COMMAND_TYPES.attribution) {
+
+		WatchJS.unwatch(command.variable);
+		WatchJS.watch(command.variable, function(){
+	      renderExpression(command, function_obj, div_to_render, expression_array);
+	    }, 0);
+
+		if (command.variable.content) {
+
+			var types_included = [];
+
+			if (command.variable.content.type == Types.INTEGER || command.variable.content.type == Types.REAL) {
+	    		types_included.push(Models.EXPRESSION_TYPES.exp_arithmetic);
+		    } else if (command.variable.content.type == Types.BOOLEAN) {
+		    	types_included.push(Models.EXPRESSION_TYPES.exp_conditional);
+		    	types_included.push(Models.EXPRESSION_TYPES.exp_logic);
+		    	types_included.push(Models.EXPRESSION_TYPES.exp_arithmetic);
+		    } else if (command.variable.content.type == Types.TEXT) {
+		    	types_included.push(Models.EXPRESSION_TYPES.exp_conditional);
+		    	types_included.push(Models.EXPRESSION_TYPES.exp_logic);
+		    	types_included.push(Models.EXPRESSION_TYPES.exp_arithmetic);
+		    } else {
+		    	console.log('NÃO RECONHECI! VEJA: ', command.variable.content.type);
+		    }
+
+		    renderElements(command, function_obj, div_to_render, expression_array, types_included);
+		} else {
+			div_to_render.text(LocalizedStrings.getUI('var_menu_select_var').toLowerCase());
+		}
+	} else {
+		var types_included = [];
+		types_included.push(Models.EXPRESSION_TYPES.exp_conditional);
+		types_included.push(Models.EXPRESSION_TYPES.exp_logic);
+		types_included.push(Models.EXPRESSION_TYPES.exp_arithmetic);
+		renderElements(command, function_obj, div_to_render, expression_array, types_included);
+	}
+
+	div_to_render.children('.mouse_distance').addClass('mouse_distance_hidden');
+	div_to_render.children('.higher_element').on('mousemove', function(evt) {
+		if (!window.open_or_close) {
+			$(this).css('position', 'relative', '!important');
+			$(this).children('.mouse_distance').css('opacity', '1');
+		}
+	});
+	div_to_render.children('.higher_element').on('mouseout', function(evt) {
+		if (!window.open_or_close) {
+			$(this).css('position', 'absolute', '!important');
+			$(this).children('.mouse_distance').css('opacity', '0');
+		}
+	});
+	var lixeira = $('<div class="lixeira" draggable="true"></div>');
+
+	div_to_render.find('.single_element_expression').on('mousedown', function (evt) {
+		window.posX = evt.clientX;
+		window.posY = evt.clientY;
+	});
+	
+	Sortable.create(div_to_render[0], {
+	    animation: 100,
+	    ghostClass: 'ghost',
+	    group: {
+	        name: 'shared',
+	        put: false // Do not allow items to be put into this list
+	    },
+	    draggable: '.single_element_expression',
+	    sort: false,
+	    filter: '.not_allowed',
+	    
+	    onStart: function() {
+	    	$('body').append(lixeira);
+	    	lixeira.css('display', 'block');
+			lixeira.css('top', window.posY + 70, '!important');
+			lixeira.css('left', window.posX - 20, '!important');
+	    },
+	    onMove: function() {
+	    	lixeira.addClass('color_test');
+	    },
+	    onEnd: function() {
+	    	lixeira.remove();
+	    	div_to_render.find('.ghost').removeClass('ghost');
+	    }
+  	});
+  	new Sortable(lixeira[0], {
+	    group: 'shared',
+	    animation: 150,
+	    onAdd: function (evt) {
+	       lixeira.css('display', 'none');
+	       lixeira.find('.single_element_expression').remove();
+	       lixeira.css('background-color', '');
+	       lixeira.remove();
+	       removeElement(evt, expression_array);
+	       renderExpression(command, function_obj, div_to_render, expression_array);
+	    }
+	});
+}
+
+function removeElement (event, expression_array) {
+	var indice = $(event.item).data('index');
+	var first = expression_array[0];
+	console.log('indice: ', indice);
+	if (expression_array[indice].type) {
+		// if is alone in expression:
+		if (expression_array.length == 1) {
+			//function_obj.commands.splice(function_obj.commands.indexOf(command), 1);
+			expression_array.splice(0, 1);
+		} else if (expression_array.length > 1) {
+			if (indice > 0 && expression_array[indice - 1].type_op) {
+				if (indice < (expression_array.length) 
+					&& expression_array[indice - 2] == '('
+					&& expression_array[indice + 1].type_op) {
+					expression_array.splice(indice + 1, 1);
+				}
+				expression_array.splice(indice, 1);
+				expression_array.splice(indice - 1, 1);
+				if (indice - 2 < (expression_array.length) 
+					&& expression_array[indice - 2] == '('
+					&& expression_array[indice - 1] == ')') {
+					expression_array.splice(indice - 1, 1);
+					expression_array.splice(indice - 2, 1);
+					if (indice - 3 >= 0 && indice - 3 < expression_array.length
+						&& expression_array[indice - 3].type_op ) {
+						expression_array.splice(indice - 3, 1);
+					}
+				}
+			} else if (indice < (expression_array.length - 1) &&  expression_array[indice + 1].type_op) {
+				expression_array.splice(indice + 1, 1);
+				expression_array.splice(indice, 1);
+			} else if (indice < (expression_array.length - 1) && indice > 0 
+				&& expression_array[indice -1] == '(' && expression_array[indice +1] == ')') {
+				if (indice > 1
+					&& expression_array[indice - 2].type_op) {
+					expression_array.splice(indice + 1, 1);
+					expression_array.splice(indice, 1);
+					expression_array.splice(indice - 1, 1);
+					expression_array.splice(indice - 2, 1);
+
+				} else if (indice < (expression_array.length - 2) 
+					&& expression_array[indice + 2].type_op) {
+					expression_array.splice(indice + 1, 1);
+					expression_array.splice(indice, 1);
+					expression_array.splice(indice - 1, 1);
+
+				} else {
+					expression_array.splice(indice + 1, 1);
+					expression_array.splice(indice, 1);
+					expression_array.splice(indice - 1, 1);
+				}
+			}
+		}
+
+	} else if (expression_array[indice].type_op) {
+		// iVProg doesn't support operator remove
+	} else {
+		
+		var opening = -1;
+		var closing = -1;
+
+		if (expression_array[indice] == '(') {
+			opening = indice;
+			for (var i = indice + 1; i < expression_array.length; i++) {
+				if (expression_array[i] == ')') {
+					closing = i;
+					break;
+				}
+			}
+		} else {
+			closing = indice;
+			for (var i = indice - 1; i >= 0; i--) {
+				if (expression_array[i] == '(') {
+					opening = i;
+					break;
+				}
+			}
+		}
+
+		if (expression_array[opening + 1].type_op) {
+			expression_array.splice(closing, 1);
+			expression_array.splice(opening + 1, 1);
+			expression_array.splice(opening, 1);
+		} else {
+			expression_array.splice(closing, 1);
+			expression_array.splice(opening, 1);
+		}
+	}
+	// if expression is empty, add a new var value:
+	if (expression_array.length == 0) {
+		expression_array.push(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
+	}
+	if (first != expression_array[0] && expression_array[0].type_op) {
+		expression_array.splice(0, 1);
+	}
+}
+
+function renderElements (command, function_obj, div_to_render, expression_array, types_included) {
+
+	/*if (expression_array.length > 0) {
+		if (!expression_array[0].type_op) {
+			renderStartAddOperator(div_to_render, types_included, expression_array, command, function_obj, 0);
+		}
+	}*/
+
+	var i = 0;
+	for (i = 0; i < expression_array.length; i++) {
+		if (expression_array[i].type == "var_value") {
+			var div_temp = $('<div class="single_element_expression" data-index="'+i+'"></div>');
+			if (i == 0) {
+				if (expression_array.length > 0  && !expression_array[0].type_op) {
+
+					renderStartAddOperator(div_to_render, types_included, expression_array, command, function_obj, 0);
+				}
+			}
+			VariableValueMenuManagement.renderMenu(command, expression_array[i], div_temp, function_obj);
+			div_to_render.append(div_temp);
+		} else if (expression_array[i] == '(' || expression_array[i] == ')') {
+			if (expression_array[i] == ')') {
+				renderFinalAddElements(div_to_render, types_included, expression_array, command, function_obj, i);
+				renderParenthesis(div_to_render, expression_array[i], command, function_obj, i, expression_array);
+			} else if (expression_array[i] == '(' && !expression_array[i + 1].type_op) {
+				renderParenthesis(div_to_render, expression_array[i], command, function_obj, i, expression_array);
+				renderStartAddOperator(div_to_render, types_included, expression_array, command, function_obj, i + 1);
+			} else {
+				renderParenthesis(div_to_render, expression_array[i], command, function_obj, i, expression_array);
+			}
+
+		} else {
+			if (i == 0) {
+				console.log("NEGAÇÃO NO PRIMEIRO ELEMENTO");
+			} else if (expression_array[i - 1] == '(') {
+				console.log("NEGAÇÃO APÓS O PARÊNTESES");
+			}
+			renderOperatorMenu(command, function_obj, div_to_render, expression_array[i], types_included, i, expression_array);
+		}
+	}
+
+	renderFinalAddElements(div_to_render, types_included, expression_array, command, function_obj, i, true);
+
+	renderAddParenthesis(command, function_obj, div_to_render, expression_array, types_included);
+
+}
+
+window.parentheses_activate = false;
+window.open_or_close = null;
+function renderAddParenthesis (command, function_obj, div_to_render, expression_array, types_included) {
+	var addParentheses = $('<div class="single_element_expression add_parentheses not_allowed"><i class="icons"><b style="font-style: normal;">( )</b><i class="corner add icon blue" style="font-size: .6em;right: -3px;bottom: -2px;"></i></i></div>');
+	div_to_render.append(addParentheses);
+	addParentheses.popup({
+	    content : "Adicionar parênteses",
+	    delay: {
+	      show: 750,
+	      hide: 0
+		}
+	});
+
+	addParentheses.on('click', function(mouse_event) {
+
+		// verificar se já está ativado
+		if (window.parentheses_activate) {
+			return;
+		}
+
+		div_to_render.find('.usepointer').off('click');
+
+		window.parentheses_activate = true;
+
+		window.open_or_close = "open";
+
+		div_to_render.find('.dropdown').addClass('disabled');
+
+		div_to_render.find('.ghost_element').addClass('temp_class');
+		div_to_render.find('.ghost_element').removeClass('ghost_element');
+
+		var floatingObject = $('<div class="floating_parenthesis"> ( </div>');
+		floatingObject.draggable().appendTo("body");
+		floatingObject.css("position", "absolute");
+		mouse_event.type = "mousedown.draggable";
+		mouse_event.target = floatingObject[0];
+		floatingObject.css("left", mouse_event.pageX + 10);
+		floatingObject.css("top", mouse_event.pageY + 10);
+		floatingObject.trigger(mouse_event);
+
+		div_to_render.on('mousemove', function(evt) {
+			var actual_target = null;
+			if ($(evt.target).hasClass('single_element_expression')) {
+				actual_target = $(evt.target);
+			} else {
+				actual_target = $(evt.target).closest('.single_element_expression');
+			}
+
+			if ($(evt.target).hasClass('temp_class') 
+				|| actual_target.length < 1 
+				|| actual_target.hasClass('add_parentheses')
+				|| actual_target.hasClass('rendered_parentheses')
+				|| $(evt.target).hasClass('expression_elements')) {
+				return;
+			}
+			renderGhostParentheses(actual_target, command, function_obj, div_to_render, expression_array);
+		});
+
+		div_to_render.on('mouseleave', function() {
+			/*window.open_parentheses.remove();
+			window.close_parentheses.remove();*/
+		});
+
+		var floating;
+
+		$('body').on('mouseup', function(evt) {
+
+			if (window.open_or_close == "open") {
+
+				window.open_or_close = "close";
+
+				floatingObject.remove();
+
+				var comando_que_esta = $(evt.target).closest('.command_container');
+				var comando_certo = div_to_render.closest('.command_container');
+				if (!comando_que_esta.is(comando_certo)) {
+
+					window.parentheses_activate = false;
+					div_to_render.find('.temp_class').addClass('ghost_element');
+					div_to_render.find('.temp_class').removeClass('temp_class');
+					div_to_render.off('mousemove');
+					div_to_render.off('mouseleave');
+					$('body').off('mouseup');
+					window.open_parentheses.remove();
+					window.close_parentheses.remove();
+					window.inserir_open = -1;
+					window.inserir_close = -1;
+					window.open_or_close = null;
+					renderExpression(command, function_obj, div_to_render, expression_array);
+
+					return;
+				}
+
+
+				window.open_parentheses.addClass('parentheses_fixed');
+
+				floating = $('<div class="floating_parenthesis"> ) </div>');
+				floating.draggable().appendTo("body");
+				floating.css("position", "absolute");
+				floating.css("left", evt.pageX + 10);
+				floating.css("top", evt.pageY + 10);
+
+				$('body').on('mousemove', function(evts) {
+					floating.css("left", evts.pageX + 10);
+					floating.css("top", evts.pageY + 10);
+				});				
+
+			} else {
+
+				floating.remove();
+
+				window.open_parentheses.removeClass('parentheses_fixed');
+				
+				div_to_render.off('mousemove');
+				div_to_render.off('mouseleave');
+				$('body').off('mouseup');
+
+				setTimeout(function(){
+					window.parentheses_activate = false;
+				}, 50);
+
+				var comando_que_esta = $(evt.target).closest('.command_container');
+				var comando_certo = div_to_render.closest('.command_container');
+				var is_correct = false;
+				if (comando_que_esta.is(comando_certo)) {
+					is_correct = true;
+				}
+
+				if (is_correct) {
+					expression_array.splice(window.inserir_open, 0, '(');
+					expression_array.splice(window.inserir_close, 0, ')');
+				}
+
+				window.inserir_open = -1;
+				window.inserir_close = -1;
+				window.open_or_close = null;
+
+				renderExpression(command, function_obj, div_to_render, expression_array);
+
+			}
+
+		});
+	});
+}
+
+window.open_parentheses = $('<div class="parentheses_ghost">(</div>');
+window.close_parentheses = $('<div class="parentheses_ghost">)</div>');
+window.inserir_open = -1;
+window.inserir_close = -1;
+function renderGhostParentheses (actual_target, command, function_obj, div_to_render, expression_array) {
+
+	/*window.open_parentheses.remove();
+	window.close_parentheses.remove();*/
+
+	var index_in_array = actual_target.data('index');
+
+	if ((expression_array[index_in_array] == '(') || (expression_array[index_in_array] == ')')) {
+		return;
+	}
+
+	if (window.open_or_close == "close") {
+		if (index_in_array < window.inserir_open) {
+			return;
+		}
+	}
+
+	// Tratando a situação quando é na primeira posição:
+
+	if (index_in_array == 0) {
+		if (expression_array[index_in_array].type == "var_value") {
+
+			if (window.open_or_close == "open") {
+				window.open_parentheses.insertBefore(actual_target);
+				window.inserir_open = index_in_array;
+			}
+
+			/*if (expression_array.length == 1) {
+				if (window.open_or_close == "close") {
+					window.close_parentheses.insertAfter(actual_target);
+					window.inserir_close = index_in_array + 2;
+				}*/
+
+			//} else {
+				var count_opened = 0;
+				var count_closed = 0;
+				for (var i = 0; i < expression_array.length; i++) {
+					if ((expression_array[i] == '(')) {
+						count_opened ++;
+					}
+					if (expression_array[i] == ')') {
+						count_closed ++;
+					}
+					if (count_opened != count_closed) {
+					} else {
+						if (count_opened > 0) {
+							if (window.open_or_close == "close") {
+								window.close_parentheses.insertAfter(div_to_render.find('.single_element_expression[data-index="'+i+'"]'));
+								window.inserir_close = i + 2;
+							}
+							break;
+						} else {
+							if (expression_array[i].type == "var_value") {
+								if (window.open_or_close == "close") {
+									window.close_parentheses.insertAfter(div_to_render.find('.single_element_expression[data-index="'+i+'"]'));
+									window.inserir_close = i + 2;
+								}
+								break;
+							}
+						}
+					}
+
+				}
+			//}
+
+		} else if (expression_array[index_in_array].type_op) {
+
+			if (window.open_or_close == "open") {
+				window.open_parentheses.insertBefore(actual_target);
+				window.inserir_open = index_in_array;
+			}
+
+			var count_opened = 0;
+			var count_closed = 0;
+			for (var i = 1; i < expression_array.length; i++) {
+				// $('.slide-link[data-slide="0"]')
+				if ((expression_array[i] == '(')) {
+					count_opened ++;
+				}
+				if (expression_array[i] == ')') {
+					count_closed ++;
+				}
+				if (count_opened != count_closed) {
+				} else {
+					if (count_opened > 0) {
+						if (expression_array[i].type == "var_value") {
+							window.close_parentheses.insertAfter(div_to_render.find('.single_element_expression[data-index="'+i+'"]'));
+							window.inserir_close = i + 2;
+						}
+
+						break;
+					} else {
+						if (expression_array[i].type == "var_value") {
+							if (expression_array[i].type == "var_value") {
+								window.close_parentheses.insertAfter(div_to_render.find('.single_element_expression[data-index="'+i+'"]'));
+								window.inserir_close = i + 2;
+							}
+							break;
+						}
+					}
+				}
+
+			}
+		}
+		return;
+	}
+
+	// Tratando quando não é no índice 0:
+	if (expression_array[index_in_array].type == "var_value") {
+		if (window.open_or_close == "open") {
+			window.open_parentheses.insertBefore(actual_target);
+			window.inserir_open = index_in_array;
+		}
+		if (window.open_or_close == "close") {
+			window.close_parentheses.insertAfter(actual_target);
+			window.inserir_close = index_in_array + 2;
+		}
+		return;
+	}
+
+	if (expression_array[index_in_array].type_op) {
+		// buscar para a esquerda primeiro:
+		if (expression_array[index_in_array - 1] == '(') {
+			if (window.open_or_close == "open") {
+				window.open_parentheses.insertBefore(actual_target);
+				window.inserir_open = index_in_array;
+			}
+		} else if (expression_array[index_in_array - 1] == ')') {
+			// buscar a abertura
+			var count_opened = 0;
+			var count_closed = 0;
+			for (var j = index_in_array - 1; j >= 0; j--) {
+				if ((expression_array[j] == '(')) {
+					count_opened ++;
+				}
+				if (expression_array[j] == ')') {
+					count_closed ++;
+				}
+
+				if (count_opened != count_closed) {
+				} else {
+					if (count_closed > 0) {
+						if (window.open_or_close == "open") {
+							window.open_parentheses.insertBefore(div_to_render.find('.single_element_expression[data-index="'+j+'"]'));
+							window.inserir_open = j;
+						}
+						break;
+					}
+				}
+
+			}
+
+		} else if (expression_array[index_in_array - 1].type == "var_value") {
+			if (window.open_or_close == "open") {
+				window.open_parentheses.insertBefore(div_to_render.find('.single_element_expression[data-index="'+(index_in_array - 1)+'"]'));
+				window.inserir_open = index_in_array - 1;
+			}
+		}
+
+		// buscar para a direita agora:
+		if (expression_array[index_in_array + 1] == '(') {
+			// buscar o fechamento:
+
+			var count_opened = 0;
+			var count_closed = 0;
+			for (var j = index_in_array + 1; j < expression_array.length; j ++) {
+				if ((expression_array[j] == '(')) {
+					count_opened ++;
+				}
+				if (expression_array[j] == ')') {
+					count_closed ++;
+				}
+
+				if (count_opened != count_closed) {
+				} else {
+					if (count_opened > 0) {
+						if (window.open_or_close == "close") {
+							window.close_parentheses.insertAfter(div_to_render.find('.single_element_expression[data-index="'+j+'"]'));
+							window.inserir_close = j + 2;
+						}
+						break;
+					}
+				}
+
+			}
+
+
+		} else if (expression_array[index_in_array + 1].type == "var_value") {
+			if (window.open_or_close == "close") {
+				window.close_parentheses.insertAfter(div_to_render.find('.single_element_expression[data-index="'+(index_in_array + 1)+'"]'));
+				window.inserir_close = index_in_array + 3;
+			}
+		}
+	}
+
+}
+
+function renderParenthesis (div_to_render, expression_content, command, function_obj, position, expression_array) {
+	var ghost_parenthesis = $('<div class="single_element_expression parentheses_in_expression" data-index="'+position+'">'+expression_content+'</div>');
+	div_to_render.append(ghost_parenthesis);
+}
+
+function renderStartAddOperator (div_to_render, types_included, expression_array, command, function_obj, position) {
+	var menu_final = '<div class="ui dropdown disabled usepointer"><div class="text"> + </div><i class="dropdown icon"></i><div class="menu">';
+	if (types_included.indexOf(Models.EXPRESSION_TYPES.exp_arithmetic) >= 0) {
+		if (types_included.length > 1) {
+			menu_final += '<div class="item"><i class="dropdown icon"></i>Aritméticos<div class="menu">';
+			menu_final += getArithmeticOperators();
+			menu_final += '</div></div>';
+		} else {
+			menu_final += getArithmeticOperators();
+		}
+	}
+	if (types_included.indexOf(Models.EXPRESSION_TYPES.exp_logic) >= 0) {
+		if (types_included.length > 1) {
+			menu_final += '<div class="item"><i class="dropdown icon"></i>Lógicos<div class="menu">';
+			menu_final += getLogicOperators();
+			menu_final += '</div></div>';
+		} else {
+			menu_final += getLogicOperators();
+		}
+	}
+	if (types_included.indexOf(Models.EXPRESSION_TYPES.exp_conditional) >= 0) {
+		if (types_included.length > 1) {
+			menu_final += '<div class="item"><i class="dropdown icon"></i>Relacionais<div class="menu">';
+			menu_final += getRelationalOperators();
+			menu_final += '</div></div>';
+		} else {
+			menu_final += getRelationalOperators();
+		}
+	}
+	menu_final += '</div></div>';
+
+	menu_final = $(menu_final);
+	var div_temp = $('<div class="single_element_expression ghost_element mouse_distance"></div>');
+	div_temp.append(menu_final);
+	var div_higher = $('<div class="higher_element"></div>');
+	div_higher.append(div_temp);
+	div_to_render.append(div_higher);
+	menu_final.dropdown('set selected', Models.ARITHMETIC_TYPES.minus);
+
+	div_temp.on('click', function() {
+		if (!window.open_or_close) {
+			var sera = position;
+
+			if (types_included.indexOf(Models.EXPRESSION_TYPES.exp_arithmetic) >= 0) {
+				console.log('p1');
+				expression_array.splice(sera, 0, new Models.ExpressionOperator(Models.EXPRESSION_TYPES.exp_arithmetic,Models.ARITHMETIC_TYPES.minus));
+			} else if (types_included.indexOf(Models.EXPRESSION_TYPES.exp_logic) >= 0) {
+				console.log('p2');
+				expression_array.splice(sera, 0, new Models.ExpressionOperator(Models.EXPRESSION_TYPES.exp_logic,Models.LOGIC_COMPARISON.equals_to));
+			} else if (types_included.indexOf(Models.EXPRESSION_TYPES.exp_conditional) >= 0) {
+				console.log('p3');
+				expression_array.splice(sera, 0, new Models.ExpressionOperator(Models.EXPRESSION_TYPES.exp_conditional,Models.ARITHMETIC_COMPARISON.greater_than));
+			}
+
+			renderExpression(command, function_obj, div_to_render, expression_array);
+		}
+	});
+}
+
+function renderFinalAddElements (div_to_render, types_included, expression_array, command, function_obj, position, is_last = false) {
+
+	var menu_final = '<div class="ui dropdown disabled usepointer"><div class="text"> + </div><i class="dropdown icon"></i><div class="menu">';
+	if (types_included.indexOf(Models.EXPRESSION_TYPES.exp_arithmetic) >= 0) {
+		if (types_included.length > 1) {
+			menu_final += '<div class="item"><i class="dropdown icon"></i>Aritméticos<div class="menu">';
+			menu_final += getArithmeticOperators();
+			menu_final += '</div></div>';
+		} else {
+			menu_final += getArithmeticOperators();
+		}
+	}
+	if (types_included.indexOf(Models.EXPRESSION_TYPES.exp_logic) >= 0) {
+		if (types_included.length > 1) {
+			menu_final += '<div class="item"><i class="dropdown icon"></i>Lógicos<div class="menu">';
+			menu_final += getLogicOperators();
+			menu_final += '</div></div>';
+		} else {
+			menu_final += getLogicOperators();
+		}
+	}
+	if (types_included.indexOf(Models.EXPRESSION_TYPES.exp_conditional) >= 0) {
+		if (types_included.length > 1) {
+			menu_final += '<div class="item"><i class="dropdown icon"></i>Relacionais<div class="menu">';
+			menu_final += getRelationalOperators();
+			menu_final += '</div></div>';
+		} else {
+			menu_final += getRelationalOperators();
+		}
+	}
+	menu_final += '</div></div>';
+
+	menu_final = $(menu_final);
+	var div_temp = $('<div class="simple_add mouse_distance"></div>');
+	var div_higher = $('<div class="higher_element"></div>');
+
+	var button = $('<button class="ui button green add_expression"><i class="plus circle inverted icon"></i></button>');
+	div_temp.append(button);
+
+	if (!is_last) {
+		div_higher.append(div_temp);
+		div_to_render.append(div_higher);
+		//div_temp.append(menu_final);
+		div_temp.css('opacity', '0', '!important');
+	} else {
+		div_temp.removeClass('mouse_distance');
+		div_temp.css('opacity', '1', '!important');
+		//div_temp.append(menu_final);
+		div_to_render.append(div_temp);
+	}
+	
+
+	menu_final.dropdown('set selected', Models.ARITHMETIC_TYPES.plus);
+
+	div_temp.on('click', function() {
+		var sera = position;
+
+		if (expression_array[sera] == ')' && expression_array[sera - 1] == '(') {
+			expression_array.splice(sera, 0, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
+			renderExpression(command, function_obj, div_to_render, expression_array);
+			return;
+		}
+
+		if (types_included.indexOf(Models.EXPRESSION_TYPES.exp_arithmetic) >= 0) {
+			expression_array.splice(sera, 0, new Models.ExpressionOperator(Models.EXPRESSION_TYPES.exp_arithmetic,Models.ARITHMETIC_TYPES.plus));
+			expression_array.splice(sera + 1, 0, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
+		} else if (types_included.indexOf(Models.EXPRESSION_TYPES.exp_logic) >= 0) {
+			expression_array.splice(sera, 0, new Models.ExpressionOperator(Models.EXPRESSION_TYPES.exp_logic,Models.LOGIC_COMPARISON.equals_to));
+			expression_array.splice(sera + 1, 0, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
+		} else if (types_included.indexOf(Models.EXPRESSION_TYPES.exp_conditional) >= 0) {
+			expression_array.splice(sera, 0, new Models.ExpressionOperator(Models.EXPRESSION_TYPES.exp_conditional,Models.ARITHMETIC_COMPARISON.greater_than));
+			expression_array.splice(sera + 1, 0, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
+		}
+
+		renderExpression(command, function_obj, div_to_render, expression_array);
+	});
+}
+
+function renderOperatorMenu (command, function_obj, div_to_render, expression_element, types_included, position, expression_array) {
+
+	var menu_final = '<div class="ui dropdown"><div class="text"> + </div><i class="dropdown icon"></i><div class="menu">';
+	if (types_included.indexOf(Models.EXPRESSION_TYPES.exp_arithmetic) >= 0) {
+		if (types_included.length > 1) {
+			menu_final += '<div class="item"><i class="dropdown icon"></i>Aritméticos<div class="menu">';
+			menu_final += getArithmeticOperators();
+			menu_final += '</div></div>';
+		} else {
+			menu_final += getArithmeticOperators();
+		}
+	}
+	if (types_included.indexOf(Models.EXPRESSION_TYPES.exp_logic) >= 0) {
+		if (types_included.length > 1) {
+			menu_final += '<div class="item"><i class="dropdown icon"></i>Lógicos<div class="menu">';
+			menu_final += getLogicOperators();
+			menu_final += '</div></div>';
+		} else {
+			menu_final += getLogicOperators();
+		}
+	}
+	if (types_included.indexOf(Models.EXPRESSION_TYPES.exp_conditional) >= 0) {
+		if (types_included.length > 1) {
+			menu_final += '<div class="item"><i class="dropdown icon"></i>Relacionais<div class="menu">';
+			menu_final += getRelationalOperators();
+			menu_final += '</div></div>';
+		} else {
+			menu_final += getRelationalOperators();
+		}
+	}
+	menu_final += '</div></div>';
+
+	menu_final = $(menu_final);
+	var div_temp = $('<div class="single_element_expression not_allowed" data-index="'+position+'"></div>');
+	div_temp.append(menu_final);
+	div_to_render.append(div_temp);
+	menu_final.dropdown({
+		onChange: function(value, text, $selectedItem) {
+      		expression_element.item = $selectedItem.data('value');
+      		expression_element.type_op = $selectedItem.data('type');
+    	}
+	});
+
+	menu_final.dropdown('set selected', expression_element.item);
+}
+
+function getArithmeticOperators () {
+	var arithmetic_operators;
+	arithmetic_operators = '<div class="item" data-type="'+Models.EXPRESSION_TYPES.exp_arithmetic+'" data-value="'+Models.ARITHMETIC_TYPES.plus+'">+</div>';
+	arithmetic_operators += '<div class="item" data-type="'+Models.EXPRESSION_TYPES.exp_arithmetic+'" data-value="'+Models.ARITHMETIC_TYPES.minus+'">-</div>';
+	arithmetic_operators += '<div class="item" data-type="'+Models.EXPRESSION_TYPES.exp_arithmetic+'" data-value="'+Models.ARITHMETIC_TYPES.multiplication+'">*</div>';
+	arithmetic_operators += '<div class="item" data-type="'+Models.EXPRESSION_TYPES.exp_arithmetic+'" data-value="'+Models.ARITHMETIC_TYPES.division+'">/</div>';
+	arithmetic_operators += '<div class="item" data-type="'+Models.EXPRESSION_TYPES.exp_arithmetic+'" data-value="'+Models.ARITHMETIC_TYPES.module+'">%</div>';
+	return arithmetic_operators;
+}
+
+function getLogicOperators () {
+	var logic_operators;
+	logic_operators = '<div class="item" data-type="'+Models.EXPRESSION_TYPES.exp_logic+'" data-value="'+Models.LOGIC_COMPARISON.equals_to+'">==</div>';
+	logic_operators += '<div class="item" data-type="'+Models.EXPRESSION_TYPES.exp_logic+'" data-value="'+Models.LOGIC_COMPARISON.not_equals_to+'">!=</div>';
+	logic_operators += '<div class="item" data-type="'+Models.EXPRESSION_TYPES.exp_logic+'" data-value="'+Models.LOGIC_COMPARISON.and+'">'+LocalizedStrings.getUI('and')+'</div>';
+	logic_operators += '<div class="item" data-type="'+Models.EXPRESSION_TYPES.exp_logic+'" data-value="'+Models.LOGIC_COMPARISON.or+'">'+LocalizedStrings.getUI('or')+'</div>';
+	logic_operators += '<div class="item" data-type="'+Models.EXPRESSION_TYPES.exp_logic+'" data-value="'+Models.LOGIC_COMPARISON.not+'">'+LocalizedStrings.getUI('not')+'</div>';
+	return logic_operators;
+}
+
+function getRelationalOperators () {
+	var relational_operators;
+	relational_operators = '<div class="item" data-type="'+Models.EXPRESSION_TYPES.exp_conditional+'" data-value="'+Models.ARITHMETIC_COMPARISON.greater_than+'">></div>';
+	relational_operators += '<div class="item" data-type="'+Models.EXPRESSION_TYPES.exp_conditional+'" data-value="'+Models.ARITHMETIC_COMPARISON.less_than+'"><</div>';
+	relational_operators += '<div class="item" data-type="'+Models.EXPRESSION_TYPES.exp_conditional+'" data-value="'+Models.ARITHMETIC_COMPARISON.equals_to+'">==</div>';
+	relational_operators += '<div class="item" data-type="'+Models.EXPRESSION_TYPES.exp_conditional+'" data-value="'+Models.ARITHMETIC_COMPARISON.not_equals_to+'">!=</div>';
+	relational_operators += '<div class="item" data-type="'+Models.EXPRESSION_TYPES.exp_conditional+'" data-value="'+Models.ARITHMETIC_COMPARISON.greater_than_or_equals_to+'">>=</div>';
+	relational_operators += '<div class="item" data-type="'+Models.EXPRESSION_TYPES.exp_conditional+'" data-value="'+Models.ARITHMETIC_COMPARISON.less_than_or_equals_to+'"><=</div>';
+	return relational_operators;
+}

+ 4 - 1
js/visualUI/commands/iftrue.js

@@ -1,6 +1,7 @@
 import { LocalizedStrings } from '../../services/localizedStringsService';
 import * as CommandsManagement from '../commands';
 import * as ConditionalExpressionManagement from './conditional_expression';
+import * as GenericExpressionManagement from './generic_expression';
 
 export function createFloatingCommand () {
 	return $('<div class="ui iftrue created_element"> <i class="ui icon small random"></i> <span> if (x < 1) { } </span></div>');
@@ -29,7 +30,9 @@ export function renderCommand (command, function_obj) {
 
 	addHandlers(command, function_obj, el);
 
-	ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
+	//ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
+
+	GenericExpressionManagement.renderExpression(command, function_obj, el.find('.conditional_expression'), command.expression);
 
 	if (command.commands_block) {
 		for (var j = 0; j < command.commands_block.length; j++) {

+ 4 - 1
js/visualUI/commands/repeatNtimes.js

@@ -4,6 +4,7 @@ import * as CommandsManagement from '../commands';
 import * as ConditionalExpressionManagement from './conditional_expression';
 import * as VariableValueMenu from './variable_value_menu';
 import * as ContextualizedMenu from './contextualized_menu';
+import * as GenericExpressionManagement from './generic_expression';
 
 export function createFloatingCommand () {
 	return $('<div class="ui repeatNtimes created_element"> <i class="ui icon small sync"></i> <span> para (x = 0; x < 10; x ++) <br> </span></div>');
@@ -26,7 +27,9 @@ export function renderCommand (command, function_obj) {
 
 	VariableValueMenu.renderMenu(command, command.var_attribution, el.find('.variable_attribution'), function_obj);
 
-	ConditionalExpressionManagement.renderExpression(command, command.expression2, function_obj, el.find('.conditional_expression'));
+	//ConditionalExpressionManagement.renderExpression(command, command.expression2, function_obj, el.find('.conditional_expression'));
+
+	GenericExpressionManagement.renderExpression(command, function_obj, el.find('.conditional_expression'), command.expression2);
 
 	VariableValueMenu.renderMenu(command, command.var_incrementation, el.find('.incrementation_variable'), function_obj);	
 

+ 6 - 5
js/visualUI/commands/return.js

@@ -2,25 +2,26 @@ import { Types } from '../types';
 import { LocalizedStrings } from '../../services/localizedStringsService';
 import * as VariableValueMenu from './variable_value_menu';
 import * as CommandsManagement from '../commands';
+import * as GenericExpressionManagement from './generic_expression';
 
 export function createFloatingCommand () {
 	return $('<div class="ui return created_element"> <i class="ui icon small reply"></i> <span> '+LocalizedStrings.getUI('text_return')+' </span></div>');
 }
 
 export function renderCommand (command, function_obj) {
-	var el = $('<div class="ui return command_container"> <i class="ui icon small reply command_drag"></i> <i class="ui icon times red button_remove_command"></i> <span class="span_command_spec"> '+LocalizedStrings.getUI('text_return')+' </span>  <div class="var_value_menu_div"></div></div>');
+	var el = $('<div class="ui return command_container"> <i class="ui icon small reply command_drag"></i> <i class="ui icon times red button_remove_command"></i> <span class="span_command_spec"> '+LocalizedStrings.getUI('text_return')+' </span>  <div class="expression_elements"></div></div>');
 	el.data('command', command);
 
 	addHandlers(command, function_obj, el);
 
 	if (function_obj.return_type != Types.VOID) {
-		VariableValueMenu.renderMenu(command, command.variable_value_menu, el.find('.var_value_menu_div'), function_obj);
+		//VariableValueMenu.renderMenu(command, command.variable_value_menu, el.find('.var_value_menu_div'), function_obj);
+		GenericExpressionManagement.renderExpression(command, function_obj, el.find('.expression_elements'), command.variable_value_menu);
 	} else {
-		el.find('.var_value_menu_div').remove();
+		el.find('.expression_elements').remove();
 		command.variable_value_menu = null;
 	}
-
-
+	
 	return el;
 }
 

+ 28 - 28
js/visualUI/commands/variable_value_menu.js

@@ -61,14 +61,14 @@ export function renderMenu (command, ref_object, dom_object, function_obj, size_
 		menu_var_or_value += '<div class="menu menu_only_functions">';
 		menu_var_or_value += '</div></div>';
 
-		if (command.type == Models.COMMAND_TYPES.attribution) {
+/*		if (command.type == Models.COMMAND_TYPES.attribution) {
 			menu_var_or_value += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
 			menu_var_or_value += '<div class="menu">';
 			menu_var_or_value += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
 			menu_var_or_value += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
 			menu_var_or_value += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
 			menu_var_or_value += '</div></div>';
-		}
+		}*/
 	}
 
     menu_var_or_value += '</div></div>';
@@ -289,14 +289,14 @@ function variableValueMenuCode (command, variable_obj, dom_object, function_obj,
 			var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
 			context_menu += '<div class="item" data-clear="true">'+LocalizedStrings.getUI('btn_clear')+'</div>';
 
-			if (command.type == Models.COMMAND_TYPES.attribution) {
+			/*if (command.type == Models.COMMAND_TYPES.attribution) {
 				context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
 				context_menu += '<div class="menu">';
 				context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
 				context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
 				context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
 				context_menu += '</div></div>';
-			}
+			}*/
 
 			context_menu += '</div></div>';
 
@@ -359,14 +359,14 @@ function variableValueMenuCode (command, variable_obj, dom_object, function_obj,
 			var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
 			context_menu += '<div class="item" data-clear="true">'+LocalizedStrings.getUI('btn_clear')+'</div>';
 
-			if (command.type == Models.COMMAND_TYPES.attribution) {
+			/*if (command.type == Models.COMMAND_TYPES.attribution) {
 				context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
 				context_menu += '<div class="menu">';
 				context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
 				context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
 				context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
 				context_menu += '</div></div>';
-			}
+			}*/
 
 			context_menu += '</div></div>';
 
@@ -419,14 +419,14 @@ function variableValueMenuCode (command, variable_obj, dom_object, function_obj,
 			var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
 			context_menu += '<div class="item" data-clear="true">'+LocalizedStrings.getUI('btn_clear')+'</div>';
 
-			if (command.type == Models.COMMAND_TYPES.attribution) {
+			/*if (command.type == Models.COMMAND_TYPES.attribution) {
 				context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
 				context_menu += '<div class="menu">';
 				context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
 				context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
 				context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
 				context_menu += '</div></div>';
-			}
+			}*/
 
 			context_menu += '</div></div>';
 
@@ -480,14 +480,14 @@ function variableValueMenuCode (command, variable_obj, dom_object, function_obj,
 			var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
 			context_menu += '<div class="item" data-clear="true">'+LocalizedStrings.getUI('btn_clear')+'</div>';
 
-			if (command.type == Models.COMMAND_TYPES.attribution) {
+			/*if (command.type == Models.COMMAND_TYPES.attribution) {
 				context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
 				context_menu += '<div class="menu">';
 				context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
 				context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
 				context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
 				context_menu += '</div></div>';
-			}
+			}*/
 
 			context_menu += '</div></div>';
 
@@ -542,7 +542,7 @@ function variableValueMenuCode (command, variable_obj, dom_object, function_obj,
 			var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
 			context_menu += '<div class="item" data-clear="true">'+LocalizedStrings.getUI('btn_clear')+'</div>';
 
-			if (command.type == Models.COMMAND_TYPES.attribution && !dom_object.hasClass('var_attributed')) {
+			/*if (command.type == Models.COMMAND_TYPES.attribution && !dom_object.hasClass('var_attributed')) {
 				console.log('dom_object6');
 				console.log(dom_object);
 				context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
@@ -551,7 +551,7 @@ function variableValueMenuCode (command, variable_obj, dom_object, function_obj,
 				context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
 				context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
 				context_menu += '</div></div>';
-			}
+			}*/
 
 			context_menu += '</div></div>';
 
@@ -597,14 +597,14 @@ function variableValueMenuCode (command, variable_obj, dom_object, function_obj,
 		var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
 		context_menu += '<div class="item" data-clear="true">'+LocalizedStrings.getUI('btn_clear')+'</div>';
 
-		if (command.type == Models.COMMAND_TYPES.attribution) {
+		/*if (command.type == Models.COMMAND_TYPES.attribution) {
 			context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
 			context_menu += '<div class="menu">';
 			context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
 			context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
 			context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
 			context_menu += '</div></div>';
-		}
+		}*/
 
 		context_menu += '</div></div>';
 
@@ -853,14 +853,14 @@ function openInputToFunction (command, ref_object, dom_object, menu_var_or_value
 		var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
 		context_menu += '<div class="item" data-clear="true">'+LocalizedStrings.getUI('btn_clear')+'</div>';
 
-		if (command.type == Models.COMMAND_TYPES.attribution) {
+		/*if (command.type == Models.COMMAND_TYPES.attribution) {
 			context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
 			context_menu += '<div class="menu">';
 			context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
 			context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
 			context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
 			context_menu += '</div></div>';
-		}
+		}*/
 
 		context_menu += '</div></div>';
 
@@ -912,14 +912,14 @@ function openInputToFunction (command, ref_object, dom_object, menu_var_or_value
 		var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
 		context_menu += '<div class="item" data-clear="true">'+LocalizedStrings.getUI('btn_clear')+'</div>';
 
-		if (command.type == Models.COMMAND_TYPES.attribution) {
+		/*if (command.type == Models.COMMAND_TYPES.attribution) {
 			context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
 			context_menu += '<div class="menu">';
 			context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
 			context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
 			context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
 			context_menu += '</div></div>';
-		}
+		}*/
 
 		context_menu += '</div></div>';
 
@@ -951,9 +951,9 @@ function openInputToFunction (command, ref_object, dom_object, menu_var_or_value
 		});
 	}
 
-	if (command.type == Models.COMMAND_TYPES.attribution) {
+	/*if (command.type == Models.COMMAND_TYPES.attribution) {
 		AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj);
-	}
+	}*/
 }
 
 function openInputToVariable (command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected, expression_element) {
@@ -995,7 +995,7 @@ function openInputToVariable (command, ref_object, dom_object, menu_var_or_value
 	var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
 	context_menu += '<div class="item" data-clear="true">'+LocalizedStrings.getUI('btn_clear')+'</div>';
 
-	if (command.type == Models.COMMAND_TYPES.attribution && !dom_object.hasClass('var_attributed')) {
+	/*if (command.type == Models.COMMAND_TYPES.attribution && !dom_object.hasClass('var_attributed')) {
 		console.log("dom_object 10: ");
 		console.log(dom_object);
 		context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
@@ -1004,7 +1004,7 @@ function openInputToVariable (command, ref_object, dom_object, menu_var_or_value
 		context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
 		context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
 		context_menu += '</div></div>';
-	}
+	}*/
 
 	context_menu += '</div></div>';
 
@@ -1040,9 +1040,9 @@ function openInputToVariable (command, ref_object, dom_object, menu_var_or_value
 	  selectOnKeydown: false
 	});
 
-	if (command.type == Models.COMMAND_TYPES.attribution) {
+	/*if (command.type == Models.COMMAND_TYPES.attribution) {
 		AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected);
-	}
+	}*/
 }
 
 
@@ -1064,14 +1064,14 @@ function openInputToValue (command, ref_object, dom_object, menu_var_or_value, f
 	var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
 	context_menu += '<div class="item" data-clear="true">'+LocalizedStrings.getUI('btn_clear')+'</div>';
 
-	if (command.type == Models.COMMAND_TYPES.attribution) {
+	/*if (command.type == Models.COMMAND_TYPES.attribution) {
 		context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
 		context_menu += '<div class="menu">';
 		context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
 		context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
 		context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
 		context_menu += '</div></div>';
-	}
+	}*/
 
 	context_menu += '</div></div>';
 
@@ -1163,9 +1163,9 @@ function openInputToValue (command, ref_object, dom_object, menu_var_or_value, f
 		openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element)
 	});
 
-	if (command.type == Models.COMMAND_TYPES.attribution) {
+	/*if (command.type == Models.COMMAND_TYPES.attribution) {
 		AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj);
-	}
+	}*/
 }
 
 

+ 4 - 1
js/visualUI/commands/whiletrue.js

@@ -2,6 +2,7 @@ import { LocalizedStrings } from '../../services/localizedStringsService';
 import * as CommandsManagement from '../commands';
 import * as ConditionalExpressionManagement from './conditional_expression';
 import * as ContextualizedMenu from './contextualized_menu';
+import * as GenericExpressionManagement from './generic_expression';
 
 export function createFloatingCommand () {
 	return $('<div class="ui whiletrue created_element"> <i class="ui icon small sync"></i> <span> ' + LocalizedStrings.getUI('text_code_while') + ' ( x < 10 ) <br> </span></div>');
@@ -25,7 +26,9 @@ export function renderCommand (command, function_obj) {
 
 	ContextualizedMenu.renderMenu(command, el.find('.context_menu'), function_obj, el);
 
-	ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
+	//ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
+
+	GenericExpressionManagement.renderExpression(command, function_obj, el.find('.conditional_expression'), command.expression);
 
 	if (command.commands_block) {
 		for (var j = 0; j < command.commands_block.length; j++) {

+ 7 - 2
js/visualUI/commands/writer.js

@@ -3,6 +3,7 @@ import { LocalizedStrings } from '../../services/localizedStringsService';
 import * as VariableValueMenu from './variable_value_menu';
 import * as VariableValueMenuManagement from './variable_value_menu';
 import * as CommandsManagement from '../commands';
+import * as GenericExpressionManagement from './generic_expression';
 
 export function createFloatingCommand () {
 	return $('<div class="ui writer created_element"> <i class="ui icon small upload"></i> <span> '+LocalizedStrings.getUI('text_command_write')+' var </span></div>');
@@ -15,7 +16,11 @@ export function renderCommand (command, function_obj) {
 	var el = $(ret);
 	el.data('command', command);
 
-	for (var i = 0; i < command.content.length; i ++) {
+	//renderExpression (command, function_obj, div_to_render, expression_array)
+
+	GenericExpressionManagement.renderExpression(command, function_obj, el.find('.all_elements_write'), command.content);
+
+	/*for (var i = 0; i < command.content.length; i ++) {
 		var new_div_item = $( '<div class="var_value_menu_div"></div>' );
 		var div_parent_with_handler = $( '<div class="div_parent_handler"></div>' );
 		div_parent_with_handler.append($('<i class="ui icon ellipsis vertical inverted handler"></i>'));
@@ -32,7 +37,7 @@ export function renderCommand (command, function_obj) {
 
 	if (command.content.length == 0) {
 		addHandlerIconAdd(el.find('.all_elements_write'), command, function_obj);
-	}
+	}*/
 
 	addHandlers(command, function_obj, el);
 	return el;

+ 30 - 27
js/visualUI/functions.js

@@ -401,34 +401,37 @@ export function renderFunction (function_obj) {
     });
   }
 
-  var teste  = '.ui.sticky.sticky_cont_'+cont;
-  $(teste).sticky({
-    context: '.ui.bottom.attached.segment.commands_list_div.commands_cont_'+cont,
-    scrollContext: '.ivprog_visual_panel',
-    observeChanges: true,
-    offset: 40,
-    onStick: function (evt) {
-      $(teste).css('top', '20px', 'important');
-    }, 
-    onBottom: function (evt) {
-      $(teste).css('top', '20px', 'important');
-    },
-    onUnstick: function (evt) {
-      $(teste).css('top', '20px', 'important');
-    },
-    onReposition: function (evt) {
-      $(teste).css('top', '20px', 'important');
-    },
-    onScroll: function (evt) {
-      $(teste).css('top', '20px', 'important');
-      if (!isVisible($(teste), $(teste).parent())) {
-        $(teste).removeClass('fixed');
+  if (function_obj.commands.length > 0) {
+    var teste  = '.ui.sticky.sticky_cont_'+cont;
+    $(teste).sticky({
+      context: '.ui.bottom.attached.segment.commands_list_div.commands_cont_'+cont,
+      scrollContext: '.ivprog_visual_panel',
+      observeChanges: true,
+      offset: 40,
+      onStick: function (evt) {
+        $(teste).css('top', '20px', 'important');
+      }, 
+      onBottom: function (evt) {
+        $(teste).css('top', '20px', 'important');
+      },
+      onUnstick: function (evt) {
+        $(teste).css('top', '20px', 'important');
+      },
+      onReposition: function (evt) {
+        $(teste).css('top', '20px', 'important');
+      },
+      onScroll: function (evt) {
+        $(teste).css('top', '20px', 'important');
+        if (!isVisible($(teste), $(teste).parent())) {
+          $(teste).removeClass('fixed');
+        }
+      },
+      onTop: function (evt) {
+        $(teste).css('top', '20px', 'important');
       }
-    },
-    onTop: function (evt) {
-      $(teste).css('top', '20px', 'important');
-    }
-  });
+    });
+  }
+  
   cont ++;
 
   return appender;

+ 9 - 1
js/visualUI/ivprog_elements.js

@@ -15,7 +15,7 @@ export const EXPRESSION_TYPES = Object.freeze({exp_conditional:"exp_conditional"
 
 export const ARITHMETIC_COMPARISON = Object.freeze({greater_than:"greater_than", less_than:"less_than", equals_to:"equals_to", not_equals_to:"not_equals_to", greater_than_or_equals_to:"greater_than_or_equals_to", less_than_or_equals_to:"less_than_or_equals_to"});
 
-export const LOGIC_COMPARISON = Object.freeze({equals_to:"equals_to", not_equals_to:"not_equals_to", and:"and", or:"or"});
+export const LOGIC_COMPARISON = Object.freeze({equals_to:"equals_to", not_equals_to:"not_equals_to", and:"and", or:"or", not:"not"});
 
 export const SYSTEM_FUNCTIONS_CATEGORIES = Object.freeze({math:"math", text:"text_t", arrangement:"arrangement", conversion:"conversion"});
 
@@ -101,6 +101,14 @@ export class Attribution {
   }
 }
 
+export class ExpressionOperator {
+
+  constructor (type_op, item) {
+    this.type_op = type_op; // Logic, Arithmetic OR Relational
+    this.item = item;
+  }
+}
+
 export class ExpressionElement {
 
   constructor (type_exp, itens = []) {

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "ivprog",
-  "version": "1.1.0",
+  "version": "1.2.0",
   "description": "IMA para o ensino de programação",
   "main": "js/main.js",
   "scripts": {

+ 3 - 3
templates/runner.html

@@ -4,7 +4,7 @@
 
   <link rel="stylesheet" type="text/css" href="css/ivprog-term.css">
 
-  <link rel="stylesheet" type="text/css" href="css/semantic.min.css">
+  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.0/semantic.min.css" integrity="sha256-9mbkOfVho3ZPXfM7W8sV2SndrGDuh7wuyLjtsWeTI1Q=" crossorigin="anonymous" />
   <style>
     .ivprog-io-output {
       border: 1px solid gainsboro;
@@ -25,7 +25,8 @@
     }
   </style>
   <title></title>
-  <script type="text/javascript" src="js/jquery-3.3.1.min.js"></script>
+  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
+  <script type="text/javascript" src="js/jquery.json-editor.min.js"></script>
 </head>
 <body>
     <div style="padding-top: 50px;content: ''"></div>
@@ -67,7 +68,6 @@
   
   
 </body>
-<script type="text/javascript" src="js/jquery.json-editor.min.js"></script>
 <script>
   ( function () {
     ivprogCore.runner();

+ 2 - 0
webpack.config.js

@@ -60,6 +60,8 @@ module.exports = {
         {from:"css/ivprog-term.css", to:path.resolve(__dirname, 'build/css')},
         {from:'js/Sortable.js', to:path.resolve(__dirname, 'build/js')},
         {from:'js/iassign-integration-functions.js', to:path.resolve(__dirname, 'build/js')},
+        {from: 'img/trash-icon.png', to:path.resolve(__dirname, 'build/img')},
+        {from:'js/jquery.json-editor.min.js', to:path.resolve(__dirname, 'build/js')},
         /*{from:'index.html', to:path.resolve(__dirname, 'build')},
         {from:'runner.html', to:path.resolve(__dirname, 'build')},*/
       ])