Class Dtd2Def.Phase1

Enclosing class:
Dtd2Def

protected class Dtd2Def.Phase1 extends DTM.SinglePathVisitor
Main translation phase which visits all DTD element definitions and generates their d2d tag expression according to their dtd content model and attribute list.
  • Field Details

    • elloc

      Location of the currently visited element. DTD expressions do not have their own location value in the current umod. Therefore se the one on "<!ELEMENT.." level for error messages.
    • expr

      protected Expression expr
      Visitor result register of the last generated expression.
  • Constructor Details

    • Phase1

      protected Phase1()
  • Method Details

    • action

      protected void action(DTM.Element el)
      Generate the d2d definition element and its contents expressions.
      Overrides:
      action in class DTM.SinglePathVisitor
    • makeRef

      protected Expression makeRef(DTM.ElementRef eref)
      Make a d2d reference for a dtm reference. Enter only the name and the original source text location. The definition is not yet entered = the reference stays "unresolved".
    • modify

      protected void modify(DTM.CP cp)
      Apply the dtd-level modifier to the current expression.
    • action

      protected void action(DTM.Singleton x)
      Translate a singleton content particle into the d2d singleton reference.
      Overrides:
      action in class DTM.SinglePathVisitor
    • action

      protected void action(DTM.Sequence x)
      Translate a sequence of DTD contents into a sequence of d2d expressions.
      Overrides:
      action in class DTM.SinglePathVisitor
    • action

      protected void action(DTM.Choice x)
      Translate an alternative of DTD contents into an alternative of d2d expressions.
      Overrides:
      action in class DTM.SinglePathVisitor
    • action

      protected void action(DTM.Mixed x)
      Translate a "mixed" dtd content model into a d2d "starred alternative" expression.
      Overrides:
      action in class DTM.SinglePathVisitor
    • makeAttribute

      protected Definition makeAttribute(SourceItem context, String name, DTM.Attribute att)
      Create a new d2d-definition for a dtd attribute value. Give it "trimmed" storage type.
      Parameters:
      context - either the global att dummy element container, or an element d2d definition
      name - the name of the new d2d definition, possibly mangled, because it must work LL(1)-disambuig as an input tag.
      att - the original dtd definition; defines the xml output tag and the location.
    • globalDefForAtt

      @Opt protected @Opt Definition globalDefForAtt(String name, DTM.Attribute attdef)
      Construct a common d2d tag element definition for a given attribute. Note that currently dtd-attribute "types" are not analyzed. there is only the type "text". Therefore all attributes with the same name and generating the same xml-tag (= not accidentally the same name due to mangling), and wich are not fixed (fixed attributes are not translated at all, anyhow), are equivalent and can be mapped to ONE(1) global d2d XRegExp.
      Parameters:
      name - the name of the new d2d definition. It is the original local name plus possibly some prefix for dis-ambiguation!
      Returns:
      the new definition, or null iff name already in use for a different xml tag. Then the caller can decide to realize the att as a LOCAL definition (or re-try after mangling).