equal
deleted
inserted
replaced
37 */ |
37 */ |
38 class search_base_type_c: public null_visitor_c { |
38 class search_base_type_c: public null_visitor_c { |
39 private: |
39 private: |
40 symbol_c *current_type_name; |
40 symbol_c *current_type_name; |
41 bool is_subrange; |
41 bool is_subrange; |
|
42 bool is_enumerated; |
42 |
43 |
43 public: |
44 public: |
44 search_base_type_c(void) {current_type_name = NULL;} |
45 search_base_type_c(void) {current_type_name = NULL;} |
45 bool base_is_subrange() {return this->is_subrange;} |
46 |
46 |
|
47 public: |
47 public: |
48 void *visit(identifier_c *type_name) { |
48 void *visit(identifier_c *type_name) { |
49 this->current_type_name = type_name; |
49 this->current_type_name = type_name; |
50 /* look up the type declaration... */ |
50 /* look up the type declaration... */ |
51 symbol_c *type_decl = type_symtable.find_value(type_name); |
51 symbol_c *type_decl = type_symtable.find_value(type_name); |
54 ERROR; |
54 ERROR; |
55 |
55 |
56 return type_decl->accept(*this); |
56 return type_decl->accept(*this); |
57 } |
57 } |
58 |
58 |
59 void *explore_type(symbol_c* type_decl) { |
59 bool type_is_subrange(symbol_c* type_decl) { |
60 this->is_subrange = false; |
60 this->is_subrange = false; |
61 return type_decl->accept(*this); |
61 type_decl->accept(*this); |
62 } |
62 return this->is_subrange; |
63 |
63 } |
|
64 |
|
65 bool type_is_enumerated(symbol_c* type_decl) { |
|
66 this->is_enumerated = false; |
|
67 type_decl->accept(*this); |
|
68 return this->is_enumerated; |
|
69 } |
|
70 |
64 /***********************************/ |
71 /***********************************/ |
65 /* B 1.3.1 - Elementary Data Types */ |
72 /* B 1.3.1 - Elementary Data Types */ |
66 /***********************************/ |
73 /***********************************/ |
67 void *visit(time_type_name_c *symbol) {return (void *)symbol;} |
74 void *visit(time_type_name_c *symbol) {return (void *)symbol;} |
68 void *visit(bool_type_name_c *symbol) {return (void *)symbol;} |
75 void *visit(bool_type_name_c *symbol) {return (void *)symbol;} |
125 return symbol->enumerated_spec_init->accept(*this); |
132 return symbol->enumerated_spec_init->accept(*this); |
126 } |
133 } |
127 |
134 |
128 /* enumerated_specification ASSIGN enumerated_value */ |
135 /* enumerated_specification ASSIGN enumerated_value */ |
129 void *visit(enumerated_spec_init_c *symbol) { |
136 void *visit(enumerated_spec_init_c *symbol) { |
|
137 this->is_enumerated = true; |
130 return symbol->enumerated_specification->accept(*this); |
138 return symbol->enumerated_specification->accept(*this); |
131 } |
139 } |
132 |
140 |
133 /* helper symbol for enumerated_specification->enumerated_spec_init */ |
141 /* helper symbol for enumerated_specification->enumerated_spec_init */ |
134 /* enumerated_value_list ',' enumerated_value */ |
142 /* enumerated_value_list ',' enumerated_value */ |