Jelajahi Sumber

Implement routes and views to BugReport, Docs, Download and Publications

Implement directive FocusInput
Lucas de Souza 6 tahun lalu
induk
melakukan
b516108cca
100 mengubah file dengan 0 tambahan dan 64240 penghapusan
  1. 0 120
      css/style.css
  2. 0 53405
      ivprogh/build/ivprog.bundle.js
  3. 0 1
      ivprogh/build/ivprog.bundle.js.map
  4. 0 790
      ivprogh/css/ivprog-visual-1.0.css
  5. TEMPAT SAMPAH
      ivprogh/img/background-panel.png
  6. 0 118
      ivprogh/index.html
  7. 0 90
      ivprogh/js/assessment/ivprogAssessment.js
  8. 0 47
      ivprogh/js/ast/ASA.txt
  9. 0 10
      ivprogh/js/ast/commands/arrayAssign.js
  10. 0 10
      ivprogh/js/ast/commands/arrayDeclaration.js
  11. 0 10
      ivprogh/js/ast/commands/assign.js
  12. 0 8
      ivprogh/js/ast/commands/break.js
  13. 0 18
      ivprogh/js/ast/commands/case.js
  14. 0 14
      ivprogh/js/ast/commands/command.js
  15. 0 16
      ivprogh/js/ast/commands/commandBlock.js
  16. 0 12
      ivprogh/js/ast/commands/declaration.js
  17. 0 13
      ivprogh/js/ast/commands/doWhile.js
  18. 0 16
      ivprogh/js/ast/commands/for.js
  19. 0 17
      ivprogh/js/ast/commands/formalParameter.js
  20. 0 32
      ivprogh/js/ast/commands/function.js
  21. 0 11
      ivprogh/js/ast/commands/ifThenElse.js
  22. 0 37
      ivprogh/js/ast/commands/index.js
  23. 0 10
      ivprogh/js/ast/commands/return.js
  24. 0 10
      ivprogh/js/ast/commands/switch.js
  25. 0 12
      ivprogh/js/ast/commands/sysCall.js
  26. 0 18
      ivprogh/js/ast/commands/while.js
  27. 0 8
      ivprogh/js/ast/error/syntaxError.js
  28. 0 70
      ivprogh/js/ast/error/syntaxErrorFactory.js
  29. 0 24
      ivprogh/js/ast/expressions/arrayAccess.js
  30. 0 87
      ivprogh/js/ast/expressions/arrayLiteral.js
  31. 0 15
      ivprogh/js/ast/expressions/boolLiteral.js
  32. 0 14
      ivprogh/js/ast/expressions/expression.js
  33. 0 36
      ivprogh/js/ast/expressions/functionCall.js
  34. 0 23
      ivprogh/js/ast/expressions/index.js
  35. 0 18
      ivprogh/js/ast/expressions/infixApp.js
  36. 0 15
      ivprogh/js/ast/expressions/intLiteral.js
  37. 0 9
      ivprogh/js/ast/expressions/literal.js
  38. 0 15
      ivprogh/js/ast/expressions/realLiteral.js
  39. 0 14
      ivprogh/js/ast/expressions/stringLiteral.js
  40. 0 14
      ivprogh/js/ast/expressions/unaryApp.js
  41. 0 14
      ivprogh/js/ast/expressions/variableLiteral.js
  42. 0 1182
      ivprogh/js/ast/ivprogParser.js
  43. 0 35
      ivprogh/js/ast/operators.js
  44. 0 22
      ivprogh/js/ast/sourceInfo.js
  45. 0 416
      ivprogh/js/iassign-integration-functions.js
  46. 0 138
      ivprogh/js/io/domConsole.js
  47. 0 37
      ivprogh/js/io/domInput.js
  48. 0 21
      ivprogh/js/io/domOutput.js
  49. 0 6
      ivprogh/js/io/input.js
  50. 0 6
      ivprogh/js/io/output.js
  51. 0 13
      ivprogh/js/main.js
  52. 0 180
      ivprogh/js/processor/compatibilityTable.js
  53. 0 5
      ivprogh/js/processor/context.js
  54. 0 128
      ivprogh/js/processor/definedFunctions.js
  55. 0 398
      ivprogh/js/processor/error/processorErrorFactory.js
  56. 0 8
      ivprogh/js/processor/error/runtimeError.js
  57. 0 8
      ivprogh/js/processor/error/semanticError.js
  58. 0 968
      ivprogh/js/processor/ivprogProcessor.js
  59. 0 58
      ivprogh/js/processor/lib/arrays.js
  60. 0 57
      ivprogh/js/processor/lib/io.js
  61. 0 188
      ivprogh/js/processor/lib/lang.js
  62. 0 254
      ivprogh/js/processor/lib/math.js
  63. 0 94
      ivprogh/js/processor/lib/strings.js
  64. 0 6
      ivprogh/js/processor/modes.js
  65. 0 517
      ivprogh/js/processor/semantic/semanticAnalyser.js
  66. 0 76
      ivprogh/js/processor/store/store.js
  67. 0 54
      ivprogh/js/processor/store/storeObject.js
  68. 0 79
      ivprogh/js/processor/store/storeObjectArray.js
  69. 0 101
      ivprogh/js/processor/store/storeObjectArrayAddress.js
  70. 0 43
      ivprogh/js/processor/store/storeObjectArrayAddressRef.js
  71. 0 43
      ivprogh/js/processor/store/storeObjectRef.js
  72. 0 49
      ivprogh/js/runner.js
  73. 0 61
      ivprogh/js/semantic/semantic-buttons.js
  74. 0 22
      ivprogh/js/services/i18nHelper.js
  75. 0 40
      ivprogh/js/services/languageService.js
  76. 0 4
      ivprogh/js/services/localizedStringsService.js
  77. 0 27
      ivprogh/js/typeSystem/baseTypes.js
  78. 0 36
      ivprogh/js/typeSystem/compoundType.js
  79. 0 38
      ivprogh/js/typeSystem/multiType.js
  80. 0 66
      ivprogh/js/typeSystem/parsers.js
  81. 0 25
      ivprogh/js/typeSystem/type.js
  82. 0 21
      ivprogh/js/typeSystem/types.js
  83. 0 18
      ivprogh/js/util/config.js
  84. 0 19
      ivprogh/js/util/inputTest.js
  85. 0 13
      ivprogh/js/util/outputTest.js
  86. 0 39
      ivprogh/js/visualUI/algorithm.js
  87. 0 1072
      ivprogh/js/visualUI/code_generator.js
  88. 0 1076
      ivprogh/js/visualUI/commands.js
  89. 0 488
      ivprogh/js/visualUI/commands/attribution.js
  90. 0 27
      ivprogh/js/visualUI/commands/break.js
  91. 0 36
      ivprogh/js/visualUI/commands/comment.js
  92. 0 231
      ivprogh/js/visualUI/commands/conditional_expression.js
  93. 0 94
      ivprogh/js/visualUI/commands/contextualized_menu.js
  94. 0 49
      ivprogh/js/visualUI/commands/dowhiletrue.js
  95. 0 32
      ivprogh/js/visualUI/commands/functioncall.js
  96. 0 60
      ivprogh/js/visualUI/commands/iftrue.js
  97. 0 33
      ivprogh/js/visualUI/commands/reader.js
  98. 0 170
      ivprogh/js/visualUI/commands/repeatNtimes.js
  99. 0 32
      ivprogh/js/visualUI/commands/return.js
  100. 0 0
      ivprogh/js/visualUI/commands/switch.js

+ 0 - 120
css/style.css

@@ -1,120 +0,0 @@
-.ivprog-container {
-	-webkit-box-shadow: 0px 0px 31px -5px rgba(0,0,0,0.75);
--moz-box-shadow: 0px 0px 31px -5px rgba(0,0,0,0.75);
-box-shadow: 0px 0px 31px -5px rgba(0,0,0,0.75);
-border-radius: 4px;
-padding-top: 0.3rem;
-}
-footer.container {
-	margin-top: 1%;
-}
-.jumbotron.ivprogh-desc {
-	padding-bottom: 0.5rem;
-	margin-bottom: 1rem;
-}
-.text-reduced {
-	font-size: 96%;
-	margin-bottom: 0.5rem;
-}
-h1 {
-	margin-bottom: 0;
-}
-.col-md-3.item {
-	padding: 1em;
-    background: #007bff;
-    color: white;
-    margin: 1em;
-    border-radius: .5em;
-    text-align: center;
-    border: 1px groove;
-    cursor: pointer;
-} 
-.col-md-3.item .octicon {
-	font-size: 3em;
-}
-.col-md-3.item h4 {
-	font-size: 1.4em;
-	margin-top: 0.6em;
-}
-.row.thumbs-ivprog {
-	margin-top: 1em;
-}
-.row.thumbs-ivprog-download .item {
-	background-color: #5a6570;
-	border: 2px groove;
-}
-.col-md-3.item:hover {
-    background-color: #03396c;
-}
-.col-md-3.item hr {
-    background: white;
-}
-.btn.btn-primary .octicon {
-	font-size: 1.5em;
-	margin-right: 0.5em;
-}
-.download-ivprog {
-    font-size: 1.3em;
-}
-.div-button {
-	text-align: center;
-	padding-top: 2.5em;
-}
-.div-button .span-version {
-	display: block;
-	font-size: 98%;
-}
-.my-4 .octicon-history {
-	font-size: 1em;
-}
-.row.thumbs-ivprog-download {
-    padding-bottom: 3em;
-}
-
-.history-ivprog-version {
-	display: block;
-	font-size: 1em;
-	font-weight: bold;
-	margin-top: -.5em;
-	margin-bottom: .5em;
-}
-.history-ivprog-time {
-    background-color: gray;
-    padding: .4em;
-    border-radius: .4em;
-}
-footer.container {
-	margin-bottom: 1em;
-}
-.example-large-div {
-	background-color: #0bbf4a;
-	border-radius: .8em;
-}
-
-.example-large-div .container .embed-responsive {
-	border-radius: .5em;
-	margin-top: 1em;
-}
-
-.text-count-example {
-	font-size: 1.5em;
-    color: white;
-    text-shadow: 2px 2px gray;
-    font-weight: 600;
-    margin-bottom: .3em;
-    padding-top: .3em;
-}
-.example-large-div .text-reduced {
-	color: #06065a;
-    font-size: 1.1em;
-    text-indent: 1em;
-}
-.text-count-example .octicon {
-	text-shadow: none;
-    font-weight: normal;
-    font-size: .9em;
-    margin-right: .1em;
-}
-.container.text-center .btn {
-	margin: .5em;
-}

File diff ditekan karena terlalu besar
+ 0 - 53405
ivprogh/build/ivprog.bundle.js


File diff ditekan karena terlalu besar
+ 0 - 1
ivprogh/build/ivprog.bundle.js.map


+ 0 - 790
ivprogh/css/ivprog-visual-1.0.css

@@ -1,790 +0,0 @@
-html {
-  height: 100%;
-}
-
-body {
-  height: 100%;
-}
-
-.ui.raised.container.segment.div_to_body {
-  height: 92%;
-  padding: 10px;
-  padding-left: 6px;
-  padding-right: 6px;
-  background-color: #1279c6;
-}
-
-.ivprog_visual_panel {
-	height: 96%;
-	overflow: auto;
-	overflow-x: auto;
-}
-
-.ivprog_textual_code {
-	width: 100%;
-	min-height: 500px;
-	resize: none;
-	background-color: white;
-}
-
-.main_title h2 {
-	margin: 0;
-	color: white;
-}
-.main_title span {
-	font-size: 80%;
-	font-style: italic;
-}
-.ivprog_format_info {
-	cursor: pointer;
-	margin-left: 10px;
-}
-.ivprog_visual_panel {
-	border: 2px solid #A0A0A0;
-	background-color: red;
-}
-
-.ui.container.main_title {
-	float: left;
-	width: 200px;
-}
-.ui.container.content_margin {
-	margin-top: 10px;
-}
-.content_margin .content_sub_margin {
-	display: inline; 
-    margin-left: 34%;
-	margin-top: 50px;
-}
-.ui.icon.menu.center.aligned.container {
-	width: 438px;
-	margin-top: -10px;
-}
-
-.ghost {
-  opacity: .5;
-  background: #C8EBFB;
-}
-
-/* editor visual: **/
-
-.function_signature_div,
-.function_close_div {
-	font-weight: bold;
-	color: black;
-}
-.ui.selection.data_types_dropdown.visible.dropdown>.text:not(.default),
-.ui.selection.parameter_data_types_dropdown.visible.dropdown>.text:not(.default) {
-	font-weight: bold;
-}
-.ui.selection.data_types_dropdown.dropdown,
-.ui.selection.parameter_data_types_dropdown.dropdown {
-	padding-bottom: 0;
-}
-
-.ui.fluid.dropdown.data_types_dropdown {
-	display: inline;
-	width: 150px;
-	border: none;
-	background: none;
-}
-
-.ui.fluid.dropdown.parameter_data_types_dropdown {
-	display: inline;
-	border: none;
-	background: none;
-}
-
-.ui.fluid.dropdown.data_types_dropdown.selection .dropdown.icon,
-.ui.fluid.dropdown.parameter_data_types_dropdown.selection .dropdown.icon {
-	font-size: 1em;
-}
-
-.function_close_div {
-	margin-left: 20px;
-}
-
-.command_div {
-	margin-left: 16px;
-}
-
-.function_draggable_div {
-	width: 16px;
-	float: left;
-}
-
-.function_draggable_div img {
-	margin-bottom: -4px;
-	margin-left: -2px;
-}
-
-.input_name_function{
-	min-width: 50px;
-}
-
-.text_attr_receives {
-	margin-left: 20px;
-	margin-right: 20px;
-}
-
-.menu_operations {
-	margin-left: 10px;
-	margin-right: 10px;
-}
-
-.case_commands_block {
-	/*border: 1px solid red;*/
-}
-
-.context_menu {
-	display: inline;
-	float: right; 
-	margin-right: 25px;
-	margin-top: -4px;
-}
-
-.case_div {
-	border: 1px solid gray;
-	margin-left: 30px;
-	padding-left: 5px;
-	margin-top: 5px;
-}
-
-.function_name_div, .function_return_div, .function_name_parameter, .created_div_valor_var, .function_return, .var_value_menu_div, .variable_rendered, .variable_rendered div, .var_attributed,
-.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 {
-	display: inline;
-}
-
-.conditional_comands_block {
-	min-height: 10px;
-}
-
-.div_comment_text {
-	min-width: 100px;
-	font-style: italic;
-}
-
-.enable_edit_name_function, .add_parameter, .remove_parameter, .add_parameter_button, .remove_variable {
-	cursor: pointer;
-}
-
-[contenteditable="true"]:active,
-[contenteditable="true"]:focus,
-[contenteditable="true"]:hover {
-	border: 1px dashed #000;
-	background: white;
-}
-
-.ui.segment.ivprog_visual_panel {
-	padding: 3px;
-	margin-top: -5px;
-	background: white;
-}
-
-.ui.segment.function_div {
-	padding: 5px;
-	margin: 0;
-	margin-bottom: 5px;
-	background-color: #bddbff;
-}
-
-.ui.button.add_function_button,
-.ui.button.add_variable_button,
-.ui.button.add_command_button {
-	padding: 8px;
-	margin: 0;
-}
-
-.glyphicon-move {
-  cursor: move;
-  cursor: -webkit-grabbing;
-}
-
-.glyphicon.glyphicon-move {
-	float: left;
-}
-
-.remove_function_button, .minimize_function_button, .add_var_top_button, .add_command_top_button {
-	float: right;
-}
-
-.ui.icon.button.remove_function_button,
-.ui.icon.button.minimize_function_button {
-	background: none;
-	padding: 0;
-	margin-top: 12px;
-}
-
-.ui.segment.variables_list_div,
-.ui.segment.commands_list_div {
-	padding: 5px;
-	margin: 0;
-	margin-left: 30px;
-	width: calc(100% - 30px);
-	background-color: #f9f9f9;
-	min-height: 30px;
-}
-
-.ui.segment.variables_list_div {
-	margin-top: 5px;
-}
-
-.ui.labeled.icon.button.add_variable_button,
-.ui.labeled.icon.button.add_command_button {
-	
-}
-
-.program_signature {
-	font-weight: bold;
-	margin: -3px 0 10px -5px;
-}
-
-.program_final {
-	font-weight: bold;
-	margin: 5px 0 0 -5px;
-}
-
-.parameters_list {
-	display: inline;
-}
-
-.parameter_type {
-	margin-left: 10px;
-    margin-right: 15px;
-}
-
-.function_return .dropdown .icon, .parameter_type .dropdown .icon {
-	margin-left: 6px;
-}
-.tabela_var {
-	display: inline;
-}
-.buttons_manage_columns i, .tr_manage_lines i {
-	cursor: pointer;
-	display: inline;
-}
-div.buttons_manage_columns {
-	display: inline;
-}
-.tr_manage_lines {
-	text-align: center;
-}
-.div_valor_var {
-	display: inline;
-}
-.ui.comment span {
-	font-style: italic;
-}
-.ui.comment, .ui.reader, .ui.writer, .ui.attribution, .ui.iftrue, .ui.repeatNtimes, .ui.whiletrue, .ui.dowhiletrue, .ui.switch, .ui.functioncall,
-.ui.return {
-	border: 1px solid gray;
-	padding: 5px;
-	border-radius: 5px;
-	margin: 5px;
-	background: #f9f9f9;
-}
-.ui.repeatNtimes .separator_character {
-	margin-right: 10px;
-}
-.ui.repeatNtimes, .ui.whiletrue {
-    min-height: 50px;
-}
-.ui.dowhiletrue .ui.block_commands {
-	min-height: 10px;
-}
-.add_var_top_button {
-	padding-right: 50px;
-}
-
-.function_signature_div {
-	min-height: 40px;
-	padding-top: 8px;
-}
-
-.move_function {
-	margin-top: 9px;
-}
-
-.div_start_minimize_v {
-	float: right;
-	width: 22px; 
-	height: 10px;
-}
-
-.global_var {
-	margin-bottom: 7px;
-}
-
-.list_globals, .global_const {
-	display: inline;
-}
-
-.created_element {
-	position: absolute;
-	width: 50%;
-	z-index: 99999999;
-	opacity: .8;
-	cursor: move;
-}
-
-.width-dynamic {
-	min-width: 100px;
-}
-
-.ui.icon.plus.square.outline.icon_add_item_to_writer {
-	margin-right: 10px;
-	margin-left: 10px;
-	cursor: pointer;
-}
-
-.button_remove_command, .button_refresh_attribution {
-	float: right;
-	cursor: pointer;
-}
-
-.expression_drag {
-	cursor: col-resize;
-	border: 2px gray solid;
-	display: inline;
-	width: 5px;
-}
-
-.ui.icon.red.exclamation.triangle.error_icon {
-	float: left;
-    margin-left: -30px;
-}
-
-.height_100 {
-  height: 100%;
-}
-
-.default_visual_title {
-  display: none;
-}
-
-.expandingArea textarea {
-	min-height: 30px;
-	resize: none;
-	padding: 5px;
-}
-
-.ui table .btn_actions {
-	text-align: center;
-}
-
-.button_remove_case {
-	cursor: pointer;
-	padding: 3px;
-}
-
-.ui.button_add_case {
-	margin-top: 10px;
-}
-.accordion {
-	margin: auto;
-}
-
-.global_container:hover, 
-.variable_container:hover {
-	border: 2px solid gray;
-	padding-left: 8px;
-	padding-right: 8px;
-	padding-top: 5px;
-	padding-bottom: 4px;
-}
-
-.ui.label.function_name_parameter:hover {
-	border: 2px solid gray;
-	padding: 5px 6px 5px 6px;
-}
-
-.ui.label.function_name_parameter {
-	padding: 7px 8px 7px 8px;
-}
-
-.global_container:hover,  .variable_container:hover {
-	margin-bottom:  4px !important;
-}
-
-.global_container .global_type, .editing_name_var, .global_container .span_value_variable,
-.variable_container .variable_type,  .variable_container .span_value_variable,
-.ui.dropdown.function_return, div.function_name_div_updated,
-.ui.dropdown.parameter_type, .parameter_div_edit {
-	background: #cecece;
-	border-radius: 5px;
-	padding: 4px;
-	margin-left: 5px;
-	margin-right: 5px;
-}
-.parameter_div_edit {
-	padding-bottom: 2px;
-	padding-top: 2px;
-}
-.ui.dropdown.parameter_type {
-
-}
-div.function_name_div_updated {
-	padding-top: 5px;
-	padding-bottom: 5px;
-	margin-right: 10px;
-}
-.function_name_div_updated .name_function_updated {
-	padding-left: 10px;
-    padding-right: 10px;
-}
-.variable_container .variable_type {
-	padding: 5px;
-	margin-left: 0;
-	margin-right: 3px;
-}
-
-.global_container .global_type:hover, .global_container .span_value_variable:hover,
-.variable_container .variable_type:hover, .variable_container .span_value_variable:hover,
-.ui.dropdown.function_return:hover, div.function_name_div_updated:hover,
-.ui.dropdown.parameter_type:hover, .parameter_div_edit:hover {
-	background: #848484;
-	color: #fff;
-	z-index: 999999;
-}
-
-.editing_name_var {
-	min-width: 40px;
-	padding-top: 3px;
-	padding-bottom: 3px;
-}
-
-.global_container .global_type:active, 
-.variable_container .variable_type:active,
-.ui.dropdown.function_return:active, 
-div.function_name_div_updated:active,
-.ui.dropdown.parameter_type:active {
-	background: #636363;
-	color: #fff;
-}
-
-.global_container i {
-	cursor: pointer;
-}
-
-.global_container .ui.icon.plus.square.outline, .global_container .ui.icon.minus.square.outline {
-	font-size: 120%;
-}
-
-.character_equals {
-	vertical-align: sub;
-    font-size: 150%;
-}
-
-.yellow.icon.times.remove_global,
-.yellow.icon.times.remove_variable,
-.yellow.icon.times.remove_parameter {
-	float: right;
-    margin-right: -1px;
-    margin-left: 8px;
-    opacity: 0;
-}
-
-.global_container:hover > .yellow.icon.times.remove_global, .variable_container:hover > .yellow.icon.times.remove_variable,
-.function_name_parameter:hover > .yellow.icon.times.remove_parameter {
-	opacity: 1;
-}
-
-.tr_manage_lines {
-	padding-top: 10px;
-}
-
-.ui.icon.button.add-globalVar-button.add_global_button {
-	padding: 7px;
-    margin-bottom: 4px;
-    padding-bottom: 9px;
-}
-.all_functions {
-	margin-top: -5px;
-}
-.only_in_frame {
-	position: absolute;
-    z-index: 9999;
-    width: 90px;
-    top: 5px;
-    left: 5px;
-    opacity: .6;
-}
-.only_in_frame:hover {
-	opacity: 1;
-}
-.only_in_frame:hover span {
-	display: block;
-}
-.only_in_frame span {
-	display: none;
-	margin-top: -5px;
-}
-.ui.container.main_title {
-	width: 85px;
-}
-.ui.label.global_container {
-	margin-bottom: 3px;
-}
-.ui.label.variable_container {
-	margin-bottom: 3px;
-}
-.created_div_valor_var {
-	display: inline-block;
-}
-.ui.dropdown.function_return {
-	padding-left: 15px;
-    padding-right: 15px;
-    margin-left: 10px;
-    margin-right: 10px;
-}
-.parethesis_function {
-	font-size: 120%;
-}
-
-.var_value_menu_div,
-.attribution .var_attributed,
-.component_element,
-.conditional_expression .expression_element,
-.menu_start_rendered,
-.attribution_expression .variable_attribution,
-.render_style_param,
-.attribution_expression .div_expression_st:not(:empty),
-.incrementation_field .incrementation_variable,
-.incrementation_field .first_operand:not(:empty),
-.incrementation_field .operator:not(:empty),
-.incrementation_field .second_operand:not(:empty) {
-	background: #e8e8e8;
-	border-radius: 5px;
-	min-width: 40px;
-	padding: 2px;
-    padding-left: 5px;
-    padding-right: 5px;
-    border: 1px solid gray;
-    box-shadow: 0 3px 3px 0 rgba(0, 0, 0, 0.2), 0 3px 3px 0 rgba(0, 0, 0, 0.19);
-    color: black;
-}
-.menu_start_rendered {
-	padding-left: 12px;
-}
-.menu_start_rendered i {
-	width: 1.5em;
-    margin-right: -1em;
-}
-.row_container:hover, .column_container:hover {
-	background: #cecece;
-}
-
-.column_container, .row_container {
-	border-radius: 4px;
-    border: 1px solid gray;
-    padding: 1px 2px 1px 2px;
-    background: #e8e8e8;
-
-    box-shadow: 0 3px 3px 0 rgba(0, 0, 0, 0.2), 0 3px 3px 0 rgba(0, 0, 0, 0.19);
-}
-
-.var_value_menu_div div i {
-	color: black;
-}
-
-.span_command_spec {
-	color: black;
-	font-weight: bold;
-	font-size: 110%;
-}
-
-.ui.comment.command_container .var_value_menu_div {
-	display: inline-block;
-	width: 93%;
-}
-
-.ui.comment.command_container .var_value_menu_div .variable_rendered,
-.ui.comment.command_container .var_value_menu_div .value_rendered {
-    width: 100%;
-    cursor: text;
-    font-style: italic;
-}
-
-.ui.comment.command_container .var_value_menu_div {
-	cursor: text;
-}
-
-.ui.comment.command_container .var_value_menu_div {
-	background: none;
-	border-radius: 0;
-    border: 0px solid gray;
-    box-shadow: none;
-    padding: 0px;
-    font-size: 110%;
-}
-.ui.comment.command_container .var_name,
-.ui.comment.command_container .value_rendered {
-	color: rgba(0,0,0,.6);
-}
-.ui.comment.command_container .var_value_menu_div input {
-    width: 100%;
-    display: inline-block;
-    font-style: italic;
-}
-.ui.dropdown.menu_start_rendered .text i {
-    padding-right: 8px;
-}
-
-* {
-	font-family: 'Roboto', sans-serif;
-}
-
-.add_global_button i {
-	font-size: 130%;
-}
-
-.global_var .circle.add_global_button, .global_var i.back,
-.ui.add_var_context .icon.plus.circle, .ui.add_var_context .icon.circle.back,
-.ui.inline_add_command .icon.plus.circle, .ui.inline_add_command .icon.circle.back {
-	position: absolute;
-}
-.global_var .circle.add_global_button,
-.ui.add_var_context .icon.plus.circle,
-.inline_add_command .icon.plus.circle {
-	z-index: 10;
-	color: #bf80d4!important;
-	cursor: pointer;
-	font-style: 120%;
-}
-.global_var i.back,
-.ui.add_var_context .icon.circle.back,
-.inline_add_command .icon.circle.back {
-	z-index: 9;
-	color: white !important;
-}
-.ui.add_var_context{
-	margin-left: -4px;
-}
-.inline_add_command {
-	color: #ab0054 !important;
-}
-
-.ui.add_var_context .icon.superscript {
-	font-size: 110%;
-}
-.ui.add_var_context .ui.icon.button.purple {
-	padding: 8px;
-}
-
-.global_container .global_const, .global_container .global_type,
-.variable_container .variable_type {
-	font-size: 114%;
-}
-.global_container .editing_name_var,
-.variable_container .editing_name_var {
-	font-size: 108%;
-}
-.global_container .global_const i {
-	font-size: 120%;
-}
-.global_container .span_value_variable,
-.variable_container .span_value_variable {
-    font-size: 110%;
-}
-.global_container .global_type, .global_container .editing_name_var, .global_container .span_value_variable,
-.variable_container .variable_type,  .variable_container .span_value_variable, .variable_container .editing_name_var,
-.ui.dropdown.parameter_type, .parameter_div_edit {
-	background: black;
-	border-radius: 5px;
-	padding: 4px;
-	margin-left: 5px;
-	margin-right: 5px;
-}
-
-.global_container .global_type:hover, .global_container .editing_name_var:hover, .global_container .span_value_variable:hover,
-.variable_container .variable_type:hover,  .variable_container .span_value_variable:hover, .variable_container .editing_name_var:hover,
-.ui.dropdown.parameter_type:hover, .parameter_div_edit:hover {
-	background-color: #545353;
-}
-.yellow.icon.times.remove_global,
-.yellow.icon.times.remove_variable {
-	color: yellow;
-	font-size: 125%;
-}
-.inline_add_command .icon.plus.circle {
-	color: #ec9962 !important;
-}
-.inline_add_command .icon.plus.circle, 
-.inline_add_command .icon.circle.back,
-.ui.add_var_context .icon.plus.circle, 
-.ui.add_var_context .icon.circle.back,
-.global_var .icon.plus.circle, 
-.global_var .icon.circle.back {
-	left: 1.8em !important;
-	margin-top: 1.5em !important;
-}
-.ui.icon.button.dropdown.menu_commands {
-    float: left;
-    color: white;
-    margin-left: -4px;
-    padding: 8px;
-    margin-top: 0.3em;
-}
-
-.ui.dropdown.variable_type {
-	padding: 5px;
-}
-
-.global_var .global_container .ellipsis,
-.variable_container .ui.icon.ellipsis.vertical.inverted,
-.ui.label.function_name_parameter.pink .ui.icon.ellipsis.vertical.inverted {
-	position: relative;
-    margin-left: -3px;
-    margin-right: 4px;
-    opacity: 0;
-    cursor: move;
-    font-size: 120%;
-}
-
-.global_container:hover > .ellipsis,
-.variable_container:hover > .ui.icon.ellipsis.vertical.inverted {
-	opacity: 1;
-}
-
-.glyphicon.glyphicon-move.move_function i {
-	font-size: 130%;
-}
-
-.span_name_parameter.label_enable_name_parameter {
-	font-size: 94%;
-    font-weight: 700;
-}
-
-.ui.dropdown.parameter_type {
-	font-size: 96%;
-}
-.ui.label.function_name_parameter .ellipsis {
-	font-size: 96% !important;
-	margin-left: .05em !important;
-}
-.ui.label.function_name_parameter:hover > .ellipsis {
-	opacity: 1 !important;
-}
-
-.command_container {
-    background: #e9dede !important;
-	border: 2px solid #e76060 !important;
-    border-radius: 0.25em !important;
-}
-.command_drag {
-	cursor: move;
-}
-.command_container.over_command_drag {
-	border: 3px dotted blue !important;
-	padding: 0.315em !important;
-}
-.commands_list_div.over_command_drag {
-	border: 3px dotted blue !important;
-	padding: 0.2em !important;
-}
-.ui.segment:first-child {
-	margin-top: 1em !important;
-}

TEMPAT SAMPAH
ivprogh/img/background-panel.png


+ 0 - 118
ivprogh/index.html

@@ -1,118 +0,0 @@
-<!DOCTYPE html>
-<html>
-  <head>
-    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
-    <meta http-equiv="cache-control" content="no-cache">
-    <meta http-equiv="cache-control" content="no-store">
-    <meta http-equiv="cache-control" content="max-age=0">
-    <meta http-equiv="expires" content="-1">
-    <meta http-equiv="pragma" content="no-cache">
-    <title></title>
-    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
-    <link rel="stylesheet" type="text/css" href="js/semantic/semantic.min.css">
-    <link rel="stylesheet" type="text/css" href="css/ivprog-visual-1.0.css">
-    <link rel="stylesheet" type="text/css" href="css/ivprog-term.css">
-    <script src="js/jquery-3.3.1.min.js"></script>
-    <script src="js/iassign-integration-functions.js"></script>
-    <script src="build/ivprog.bundle.js"></script>
-    <script src="js/semantic/semantic.min.js"></script>
-    <script src="js/semantic/semantic-buttons.js"></script>
-
-    <script src="js/jquery-ui.js"></script>
-    <script src="js/Sortable.js"></script>
-    
-  </head>
-  <body>
-
-    <div class="ui height_100 add_accordion" id="ui_main_div">
-
-    <div class="content height_100">
-   
-    <div class="ui raised container segment div_to_body">
-
-      <div class="ui container main_title only_in_frame">
-      <h2>iVProg</h2>
-    </div>
-
-      <div class="ui icon menu center aligned container" style="width: 438px; margin-top: -20px;">
-        <a class="item active visual_coding_button">
-          <i class="window maximize outline icon"></i>
-        </a>
-        <a class="item textual_coding_button">
-          <i class="code icon"></i>
-        </a>
-        <a class="item upload_file_button disabled">
-          <i class="upload icon"></i>
-        </a>
-        <a class="item download_file_button disabled">
-          <i class="download icon"></i>
-        </a>
-        <a class="item undo_button disabled">
-          <i class="undo icon"></i>
-        </a>
-        <a class="item redo_button disabled">
-          <i class="redo icon"></i>
-        </a>
-        <a class="item run_button">
-          <i class="play icon"></i>
-        </a>
-        <a class="item assessment assessment_button">
-          <i class="check icon"></i>
-        </a>
-        <!--<a class="item expand_button">
-          <i class="expand arrows alternate icon"></i>
-        </a>-->
-        <a class="item help_button">
-          <i class="help icon"></i>
-        </a>
-      </div>
-
-      <div class="ui one column container segment ivprog_visual_panel loading">
-
-        <div class="global_var">
-          <i class="icon plus circle purple add_global_button"></i>
-          <i class="icon circle white back"></i>
-
-          <div class="ui icon button add-globalVar-button add_global_button purple"><i class="icon superscript"></i></div>
-
-          <div class="list_globals" id="listGlobalsHandle"></div>
-
-        </div>
-
-        <div class="all_functions list-group" id="listWithHandle">
-
-        </div>
-
-
-        <div class="ui teal small labeled icon button add_function_button">
-          <data class="i18n" value="ui:btn_function">Function</data>
-          <i class="add icon"></i>
-        </div>
-        <div class="program_final"></div>
-
-      </div>
-
-
-      <div class="ui one column container segment ivprog_textual_panel loading" style="display: none;">
-        <textarea class="ivprog_textual_code" readonly></textarea>
-      </div>
-
-      <div id='ivprog-term' class="six column wide">
-        <div class="div_toggle_console"><i class="inverted terminal icon green button_toggle_console"></i></div>
-      </div>
-    </div>
-
-    </div>
-
-  </div>
-
-    <script>
-      $(document).ready(() => {
-        ivprogCore.LocalizedStrings.updateTagText();
-        ivprogCore.initVisualUI();
-        prepareEnvironment();
-      });
-    </script>
-
-  </body>
-</html>

