Skip to content

Commit

Permalink
[potigol] - adicionada interface para interpretador
Browse files Browse the repository at this point in the history
  • Loading branch information
pablotdv committed Oct 28, 2023
1 parent 57d964f commit 430b663
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
6 changes: 4 additions & 2 deletions fontes/construtos/qual-tipo.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { VisitanteComumInterface, SimboloInterface, VariavelInterface } from '../interfaces';
import { SimboloInterface } from '../interfaces';
import { InterpretadorInterfacePotigol } from '../interfaces/interpretador-interface-potigol';
import { Construto } from './construto';


Expand All @@ -16,7 +17,8 @@ export class QualTipo implements Construto {
this.simbolo = simbolo;
}

async aceitar(visitante: VisitanteComumInterface): Promise<VariavelInterface> {
async aceitar(visitante: InterpretadorInterfacePotigol): Promise<string> {
return Promise.resolve(visitante.visitarExpressaoQualTipo(this));
}
}

7 changes: 7 additions & 0 deletions fontes/interfaces/interpretador-interface-potigol.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { QualTipo } from '../construtos';

import { VisitanteComumInterface } from './visitante-comum-interface';

export interface InterpretadorInterfacePotigol extends VisitanteComumInterface {
visitarExpressaoQualTipo(expressao: QualTipo): Promise<string>;
}
1 change: 0 additions & 1 deletion fontes/interfaces/visitante-comum-interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,4 @@ export interface VisitanteComumInterface {
visitarExpressaoTipoDe(expressao: TipoDe): Promise<any>;
visitarExpressaoUnaria(expressao: any): any;
visitarExpressaoVetor(expressao: any): any;
visitarExpressaoQualTipo(expressao: any): Promise<any>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import { AcessoMetodo, Binario, QualTipo, Unario, Variavel } from '../../../cons
import * as comum from './comum';
import { ObjetoPadrao } from '../../../estruturas';
import { inferirTipoVariavel } from './inferenciador';
import { InterpretadorInterfacePotigol } from '../../../interfaces/interpretador-interface-potigol';

/**
* Uma implementação do interpretador de Potigol.
*/
export class InterpretadorPotigol extends InterpretadorBase {
export class InterpretadorPotigol extends InterpretadorBase implements InterpretadorInterfacePotigol {
constructor(
diretorioBase: string,
performance = false,
Expand Down

0 comments on commit 430b663

Please sign in to comment.