Skip to content

Commit

Permalink
Merge pull request #18 from DesignLiquido/nucleos
Browse files Browse the repository at this point in the history
Redesenhando núcleo de Delégua para trabalhar com outros dois núcleos…
  • Loading branch information
samuelrvg authored Aug 17, 2023
2 parents 4d82d94 + 1ae9c83 commit e5f7ac7
Show file tree
Hide file tree
Showing 43 changed files with 817 additions and 2,906 deletions.
110 changes: 55 additions & 55 deletions .github/workflows/principal.yml
Original file line number Diff line number Diff line change
@@ -1,62 +1,62 @@
name: Commit e PR - Principal
# name: Commit e PR - Principal

on:
pull_request:
branches: [ principal ]
# on:
# pull_request:
# branches: [ principal ]

jobs:
testes-delegua:
runs-on: ubuntu-latest
# jobs:
# testes-delegua:
# runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2-beta
with:
node-version: '16'
- name: NPM - Dependências
run: |
sudo npm install
- name: Testes da Linguagem Delégua
run: |
sudo chmod +x ./bin/delegua-ts
sudo npm run testes:delegua:bhaskara
sudo npm run testes:delegua:fibonacci
# steps:
# - uses: actions/checkout@v2
# - uses: actions/setup-node@v2-beta
# with:
# node-version: '16'
# - name: NPM - Dependências
# run: |
# sudo npm install
# - name: Testes da Linguagem Delégua
# run: |
# sudo chmod +x ./bin/delegua-ts
# sudo npm run testes:delegua:bhaskara
# sudo npm run testes:delegua:fibonacci

testes-egua-classico:
runs-on: ubuntu-latest
# testes-egua-classico:
# runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2-beta
with:
node-version: '16'
- name: NPM - Dependências
run: |
sudo npm install
- name: Testes do Dialeto Égua Clássico
run: |
sudo chmod +x ./bin/delegua-ts
sudo npm run testes:egua
# steps:
# - uses: actions/checkout@v2
# - uses: actions/setup-node@v2-beta
# with:
# node-version: '16'
# - name: NPM - Dependências
# run: |
# sudo npm install
# - name: Testes do Dialeto Égua Clássico
# run: |
# sudo chmod +x ./bin/delegua-ts
# sudo npm run testes:egua

testes-unitarios:
permissions:
checks: write
pull-requests: write
contents: write
runs-on: ubuntu-latest
# testes-unitarios:
# permissions:
# checks: write
# pull-requests: write
# contents: write
# runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2-beta
with:
node-version: '16'
- uses: ArtiomTr/jest-coverage-report-action@v2
id: coverage
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
test-script: yarn testes-unitarios
package-manager: yarn
output: report-markdown
- uses: marocchino/sticky-pull-request-comment@v2
with:
message: ${{ steps.coverage.outputs.report }}
# steps:
# - uses: actions/checkout@v2
# - uses: actions/setup-node@v2-beta
# with:
# node-version: '16'
# - uses: ArtiomTr/jest-coverage-report-action@v2
# id: coverage
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
# test-script: yarn testes-unitarios
# package-manager: yarn
# output: report-markdown
# - uses: marocchino/sticky-pull-request-comment@v2
# with:
# message: ${{ steps.coverage.outputs.report }}
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@
{
"type": "node",
"request": "launch",
"name": "Delégua > REPL",
"name": "Delégua > Modo LAIR (REPL)",
"skipFiles": ["<node_internals>/**", "node_modules/**"],
"cwd": "${workspaceRoot}",
"console": "integratedTerminal",
Expand Down
27 changes: 13 additions & 14 deletions execucao.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Delegua } from './fontes/delegua';
import { Command } from 'commander';

const principal = () => {
const principal = async () => {
const analisadorArgumentos = new Command();
let codigoOuNomeArquivo: string;

analisadorArgumentos
.option(
'-c, --codigo <codigo>',
'-c, --codigo <código>',
'Código a ser avaliado.',
''
)
Expand All @@ -32,8 +32,8 @@ const principal = () => {
false
)
.option(
'-t, --traduzir <linguagem>',
'Traduz o código do arquivo passado como parâmetro.',
'-t, --traduzir <linguagem-para-linguagem>',
'Traduz o código do arquivo passado como parâmetro de arquivo. O argumento deve ser no formato linguagem-para-linguagem, como por exemplo `delegua-para-js`.',
)
.argument('[arquivos...]', 'Nomes dos arquivos (opcional)')
.action((argumentos) => {
Expand All @@ -45,24 +45,23 @@ const principal = () => {
analisadorArgumentos.parse();
const opcoes = analisadorArgumentos.opts();

const delegua = new Delegua(
opcoes.dialeto,
opcoes.performance,
codigoOuNomeArquivo ? opcoes.depurador : false,
opcoes.traduzir
);
const delegua = new Delegua();

if (opcoes.codigo) {
delegua.executarCodigoComoArgumento(opcoes.codigo || codigoOuNomeArquivo);
await delegua.executarCodigoComoArgumento(
opcoes.codigo || codigoOuNomeArquivo,
opcoes.dialeto,
Boolean(opcoes.performance)
);
} else {
if (codigoOuNomeArquivo) {
if (opcoes.traduzir) {
delegua.traduzirArquivo(codigoOuNomeArquivo, opcoes.saida);
delegua.traduzirArquivo(codigoOuNomeArquivo, opcoes.traduzir, opcoes.saida);
} else {
delegua.carregarArquivo(codigoOuNomeArquivo);
await delegua.executarCodigoPorArquivo(codigoOuNomeArquivo);
}
} else {
delegua.iniciarLairDelegua();
delegua.iniciarLair();
}
}
};
Expand Down
Loading

0 comments on commit e5f7ac7

Please sign in to comment.