+ 0 - 90
ivprogh/js/assessment/ivprogAssessment.js

@@ -1,90 +0,0 @@
-import { IVProgParser } from "./../ast/ivprogParser";
-import { SemanticAnalyser } from "./../processor/semantic/semanticAnalyser";
-import { IVProgProcessor } from "./../processor/ivprogProcessor";
-import { InputTest } from "./../util/inputTest";
-import { OutputTest } from "./../util/outputTest";
-
-export class IVProgAssessment {
-
-  constructor (textCode, testCases, domConsole) {
-    this.textCode = textCode;
-    this.testCases = testCases;
-    this.domConsole = domConsole;
-  }
-
-  runTest () {
-    try {
-      // try and show error messages through domconsole
-      const parser = IVProgParser.createParser(this.textCode);
-      const semantic = new SemanticAnalyser(parser.parseTree());
-      const validTree = semantic.analyseTree();
-      // loop test cases and show messages through domconsole
-      const partialTests = this.testCases.map( (t, name) => {
-        return this.partialEvaluateTestCase(new IVProgProcessor(validTree), t.input, t.output, name);
-      });
-      const testResult = partialTests.reduce((acc, curr) => acc.then( v => curr(v)), Promise.resolve(0));
-      return testResult.then(total => Promise.resolve(total / this.testCases.length))
-        .catch(err => {
-          this.domConsole.err("Erro durante a execução do programa");// try and show error messages through domconsole
-          this.domConsole.err(err.message);
-          return Promise.resolve(0);
-      });
-    } catch (error) {
-      this.domConsole.err("Erro durante a execução do programa");// try and show error messages through domconsole
-      this.domConsole.err(error.message);
-      return Promise.resolve(0);
-    }
-  }
-
-  evaluateTestCase (prog, inputList, outputList, name, accumulator) {
-    const outerThis = this;
-    const input = new InputTest(inputList);
-    const output = new OutputTest();
-    prog.registerInput(input);
-    prog.registerOutput(output);
-    const startTime = Date.now()
-    return prog.interpretAST().then( _ => {
-      const millis = Date.now() - startTime;
-      if (input.inputList.length !== input.index) {
-        outerThis.domConsole.err(`Caso de teste ${name + 1}: Falhou, ainda restam entradas!`);
-        outerThis.domConsole.info(`Levou ${millis}ms`);
-        return Promise.resolve(accumulator + 1 * (input.index/inputList.length));
-      } else if (output.list.length < outputList.length) {
-        outerThis.domConsole.err(`Caso de teste ${name + 1}: Falhou <${inputList.join(", ")};${outputList.join(", ")};${output.list.join(", ")}>`);
-        outerThis.domConsole.info(`Levou ${millis}ms`);
-        return Promise.resolve(accumulator + 1 * (output.list.length/outputList.length));
-      } else if (output.list.length > outputList.length) {
-        outerThis.domConsole.err(`Caso de teste ${name + 1}: Falhou <${inputList.join(", ")};${outputList.join(", ")};${output.list.join(", ")}>`);
-        outerThis.domConsole.info(`Levou ${millis}ms`);
-        return Promise.resolve(accumulator + 1 * (outputList.length/output.list.length));
-      } else {
-        const isOk = outerThis.checkOutput(output.list, outputList);
-        if(!isOk) {
-          outerThis.domConsole.err(`Caso de teste ${name + 1}: Falhou <${inputList.join(", ")};${outputList.join(", ")};${output.list.join(", ")}>`);
-          outerThis.domConsole.info(`Levou ${millis}ms`);
-          return Promise.resolve(accumulator);
-        } else {
-          outerThis.domConsole.info(`Caso de teste ${name + 1}: OK!`);
-          outerThis.domConsole.info(`Levou ${millis}ms`);
-          return Promise.resolve(accumulator + 1);
-        }
-      }
-    }).catch( _ => Promise.resolve(accumulator));
-  }
-
-  partialEvaluateTestCase (prog, inputList, outputList, name) {
-    let partial = (accumulator) => this.evaluateTestCase(prog, inputList, outputList, name, accumulator)
-    partial = partial.bind(this);
-    return partial;
-  }
-
-  checkOutput (aList, bList) {
-    for (let i = 0; i < aList.length; i++) {
-      const outValue = aList[i];
-      if(outValue != bList[i]) {
-        return false;
-      }
-    }
-    return true;
-  }
-}

+ 0 - 47
ivprogh/js/ast/ASA.txt

@@ -1,47 +0,0 @@
-/*
-  Raiz(ASA)
-    |
-    |
-  DeclaraçõesGlobais + Funções
-
-  DeclaracaoGlobal
-    |
-    |
-  const? TIPO ID (= EAnd)?
-
-  Função
-    |
-    |
-  Declaracao => TIPO ID (= EAnd)?
-  Attribuição => ID = EAnd
-  IF, WHILE, SWITCH, FuncCall, RETURN
-
-  EAnd
-    |
-    |
-  EOR ( 'and' EAnd)?
-
-  EOR   => ENot ('or' EAnd)?
-
-  ENot  => 'not'? ER
-
-  ER    => E ((>=, <=, ==, >, <) E)?
-
-  E     => factor ((+, -) E)?
-
-  factor=> term ((*, /, %) factor)?
-
-  term  => literal || arrayAccess || FuncCall || ID || '('EAnd')'
-
-  arrayAccess
-    |
-    |
-  ID'['E']'('['E']')*
-
-  FuncCall
-    |
-    |
-  ID'('p.a')'
-
-  p.a => E (, p.a)?
-**/

+ 0 - 10
ivprogh/js/ast/commands/arrayAssign.js

@@ -1,10 +0,0 @@
-import { Assign } from './assign';
-
-export class ArrayIndexAssign extends Assign {
-
-  constructor (id, lineExpression, columnExpression, expression) {
-    super(id, expression);
-    this.line = lineExpression;
-    this.column = columnExpression;
-  }
-}

+ 0 - 10
ivprogh/js/ast/commands/arrayDeclaration.js

@@ -1,10 +0,0 @@
-import { Declaration } from './declaration';
-
-export class ArrayDeclaration extends Declaration {
-
-  constructor (id, type, lines, columns, initial, isConst)   {
-    super(id, type, initial, isConst);
-    this.lines = lines;
-    this.columns = columns;
-  }
-}

+ 0 - 10
ivprogh/js/ast/commands/assign.js

@@ -1,10 +0,0 @@
-import { Command } from './command';
-
-export class Assign extends Command {
-  
-  constructor (id, expression) {
-    super();
-    this.id = id;
-    this.expression = expression;
-  }
-}

+ 0 - 8
ivprogh/js/ast/commands/break.js

@@ -1,8 +0,0 @@
-import { Command } from './command';
-
-export class Break extends Command {
-
-  constructor () {
-    super();
-  }
-}

+ 0 - 18
ivprogh/js/ast/commands/case.js

@@ -1,18 +0,0 @@
-import { Command } from './command';
-
-export class Case extends Command {
-
-  constructor (expression) {
-    super();
-    this.expression = expression;
-    this.commands = [];
-  }
-
-  setCommands (commands) {
-    this.commands = commands;
-  }
-
-  get isDefault () {
-    return this.expression === null;
-  }
-}

+ 0 - 14
ivprogh/js/ast/commands/command.js

@@ -1,14 +0,0 @@
-export class Command {
-
-  constructor () {
-    this._sourceInfo = null;
-  }
-
-  set sourceInfo (sourceInfo) {
-    this._sourceInfo = sourceInfo;
-  }
-
-  get sourceInfo () {
-    return this._sourceInfo;
-  }
-}

+ 0 - 16
ivprogh/js/ast/commands/commandBlock.js

@@ -1,16 +0,0 @@
-export class CommandBlock {
-	
-	constructor(variables, commands) {
-		this.variables = variables;
-		this.commands = commands;
-		this._sourceInfo = null;
-	}
-
-	set sourceInfo (sourceInfo) {
-		this._sourceInfo = sourceInfo;
-	}
-
-	get sourceInfo () {
-		return this._sourceInfo;
-	}
-}

+ 0 - 12
ivprogh/js/ast/commands/declaration.js

@@ -1,12 +0,0 @@
-import { Command } from './command';
-
-export class Declaration extends Command {
-  
-  constructor (id, type, initial, isConst) {
-    super();
-    this.id = id;
-    this.type = type;
-    this.initial = initial;
-    this.isConst = isConst;
-  }
-}

+ 0 - 13
ivprogh/js/ast/commands/doWhile.js

@@ -1,13 +0,0 @@
-import { While } from './while';
-
-export class DoWhile extends While {
-
-  constructor(condition, commandBlock) {
-    super(condition, commandBlock);
-  }
-
-  get testFirst () {
-    return false;
-  }
-  
-}

+ 0 - 16
ivprogh/js/ast/commands/for.js

@@ -1,16 +0,0 @@
-import { Command } from './command';
-
-export class For extends Command {
-
-  constructor (assignment, condition, increment, commandBlock) {
-    super();
-    this.assignment = assignment;
-    this.condition = condition;
-    this.increment = increment;
-    this.commandBlock = commandBlock;
-  }
-
-  get commands () {
-    return this.commandBlock.commands;
-  }
-}

+ 0 - 17
ivprogh/js/ast/commands/formalParameter.js

@@ -1,17 +0,0 @@
-export class FormalParameter {
-
-  constructor (type, id, byRef = false) {
-    this.type = type;
-    this.id = id;
-    this.byRef = byRef;
-    this._sourceInfo = null;
-  }
-
-  set sourceInfo (sourceInfo) {
-		this._sourceInfo = sourceInfo;
-	}
-
-	get sourceInfo () {
-		return this._sourceInfo;
-	}
-}

+ 0 - 32
ivprogh/js/ast/commands/function.js

@@ -1,32 +0,0 @@
-import { Types } from './../../typeSystem/types';
-
-export class Function {
-
-  constructor(name, returnType, formalParameters, commandBlock) {
-    this.name = name;
-    this.returnType = returnType;
-    this.formalParameters = formalParameters;
-    this.commandBlock = commandBlock;
-    this._sourceInfo = null;
-  }
-
-  get isMain () {
-    return this.name === null && this.returnType.isCompatible(Types.VOID);
-  }
-
-  get commands () {
-    return this.commandBlock.commands;
-  }
-
-  get variablesDeclarations () {
-    return this.commandBlock.variables;
-  }
-
-  set sourceInfo (sourceInfo) {
-		this._sourceInfo = sourceInfo;
-	}
-
-	get sourceInfo () {
-		return this._sourceInfo;
-	}
-}

+ 0 - 11
ivprogh/js/ast/commands/ifThenElse.js

@@ -1,11 +0,0 @@
-import { Command } from './command';
-
-export class IfThenElse extends Command {
-
-  constructor (condition, ifTrue, ifFalse) {
-    super();
-    this.condition = condition;
-    this.ifTrue = ifTrue;
-    this.ifFalse = ifFalse;
-  }
-}

+ 0 - 37
ivprogh/js/ast/commands/index.js

@@ -1,37 +0,0 @@
-import { Break } from './break';
-import { Return } from './return';
-import { Assign } from './assign';
-import { ArrayIndexAssign } from './arrayAssign';
-import { Declaration } from './declaration';
-import { ArrayDeclaration } from './arrayDeclaration';
-import { While } from './while';
-import { For } from './for';
-import { Function } from './function';
-import { IfThenElse } from './ifThenElse';
-import { CommandBlock } from './commandBlock';
-import { DoWhile } from './doWhile';
-import { Switch } from './switch';
-import { Case } from './case';
-import { SysCall } from './sysCall';
-import { FormalParameter } from './formalParameter';
-import { FunctionCall } from './../expressions/functionCall'; //Proxy to expression since they do exatcly the same thing
-
-export {
-  Break,
-  Return,
-  Assign,
-  ArrayIndexAssign,
-  Declaration,
-  ArrayDeclaration,
-  While,
-  For,
-  Function,
-  IfThenElse,
-  CommandBlock,
-  DoWhile,
-  Switch,
-  Case,
-  SysCall,
-  FormalParameter,
-  FunctionCall
-};

+ 0 - 10
ivprogh/js/ast/commands/return.js

@@ -1,10 +0,0 @@
-import { Command } from './command';
-
-export class Return extends Command {
-
-  constructor(expression) {
-    super();
-    this.expression = expression;
-  }
-  
-}

+ 0 - 10
ivprogh/js/ast/commands/switch.js

@@ -1,10 +0,0 @@
-import { Command } from './command';
-
-export class Switch extends Command {
-  
-  constructor (expression, cases) {
-    super();
-    this.expression = expression;
-    this.cases = cases;
-  }
-}

+ 0 - 12
ivprogh/js/ast/commands/sysCall.js

@@ -1,12 +0,0 @@
-/**
- * This class represents all the language defined functions.
- * The language processor uses the id provided here to properly execute the desired function.
- * The function is actually implemented inside the language processor.
- * All the functions can be found at: js/processor/definedFunctions.js
- */
-export class SysCall {
-
-  constructor (langFunc) {
-    this.langFunc = langFunc;
-  }
-}

+ 0 - 18
ivprogh/js/ast/commands/while.js

@@ -1,18 +0,0 @@
-import { Command } from './command';
-
-export class While extends Command {
-
-  constructor (expression, commandBlock) {
-    super();
-    this.expression = expression;
-    this.commandBlock = commandBlock;
-  }
-
-  get commands () {
-    return this.commandBlock.commands;
-  }
-
-  get testFirst () {
-  	return true;
-  }
-}

+ 0 - 8
ivprogh/js/ast/error/syntaxError.js

@@ -1,8 +0,0 @@
-export class SyntaxError extends Error {
-
-  constructor (...msg) {
-    super(...msg);
-    if(Error.captureStackTrace)
-      Error.captureStackTrace(this, SyntaxError);
-  }
-}

+ 0 - 70
ivprogh/js/ast/error/syntaxErrorFactory.js

@@ -1,70 +0,0 @@
-import { LocalizedStrings } from './../../services/localizedStringsService';
-import { SyntaxError } from './syntaxError';
-
-export const SyntaxErrorFactory = Object.freeze({
-  extra_lines: () => new SyntaxError(LocalizedStrings.getError("extra_lines")),
-  token_missing_one: (expected, token) => {
-    const context = [expected, token.text, token.line, token.column];
-    return new SyntaxError(LocalizedStrings.getError("token_missing_one", context));
-  },
-  token_missing_list: (expectedList, token) => {
-    const line = expectedList.join(LocalizedStrings.getOR());
-    return SyntaxErrorFactory.token_missing_one(line, token);
-  },
-  id_missing: (token) => {
-    const context = [token.text, token.line, token.column];
-    return new SyntaxError(LocalizedStrings.getError("id_missing", context));
-  },
-  eos_missing: (token) => {
-    const context = [token.line, token.column];
-    return new SyntaxError(LocalizedStrings.getError("eos_missing", context));
-  },
-  invalid_array_dimension: (typeName, token) => {
-    const context = [token.line, token.column, typeName];
-    return new SyntaxError(LocalizedStrings.getError("invalid_array_dimension", context));
-  },
-  invalid_array_size: (token) => {
-    const context = [token.line];
-    return new SyntaxError(LocalizedStrings.getError("invalid_array_size", context));
-  },
-  invalid_main_return: (name, typeName, token) => {
-    const context = [name, typeName, token.line];
-    return new SyntaxError(LocalizedStrings.getError("invalid_main_return", context));
-  },
-  invalid_var_declaration: (token) => {
-    const context = [token.line];
-    return new SyntaxError(LocalizedStrings.getError("invalid_var_declaration", context));
-  },
-  invalid_break_command: (cmdName, token) => {
-    const context = [token.line, cmdName];
-    return new SyntaxError(LocalizedStrings.getError("invalid_break_command", context));
-  },
-  invalid_terminal: (token) => {
-    const context = [token.text, token.line, token.column];
-    return new SyntaxError(LocalizedStrings.getError('invalid_terminal', context));
-  },
-  invalid_type: (list, token) => {
-    const line = list.join(LocalizedStrings.getOR());
-    const context = [token.text, token.line, token.column, line]
-    return new SyntaxError(LocalizedStrings.getError("invalid_type", context));
-  },
-  const_not_init: (token) => {
-    const context = [token.line, token.column];
-    return new SyntaxError(LocalizedStrings.getError("const_not_init", context));
-  },
-  invalid_id_format: (token) => {
-    const context = [token.text, token.line, token.column];
-    return new SyntaxError(LocalizedStrings.getError("invalid_id_format", context));
-  },
-  duplicate_function: (token) => {
-    const context = [token.text, token.line, token.column];
-    return new SyntaxError(LocalizedStrings.getError("duplicate_function", context));
-  },
-  main_parameters: () => {
-    return new SyntaxError(LocalizedStrings.getError("main_parameters"));
-  },
-  duplicate_variable: (token) => {
-    const context = [token.text, token.line, token.column];
-    return new SyntaxError(LocalizedStrings.getError("duplicate_variable", context));
-  }
-});

+ 0 - 24
ivprogh/js/ast/expressions/arrayAccess.js

@@ -1,24 +0,0 @@
-import { Expression } from './expression';
-
-export class ArrayAccess extends Expression {
-	
-	constructor (id, line, column) {
-		super();
-		this.id = id;
-		this.line = line;
-		this.column = column;
-	}
-
-	toString () {
-		const strLine = this.line.toString();
-		let strColumn = null;
-		if(this.column) {
-			strColumn = this.column.toString();
-		}
-		if(strColumn) {
-			return `${this.id}[${strLine}][${strColumn}]`;
-		} else {
-			return `${this.id}[${strLine}]`;
-		}
-	}
-}

+ 0 - 87
ivprogh/js/ast/expressions/arrayLiteral.js

@@ -1,87 +0,0 @@
-import { Literal } from './literal';
-
-export class ArrayLiteral extends Literal {
-  
-  constructor(type, value) {
-    super(type);
-    this.value = value;
-  }
-
-  get subtype () {
-    let element = this.value[0];
-    if (element instanceof ArrayLiteral) {
-      return element.value[0].type;
-    } else {
-      return element.type;
-    }
-  }
-
-  get lines () {
-    return this.value.length;
-  }
-
-  get columns () {
-    let element = this.value[0];
-    if (!(element instanceof ArrayLiteral)){
-      return null;
-    } else {
-      return element.value[0].value.length;
-    }
-  }
-
-  get isVector () {
-    return this.columns === null;
-  }
-
-  get isValid () {
-    return true;//this.validateType() && this.validateSize();
-  }
-
-  validateType () {
-    // let valid = true;
-    // if(this.columns !== null) {
-    //   const len = this.columns;
-    //   const len2 = this.lines;
-    //   for (let i = len - 1; i >= 0; i--) {
-    //     for (let j = len2 - 1; j >= 0; j--) {
-    //       if(this.value[i].value[j].type !== this.subtype) {
-    //         valid = false;
-    //         break;
-    //       }
-    //     }
-    //   }
-    // } else {
-    //   const len = this.lines;
-    //   for (var i = len - 1; i >= 0; i--) {
-    //     if(this.value[i].type !== this.subtype) {
-    //       valid = false;
-    //       break;
-    //     }
-    //   }
-    // }
-    return true;//valid;
-  }
-
-  validateSize () {
-    let valid = true;
-    if(this.columns !== null) {
-      const equalityTest = data.value.map(v => v.length)
-      .reduce((old, next) => {
-        if (old === null) {
-          return next;
-        } else if (old === next) {
-          return old
-        } else {
-          return -1;
-        }
-      }, null);
-      valid = equalityTest !== -1;
-    }
-    return valid;
-  }
-
-  toString () {
-    const strList = this.value.map(arrayLiteral => arrayLiteral.toString());
-    return "{" + strList.join(',') + "}";
-  }
-}

+ 0 - 15
ivprogh/js/ast/expressions/boolLiteral.js

@@ -1,15 +0,0 @@
-import { Literal } from './literal';
-import { Types } from './../../typeSystem/types';
-import { convertBoolToString } from "./../../typeSystem/parsers";
-
-export class BoolLiteral extends Literal {
-  
-  constructor(value) {
-    super(Types.BOOLEAN);
-    this.value = value;
-  }
-
-  toString () {
-    return convertBoolToString(this.value);
-  }
-}

+ 0 - 14
ivprogh/js/ast/expressions/expression.js

@@ -1,14 +0,0 @@
-export class Expression {
-
-  constructor () {
-    this._sourceInfo = null;
-  }
-
-  set sourceInfo (sourceInfo) {
-		this._sourceInfo = sourceInfo;
-	}
-
-	get sourceInfo () {
-		return this._sourceInfo;
-	}
-}

+ 0 - 36
ivprogh/js/ast/expressions/functionCall.js

@@ -1,36 +0,0 @@
-import { Expression } from './expression';
-import { LanguageDefinedFunction } from '../../processor/definedFunctions';
-
-export class FunctionCall extends Expression {
-
-	constructor (id, actualParameters) {
-		super();
-		this.id = id;
-		this.actualParameters = actualParameters;
-	}
-
-	get isMainCall () {
-		return this.id === null;
-	}
-
-	get parametersSize () {
-		return this.actualParameters.length;
-	}
-
-	toString () {
-		let name = null;
-		if(this.isMainCall) {
-			name = LanguageDefinedFunction.getMainFunctionName();
-		} else {
-			name = LanguageDefinedFunction.getLocalName(this.id);
-		}
-		let params = null;
-		if(this.actualParameters.length == 0) {
-			params = "()";
-		} else {
-			const strParams = this.actualParameters.map(v => v.toString());
-			params = "(" + strParams.join(",") + ")";
-		}
-		return name + params;
-	}
-}

+ 0 - 23
ivprogh/js/ast/expressions/index.js

@@ -1,23 +0,0 @@
-import { ArrayAccess } from './arrayAccess';
-import { FunctionCall } from './functionCall';
-import { IntLiteral } from './intLiteral';
-import { RealLiteral } from './realLiteral';
-import { BoolLiteral } from './boolLiteral';
-import { StringLiteral } from './stringLiteral';
-import { ArrayLiteral } from './arrayLiteral';
-import { VariableLiteral } from './variableLiteral';
-import { InfixApp } from './infixApp';
-import { UnaryApp } from './unaryApp';
-
-export {
-	ArrayAccess,
-	FunctionCall,
-  IntLiteral,
-  RealLiteral,
-  BoolLiteral,
-  StringLiteral,
-  ArrayLiteral,
-  VariableLiteral,
-  InfixApp,
-  UnaryApp
-};

+ 0 - 18
ivprogh/js/ast/expressions/infixApp.js

@@ -1,18 +0,0 @@
-import { Expression } from './expression';
-
-export class InfixApp extends Expression {
-
-  constructor(op, left, right) {
-    super();
-    this.op = op;
-    this.left = left;
-    this.right = right;
-  }
-
-  toString () {
-    const l = this.left.toString();
-    const op = this.op.value;
-    const r = this.right.toString();
-    return l + op + r;
-  }
-}

+ 0 - 15
ivprogh/js/ast/expressions/intLiteral.js

@@ -1,15 +0,0 @@
-import { Literal } from './literal';
-import { Types } from './../../typeSystem/types';
-import { convertToString } from './../../typeSystem/parsers';
-
-export class IntLiteral extends Literal {
-  
-  constructor(value) {
-    super(Types.INTEGER);
-    this.value = value;
-  }
-
-  toString() {
-    return convertToString(this.value, this.type);
-  }
-}

+ 0 - 9
ivprogh/js/ast/expressions/literal.js

@@ -1,9 +0,0 @@
-import { Expression } from './expression';
-
-export class Literal extends Expression {
-  
-  constructor (type) {
-    super();
-    this.type = type;
-  }
-}

+ 0 - 15
ivprogh/js/ast/expressions/realLiteral.js

@@ -1,15 +0,0 @@
-import { Literal } from './literal';
-import { Types } from './../../typeSystem/types';
-import { convertToString } from './../../typeSystem/parsers';
-
-export class RealLiteral extends Literal {
-  
-  constructor(value) {
-    super(Types.REAL);
-    this.value = value;
-  }
-
-  toString() {
-    return convertToString(this.value, this.type);
-  }
-}

+ 0 - 14
ivprogh/js/ast/expressions/stringLiteral.js

@@ -1,14 +0,0 @@
-import { Literal } from './literal';
-import { Types } from './../../typeSystem/types';
-
-export class StringLiteral extends Literal {
-  
-  constructor(value) {
-    super(Types.STRING);
-    this.value = value;
-  }
-
-  toString() {
-    return this.value;
-  }
-}

+ 0 - 14
ivprogh/js/ast/expressions/unaryApp.js

@@ -1,14 +0,0 @@
-import {InfixApp} from './infixApp';
-
-export class UnaryApp extends InfixApp {
-  
-  constructor (op, left) {
-    super(op, left, null);
-  }
-
-  toString () {
-    const l = this.left.toString();
-    const op = this.op.value;
-    return op + l;
-  }
-}

+ 0 - 14
ivprogh/js/ast/expressions/variableLiteral.js

@@ -1,14 +0,0 @@
-import { Literal } from './literal';
-import { Types } from './../../typeSystem/types';
-
-export class VariableLiteral extends Literal {
-  
-  constructor(id) {
-    super(Types.UNDEFINED);
-    this.id = id;
-  }
-
-  toString () {
-    return this.id;
-  }
-}

File diff ditekan karena terlalu besar
+ 0 - 1182
ivprogh/js/ast/ivprogParser.js


+ 0 - 35
ivprogh/js/ast/operators.js

@@ -1,35 +0,0 @@
-export const Operators = Object.freeze({
-  ADD: {ord: 0, value: "+"},
-  SUB: {ord: 1, value: "-"},
-  MULT: {ord: 2, value: '*'},
-  DIV: {ord: 3, value: '/'},
-  MOD: {ord: 4, value: '%'},
-  GT: {ord: 5, value: '>'},
-  GE: {ord: 6, value: '>='},
-  LT: {ord: 7, value: '<'},
-  LE: {ord: 8, value: '<='},
-  EQ: {ord: 9, value: '=='},
-  NEQ: {ord: 10, value: '!='},
-  AND: {ord: 11, value: 'and'},
-  OR: {ord: 12, value: 'or'},
-  NOT: {ord: 13, value: 'not'}
-});
-
-export function convertFromString (op) {
-  switch (op) {
-    case '+' : return Operators.ADD;
-    case '-' : return Operators.SUB;
-    case '*' : return Operators.MULT;
-    case '/' : return Operators.DIV;
-    case '%' : return Operators.MOD;
-    case '>' : return Operators.GT;
-    case '>=' : return Operators.GE;
-    case '<' : return Operators.LT;
-    case '<=' : return Operators.LE;
-    case '==' : return Operators.EQ;
-    case '!=' : return Operators.NEQ;
-    case 'and' : return Operators.AND;
-    case 'or' : return Operators.OR;
-    case 'not' : return Operators.NOT;
-  }
-}

+ 0 - 22
ivprogh/js/ast/sourceInfo.js

@@ -1,22 +0,0 @@
-export class SourceInfo {
-
-  static createSourceInfo (token) {
-    return new SourceInfo(token.line, token.column, token.text.length);
-  }
-
-  static createSourceInfoFromList (tokenA, tokenB) {
-    const line = tokenA.line;
-    const column = tokenA.column;
-    // copied from https://github.com/UNIVALI-LITE/Portugol-Studio/blob/master/core/src/main/java/br/univali/portugol/nucleo/analise/sintatica/Portugol.g
-    // No idea why...
-    const size = tokenB.tokenIndex + 1 - tokenA.tokenIndex
-    return new SourceInfo(line, column, size);
-  }
-
-  constructor (line, column, size) {
-    this.line = line;
-    this.column = column;
-    this.size = size;
-  }
-
-}

+ 0 - 416
ivprogh/js/iassign-integration-functions.js

