Traductor e intérprete del lenguaje CL 1.23
|
Nodos a medida del árbol de sintaxis abstracta. More...
Public Member Functions | |
CL_AST | getChild (int i) |
Sobreescribe el método que obtiene el i-éesimo hijo del nodo actual del AST. | |
String | toString () |
Sobreescribe CommonTree.toString() para describir cómo debe aparecer como texto el nodo raiz del subárbol AST, no todo el subárbol. | |
Package Functions | |
CL_AST (Token t) | |
Constructor que crea un nodo de un árbol CL_AST a partir de un token t . | |
TypeTree | getTypeTree () |
Consulta el atributo tipus. | |
void | setTypeTree (TypeTree t) |
Establece el atributo tipus. | |
void | setTypeTree (int type) |
Establece el atributo tipus para tipos básicos. | |
void | setTypeError () |
Establece el atributo tipus al tipo error (TypeError , declarado en TypeCheck.g . | |
boolean | getReferenciable () |
Consulta el atributo esReferenciable. | |
void | setReferenciable (boolean b) |
Establece el atributo esReferenciable. | |
Static Package Functions | |
static String | toIndentedTreeString (CL_AST t) |
Describe cómo un subárbol AST debe aparecer como texto, en formato multilínea indentado. | |
Private Member Functions | |
String | toNodeString () |
Describe cómo debe aparecer como texto el nodo raiz del subárbol AST, no todo el subárbol. | |
Static Private Member Functions | |
static void | toIndentedTreeString (CL_AST t, String s, StringBuffer sb) |
Describe cómo un subárbol AST debe aparecer como texto (en un StringBuffer ), en formato multilínea indentado. | |
Private Attributes | |
TypeTree | tipus |
Tipo de la expresión. | |
boolean | esReferenciable |
La expresión es referenciable?. |
Nodos a medida del árbol de sintaxis abstracta.
Extiende la clase CommonTree
que define árboles con nodos que contienen el tipo y texto del token (atributos type y text), y su localización (line y charPositionInLine). A estos se añaden nuevos atributos y otros métodos para trabajar con estos nuevos árboles.
Definition at line 61 of file CL_AST.java.
CL_AST.CL_AST | ( | Token | t | ) | [package] |
Constructor que crea un nodo de un árbol CL_AST a partir de un token t
.
Además establece los valores por defecto para los atributos tipus y esReferenciable.
[in] | t | token que incorporar al nodo del CL_AST |
Definition at line 87 of file CL_AST.java.
CL_AST CL_AST.getChild | ( | int | i | ) |
Sobreescribe el método que obtiene el i-éesimo hijo del nodo actual del AST.
Para evitar tener que hacer castings de la forma: (CL_AST)
getChild(i)
[in] | i | número de hijo a obtener, comenzando desde 0 |
Definition at line 152 of file CL_AST.java.
boolean CL_AST.getReferenciable | ( | ) | [package] |
Consulta el atributo esReferenciable.
Definition at line 133 of file CL_AST.java.
TypeTree CL_AST.getTypeTree | ( | ) | [package] |
Consulta el atributo tipus.
TypeTree
Definition at line 102 of file CL_AST.java.
void CL_AST.setReferenciable | ( | boolean | b | ) | [package] |
Establece el atributo esReferenciable.
[in] | b | valor del atributo esReferenciable, de tipo booleano |
Definition at line 141 of file CL_AST.java.
void CL_AST.setTypeError | ( | ) | [package] |
Establece el atributo tipus al tipo error (TypeError
, declarado en TypeCheck.g
.
Definition at line 126 of file CL_AST.java.
void CL_AST.setTypeTree | ( | TypeTree | t | ) | [package] |
Establece el atributo tipus.
[in] | t | valor del atributo tipus, de tipo TypeTree |
Definition at line 109 of file CL_AST.java.
void CL_AST.setTypeTree | ( | int | type | ) | [package] |
Establece el atributo tipus para tipos básicos.
[in] | type | tipo de token que representa un tipo básico (valores enteros INT o BOOL declarados en CL.g ) |
Definition at line 118 of file CL_AST.java.
static void CL_AST.toIndentedTreeString | ( | CL_AST | t, |
String | s, | ||
StringBuffer | sb | ||
) | [static, private] |
Describe cómo un subárbol AST debe aparecer como texto (en un StringBuffer
), en formato multilínea indentado.
[in] | t | el AST a ser convertido en string (en un StringBuffer sb) |
[in] | s | la indentación de los subárboles hijos |
[in,out] | sb | el StringBuffer con el string correspondiente a t |
Definition at line 211 of file CL_AST.java.
static String CL_AST.toIndentedTreeString | ( | CL_AST | t | ) | [static, package] |
Describe cómo un subárbol AST debe aparecer como texto, en formato multilínea indentado.
[in] | t | el AST a ser convertido en string |
Definition at line 238 of file CL_AST.java.
String CL_AST.toNodeString | ( | ) | [private] |
Describe cómo debe aparecer como texto el nodo raiz del subárbol AST, no todo el subárbol.
No tiene en cuenta la decoració del nodo.
Por defecto devuelve el text del token contenido en el nodo, pero en algunos casos también aparece su type (como texto). Por ejemplo, while
, intconst(23)
o ident(n1)
Definition at line 167 of file CL_AST.java.
String CL_AST.toString | ( | ) |
Sobreescribe CommonTree.toString()
para describir cómo debe aparecer como texto el nodo raiz del subárbol AST, no todo el subárbol.
Incluye la decoración cuando el nodo es la raiz de una expresión. Entonces se añade al string la decoración en los atributos tipus
y esReferenciable
Definition at line 189 of file CL_AST.java.
boolean CL_AST.esReferenciable [private] |
La expresión es referenciable?.
Muestra si una expresion es asignable/addressable, es decir, si puede recibir y guardar un valor, o si tiene sentido referirse a su dirección. Este atributo sólo se usa en subárboles que son (sub)expresiones. Por defecto, tiene el valor falso
. Decoración que coloca el analizador semántico (TypeCheck)
Definition at line 79 of file CL_AST.java.
TypeTree CL_AST.tipus [private] |
Tipo de la expresión.
Descripción del tipo CL del AST enraizado en este nodo. Este atributo sólo se usa en subárboles que son (sub)expresiones. Decoración que coloca el analizador semántico (TypeCheck)
Definition at line 69 of file CL_AST.java.