Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Agregadas funciones "inclusivas" #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,8 @@ dmypy.json
# Cython debug symbols
cython_debug/

Releases/
Releases/

# IDEA

.idea
2 changes: 2 additions & 0 deletions CheLang/BuiltInConst.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,5 @@
global_symbol_table.set("HalloEbribodi", BuiltInFunction.HalloEbribodi)
global_symbol_table.set("Sumate", BuiltInFunction.sum)
global_symbol_table.set("ElMasGrande", BuiltInFunction.ElMasGrande)
global_symbol_table.set("HaceloInclusivoMacho", BuiltInFunction.HaceloInclusivoMacho)
global_symbol_table.set("EInclusivo", BuiltInFunction.EInclusivo)
41 changes: 40 additions & 1 deletion CheLang/Values.py
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,44 @@ def execute_ElMasGrande(self, exec_ctx):
sleep(1)
return RTResult().success(Empty())
execute_ElMasGrande.arg_names = []


def execute_HaceloInclusivoMacho(self, exec_ctx):
s = exec_ctx.symbol_table.get("palabrita")

if isinstance(s, String):
return RTResult().success(String(self.hacelo_inclusivo_macho(str(s.value))))

return RTResult().failure(RTError(
self.pos_start, self.pos_end,
"Aceptamo solo un estrin, mostre.",
exec_ctx
))

execute_HaceloInclusivoMacho.arg_names = ["palabrita"]

def execute_EInclusivo(self, exec_ctx):
s = exec_ctx.symbol_table.get("palabrita")

if isinstance(s, String):
res = Number.true if (str(s.value) == self.hacelo_inclusivo_macho(str(s.value))) else Number.false

return RTResult().success(res)

return RTResult().failure(RTError(
self.pos_start, self.pos_end,
"Aceptamo solo un estrin, mostre.",
exec_ctx
))

execute_EInclusivo.arg_names = ["palabrita"]

def hacelo_inclusivo_macho(self, s):
if s.endswith("a") or s.endswith("o"):
s = s[:-1] + "e"
elif s.endswith("as") or s.endswith("os"):
s = s[:-2] + "es"

return s

BuiltInFunction.print = BuiltInFunction("Cuchame")
BuiltInFunction.print_ret = BuiltInFunction("CuchameRet")
Expand Down Expand Up @@ -969,3 +1006,5 @@ def execute_ElMasGrande(self, exec_ctx):
BuiltInFunction.HalloEbribodi = BuiltInFunction("HalloEbribodi")
BuiltInFunction.sum = BuiltInFunction("Sumate")
BuiltInFunction.ElMasGrande = BuiltInFunction("ElMasGrande")
BuiltInFunction.HaceloInclusivoMacho = BuiltInFunction("HaceloInclusivoMacho")
BuiltInFunction.EInclusivo = BuiltInFunction("EInclusivo")
60 changes: 32 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ Se puede revisar el precio del dolar con su funcion "Dolar()". Pero tenes que es

Podes llamar a la "Campora()" cuando quieras y vas a notar su presencia tan particular. Tene en cuenta que, cada vez que se los llama, hay inflacion. Por lo que el "Dolar()" se ve afectado.

Y no nos olvidemos que somos inclusivEs. Por eso, recordá convertir tus estrin a modo inclusivo con: 'HaceloInclusivoMacho("todos") = "todes"'. Y si te viene un estrin de arafue, chequealo con 'EInclusivo("todes") = True'.

Claramente somos inclusivos y aceptamos a los que hablan ingles, entonces pidiendo un "HalloEbribodi()" un expresidente (defraudado por una reconocida cantante que no lo esperó) les va a dar la bienvenida con su magnifico nivel de ingles y queriendo tirar unos pasos.

Como somos patrios ante todo, podemos hacerle honor a la Patria diciendo "Argentina()".
Expand Down Expand Up @@ -248,34 +250,36 @@ Cosas de fabrica:
"Pi" = Number.math_PI