@@ -1,416 +0,0 @@
-// Função para ler parâmetros informados pelo iTarefa via URL
-// Apesar de não ser obrigatório, será muito útil para capturar os parâmetros
-function getParameterByName (name, defaultReturn = null) {
-    var match = RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search);
-    return match ? decodeURIComponent(match[1].replace(/\+/g, ' ')) : defaultReturn;
-}
-
-// Criando um object com os parâmetros informados pelo iTarefa
-// Observe que para cada parâmetro, é realizada a chamada do método getParameterByName, implementado acima
-var iLMparameters = {
-    iLM_PARAM_ServerToGetAnswerURL: getParameterByName("iLM_PARAM_ServerToGetAnswerURL"),
-    iLM_PARAM_SendAnswer: getParameterByName("iLM_PARAM_SendAnswer"),
-    iLM_PARAM_AssignmentURL: getParameterByName("iLM_PARAM_AssignmentURL"),
-    iLM_PARAM_Assignment: getParameterByName("iLM_PARAM_Assignment"),
-    lang: getParameterByName("lang", "pt")
-};
-
-// Set the lang parameter to the localStorage for easy access
-// and no dependency to the global scope, avoind future 'strict mode' problems
-//localStorage.setItem('ivprog.lang', iLMparameters.lang);
-
-// Função chamada pelo iTarefa quando o professor finaliza a criação da atividade
-// ou quando o aluno finaliza a resolução do exercício
-// O retorno é um JSON com os dados do exercício ou da resolução
-// Esse retorno será armazenado no banco de dados do Moodle, pelo iTarefa
-function getAnswer () {
-    // Se o parâmetro "iLM_PARAM_SendAnswer" for false,
-    // então trata-se de resolução de atividade
-    if (iLMparameters.iLM_PARAM_SendAnswer == 'false') {
-        // Montar o retorno com a resposta do aluno
-        var contentToSend = previousContent.split("\n::algorithm::")[0];
-        contentToSend += '\n::algorithm::\n';
-        contentToSend += JSON.stringify(window.program_obj);
-
-        contentToSend += '\n::logs::';
-        contentToSend += getTrackingLogs();
-
-        return contentToSend;
-
-    } else {
-        // Montar o retorno com a criação da atividade do professor
-        var ret = ' { ' + prepareTestCases() 
-            + ',\n"settings_data_types": \n' + JSON.stringify($('form[name="settings_data_types"]').serializeArray()) 
-            + ',\n"settings_commands": \n' + JSON.stringify($('form[name="settings_commands"]').serializeArray()) 
-            + ',\n"settings_functions": \n' + JSON.stringify($('form[name="settings_functions"]').serializeArray()) 
-            + ' } ';
-
-        if ($("input[name='include_algo']").is(':checked')) {
-            ret += '\n::algorithm::\n';
-            ret += JSON.stringify(window.program_obj);
-        }
-
-        return ret;
-    }
-}
-
-function prepareTestCases () {
-    var ret = ' \n "testcases" : [ '
-    var test_cases_array = $('form[name="test_cases"]').serializeArray();
-    for (var i = 0; i < test_cases_array.length; i = i + 2) {
-        ret += '\n{ ';
-        ret += '\n "input": [';
-        var inps = test_cases_array[i].value.match(/[^\r\n]+/g);
-        if (inps) {
-            for (var j = 0; j < inps.length; j++) {
-                ret += '"' + inps[j] + '"';
-                if ((j + 1) < inps.length) {
-                    ret += ', ';
-                }
-            }
-        }
-        ret += '], \n "output": [';
-        var outs = test_cases_array[i+1].value.match(/[^\r\n]+/g);
-        if (outs) {
-            for (var j = 0; j < outs.length; j++) {
-                ret += '"' + outs[j] + '"';
-                if ((j + 1) < outs.length) {
-                    ret += ', ';
-                }
-            }
-        }
-        ret += ']';
-        ret += '\n}'
-        if ((i + 2) < test_cases_array.length) {
-            ret += ',';
-        }
-    }
-    ret += '\n] ';
-    return ret;
-}
-
-// Função chamada pelo iTarefa para receber a nota do aluno na atividade
-// O retorno é um valor entre 0.0 e 1.0
-function getEvaluation () {
-    if (iLMparameters.iLM_PARAM_SendAnswer == 'false') {
-        // A chamada do método abaixo é obrigatória!
-        // Observe que a chamada parte do iLM para o iTarefa
-        //parent.getEvaluationCallback(window.studentGrade);
-
-        runCodeAssessment();
-    }
-}
-
-
-var testCases = null;
-var settingsDataTypes = null;
-var settingsCommands = null;
-var settingsFunctions = null;
-var algorithm_in_ilm = null;
-var previousContent = null;
-
-// Função para que o iMA leia os dados da atividade fornecidos pelo iTarefa
-function getiLMContent () {
-
-    // O parâmetro "iLM_PARAM_Assignment" fornece o URL do endereço que deve ser
-    // requisitado via AJAX para a captura dos dados da atividade
-    $.get(iLMparameters.iLM_PARAM_Assignment, function (data) {
-        if (iLMparameters.iLM_PARAM_SendAnswer == 'false') {
-            previousContent = data;
-            prepareActivityToStudent(data);
-        } else {
-
-        }
-    });
-}
-
-function prepareActivityToStudent (ilm_cont) {
-    var content = JSON.parse(ilm_cont.split('\n::algorithm::')[0]);
-    testCases = content.testcases;
-    settingsDataTypes = content.settings_data_types;
-    settingsCommands = content.settings_commands;
-    settingsFunctions = content.settings_functions;
-    if (ilm_cont.split('\n::algorithm::')[1]) {
-        algorithm_in_ilm = ilm_cont.split('\n::algorithm::')[1].split('\n::logs::')[0];
-        window.program_obj.functions = JSON.parse(algorithm_in_ilm).functions;
-        window.program_obj.globals = JSON.parse(algorithm_in_ilm).globals;
-
-        window.watchW.watch(window.program_obj.globals, function(){
-          if (window.insertContext) {
-            setTimeout(function(){ renderAlgorithm(); }, 300);
-            window.insertContext = false;
-          } else {
-            renderAlgorithm();
-          }
-        }, 1);
-
-        for (var i = 0; i < window.program_obj.functions.length; i ++) {
-            window.watchW.watch(window.program_obj.functions[i].parameters_list, function(){
-              if (window.insertContext) {
-                setTimeout(function(){ renderAlgorithm(); }, 300);
-                window.insertContext = false;
-              } else {
-                renderAlgorithm();
-              }
-            }, 1);
-
-            window.watchW.watch(window.program_obj.functions[i].variables_list, function(){
-              if (window.insertContext) {
-                setTimeout(function(){ renderAlgorithm(); }, 300);
-                window.insertContext = false;
-              } else {
-                renderAlgorithm();
-              }
-            }, 1);
-        }
-        window.watchW.watch(window.program_obj.functions, function(){
-          if (window.insertContext) {
-            setTimeout(function(){ renderAlgorithm(); }, 300);
-            window.insertContext = false;
-          } else {
-            renderAlgorithm();
-          }
-        }, 1);
-    }
-    $('.assessment_button').removeClass('disabled');
-    renderAlgorithm();
-}
-
-// Função para organizar se para criação, visualização ou resolução de atividade
-function prepareEnvironment () {
-    if ((iLMparameters.iLM_PARAM_AssignmentURL == "true") && (iLMparameters.iLM_PARAM_SendAnswer == "true")) {
-        prepareActivityCreation();
-    }
-}
-
-$(document).ready(function() {
-
-    // Se iLM_PARAM_SendAnswer for false, então trata-se de resolução de atividade,
-    // portanto, a "DIV" de resolução é liberada
-    if (iLMparameters.iLM_PARAM_SendAnswer == 'false') {
-        //$('.resolucao').css("display","block");
-        getiLMContent();
-
-
-        $( document ).ready(function() {
-            $('.div_to_body').mousemove(function(e) {
-                trackingMatrix.push(adCoords(e, 0));
-            });
-
-            $('.div_to_body').click(function(e) {
-                trackingMatrix.push(adCoords(e, 1));                    
-            });
-
-        });
-
-    } else {
-        // Caso não esteja em modo de resolução de atividade, a visualização no momento
-        // é para a elaboração de atividade:
-        //$('.elaboracao').css("display","block");
-    }
-
-    if (!testCases) {
-        $('.assessment_button').addClass('disabled');
-    }
-
-});
-
-// Função para preparar a interface para o professor criar atividade:
-function prepareActivityCreation () {
-
-    $('.add_accordion').addClass('accordion');
-
-    $('.default_visual_title').toggle();
-    $('.default_visual_title').append('<span>'+LocalizedStrings.getUI('text_teacher_algorithm')+'</span>');
-    $('.height_100').removeClass('height_100');
-    $('.main_title').remove();
-    $('.ui.accordion').addClass('styled');
-    
-    $('<div class="ui checkbox"><input type="checkbox" name="include_algo" class="include_algo" tabindex="0" class="hidden"><label>'+LocalizedStrings.getUI('text_teacher_algorithm_include')+'</label></div>').insertBefore('.content_margin');
-    
-    var cases_test_div = $('<div class="ui accordion styled"><div class="active title"><i class="dropdown icon"></i>'+LocalizedStrings.getUI('text_teacher_test_case')+'</div><div class="active content"></div></div>');
-
-    cases_test_div.insertBefore('.accordion');
-
-    var config_div = $('<div class="ui accordion styled"><div class="title"><i class="dropdown icon"></i>'+LocalizedStrings.getUI('text_teacher_config')+'</div><div class="content"></div></div>');
-
-    config_div.insertAfter(cases_test_div);
-
-    $('.ui.accordion').accordion();
-
-    $('.ui.checkbox').checkbox();
-
-    prepareTableSettings(config_div.find('.content'));
-
-    prepareTableTestCases(cases_test_div.find('.content'));
-}
-
-function prepareTableTestCases (div_el) {
-
-    var table_el = '<form name="test_cases"><table class="ui blue table"><thead><tr><th width="30px">#</th><th>'+LocalizedStrings.getUI('text_teacher_test_case_input')+'</th><th>'+LocalizedStrings.getUI('text_teacher_test_case_output')+'</th><th width="80px">'+LocalizedStrings.getUI('text_teacher_test_case_actions')+'</th></tr></thead>'
-            + '<tbody class="content_cases"></tbody></table></form>';
-
-    div_el.append(table_el);
-
-    div_el.append('<button class="ui teal labeled icon button button_add_case"><i class="plus icon"></i>'+LocalizedStrings.getUI('text_teacher_test_case_add')+'</button>');
-
-    $('.button_add_case').on('click', function(e) {
-        addTestCase();
-    });
-
-}
-
-var hist = false;
-
-function addTestCase () {
-    var new_row = $('<tr><td class="counter"></td><td class="expandingArea"><textarea rows="1" name="input" class="text_area_input"></textarea></td><td class="expandingArea"><textarea rows="1" name="output" class="text_area_output"></textarea></td><td class="btn_actions"><div class="ui button_remove_case"><i class="red icon times large"></i></div></td></tr>');
-    $('.content_cases').append(new_row);
-
-    new_row.find('.button_remove_case').click(function(e) {
-        new_row.remove();
-        updateTestCaseCounter();
-    });
-
-    $('textarea').on('input', function(e) {
-        var lines = $(this).val().split('\n').length;
-        $(this).attr('rows', lines);
-    });
-    
-    updateTestCaseCounter();
-
-     $('.text_area_output').keydown(function(e) {
-        var code = e.keyCode || e.which;
-        if (code == 9 && $(this).closest("tr").is(":last-child")) {
-            hist = true;
-            addTestCase();
-        }
-     });
-     if (!hist) {
-        $( ".content_cases tr:last" ).find('.text_area_input').focus();
-     } else {
-        hist = false;
-     }
-}
-
-function updateTestCaseCounter () {
-    var i = 1;
-    $( ".content_cases" ).find('tr').each(function() {
-      $( this ).find('.counter').text(i);
-      i ++;
-    });
-}
-
-function prepareTableSettings (div_el) {
-    div_el.append('<h4 class="ui header">'+LocalizedStrings.getUI('text_teacher_data_types')+'</h4>');
-    div_el.append('<form name="settings_data_types"><div class="ui stackable five column grid">'
-        +'<div class="column"><div class="ui checkbox"><input type="checkbox" name="integer_data_type" checked tabindex="0" class="hidden small"><label>'+LocalizedStrings.getUI('integer')+'</label></div></div>'
-        +'<div class="column"><div class="ui checkbox"><input type="checkbox" name="real_data_type" checked tabindex="0" class="hidden small"><label>'+LocalizedStrings.getUI('real')+'</label></div></div>'
-        +'<div class="column"><div class="ui checkbox"><input type="checkbox" name="text_data_type" checked tabindex="0" class="hidden small"><label>'+LocalizedStrings.getUI('text')+'</label></div></div>'
-        +'<div class="column"><div class="ui checkbox"><input type="checkbox" name="boolean_data_type" checked tabindex="0" class="hidden small"><label>'+LocalizedStrings.getUI('boolean')+'</label></div></div>'
-        +'<div class="column"><div class="ui checkbox"><input type="checkbox" name="void_data_type" checked tabindex="0" class="hidden small"><label>'+LocalizedStrings.getUI('void')+'</label></div></div>'
-        +'</div></form>');
-
-
-    div_el.append('<h4 class="ui header">'+LocalizedStrings.getUI('text_teacher_commands')+'</h4>');
-    div_el.append('<form name="settings_commands"><div class="ui stackable three column grid">'
-        +'<div class="column"><div class="ui checkbox"><input type="checkbox" name="commands_read" checked tabindex="0" class="hidden small"><label>'+LocalizedStrings.getUI('text_read_var')+'</label></div></div>'
-        +'<div class="column"><div class="ui checkbox"><input type="checkbox" name="commands_write" checked tabindex="0" class="hidden small"><label>'+LocalizedStrings.getUI('text_write_var')+'</label></div></div>'
-        +'<div class="column"><div class="ui checkbox"><input type="checkbox" name="commands_comment" checked tabindex="0" class="hidden small"><label>'+LocalizedStrings.getUI('text_comment')+'</label></div></div>'
-        +'<div class="column"><div class="ui checkbox"><input type="checkbox" name="commands_attribution" checked tabindex="0" class="hidden small"><label>'+LocalizedStrings.getUI('text_attribution')+'</label></div></div>'
-        +'<div class="column"><div class="ui checkbox"><input type="checkbox" name="commands_functioncall" checked tabindex="0" class="hidden small"><label>'+LocalizedStrings.getUI('text_functioncall')+'</label></div></div>'
-        +'<div class="column"><div class="ui checkbox"><input type="checkbox" name="commands_iftrue" checked tabindex="0" class="hidden small"><label>'+LocalizedStrings.getUI('text_iftrue')+'</label></div></div>'
-        +'<div class="column"><div class="ui checkbox"><input type="checkbox" name="commands_repeatNtimes" checked tabindex="0" class="hidden small"><label>'+LocalizedStrings.getUI('text_repeatNtimes')+'</label></div></div>'
-        +'<div class="column"><div class="ui checkbox"><input type="checkbox" name="commands_while" checked tabindex="0" class="hidden small"><label>'+LocalizedStrings.getUI('text_whiletrue')+'</label></div></div>'
-        +'<div class="column"><div class="ui checkbox"><input type="checkbox" name="commands_dowhile" checked tabindex="0" class="hidden small"><label>'+LocalizedStrings.getUI('text_dowhiletrue')+'</label></div></div>'
-        +'<div class="column"><div class="ui checkbox"><input type="checkbox" name="commands_switch" checked tabindex="0" class="hidden small"><label>'+LocalizedStrings.getUI('text_switch')+'</label></div></div>'
-        +'</div></form>');
-
-    div_el.append('<h4 class="ui header">'+LocalizedStrings.getUI('text_teacher_functions')+'</h4>');
-    div_el.append('<form name="settings_functions"><div class="ui stackable one column grid">'
-        +'<div class="column"><div class="ui checkbox"><input type="checkbox" name="functions_creation" checked tabindex="0" class="hidden small"><label>'+LocalizedStrings.getUI('text_teacher_create_functions')+'</label></div></div>'
-        +'<div class="column"><div class="ui checkbox"><input type="checkbox" name="functions_move" checked tabindex="0" class="hidden small"><label>'+LocalizedStrings.getUI('text_teacher_create_movement_functions')+'</label></div></div>'
-        +'</div></form>');
-
-    $('.ui.checkbox').checkbox();
-
-
-}
-
-function getTrackingLogs () {
-    var ret = "";
-    for (var i = 0; i < trackingMatrix.length; i++) {
-        ret += "\n" + trackingMatrix[i][0] + "," + trackingMatrix[i][1] + "," + trackingMatrix[i][2];
-        if (trackingMatrix[i][2] === 1) {
-            ret += ',"' + trackingMatrix[i][3] + '"';
-        }
-    }
-    return ret;
-}
-
-// Tracking mouse movements
-var trackingMatrix = [];
-
-function adCoords(e, code){
-    var x = e.pageX; 
-    var y = e.pageY;
-    if (code === 1) {
-        return [x, y, code, e.target.classList['value']];
-    } else {
-        return [x, y, code];
-    }
-}
-
-$( document ).ready(function() {
-
-    if (inIframe()) {
-        orderIcons();
-        orderWidth();
-    }
-
-});
-
-function orderWidth() {
-    $('.ui.raised.container.segment.div_to_body').css('width', '98%');
-    $('.ui.one.column.container.segment.ivprog_visual_panel').css('width', '100%');
-}
-
-function orderIcons() {
-    $('.ui.one.column.doubling.stackable.grid.container').css('display', 'none');
-    $('.only_in_frame').css('display', 'block');
-    
-}
-
-
-function inIframe () {
-    try {
-        return window.self !== window.top;
-    } catch (e) {
-        return true;
-    }
-}
-
-
-function full_screen() {
-     // check if user allows full screen of elements. This can be enabled or disabled in browser config. By default its enabled.
-    //its also used to check if browser supports full screen api.
-    if("fullscreenEnabled" in document || "webkitFullscreenEnabled" in document || "mozFullScreenEnabled" in document || "msFullscreenEnabled" in document) {
-        if(document.fullscreenEnabled || document.webkitFullscreenEnabled || document.mozFullScreenEnabled || document.msFullscreenEnabled) {
-            var element = document.getElementById("ui_main_div");
-            //requestFullscreen is used to display an element in full screen mode.
-            if("requestFullscreen" in element) {
-                element.requestFullscreen();
-            } 
-            else if ("webkitRequestFullscreen" in element) {
-                element.webkitRequestFullscreen();
-            } 
-            else if ("mozRequestFullScreen" in element) {
-                element.mozRequestFullScreen();
-            } 
-            else if ("msRequestFullscreen" in element) {
-                element.msRequestFullscreen();
-            }
-        }
-    } else {
-        $('.expand_button').addClass('disabled');
-    }
-}

+ 0 - 138
ivprogh/js/io/domConsole.js

@@ -1,138 +0,0 @@
-import $ from 'jquery';
-
-export class DOMConsole {
-
-  static get USER () {
-    return 0;
-  }
-
-  static get INFO () {
-    return 1;
-  }
-
-  static get ERR () {
-    return 2;
-  }
-
-  constructor (elementID) {
-    this.input = null;
-    this.needInput = false;
-    this.termDiv = null;
-    this.anyKey = false;
-    this.parent = $(elementID);
-    this.setup();
-    this.inputListeners = [];
-  }
-
-  setup () {
-    this._setupDom();
-    this._setupEvents();
-  }
-
-  _setupEvents () {
-    this.input.on("keydown", (event) => {
-      if (!this.needInput) {
-        event.preventDefault();
-        return;
-      }
-      const keyCode = event.which;
-      if (keyCode === 13 || this.anyKey) {
-        let text = this.input.val();
-        text = text.replace('[\n\r]+', '');
-        this.notifyListeners(text);
-        this.write(text);
-        this.input.val("");
-      }
-    });
-  }
-
-  _setupDom () {
-    this.termDiv = $("<div></div>");
-    this.termDiv.addClass("ivprog-term-div");
-    this.input = $('<input text="type">')
-    this.input.addClass("ivprog-term-input");
-    this.termDiv.append(this.input);
-    this.parent.append(this.termDiv);
-  }
-
-  notifyListeners (text) {
-    this.inputListeners.forEach(resolve => resolve(text));
-    this.inputListeners.splice(0, this.inputListeners.length);
-    this.hideInput();
-    this.anyKey = false;
-  }
-
-  write (text) {
-    this._appendText(text, DOMConsole.USER);
-  }
-
-  info (text) {
-    this._appendText(text, DOMConsole.INFO);
-  }
-
-  err (text) {
-    this._appendText(text, DOMConsole.ERR);
-  }
-
-  _appendText (text, type) {
-    const divClass = this.getClassForType(type);
-    const textDiv = $("<div></div>");
-    textDiv.addClass(divClass);
-    textDiv.append(text);
-    textDiv.insertBefore(this.input);
-    this.scrollTerm();
-  }
-
-  scrollTerm () {
-    this.termDiv.animate({
-      scrollTop: this.termDiv.prop('scrollHeight')
-    }, 0);
-  }
-
-  getClassForType (type) {
-    switch (type) {
-      case DOMConsole.USER:
-        return "ivprog-term-userText";
-      case DOMConsole.INFO:
-        return "ivprog-term-info";
-      case DOMConsole.ERR:
-        return "ivprog-term-error";
-    }
-  }
-
-  dispose () {
-    this.parent.off();
-    this.input.off();
-    this.input = null;
-    this.parent.empty();
-  }
-
-  showInput () {
-    this.needInput = true;
-    this.input.show();
-    this.input.focus();
-  }
-
-  hideInput () {
-    this.needInput = false;
-    this.input.hide();
-  }
-
-  requestInput (callback, anyKey = false) {
-    this.inputListeners.push(callback);
-    this.anyKey = anyKey;
-    this.showInput();
-  }
-
-  sendOutput (text) {
-    text.split("\n").forEach(t => {
-      t = t.replace(/\t/g,'&#9;');
-      this.write(t)
-    });
-  }
-
-  clear () {
-    this.input.parent().children().not(this.input).remove();
-    this.input.val("");
-  }
-}

+ 0 - 37
ivprogh/js/io/domInput.js

@@ -1,37 +0,0 @@
-import {Input} from './input';
-import $ from 'jquery';
-
-export class DOMInput extends Input{
-
-  constructor (element) {
-    super();
-    this.el = $(element);
-    this.listeners = [];
-    this.setupEvents();
-  }
-
-  setupEvents () {
-    this.el.on('keydown', (e) => {
-      const code = e.keyCode || e.which;
-      if (code === 13) {
-        let text = this.el.val();
-        text = text.replace('[\n\r]+', '');
-        this.notifyInput(text);
-        this.el.val('');
-      }
-    });
-  }
-
-  requestInput (callback) {
-    this.listeners.push(callback);
-    this.el.focus();
-  }
-
-  notifyInput (text) {
-    this.listeners.forEach(resolve => {
-      resolve(text);
-    })
-    this.listeners.splice(0, this.listeners.length);
-  }
-
-}

+ 0 - 21
ivprogh/js/io/domOutput.js

@@ -1,21 +0,0 @@
-import { Output } from './output';
-import $ from 'jquery';
-
-export class DOMOutput extends Output {
-
-  constructor (selector) {
-    super();
-    this.el = $(selector);
-  }
-
-  sendOutput (text) {
-    text = text.replace("\n", '</br>');
-    text = text.replace(/\t/g,'&#9;');
-    const span = $('<span />').addClass('ivprog-io-output-text').html(text);
-    this.el.append(span);
-  }
-
-  clear () {
-    this.el.empty();
-  }
-}

+ 0 - 6
ivprogh/js/io/input.js

@@ -1,6 +0,0 @@
-export class Input {
-
-  requestInput (callback) {
-    throw new Error("Must be implemented");
-  }
-}

+ 0 - 6
ivprogh/js/io/output.js

@@ -1,6 +0,0 @@
-export class Output {
-
-  sendOutput (text) {
-    throw new Error("Must be implemented");
-  }
-}

+ 0 - 13
ivprogh/js/main.js

@@ -1,13 +0,0 @@
-import { runner } from './runner';
-import { initVisualUI } from './visualUI/functions';
-import { LocalizedStrings} from './services/localizedStringsService';
-import { i18nHelper } from "./services/i18nHelper";
-
-const i18n = i18nHelper.i18n
-
-export {
-  runner,
-  initVisualUI,
-  LocalizedStrings,
-  i18n
-}

+ 0 - 180
ivprogh/js/processor/compatibilityTable.js

@@ -1,180 +0,0 @@
-import { Types } from './../typeSystem/types';
-import { Operators } from './../ast/operators';
-import { MultiType } from '../typeSystem/multiType';
-
-function buildInfixAddTable () {
-  const table = [[], [], [], []];
-
-  table[Types.INTEGER.ord][Types.INTEGER.ord] = Types.INTEGER;
-  table[Types.INTEGER.ord][Types.REAL.ord] = Types.REAL;
-  table[Types.INTEGER.ord][Types.STRING.ord] = Types.STRING;
-
-  table[Types.REAL.ord][Types.INTEGER.ord] = Types.REAL;
-  table[Types.REAL.ord][Types.REAL.ord] = Types.REAL;
-  table[Types.REAL.ord][Types.STRING.ord] = Types.STRING;
-
-  table[Types.STRING.ord][Types.INTEGER.ord] = Types.STRING;
-  table[Types.STRING.ord][Types.REAL.ord] = Types.STRING;
-  table[Types.STRING.ord][Types.STRING.ord] = Types.STRING;
-  table[Types.STRING.ord][Types.BOOLEAN.ord] = Types.STRING;
-
-  return table;
-}
-
-function buildInfixMultiDivSubTable () {
-  const table = [[], [], [], []];
-
-  table[Types.INTEGER.ord][Types.INTEGER.ord] = Types.INTEGER;
-  table[Types.INTEGER.ord][Types.REAL.ord] = Types.REAL;
-
-  table[Types.REAL.ord][Types.INTEGER.ord] = Types.REAL;
-  table[Types.REAL.ord][Types.REAL.ord] = Types.REAL;
-
-  return table;
-}
-
-function buildInfixEqualityInequalityTable () {
-  const table = [[], [], [], []];
-
-  table[Types.INTEGER.ord][Types.INTEGER.ord] = Types.BOOLEAN;
-
-  table[Types.REAL.ord][Types.REAL.ord] = Types.BOOLEAN;
-
-  table[Types.BOOLEAN.ord][Types.BOOLEAN.ord] = Types.BOOLEAN;
-
-  table[Types.STRING.ord][Types.STRING.ord] = Types.BOOLEAN;
-
-  return table;
-}
-
-function buildInfixRelationalTable () {
-  const table = [[], [], [], []];
-
-  table[Types.INTEGER.ord][Types.INTEGER.ord] = Types.BOOLEAN;
-
-  table[Types.REAL.ord][Types.REAL.ord] = Types.BOOLEAN;
-
-  table[Types.STRING.ord][Types.STRING.ord] = Types.BOOLEAN;
-
-  return table;
-}
-
-function buildInfixAndOrTable () {
-  const table = [[], [], [], []];
-
-  table[Types.BOOLEAN.ord][Types.BOOLEAN.ord] = Types.BOOLEAN;
-
-  return table;
-}
-
-function buildInfixModTable () {
-  const table = [[], [], [], []];
-
-  table[Types.INTEGER.ord][Types.INTEGER.ord] = Types.INTEGER;
-
-  return table;
-}
-
-function buildUnarySumSubList () {
-  const list = [];
-
-  list[Types.INTEGER.ord] = Types.INTEGER;
-
-  list[Types.REAL.ord] = Types.REAL;
-
-  return list;
-}
-
-function buildUnaryNegList () {
-  const list = [];
-
-  list[Types.BOOLEAN.ord] = Types.BOOLEAN;
-
-  return list;
-}
-
-function buildInfixCompatibilityTable () {
-  const compatibilityMap = new WeakMap();
-  compatibilityMap.set(Operators.ADD, buildInfixAddTable());
-  compatibilityMap.set(Operators.SUB, buildInfixMultiDivSubTable());
-  compatibilityMap.set(Operators.MULT, buildInfixMultiDivSubTable());
-  compatibilityMap.set(Operators.DIV, buildInfixMultiDivSubTable());
-  compatibilityMap.set(Operators.EQ, buildInfixEqualityInequalityTable());
-  compatibilityMap.set(Operators.NEQ, buildInfixEqualityInequalityTable());
-  compatibilityMap.set(Operators.GE, buildInfixRelationalTable());
-  compatibilityMap.set(Operators.GT, buildInfixRelationalTable());
-  compatibilityMap.set(Operators.LE, buildInfixRelationalTable());
-  compatibilityMap.set(Operators.LT, buildInfixRelationalTable());
-  compatibilityMap.set(Operators.OR, buildInfixAndOrTable());
-  compatibilityMap.set(Operators.AND, buildInfixAndOrTable());
-  compatibilityMap.set(Operators.MOD, buildInfixModTable());
-  return compatibilityMap;
-}
-
-function buildUnaryCompatibilityTable () {
-  const compatibilityMap = new WeakMap();
-  compatibilityMap.set(Operators.ADD, buildUnarySumSubList());
-  compatibilityMap.set(Operators.SUB, buildUnarySumSubList());
-  compatibilityMap.set(Operators.NOT, buildUnaryNegList());
-  return compatibilityMap;
-}
-
-const infixMap = buildInfixCompatibilityTable();
-const unaryMap = buildUnaryCompatibilityTable();
-
-export function resultTypeAfterInfixOp (operator, leftExpressionType, rightExpressionType) {
-  try {
-    if(leftExpressionType instanceof MultiType && rightExpressionType instanceof MultiType) {
-      let newMulti = [];
-      for (let i = 0; i < leftExpressionType.types.length; i++) {
-        const element = leftExpressionType.types[i];
-        if(rightExpressionType.types.indexOf(element) !== -1) {
-          newMulti.push(element);
-        }
-      }
-      if(newMulti.length <= 0) {
-        return Types.UNDEFINED;
-      } else {
-        return new MultiType(newMulti)
-      }
-    } else if(leftExpressionType instanceof MultiType) {
-      if(leftExpressionType.isCompatible(rightExpressionType)) {
-        return rightExpressionType;
-      } else {
-        return Types.UNDEFINED;
-      }
-    } else if(rightExpressionType instanceof MultiType) {
-      if(rightExpressionType.isCompatible(leftExpressionType)) {
-        return leftExpressionType;
-      } else {
-        return Types.UNDEFINED;
-      }
-    }
-    const resultType = infixMap.get(operator)[leftExpressionType.ord][rightExpressionType.ord];
-    if (resultType === null || resultType === undefined) {
-      return Types.UNDEFINED
-    }
-    return resultType;
-  } catch (e) {
-    if (e instanceof TypeError) {
-      return Types.UNDEFINED;
-    } else {
-      throw e;
-    }
-  }
-}
-
-export function resultTypeAfterUnaryOp (operator, leftExpressionType) {
-  try {
-    if(leftExpressionType instanceof MultiType){
-      return leftExpressionType;
-    }
-    return unaryMap.get(operator)[leftExpressionType.ord];
-  } catch (e) {
-    if (e instanceof TypeError) {
-      return Types.UNDEFINED;
-    } else {
-      throw e;
-    } 
-  }
-}

+ 0 - 5
ivprogh/js/processor/context.js

@@ -1,5 +0,0 @@
-export const Context = Object.freeze({
-  BASE: Symbol('context:base'),
-  BREAKABLE: Symbol('context:breakable'),
-  FUNCTION: Symbol('context:function')
-});

+ 0 - 128
ivprogh/js/processor/definedFunctions.js

@@ -1,128 +0,0 @@
-import { LanguageService } from '../services/languageService';
-import {createInputFun, createOutputFun} from './lib/io';
-import {createLengthFun, createLowercaseFun,
-  createrCharAtFun, createSubstringFun,
-  createUppercaseFun} from './lib/strings';
-import {createMatrixColumnsFun, createMatrixLinesFun,
-  createNumElementsFun} from './lib/arrays';
-import {createCastBoolFun, createCastIntFun,
-  createCastRealFun, createCastStringFun,
-  createIsBoolFun, createIsIntFun,
-  createIsRealFun} from './lib/lang';
-import {createAbsFun, createCosFun,
-  createInvertFun, createLogFun,
-  createMaxFun, createMinFun,
-  createNegateFun, createPowFun,
-  createSinFun, createSqrtFun,
-  createTanFun} from './lib/math';
-
-function valueToKey (value, object) {
-  for (const key in object) {
-    if(object.hasOwnProperty(key)){
-      if (object[key] === value) {
-        return key;
-      }
-    }
-  }
-  return null;
-}
-
-function concatObjects (...objs) {
-  let result = {};
-  for (let i = 0; i < objs.length; i++) {
-    const obj = objs[i];
-    for(const key in obj) {
-      if(obj.hasOwnProperty(key)) {
-        result[key] = obj[key];
-      }
-    }
-  }
-  return result;
-}
-
-const libsObject = {
-  $mathLib: {
-    $sin: createSinFun(),
-    $cos: createCosFun(),
-    $tan: createTanFun(),
-    $sqrt: createSqrtFun(),
-    $pow: createPowFun(),
-    $log: createLogFun(),
-    $abs: createAbsFun(),
-    $negate: createNegateFun(),
-    $invert: createInvertFun(),
-    $max: createMaxFun(),
-    $min: createMinFun()
-  },
-  $ioLib: {
-    $read: createInputFun(),
-    $write: createOutputFun()
-  },
-  $strLib: {
-    $substring: createSubstringFun(),
-    $length: createLengthFun(),
-    $uppercase: createUppercaseFun(),
-    $lowercase: createLowercaseFun(),
-    $charAt: createrCharAtFun(),
-  },
-  $arrayLib: {
-    $numElements: createNumElementsFun(),
-    $matrixLines: createMatrixLinesFun(),
-    $matrixColumns: createMatrixColumnsFun()
-  },
-  $langLib: {
-    $isReal: createIsRealFun(),
-    $isInt: createIsIntFun(),
-    $isBool: createIsBoolFun(),
-    $castReal: createCastRealFun(),
-    $castInt: createCastIntFun(),
-    $castBool: createCastBoolFun(),
-    $castString: createCastStringFun()
-  }
-}
-
-const funcsObject = concatObjects(libsObject.$ioLib, libsObject.$langLib,
-  libsObject.$strLib, libsObject.$arrayLib);
-
-export const LanguageDefinedFunction = Object.freeze({
-  getMainFunctionName: () => LanguageService.getCurrentLangFuncs().main_function,
-  getInternalName: (localName) => {
-    if (localName.indexOf(".") !== -1) {
-      const names = localName.split(".");
-      const lib = valueToKey(names[0], LanguageService.getCurrentLangLibs());
-      const internalName = valueToKey(names[1], LanguageService.getCurrentLangFuncs());
-      if (lib === null || internalName === null) {
-        return null;
-      }
-      return lib + "." + internalName;
-    }
-    const funcName = valueToKey(localName, LanguageService.getCurrentLangFuncs());
-    if(funcName !== null) {
-      if(funcsObject[funcName]) {
-        return funcName;
-      }
-    }
-    return null;
-  },
-  getFunction: (internalName) => {
-    if (internalName.indexOf(".") !== -1) {
-      const names = internalName.split(".");
-      const libName = names[0];
-      const funName = names[1];
-      return libsObject[libName][funName];
-    }
-    return funcsObject[internalName];
-  },
-  getLocalName: (internalName) => {
-    if (internalName.indexOf(".") !== -1) {
-      const names = internalName.split(".");
-      const libName = LanguageService.getCurrentLangLibs()[names[0]];
-      const funName = LanguageService.getCurrentLangFuncs()[names[1]];
-      return `${libName}.${funName}`;
-    } else if (LanguageService.getCurrentLangFuncs()[internalName]) {
-      return LanguageService.getCurrentLangFuncs()[internalName];
-    } else { 
-      return internalName
-    }
-  }
-});

+ 0 - 398
ivprogh/js/processor/error/processorErrorFactory.js

@@ -1,398 +0,0 @@
-import { RuntimeError } from './runtimeError';
-import { SemanticError } from './semanticError';
-import { LocalizedStrings } from './../../services/localizedStringsService';
-import { Operators } from '../../ast/operators';
-
-function translateType (type, dim) {
-  switch (dim) {
-    case 0:
-      return LocalizedStrings.getUI(type);
-    default:
-      const transType = LocalizedStrings.getUI(type);
-      if(dim === 1)
-        return LocalizedStrings.getUI("vector_string", [transType])
-      else
-        return LocalizedStrings.getUI("matrix_string", [transType])
-  }
-}
-
-function translateOp (op) {
-  switch(op.ord) {
-    case Operators.AND.ord:
-    case Operators.OR.ord:
-    case Operators.NOT.ord:
-      return LocalizedStrings.getUI(op.value);
-    default:
-      return op.value;
-  }
-}
-
-export const ProcessorErrorFactory  = Object.freeze({
-  symbol_not_found_full: (id, sourceInfo) => {
-    if(sourceInfo) {
-      const context = [id, sourceInfo.line, sourceInfo.column];
-      return new SemanticError(LocalizedStrings.getError("symbol_not_found_full", context));
-    } else {
-      return ProcessorErrorFactory.symbol_not_found(id);
-    }
-  },
-  symbol_not_found: (id) => {
-    const context = [id];
-    return new SemanticError(LocalizedStrings.getError("symbol_not_found", context));
-  },
-  function_missing_full: (id, sourceInfo) => {
-    if(sourceInfo) {
-      const context = [id, sourceInfo.line, sourceInfo.column];
-      return new SemanticError(LocalizedStrings.getError("function_missing_full", context));
-    } else {
-      return ProcessorErrorFactory.function_missing(id);
-    }
-  },
-  function_missing: (id) => {
-    const context = [id];
-    return new SemanticError(LocalizedStrings.getError("function_missing", context));
-  },
-  main_missing: () => {
-    return new SemanticError(LocalizedStrings.getError("main_missing"));
-  },        // TODO: better urgent error message
-  array_dimension_not_int_full: (sourceInfo) => {
-    if(sourceInfo) {
-      const context = [sourceInfo.line];
-      return new SemanticError(LocalizedStrings.getError("array_dimension_not_int_full", context));
-    } else {
-      return ProcessorErrorFactory.array_dimension_not_int();
-    }
-  },
-  array_dimension_not_int: () => {
-    return new SemanticError(LocalizedStrings.getError("array_dimension_not_int"));
-  },
-  unknown_command_full: (sourceInfo)=> {
-    if(sourceInfo) {
-      const context = [sourceInfo.line];
-      return new RuntimeError(LocalizedStrings.getError("unknown_command_full", context));
-    } else {
-      return ProcessorErrorFactory.unknown_command();
-    }
-    
-  },
-  unknown_command: ()=> {
-    return new RuntimeError(LocalizedStrings.getError("unknown_command"));
-  },
-  incompatible_types_full: (type, dim, sourceInfo) => {
-    if(sourceInfo) {
-      const context = [translateType(type, dim), sourceInfo.line, sourceInfo.column];
-      return new SemanticError(LocalizedStrings.getError("incompatible_types_full", context));
-    } else {
-      return ProcessorErrorFactory.incompatible_types(type, dim);
-    }
-  },
-  incompatible_types: (type, dim) => {
-    const context = [translateType(type, dim)];
-    return new SemanticError(LocalizedStrings.getError("incompatible_types", context));
-  },
-  incompatible_types_array_full: (exp, type, dim, sourceInfo) => {
-    if(sourceInfo) {
-      const context = [exp, translateType(type, dim), sourceInfo.line, sourceInfo.column];
-      return new SemanticError(LocalizedStrings.getError("incompatible_types_array_full", context));
-    } else {
-      return ProcessorErrorFactory.incompatible_types_array(exp, type, dim);
-    }
-  },
-  incompatible_types_array: (exp, type, dim) => {
-    const context = [exp, translateType(type, dim)];
-    return new SemanticError(LocalizedStrings.getError("incompatible_types_array", context));
-  },
-  loop_condition_type_full: (sourceInfo) => {
-    if(sourceInfo) {
-      const context = [sourceInfo.line, sourceInfo.column];
-      return new SemanticError(LocalizedStrings.getError("loop_condition_type_full", context));
-    } else {
-      return ProcessorErrorFactory.loop_condition_type();
-    }
-  },
-  loop_condition_type: () => {
-    return new SemanticError(LocalizedStrings.getError("loop_condition_type"));
-  },
-  endless_loop_full: (sourceInfo) => {
-    if(sourceInfo) {
-      const context = [sourceInfo.line];
-      return new SemanticError(LocalizedStrings.getError("endless_loop_full", context));
-    } else {
-      return ProcessorErrorFactory.endless_loop();
-    }
-  },
-  endless_loop: () => {
-    return new SemanticError(LocalizedStrings.getError("endless_loop"));
-  },
-  for_condition_type_full: (sourceInfo) => {
-    if(sourceInfo) {
-      const context = [sourceInfo.line, sourceInfo.column];
-      return new SemanticError(LocalizedStrings.getError("for_condition_type_full", context));
-    } else {
-      return ProcessorErrorFactory.for_condition_type();
-    }
-  },
-  for_condition_type: () => {
-    return new SemanticError(LocalizedStrings.getError("for_condition_type"));
-  },
-  if_condition_type_full: (sourceInfo) => {
-    if(sourceInfo) {
-      const context = [sourceInfo.line, sourceInfo.column];
-      return new SemanticError(LocalizedStrings.getError("if_condition_type_full", context));
-    } else {
-      return ProcessorErrorFactory.if_condition_type();
-    }
-  },
-  if_condition_type: () => {
-    return new SemanticError(LocalizedStrings.getError("if_condition_type"));
-  },
-  invalid_global_var: () => {
-    return new RuntimeError(LocalizedStrings.getError("invalid_global_var"))
-  },
-  not_implemented: (id) => {
-    const context  = [id]
-    return new RuntimeError(LocalizedStrings.getError("not_implemented", context))
-  },
-  invalid_case_type_full: (exp, type, dim, sourceInfo) => {
-    if(sourceInfo) {
-      const context = [exp, translateType(type, dim), sourceInfo.line, sourceInfo.column];
-      return new SemanticError(LocalizedStrings.getError("invalid_case_type_full", context));
-    } else {
-      return ProcessorErrorFactory.invalid_case_type(exp, type, dim);
-    }
-  },
-  invalid_case_type: (exp, type, dim) => {
-    const context = [exp, translateType(type, dim)];
-    return new SemanticError(LocalizedStrings.getError("invalid_case_type", context));
-  },
-  void_in_expression_full: (id, sourceInfo) => {
-    if(sourceInfo) {
-      const context = [sourceInfo.line, sourceInfo.column, id];
-      return new SemanticError(LocalizedStrings.getError("void_in_expression_full", context));
-    } else {
-      return ProcessorErrorFactory.void_in_expression(id);
-    }
-  },
-  void_in_expression: (id) => {
-    const context = [id];
-    return new SemanticError(LocalizedStrings.getError("void_in_expression", context));
-  },
-  invalid_array_access_full: (id, sourceInfo) => {
-    if(sourceInfo) {
-      const context = [id, sourceInfo.line, sourceInfo.column];
-      return new SemanticError(LocalizedStrings.getError("invalid_array_access_full", context));
-    } else {
-      return ProcessorErrorFactory.invalid_array_access(id);
-    }
-  },
-  invalid_array_access: (id) => {
-    const context = [id];
-    return new SemanticError(LocalizedStrings.getError("invalid_array_access", context));
-  },
-  invalid_matrix_access_full: (id, sourceInfo) => {
-    if(sourceInfo) {
-      const context = [id, sourceInfo.line, sourceInfo.column];
-      return new SemanticError(LocalizedStrings.getError("invalid_matrix_access_full", context));
-    } else {
-      return ProcessorErrorFactory.invalid_matrix_access(id);
-    }
-  },
-  invalid_matrix_access: (id) => {
-    const context = [id];
-    return new SemanticError(LocalizedStrings.getError("invalid_matrix_access", context));
-  },
-  matrix_column_outbounds_full: (id, value, columns, sourceInfo) => {
-    if(sourceInfo) {
-      const context = [sourceInfo.line, value, id, columns];
-      return new RuntimeError(LocalizedStrings.getError("matrix_column_outbounds_full", context));
-    } else {
-      return ProcessorErrorFactory.matrix_column_outbounds(id, value, columns);
-    }
-  },
-  matrix_column_outbounds: (id, value, columns) => {
-    const context = [value, id, columns];
-    return new RuntimeError(LocalizedStrings.getError("matrix_column_outbounds", context));
-  },
-  matrix_line_outbounds_full: (id, value, lines, sourceInfo) => {
-    if(sourceInfo) {
-      const context = [sourceInfo.line, value, id, lines];
-      return new RuntimeError(LocalizedStrings.getError("matrix_line_outbounds_full", context));
-    } else {
-      return ProcessorErrorFactory.matrix_line_outbounds(id, value, lines);
-    }
-  },
-  matrix_line_outbounds: (id, value, lines) => {
-    const context = [value, id, lines];
-    return new RuntimeError(LocalizedStrings.getError("matrix_line_outbounds", context));
-  },
-  vector_line_outbounds_full: (id, value, lines, sourceInfo) => {
-    if(sourceInfo) {
-      const context = [sourceInfo.line, value, id, lines];
-      return new RuntimeError(LocalizedStrings.getError("vector_line_outbounds_full", context));
-    } else {
-      return ProcessorErrorFactory.vector_line_outbounds(id, value, lines);
-    }
-  },
-  vector_line_outbounds: (id, value, lines) => {
-    const context = [value, id, lines];
-    return new RuntimeError(LocalizedStrings.getError("vector_line_outbounds", context));
-  },
-  vector_not_matrix_full: (id, sourceInfo) => {
-    if(sourceInfo) {
-      const context = [sourceInfo.line, id];
-      return new RuntimeError(LocalizedStrings.getError("vector_not_matrix_full", context));
-    } else {
-      return ProcessorErrorFactory.vector_not_matrix(id);
-    }
-  },
-  vector_not_matrix: (id) => {
-    const context = [id];
-    return new RuntimeError(LocalizedStrings.getError("vector_not_matrix", context));
-  },
-  function_no_return: (id) => {
-    const context = [id];
-    return new SemanticError(LocalizedStrings.getError("function_no_return", context));
-  },
-  invalid_void_return_full: (id, type, dim, sourceInfo) => {
-    if(sourceInfo) {
-      const context = [sourceInfo.line, id, translateType(type, dim)];
-      return new SemanticError(LocalizedStrings.getError("invalid_void_return_full", context));
-    } else {
-      return ProcessorErrorFactory.invalid_void_return(id, type, dim);
-    }
-  },
-  invalid_void_return: (id, type, dim) => {
-    const context = [id, translateType(type, dim)];
-    return new SemanticError(LocalizedStrings.getError("invalid_void_return_full", context));
-  },
-  invalid_return_type_full: (id, type, dim, sourceInfo) => {
-    if(sourceInfo) {
-      const context = [sourceInfo.line, id, translateType(type, dim)];
-      return new SemanticError(LocalizedStrings.getError("invalid_return_type_full", context));
-    } else {
-      return ProcessorErrorFactory.invalid_return_type(id, type, dim);
-    }
-  },
-  invalid_return_type: (id, type, dim) => {
-    const context = [id, translateType(type, dim)];
-    return new SemanticError(LocalizedStrings.getError("invalid_return_type", context));
-  },
-  invalid_parameters_size_full: (id, expected, actual, sourceInfo) => {
-    if(sourceInfo) {
-      const context = [sourceInfo.line, id, expected, actual];
-      return new SemanticError(LocalizedStrings.getError("invalid_parameters_size_full", context));
-    } else {
-      return ProcessorErrorFactory.invalid_parameters_size(id, expected, actual);
-    }
-  },
-  invalid_parameters_size: (id, expected, actual) => {
-    const context = [id, expected, actual];
-    return new SemanticError(LocalizedStrings.getError("invalid_parameters_size", context));
-  },
-  invalid_parameter_type_full: (id, exp, sourceInfo) => {
-    if(sourceInfo) {
-      const context = [exp, id, sourceInfo.line];
-      return new SemanticError(LocalizedStrings.getError("invalid_parameter_type_full", context));
-    } else {
-      return ProcessorErrorFactory.invalid_parameter_type(id, exp);
-    }
-  },
-  invalid_parameter_type: (id, exp) => {
-    const context = [exp, id];
-    return new SemanticError(LocalizedStrings.getError("invalid_parameter_type_full", context));
-  },
-  invalid_ref_full: (id, exp, sourceInfo) => {
-    if(sourceInfo) {
-      const context = [exp, id , sourceInfo.line];
-      return new SemanticError(LocalizedStrings.getError("invalid_ref_full", context));
-    } else {
-      return ProcessorErrorFactory.invalid_ref(id, exp);
-    }
-  },
-  invalid_ref: (id, exp) => {
-    const context = [exp, id];
-    return new SemanticError(LocalizedStrings.getError("invalid_ref", context));
-  },
-  unexpected_break_command_full: (sourceInfo) => {
-    if(sourceInfo) {
-      const context = [sourceInfo.line];
-      return new RuntimeError(LocalizedStrings.getError("unexpected_break_command_full", context));
-    } else {
-      return ProcessorErrorFactory.unexpected_break_command();
-    }
-  },
-  unexpected_break_command: () => {
-    return new RuntimeError(LocalizedStrings.getError("unexpected_break_command"));
-  },
-  invalid_array_literal_type_full: (exp, sourceInfo) => {
-    if(sourceInfo) {
-      const context = [sourceInfo.line, exp];
-      return new RuntimeError(LocalizedStrings.getError("invalid_array_literal_type_full", context));
-    } else {
-      return ProcessorErrorFactory.invalid_array_literal_type(exp);
-    }
-  },
-  invalid_array_literal_type: (exp) => {
-    const context = [exp];
-    return new RuntimeError(LocalizedStrings.getError("invalid_array_literal_type", context));
-  },
-  invalid_array_literal_line_full: (expected, actual, sourceInfo) => {
-    if(sourceInfo) {
-      const context = [sourceInfo.line, expected, actual];
-      return new RuntimeError(LocalizedStrings.getError("invalid_array_literal_line_full", context));
-    } else {
-      return ProcessorErrorFactory.invalid_array_literal_type(expected, actual);
-    }
-  },
-  invalid_array_literal_line: (expected, actual) => {
-    const context = [expected, actual];
-    return new RuntimeError(LocalizedStrings.getError("invalid_array_literal_line", context));
-  },
-  invalid_array_literal_column_full: (expected, actual, sourceInfo) => {
-    if(sourceInfo) {
-      const context = [sourceInfo.line, expected, actual];
-      return new RuntimeError(LocalizedStrings.getError("invalid_array_literal_column_full", context));
-    } else {
-      return ProcessorErrorFactory.invalid_array_literal_column(expected, actual);
-    }
-  },
-  invalid_array_literal_column: (expected, actual) => {
-    const context = [expected, actual];
-    return new RuntimeError(LocalizedStrings.getError("invalid_array_literal_column", context));
-  },
-  invalid_unary_op_full: (opName, type, dim, sourceInfo) => {
-    if(sourceInfo) {
-      const context = [sourceInfo.line, translateOp(opName), translateType(type, dim)];
-      return new RuntimeError(LocalizedStrings.getError("invalid_unary_op_full", context));
-    } else {
-      return ProcessorErrorFactory.invalid_unary_op(opName, type, dim);
-    }
-  },
-  invalid_unary_op: (opName, type, dim) => {
-    const context = [translateOp(opName), translateType(type, dim)];
-    return new RuntimeError(LocalizedStrings.getError("invalid_unary_op", context));
-  },
-  invalid_infix_op_full: (opName, typeLeft, dimLeft, typeRight, dimRight,  sourceInfo) => {
-    if(sourceInfo) {
-      const context = [sourceInfo.line, translateOp(opName), translateType(typeLeft, dimLeft), translateType(typeRight, dimRight)];
-      return new RuntimeError(LocalizedStrings.getError("invalid_infix_op_full", context));
-    } else {
-      return ProcessorErrorFactory.invalid_infix_op(opName, typeLeft, dimLeft, typeRight, dimRight);
-    }
-  },
-  invalid_infix_op: (opName, typeLeft, dimLeft, typeRight, dimRight) => {
-    const context = [translateOp(opName), translateType(typeLeft, dimLeft), translateType(typeRight, dimRight)];
-    return new RuntimeError(LocalizedStrings.getError("invalid_infix_op", context));
-  },
-  array_dimension_not_positive_full: (sourceInfo) => {
-    if(sourceInfo) {
-      const context = [sourceInfo.line];
-      return new SemanticError(LocalizedStrings.getError("array_dimension_not_positive_full", context));
-    } else {
-      return ProcessorErrorFactory.array_dimension_not_positive();
-    }
-  },
-  array_dimension_not_positive: () => {
-    return new SemanticError(LocalizedStrings.getError("array_dimension_not_positive"));
-  }
-});

+ 0 - 8
ivprogh/js/processor/error/runtimeError.js

@@ -1,8 +0,0 @@
-export class RuntimeError extends Error {
-
-  constructor (...msg) {
-    super(...msg);
-    if(Error.captureStackTrace)
-      Error.captureStackTrace(this, RuntimeError);
-  }
-}

+ 0 - 8
ivprogh/js/processor/error/semanticError.js

@@ -1,8 +0,0 @@
-export class SemanticError extends Error {
-
-  constructor (...msg) {
-    super(...msg);
-    if(Error.captureStackTrace)
-      Error.captureStackTrace(this, SemanticError);
-  }
-}

+ 0 - 968
ivprogh/js/processor/ivprogProcessor.js

