Commit 9e01a6be authored by Sergio Costas's avatar Sergio Costas

Added ALIAS type

parent ec913551
......@@ -295,6 +295,7 @@ class crusty(object):
* the type of the assignment (crust, no_crust or no_matter)
* the variable name corresponding to the assignment, if it was a variable
* the boolean value (CONDITION_TRUE, CONDITION_FALSE or CONDITION_FALSE_TRUE) equivalent to that
* if in any part of the assignment chain is a borrowed block
"""
if assignment is None:
return [ (crusty.STATUS_UNINITIALIZED, self._copy_container(var_container), self.TYPE_NO_MATTER, None, self.CONDITION_FALSE_TRUE, self.TYPE_NO_BORROWED) ]
......
......@@ -71,6 +71,7 @@ struct AST * new_leaf(int type, struct AST *template) {
ast->t_crusty = false;
ast->t_crusty_borrow = false;
ast->t_crusty_recycle = false;
ast->t_crusty_alias = false;
ast->t_null = false;
ast->t_ellipsis = false;
ast->t_label = false;
......@@ -117,6 +118,7 @@ void mix_ast_leaves(struct AST *base, struct AST *new_leaf) {
base->function |= new_leaf->function;
base->t_crusty |= new_leaf->t_crusty;
base->t_crusty_borrow |= new_leaf->t_crusty_borrow;
base->t_crusty_alias |= new_leaf->t_crusty_alias;
base->t_crusty_recycle |= new_leaf->t_crusty_recycle;
base->t_null |= new_leaf->t_null;
base->t_ellipsis |= new_leaf->t_ellipsis;
......@@ -158,6 +160,7 @@ void copy_ast_data(struct AST *base, struct AST *new_leaf) {
base->t_crusty = new_leaf->t_crusty;
base->t_crusty_borrow = new_leaf->t_crusty_borrow;
base->t_crusty_recycle = new_leaf->t_crusty_recycle;
base->t_crusty_alias = new_leaf->t_crusty_alias;
base->t_null = new_leaf->t_null;
base->t_ellipsis = new_leaf->t_ellipsis;
base->t_label = new_leaf->t_label;
......
......@@ -38,6 +38,7 @@ struct AST {
bool t_crusty;
bool t_crusty_borrow;
bool t_crusty_recycle;
bool t_crusty_alias;
bool t_null;
bool t_ellipsis;
bool t_label;
......
......@@ -86,6 +86,7 @@ char do_verbose = 0;
"__crust_t__" { return prepare_leaf(0,0.0,CRUSTY_T); }
"__crust_borrow__" { return prepare_leaf(0,0.0,CRUSTY_BORROW); }
"__crust_recycle__" { return prepare_leaf(0,0.0,CRUSTY_RECYCLE); }
"__crust_alias__" { return prepare_leaf(0,0.0,CRUSTY_ALIAS); }
"__crust_enable__" { return prepare_leaf(0,0.0,CRUSTY_ENABLE); }
"__crust_disable__" { return prepare_leaf(0,0.0,CRUSTY_DISABLE); }
"__crust_full_disable__" { return prepare_leaf(0,0.0,CRUSTY_FULL_DISABLE); }
......@@ -354,6 +355,10 @@ int prepare_leaf(unsigned long long int v1, double v2, int current_token) {
yylval->t_crusty_recycle = true;
yylval->t_crusty = true;
break;
case CRUSTY_ALIAS:
yylval->t_crusty_alias = true;
yylval->t_crusty = true;
break;
case T_NULL:
yylval->t_null = true;
free(yylval->data);
......
......@@ -32,6 +32,7 @@ void add_type_element(char *);
%token CRUSTY_T
%token CRUSTY_BORROW
%token CRUSTY_RECYCLE
%token CRUSTY_ALIAS
%token CRUSTY_ENABLE
%token CRUSTY_DISABLE
%token CRUSTY_FULL_DISABLE
......@@ -141,12 +142,12 @@ unary_expression
;
unary_operator
: '&' { $$ = $1; }
| '*' { $$ = $1; }
| '+' { $$ = $1; }
| '-' { $$ = $1; }
| '~' { $$ = $1; }
| '!' { $$ = $1; }
: '&'
| '*'
| '+'
| '-'
| '~'
| '!'
;
cast_expression
......@@ -494,6 +495,7 @@ type_qualifier
| CRUSTY_T
| CRUSTY_BORROW
| CRUSTY_RECYCLE
| CRUSTY_ALIAS
;
function_specifier
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment