Explorar o código

Refactor code to use webpack and define a UI entry point

Lucas de Souza %!s(int64=5) %!d(string=hai) anos
pai
achega
e9fc3d5d90
Modificáronse 3 ficheiros con 96 adicións e 0 borrados
  1. 3 0
      index.html
  2. 76 0
      js/visualUI/visual.js
  3. 17 0
      runner.html

+ 3 - 0
index.html

@@ -12,6 +12,9 @@
     <script src="js/iassign-integration-functions.js"></script>
     <script src="i18n/i18n-engine.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>
     

+ 76 - 0
js/visualUI/visual.js

@@ -0,0 +1,76 @@
+import { Types } from './../ast/types';
+
+const tiposComandos = Object.freeze({comment:"comment", reader:"reader", writer:"writer"});
+
+export class Variavel {
+
+  constructor (tipo, nome, valor, dimensoes = 0, eh_constante = false, linhas = 0, colunas = 0) {
+    this.tipo = tipo;
+    this.nome = nome;
+    this.valor = valor;
+    this.dimensoes = dimensoes;
+    this.eh_constante = eh_constante;
+    this.linhas = linhas;
+    this.colunas = colunas;
+  }
+}
+
+export class Funcao {
+
+  constructor (nome, tipo_retorno = Types.VOID, dimensoes_retorno = 0, lista_parametros = null, eh_principal = false, esta_oculta = false, variaveis = [], comentario_funcao = null) {
+    this.nome = nome;
+    this.tipo_retorno = tipo_retorno;
+    this.dimensoes_retorno = dimensoes_retorno;
+    this.lista_parametros = lista_parametros;
+    this.eh_principal = eh_principal;
+    this.esta_oculta = esta_oculta;
+    this.variaveis = variaveis;
+    this.comentario_funcao = comentario_funcao;
+    this.comandos = [];
+  }
+}
+
+export class Comentario {
+  
+  constructor (texto_comentario) {
+    this.tipo = tiposComandos.comment;
+    this.texto_comentario = texto_comentario;
+  }
+}
+
+export class Comando {
+
+  constructor (tipo) {
+    this.tipo = tipo;
+  }
+} 
+
+export class Expressao {
+
+  constructor (conteudo) {
+    this.conteudo = conteudo;
+  }
+}
+
+
+export class Programa {
+  constructor () {
+    this.funcoes = [];
+    this.globais = [];
+  };
+
+  adicionarFuncao (funcao) {
+    this.funcoes.push(funcao);
+  }
+
+  adicionarVariavel(funcao, variavel) {
+    if (this.funcoes[funcao].variaveis === null) {
+      this.funcoes[funcao].variaveis = [];
+    }
+    this.funcoes[funcao].variaveis.push(variavel);
+  }
+
+  adicionarGlobal (variavel) {
+    this.globais.push(variavel);
+  }
+}

+ 17 - 0
runner.html

@@ -1,7 +1,10 @@
 <!DOCTYPE html>
 <html>
 <head>
+<<<<<<< HEAD
   <link rel="stylesheet" type="text/css" href="css/ivprog-term.css">
+=======
+>>>>>>> Refactor code to use webpack and define a UI entry point
   <link rel="stylesheet" type="text/css" href="js/semantic/semantic.min.css">
   <style>
     .ivprog-io-output {
@@ -35,7 +38,11 @@
 
               const real C = 5.5
              
+<<<<<<< HEAD
               funcao inicio() {
+=======
+              funcao inteiro inicio() {
+>>>>>>> Refactor code to use webpack and define a UI entry point
                inteiro a = 8
                se (a * C > 80) {
                 a = 0
@@ -51,8 +58,15 @@
       </div>
     </div>
     <div class="six wide column">
+<<<<<<< HEAD
       <div id="console">
       </div>
+=======
+      <div id="dom-out" class="ivprog-io-output">
+
+      </div>
+      <input id="dom-in" type="text" class="ivprog-io-input">
+>>>>>>> Refactor code to use webpack and define a UI entry point
     </div>
     <div class="six wide column">
         <div style="overflow-y: scroll; height: 70%;">
@@ -63,8 +77,11 @@
   
   
 </body>
+<<<<<<< HEAD
 
 <script src="js/jquery-3.3.1.min.js"></script>
+=======
+>>>>>>> Refactor code to use webpack and define a UI entry point
 <script type="text/javascript" src="js/jquery.json-editor.min.js"></script>
 <script type="text/javascript" src="build/ivprog.bundle.js"></script>