@@ -1,968 +0,0 @@
-import { Store } from './store/store';
-import { StoreObject } from './store/storeObject';
-import { StoreObjectArray } from './store/storeObjectArray';
-import { StoreObjectRef } from './store/storeObjectRef';
-import { Modes } from './modes';
-import { Context } from './context';
-import { Types } from './../typeSystem/types';
-import { Operators } from './../ast/operators';
-import { LanguageDefinedFunction } from './definedFunctions';
-import { resultTypeAfterInfixOp, resultTypeAfterUnaryOp } from './compatibilityTable';
-import * as Commands from './../ast/commands/';
-import * as Expressions from './../ast/expressions/';
-import { StoreObjectArrayAddress } from './store/storeObjectArrayAddress';
-import { StoreObjectArrayAddressRef } from './store/storeObjectArrayAddressRef';
-import { CompoundType } from './../typeSystem/compoundType';
-import { convertToString } from '../typeSystem/parsers';
-import { Config } from '../util/config';
-import Decimal from 'decimal.js';
-import { ProcessorErrorFactory } from './error/processorErrorFactory';
-import { RuntimeError } from './error/runtimeError';
-
-export class IVProgProcessor {
-
-  static get LOOP_TIMEOUT () {
-    return Config.loopTimeout;
-  }
-
-  static set LOOP_TIMEOUT (ms) {
-    Config.setConfig({loopTimeout: ms});
-  }
-
-  static get MAIN_INTERNAL_ID () {
-    return "$main";
-  }
-
-  constructor (ast) {
-    this.ast = ast;
-    this.globalStore = new Store("$global");
-    this.stores = [this.globalStore];
-    this.context = [Context.BASE];
-    this.input = null;
-    this.forceKill = false;
-    this.loopTimers = [];
-    this.output = null;
-  }
-
-  registerInput (input) {
-    if(this.input !== null)
-      this.input = null;
-    this.input = input;
-  }
-
-  registerOutput (output) {
-    if(this.output !== null)
-      this.output = null;
-    this.output = output;
-  }
-
-  checkContext(context) {
-    return this.context[this.context.length - 1] === context;
-  }
-
-  ignoreSwitchCases (store) {
-    if (store.mode === Modes.RETURN) {
-      return true;
-    } else if (store.mode === Modes.BREAK) {
-      return true;
-    } else {
-      return false;
-    }
-  }
-
-  prepareState () {
-    if(this.stores !== null) {
-      for (let i = 0; i < this.stores.length; i++) {
-        delete this.stores[i];
-      }
-      this.stores = null;
-    }
-    if(this.globalStore !== null)
-      this.globalStore = null;
-    this.globalStore = new Store("$global");
-    this.stores = [this.globalStore];
-    this.context = [Context.BASE];
-  }
-
-  interpretAST () {
-    this.prepareState();
-    this.initGlobal();
-    const mainFunc = this.findMainFunction();
-    if(mainFunc === null) {
-      throw ProcessorErrorFactory.main_missing();
-    }
-    return this.runFunction(mainFunc, [], this.globalStore);
-  }
-
-  initGlobal () {
-    if(!this.checkContext(Context.BASE)) {
-      throw ProcessorErrorFactory.invalid_global_var();
-    }
-    this.ast.global.forEach(decl => {
-      this.executeCommand(this.globalStore, decl).then(sto => this.globalStore = sto);
-    });
-  }
-
-  findMainFunction () {
-    return this.ast.functions.find(v => v.isMain);
-  }
-
-  findFunction (name) {
-    if(name.match(/^\$.+$/)) {
-      const fun = LanguageDefinedFunction.getFunction(name);
-      if(!!!fun) {
-        throw ProcessorErrorFactory.not_implemented(name);
-      }
-      return fun;
-    } else {
-      const val = this.ast.functions.find( v => v.name === name);
-      if (!!!val) {
-        // TODO: better error message;
-        throw ProcessorErrorFactory.function_missing(name);
-      }
-      return val;
-    }
-  }
-
-  runFunction (func, actualParameters, store) {
-    const funcName = func.isMain ? IVProgProcessor.MAIN_INTERNAL_ID : func.name;
-    let funcStore = new Store(funcName);
-    funcStore.extendStore(this.globalStore);
-    let returnStoreObject = null;
-    if(func.returnType instanceof CompoundType) {
-      if(func.returnType.dimensions > 1) {
-        returnStoreObject = new StoreObjectArray(func.returnType,-1,-1,[[]]);
-      } else {
-        returnStoreObject = new StoreObjectArray(func.returnType,-1,null,[]);
-      }
-    } else {
-      returnStoreObject = new StoreObject(func.returnType, null);
-    }
-    funcStore.insertStore('$', returnStoreObject);
-    const newFuncStore$ = this.associateParameters(func.formalParameters, actualParameters, store, funcStore);
-    return newFuncStore$.then(sto => {
-      this.context.push(Context.FUNCTION);
-      this.stores.push(sto);
-      return this.executeCommands(sto, func.variablesDeclarations)
-        .then(stoWithVars => this.executeCommands(stoWithVars, func.commands)).then(finalSto => {
-          this.stores.pop();
-          this.context.pop();
-          return finalSto;
-        });
-    });
-  }
-
-  associateParameters (formalList, actualList, callerStore, calleeStore) {
-    const funcName = calleeStore.name === IVProgProcessor.MAIN_INTERNAL_ID ? 
-      LanguageDefinedFunction.getMainFunctionName() : calleeStore.name;
-
-    if (formalList.length != actualList.length) {
-      throw ProcessorErrorFactory.invalid_parameters_size(funcName, formalList.length, actualList.length);
-    }
-    const promises$ = actualList.map(actualParameter => this.evaluateExpression(callerStore, actualParameter));
-    return Promise.all(promises$).then(values => {
-      for (let i = 0; i < values.length; i++) {
-        const stoObj = values[i];
-        const exp = actualList[i]
-        const formalParameter = formalList[i];
-        if(formalParameter.type.isCompatible(stoObj.type)) {
-          if(formalParameter.byRef && !stoObj.inStore) {
-            throw ProcessorErrorFactory.invalid_ref(funcName, exp.toString());
-          }
-
-          if(formalParameter.byRef) {
-            let ref = null;
-            if (stoObj instanceof StoreObjectArrayAddress) {
-              ref = new StoreObjectArrayAddressRef(stoObj);
-            } else {
-              ref = new StoreObjectRef(stoObj.id, callerStore);
-            }
-            calleeStore.insertStore(formalParameter.id, ref);
-          } else {
-            let realValue = this.parseStoreObjectValue(stoObj);
-            calleeStore.insertStore(formalParameter.id, realValue);
-          }
-        } else {
-          throw ProcessorErrorFactory.invalid_parameter_type(funcName, exp.toString());
-        }
-      }
-      return calleeStore;
-    });
-  }
-
-  executeCommands (store, cmds) {
-    // helper to partially apply a function, in this case executeCommand
-    const outerRef = this;
-    const partial = (fun, cmd) => (sto) => fun(sto, cmd);
-    return cmds.reduce((lastCommand, next) => {
-      const nextCommand = partial(outerRef.executeCommand.bind(outerRef), next);
-      return lastCommand.then(nextCommand);
-    }, Promise.resolve(store));
-  }
-
-  executeCommand (store, cmd) {
-
-    if(this.forceKill) {
-      return Promise.reject("FORCED_KILL!");
-    } else if (store.mode === Modes.PAUSE) {
-      return Promise.resolve(this.executeCommand(store, cmd));
-    } else if(store.mode === Modes.RETURN) {
-      return Promise.resolve(store);
-    } else if(this.checkContext(Context.BREAKABLE) && store.mode === Modes.BREAK) {
-      return Promise.resolve(store);
-    }
-
-    if (cmd instanceof Commands.Declaration) {
-      return this.executeDeclaration(store, cmd);
-    } else if (cmd instanceof Commands.ArrayIndexAssign) {
-      return this.executeArrayIndexAssign(store, cmd);
-    } else if (cmd instanceof Commands.Assign) {
-      return this.executeAssign(store, cmd);
-    } else if (cmd instanceof Commands.Break) {
-      return this.executeBreak(store, cmd);
-    } else if (cmd instanceof Commands.Return) {
-      return this.executeReturn(store, cmd);
-    } else if (cmd instanceof Commands.IfThenElse) {
-      return this.executeIfThenElse(store, cmd);
-    } else if (cmd instanceof Commands.While) {
-      return this.executeWhile(store, cmd);
-    } else if (cmd instanceof Commands.DoWhile) {
-      return this.executeDoWhile(store, cmd);
-    } else if (cmd instanceof Commands.For) {
-      return this.executeFor(store, cmd);
-    } else if (cmd instanceof Commands.Switch) {
-      return this.executeSwitch(store, cmd);
-    } else if (cmd instanceof Expressions.FunctionCall) {
-      
-      return this.executeFunctionCall(store, cmd);
-    } else if (cmd instanceof Commands.SysCall) {
-      return this.executeSysCall(store, cmd);
-    } else {
-      throw ProcessorErrorFactory.unknown_command(cmd.sourceInfo);
-    }
-  }
-
-  executeSysCall (store, cmd) {
-    const func = cmd.langFunc.bind(this);
-    return func(store, cmd);
-  }
-
-  executeFunctionCall (store, cmd) {
-    let func = null;
-    if(cmd.isMainCall) {
-      func = this.findMainFunction();
-    } else {
-      func = this.findFunction(cmd.id);
-    }
-    return this.runFunction(func, cmd.actualParameters, store)
-      .then(sto => {
-        if(!Types.VOID.isCompatible(func.returnType) && sto.mode !== Modes.RETURN) {
-          const funcName = func.name === IVProgProcessor.MAIN_INTERNAL_ID ? 
-            LanguageDefinedFunction.getMainFunctionName() : func.name;
-          return Promise.reject(ProcessorErrorFactory.function_no_return(funcName));
-        } else {
-          return store;
-        }
-      })
-  }
-
-  executeSwitch (store, cmd) {
-    this.context.push(Context.BREAKABLE);
-    const auxCaseFun = (promise, switchExp, aCase) => {
-      return promise.then( result => {
-        const sto = result.sto;
-        if (this.ignoreSwitchCases(sto)) {
-          return Promise.resolve(result);
-        } else if (result.wasTrue || aCase.isDefault) {
-          const $newSto = this.executeCommands(result.sto,aCase.commands);
-          return $newSto.then(nSto => {
-            return Promise.resolve({wasTrue: true, sto: nSto});
-          });
-        } else {
-          const $value = this.evaluateExpression(sto,
-            new Expressions.InfixApp(Operators.EQ, switchExp, aCase.expression));
-          return $value.then(vl => {
-            if (vl.value) {
-              const $newSto = this.executeCommands(result.sto,aCase.commands);
-              return $newSto.then(nSto => {
-                return Promise.resolve({wasTrue: true, sto: nSto});
-              });
-            } else {
-              return Promise.resolve({wasTrue: false, sto: sto});
-            }
-          });
-        }
-      });
-    }
-
-    try {
-      let breakLoop = false;
-      let $result = Promise.resolve({wasTrue: false, sto: store});
-      for (let index = 0; index < cmd.cases.length && !breakLoop; index++) {
-        const aCase = cmd.cases[index];
-        $result = auxCaseFun($result, cmd.expression, aCase);
-        $result.then( r => breakLoop = this.ignoreSwitchCases(r.sto));
-      }
-      return $result.then(r => {
-        this.context.pop();
-        if(r.sto.mode === Modes.BREAK) {
-          r.sto.mode = Modes.RUN;
-        }
-        return r.sto;
-      });
-    } catch (error) {
-      return Promise.reject(error);
-    }
-  }
-
-  executeFor (store, cmd) {
-    try {
-      //BEGIN for -> while rewrite
-      const initCmd = cmd.assignment;
-      const condition = cmd.condition;
-      const increment = cmd.increment;
-      const whileBlock = new Commands.CommandBlock([],
-        cmd.commands.concat(increment));
-      const forAsWhile = new Commands.While(condition, whileBlock);
-      //END for -> while rewrite
-      const newCmdList = [initCmd,forAsWhile];
-      return this.executeCommands(store, newCmdList);
-    } catch (error) {
-      return Promise.reject(error);
-    }
-  }
-
-  executeDoWhile (store, cmd) {
-    const outerRef = this;
-    try {
-      outerRef.loopTimers.push(Date.now());
-      outerRef.context.push(Context.BREAKABLE);
-      const $newStore = outerRef.executeCommands(store, cmd.commands);
-      return $newStore.then(sto => {
-        if(sto.mode === Modes.BREAK) {
-          outerRef.context.pop();
-          sto.mode = Modes.RUN;
-          outerRef.loopTimers.pop();
-          return sto;
-        }
-        const $value = outerRef.evaluateExpression(sto, cmd.expression);
-        return $value.then(vl => {
-          if (!vl.type.isCompatible(Types.BOOLEAN)) {
-            return Promise.reject(ProcessorErrorFactory.loop_condition_type_full(cmd.sourceInfo));
-          }
-          if (vl.value) {
-            outerRef.context.pop();
-            for (let i = 0; i < outerRef.loopTimers.length; i++) {
-              const time = outerRef.loopTimers[i];
-              if(Date.now() - time >= IVProgProcessor.LOOP_TIMEOUT) {
-                outerRef.forceKill = true;
-                return Promise.reject(ProcessorErrorFactory.endless_loop_full(cmd.sourceInfo));
-              }
-            }
-            return outerRef.executeCommand(sto, cmd);
-          } else {
-            outerRef.context.pop();
-            outerRef.loopTimers.pop();
-            return sto;
-          }
-        })
-      })
-    } catch (error) {
-      return Promise.reject(error);
-    }
-  }
-
-  executeWhile (store, cmd) {
-    const outerRef = this;
-    try {
-      outerRef.loopTimers.push(Date.now());
-      outerRef.context.push(Context.BREAKABLE);
-      const $value = outerRef.evaluateExpression(store, cmd.expression);
-      return $value.then(vl => {
-        if(vl.type.isCompatible(Types.BOOLEAN)) {
-          if(vl.value) {
-            const $newStore = outerRef.executeCommands(store, cmd.commands);
-            return $newStore.then(sto => {
-              outerRef.context.pop();
-              if (sto.mode === Modes.BREAK) {
-                outerRef.loopTimers.pop();
-                sto.mode = Modes.RUN;
-                return sto;
-              }
-              for (let i = 0; i < outerRef.loopTimers.length; i++) {
-                const time = outerRef.loopTimers[i];
-                if(Date.now() - time >= IVProgProcessor.LOOP_TIMEOUT) {
-                  outerRef.forceKill = true;
-                  return Promise.reject(ProcessorErrorFactory.endless_loop_full(cmd.sourceInfo));
-                }
-              }
-              return outerRef.executeCommand(sto, cmd);
-            });
-          } else {
-            outerRef.context.pop();
-            outerRef.loopTimers.pop();
-            return store;
-          }
-        } else {
-          return Promise.reject(ProcessorErrorFactory.loop_condition_type_full(cmd.sourceInfo));
-        }
-      })
-      
-    } catch (error) {
-      return Promise.reject(error);
-    }
-  }
-
-  executeIfThenElse (store, cmd) {
-    try {
-      const $value = this.evaluateExpression(store, cmd.condition);
-      return $value.then(vl => {
-        if(vl.type.isCompatible(Types.BOOLEAN)) {
-          if(vl.value) {
-            return this.executeCommands(store, cmd.ifTrue.commands);
-          } else if( cmd.ifFalse !== null){
-            if(cmd.ifFalse instanceof Commands.IfThenElse) {
-              return this.executeCommand(store, cmd.ifFalse);
-            } else {
-              return this.executeCommands(store, cmd.ifFalse.commands);
-            }
-          } else {
-            return Promise.resolve(store);
-          }
-        } else {
-          return Promise.reject(ProcessorErrorFactory.if_condition_type_full(cmd.sourceInfo));
-        }
-      });
-    } catch (error) {
-      return Promise.reject(error);
-    }
-  }
-
-  executeReturn (store, cmd) {
-    try {
-      const funcType = store.applyStore('$').type;
-      const $value = this.evaluateExpression(store, cmd.expression);
-      const funcName = store.name === IVProgProcessor.MAIN_INTERNAL_ID ? 
-        LanguageDefinedFunction.getMainFunctionName() : store.name;
-      return $value.then(vl => {
-
-        if(vl === null && funcType.isCompatible(Types.VOID)) {
-          return Promise.resolve(store);
-        }
-
-        if (vl === null || !funcType.isCompatible(vl.type)) {
-          const stringInfo = funcType.stringInfo();
-          const info = stringInfo[0];
-          return Promise.reject(ProcessorErrorFactory.invalid_return_type_full(funcName, info.type, info.dim, cmd.sourceInfo));
-        } else {
-          let realValue = this.parseStoreObjectValue(vl);
-          store.updateStore('$', realValue);
-          store.mode = Modes.RETURN;
-          return Promise.resolve(store);
-        }
-      });
-    } catch (error) {
-      return Promise.reject(error);
-    }
-  }
-
-  executeBreak (store, cmd) {
-    if(this.checkContext(Context.BREAKABLE)) {
-      store.mode = Modes.BREAK;
-      return Promise.resolve(store);
-    } else {
-      return Promise.reject(ProcessorErrorFactory.unexpected_break_command_full(cmd.sourceInfo));
-    }
-  }
-
-  executeAssign (store, cmd) {
-    try {
-      const $value = this.evaluateExpression(store, cmd.expression);
-      return $value.then( vl => {
-        let realValue = this.parseStoreObjectValue(vl);
-        store.updateStore(cmd.id, realValue) 
-        return store;
-      });
-    } catch (error) {
-      return Promise.reject(error);
-    }
-  }
-
-  executeArrayIndexAssign (store, cmd) {
-    const mustBeArray = store.applyStore(cmd.id);
-    if(!(mustBeArray.type instanceof CompoundType)) {
-      return Promise.reject(ProcessorErrorFactory.invalid_array_access_full(cmd.id, cmd.sourceInfo));
-    }
-    const line$ = this.evaluateExpression(store, cmd.line);
-    const column$ = this.evaluateExpression(store, cmd.column);
-    const value$ =  this.evaluateExpression(store, cmd.expression);
-    return Promise.all([line$, column$, value$]).then(results => {
-      const lineSO = results[0];
-      if(!Types.INTEGER.isCompatible(lineSO.type)) {
-        return Promise.reject(ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo));
-      }
-      const line = lineSO.number;
-      const columnSO = results[1];
-      let column = null
-      if (columnSO !== null) {
-        if(!Types.INTEGER.isCompatible(columnSO.type)) {
-          return Promise.reject(ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo));
-        }
-        column = columnSO.number;
-      }
-      const value = this.parseStoreObjectValue(results[2]);
-      if (line >= mustBeArray.lines) {
-        if(mustBeArray.isVector) {
-          return Promise.reject(ProcessorErrorFactory.vector_line_outbounds_full(cmd.id, line, mustBeArray.lines, cmd.sourceInfo));
-        } else {
-          return Promise.reject(ProcessorErrorFactory.matrix_line_outbounds_full(cmd.id, line, mustBeArray.lines, cmd.sourceInfo));
-        }
-      } else if (line < 0) {
-        throw ProcessorErrorFactory.array_dimension_not_positive_full(cmd.sourceInfo);
-      }
-      if (column !== null && mustBeArray.columns === null ){
-        return Promise.reject(ProcessorErrorFactory.vector_not_matrix_full(cmd.id, cmd.sourceInfo));
-      }
-      if(column !== null ) {
-        if (column >= mustBeArray.columns) {
-          return Promise.reject(ProcessorErrorFactory.matrix_column_outbounds_full(cmd.id, column,mustBeArray.columns, cmd.sourceInfo));
-        } else if (column < 0) {
-          throw ProcessorErrorFactory.array_dimension_not_positive_full(cmd.sourceInfo);
-        }
-      }
-
-      const newArray = Object.assign(new StoreObjectArray(null,null,null), mustBeArray);
-      if (column !== null) {
-        if (value.type instanceof CompoundType) {
-          const type = mustBeArray.type.innerType;
-          const stringInfo = type.stringInfo()
-          const info = stringInfo[0]
-          return Promise.reject(ProcessorErrorFactory.incompatible_types_full(info.type, info.dim, cmd.sourceInfo));
-        }
-        newArray.value[line].value[column] = value;
-        store.updateStore(cmd.id, newArray);
-      } else {
-        if(mustBeArray.columns !== null && value.type instanceof CompoundType) {
-          const type = mustBeArray.type;
-          const stringInfo = type.stringInfo()
-          const info = stringInfo[0]
-          const exp = cmd.expression.toString()
-          return Promise.reject(ProcessorErrorFactory.incompatible_types_array_full(exp,info.type, info.dim-1, cmd.sourceInfo));
-        }
-        newArray.value[line] = value;
-        store.updateStore(cmd.id, newArray);
-      }
-      return store;
-    });
-  }
-
-  executeDeclaration (store, cmd) {
-    try {
-      const $value = this.evaluateExpression(store, cmd.initial);
-      if(cmd instanceof Commands.ArrayDeclaration) {
-        const $lines = this.evaluateExpression(store, cmd.lines);
-        const $columns = cmd.columns === null ? null: this.evaluateExpression(store, cmd.columns);
-        return Promise.all([$lines, $columns, $value]).then(values => {
-          const lineSO = values[0];
-          if(!Types.INTEGER.isCompatible(lineSO.type)) {
-            return Promise.reject(ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo));
-          }
-          const line = lineSO.number;
-          if(line < 0) {
-            throw ProcessorErrorFactory.array_dimension_not_positive_full(cmd.sourceInfo);
-          }
-          const columnSO = values[1];
-          let column = null
-          if (columnSO !== null) {
-            if(!Types.INTEGER.isCompatible(columnSO.type)) {
-              return Promise.reject(ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo));
-            }
-            column = columnSO.number;
-            if(column < 0) {
-              throw ProcessorErrorFactory.array_dimension_not_positive_full(cmd.sourceInfo);
-            }
-          }
-          const value = values[2];
-          const temp = new StoreObjectArray(cmd.type, line, column, null);
-          store.insertStore(cmd.id, temp);
-          let realValue = value;
-          if (value !== null) {
-            if(value instanceof StoreObjectArrayAddress) {
-              if(value.type instanceof CompoundType) {
-                realValue = Object.assign(new StoreObjectArray(null,null,null), value.refValue);
-              } else {
-                realValue = Object.assign(new StoreObject(null,null), value.refValue);
-              }
-            }
-          } else {
-            realValue = new StoreObjectArray(cmd.type, line, column, [])
-            if(column !== null) {
-              for (let i = 0; i < line; i++) {
-                realValue.value.push(new StoreObjectArray(new CompoundType(cmd.type.innerType, 1), column, null, []));
-              }
-            }
-          }
-          realValue.readOnly = cmd.isConst;
-          store.updateStore(cmd.id, realValue);
-          return store;
-        });
-        
-      } else {
-        const temp = new StoreObject(cmd.type, null);
-        store.insertStore(cmd.id, temp);
-        return $value.then(vl => {
-          let realValue = vl;
-          if (vl !== null) {
-            if(vl instanceof StoreObjectArrayAddress) {
-              if(vl.type instanceof CompoundType) {
-                realValue = Object.assign(new StoreObjectArray(null,null,null), vl.refValue);
-              } else {
-                realValue = Object.assign(new StoreObject(null,null), vl.refValue);
-              }
-            }
-          } else {
-            realValue = new StoreObject(cmd.type,0);
-          }
-          realValue.readOnly = cmd.isConst;
-          store.updateStore(cmd.id, realValue);
-          return store;
-        });
-      }
-    } catch (e) {
-      return Promise.reject(e);
-    }
-  }
-
-   evaluateExpression (store, exp) {
-
-    if (exp instanceof Expressions.UnaryApp) {
-      return this.evaluateUnaryApp(store, exp);
-    } else if (exp instanceof Expressions.InfixApp) {
-      return this.evaluateInfixApp(store, exp);
-    } else if (exp instanceof Expressions.ArrayAccess) {
-      return this.evaluateArrayAccess(store, exp);
-    } else if (exp instanceof Expressions.VariableLiteral) {
-      return this.evaluateVariableLiteral(store, exp);
-    } else if (exp instanceof Expressions.IntLiteral) {
-      return this.evaluateLiteral(store, exp);
-    } else if (exp instanceof Expressions.RealLiteral) {
-      return this.evaluateLiteral(store, exp);
-    } else if (exp instanceof Expressions.BoolLiteral) {
-      return this.evaluateLiteral(store, exp);
-    } else if (exp instanceof Expressions.StringLiteral) {
-      return this.evaluateLiteral(store, exp);
-    } else if (exp instanceof Expressions.ArrayLiteral) {
-      return this.evaluateArrayLiteral(store, exp);
-    } else if (exp instanceof Expressions.FunctionCall) {
-      return this.evaluateFunctionCall(store, exp);
-    }
-    return Promise.resolve(null);
-  }
-
-  evaluateFunctionCall (store, exp) {
-    if(exp.isMainCall) {
-      return Promise.reject(ProcessorErrorFactory.void_in_expression_full(LanguageDefinedFunction.getMainFunctionName(), exp.sourceInfo));
-    }
-    const func = this.findFunction(exp.id);
-    if(Types.VOID.isCompatible(func.returnType)) {
-      // TODO: better error message
-      return Promise.reject(ProcessorErrorFactory.void_in_expression_full(exp.id, exp.sourceInfo));
-    }
-    const $newStore = this.runFunction(func, exp.actualParameters, store);
-    return $newStore.then( sto => {
-      if(sto.mode !== Modes.RETURN) {
-        return Promise.reject(new Error("The function that was called did not had a return command: "+exp.id));
-      }
-      const val = sto.applyStore('$');
-      if (val instanceof StoreObjectArray) {
-        return Promise.resolve(Object.assign(new StoreObjectArray(null,null,null,null,null), val));
-      } else {
-        return Promise.resolve(Object.assign(new StoreObject(null,null), val));
-      }
-    });
-  }
-
-  evaluateArrayLiteral (store, exp) {
-    const errorHelperFunction = (validationResult, exp) => {
-      const errorCode = validationResult[0];
-      switch(errorCode) {
-        case StoreObjectArray.WRONG_COLUMN_NUMBER: {
-          const columnValue = validationResult[1];
-          return Promise.reject(ProcessorErrorFactory.invalid_array_literal_column_full(arr.columns, columnValue, exp.sourceInfo));
-        }
-        case StoreObjectArray.WRONG_LINE_NUMBER: {
-          const lineValue = validationResult[1];
-          return Promise.reject(ProcessorErrorFactory.invalid_array_literal_line_full(arr.lines, lineValue, exp.sourceInfo));
-        }
-        case StoreObjectArray.WRONG_TYPE: {
-          let line = null;
-          let strExp = null;
-          if (validationResult.length > 2) {
-            line = validationResult[1];
-            const column = validationResult[2];
-            strExp = exp.value[line].value[column].toString()
-          } else {
-            line = validationResult[1];
-            strExp = exp.value[line].toString()
-          }
-          return Promise.reject(ProcessorErrorFactory.invalid_array_literal_type_full(strExp, exp.sourceInfo));            }
-      }
-    };
-    if(!exp.isVector) {
-      const $matrix = this.evaluateMatrix(store, exp.value);
-      return $matrix.then(list => {
-        const type = new CompoundType(list[0].type.innerType, 2);
-        const arr = new StoreObjectArray(type, list.length, list[0].lines, list);
-        const checkResult = arr.isValid;
-        if(checkResult.length == 0)
-          return Promise.resolve(arr);
-        else {
-          return errorHelperFunction(checkResult, exp);
-        }
-      });
-    } else {
-      return this.evaluateVector(store, exp.value).then(list => {
-        const type = new CompoundType(list[0].type, 1);
-        const stoArray = new StoreObjectArray(type, list.length, null, list);
-        const checkResult = stoArray.isValid;
-        if(checkResult.length == 0)
-          return Promise.resolve(stoArray);
-        else {
-          return errorHelperFunction(checkResult, exp);
-        }
-      });
-    }
-  }
-
-  evaluateVector (store, exps) {
-    return Promise.all(exps.map( exp => this.evaluateExpression(store, exp)));
-  }
-
-  evaluateMatrix (store, exps) {
-    return Promise.all(exps.map( vector => {
-      const $vector = this.evaluateVector(store, vector.value)
-      return $vector.then(list => {
-        const type = new CompoundType(list[0].type, 1);
-        return new StoreObjectArray(type, list.length, null, list)
-      });
-    } ));
-  }
-
-  evaluateLiteral (_, exp) {
-    return Promise.resolve(new StoreObject(exp.type, exp.value));
-  }
-
-  evaluateVariableLiteral (store, exp) {
-    try {
-      const val = store.applyStore(exp.id);
-      if (val instanceof StoreObjectArray) {
-        return Promise.resolve(Object.assign(new StoreObjectArray(null,null,null,null), val));
-      } else {
-        return Promise.resolve(Object.assign(new StoreObject(null,null), val));
-      }
-    } catch (error) {
-      return Promise.reject(error);
-    }
-  }
-
-  evaluateArrayAccess (store, exp) {
-    const mustBeArray = store.applyStore(exp.id);
-    if (!(mustBeArray.type instanceof CompoundType)) {
-      return Promise.reject(ProcessorErrorFactory.invalid_array_access_full(exp.id, exp.sourceInfo));
-    }
-    const $line = this.evaluateExpression(store, exp.line);
-    const $column = this.evaluateExpression(store, exp.column);
-    return Promise.all([$line, $column]).then(values => {
-      const lineSO = values[0];
-      const columnSO = values[1];
-      if(!Types.INTEGER.isCompatible(lineSO.type)) {
-        return Promise.reject(ProcessorErrorFactory.array_dimension_not_int_full(exp.sourceInfo));
-      }
-      const line = lineSO.number;
-      let column = null;
-      if(columnSO !== null) {
-        if(!Types.INTEGER.isCompatible(columnSO.type)) {
-          return Promise.reject(ProcessorErrorFactory.array_dimension_not_int_full(exp.sourceInfo));
-        }
-        column = columnSO.number;
-      }
-
-      if (line >= mustBeArray.lines) {
-        if(mustBeArray.isVector) {
-          return Promise.reject(ProcessorErrorFactory.vector_line_outbounds_full(exp.id, line, mustBeArray.lines, exp.sourceInfo));
-        } else {
-          return Promise.reject(ProcessorErrorFactory.matrix_line_outbounds_full(exp.id, line, mustBeArray.lines, exp.sourceInfo));
-        }
-      } else if (line < 0) {
-        throw ProcessorErrorFactory.array_dimension_not_positive_full(exp.sourceInfo);
-      }
-      if (column !== null && mustBeArray.columns === null ){
-        return Promise.reject(ProcessorErrorFactory.vector_not_matrix_full(exp.id, exp.sourceInfo));
-      }
-      if(column !== null ) {
-        if (column >= mustBeArray.columns) {
-          return Promise.reject(ProcessorErrorFactory.matrix_column_outbounds_full(exp.id, column,mustBeArray.columns, exp.sourceInfo));
-        } else if (column < 0) {
-          throw ProcessorErrorFactory.array_dimension_not_positive_full(exp.sourceInfo);
-        }
-        
-      }
-      return Promise.resolve(new StoreObjectArrayAddress(mustBeArray.id, line, column, store));
-    });
-  }
-
-  evaluateUnaryApp (store, unaryApp) {
-    const $left = this.evaluateExpression(store, unaryApp.left);
-    return $left.then( left => {
-      const resultType = resultTypeAfterUnaryOp(unaryApp.op, left.type);
-      if (Types.UNDEFINED.isCompatible(resultType)) {
-        const stringInfo = left.type.stringInfo();
-        const info = stringInfo[0];
-        return Promise.reject(ProcessorErrorFactory.invalid_unary_op_full(unaryApp.op, info.type, info.dim, unaryApp.sourceInfo));
-      }
-      switch (unaryApp.op.ord) {
-        case Operators.ADD.ord:
-          return new StoreObject(resultType, left.value);
-        case Operators.SUB.ord:
-          return new StoreObject(resultType, left.value.negated());
-        case Operators.NOT.ord:
-          return new StoreObject(resultType, !left.value);
-        default:
-          return Promise.reject(new RuntimeError('!!!Critical Invalid UnaryApp '+ unaryApp.op));
-      }
-    });
-  }
-
-  evaluateInfixApp (store, infixApp) {
-    const $left = this.evaluateExpression(store, infixApp.left);
-    const $right = this.evaluateExpression(store, infixApp.right);
-    return Promise.all([$left, $right]).then(values => {
-      const left = values[0];
-      const right = values[1];
-      const resultType = resultTypeAfterInfixOp(infixApp.op, left.type, right.type);
-      if (Types.UNDEFINED.isCompatible(resultType)) {
-        const stringInfoLeft = left.type.stringInfo();
-        const infoLeft = stringInfoLeft[0];
-        const stringInfoRight = right.type.stringInfo();
-        const infoRight = stringInfoRight[0];
-        return Promise.reject(ProcessorErrorFactory.invalid_infix_op_full(infixApp.op, infoLeft.type, infoLeft.dim,
-          infoRight.type,infoRight.dim,infixApp.sourceInfo));
-      }
-      let result = null;
-      switch (infixApp.op.ord) {
-        case Operators.ADD.ord: {
-          if(Types.STRING.isCompatible(left.type)) {
-            const rightStr = convertToString(right.value, right.type);
-            return new StoreObject(resultType, left.value + rightStr);
-          } else if (Types.STRING.isCompatible(right.type)) {
-            const leftStr = convertToString(left.value, left.type);
-            return new StoreObject(resultType, leftStr + right.value);
-          } else {
-            return new StoreObject(resultType, left.value.plus(right.value));
-          }
-        }
-        case Operators.SUB.ord:
-          return new StoreObject(resultType, left.value.minus(right.value));
-        case Operators.MULT.ord: {
-          result = left.value.times(right.value);
-          if(result.dp() > Config.decimalPlaces) {
-            result = new Decimal(result.toFixed(Config.decimalPlaces));
-          }
-          return new StoreObject(resultType, result);
-        }
-        case Operators.DIV.ord: {
-          if (Types.INTEGER.isCompatible(resultType))
-            result = left.value.divToInt(right.value);
-          else
-            result = left.value.div(right.value);
-          if(result.dp() > Config.decimalPlaces) {
-            result = new Decimal(result.toFixed(Config.decimalPlaces));
-          }
-          return new StoreObject(resultType, result);
-        }
-        case Operators.MOD.ord: {
-          result = left.value.modulo(right.value);
-          if(result.dp() > Config.decimalPlaces) {
-            result = new Decimal(result.toFixed(Config.decimalPlaces));
-          }
-          return new StoreObject(resultType, result);
-        }          
-        case Operators.GT.ord: {
-          if (Types.STRING.isCompatible(left.type)) {
-            result = left.value.length > right.value.length;
-          } else {
-            result = left.value.gt(right.value);
-          }
-          return new StoreObject(resultType, result);
-        }
-        case Operators.GE.ord: {
-          if (Types.STRING.isCompatible(left.type)) {
-            result = left.value.length >= right.value.length;
-          } else {
-            result = left.value.gte(right.value);
-          }
-          return new StoreObject(resultType, result);
-        }
-        case Operators.LT.ord: {
-          if (Types.STRING.isCompatible(left.type)) {
-            result = left.value.length < right.value.length;
-          } else {
-            result = left.value.lt(right.value);
-          }
-          return new StoreObject(resultType, result);
-        }
-        case Operators.LE.ord: {
-          if (Types.STRING.isCompatible(left.type)) {
-            result = left.value.length <= right.value.length;
-          } else {
-            result = left.value.lte(right.value);
-          }
-          return new StoreObject(resultType, result);
-        }
-        case Operators.EQ.ord: {
-          if (Types.INTEGER.isCompatible(left.type) || Types.REAL.isCompatible(left.type)) {
-            result = left.value.eq(right.value);
-          } else {
-            result = left.value === right.value;
-          }
-          return new StoreObject(resultType, result);
-        }
-        case Operators.NEQ.ord: {
-          if (Types.INTEGER.isCompatible(left.type) || Types.REAL.isCompatible(left.type)) {
-            result = !left.value.eq(right.value);
-          } else {
-            result = left.value !== right.value;
-          }
-          return new StoreObject(resultType, result);
-        }
-        case Operators.AND.ord:
-          return new StoreObject(resultType, left.value && right.value);
-        case Operators.OR.ord:
-          return new StoreObject(resultType, left.value || right.value);
-        default:
-          return Promise.reject(new RuntimeError('!!!Critical Invalid InfixApp '+ infixApp.op));
-      }
-    });
-  }
-
-  parseStoreObjectValue (vl) {
-    let realValue = vl;
-    if(vl instanceof StoreObjectArrayAddress) {      
-      if(vl.type instanceof CompoundType) {
-        switch(vl.type.dimensions) {
-          case 1: {
-            realValue = new StoreObjectArray(vl.type, vl.value);
-            break;
-          }
-          default: {
-            throw new RuntimeError("Three dimensional array address...");
-          }
-        }
-      } else {
-        realValue = new StoreObject(vl.type, vl.value);
-      }
-    }
-    return realValue;
-  }
-
-}

+ 0 - 58
ivprogh/js/processor/lib/arrays.js

@@ -1,58 +0,0 @@
-import { StoreObject } from '../store/storeObject';
-import * as Commands from './../../ast/commands';
-import { Types } from './../../typeSystem/types';
-import { toInt } from "./../../typeSystem/parsers";
-import { CompoundType } from '../../typeSystem/compoundType';
-import { Modes } from '../modes';
-
-/**
- * num_elements
- * matrix_lines
- * matrix_columns
- */
-
-export function createNumElementsFun () {
-  const numElementsFun = (sto, _) => {
-    const vector  = sto.applyStore("vector");
-    const temp = new StoreObject(Types.INTEGER, toInt(vector.lines));
-    sto.mode = Modes.RETURN;
-    return Promise.resolve(sto.updateStore("$", temp));
-  }
-
-  const block = new Commands.CommandBlock([],  [new Commands.SysCall(numElementsFun)]);
-  const func = new Commands.Function('$numElements', Types.INTEGER,
-    [new Commands.FormalParameter(new CompoundType(Types.ALL, 1), 'vector', false)],
-    block);
-  return func;
- }
-
-export function createMatrixLinesFun () {
-  const matrixLinesFun = (sto, _) => {
-    const matrix  = sto.applyStore("matrix");
-    const temp = new StoreObject(Types.INTEGER, toInt(matrix.lines));
-    sto.mode = Modes.RETURN;
-    return Promise.resolve(sto.updateStore("$", temp));
-  }
-
-  const block = new Commands.CommandBlock([],  [new Commands.SysCall(matrixLinesFun)]);
-  const func = new Commands.Function('$matrixLines', Types.INTEGER,
-    [new Commands.FormalParameter(new CompoundType(Types.ALL, 2), 'matrix', false)],
-    block);
-  return func;
- }
-
-export function createMatrixColumnsFun () {
-  const matrixColumnsFun = (sto, _) => {
-    const matrix  = sto.applyStore("matrix");
-    const temp = new StoreObject(Types.INTEGER, toInt(matrix.columns));
-    sto.mode = Modes.RETURN;
-    return Promise.resolve(sto.updateStore("$", temp));
-  }
-
-  const block = new Commands.CommandBlock([],  [new Commands.SysCall(matrixColumnsFun)]);
-  const func = new Commands.Function('$matrixColumns', Types.INTEGER,
-    [new Commands.FormalParameter(new CompoundType(Types.ALL, 2), 'matrix', false)],
-    block);
-  return func;
- }
- 

+ 0 - 57
ivprogh/js/processor/lib/io.js

@@ -1,57 +0,0 @@
-import { StoreObject } from './../store/storeObject';
-import * as Commands from './../../ast/commands';
-import {toInt, toString, toBool, toReal} from './../../typeSystem/parsers';
-import { Types } from './../../typeSystem/types';
-
-export function createOutputFun () {
-  const writeFunction = function (store, _) {
-    const val = store.applyStore('p1');
-    if(val.type.isCompatible(Types.INTEGER)) {
-      this.output.sendOutput(val.value.toString());
-    } else if (val.type.isCompatible(Types.REAL)) {
-      if (val.value.dp() <= 0) {
-        this.output.sendOutput(val.value.toFixed(1));  
-      } else {
-        this.output.sendOutput(val.value.toString());
-      }
-    } else {
-      this.output.sendOutput(val.value);
-    }
-    return Promise.resolve(store);
-  }
-  const block = new Commands.CommandBlock([], [new Commands.SysCall(writeFunction)]);
-  const func = new Commands.Function('$write', Types.VOID,
-    [new Commands.FormalParameter(Types.ALL, 'p1', false)],
-    block);
-  return func;
-}
-
-export function createInputFun () {
-  const readFunction = function (store, _) {
-    const request = new Promise((resolve, _) => {
-      this.input.requestInput(resolve);
-    });
-    return request.then(text => {
-      const typeToConvert = store.applyStore('p1').type;
-      let stoObj = null;
-      if (typeToConvert.isCompatible(Types.INTEGER)) {
-        const val = toInt(text);
-        stoObj = new StoreObject(Types.INTEGER, val);
-      } else if (typeToConvert.isCompatible(Types.REAL)) {
-        stoObj = new StoreObject(Types.REAL, toReal(text));
-      } else if (typeToConvert.isCompatible(Types.BOOLEAN)) {
-        stoObj = new StoreObject(Types.BOOLEAN, toBool(text));
-      } else if (typeToConvert.isCompatible(Types.STRING)) {
-        stoObj = new StoreObject(Types.STRING, toString(text));
-      }
-      this.loopTimers.splice(0,this.loopTimers.length)
-      store.updateStore('p1', stoObj);
-      return Promise.resolve(store);
-    });
-  }
-  const block = new Commands.CommandBlock([],  [new Commands.SysCall(readFunction)]);
-  const func = new Commands.Function('$read', Types.VOID,
-    [new Commands.FormalParameter(Types.ALL, 'p1', true)],
-    block);
-  return func;
-}

+ 0 - 188
ivprogh/js/processor/lib/lang.js

@@ -1,188 +0,0 @@
-import { StoreObject } from '../store/storeObject';
-import * as Commands from './../../ast/commands';
-import { Types } from './../../typeSystem/types';
-import { toReal, convertToString } from "./../../typeSystem/parsers";
-import { IVProgParser } from '../../ast/ivprogParser';
-import { RealLiteral, IntLiteral, BoolLiteral } from '../../ast/expressions';
-import { Modes } from '../modes';
-
-/**
- * 
- * is_real
- * is_int
- * is_bool
- * cast_real
- * cast_int
- * cast_bool
- * cast_string
- */
-
-export function createIsRealFun () {
-  const isRealFun = (sto, _) => {
-    const str = sto.applyStore("str");
-    const parser = IVProgParser.createParser(str.value);
-    let result = false;
-    try {
-      const val = parser.parseTerm();
-      if (val instanceof RealLiteral) {
-        result = true;
-      }
-    } catch (error) { }
-    const temp = new StoreObject(Types.BOOLEAN, result);
-    sto.mode = Modes.RETURN;
-    return Promise.resolve(sto.updateStore("$", temp));
-  }
-
-  const block = new Commands.CommandBlock([],  [new Commands.SysCall(isRealFun)]);
-  const func = new Commands.Function('$isReal', Types.BOOLEAN,
-    [new Commands.FormalParameter(Types.STRING, 'str', false)],
-    block);
-  return func;
-}
-
-export function createIsIntFun () {
-  const isIntFun = (sto, _) => {
-    const str = sto.applyStore("str");
-    const parser = IVProgParser.createParser(str.value);
-    let result = false;
-    try {
-      const val = parser.parseTerm();
-      if (val instanceof IntLiteral) {
-        result = true;
-      }
-    } catch (error) { }
-    const temp = new StoreObject(Types.BOOLEAN, result);
-    sto.mode = Modes.RETURN;
-    return Promise.resolve(sto.updateStore("$", temp));
-  }
-
-  const block = new Commands.CommandBlock([],  [new Commands.SysCall(isIntFun)]);
-  const func = new Commands.Function('$isInt', Types.BOOLEAN,
-    [new Commands.FormalParameter(Types.STRING, 'str', false)],
-    block);
-  return func;
-}
-
-export function createIsBoolFun () {
-  const isBoolFun = (sto, _) => {
-    const str = sto.applyStore("str");
-    const parser = IVProgParser.createParser(str.value);
-    let result = false;
-    try {
-      const val = parser.parseTerm();
-      if (val instanceof BoolLiteral) {
-        result = true;
-      }
-    } catch (error) { }
-    const temp = new StoreObject(Types.BOOLEAN, result);
-    sto.mode = Modes.RETURN;
-    return Promise.resolve(sto.updateStore("$", temp));
-  }
-
-  const block = new Commands.CommandBlock([],  [new Commands.SysCall(isBoolFun)]);
-  const func = new Commands.Function('$isBool', Types.BOOLEAN,
-    [new Commands.FormalParameter(Types.STRING, 'str', false)],
-    block);
-  return func;
-}
-
-export function createCastRealFun () {
-  const castRealFun = (sto, _) => {
-    const val = sto.applyStore("val");
-    switch (val.type.ord) {
-      case Types.INTEGER.ord: {
-        const temp = new StoreObject(Types.REAL, toReal(val.number));
-        sto.mode = Modes.RETURN;
-        return Promise.resolve(sto.updateStore("$", temp));
-      }
-      case Types.STRING.ord: {
-        const parser = IVProgParser.createParser(val.value);
-        try {
-          const result = parser.parseTerm();
-          if (result instanceof RealLiteral) {
-            const temp = new StoreObject(Types.REAL, result.value);
-            sto.mode = Modes.RETURN;
-            return Promise.resolve(sto.updateStore("$", temp));
-          }
-        } catch (error) { 
-          return Promise.reject("cannot convert string to real");
-        }
-      }
-    }
-  }
-
-  const block = new Commands.CommandBlock([],  [new Commands.SysCall(castRealFun)]);
-  const func = new Commands.Function('$castReal', Types.REAL,
-    [new Commands.FormalParameter(Types.ALL, 'val', false)],
-    block);
-  return func;
-}
-
-export function createCastIntFun () {
-  const castIntFun = (sto, _) => {
-    const val = sto.applyStore("val");
-    switch (val.type.ord) {
-      case Types.REAL.ord: {
-        const temp = new StoreObject(Types.INTEGER, Math.floor(val.number));
-        sto.mode = Modes.RETURN;
-        return Promise.resolve(sto.updateStore("$", temp));
-      }
-      case Types.STRING.ord: {
-        const parser = IVProgParser.createParser(val.value);
-        try {
-          const result = parser.parseTerm();
-          if (result instanceof IntLiteral) {
-            const temp = new StoreObject(Types.INTEGER, result.value);
-            sto.mode = Modes.RETURN;
-            return Promise.resolve(sto.updateStore("$", temp));
-          }
-        } catch (error) { 
-          return Promise.reject("cannot convert string to real");
-        }
-      }
-    }
-  }
-
-  const block = new Commands.CommandBlock([],  [new Commands.SysCall(castIntFun)]);
-  const func = new Commands.Function('$castInt', Types.INTEGER,
-    [new Commands.FormalParameter(Types.ALL, 'val', false)],
-    block);
-  return func;
-}
-
-export function createCastBoolFun () {
-  const castBoolFun = (sto, _) => {
-    const str = sto.applyStore("str");
-    const parser = IVProgParser.createParser(str.value);
-    try {
-      const val = parser.parseTerm();
-      if (val instanceof BoolLiteral) {
-        const temp = new StoreObject(Types.BOOLEAN, val.value);
-        sto.mode = Modes.RETURN;
-        return Promise.resolve(sto.updateStore("$", temp));
-      }
-    } catch (error) { }
-    return Promise.reject("cannot convert " + str.value + " to boolean");
-  }
-
-  const block = new Commands.CommandBlock([],  [new Commands.SysCall(castBoolFun)]);
-  const func = new Commands.Function('$castBool', Types.BOOLEAN,
-    [new Commands.FormalParameter(Types.STRING, 'str', false)],
-    block);
-  return func;
-}
-
-export function createCastStringFun () {
-  const castStringFun = function (store, _) {
-    const val = store.applyStore('str');
-    let result = convertToString(val)
-    const temp = new StoreObject(Types.STRING, result);
-    sto.mode = Modes.RETURN;
-    return Promise.resolve(sto.updateStore("$", temp));
-  }
-  const block = new Commands.CommandBlock([], [new Commands.SysCall(castStringFun)]);
-  const func = new Commands.Function('$castString', Types.STRING,
-    [new Commands.FormalParameter(Types.ALL, 'str', false)],
-    block);
-  return func;
-}

+ 0 - 254
ivprogh/js/processor/lib/math.js

