Skip to content

Commit

Permalink
Implementando metodos na tradução reversa (37/43)
Browse files Browse the repository at this point in the history
  • Loading branch information
VitBrandao committed Dec 10, 2024
1 parent 1131c92 commit 314a966
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 3 deletions.
10 changes: 7 additions & 3 deletions exemplos/reverso/exemplo-metodos.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,14 @@ div {
transform: rotateZ(0);
}

a {
backdrop-filter: hue-rotate(90deg);
}

p {
backdrop-filter: brightness(10);
backdrop-filter: sepia(60%);
}

a {
backdrop-filter: hue-rotate(90deg);
div {
backdrop-filter: saturate(5);
}
29 changes: 29 additions & 0 deletions fontes/avaliador-sintatico/avaliador-sintatico-reverso.ts
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,35 @@ export class AvaliadorSintaticoReverso implements AvaliadorSintaticoInterface {
[valorRotacionarY, quantificadorRotacionarY]
);

case "saturate":
this.consumir(tiposDeSimbolos.PARENTESE_ESQUERDO, "Esperado parêntese esquerdo após método 'saturate'.");

Check warning on line 722 in fontes/avaliador-sintatico/avaliador-sintatico-reverso.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement
const valorSaturar = this.avancarEDevolverAnterior();

Check warning on line 723 in fontes/avaliador-sintatico/avaliador-sintatico-reverso.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement
let quantificadorSaturar;
if (this.simbolos[this.atual].tipo === 'QUANTIFICADOR') {
quantificadorSaturar = this.avancarEDevolverAnterior();

Check warning on line 726 in fontes/avaliador-sintatico/avaliador-sintatico-reverso.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement
} else {
quantificadorSaturar = null;

Check warning on line 728 in fontes/avaliador-sintatico/avaliador-sintatico-reverso.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement
}

Check warning on line 729 in fontes/avaliador-sintatico/avaliador-sintatico-reverso.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement

Check warning on line 729 in fontes/avaliador-sintatico/avaliador-sintatico-reverso.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch

Check warning on line 729 in fontes/avaliador-sintatico/avaliador-sintatico-reverso.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch
this.consumir(tiposDeSimbolos.PARENTESE_DIREITO, "Esperado parêntese direito após método 'saturate'.");

Check warning on line 730 in fontes/avaliador-sintatico/avaliador-sintatico-reverso.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement
return new SeletorValorReverso(
lexema,
[valorSaturar, quantificadorSaturar]
);

Check warning on line 734 in fontes/avaliador-sintatico/avaliador-sintatico-reverso.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement

Check warning on line 734 in fontes/avaliador-sintatico/avaliador-sintatico-reverso.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch

case "sepia":
this.consumir(tiposDeSimbolos.PARENTESE_ESQUERDO, "Esperado parêntese esquerdo após método 'sepia'.");

Check warning on line 737 in fontes/avaliador-sintatico/avaliador-sintatico-reverso.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement
const valorSepia = this.avancarEDevolverAnterior();

Check warning on line 738 in fontes/avaliador-sintatico/avaliador-sintatico-reverso.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement
let quantificadorSepia;
if (this.simbolos[this.atual].tipo === 'QUANTIFICADOR') {
quantificadorSepia = this.avancarEDevolverAnterior();

Check warning on line 741 in fontes/avaliador-sintatico/avaliador-sintatico-reverso.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement
} else {
quantificadorSepia = null;

Check warning on line 743 in fontes/avaliador-sintatico/avaliador-sintatico-reverso.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement
}

Check warning on line 744 in fontes/avaliador-sintatico/avaliador-sintatico-reverso.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement

Check warning on line 744 in fontes/avaliador-sintatico/avaliador-sintatico-reverso.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch

Check warning on line 744 in fontes/avaliador-sintatico/avaliador-sintatico-reverso.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch
this.consumir(tiposDeSimbolos.PARENTESE_DIREITO, "Esperado parêntese direito após método 'sepia'.");

Check warning on line 745 in fontes/avaliador-sintatico/avaliador-sintatico-reverso.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement
return new SeletorValorReverso(
lexema,
[valorSepia, quantificadorSepia]
);

Check warning on line 749 in fontes/avaliador-sintatico/avaliador-sintatico-reverso.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement

Check warning on line 749 in fontes/avaliador-sintatico/avaliador-sintatico-reverso.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch
}

Check warning on line 750 in fontes/avaliador-sintatico/avaliador-sintatico-reverso.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,8 @@ import { RotateX } from "../../valores/metodos/css/rotateX";
import { RotateY } from "../../valores/metodos/css/rotateY";
import { RotateZ } from "../../valores/metodos/css/rotateZ";
import { HueRotate } from "../../valores/metodos/css/hue-rotate";
import { Saturate } from "../../valores/metodos/css/saturate";
import { Sepia } from "../../valores/metodos/css/sepia";

export const DicionarioReversoModificadores: { [nomeCss: string]: any } = {
"word-wrap": AgruparPalavra,
Expand Down Expand Up @@ -787,11 +789,13 @@ export const DicionarioReversoModificadores: { [nomeCss: string]: any } = {
"rotateX": RotateX,
"rotateY": RotateY,
"rotateZ": RotateZ,
"saturate": Saturate,
"scale3d": Scale3d,
// "scale": Scale,
"scaleX": ScaleX,
"scaleY": ScaleY,
"scaleZ": ScaleZ,
"sepia": Sepia,
"skew": Skew,
"skewX": SkewX,
"skewY": SkewY,
Expand Down
23 changes: 23 additions & 0 deletions fontes/valores/metodos/css/saturate.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Simbolo } from "../../../lexador";
import { MetodoCss } from "./metodo-css";

export class Saturate extends MetodoCss {
valor: number;
quantificador: string;
traducao: string;

constructor(valor: Simbolo, quantificador: Simbolo) {
super();
this.valor = Number(valor.lexema);
this.quantificador = quantificador ? quantificador.lexema : null;
this.traducao = 'saturate';
}

paraTexto() {
if (this.quantificador) {
return `saturar(${this.valor}${this.quantificador})`
}

return `saturar(${this.valor})`
}
}
23 changes: 23 additions & 0 deletions fontes/valores/metodos/css/sepia.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Simbolo } from "../../../lexador";
import { MetodoCss } from "./metodo-css";

export class Sepia extends MetodoCss {
valor: number;
quantificador: string;
traducao: string;

constructor(valor: Simbolo, quantificador: Simbolo) {
super();
this.valor = Number(valor.lexema);
this.quantificador = quantificador ? quantificador.lexema : null;
this.traducao = 'sepia';
}

paraTexto() {
if (this.quantificador) {
return `sepia(${this.valor}${this.quantificador})`
}

return `sepia(${this.valor})`
}
}

0 comments on commit 314a966

Please sign in to comment.