예제 #1
0
    public static void XmlMatch(ReferentToken token, Token parent, XmlWriter xml)
    {
        Referent referent = token.GetReferent();
        int      start    = token.BeginChar;
        int      stop     = token.EndChar + 1;
        int      id       = token.GetHashCode();

        xml.WriteStartElement("match");
        xml.WriteAttributeString("id", id.ToString());
        if (parent != null)
        {
            id = parent.GetHashCode();
            xml.WriteAttributeString("parent", id.ToString());
        }
        id = referent.GetHashCode();
        xml.WriteAttributeString("referent", id.ToString());
        xml.WriteAttributeString("start", start.ToString());
        xml.WriteAttributeString("stop", stop.ToString());
        xml.WriteEndElement();
        XmlMatches(token.BeginToken, token.EndToken, token, xml);
    }
예제 #2
0
    public static void XmlSlots(Referent referent, List <Slot> slots, XmlWriter xml)
    {
        int parent = referent.GetHashCode();

        foreach (Slot slot in slots)
        {
            xml.WriteStartElement("slot");
            xml.WriteAttributeString("parent", parent.ToString());
            var value = slot.Value;
            if (value is Referent)
            {
                int id = value.GetHashCode();
                xml.WriteAttributeString("referent", id.ToString());
            }
            else
            {
                xml.WriteAttributeString("value", value.ToString());
            }
            xml.WriteAttributeString("key", slot.TypeName);
            xml.WriteEndElement();
        }
    }
예제 #3
0
 public override int GetHashCode() => HashCode.Combine(Owner.GetHashCode(), Referent.GetHashCode());