@@ -1,254 +0,0 @@
-import { StoreObject } from '../store/storeObject';
-import * as Commands from './../../ast/commands';
-import { Types } from './../../typeSystem/types';
-import { toReal } from "./../../typeSystem/parsers";
-import { Decimal } from 'decimal.js';
-import { MultiType } from '../../typeSystem/multiType';
-import { CompoundType } from '../../typeSystem/compoundType';
-import { Modes } from '../modes';
-import { Config } from '../../util/config';
-
-/**
- * sin
- * cos
- * tan
- * sqrt
- * pow
- * log
- * abs
- * negate
- * invert
- * max
- * min
- */
-
-function convertToRadians (degrees) {
-  return degrees.times(Decimal.acos(-1)).div(180);
-}
-
-export function createSinFun () {
-   const sinFun = (sto, _) => {
-     const x = sto.applyStore('x');
-     const angle = x.value.mod(360);
-     let result = null;
-     if(angle.eq(90)) {
-       result = new Decimal(1);
-     } else if (angle.eq(180)) {
-      result = new Decimal(0);
-     } else if (angle.eq(270)) {
-       result = new Decimal(-1);
-     } else {
-       result = Decimal.sin(convertToRadians(angle));
-     }
-     if(result.dp() > Config.decimalPlaces) {
-      result = new Decimal(result.toFixed(Config.decimalPlaces));
-    }
-     const temp = new StoreObject(Types.REAL, result);
-     sto.mode = Modes.RETURN;
-     return Promise.resolve(sto.updateStore('$', temp));
-   };
-
-  const block = new Commands.CommandBlock([],  [new Commands.SysCall(sinFun)]);
-  const func = new Commands.Function('$sin', Types.REAL,
-    [new Commands.FormalParameter(new MultiType([Types.INTEGER, Types.REAL]), 'x', false)],
-    block);
-  return func;
-}
-
-export function createCosFun () {
-  const cosFun = (sto, _) => {
-    const x = sto.applyStore('x');
-    const angle = x.value.mod(360);
-    let result = null;
-    if(angle.eq(90)) {
-      result = new Decimal(0);
-    } else if (angle.eq(180)) {
-      result = new Decimal(-1);
-    } else if (angle.eq(270)) {
-      result = new Decimal(0)
-    }
-    result = Decimal.cos(convertToRadians(angle));
-    if(result.dp() > Config.decimalPlaces) {
-      result = new Decimal(result.toFixed(Config.decimalPlaces));
-    }
-    const temp = new StoreObject(Types.REAL, result);
-    sto.mode = Modes.RETURN;
-    return Promise.resolve(sto.updateStore('$', temp));
-  };
-
- const block = new Commands.CommandBlock([],  [new Commands.SysCall(cosFun)]);
- const func = new Commands.Function('$cos', Types.REAL,
-   [new Commands.FormalParameter(new MultiType([Types.INTEGER, Types.REAL]), 'x', false)],
-   block);
- return func;
-}
-
-export function createTanFun () {
-  const tanFun = (sto, _) => {
-    const x = sto.applyStore('x');
-    const angle = x.value.mod(360);
-    if(angle.eq(90) || angle.eq(270)) {
-      return Promise.reject("Tangent of "+x.value.toNumber()+"° is undefined.");
-    }
-    let result = Decimal.tan(convertToRadians(angle));
-    if(result.dp() > Config.decimalPlaces) {
-      result = new Decimal(result.toFixed(Config.decimalPlaces));
-    }
-    const temp = new StoreObject(Types.REAL, result);
-    sto.mode = Modes.RETURN;
-    return Promise.resolve(sto.updateStore('$', temp));
-  };
-
- const block = new Commands.CommandBlock([],  [new Commands.SysCall(tanFun)]);
- const func = new Commands.Function('$tan', Types.REAL,
-   [new Commands.FormalParameter(new MultiType([Types.INTEGER, Types.REAL]), 'x', false)],
-   block);
- return func;
-}
-
-export function createSqrtFun () {
-  const sqrtFun = (sto, _) => {
-    const x = sto.applyStore('x');
-    let result = x.value.sqrt();
-    if(result.dp() > Config.decimalPlaces) {
-      result = new Decimal(result.toFixed(Config.decimalPlaces));
-    }
-    const temp = new StoreObject(Types.REAL, result);
-    sto.mode = Modes.RETURN;
-    return Promise.resolve(sto.updateStore('$', temp));
-  };
-
- const block = new Commands.CommandBlock([],  [new Commands.SysCall(sqrtFun)]);
- const func = new Commands.Function('$sqrt', Types.REAL,
-   [new Commands.FormalParameter(new MultiType([Types.INTEGER, Types.REAL]), 'x', false)],
-   block);
- return func;
-}
-
-export function createPowFun () {
-  const powFun = (sto, _) => {
-    const x = sto.applyStore('x');
-    const y = sto.applyStore('y');
-    let result = x.value.pow(y.value);
-    if(result.dp() > Config.decimalPlaces) {
-      result = new Decimal(result.toFixed(Config.decimalPlaces));
-    }
-    const temp = new StoreObject(Types.REAL, result);
-    sto.mode = Modes.RETURN;
-    return Promise.resolve(sto.updateStore('$', temp));
-  };
-
- const block = new Commands.CommandBlock([],  [new Commands.SysCall(powFun)]);
- const func = new Commands.Function('$pow', Types.REAL,
-   [new Commands.FormalParameter(new MultiType([Types.INTEGER, Types.REAL]), 'x', false),
-    new Commands.FormalParameter(new MultiType([Types.INTEGER, Types.REAL]), 'y', false)],
-   block);
- return func;
-}
-
-export function createLogFun () {
-  const logFun = (sto, _) => {
-    const x = sto.applyStore('x');
-    if (x.value.isNegative()) {
-      return Promise.reject("the value passed to log function cannot be negative");
-    }
-    let result = Decimal.log10(x.value);
-    if(result.dp() > Config.decimalPlaces) {
-      result = new Decimal(result.toFixed(Config.decimalPlaces));
-    }
-    const temp = new StoreObject(Types.REAL, result);
-    sto.mode = Modes.RETURN;
-    return Promise.resolve(sto.updateStore('$', temp));
-  };
-
- const block = new Commands.CommandBlock([],  [new Commands.SysCall(logFun)]);
- const func = new Commands.Function('$log', Types.REAL,
-   [new Commands.FormalParameter(new MultiType([Types.INTEGER, Types.REAL]), 'x', false)],
-   block);
- return func;
-}
-
-export function createAbsFun () {
-  const absFun = (sto, _) => {
-    const x = sto.applyStore('x');
-    const result = x.value.abs();
-    const temp = new StoreObject(x.type, result);
-    sto.mode = Modes.RETURN;
-    return Promise.resolve(sto.updateStore('$', temp));
-  };
-
- const block = new Commands.CommandBlock([],  [new Commands.SysCall(absFun)]);
- const func = new Commands.Function('$abs', new MultiType([Types.INTEGER, Types.REAL]),
-   [new Commands.FormalParameter(new MultiType([Types.INTEGER, Types.REAL]), 'x', false)],
-   block);
- return func;
-}
-
-export function createNegateFun () {
-  const negateFun = (sto, _) => {
-    const x = sto.applyStore('x');
-    const result = x.value.negated();
-    const temp = new StoreObject(x.type, result);
-    sto.mode = Modes.RETURN;
-    return Promise.resolve(sto.updateStore('$', temp));
-  };
-
- const block = new Commands.CommandBlock([],  [new Commands.SysCall(negateFun)]);
- const func = new Commands.Function('$negate', new MultiType([Types.INTEGER, Types.REAL]),
-   [new Commands.FormalParameter(new MultiType([Types.INTEGER, Types.REAL]), 'x', false)],
-   block);
- return func;
-}
-
-export function createInvertFun () {
-  const invertFun = (sto, _) => {
-    const x = sto.applyStore('x');
-    let result = toReal(1).dividedBy(x.value);
-    if(result.dp() > Config.decimalPlaces) {
-      result = new Decimal(result.toFixed(Config.decimalPlaces));
-    }
-    const temp = new StoreObject(Types.REAL, result);
-    sto.mode = Modes.RETURN;
-    return Promise.resolve(sto.updateStore('$', temp));
-  };
-
- const block = new Commands.CommandBlock([],  [new Commands.SysCall(invertFun)]);
- const func = new Commands.Function('$invert', Types.REAL,
-   [new Commands.FormalParameter(new MultiType([Types.INTEGER, Types.REAL]), 'x', false)],
-   block);
- return func;
-}
-
-export function createMaxFun () {
-  const maxFun = (sto, _) => {
-    const x = sto.applyStore('x');
-    const numbers = x.value.map(stoObj => stoObj.value);
-    const result = Decimal.max(...numbers);
-    const temp = new StoreObject(x.type.innerType, result);
-    sto.mode = Modes.RETURN;
-    return Promise.resolve(sto.updateStore('$', temp));
-  };
- const paramType = new CompoundType(new MultiType([Types.INTEGER, Types.REAL]), 1);
- const block = new Commands.CommandBlock([],  [new Commands.SysCall(maxFun)]);
- const func = new Commands.Function('$max', new MultiType([Types.INTEGER, Types.REAL]),
-   [new Commands.FormalParameter(paramType, 'x', false)],
-   block);
- return func;
-}
-
-export function createMinFun () {
-  const minFun = (sto, _) => {
-    const x = sto.applyStore('x');
-    const numbers = x.value.map(stoObj => stoObj.value);
-    const result = Decimal.min(...numbers);
-    const temp = new StoreObject(x.type.innerType, result);
-    sto.mode = Modes.RETURN;
-    return Promise.resolve(sto.updateStore('$', temp));
-  };
- const paramType = new CompoundType(new MultiType([Types.INTEGER, Types.REAL]), 1);
- const block = new Commands.CommandBlock([],  [new Commands.SysCall(minFun)]);
- const func = new Commands.Function('$min', new MultiType([Types.INTEGER, Types.REAL]),
-   [new Commands.FormalParameter(paramType, 'x', false)],
-   block);
- return func;
-}

+ 0 - 94
ivprogh/js/processor/lib/strings.js

@@ -1,94 +0,0 @@
-import { StoreObject } from '../store/storeObject';
-import * as Commands from './../../ast/commands';
-import { Types } from './../../typeSystem/types';
-import { toInt } from "./../../typeSystem/parsers";
-import { Modes } from '../modes';
-
-/*
-*  substring
-*  length
-*  uppercase
-*  lowercase
-*  charAt
-**/
-
-export function createSubstringFun () {
-  const substringFun = (sto, _) => {
-    const str = sto.applyStore("str");
-    const start = sto.applyStore("start");
-    const end = sto.applyStore("end");
-    const result = str.value.substring(start.value, end.value);
-    const temp = new StoreObject(Types.STRING, result);
-    sto.mode = Modes.RETURN;
-    return Promise.resolve(sto.updateStore("$", temp));
-  };
-
-  const block = new Commands.CommandBlock([],  [new Commands.SysCall(substringFun)]);
-  const func = new Commands.Function('$substring', Types.STRING,
-    [new Commands.FormalParameter(Types.STRING, 'str', false),
-    new Commands.FormalParameter(Types.INTEGER, 'start', false),
-    new Commands.FormalParameter(Types.INTEGER, 'end', false)],
-    block);
-  return func;
-}
-
-export function createLengthFun () {
-  const lengthFun = (sto, _) => {
-    const str = sto.applyStore("str");
-    const temp = new StoreObject(Types.INTEGER, toInt(str.value.length));
-    sto.mode = Modes.RETURN;
-    return Promise.resolve(sto.updateStore("$", temp));
-  }
-  const block = new Commands.CommandBlock([],  [new Commands.SysCall(lengthFun)]);
-  const func = new Commands.Function('$length', Types.INTEGER,
-    [new Commands.FormalParameter(Types.STRING, 'str', false)],
-    block);
-  return func;
-}
-
-export function createUppercaseFun () {
-  const uppercaseFun = (sto, _) => {
-    const str = sto.applyStore("str");
-    const temp = new StoreObject(Types.STRING, str.value.toUpperCase());
-    sto.mode = Modes.RETURN;
-    return Promise.resolve(sto.updateStore("$", temp));
-  }
-  const block = new Commands.CommandBlock([],  [new Commands.SysCall(uppercaseFun)]);
-  const func = new Commands.Function('$uppercase', Types.STRING,
-    [new Commands.FormalParameter(Types.STRING, 'str', false)],
-    block);
-  return func;
-}
-
-export function createLowercaseFun () {
-  const lowercaseFun = (sto, _) => {
-    const str = sto.applyStore("str");
-    const temp = new StoreObject(Types.STRING, str.value.toLowerCase());
-    sto.mode = Modes.RETURN;
-    return Promise.resolve(sto.updateStore("$", temp));
-  }
-  const block = new Commands.CommandBlock([],  [new Commands.SysCall(lowercaseFun)]);
-  const func = new Commands.Function('$lowercase', Types.STRING,
-    [new Commands.FormalParameter(Types.STRING, 'str', false)],
-    block);
-  return func;
-}
-
-export function createrCharAtFun () {
-  const charAtFun = (sto, _) => {
-    const str = sto.applyStore("str");
-    const idx = sto.applyStore("index");
-    if (idx.value.toNumber() < 0 || idx.value.toNumber() >= str.value.length) {
-      return Promise.reject(new Error("invalid string position"));
-    }
-    const temp = new StoreObject(Types.STRING, str.value.charAt(idx.value.toNumber()));
-    sto.mode = Modes.RETURN;
-    return Promise.resolve(sto.updateStore("$", temp));
-  }
-  const block = new Commands.CommandBlock([],  [new Commands.SysCall(charAtFun)]);
-  const func = new Commands.Function('$charAt', Types.STRING,
-    [new Commands.FormalParameter(Types.STRING, 'str', false),
-    new Commands.FormalParameter(Types.INTEGER, 'index', false)],
-    block);
-  return func;
-}

+ 0 - 6
ivprogh/js/processor/modes.js

@@ -1,6 +0,0 @@
-export const Modes = Object.freeze({
-  RETURN: Symbol('mode:return'),
-  BREAK: Symbol('mode:break'),
-  PAUSE: Symbol('mode:pause'),
-  RUN: Symbol('mode:run')
-});

+ 0 - 517
ivprogh/js/processor/semantic/semanticAnalyser.js

@@ -1,517 +0,0 @@
-import { ProcessorErrorFactory } from './../error/processorErrorFactory';
-import { LanguageDefinedFunction } from './../definedFunctions';
-import { LanguageService } from './../../services/languageService';
-import { ArrayDeclaration, While, For, Switch, Assign, Break, IfThenElse, Return, ArrayIndexAssign } from '../../ast/commands';
-import { InfixApp, UnaryApp, FunctionCall, IntLiteral, RealLiteral, StringLiteral, BoolLiteral, VariableLiteral, ArrayLiteral, ArrayAccess } from '../../ast/expressions';
-import { Literal } from '../../ast/expressions/literal';
-import { resultTypeAfterInfixOp, resultTypeAfterUnaryOp } from '../compatibilityTable';
-import { Types } from '../../typeSystem/types';
-import { CompoundType } from '../../typeSystem/compoundType';
-import { MultiType } from '../../typeSystem/multiType';
-
-export class SemanticAnalyser {
-
-  constructor(ast) {
-    this.ast = ast;
-    this.lexerClass = LanguageService.getCurrentLexer();
-    const lexer = new this.lexerClass(null);
-    this.literalNames = lexer.literalNames;
-    this.symbolMap = null;
-    this.currentFunction = null;
-  }
-
-  pushMap () {
-    if(this.symbolMap === null) {
-      this.symbolMap = {map:{}, next: null};
-    } else {
-      const n = {map:{}, next: this.symbolMap};
-      this.symbolMap = n;
-    }
-  }
-
-  popMap () {
-    if(this.symbolMap !== null) {
-      this.symbolMap = this.symbolMap.next;
-    }
-  }
-
-  insertSymbol (id, typeInfo) {
-    this.symbolMap.map[id] = typeInfo;
-  }
-
-  findSymbol (id, symMap) {
-    if(!symMap.map[id]) {
-      if(symMap.next) {
-        return this.findSymbol(id, symMap.next);
-      }
-      return null;
-    } else {
-      return symMap.map[id];
-    }
-  }
-
-  getMainFunction () {
-    return this.ast.functions.find(v => v.isMain);
-  }
-
-  findFunction (name) {
-    if(name.match(/^\$.+$/)) {
-      const fun = LanguageDefinedFunction.getFunction(name);
-      if(!!!fun) {
-        throw ProcessorErrorFactory.not_implemented(name);
-      }
-      return fun;
-    } else {
-      const val = this.ast.functions.find( v => v.name === name);
-      if (!!!val) {
-        return null;
-      }
-      return val;
-    }
-  }
-
-  analyseTree () {
-    const globalVars = this.ast.global;
-    this.pushMap();
-    this.assertDeclarations(globalVars);
-    const functions = this.ast.functions;
-    const mainFunc = functions.filter((f) => f.name === null);
-    if (mainFunc.length <= 0) {
-      throw ProcessorErrorFactory.main_missing();
-    }
-    for (let i = 0; i < functions.length; i++) {
-      const fun = functions[i];
-      this.assertFunction(fun);
-    }
-    return this.ast;
-  }
-
-  assertDeclarations (list) {
-    for (let i = 0; i < list.length; i++) {
-      this.assertDeclaration(list[i]);
-    }
-  }
-
-  assertDeclaration (declaration) {
-    if (declaration instanceof ArrayDeclaration) {
-      if(declaration.initial === null) {
-        const lineType = this.evaluateExpressionType(declaration.lines);
-        if (!lineType.isCompatible(Types.INTEGER)) {
-          throw ProcessorErrorFactory.array_dimension_not_int_full(declaration.sourceInfo);
-        }
-        if (declaration.columns !== null) {
-          const columnType = this.evaluateExpressionType(declaration.columns);
-          if (!columnType.isCompatible(Types.INTEGER)) {
-            throw ProcessorErrorFactory.array_dimension_not_int_full(declaration.sourceInfo);
-          }
-        }
-        this.insertSymbol(declaration.id, {id: declaration.id, lines: declaration.lines, columns: declaration.columns, type: declaration.type});
-        return;
-      }
-      this.evaluateArrayLiteral(declaration.id, declaration.lines, declaration.columns, declaration.type, declaration.initial);
-      this.insertSymbol(declaration.id, {id: declaration.id, lines: declaration.lines, columns: declaration.columns, type: declaration.type});
-
-    } else {
-      if(declaration.initial === null) {
-        this.insertSymbol(declaration.id, {id: declaration.id, type: declaration.type});
-        return;
-      }
-      const resultType = this.evaluateExpressionType(declaration.initial);
-      if(resultType instanceof MultiType) {
-        if(!resultType.isCompatible(declaration.type)) {
-          const stringInfo = declaration.type.stringInfo();
-          const info = stringInfo[0];
-          throw ProcessorErrorFactory.incompatible_types_full(info.type, info.dim, declaration.sourceInfo);
-        }
-        this.insertSymbol(declaration.id, {id: declaration.id, type: declaration.type})
-      } else if(!declaration.type.isCompatible(resultType)) {
-        const stringInfo = declaration.type.stringInfo();
-        const info = stringInfo[0];
-        throw ProcessorErrorFactory.incompatible_types_full(info.type, info.dim, declaration.sourceInfo);
-      } else {
-        this.insertSymbol(declaration.id, {id: declaration.id, type: declaration.type})
-      }
-    }
-  }
-
-  evaluateExpressionType (expression) {
-    if(expression instanceof UnaryApp) {
-      const op = expression.op;
-      const resultType = this.evaluateExpressionType(expression.left);
-      return resultTypeAfterUnaryOp(op, resultType);
-    } else if (expression instanceof InfixApp) {
-      const op = expression.op;
-      const resultTypeLeft = this.evaluateExpressionType(expression.left);
-      const resultTypeRight = this.evaluateExpressionType(expression.right);
-      return resultTypeAfterInfixOp(op, resultTypeLeft, resultTypeRight);
-    } else if (expression instanceof Literal) {
-      return this.evaluateLiteralType(expression);
-    } else if (expression instanceof FunctionCall) {
-      if (expression.isMainCall) {
-        throw ProcessorErrorFactory.void_in_expression_full(LanguageDefinedFunction.getMainFunctionName(), expression.sourceInfo);
-      }
-      const fun = this.findFunction(expression.id);
-      if(fun === null) {
-        throw ProcessorErrorFactory.function_missing_full(expression.id, expression.sourceInfo);
-      }
-      if (fun.returnType.isCompatible(Types.VOID)) {
-        throw ProcessorErrorFactory.void_in_expression_full(expression.id, expression.sourceInfo);
-      }
-      this.assertParameters(fun, expression.actualParameters);
-      return fun.returnType;
-    } else if (expression instanceof ArrayAccess) {
-      const arrayTypeInfo = this.findSymbol(expression.id, this.symbolMap);
-      if(arrayTypeInfo === null) {
-        throw ProcessorErrorFactory.symbol_not_found_full(expression.id, expression.sourceInfo);
-      }
-      if (!(arrayTypeInfo.type instanceof CompoundType)) {
-        throw ProcessorErrorFactory.invalid_array_access_full(expression.id, expression.sourceInfo);
-      }
-      const lineType = this.evaluateExpressionType(expression.line);
-      if (!lineType.isCompatible(Types.INTEGER)) {
-        throw ProcessorErrorFactory.array_dimension_not_int_full(expression.sourceInfo);
-      }
-      if (expression.column !== null) {
-        if (arrayTypeInfo.columns === null) {
-          throw ProcessorErrorFactory.invalid_matrix_access_full(expression.id, expression.sourceInfo);
-        }
-        const columnType = this.evaluateExpressionType(expression.column);
-        if(!columnType.isCompatible(Types.INTEGER)) {
-          throw ProcessorErrorFactory.array_dimension_not_int_full(expression.sourceInfo);
-        }
-      }
-      const arrType = arrayTypeInfo.type;
-      if(expression.column !== null) {
-        // indexing matrix
-        return arrType.innerType;
-      } else {
-        if(arrayTypeInfo.columns === null) {
-          return arrType.innerType;
-        }
-        return new CompoundType(arrType.innerType, 1);
-      }
-    }
-  }
-
-  evaluateLiteralType (literal) {
-    if(literal instanceof IntLiteral) {
-      return literal.type;
-    } else if (literal instanceof RealLiteral) {
-      return literal.type;
-    } else if (literal instanceof StringLiteral) {
-      return literal.type;
-    } else if (literal instanceof BoolLiteral) {
-      return literal.type;
-    } else if (literal instanceof VariableLiteral) {
-      const typeInfo = this.findSymbol(literal.id, this.symbolMap);
-      if(typeInfo === null) {
-        throw ProcessorErrorFactory.symbol_not_found_full(literal.id, literal.sourceInfo);
-      }
-      if (typeInfo.type instanceof CompoundType) {
-        return typeInfo.type;
-      }
-      return typeInfo.type;
-    } else {
-      console.warn("Evaluating type only for an array literal...");
-      let last = null;
-      if(literal.value.length === 1) {
-        last = this.evaluateExpressionType(literal.value[0]);
-      } else {
-        for (let i = 0; i < literal.value.length; i++) {
-          const e = this.evaluateExpressionType(literal.value[i]);
-          if(last === null) {
-            last = e;
-          } else if(!last.isCompatible(e)) {
-            const strInfo = last.stringInfo();
-            const info = strInfo[0];
-            const strExp = literal.toString();
-            throw ProcessorErrorFactory.incompatible_types_array_full(strExp,info.type, info.dim, literal.sourceInfo);
-          }
-        }
-      }
-      if(last instanceof CompoundType) {
-        return new CompoundType(last.innerType, last.dimensions + 1);
-      }
-      return new CompoundType(last, 1);
-    }
-  }
-
-  evaluateArrayLiteral (id, lines, columns, type, literal) {
-    if (literal instanceof ArrayLiteral) {
-      if (columns === null) {
-        // it's a vector...
-        const dimType = this.evaluateExpressionType(lines);
-        if (!dimType.isCompatible(Types.INTEGER)) {
-          throw ProcessorErrorFactory.array_dimension_not_int_full(literal.sourceInfo);
-        }
-        if ((lines instanceof IntLiteral)) {
-          if (!lines.value.eq(literal.value.length)) {
-            if(type.dimensions > 1) {
-              throw ProcessorErrorFactory.matrix_line_outbounds_full(id, literal.value.length, lines.values.toNumber(), literal.sourceInfo)
-            } else {
-              throw ProcessorErrorFactory.vector_line_outbounds_full(id, literal.value.length, lines.values.toNumber(), literal.sourceInfo)
-            }
-          } else if (line.value.isNeg()) {
-            throw ProcessorErrorFactory.array_dimension_not_positive_full(literal.sourceInfo);
-          }
-          
-        }
-        literal.value.reduce((last, next) => {
-          const eType = this.evaluateExpressionType(next);
-          if (!last.canAccept(eType)) {
-            const strInfo = last.stringInfo();invalid
-            const info = strInfo[0];
-            const strExp = literal.toString();
-            throw ProcessorErrorFactory.incompatible_types_array_full(strExp,info.type, info.dim, literal.sourceInfo);
-          }
-          return last;
-        }, type);
-        return true;
-      } else {
-        const dimType = this.evaluateExpressionType(columns);
-        if (!dimType.isCompatible(Types.INTEGER)) {
-          throw ProcessorErrorFactory.array_dimension_not_int_full(literal.sourceInfo);
-        }
-        if ((columns instanceof IntLiteral)) {
-          if (!columns.value.eq(literal.value.length)) {
-            if(type.dimensions > 1) {
-              throw ProcessorErrorFactory.matrix_column_outbounds_full(id, literal.value.length, columns.values.toNumber(), literal.sourceInfo)
-            } else {
-              throw ProcessorErrorFactory.invalid_matrix_access_full(id, literal.sourceInfo);
-            }
-          } else if (columns.value.isNeg()) {
-            throw ProcessorErrorFactory.array_dimension_not_positive_full(literal.sourceInfo);
-          }
-          
-        }
-        for (let i = 0; i < columns; i++) {
-          const anotherArray = literal.value[i];
-          this.evaluateArrayLiteral(id, lines, null, type, anotherArray)
-        }
-      }
-
-    } else {
-
-      const resultType = this.evaluateExpressionType(literal);
-      if (!(resultType instanceof CompoundType)) {
-        const strInfo = type.stringInfo();
-        const info = strInfo[0];
-        const strExp = literal.toString();
-        throw ProcessorErrorFactory.incompatible_types_array_full(strExp,info.type, info.dim, literal.sourceInfo);
-      }
-      if (!type.isCompatible(resultType)) {
-        const strInfo = type.stringInfo();
-        const info = strInfo[0];
-        const strExp = literal.toString();
-        throw ProcessorErrorFactory.incompatible_types_array_full(strExp,info.type, info.dim, literal.sourceInfo);
-      }
-      return true;
-    }
-  }
-
-  assertFunction (fun) {
-    this.pushMap();
-    this.currentFunction = fun;
-    fun.formalParameters.forEach(formalParam => {
-      if(formalParam.type instanceof CompoundType) {
-        if(formalParam.type.dimensions > 1) {
-          this.insertSymbol(formalParam.id, {id: formalParam.id, lines: -1, columns: -1, type: formalParam.type});
-        } else {
-          this.insertSymbol(formalParam.id, {id: formalParam.id, lines: -1, columns: null, type: formalParam.type});
-        }
-      } else {
-        this.insertSymbol(formalParam.id, {id: formalParam.id, type: formalParam.type});
-      }
-    })
-    this.assertDeclarations(fun.variablesDeclarations);
-    const optional = fun.returnType.isCompatible(Types.VOID);
-    const valid = this.assertReturn(fun, optional);
-    if (!valid) {
-      throw ProcessorErrorFactory.function_no_return(fun.name);
-    }
-    this.popMap();
-  }
-
-  assertReturn (fun, optional) {
-    return fun.commands.reduce(
-      (last, next) => this.checkCommand(fun.returnType, next, optional) || last, optional
-    );
-  }
-
-  checkCommand (type, cmd, optional) {
-    if (cmd instanceof While) {
-      const resultType = this.evaluateExpressionType(cmd.expression);
-      if (!resultType.isCompatible(Types.BOOLEAN)) {
-        throw ProcessorErrorFactory.loop_condition_type_full(cmd.sourceInfo);
-      }
-      this.checkCommands(type, cmd.commands, optional);
-      return false;
-    } else if (cmd instanceof For) {
-      this.checkCommand(type, cmd.assignment, optional);
-      const resultType = this.evaluateExpressionType(cmd.condition);
-      if (!resultType.isCompatible(Types.BOOLEAN)) {
-        throw ProcessorErrorFactory.for_condition_type_full(cmd.sourceInfo);
-      }
-      this.checkCommand(type, cmd.increment, optional);
-      this.checkCommands(type, cmd.commands, optional);
-      return false;
-    } else if (cmd instanceof Switch) {
-      const sType = this.evaluateExpressionType(cmd.expression);
-      let result = optional;
-      let hasDefault = false;
-      for (let i = 0; i < cmd.cases.length; i++) {
-        const aCase = cmd.cases[i];
-        if (aCase.expression !== null) {
-          const caseType = this.evaluateExpressionType(aCase.expression);
-          if (!sType.isCompatible(caseType)) {
-            const strInfo = sType.stringInfo();
-            const info = strInfo[0];
-            const strExp = aCase.expression.toString();
-            throw ProcessorErrorFactory.invalid_case_type_full(strExp, info.type, info.dim, aCase.sourceInfo);
-          }
-        } else {
-          hasDefault = true;
-        }
-        result = result && this.checkCommands(type, aCase.commands, result);        
-      }
-      return result && hasDefault;
-
-    } else if (cmd instanceof ArrayIndexAssign) {
-      const typeInfo = this.findSymbol(cmd.id, this.symbolMap);
-      if(typeInfo === null) {
-        throw ProcessorErrorFactory.symbol_not_found_full(cmd.id, cmd.sourceInfo);
-      }
-      if(!(typeInfo.type instanceof CompoundType)) {
-        throw ProcessorErrorFactory.invalid_array_access_full(cmd.id, cmd.sourceInfo);
-      }
-      const exp = cmd.expression;
-      const lineExp = cmd.line;
-      const lineType = this.evaluateExpressionType(lineExp);
-      if (!lineType.isCompatible(Types.INTEGER)) {
-        throw ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo);
-      }
-      const columnExp = cmd.column;
-      if (typeInfo.columns === null && columnExp !== null) {
-        throw ProcessorErrorFactory.invalid_matrix_access_full(cmd.id, cmd.sourceInfo);
-      } else if (columnExp !== null) {
-        const columnType = this.evaluateExpressionType(columnExp);
-        if (!columnType.isCompatible(Types.INTEGER)) {
-          throw ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo);
-        }
-      }
-      // exp can be a arrayLiteral, a single value exp or an array access
-      if(exp instanceof ArrayLiteral) {
-        this.evaluateArrayLiteral(cmd.id, typeInfo.lines, (columnExp ? typeInfo.columns : null), typeInfo.type, exp);
-      } else {
-        // cannot properly evaluate since type system is poorly constructed
-      }
-      return optional;
-    } else if (cmd instanceof Assign) {
-      const typeInfo = this.findSymbol(cmd.id, this.symbolMap);
-      if(typeInfo === null) {
-        throw ProcessorErrorFactory.symbol_not_found_full(cmd.id, cmd.sourceInfo);
-      }
-      const exp = cmd.expression;
-      if(exp instanceof ArrayLiteral) {
-        if(!(typeInfo.type instanceof CompoundType)) {
-          const stringInfo = typeInfo.type.stringInfo();
-          const info = stringInfo[0];
-          throw ProcessorErrorFactory.incompatible_types_full(info.type, info.dim, cmd.sourceInfo);
-        }
-        this.evaluateArrayLiteral(cmd.id, typeInfo.lines, typeInfo.columns, typeInfo.type, exp);
-      } else {
-        const resultType = this.evaluateExpressionType(exp);
-        if(!resultType.isCompatible(typeInfo.type)) {
-          const stringInfo = typeInfo.type.stringInfo();
-          const info = stringInfo[0];
-          throw ProcessorErrorFactory.incompatible_types_full(info.type, info.dim, cmd.sourceInfo);
-        }
-      }
-      return optional;
-    } else if (cmd instanceof Break) {
-      return optional;
-    } else if (cmd instanceof IfThenElse) {
-      const resultType = this.evaluateExpressionType(cmd.condition);
-      if (!resultType.isCompatible(Types.BOOLEAN)) {
-        throw ProcessorErrorFactory.if_condition_type_full(cmd.sourceInfo);
-      }
-      if(cmd.ifFalse instanceof IfThenElse) {
-        return this.checkCommands(type, cmd.ifTrue.commands, optional) && this.checkCommand(type, cmd.ifFalse, optional);
-      } else {
-        return this.checkCommands(type, cmd.ifTrue.commands, optional) && this.checkCommands(type, cmd.ifFalse.commands,optional);
-      }
-
-    } else if (cmd instanceof FunctionCall) {
-      let fun = null;
-      if (cmd.isMainCall) {
-        fun = this.getMainFunction();
-      } else {
-        fun = this.findFunction(cmd.id);
-      }
-      if(fun === null) {
-        throw ProcessorErrorFactory.function_missing_full(cmd.id, cmd.sourceInfo);
-      }
-      this.assertParameters(fun, cmd.actualParameters);
-      return optional;
-    } else if (cmd instanceof Return) {
-      const funcName = this.currentFunction.isMain ? LanguageDefinedFunction.getMainFunctionName() : this.currentFunction.name
-      if (cmd.expression === null && !type.isCompatible(Types.VOID)) {
-        const stringInfo = type.stringInfo();
-        const info = stringInfo[0];
-        throw ProcessorErrorFactory.invalid_void_return_full(funcName, info.type, info.dim, cmd.sourceInfo);
-      } else if (cmd.expression !== null) {
-        const resultType = this.evaluateExpressionType(cmd.expression);
-        if (!type.isCompatible(resultType)) {
-          const stringInfo = type.stringInfo();
-          const info = stringInfo[0];
-          throw ProcessorErrorFactory.invalid_return_type_full(funcName, info.type, info.dim, cmd.sourceInfo);
-        } else {
-          return true;
-        }
-      } else {
-        return true;
-      }
-    }
-  }
-
-  checkCommands (type, cmds, optional) {
-    return cmds.reduce(
-      (last, next) => this.checkCommand(type, next, optional) || last, optional
-    );
-  }
-
-  assertParameters (fun, actualParametersList) {
-    if (fun.formalParameters.length !== actualParametersList.length) {
-      throw ProcessorErrorFactory.invalid_parameters_size_full(fun.name, actualParametersList.length, fun.formalParameters.length, null);
-    }
-    for (let i = 0; i < actualParametersList.length; i++) {
-      const param = actualParametersList[i];
-      const formalParam = fun.formalParameters[i];
-      if(formalParam.byRef) {
-        if (!(param instanceof VariableLiteral || param instanceof ArrayAccess)) {
-          throw ProcessorErrorFactory.invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
-        }
-      }
-      const resultType = this.evaluateExpressionType(param);
-      if(resultType instanceof MultiType && formalParam.type instanceof MultiType) {
-        let shared = 0
-        for (let j = 0; j < resultType.types.length; j++) {
-          const element = resultType.types[j];
-          if(formalParam.type.types.indexOf(element) !== -1) {
-            shared++;
-          }
-        }
-        if(shared <= 0) {
-          throw ProcessorErrorFactory.invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
-        }
-      } else if (resultType instanceof MultiType) {
-        if(!resultType.isCompatible(formalParam.type)) {
-          throw ProcessorErrorFactory.invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
-        }
-      } else if(!formalParam.type.isCompatible(resultType)) {
-        throw ProcessorErrorFactory.invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
-      }
-
-    }
-  }
-}

+ 0 - 76
ivprogh/js/processor/store/store.js

