-
Notifications
You must be signed in to change notification settings - Fork 220
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* corrigindo ajuda desformatada * atualizando testes * iniciando testes * terminando testes * verificando travis * testando travis * testando travis 2 * testando travis 3 * testando travis 4 * testando travis 5 * testando travis 6 * trocando charset de teste
- Loading branch information
1 parent
7d802ab
commit df0e705
Showing
89 changed files
with
1,726 additions
and
588 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
454 changes: 228 additions & 226 deletions
454
core/src/main/java/br/univali/portugol/nucleo/analise/sintatica/antlr4/PortugolLexer.java
Large diffs are not rendered by default.
Oops, something went wrong.
369 changes: 189 additions & 180 deletions
369
core/src/main/java/br/univali/portugol/nucleo/analise/sintatica/antlr4/PortugolLexico.java
Large diffs are not rendered by default.
Oops, something went wrong.
356 changes: 190 additions & 166 deletions
356
core/src/main/java/br/univali/portugol/nucleo/analise/sintatica/antlr4/PortugolParser.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
ide/src/test/java/br/univali/ps/ui/editor/formatador/ResourceHandle.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package br.univali.ps.ui.editor.formatador; | ||
|
||
import java.io.BufferedReader; | ||
import java.io.File; | ||
import java.io.FileInputStream; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.io.InputStreamReader; | ||
import java.util.logging.Level; | ||
import java.util.logging.Logger; | ||
|
||
public final class ResourceHandle | ||
{ | ||
private static final Logger LOGGER = Logger.getLogger(ResourceHandle.class.getName()); | ||
private static final String CHARSET_PADRAO = "UTF-8"; | ||
|
||
public static String readInternalResourceFile(String path) throws IOException | ||
{ | ||
return read(Thread.currentThread().getContextClassLoader().getResourceAsStream(path), CHARSET_PADRAO); | ||
} | ||
|
||
public static String readInternalResourceFile(String path, String charset) throws IOException | ||
{ | ||
return read(Thread.currentThread().getContextClassLoader().getResourceAsStream(path), charset); | ||
} | ||
|
||
public static String readExternalResourceFile(File file) throws IOException | ||
{ | ||
return read(new FileInputStream(file), CHARSET_PADRAO); | ||
} | ||
|
||
public static String readExternalResourceFile(File file, String charset) throws IOException | ||
{ | ||
return read(new FileInputStream(file), charset); | ||
} | ||
|
||
private static String read(InputStream inputStream, String charset) throws IOException | ||
{ | ||
StringBuilder reading = new StringBuilder(); | ||
|
||
try (InputStreamReader isr = new InputStreamReader(inputStream, charset); BufferedReader reader = new BufferedReader(isr)) | ||
{ | ||
int read; | ||
char[] buffer = new char[4096]; | ||
|
||
while ((read = reader.read(buffer, 0, buffer.length)) > 0) | ||
{ | ||
reading.append(buffer, 0, read); | ||
} | ||
} | ||
catch (Exception ex) | ||
{ | ||
LOGGER.log(Level.SEVERE, null, ex); | ||
|
||
throw ex; | ||
} | ||
|
||
return reading.toString().replaceAll(System.lineSeparator(), "\n"); | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
ide/src/test/resources/br/univali/ps/ui/editor/formatador/exemplos/bibliotecas/exemplo1.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<span class="porPalavraReservada">inclua</span> <span class="porPalavraReservada">biblioteca</span> <span class="porID">Mouse</span> | ||
<span class="porPalavraReservada">inclua</span> <span class="porPalavraReservada">biblioteca</span> <span class="porID">Graficos</span> <span class="porDesconhecido">--></span> <span class="porID">g</span> | ||
<span class="porID">Mouse</span><span class="porDesconhecido">.</span><span class="porID">ocultar_cursor</span><span class="porAgrupamentos">(</span><span class="porAgrupamentos">)</span> | ||
<span class="porID">g</span><span class="porDesconhecido">.</span><span class="porID">iniciar_modo_grafico</span><span class="porAgrupamentos">(</span><span class="porLogico">verdadeiro</span><span class="porAgrupamentos">)</span> |
12 changes: 12 additions & 0 deletions
12
ide/src/test/resources/br/univali/ps/ui/editor/formatador/exemplos/bibliotecas/exemplo2.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
...resources/br/univali/ps/ui/editor/formatador/exemplos/declaracoes/constante/exemplo1.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<span class="porPalavraReservada">const</span> <span class="porTipoDeclaracao">inteiro</span> <span class="porID">NOME_DA_CONSTANTE</span> <span class="porDesconhecido">=</span> <span class="porNumeros">3</span> | ||
<span class="porPalavraReservada">const</span> <span class="porTipoDeclaracao">real</span> <span class="porID">NOME_DA_CONSTANTE2</span> <span class="porDesconhecido">=</span> <span class="porNumeros">45</span> |
14 changes: 14 additions & 0 deletions
14
...resources/br/univali/ps/ui/editor/formatador/exemplos/declaracoes/constante/exemplo2.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<span class="porPalavraReservada">programa</span> | ||
<span class="porAgrupamentos">{</span> | ||
<span class="porComentario">//Constante global do tipo de dado real | ||
</span> <span class="porPalavraReservada">const</span> <span class="porTipoDeclaracao">real</span> <span class="porID">ACELERACAO_GRAVIDADE</span> <span class="porDesconhecido">=</span> <span class="porNumeros">9.78</span> | ||
|
||
<span class="porPalavraReservada">funcao</span> <span class="porID">inicio</span><span class="porAgrupamentos">(</span><span class="porAgrupamentos">)</span> | ||
<span class="porAgrupamentos">{</span> | ||
<span class="porComentario">//Vetor constante local do tipo de dado caracter | ||
</span> <span class="porPalavraReservada">const</span> <span class="porTipoDeclaracao">caracter</span> <span class="porID">VOGAIS</span><span class="porAgrupamentos">[</span><span class="porNumeros">5</span><span class="porAgrupamentos">]</span> <span class="porDesconhecido">=</span> <span class="porAgrupamentos">{</span><span class="porTexto">'a'</span><span class="porDesconhecido">,</span><span class="porTexto">'e'</span><span class="porDesconhecido">,</span><span class="porTexto">'i'</span><span class="porDesconhecido">,</span><span class="porTexto">'o'</span><span class="porDesconhecido">,</span><span class="porTexto">'u'</span><span class="porAgrupamentos">}</span> | ||
|
||
<span class="porComentario">//Matriz constante local do tipo de dado inteiro | ||
</span> <span class="porPalavraReservada">const</span> <span class="porTipoDeclaracao">inteiro</span> <span class="porID">TECLADO_NUMERICO</span><span class="porAgrupamentos">[</span><span class="porAgrupamentos">]</span><span class="porAgrupamentos">[</span><span class="porAgrupamentos">]</span> <span class="porDesconhecido">=</span> <span class="porAgrupamentos">{</span><span class="porAgrupamentos">{</span><span class="porNumeros">1</span><span class="porDesconhecido">,</span><span class="porNumeros">2</span><span class="porDesconhecido">,</span><span class="porNumeros">3</span><span class="porAgrupamentos">}</span><span class="porDesconhecido">,</span><span class="porAgrupamentos">{</span><span class="porNumeros">4</span><span class="porDesconhecido">,</span><span class="porNumeros">5</span><span class="porDesconhecido">,</span><span class="porNumeros">6</span><span class="porAgrupamentos">}</span><span class="porDesconhecido">,</span><span class="porAgrupamentos">{</span><span class="porNumeros">7</span><span class="porDesconhecido">,</span><span class="porNumeros">8</span><span class="porDesconhecido">,</span><span class="porNumeros">9</span><span class="porAgrupamentos">}</span><span class="porAgrupamentos">}</span> | ||
<span class="porAgrupamentos">}</span> | ||
<span class="porAgrupamentos">}</span> |
12 changes: 12 additions & 0 deletions
12
...st/resources/br/univali/ps/ui/editor/formatador/exemplos/declaracoes/funcao/exemplo1.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<span class="porPalavraReservada">funcao</span> <span class="porTipoDeclaracao">real</span> <span class="porID">nome_da_funcao</span> <span class="porAgrupamentos">(</span><span class="porTipoDeclaracao">inteiro</span> <span class="porID">parametro1</span><span class="porDesconhecido">,</span><span class="porTipoDeclaracao">real</span> <span class="porID">parametro2</span><span class="porAgrupamentos">)</span> | ||
<span class="porAgrupamentos">{</span> | ||
<span class="porPalavraReservada">retorne</span> <span class="porID">parametro1</span> <span class="porDesconhecido">*</span> <span class="porID">parametro2</span> | ||
<span class="porAgrupamentos">}</span> | ||
<span class="porPalavraReservada">funcao</span> <span class="porTipoDeclaracao">inteiro</span> <span class="porID">nome_da_funcao2</span> <span class="porAgrupamentos">(</span><span class="porAgrupamentos">)</span> | ||
<span class="porAgrupamentos">{</span> | ||
<span class="porPalavraReservada">retorne</span> <span class="porNumeros">1</span> | ||
<span class="porAgrupamentos">}</span> | ||
<span class="porPalavraReservada">funcao</span> <span class="porID">nome_da_funcao3</span> <span class="porAgrupamentos">(</span><span class="porTipoDeclaracao">cadeia</span> <span class="porDesconhecido">&</span><span class="porID">parametro</span><span class="porAgrupamentos">)</span> | ||
<span class="porAgrupamentos">{</span> | ||
<span class="porID">parametro</span> <span class="porDesconhecido">=</span> <span class="porTexto">"Novo Valor"</span> | ||
<span class="porAgrupamentos">}</span> |
Oops, something went wrong.