Funciones:
Cuchame() => print() => Imprimir en consola
CuchameRet() => return print => Retorna el print
Traeme() => input("input str"?) => Input en consola
TraemeNumerito() => input("input str"?) (int) => Input en consola (Solo numeros)
Limpiame() => clear console => Limpia consola
clear() => clear console => Limpia consola
EsNumerito() => isNumber(int) => True si es numero, false si no
EsTexto() => isString(str) => True si es string, false si no
EsLista() => isList([]) => True si es lista, false si no
EsFuncion() => isFunc(fun) => True si es funcion, false si no
Agregale() => append(list, element) => Le agrega un elemento a una lista
Rajale() => pop(list, index) => Le saca un elemento a una lista
Metele() => extend(listA,listB) => Agrega una lista a otra
TaLargo() => len(list or string) => Retorna la longitud de la lista o string
Correme() => run("path/file.che") => Ejecuta un archivo (Solo .che)
Chorro() => Probalo que esta re piola
Argentina() => Probalo que esta re piola
Boludear(n) => sleep(seconds) => Espera n segundos
Viborita(str) => eval(str) => Usa python adentro de CheLang. Re pawerful. Retorna el return de python en string
ANumerito(n-str) => int(n-str) => Convierte string o numero a int
AFlotantito(n-str)=> float(n-str) => Convierte string o numero a float
ATextito(*) => str(*) => Convierte string o numero a string
FloatYPico(n-str) => float(n-str) +- .5 => Da un float mas o menos cerca al numero
Dolar() => Tira el precio del dolar actual => Tira el precio actual del dolar
Campora() => Probalo que esta re piola
HalloEbribodi() => Probalo que esta re piola
Sumate(list[n]) => sum(list[n]) => Retorna la suma de la lista, solo numeros
ElMasGrande() => Probalo que esta re piola
Cuchame() => print() => Imprimir en consola
CuchameRet() => return print => Retorna el print
Traeme() => input("input str"?) => Input en consola
TraemeNumerito() => input("input str"?) (int) => Input en consola (Solo numeros)
Limpiame() => clear console => Limpia consola
clear() => clear console => Limpia consola
EsNumerito() => isNumber(int) => True si es numero, false si no
EsTexto() => isString(str) => True si es string, false si no
EsLista() => isList([]) => True si es lista, false si no
EsFuncion() => isFunc(fun) => True si es funcion, false si no
Agregale() => append(list, element) => Le agrega un elemento a una lista
Rajale() => pop(list, index) => Le saca un elemento a una lista
Metele() => extend(listA,listB) => Agrega una lista a otra
TaLargo() => len(list or string) => Retorna la longitud de la lista o string
Correme() => run("path/file.che") => Ejecuta un archivo (Solo .che)
Chorro() => Probalo que esta re piola
Argentina() => Probalo que esta re piola
Boludear(n) => sleep(seconds) => Espera n segundos
Viborita(str) => eval(str) => Usa python adentro de CheLang. Re pawerful. Retorna el return de python en string
ANumerito(n-str) => int(n-str) => Convierte string o numero a int
AFlotantito(n-str) => float(n-str) => Convierte string o numero a float
ATextito(*) => str(*) => Convierte string o numero a string
FloatYPico(n-str) => float(n-str) +- .5 => Da un float mas o menos cerca al numero
Dolar() => Tira el precio del dolar actual => Tira el precio actual del dolar
Campora() => Probalo que esta re piola
HalloEbribodi() => Probalo que esta re piola
Sumate(list[n]) => sum(list[n]) => Retorna la suma de la lista, solo numeros
ElMasGrande() => Probalo que esta re piola
HaceloInclusivoMacho(str) => Convierte un string a su forma inclusiva. Ejemplo: Todas => Todes.
EInclusivo(str) => Devuelve true si el string es inclusivo. Ejemplo: Todes => True. Todos => False.

(En ejemplos/ejemplo.che esta todo practico, se puede correr y demas)
```
Expand Down