@@ -1,76 +0,0 @@
-import { Modes } from './../modes';
-
-export class Store {
-
-  constructor(name) {
-    this.name = name;
-    this.store = {};
-    this.nextStore = null;
-    this.mode = Modes.RUN; 
-  }
-
-  extendStore (nextStore) {
-    this.nextStore = nextStore;
-  }
-
-  applyStore (id) {
-    if(!this.store[id]) {
-      if (this.nextStore !== null) {
-        return this.nextStore.applyStore(id);
-      } else {
-        // TODO: better error message
-        throw new Error(`Variable ${id} not found.`);
-      }
-    }
-    const val = this.store[id];
-    if (val.isRef) {
-      return val.getRefObj();
-    }
-    return this.store[id];
-  }
-
-  updateStore (id, stoObj) {
-    if(!this.store[id]) {
-      if(this.nextStore !== null) {
-        this.nextStore.updateStore(id, stoObj);
-        return this;
-      } else {
-        // TODO: better error message
-        throw new Error(`Variable ${id} not found.`);
-      }
-    } else {
-      const oldObj = this.store[id];
-      if(oldObj.readOnly) {
-        // TODO: better error message
-        throw new Error("Cannot change value of a read only variable: " + id);
-      }
-      if(oldObj.isRef) {
-        oldObj.updateRef(stoObj);
-        return this;
-      } else if(oldObj.isCompatible(stoObj)) {
-        stoObj.setID(id);
-        this.store[id] = Object.freeze(stoObj);
-        return this;
-      } else {
-        const oldType = oldObj.type;
-        const stoType = stoObj.type;
-        // TODO: better error message
-        throw new Error(`${oldType} is not compatible with type ${stoType} given`);
-      }
-    }
-  }
-
-  //In case of future use of ref, it needs to have a special function to update the storeRefObject
-  // and no the StoreObject refferenced by it
-  // updateStoreRef(id, stoObjAddress) {...}
-
-  insertStore (id, stoObj) {
-    if (this.store[id]) {
-      // TODO: better error message
-      throw new Error(`${id} is already defined`);
-    }
-    stoObj.setID(id);
-    this.store[id] = Object.freeze(stoObj);
-    return this;
-  }
-}

+ 0 - 54
ivprogh/js/processor/store/storeObject.js

@@ -1,54 +0,0 @@
-import Decimal from 'decimal.js';
-
-export class StoreObject {
-
-  constructor (type, value, readOnly = false) {
-    this._type = type;
-    this._value = value;
-    this._readOnly = readOnly;
-    this._id = null;
-  }
-
-  setID (id) {
-    this._id = id;
-  }
-
-  get id () {
-    return this._id;
-  }
-
-  get inStore () {
-    return this.id !== null;
-  }
-
-  get type () {
-    return this._type;
-  }
-
-  get value () {
-    return this._value;
-  }
-  
-  get number () {
-    if (this._value instanceof Decimal) {
-      return this._value.toNumber();
-    } else {
-      return null;
-    }
-  }
-
-  get readOnly () {
-    return this._readOnly;
-  }
-
-  set readOnly (value) {
-    this._readOnly = value;
-  }
-
-  isCompatible (another) {
-    if( another instanceof StoreObject) {
-      return this.type.isCompatible(another.type);
-    }
-    return false;
-  }
-}

+ 0 - 79
ivprogh/js/processor/store/storeObjectArray.js

@@ -1,79 +0,0 @@
-import { StoreObject } from './storeObject';
-
-export class StoreObjectArray extends StoreObject {
-
-  static get WRONG_LINE_NUMBER () {
-    return 1;
-  }
-
-  static get WRONG_TYPE () {
-    return 2;
-  }
-
-  static get WRONG_COLUMN_NUMBER () {
-    return 3;
-  }
-
-  constructor (type, lines, columns, value = null, readOnly = false) {
-    super(type, value, readOnly);
-    this._lines = lines;
-    this._columns = columns;
-  }
-
-  get lines () {
-    return this._lines;
-  }
-
-  get columns () {
-    return this._columns;
-  }
-
-  isCompatible (another) {
-    if(another instanceof StoreObject) {
-      if(((this.lines === -1 && another.lines > 0) ||
-        (this.lines === another.lines))) {
-          if ((this.columns === -1 && another.columns > 0) ||
-            (this.columns === another.columns)) {
-              return super.isCompatible(another);
-          }
-        }
-    }
-    return false;
-  }
-
-  get isVector () {
-    return this.type.dimensions === 1;
-  }
-
-  get isValid () {
-    if (this.value !== null) {
-      if( this.isVector) {
-        if(this.value.length !== this.lines) {
-          return [StoreObjectArray.WRONG_LINE_NUMBER, this.value.length];;
-        }
-        const mustBeNull = this.value.find(v => !this.type.canAccept(v.type) );
-        if(!!mustBeNull) {
-          return [StoreObjectArray.WRONG_TYPE, this.value.indexOf(mustBeNull)];;
-        }
-      }
-      return [];
-    } else {
-    if(this.lines !== this.value.length) {
-      return [StoreObjectArray.WRONG_LINE_NUMBER, this.value.length];
-    }
-    for (let i = 0; i < this.lines; i++) {
-      for (let j = 0; j < this.columns; j++) {
-        const arr = this.value[i];
-        if(arr.length !== this.columns) {
-          return [StoreObjectArray.WRONG_COLUMN_NUMBER, arr.length];
-        }
-        const mustBeNull = arr.find(v => !this.type.canAccept(v.type) );
-        if(!!mustBeNull) {
-          return [StoreObjectArray.WRONG_TYPE, i, arr.indexOf(mustBeNull)];
-        }            
-      }
-    }
-      return [];
-    }
-  }
-}

+ 0 - 101
ivprogh/js/processor/store/storeObjectArrayAddress.js

@@ -1,101 +0,0 @@
-import { StoreObject } from './storeObject';
-import { StoreObjectArray } from './storeObjectArray';
-import { CompoundType } from '../../typeSystem/compoundType';
-import { ProcessorErrorFactory } from '../error/processorErrorFactory';
-
-export class StoreObjectArrayAddress extends StoreObject {
-
-  constructor (refID, line, column, store) {
-    super(null, null, false);
-    this.refID = refID;
-    this.store = store;
-    this.line = line;
-    this.column = column;
-  }
-
-  get isRef () {
-    return false;
-  }
-
-  get inStore () {
-    return true;
-  }
-
-  get refValue () {
-    const refLine = this.store.applyStore(this.refID).value[this.line];
-    if(!refLine) {
-      if(this.getArrayObject().isVector) {
-        throw ProcessorErrorFactory.vector_line_outbounds(this.refID, this.line, this.getArrayObject().lines);
-      } else {
-        throw ProcessorErrorFactory.matrix_line_outbounds(this.refID, this.line, this.getArrayObject().lines);
-      }
-    }
-    if (this.column !== null) {
-      const refColumn = refLine.value[this.column];
-      if(!refColumn) {
-        if(this.getArrayObject().isVector) {
-          throw ProcessorErrorFactory.vector_not_matrix(this.refID);
-        } else {
-          throw ProcessorErrorFactory.matrix_column_outbounds(this.refID, this.column, this.getArrayObject().columns);
-        }
-      }
-      return refColumn;
-    }
-    return refLine;
-  }
-
-  get value () {
-    return this.refValue.value;
-  }
-
-  get type () {
-    return this.refValue.type;
-  }
-
-  get lines () {
-    if(!(this.type instanceof CompoundType)) {
-      return null;
-    }
-    return this.refValue.value.length;
-  }
-
-  get columns () {
-    switch (this.type.dimensions) {
-      case 2:
-        return this.refValue.value[0].value.length;
-      default:
-        return null;
-    }
-  }
-
-  getArrayObject () {
-    return this.store.applyStore(this.refID);
-  }
-
-  updateArrayObject (stoObj) {
-    const anArray =  this.getArrayObject();
-    const newArray = Object.assign(new StoreObjectArray(null,null,null), anArray);
-    if(!stoObj.type.isCompatible(this.type)) {
-      throw new Error(`Invalid operation: cannot assign the value given to ${this.refID}`);
-    } else if (this.type instanceof CompoundType && this.type.canAccept(stoObj.type)) {
-      throw new Error(`Invalid operation: cannot assign the value given to ${this.refID}`);
-    }
-    if (this.column !== null) {
-     newArray.value[this.line].value[this.column] = stoObj;
-     return newArray;
-    } else {
-     newArray.value[this.line] = stoObj;
-     return newArray;
-    }
-  }
-
-  isCompatible (another) {
-    if(this.type.isCompatible(another.type)) {
-      if(another.type instanceof CompoundType) {
-        return this.lines === another.lines && this.columns === another.columns;
-      } else {
-        this.refValue.isCompatible(another);
-      }
-    }
-  }
-}

+ 0 - 43
ivprogh/js/processor/store/storeObjectArrayAddressRef.js

@@ -1,43 +0,0 @@
-import { StoreObject } from './storeObject';
-import Decimal from 'decimal.js';
-
-export class StoreObjectArrayAddressRef extends StoreObject {
-
-  constructor (address) {
-    super(null, null, false);
-    this.address = address;
-  }
-
-  get isRef () {
-    return true;
-  }
-
-  get type () {
-    return this.address.type;
-  }
-
-  get value () {
-    return this.address.value;
-  }
-
-  get number () {
-    if (this.value instanceof Decimal) {
-      return this.value.toNumber();
-    } else {
-      return null;
-    }
-  }
-
-  getRefObj () {
-    return this.address.refValue;
-  }
-
-  updateRef (stoObj) {
-    const newArray = this.address.updateArrayObject(stoObj);
-    this.address.store.updateStore(this.address.refID, newArray);
-  }
-
-  isCompatible (another) {
-    return this.address.isCompatible(another);
-  }
-}

+ 0 - 43
ivprogh/js/processor/store/storeObjectRef.js

@@ -1,43 +0,0 @@
-import { StoreObject } from './storeObject';
-import Decimal from 'decimal.js';
-
-export class StoreObjectRef extends StoreObject {
-
-  constructor (refID, store) {
-    super(null, null, false);
-    this.refID = refID;
-    this.store = store;
-  }
-
-  get isRef () {
-    return true;
-  }
-
-  get type () {
-    return this.store.applyStore(this.refID).type;
-  }
-
-  get value () {
-    return this.store.applyStore(this.refID).value;
-  }
-
-  get number () {
-    if (this.value instanceof Decimal) {
-      return this.value.toNumber();
-    } else {
-      return null;
-    }
-  }
-
-  getRefObj () {
-    return this.store.applyStore(this.refID);
-  }
-
-  updateRef (stoObj) {
-    this.store.updateStore(this.refID, stoObj);
-  }
-
-  isCompatible (another) {
-    return this.store.applyStore(this.refID).isCompatible(another);
-  }
-}

+ 0 - 49
ivprogh/js/runner.js

@@ -1,49 +0,0 @@
-import { IVProgParser } from './ast/ivprogParser';
-import { IVProgProcessor } from './processor/ivprogProcessor';
-import {DOMConsole} from './io/domConsole';
-import { LanguageService } from './services/languageService';
-import { SemanticAnalyser } from './processor/semantic/semanticAnalyser';
-
-export function runner () {
-const ivprogLexer = LanguageService.getCurrentLexer();
-
-
-// const lexer = new ivprogLexer(new InputStream(input));
-// const stream = new CommonTokenStream(lexer);
-// stream.fill();
-// let i = 1;
-// let token = null;
-// while ((token = stream.LT(i)).type !== ivprogLexer.EOF && token.type !== ivprogLexer.WHITESPACE) {
-//     console.log(`${token.type}-${token.text}`);
-//     console.log('\n')
-//     i++;
-// }
-// const anaSin = new IVProgParser(input, ivprogLexer);
-const editor = new JsonEditor('#json-renderer', {});
-const domConsole = new DOMConsole("#console");
-// proc.interpretAST().then( sto => {
-//   console.log(sto.applyStore('a'));
-// }).catch(e => console.log(e));
-try {
-  $('#btn').click( () => {
-    const input = $('#input').val();
-    const analiser = new IVProgParser(input, ivprogLexer);
-    try {
-      const data = analiser.parseTree();
-      const semAna = new SemanticAnalyser(data);
-      const proc = new IVProgProcessor(semAna.analyseTree());
-      proc.registerInput(domConsole);
-      domConsole.clear();
-      proc.registerOutput(domConsole);
-      proc.interpretAST().then(sto => editor.load(sto.store))
-        .catch( e => {alert(e); console.log(e)});
-    } catch (error) {
-      alert(error);
-      console.log(error);
-    }
-    
-  });
-} catch(a) {
-  console.log(a);
-}
-}

+ 0 - 61
ivprogh/js/semantic/semantic-buttons.js

@@ -1,61 +0,0 @@
-
-var button_ready = function() {
-
-  var
-    $buttons         = $('.ivprog_format .button'),
-    
-    handler = {
-
-      activate: function() {
-        $(this)
-          .addClass('active')
-          .siblings()
-          .removeClass('active')
-        ;
-      }
-
-    }
-  ;
-
-  $buttons.on('click', handler.activate);
-
-  $('.ivprog_format_info')
-    .popup({
-      popup : $('.custom.popup'),
-      on    : 'click'
-    })
-  ;
-
-  $(".data_types_dropdown")
-    .dropdown()
-  ;
-
-  $('.ui.dropdown')
-    .dropdown()
-  ;
-
-  // Atualiza a tela do algoritmo
-  //renderAlgorithm();
-
-  $('.ivprog_visual_panel').removeClass("loading");
-
-  $(document).mousemove(function(e){
-    var parentOffset = $('.ivprog_visual_panel').offset();; 
-   
-    mouseX = e.pageX - parentOffset.left + 300;
-    mouseY = e.pageY - parentOffset.top + 100;
-
-    /*$('.created_element').css('top', mouseY);
-    $('.created_element').css('left', mouseX);*/
-
-  });
-
-};
-
-var mouseX;
-var mouseY;
-
-// attach ready event
-$(document)
-  .ready(button_ready)
-;

+ 0 - 22
ivprogh/js/services/i18nHelper.js

@@ -1,22 +0,0 @@
-import line_i18n from "line-i18n";
-import { LocalizedStrings } from "./localizedStringsService";
-
-const StringTypes = line_i18n.StringTypes;
-
-export const i18nHelper = Object.freeze({
-  i18n: (identifier) => {
-    var opts = identifier.split(':');
-    var type = opts[0].toLowerCase();
-    var id = opts[1];
-    if (StringTypes.ERROR === type) {
-      return LocalizedStrings.getError(id);
-    } else if (StringTypes.MESSAGE === type) {
-      return LocalizedStrings.getMessage(id); 
-    } else if (StringTypes.UI === type) {
-      return LocalizedStrings.getUI(id);
-    } else {
-      console.warn("A string has been passed to the i18n helper function that was not in the form type:id -> " + identifier);
-      return LocalizedStrings.getString(identifier, type);
-    }
-  }
-});

+ 0 - 40
ivprogh/js/services/languageService.js

@@ -1,40 +0,0 @@
-import Lexers from './../../grammar/';
-import line_i18n from 'line-i18n';
-
-// This is for LanguageService with localStorage
-// const DEFAULT_LANG = "pt";
-
-class LanguageServiceExtended extends line_i18n.LanguageServiceNoLS {
-
-  constructor () {
-    super(iLMparameters.lang);
-  }
-
-  getCurrentLexer () {
-    const langInfo = Lexers[this.getLang()];
-    if(langInfo === null || langInfo === undefined) {
-      return Lexers[this.getDefaultLang()].lexer;
-    } else {
-      return langInfo.lexer;
-    }
-  }
-
-  getCurrentLangFuncs () {
-    const langInfo = Lexers[this.getLang()];
-    if(langInfo === null || langInfo === undefined) {
-      return Lexers[this.getDefaultLang()].langFuncs;
-    } else {
-      return langInfo.langFuncs;
-    }
-  }
-
-  getCurrentLangLibs () {
-    const langInfo = Lexers[this.getLang()];
-    if(langInfo === null || langInfo === undefined) {
-      return Lexers[this.getDefaultLang()].langLibs;
-    }
-    return langInfo.langLibs;
-  }
-}
-
-export const LanguageService  = new LanguageServiceExtended();

+ 0 - 4
ivprogh/js/services/localizedStringsService.js

@@ -1,4 +0,0 @@
-import { LanguageService } from "./languageService";
-import line_i18n from 'line-i18n'
-import Langs from './../../i18n';
-export const LocalizedStrings = Object.freeze(new line_i18n.LocalizedStrings(LanguageService, Langs, true));

+ 0 - 27
ivprogh/js/typeSystem/baseTypes.js

@@ -1,27 +0,0 @@
-class BaseType {
-  constructor(name, ord) {
-    this.name = name;
-    this.ord = ord;
-  }
-
-  get value () {
-    return this.name;
-  }
-
-  isCompatible (another) {
-    if(another instanceof BaseType) {
-      return this.name === another.name && this.ord === another.ord;
-    }
-    return false;
-  }
-}
-
-// Base types names are the same as i18n ui type keys
-export const BaseTypes = Object.freeze({
-  INTEGER: new BaseType("integer", 0),
-  REAL: new BaseType("real", 1),
-  STRING: new BaseType("text", 2),
-  BOOLEAN: new BaseType("boolean", 3),
-  VOID: new BaseType("void", 4),
-  UNDEFINED: new BaseType("undefined", 5)
-})

+ 0 - 36
ivprogh/js/typeSystem/compoundType.js

@@ -1,36 +0,0 @@
-import { Type } from "./type";
-
-export class CompoundType extends Type {
-
-  constructor (type, dimensions) {
-    super(null);
-    this.innerType = type;
-    this.dimensions = dimensions;
-  }
-
-  isCompatible (another) {
-    if(another instanceof CompoundType){
-      if(this.dimensions !== another.dimensions) {
-        return false;
-      }
-      return this.innerType.isCompatible(another.innerType);
-    }
-    return false;
-  }
-
-  stringInfo () {
-    const list = this.innerType.stringInfo();
-    list.forEach(v => {
-      v.dim = this.dimensions;
-    });
-    return list;
-  }
-
-  canAccept (another) {
-    if(another instanceof CompoundType) {
-      return this.dimensions > another.dimensions && this.innerType.isCompatible(another.innerType);
-    } else {
-      return this.innerType.isCompatible(another);
-    }
-  }
-}

+ 0 - 38
ivprogh/js/typeSystem/multiType.js

@@ -1,38 +0,0 @@
-import { Type } from "./type";
-
-export class MultiType extends Type {
-
-  constructor (types) {
-    super(null);
-    this.types = types;
-  }
-
-  get value () {
-    return null;
-  }
-
-  get ord () {
-    return null;
-  }
-
-  stringInfo () {
-    let list = [];
-    for (let i = 0; i < this.types.length; i++) {
-      const t = this.types[i];
-      list = list.concat(t.stringInfo());
-    }
-    return list;
-  }
-
-  isCompatible (another) {
-    if(another instanceof Type) {
-      for (let i = 0; i < this.types.length; i++) {
-        const t = this.types[i];
-        if (t.isCompatible(another)) {
-          return true;
-        }
-      }
-    }
-    return false;
-  }
-}

+ 0 - 66
ivprogh/js/typeSystem/parsers.js

