Browse Source

Change grammar equal char

Lucas de Souza 5 years ago
parent
commit
80aeecf0ea

+ 2 - 1
grammar/en/ivprog.g4

@@ -129,7 +129,8 @@ COMMA
   ;
 
 EQUAL
-  : '='
+  : '<-'
+  | '←'
   ;
 
 SUM_OP

+ 2 - 1
grammar/es/ivprog.g4

@@ -129,7 +129,8 @@ COMMA
   ;
 
 EQUAL
-  : '='
+  : '<-'
+  | '←'
   ;
 
 SUM_OP

+ 2 - 1
grammar/pt/ivprog.g4

@@ -129,7 +129,8 @@ COMMA
   ;
 
 EQUAL
-  : '='
+  : '<-'
+  | '←'
   ;
 
 SUM_OP

+ 17 - 5
js/visualUI/functions.js

@@ -15,6 +15,7 @@ import * as AlgorithmManagement from './algorithm';
 import * as Utils from './utils';
 import { registerUserEvent, ActionTypes } from "./../services/userLog";
 import VersionInfo from './../../.ima_version.json';
+import * as TextEditor from "./text_editor";
 
 var counter_new_functions = 0;
 var counter_new_parameters = 0;
@@ -854,6 +855,11 @@ export function initVisualUI () {
        updateSequenceGlobals(evt.oldIndex, evt.newIndex);
     }
   });
+
+  TextEditor.initTextEditor("ivprog-text-editor");
+  if (settingsProgrammingTypes != "textual") {
+    TextEditor.disable(true);
+  }
   
 }
 
@@ -1011,16 +1017,22 @@ function toggleConsole (is_running) {
 // }
 
 function toggleTextualCoding () {
-  var code = CodeManagement.generate();
-
-  if (code == null) {
-    return;
+  let code = null;
+  if (settingsProgrammingTypes != "textual") {
+    code = CodeManagement.generate();
+    if (code == null) {
+      return;
+    }
   }
 
+
   $('.ivprog_visual_panel').css('display', 'none');
   $('.ivprog_textual_panel').css('display', 'block');
   $('.ivprog_textual_panel').removeClass('loading');
-  $('.ivprog_textual_code').text(code);
+  TextEditor.updateEditor();
+  if (code != null)
+    TextEditor.setCode(code);
+  //$('.ivprog_textual_code').text(code);
 
   $('.visual_coding_button').removeClass('active');
   $('.textual_coding_button').addClass('active');

+ 6 - 1
package-lock.json

@@ -1,6 +1,6 @@
 {
   "name": "ivprog",
-  "version": "1.1.0",
+  "version": "4.3.2",
   "lockfileVersion": 1,
   "requires": true,
   "dependencies": {
@@ -1964,6 +1964,11 @@
       "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz",
       "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c="
     },
+    "codemirror": {
+      "version": "5.48.0",
+      "resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.48.0.tgz",
+      "integrity": "sha512-3Ter+tYtRlTNtxtYdYNPxGxBL/b3cMcvPdPm70gvmcOO2Rauv/fUEewWa0tT596Hosv6ea2mtpx28OXBy1mQCg=="
+    },
     "collection-visit": {
       "version": "1.0.0",
       "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz",

+ 1 - 0
package.json

@@ -47,6 +47,7 @@
   },
   "dependencies": {
     "antlr4": "^4.7.2",
+    "codemirror": "^5.48.0",
     "decimal.js": "^10.1.1",
     "line-i18n": "git+https://git.lcalion.com/LInE/line-i18n.git",
     "melanke-watchjs": "^1.5.0",

+ 2 - 1
templates/index.html

@@ -7,6 +7,7 @@
     <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.0/semantic.min.css" integrity="sha256-9mbkOfVho3ZPXfM7W8sV2SndrGDuh7wuyLjtsWeTI1Q=" crossorigin="anonymous" />
     <link rel="stylesheet" type="text/css" href="css/ivprog-visual-1.0.css">
     <link rel="stylesheet" type="text/css" href="css/ivprog-term.css">
+    <link rel="stylesheet" type="text/css" href="css/codemirror.css">
     <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
     <script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"
       integrity="sha256-KM512VNnjElC30ehFwehXjx1YCHPiQkOPmqnrWtpccM="
@@ -97,7 +98,7 @@
 
 
         <div class="ui one column container segment ivprog_textual_panel loading" style="display: none;">
-          <textarea class="ivprog_textual_code"></textarea>
+          <textarea id="ivprog-text-editor" class=".ivprog_textual_code" rows="20" cols="35"></textarea>
         </div>
         <div id='ivprog-term-div' class="six column wide">
           

+ 4 - 0
templates/runner.html

@@ -27,6 +27,10 @@
   <title></title>
   <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
   <script type="text/javascript" src="js/jquery.json-editor.min.js"></script>
+  <script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"
+      integrity="sha256-KM512VNnjElC30ehFwehXjx1YCHPiQkOPmqnrWtpccM="
+      crossorigin="anonymous"></script>
+  <script src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.0/semantic.min.js" integrity="sha256-x1fC6BXl6BwnUhfQqqqC0Fd/n12wH+u8u9va6+E7xaA=" crossorigin="anonymous"></script>
 </head>
 <body>
     <div style="padding-top: 50px;content: ''"></div>

+ 1 - 0
webpack.config.js

@@ -62,6 +62,7 @@ module.exports = {
         {from:'js/iassign-integration-functions.js', to:path.resolve(__dirname, 'build/js')},
         {from: 'img/trash-icon.png', to:path.resolve(__dirname, 'build/img')},
         {from:'js/jquery.json-editor.min.js', to:path.resolve(__dirname, 'build/js')},
+        {from:'node_modules/codemirror/lib/codemirror.css', to:path.resolve(__dirname, 'build/css')},
         /*{from:'index.html', to:path.resolve(__dirname, 'build')},
         {from:'runner.html', to:path.resolve(__dirname, 'build')},*/
       ])