diff options
author | Iván Ávalos <avalos@disroot.org> | 2022-11-25 19:07:58 -0600 |
---|---|---|
committer | Iván Ávalos <avalos@disroot.org> | 2022-11-25 19:07:58 -0600 |
commit | 4b2fad150a292f882cee408d7f9746715225f7cb (patch) | |
tree | fe02aa65491aeec869e5c5427e2229fc1633bbf7 /compilador/astree | |
parent | ea2d6ab3cc66e69d423e502407f272f634c3e070 (diff) | |
download | javanol-4b2fad150a292f882cee408d7f9746715225f7cb.tar.gz javanol-4b2fad150a292f882cee408d7f9746715225f7cb.tar.bz2 javanol-4b2fad150a292f882cee408d7f9746715225f7cb.zip |
Se añade `retornar', `detener' y `continuar'
Diffstat (limited to 'compilador/astree')
-rw-r--r-- | compilador/astree/expr.py | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/compilador/astree/expr.py b/compilador/astree/expr.py index c074553..527e606 100644 --- a/compilador/astree/expr.py +++ b/compilador/astree/expr.py @@ -49,6 +49,13 @@ class BinarithmExpr: lvalue: Expr rvalue: Expr +# A break expression. +# +# detener +@dataclass +class BreakExpr: + pass + # A function call expression. # # foo(bar) @@ -68,6 +75,13 @@ class CallExpr: class CompoundExpr: exprs: List[Expr] +# A continue expression. +# +# continuar +@dataclass +class ContinueExpr: + pass + # A scalar value. Value = bool | str | int | type(None) @@ -115,7 +129,9 @@ class ReadExpr: # A return statement. # # retorna a -ReturnExpr = Optional[Expr] +@dataclass +class ReturnExpr: + expr: Optional[Expr] # A while expression. # @@ -126,6 +142,7 @@ class WhileExpr: body: Expr # A Javañol expression. -Expr = (AccessExpr | AssignExpr | BinarithmExpr | CallExpr | - ConstantExpr | ForExpr | IfExpr | CompoundExpr | - PrintExpr | ReadExpr | ReturnExpr) +Expr = (AccessExpr | AssignExpr | BinarithmExpr | BreakExpr | + CallExpr | ConstantExpr | ContinueExpr | ForExpr | + IfExpr | CompoundExpr | PrintExpr | ReadExpr | + ReturnExpr) |