Ver código fonte

Fix some typos and enable webpack watch

Lucas de Souza 5 anos atrás
pai
commit
6ea66a79a2

+ 0 - 2
js/io/domOutput.js

@@ -9,8 +9,6 @@ export class DOMOutput extends Output {
   }
 
   sendOutput (text) {
-    text = text.replace(/^"/, '');
-    text = text.replace(/"$/, '');
     text = text.replace("\n", '</br>');
     text = text.replace(/\t/g,'&#9;');
     const span = $('<span />').addClass('ivprog-io-output-text').html(text);

+ 1 - 1
js/processor/compatibilityTable.js

@@ -35,7 +35,7 @@ function buildInfixMultiSubTable () {
 function buildInfixDivTable () {
   const table = [[], [], [], []];
 
-  table[Types.INTEGER.ord][Types.INTEGER.ord] = Types.REAL;
+  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;

+ 2 - 4
js/processor/ivprogProcessor.js

@@ -707,15 +707,13 @@ export class IVProgProcessor {
         case Operators.MULT.ord: {
           result = left.value * right.value;
           if (resultType === Types.INTEGER)
-            result = Math.round(result);
-          console.log("R multi" + result);
+            result = Math.trunc(result);
           return new StoreObject(resultType, result);
         }
         case Operators.DIV.ord: {
           result = left.value / right.value;
           if (resultType === Types.INTEGER)
-            result = Math.round(result);
-          console.log("R div:" +result);
+            result = Math.trunc(result);
           return new StoreObject(resultType, result);
         }
         case Operators.MOD.ord:

+ 1 - 0
webpack.config.js

@@ -3,6 +3,7 @@ var webpack = require('webpack');
 module.exports = {
     entry: './js/main.js',
     mode: 'development',
+    watch: true,
     output: {
         path: path.resolve(__dirname, 'build'),
         filename: 'ivprog.bundle.js'