@@ -1,66 +0,0 @@
-import { LanguageService } from "../services/languageService";
-import { Types } from "./types";
-import Decimal from "decimal.js";
-
-export function toInt (str) {
-  return new Decimal(str);
-}
-
-export function toString (str) {
-  let value = str.replace(/^"/, '');
-  value = value.replace(/"$/, '');
-  value = value.replace(/\\b/g, "\b");
-  value = value.replace(/\\t/g, "\t");
-  value = value.replace(/\\n/g, "\n");
-  value = value.replace(/\\r/g, "\r");
-  value = value.replace(/\\\"/g, "\"");
-  value = value.replace(/\\\'/g, "\'");
-  value = value.replace(/\\\\/g, "\\");
-  return value;
-}
-
-export function toReal (value) {
-  return new Decimal(value);
-}
-
-export function toBool (str) {
-  const val = "'" + str + "'";
-  const lexer = LanguageService.getCurrentLexer();
-  const instance = new lexer(null);
-  if (instance.literalNames[lexer.RK_TRUE] === val) {
-    return true;
-  } else if (instance.literalNames[lexer.RK_FALSE] === val) {
-    return false;
-  } else {
-    // TODO: better error message
-    throw new Error(str + "not a valid boolean");
-  }
-}
-
-function convertBoolToString (bool) {
-  const lexer = LanguageService.getCurrentLexer();
-  const instance = new lexer(null);
-  if (bool) {
-    return instance.literalNames[lexer.RK_TRUE];
-  } else {
-    return instance.literalNames[lexer.RK_FALSE];
-  }
-}
-
-export function convertToString(stoObj, type) {
-  switch (type.ord) {
-    case Types.INTEGER.ord:
-      return stoObj.toString();
-    case Types.REAL.ord: {
-      if (stoObj.dp() <= 0) {
-        return stoObj.toFixed(1);  
-      } else {
-        return stoObj.toNumber();
-      }
-    }
-    case Types.BOOLEAN.ord:
-      return convertBoolToString(stoObj);
-    default:
-      return stoObj;
-  }
-}

+ 0 - 25
ivprogh/js/typeSystem/type.js

@@ -1,25 +0,0 @@
-export class Type {
-
-  constructor(baseType) {
-    this.baseType = baseType;
-  }
-
-  get value () {
-    return this.baseType.value;
-  }
-
-  get ord () {
-    return this.baseType.ord;
-  }
-
-  stringInfo () {
-    return [{type: this.baseType.name, dim: 0}];
-  }
-
-  isCompatible (another) {
-    if(another instanceof Type) {
-      return this.baseType.isCompatible(another.baseType);
-    }
-    return false;
-  }
-}

+ 0 - 21
ivprogh/js/typeSystem/types.js

@@ -1,21 +0,0 @@
-import { BaseTypes } from './baseTypes';
-import { Type } from "./type";
-import { MultiType } from "./multiType";
-
-const INTEGER = new Type(BaseTypes.INTEGER);
-const REAL = new Type(BaseTypes.REAL);
-const STRING = new Type(BaseTypes.STRING);
-const BOOLEAN = new Type(BaseTypes.BOOLEAN);
-const VOID = new Type(BaseTypes.VOID);
-const UNDEFINED = new Type(BaseTypes.UNDEFINED);
-const ALL = new MultiType([INTEGER, REAL, STRING, BOOLEAN]);
-
-export const Types = Object.freeze({
-  INTEGER: INTEGER,
-  REAL: REAL,
-  STRING: STRING,
-  BOOLEAN: BOOLEAN,
-  VOID: VOID,
-  UNDEFINED: UNDEFINED,
-  ALL: ALL
-});

+ 0 - 18
ivprogh/js/util/config.js

@@ -1,18 +0,0 @@
-class ConfigObject {
-
-  constructor () {
-    this.loopTimeout = 5000;
-    this.decimalPlaces = 5;
-    this.intConvertRoundMode = 2;
-  }
-
-  setConfig (opts) {
-    for (const key in opts) {
-      if(this.hasOwnProperty(key)){
-        this[key] = opts[key];
-      }
-    }
-  }
-}
-let config = new ConfigObject();
-export const Config = config;

+ 0 - 19
ivprogh/js/util/inputTest.js

@@ -1,19 +0,0 @@
-import { Input } from './../io/input';
-
-export class InputTest extends Input {
-
-  constructor (inputList) {
-    super();
-    this.index = 0;
-    this.inputList = inputList;
-  }
-
-  requestInput (callback) {
-    if(this.index < this.inputList.length) {      
-      callback(this.inputList[this.index]);
-      this.index++;
-    } else {
-      throw new Error('The amount of requests exceeded the amount of available inputs');
-    }
-  }
-}

+ 0 - 13
ivprogh/js/util/outputTest.js

@@ -1,13 +0,0 @@
-import { Output } from './../io/output';
-
-export class OutputTest extends Output {
-
-  constructor () {
-    super();
-    this.list = [];
-  }
-
-  sendOutput (text) {
-    this.list.push(text);
-  }
-}

+ 0 - 39
ivprogh/js/visualUI/algorithm.js

@@ -1,39 +0,0 @@
-import $ from 'jquery';
-import { Types } from './types';
-import * as Models from './ivprog_elements';
-import { LocalizedStrings } from './../services/localizedStringsService';
-import * as GlobalsManagement from './globals';
-import * as VariablesManagement from './variables';
-import * as CommandsManagement from './commands';
-import * as CodeManagement from './code_generator';
-import * as VariableValueMenu from './commands/variable_value_menu';
-import * as FunctionsManagement from './functions';
-import { DOMConsole } from './../io/domConsole';
-import { IVProgParser } from './../ast/ivprogParser';
-import { IVProgProcessor } from './../processor/ivprogProcessor';
-import { LanguageService } from '../services/languageService';
-
-var block_render = false;
-
-export function renderAlgorithm () {
-	if (block_render) {
-		return;
-	}
-	block_render = true;
-
- 	$('.all_functions').children().off();
-	$('.all_functions').empty();
-
-	$('.list_globals').children().off();
-	$('.list_globals').empty();	
-
-	for (var i = 0; i < window.program_obj.functions.length; i++) {
-		FunctionsManagement.renderFunction(window.program_obj.functions[i]);
-	}
-
-	for (var i = 0; i < window.program_obj.globals.length; i++) {
-		GlobalsManagement.renderGlobal(window.program_obj.globals[i]);
-	}	
-
-	setTimeout(function(){ block_render = false; }, 500);
-}

File diff ditekan karena terlalu besar
+ 0 - 1072
ivprogh/js/visualUI/code_generator.js


File diff ditekan karena terlalu besar
+ 0 - 1076
ivprogh/js/visualUI/commands.js


+ 0 - 488
ivprogh/js/visualUI/commands/attribution.js

@@ -1,488 +0,0 @@
-import $ from 'jquery';
-import { Types } from '../types';
-import * as Models from '../ivprog_elements';
-import { LocalizedStrings } from '../../services/localizedStringsService';
-import * as GlobalsManagement from '../globals';
-import * as VariablesManagement from '../variables';
-import * as VariableValueMenu from './variable_value_menu';
-import * as VariableValueMenuManagement from './variable_value_menu';
-import * as CommandsManagement from '../commands';
-
-export function createFloatingCommand () {
-	return $('<div class="ui attribution created_element"> <i class="ui icon small arrow left"></i> <span> x = 1 + 1 </span></div>');
-}
-
-export function renderCommand (command, function_obj) {
-	
-	var el = $('<div class="ui attribution command_container"><i class="ui icon small arrow left command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="var_attributed"></div> <span class="text_attr_receives span_command_spec">'+LocalizedStrings.getUI('text_receives')+'</span> '
-		 + '<div class="expression_elements"></div> </div>');
-	el.data('command', command);
-
-	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)]);
-
-		command.expression.push(exp);
-	}
-
-	addHandlers(command, function_obj, el);
-
-	renderExpressionElements(command, function_obj, el);
-
-	return el;
-
-}
-
-export function manageExpressionElements (command, ref_object, dom_object, menu_var_or_value, function_obj, selectedItem, expression_element) {
-	
-	var index_to_move = expression_element.itens.indexOf(ref_object);
-
-	switch (selectedItem.data('exp')) {
-		case Models.EXPRESSION_ELEMENTS.exp_op_exp:
-
-			var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.exp_op_exp, [expression_element.itens[index_to_move],
-	     		Models.ARITHMETIC_TYPES.plus, 
-				new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
-
-			expression_element.itens[index_to_move] = exp;
-
-			break;
-
-		case Models.EXPRESSION_ELEMENTS.op_exp:
-
-			var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.op_exp, [Models.ARITHMETIC_TYPES.plus, 
-				expression_element.itens[index_to_move] ]);
-
-			expression_element.itens[index_to_move] = exp;
-
-			break;
-
-		case Models.EXPRESSION_ELEMENTS.par_exp_par:
-
-			var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.par_exp_par, [expression_element.itens[index_to_move]]);
-
-			expression_element.itens[index_to_move] = exp;
-
-			break;
-	}
-
-	renderExpressionElements(command, function_obj, dom_object);
-
-}
-
-function renderExpressionElements (command, function_obj, el) {
-	var expression_div = el.find('.expression_elements');
-	var command_container;
-
-	if (el.hasClass("command_container") == false) {
-		var hier = el.parentsUntil(".command_container");
-		for (var i = 0; i < hier.length; i++) {
-			if ($(hier[i]).hasClass("command_container")) {
-				command_container = $(hier[i]);
-				break;
-			}
-			if ($(hier[i]).hasClass("expression_elements")) {
-				expression_div = $(hier[i]);
-				break;
-			}
-		}
-	}
-
-	if (command_container) {
-		expression_div = command_container.find('.expression_elements');
-	}
-
-	expression_div.text('');
-
-	for (var i = 0; i < command.expression.length; i++) {
-
-		var temp = $('<div class="expression_element"></div>');
-		temp.data('ref_element', command.expression[i]);
-		temp.data('ref_index', i);
-
-		expression_div.append(temp);
-
-		renderElement(command, function_obj, temp, command.expression[i]);
-	}
-}
-
-function renderOperator (command, function_obj, temp_op, expression_element, index_op) {
-
-	var context_menu = '<div class="ui dropdown"><div class="text">';
-
-	switch (expression_element.itens[index_op]) {
-		case Models.ARITHMETIC_TYPES.plus:
-			context_menu += '+';
-			break;
-
-		case Models.ARITHMETIC_TYPES.minus:
-			context_menu += '-';
-			break;
-
-		case Models.ARITHMETIC_TYPES.multiplication:
-			context_menu += '*';
-			break;
-
-		case Models.ARITHMETIC_TYPES.division:
-			context_menu += '/';
-			break;
-
-		case Models.ARITHMETIC_TYPES.module:
-			context_menu += '%';
-			break;
-
-		case Models.ARITHMETIC_TYPES.none:
-			context_menu += '...';
-			break;
-	}
-	
-	context_menu += '</div><div class="menu">';
-	context_menu += '<div class="item" data-value="'+Models.ARITHMETIC_TYPES.plus+'">+</div>';
-	context_menu += '<div class="item" data-value="'+Models.ARITHMETIC_TYPES.minus+'">-</div>';
-	context_menu += '<div class="item" data-value="'+Models.ARITHMETIC_TYPES.multiplication+'">*</div>';
-	context_menu += '<div class="item" data-value="'+Models.ARITHMETIC_TYPES.division+'">/</div>';
-	context_menu += '<div class="item" data-value="'+Models.ARITHMETIC_TYPES.module+'">%</div>';
-	context_menu += '<div class="item" data-value="'+Models.ARITHMETIC_TYPES.none+'" data-text="...">Nenhum</div>';
-	context_menu += '</div></div>';
-
-	context_menu = $(context_menu);
-
-	temp_op.append(context_menu);
-
-	context_menu.dropdown({
-		onChange: function(value, text, $selectedItem) {
-	     expression_element.itens[index_op] = value;
-      }
-	});
-
-}
-
-function renderMenuAddExpression (command, function_obj, el, dom_append_menu, expression_append_new_expression) {
-
-	if (el.hasClass("command_container") == false) {
-		var hier = el.parentsUntil(".commands_list_div");
-
-		for (var i = 0; i < hier.length; i++) {
-			if ($(hier[i]).hasClass("command_container")) {
-				el = $(hier[i]);
-				break;
-			}
-		}
-	}
-
-	if (dom_append_menu.hasClass("expression_elements") == false) {
-		var hier = el.parentsUntil(".commands_list_div");
-
-		for (var i = 0; i < hier.length; i++) {
-			if ($(hier[i]).hasClass("expression_elements")) {
-				dom_append_menu = $(hier[i]);
-				break;
-			}
-		}
-	}
-
-	var context_menu = '<div class="ui dropdown"><div class="text"></div><i class="ui icon arrow alternate circle right outline"></i><div class="menu">';
-	context_menu += '<div class="item" data-value="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
-	context_menu += '<div class="item" data-value="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
-	context_menu += '<div class="item" data-value="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
-	context_menu += '</div></div>';
-
-	context_menu = $(context_menu);
-
-	dom_append_menu.append(context_menu);
-
-	context_menu.dropdown({
-		onChange: function(value, text, $selectedItem) {
-	     switch (value) {
-	     	case Models.EXPRESSION_ELEMENTS.exp_op_exp:
-
-	     	var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.exp_op_exp, [new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true),
-	     		Models.ARITHMETIC_TYPES.plus, 
-				new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
-
-			expression_append_new_expression.push(exp);
-			break;
-
-		case Models.EXPRESSION_ELEMENTS.op_exp:
-			var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.op_exp, [Models.ARITHMETIC_TYPES.plus, 
-				new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
-
-			expression_append_new_expression.push(exp);
-			break;
-
-		case Models.EXPRESSION_ELEMENTS.par_exp_par:
-
-			var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.par_exp_par, [new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
-
-			expression_append_new_expression.push(exp);
-
-			break;
-		}
-		
-		renderExpressionElements(command, function_obj, el);
-      }
-	});
-
-}
-
-function renderElement (command, function_obj, el, expression_element) {
-
-	switch (expression_element.type_exp) {
-		case Models.EXPRESSION_ELEMENTS.exp_op_exp:
-
-			var temp_op = $('<div class="component_element"></div>');
-			var temp_exp_1 = $('<div class="component_element"></div>');
-			var temp_exp_2 = $('<div class="component_element"></div>');
-
-			el.append(temp_exp_1);
-			el.append(temp_op);
-			el.append(temp_exp_2);
-			
-			if (expression_element.itens[0].type) {
-				VariableValueMenu.renderMenu(command, expression_element.itens[0], temp_exp_1, function_obj, 2, expression_element);
-			} else {
-				renderElement(command, function_obj, temp_exp_1, expression_element.itens[0]);
-			}
-
-			renderOperator(command, function_obj, temp_op, expression_element, 1);
-
-			if (expression_element.itens[2].type) {
-				VariableValueMenu.renderMenu(command, expression_element.itens[2], temp_exp_2, function_obj, 2, expression_element);
-			} else {
-				renderElement(command, function_obj, temp_exp_2, expression_element.itens[2]);
-			}
-
-			break;
-
-		case Models.EXPRESSION_ELEMENTS.op_exp:
-			var temp_op = $('<div class="component_element"></div>');
-			var temp_exp = $('<div class="component_element"></div>');
-
-			el.append(temp_op);
-			el.append(temp_exp);
-
-			renderOperator(command, function_obj, temp_op, expression_element, 0);
-
-			if (expression_element.itens[1].type) {
-				VariableValueMenu.renderMenu(command, expression_element.itens[1], temp_exp, function_obj, 2, expression_element);
-			} else {
-				renderElement(command, function_obj, temp_exp, expression_element.itens[1]);
-			}
-			break;
-
-		case Models.EXPRESSION_ELEMENTS.par_exp_par:
-
-			var temp_par_1 = $('<div class="component_element"> ( </div>');
-			var temp_exp = $('<div class="component_element"></div>');
-			var temp_par_2 = $('<div class="component_element"> ) </div>');
-
-			el.append(temp_par_1);
-			el.append(temp_exp);
-
-			for (var j = 0; j < expression_element.itens.length; j++) {
-				if (expression_element.itens[j].type) {
-					VariableValueMenu.renderMenu(command, expression_element.itens[j], temp_exp, function_obj, 2, expression_element);
-				} else {
-					renderElement(command, function_obj, temp_exp, expression_element.itens[j]);
-				}
-			}
-			
-
-			//renderMenuAddExpression(command, function_obj, el, el, expression_element.itens);
-
-			el.append(temp_par_2);
-
-			break;
-	}
-
-}
-
-
-function renderExpression (command, function_obj, el) {
-
-	var expression_div = el.find('.expression_elements');
-	expression_div.text('');
-
-	var menu_add_item = $('<div class="menu_add_item"></div>');
-	menu_add_item.data('index_add', 0);
-
-	expression_div.append(menu_add_item);
-	
-	for (var i = 0; i < command.expression.length; i++) {
-
-		if (command.expression[i].type) {
-
-			var temp = $('<div class="expression_element"></div>');
-			temp.data('ref_element', command.expression[i]);
-			temp.data('ref_index', i);
-
-			expression_div.append(temp);
-
-			VariableValueMenu.renderMenu(command, command.expression[i], temp, function_obj);
-
-		} else if (command.expression[i] == "(" || command.expression[i] == ")") {
-
-			var temp = $('<div class="expression_element">'+command.expression[i]+'</div>');
-			temp.data('ref_element', command.expression[i]);
-			temp.data('ref_index', i);
-
-			expression_div.append(temp);
-
-		} else {
-
-			var temp = '<div class="expression_element">';
-
-			switch(command.expression[i]) {
-				case Models.ARITHMETIC_TYPES.plus:
-					temp += '+';
-					break;
-				case Models.ARITHMETIC_TYPES.minus:
-					temp += '-';
-					break;
-				case Models.ARITHMETIC_TYPES.multiplication:
-					temp += '*';
-					break;
-				case Models.ARITHMETIC_TYPES.division:
-					temp += '/';
-					break;
-				case Models.ARITHMETIC_TYPES.module:
-					temp += '%';
-					break;
-			}
-
-			temp += '</div>';
-			temp = $(temp);
-			temp.data('ref_element', command.expression[i]);
-			temp.data('ref_index', i);
-
-			expression_div.append(temp);
-
-		}
-		
-		var menu_add_item_seq = $('<div class="menu_add_item"></div>');
-		var index_temp = (i + 1);
-		menu_add_item_seq.data('index_add', index_temp);
-		expression_div.append(menu_add_item_seq);
-
-	}
-
-	addMenuItens(command, function_obj, el);
-
-}
-
-function addMenuItens (command, function_obj, expression_div) {
-	var divs_expression = expression_div.find('.menu_add_item');
-
-	for (var i = 0; i < divs_expression.length; i++) {
-
-		var temp = $(divs_expression[i]).data('index_add');
-
-		var context_menu = '<div class="ui dropdown context_menu_clear"><i class="ui icon plus square outline"></i><div class="menu">';
-		context_menu += '<div class="item" data-option="value" data-index="'+temp+'">'+LocalizedStrings.getUI('text_value')+'</div>';
-		context_menu += '<div class="item" data-option="operator" data-index="'+temp+'">'+LocalizedStrings.getUI('text_operator')+'</div>';
-		context_menu += '<div class="item" data-option="parentheses" data-index="'+temp+'">'+LocalizedStrings.getUI('text_parentheses')+'</div>';
-		context_menu += '</div></div>';
-
-		context_menu = $(context_menu);
-
-		$(divs_expression[i]).append(context_menu);
-
-		context_menu.dropdown({
-	      on: 'hover',
-	      onChange: function(value, text, $selectedItem) {
-    		switch ($selectedItem.data('option')) {
-    			case "value":
-    				command.expression.splice($selectedItem.data('index'), 0, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
-    				renderExpression(command, function_obj, expression_div);
-    				break;
-    			case "operator":
-    				command.expression.splice($selectedItem.data('index'), 0, Models.ARITHMETIC_TYPES.plus);
-    				renderExpression(command, function_obj, expression_div);
-    				break;
-    			case "parentheses":
-    				command.expression.splice($selectedItem.data('index'), 0, "(");
-    				command.expression.splice($selectedItem.data('index') + 1, 0, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
-    				command.expression.splice($selectedItem.data('index') + 2, 0, ")");
-    				renderExpression(command, function_obj, expression_div);
-    				break;
-    		 }
-        	}
-	    });
-
-	}
-}
-
-
-function addHandlers (command, function_obj, attribution_dom) {
-
-	attribution_dom.find('.button_remove_command').on('click', function() {
-		if (CommandsManagement.removeCommand(command, function_obj, attribution_dom)) {
-			attribution_dom.fadeOut();
-		}
-	});
-
-	attribution_dom.find('.button_refresh_attribution').on('click', function() {
-		renderExpressionElements(command, function_obj, attribution_dom);
-	});
-}
-
-export function renderMenuOperations (command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected) {
-
-	/*console.log("recebido o seguinte DOM: ");
-	console.log(dom_object);
-
-	if (dom_object.hasClass('var_attributed')) {
-		return;
-	} else {
-		var hier = dom_object.parentsUntil(".command_container");
-		for (var i = 0; i < hier.length; i++) {
-			if ($(hier[i]).hasClass('var_attributed') || $(hier[i]).hasClass('parameters_function_called')) {
-				return;
-			}
-		}
-
-
-		
-	}
-
-	dom_object.find('.context_menu_clear').remove();
-
-
-	var menu_operations = '<div class="ui dropdown menu_operations"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
-
-	for (var tm in Models.ARITHMETIC_TYPES) {
-
-		menu_operations += '<div class="item" data-option="'+tm+'">'+LocalizedStrings.getUI('btn_arithmetic_' + tm)+'</div>';
-    }
-    menu_operations += '<div class="item" data-option="clear">'+LocalizedStrings.getUI('btn_clear')+'</div>';
-	
-    menu_operations += '</div></div>';
-
-    menu_operations = $(menu_operations);
-
-    dom_object.append(menu_operations);
-
-    menu_operations.dropdown({
-    	onChange: function(value, text, $selectedItem) {
-    		switch ($($selectedItem).data('option')) {
-    			case "clear":
-	    			$(dom_object).text('');
-		     	 	VariableValueMenu.renderMenu(command, ref_object, dom_object, function_obj);
-    				break;
-    			default:
-    				createExpressionAround(command, ref_object, dom_object, function_obj);
-    				menu_operations.find('.text').text('');
-    		}
-        }
-    });*/
-}
-
-function createExpressionAround (command, ref_object, dom_object, function_obj) {
-	$('<span> ( </span>').insertBefore(dom_object);
-	$('<span> ) </span>').insertAfter(dom_object);
-
-	VariableValueMenu.renderMenu(command, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true), dom_object, function_obj);
-}
-

+ 0 - 27
ivprogh/js/visualUI/commands/break.js

@@ -1,27 +0,0 @@
-import $ from 'jquery';
-import { Types } from '../types';
-import * as Models from '../ivprog_elements';
-import { LocalizedStrings } from '../../services/localizedStringsService';
-import * as CommandsManagement from '../commands';
-
-export function createFloatingCommand () {
-	return $('<div class="ui comment created_element"> <i class="ui icon small quote left"></i> <span> '+LocalizedStrings.getUI('text_break')+' </span></div>');
-}
-
-export function renderCommand (command, function_obj) {
-	var el = $('<div class="ui comment command_container"> <i class="ui icon small quote left"></i> <i class="ui icon times red button_remove_command"></i> <span>'+LocalizedStrings.getUI('text_break')+'</span> </div>');
-	el.data('command', command);
-
-	addHandlers(command, function_obj, el);
-
-	return el;
-}
-
-function addHandlers (command, function_obj, break_dom) {
-
-	break_dom.find('.button_remove_command').on('click', function() {
-		if (CommandsManagement.removeCommand(command, function_obj, break_dom)) {
-			break_dom.fadeOut();
-		}
-	});
-}

+ 0 - 36
ivprogh/js/visualUI/commands/comment.js

@@ -1,36 +0,0 @@
-import $ from 'jquery';
-import { Types } from '../types';
-import * as Models from '../ivprog_elements';
-import { LocalizedStrings } from '../../services/localizedStringsService';
-import * as GlobalsManagement from '../globals';
-import * as VariablesManagement from '../variables';
-import * as VariableValueMenu from './variable_value_menu';
-import * as CommandsManagement from '../commands';
-
-export function createFloatingCommand () {
-	return $('<div class="ui comment created_element"> <i class="ui icon small quote left"></i> <span class="span_comment_text" "> '+LocalizedStrings.getUI('text_comment')+' </span></div>');
-}
-
-export function renderCommand (command, function_obj) {
-	var el = $('<div class="ui comment command_container"> <i class="ui icon small quote left command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="var_value_menu_div"></div> <div class="div_comment_text">'+'</div> </div>');
-	el.data('command', command);
-
-	addHandlers(command, function_obj, el);
-
-	renderTextComment(command, function_obj, el);
-
-	return el;
-}
-
-function renderTextComment (command, function_obj, el) {
-	VariableValueMenu.renderMenu(command, command.comment_text, el.find('.var_value_menu_div'), function_obj, 20);
-}
-
-function addHandlers (command, function_obj, comment_dom) {
-
-	comment_dom.find('.button_remove_command').on('click', function() {
-		if (CommandsManagement.removeCommand(command, function_obj, comment_dom)) {
-			comment_dom.fadeOut();
-		}
-	});
-}

+ 0 - 231
ivprogh/js/visualUI/commands/conditional_expression.js

@@ -1,231 +0,0 @@
-import $ from 'jquery';
-import { Types } from '../types';
-import * as Models from '../ivprog_elements';
-import { LocalizedStrings } from '../../services/localizedStringsService';
-import * as GlobalsManagement from '../globals';
-import * as VariablesManagement from '../variables';
-import * as VariableValueMenuManagement from './variable_value_menu';
-
-
-export function renderExpression (command, expression, function_obj, initial_el_to_render) {
-
-	if (expression.expression == null || expression.expression.length < 1) {
-
-		renderStartMenu(command, expression, function_obj, initial_el_to_render);
-
-	} else {
-		
-		var main_div = $('<div class="expression_elements"></div>');
-
-		switch (expression.expression.type) {
-			case Models.EXPRESSION_TYPES.exp_logic:
-				renderLogicExpression(command, expression, expression.expression, function_obj, main_div, initial_el_to_render);
-				break;
-			case Models.EXPRESSION_TYPES.exp_arithmetic:
-				renderArithmeticExpression(command, expression, expression.expression, function_obj, main_div);
-				break;
-		}
-
-		initial_el_to_render.append(main_div);	
-	}
-}
-
-function renderArithmeticOperator (command, all_expression, expression_arithmetic, arithmetic_operator, function_obj, element_to_append) {
-
-	var menu_operator = $('<div class="ui dropdown"><div class="text"></div><i class="dropdown icon"></i></div>');
-	menu_operator.dropdown({
-	    values: [
-	      {
-	        name     : '>',
-	        value    : Models.ARITHMETIC_COMPARISON.greater_than,
-	        selected : (arithmetic_operator == Models.ARITHMETIC_COMPARISON.greater_than)
-	      },
-	      {
-	        name     : '<',
-	        value    : Models.ARITHMETIC_COMPARISON.less_than,
-	        selected : (arithmetic_operator == Models.ARITHMETIC_COMPARISON.less_than)
-	      },
-	      {
-	        name     : '==',
-	        value    : Models.ARITHMETIC_COMPARISON.equals_to,
-	        selected : (arithmetic_operator == Models.ARITHMETIC_COMPARISON.equals_to)
-	      },
-	      {
-	        name     : '!=',
-	        value    : Models.ARITHMETIC_COMPARISON.not_equals_to,
-	        selected : (arithmetic_operator == Models.ARITHMETIC_COMPARISON.not_equals_to)
-	      },
-	      {
-	        name     : '>=',
-	        value    : Models.ARITHMETIC_COMPARISON.greater_than_or_equals_to,
-	        selected : (arithmetic_operator == Models.ARITHMETIC_COMPARISON.greater_than_or_equals_to)
-	      },
-	      {
-	        name     : '<=',
-	        value    : Models.ARITHMETIC_COMPARISON.less_than_or_equals_to,
-	        selected : (arithmetic_operator == Models.ARITHMETIC_COMPARISON.less_than_or_equals_to)
-	      }
-	    ],
-	    onChange: function(value, text, $selectedItem) {
-	    	expression_arithmetic.operator = value;
-	    }
-	  })
-	;
-
-	element_to_append.append(menu_operator);
-}
-
-function renderLogicOperator (command, all_expression, expression_logic, logic_operator, function_obj, element_to_append, initial_el_to_render) {
-
-	var menu_operator = $('<div class="ui dropdown"><div class="text"></div><i class="dropdown icon"></i></div>');
-	menu_operator.dropdown({
-	    values: [
-	      {
-	        name     : '==',
-	        value    : Models.LOGIC_COMPARISON.equals_to,
-	        selected : (logic_operator == Models.LOGIC_COMPARISON.equals_to)
-	      },
-	      {
-	        name     : '!=',
-	        value    : Models.LOGIC_COMPARISON.not_equals_to,
-	        selected : (logic_operator == Models.LOGIC_COMPARISON.not_equals_to)
-	      },
-	      {
-	        name     : '&&',
-	        value    : Models.LOGIC_COMPARISON.and,
-	        selected : (logic_operator == Models.LOGIC_COMPARISON.and)
-	      },
-	      {
-	        name     : '||',
-	        value    : Models.LOGIC_COMPARISON.or,
-	        selected : (logic_operator == Models.LOGIC_COMPARISON.or)
-	      }
-	    ],
-	    onChange: function(value, text, $selectedItem) {
-	    	if ($selectedItem) {
-		    	expression_logic.operator = value;
-		    	if (expression_logic.second_operand == null) {
-		    		expression_logic.second_operand = new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true);
-		    		initial_el_to_render.empty();
-		    		renderExpression(command, all_expression, function_obj, initial_el_to_render);
-		    	}
-	    	}
-	    }
-	  });
-
-	element_to_append.append(menu_operator);
-
-}
-
-
-function renderLogicExpression (command, all_expression, expression_logic, function_obj, element_to_append, initial_el_to_render) {
-
-	var exp_el_par_1 = $(' <span class="span_command_spec"> </span> ');
-	var exp_el_expr_el_1 = $('<div class="expression_element"></div>');
-	var exp_el_expr_operand = $('<div class="expression_element"></div>');
-	var exp_el_expr_el_2 = $('<div class="expression_element"></div>');
-	var exp_el_par_2 = $(' <span class="span_command_spec"> </span> ');
-
-	if (expression_logic.first_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
-		renderLogicExpression(command, all_expression, expression_logic.first_operand, function_obj, exp_el_expr_el_1);
-	} else if (expression_logic.first_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
-		renderArithmeticExpression(command, all_expression, expression_logic.first_operand, function_obj, exp_el_expr_el_1);
-	} else {
-		VariableValueMenuManagement.renderMenu(command, expression_logic.first_operand, exp_el_expr_el_1, function_obj);
-	}
-
-	element_to_append.append(exp_el_par_1);
-	element_to_append.append(exp_el_expr_el_1);
-
-	renderLogicOperator(command, all_expression, expression_logic, expression_logic.operator, function_obj, exp_el_expr_operand, initial_el_to_render);
-
-	element_to_append.append(exp_el_expr_operand);
-
-	if (expression_logic.second_operand) {
-		if (expression_logic.second_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
-			renderLogicExpression(command, all_expression, expression_logic.second_operand, function_obj, exp_el_expr_el_2);
-		} else if (expression_logic.second_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
-			renderArithmeticExpression(command, all_expression, expression_logic.second_operand, function_obj, exp_el_expr_el_2);
-		} else {
-			VariableValueMenuManagement.renderMenu(command, expression_logic.second_operand, exp_el_expr_el_2, function_obj);
-		}
-
-		element_to_append.append(exp_el_expr_el_2);
-	}
-
-	element_to_append.append(exp_el_par_2);
-
-}
-
-function renderArithmeticExpression (command, all_expression, expression_arithmetic, function_obj, element_to_append) {
-
-	var exp_el_par_1 = $(' <span class="span_command_spec"> </span> ');
-	var exp_el_expr_el_1 = $('<div class="expression_element"></div>');
-	var exp_el_expr_operand = $('<div class="expression_element"></div>');
-	var exp_el_expr_el_2 = $('<div class="expression_element"></div>');
-	var exp_el_par_2 = $(' <span class="span_command_spec"> </span> ');
-
-
-	if (expression_arithmetic.first_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
-		renderLogicExpression(command, all_expression, expression_arithmetic.first_operand, function_obj, exp_el_expr_el_1);
-	} else if (expression_arithmetic.first_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
-		renderArithmeticExpression(command, all_expression, expression_arithmetic.first_operand, function_obj, exp_el_expr_el_1);
-	} else {
-		VariableValueMenuManagement.renderMenu(command, expression_arithmetic.first_operand, exp_el_expr_el_1, function_obj);
-	}
-
-	if (expression_arithmetic.second_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
-		renderLogicExpression(command, all_expression, expression_arithmetic.second_operand, function_obj, exp_el_expr_el_2);
-	} else if (expression_arithmetic.second_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
-		renderArithmeticExpression(command, all_expression, expression_arithmetic.second_operand, function_obj, exp_el_expr_el_2);
-	} else {
-		VariableValueMenuManagement.renderMenu(command, expression_arithmetic.second_operand, exp_el_expr_el_2, function_obj);
-	}
-
-	renderArithmeticOperator(command, all_expression, expression_arithmetic, expression_arithmetic.operator, function_obj, exp_el_expr_operand);
-
-	element_to_append.append(exp_el_par_1);
-	element_to_append.append(exp_el_expr_el_1);
-	element_to_append.append(exp_el_expr_operand);
-	element_to_append.append(exp_el_expr_el_2);
-	element_to_append.append(exp_el_par_2);
-}
-
-function renderStartMenu (command, expression, function_obj, initial_el_to_render) {
-	var start_menu = '';
-	start_menu += '<div class="ui dropdown menu_start_rendered"><div class="text"><i>'+LocalizedStrings.getUI('expression_menu_select')+'</i></div><i class="dropdown icon"></i><div class="menu">';
-	start_menu += '<div class="item" data-exp="'+Models.EXPRESSION_TYPES.exp_logic+'">'+LocalizedStrings.getUI('text_logic_expression')+'</div>';
-	start_menu += '<div class="item" data-exp="'+Models.EXPRESSION_TYPES.exp_arithmetic+'">'+LocalizedStrings.getUI('text_arithmetic_expression')+'</div>';
-	start_menu += '</div></div>';
-	start_menu = $(start_menu);
-
-	start_menu.dropdown({
-		onChange: function(value, text, $selectedItem) {
-			switch ($selectedItem.data('exp')) {
-				case Models.EXPRESSION_TYPES.exp_logic:
-					expression.expression = 
-						new Models.LogicExpression(false, 
-							new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
-					break;
-				case Models.EXPRESSION_TYPES.exp_arithmetic:
-					expression.expression = 
-						new Models.ArithmeticExpression(
-							new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true), 
-							new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true), 
-							Models.ARITHMETIC_COMPARISON.less_than);
-					break;
-			}
-
-			initial_el_to_render.html('');
-
-			renderExpression(command, expression, function_obj, initial_el_to_render);
-
-    	}
-	});
-
-	initial_el_to_render.append(' <span class="span_command_spec"> </span> ');
-	
-	initial_el_to_render.append(start_menu);
-
-	initial_el_to_render.append(' <span class="span_command_spec"> </span> ');
-}

+ 0 - 94
ivprogh/js/visualUI/commands/contextualized_menu.js

@@ -1,94 +0,0 @@
-import $ from 'jquery';
-import { Types } from '../types';
-import * as Models from '../ivprog_elements';
-import { LocalizedStrings } from '../../services/localizedStringsService';
-import * as CommandsManagement from '../commands';
-import * as VariableValueMenuManagement from './variable_value_menu';
-import * as SwitchManagement from './switch';
-
-import * as RepeatNTimesManagement from './repeatNtimes';
-
-export function renderMenu (command, dom_where_render, function_obj, dom_command) {
-
-	var menu_div = '<div class="ui dropdown menu_commands" ><i class="icon code"></i> <div class="menu"> ';
-
-	if ((command.type == Models.COMMAND_TYPES.repeatNtimes) 
-		|| (command.type == Models.COMMAND_TYPES.whiletrue) 
-		|| (command.type == Models.COMMAND_TYPES.dowhiletrue)) {
-
-		menu_div += '<a class="item" data-command="'+Models.COMMAND_TYPES.break+'"><i class="download icon"></i> '+LocalizedStrings.getUI('btn_break')+' </a>';
-
-	} else {
-
-		menu_div += '<a class="item" data-command="'+Models.COMMAND_TYPES.break+'"><i class="download icon"></i> '+LocalizedStrings.getUI('btn_break')+' </a>';
-		menu_div += '<a class="item" data-command="'+Models.COMMAND_TYPES.switchcase+'"><i class="download icon"></i> '+LocalizedStrings.getUI('btn_case')+' </a>';
-
-	}
-
-	menu_div += '</div></div>';
-
-	menu_div = $(menu_div);
-  	
-	dom_where_render.append(menu_div);
-
-	addHandlers(command, dom_where_render, function_obj, dom_command);
-}
-
-function addHandlers (command, dom_where_render, function_obj, dom_command) {
-
-	dom_where_render.find('.menu_commands').dropdown({
-      on: 'hover'
-    });
-	
-	dom_where_render.find('.menu_commands a').on('click', function(evt){
-
-		if ((command.type == Models.COMMAND_TYPES.repeatNtimes) 
-			|| (command.type == Models.COMMAND_TYPES.whiletrue) 
-			|| (command.type == Models.COMMAND_TYPES.dowhiletrue)) {
-
-				if (command.commands_block == null || command.commands_block.length == 0) {
-
-			      command.commands_block = [];
-
-			      var new_cmd = CommandsManagement.genericCreateCommand($(this).data('command'));
-			      command.commands_block.push(new_cmd);
-
-			      CommandsManagement.renderCommand(new_cmd, dom_command.find('.block_commands'), 3, function_obj);
-
-			    } else {
-			      CommandsManagement.createFloatingCommand(function_obj, dom_command.find('.block_commands'), $(this).data('command'), evt);
-			    }
-
-		} else {
-
-			switch ($(this).data('command')) {
-				case Models.COMMAND_TYPES.break:
-					CommandsManagement.createFloatingCommand(function_obj, null, $(this).data('command'), evt);
-					break;
-
-				case Models.COMMAND_TYPES.switchcase:
-					addCaseToSwitch(command, dom_where_render, function_obj, dom_command);
-					break;
-			}
-
-		}
-
-	});
-}
-
-function addCaseToSwitch (command, dom_where_render, function_obj, dom_command) {
-	
-	if ((command.cases == null)) {
-		command.cases = [];
-	}
-	
-	var sc = new Models.SwitchCase(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
-
-	command.cases.push(sc);
-
-	SwitchManagement.renderCase(sc, command, function_obj, dom_command.find('.all_cases_div'));
-
-}
-
-
-

+ 0 - 49
ivprogh/js/visualUI/commands/dowhiletrue.js

@@ -1,49 +0,0 @@
-import $ from 'jquery';
-import { Types } from '../types';
-import * as Models from '../ivprog_elements';
-import { LocalizedStrings } from '../../services/localizedStringsService';
-import * as GlobalsManagement from '../globals';
-import * as VariablesManagement from '../variables';
-import * as CommandsManagement from '../commands';
-import * as ConditionalExpressionManagement from './conditional_expression';
-import * as ContextualizedMenu from './contextualized_menu';
-
-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>');
-}
-
-export function renderCommand (command, function_obj) {
-	var ret = '';
-	ret += '<div class="ui dowhiletrue command_container"> <i class="ui icon small random command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="ui context_menu"></div>  <span class="span_command_spec"> ' + LocalizedStrings.getUI('text_command_do') + ' </span>';
-	ret += '<div class="ui block_commands" data-subblock="" data-idcommand="">';
-	ret += '</div>';
-	ret += ' <span class="span_command_spec"> ' + LocalizedStrings.getUI('text_code_while') + ' </span> <span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="span_command_spec"> ) </span>';
-	ret += '</div>';
-
-	var el = $(ret);
-	el.data('command', command);
-
-	addHandlers(command, function_obj, el);
-
-	ContextualizedMenu.renderMenu(command, el.find('.context_menu'), function_obj, el);
-
-	ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
-
-	if (command.commands_block) {
-		for (var j = 0; j < command.commands_block.length; j++) {
-		    CommandsManagement.renderCommand(command.commands_block[j], $(el.find('.block_commands')[0]), 3, function_obj);
-		}
-	}
-
-	return el;
-}
-
-
-function addHandlers (command, function_obj, dowhiletrue_dom) {
-
-	dowhiletrue_dom.find('.button_remove_command').on('click', function() {
-		if (CommandsManagement.removeCommand(command, function_obj, dowhiletrue_dom)) {
-			dowhiletrue_dom.fadeOut();
-		}
-	});
-}

+ 0 - 32
ivprogh/js/visualUI/commands/functioncall.js

@@ -1,32 +0,0 @@
-import $ from 'jquery';
-import { Types } from '../types';
-import * as Models from '../ivprog_elements';
-import { LocalizedStrings } from '../../services/localizedStringsService';
-import * as GlobalsManagement from '../globals';
-import * as VariablesManagement from '../variables';
-import * as VariableValueMenu from './variable_value_menu';
-import * as CommandsManagement from '../commands';
-
-export function createFloatingCommand () {
-	return $('<div class="ui functioncall created_element"> <i class="hand point right icon"></i> <span> funcao() </span></div>');
-}
-
-export function renderCommand (command, function_obj) {
-	var el = $('<div class="ui functioncall command_container"> <i class="hand point right icon command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="var_value_menu_div"></div> </div>');
-	el.data('command', command);
-
-	VariableValueMenu.renderMenu(command, command.function_called, el.find('.var_value_menu_div'), function_obj);
-
-	addHandlers(command, function_obj, el);
-
-	return el;
-}
-
-function addHandlers (command, function_obj, functioncall_dom) {
-
-	functioncall_dom.find('.button_remove_command').on('click', function() {
-		if (CommandsManagement.removeCommand(command, function_obj, functioncall_dom)) {
-			functioncall_dom.fadeOut();
-		}
-	});
-}

+ 0 - 60
ivprogh/js/visualUI/commands/iftrue.js

@@ -1,60 +0,0 @@
-import $ from 'jquery';
-import { Types } from '../types';
-import * as Models from '../ivprog_elements';
-import { LocalizedStrings } from '../../services/localizedStringsService';
-import * as GlobalsManagement from '../globals';
-import * as VariablesManagement from '../variables';
-import * as CommandsManagement from '../commands';
-import * as ConditionalExpressionManagement from './conditional_expression';
-
-export function createFloatingCommand () {
-	return $('<div class="ui iftrue created_element"> <i class="ui icon small random"></i> <span> if (x < 1) { } </span></div>');
-}
-
-export function renderCommand (command, function_obj) {
-	var ret = '';
-	ret += '<div class="ui iftrue command_container"><div class="ui data_block_if" data-if="true">  <i class="ui icon small random command_drag"></i> <i class="ui icon times red button_remove_command"></i>';
-	ret += '<span class="span_command_spec"> ' + LocalizedStrings.getUI('text_if') + '</span>';
-	ret += ' <span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="span_command_spec"> ) </span>';
-	ret += '<span> </span> ';
-	ret += '<div class="ui block_commands commands_if conditional_comands_block" data-if="true">';
- 	ret += '</div></div>';
-	ret += '<div class="ui data_block_else" data-else="true"> <span class="span_command_spec"> ' + LocalizedStrings.getUI('text_else') + ' </span>';
-	ret += '<div class="ui block_commands commands_else conditional_comands_block" data-else="true">';
-	ret += '</div>';
-	ret += '<span></span></div>';
-	ret += '</div>';
-
-	var el = $(ret);
-	el.data('command', command);
-	el.find('.block_commands').data('command', command);
-	el.find('.data_block_if').data('command', command);
-	el.find('.data_block_else').data('command', command);
-
-	addHandlers(command, function_obj, el);
-
-	ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
-
-	if (command.commands_block) {
-		for (var j = 0; j < command.commands_block.length; j++) {
-		    CommandsManagement.renderCommand(command.commands_block[j], $(el.find('.commands_if')[0]), 3, function_obj);
-		}
-	}
-	if (command.commands_else) {
-		for (var j = 0; j < command.commands_else.length; j++) {
-		    CommandsManagement.renderCommand(command.commands_else[j], $(el.find('.commands_else')[0]), 3, function_obj);
-		}
-	}
-
-	return el;
-}
-
-
-function addHandlers (command, function_obj, iftrue_dom) {
-
-	iftrue_dom.find('.button_remove_command').on('click', function() {
-		if (CommandsManagement.removeCommand(command, function_obj, iftrue_dom)) {
-			iftrue_dom.fadeOut();
-		}
-	});
-}

+ 0 - 33
ivprogh/js/visualUI/commands/reader.js

@@ -1,33 +0,0 @@
-import $ from 'jquery';
-import { Types } from '../types';
-import * as Models from '../ivprog_elements';
-import { LocalizedStrings } from '../../services/localizedStringsService';
-import * as GlobalsManagement from '../globals';
-import * as VariablesManagement from '../variables';
-import * as VariableValueMenu from './variable_value_menu';
-import * as CommandsManagement from '../commands';
-
-export function createFloatingCommand () {
-	return $('<div class="ui reader created_element"> <i class="ui icon small download"></i> <span> '+LocalizedStrings.getUI('text_command_read')+' var </span></div>');
-}
-
-export function renderCommand (command, function_obj) {
-	var el = '<div class="ui reader command_container"> <i class="ui icon small download command_drag"></i> <i class="ui icon times red button_remove_command"></i> <span class="span_command_spec">'+LocalizedStrings.getUI('text_command_read')+' ( </span> <div class="var_value_menu_div"></div> <span class="close_parentheses span_command_spec">)</span> </div>';
-	
-	el = $(el);
-	el.data('command', command);
-
-	VariableValueMenu.renderMenu(command, command.variable_value_menu, el.find('.var_value_menu_div'), function_obj);
-
-	addHandlers(command, function_obj, el);
-
-	return el;
-}
-
-function addHandlers (command, function_obj, reader_dom) {
-	reader_dom.find('.button_remove_command').on('click', function() {
-		if (CommandsManagement.removeCommand(command, function_obj, reader_dom)) {
-			reader_dom.fadeOut();
-		}
-	});
-}

File diff ditekan karena terlalu besar
+ 0 - 170
ivprogh/js/visualUI/commands/repeatNtimes.js


+ 0 - 32
ivprogh/js/visualUI/commands/return.js

@@ -1,32 +0,0 @@
-import $ from 'jquery';
-import { Types } from '../types';
-import * as Models from '../ivprog_elements';
-import { LocalizedStrings } from '../../services/localizedStringsService';
-import * as GlobalsManagement from '../globals';
-import * as VariablesManagement from '../variables';
-import * as VariableValueMenu from './variable_value_menu';
-import * as CommandsManagement from '../commands';
-
-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>');
-	el.data('command', command);
-
-	addHandlers(command, function_obj, el);
-
-	VariableValueMenu.renderMenu(command, command.variable_value_menu, el.find('.var_value_menu_div'), function_obj);
-
-	return el;
-}
-
-function addHandlers (command, function_obj, return_dom) {
-
-	return_dom.find('.button_remove_command').on('click', function() {
-		if (CommandsManagement.removeCommand(command, function_obj, return_dom)) {
-			return_dom.fadeOut();
-		}
-	});
-}

+ 0 - 0
ivprogh/js/visualUI/commands/switch.js


Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini