| summaryrefslogtreecommitdiff | 
diff options
| author | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2017-07-20 13:46:47 +0200 | 
|---|---|---|
| committer | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2017-07-20 13:46:47 +0200 | 
| commit | b5c3459a9763107abcbbcd7fc1a42eee3a887c52 (patch) | |
| tree | a44474d508d3ea6c940ce7893f95994d3153b19d /ast-to-instr/src/VHDLGeneric.java | |
| parent | cd9254b65410c0f8a0fc3437ee43d88375244508 (diff) | |
Still working on AST-to-Instr.
Diffstat (limited to 'ast-to-instr/src/VHDLGeneric.java')
| -rw-r--r-- | ast-to-instr/src/VHDLGeneric.java | 277 | 
1 files changed, 277 insertions, 0 deletions
| diff --git a/ast-to-instr/src/VHDLGeneric.java b/ast-to-instr/src/VHDLGeneric.java new file mode 100644 index 0000000..7184f61 --- /dev/null +++ b/ast-to-instr/src/VHDLGeneric.java @@ -0,0 +1,277 @@ +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +import javax.xml.xpath.XPathConstants; +import javax.xml.xpath.XPathExpression; +import javax.xml.xpath.XPathExpressionException; + +import java.util.ArrayList; +import java.util.Collection; + +public class VHDLGeneric extends ParsableXML +{ +   private static final XPathExpression GET_ENTITIES; + +   static +   { +      /* TODO */ +      GET_ENTITIES = null; +   } + +   public VHDLGeneric +   ( +      final IDs parent_id, +      final Node xml_node +   ) +   { +      super(parent_id, xml_node); +   } + +   @Override +   public Collection<ParsableXML> parse () +   throws XPathExpressionException +   { +      final Collection<ParsableXML> result; +      final String xml_id; +      final IDs local_id; + +      result = new ArrayList<ParsableXML>(); + +      xml_id = XMLManager.get_attribute(xml_node, "id"); + +      local_id = IDs.get_id_from_xml_id(xml_id, "generic"); + +      /** Parent **************************************************************/ +      handle_link_to_entity(local_id); + +      /** Functions ***********************************************************/ +      handle_function_line(local_id); +      handle_function_column(local_id); +      handle_function_identifier(local_id); + +      /** Predicates **********************************************************/ +      handle_predicate_has_class(local_id); +      handle_predicate_is_ref(local_id); +      handle_predicate_has_identifier_list(local_id); +      handle_predicate_has_visible_flag(local_id); +      handle_predicate_has_after_drivers_flag(local_id); +      handle_predicate_has_use_flag(local_id); +      handle_predicate_has_guarded_signal_flag(local_id); + +      /** Children ************************************************************/ +      handle_child_waveform(local_id); + +      return null; +   } + +   /***************************************************************************/ +   /** Parents ****************************************************************/ +   /***************************************************************************/ +   private void handle_link_to_entity +   ( +      final IDs local_id +   ) +   { +      Predicates.add_entry("is_port_of", local_id, parent_id); +   } + + +   /***************************************************************************/ +   /** Functions **************************************************************/ +   /***************************************************************************/ +   private void handle_function_line +   ( +      final IDs local_id +   ) +   { +      Functions.add_entry +      ( +         "line", +         local_id, +         Strings.get_id_from_string +         ( +            XMLManager.get_attribute(xml_node, "line") +         ) +      ); +   } + +   private void handle_function_column +   ( +      final IDs local_id +   ) +   { +      Functions.add_entry +      ( +         "column", +         local_id, +         Strings.get_id_from_string +         ( +            XMLManager.get_attribute(xml_node, "col") +         ) +      ); +   } + +   private void handle_function_identifier +   ( +      final IDs local_id +   ) +   { +      Functions.add_entry +      ( +         "identifier", +         local_id, +         Strings.get_id_from_string +         ( +            XMLManager.get_attribute(xml_node, "identifier") +         ) +      ); +   } + +   /***************************************************************************/ +   /** Predicates *************************************************************/ +   /***************************************************************************/ +   private void handle_predicate_has_class +   ( +      final IDs local_id +   ) +   { +      if +      ( +         XMLManager.get_attribute +         ( +            xml_node, +            "has_class" +         ).equals("true") +      ) +      { +         Predicates.add_entry("has_class", local_id); +      } +   } + +   private void handle_predicate_is_ref +   ( +      final IDs local_id +   ) +   { +      if +      ( +         XMLManager.get_attribute +         ( +            xml_node, +            "is_ref" +         ).equals("true") +      ) +      { +         Predicates.add_entry("is_ref", local_id); +      } +   } + +   private void handle_predicate_has_identifier_list +   ( +      final IDs local_id +   ) +   { +      if +      ( +         XMLManager.get_attribute +         ( +            xml_node, +            "has_identifier_list" +         ).equals("true") +      ) +      { +         Predicates.add_entry("has_identifier_list", local_id); +      } +   } + +   private void handle_predicate_has_visible_flag +   ( +      final IDs local_id +   ) +   { +      if +      ( +         XMLManager.get_attribute +         ( +            xml_node, +            "visible_flag" +         ).equals("true") +      ) +      { +         Predicates.add_entry("has_visible_flag", local_id); +      } +   } + +   private void handle_predicate_has_after_drivers_flag +   ( +      final IDs local_id +   ) +   { +      if +      ( +         XMLManager.get_attribute +         ( +            xml_node, +            "after_drivers_flag" +         ).equals("true") +      ) +      { +         Predicates.add_entry("has_after_drivers_flag", local_id); +      } +   } + +   private void handle_predicate_has_use_flag +   ( +      final IDs local_id +   ) +   { +      if +      ( +         XMLManager.get_attribute +         ( +            xml_node, +            "use_flag" +         ).equals("true") +      ) +      { +         Predicates.add_entry("has_use_flag", local_id); +      } +   } + +   private void handle_predicate_has_guarded_signal_flag +   ( +      final IDs local_id +   ) +   { +      if +      ( +         XMLManager.get_attribute +         ( +            xml_node, +            "guarded_signal_flag" +         ).equals("true") +      ) +      { +         Predicates.add_entry("has_guarded_signal_flag", local_id); +      } +   } + +   /***************************************************************************/ +   /** Children ***************************************************************/ +   /***************************************************************************/ +   private void handle_child_waveform +   ( +      final IDs local_id +   ) +   { +      Predicates.add_entry +      ( +         "is_waveform_of", +         Waveforms.get_associated_waveform_id +         ( +            local_id +         ), +         local_id +      ); +   } +} | 


