absyntax_utils/search_varfb_instance_type.cc
changeset 936 0f7bcc160568
parent 830 6f45ec6ed011
child 938 31e3b3f2eff1
--- a/absyntax_utils/search_varfb_instance_type.cc	Sun Sep 28 17:48:42 2014 +0100
+++ b/absyntax_utils/search_varfb_instance_type.cc	Sun Oct 19 08:36:49 2014 +0100
@@ -405,3 +405,61 @@
   initial_step_c initial_step(NULL, NULL);
   return initial_step.accept(*this);
 }
+
+
+/***************************************/
+/* B.3 - Language ST (Structured Text) */
+/***************************************/
+/***********************/
+/* B 3.1 - Expressions */
+/***********************/
+/* SYM_REF1(deref_expression_c, exp)  --> an extension to the IEC 61131-3 standard - based on the IEC 61131-3 v3 standard. Returns address of the varible! */
+void *search_varfb_instance_type_c::visit(deref_expression_c  *symbol) {
+  symbol->exp->accept(*this);
+  symbol_c *basetype_decl = current_basetype_decl;
+  this->init(); /* set all current_*** pointers to NULL ! */
+  
+  /* Check whether the expression if a REF_TO datatype, and if so, set the new datatype to the datatype it references! */
+    /* Determine whether the datatype is a ref_spec_c, as this is the class used as the    */
+    /* canonical/base datatype of REF_TO types (see search_base_type_c ...)                */   
+  ref_spec_c * ref_spec = dynamic_cast<ref_spec_c *>(basetype_decl);
+  if (NULL != ref_spec) {
+    current_basetype_decl = search_base_type_c::get_basetype_decl(ref_spec->type_name);
+    current_basetype_id   = search_base_type_c::get_basetype_id  (ref_spec->type_name);
+  }
+  
+/* ########### WARNING ########################################################## */
+/* The following two lines DO NOT belong here. It is just a temporary measure until I get the chance 
+ * to clean this up, and move it to fill/narrow candidate datatypes in stage 3 
+ */
+  symbol->datatype = current_basetype_decl;
+  symbol->exp->datatype = ref_spec;
+  
+  return NULL;
+}
+
+  
+/* SYM_REF1(deref_operator_c, exp)  --> an extension to the IEC 61131-3 standard - based on the IEC 61131-3 v3 standard. Returns address of the varible! */
+void *search_varfb_instance_type_c::visit(deref_operator_c  *symbol) {
+  symbol->exp->accept(*this);
+  symbol_c *basetype_decl = current_basetype_decl;
+  this->init(); /* set all current_*** pointers to NULL ! */
+  
+  /* Check whether the expression if a REF_TO datatype, and if so, set the new datatype to the datatype it references! */
+    /* Determine whether the datatype is a ref_spec_c, as this is the class used as the    */
+    /* canonical/base datatype of REF_TO types (see search_base_type_c ...)                */   
+  ref_spec_c * ref_spec = dynamic_cast<ref_spec_c *>(basetype_decl);
+  if (NULL != ref_spec) {
+    current_basetype_decl = search_base_type_c::get_basetype_decl(ref_spec->type_name);
+    current_basetype_id   = search_base_type_c::get_basetype_id  (ref_spec->type_name);
+  }
+  
+/* ########### WARNING ########################################################## */
+/* The following two lines DO NOT belong here. It is just a temporary measure until I get the chance 
+ * to clean this up, and move it to fill/narrow candidate datatypes in stage 3 
+ */
+  symbol->datatype = current_basetype_decl;
+  symbol->exp->datatype = ref_spec;
+  
+  return NULL;
+}