Ejemplo n.º 1
0
 public void Visit(MapType mapType)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 2
0
 public void Visit(MapType mapType)
 {
     sb.Append("map").Append("<");
     VisitTripType(mapType.KeyType);
     sb.Append(",");
     VisitTripType(mapType.ValueType);
     sb.Append(">");
 }
Ejemplo n.º 3
0
        public static TripType BuildFieldType(ParseTreeNode fieldTypeNode)
        {
            TripType tripType = null;

            var fieldTypeChildNode = fieldTypeNode.ChildNodes[0];

            if (fieldTypeChildNode.Term.Name == IdlGrammar.TNAME_TIDENTIFIER)
            {
                var identifier = fieldTypeChildNode.Token.Text;
                tripType = new IdentifierType(identifier);
            }
            else if (fieldTypeChildNode.Term.Name == IdlGrammar.NTNAME_TBASE_TYPE)
            {
                var baseTypeKeyword = fieldTypeChildNode.FindTokenAndGetText();
                var bType = ConvertBaseTypeKeywordToBaseType(baseTypeKeyword);
                tripType = new BaseType(bType);
            }
            else if (fieldTypeChildNode.Term.Name == IdlGrammar.NTNAME_TCONTAINER_TYPE)
            {
                var containerTypeNode = fieldTypeChildNode.ChildNodes[0];
                if (containerTypeNode.Term.Name == IdlGrammar.NTNAME_TMAP_TYPE)
                {
                    var keyType = BuildFieldType(containerTypeNode.ChildNodes[0]);
                    var valueType = BuildFieldType(containerTypeNode.ChildNodes[1]);
                    tripType = new MapType(keyType, valueType);
                }
                else if (containerTypeNode.Term.Name == IdlGrammar.NTNAME_TSET_TYPE)
                {
                    var setValueType = BuildFieldType(containerTypeNode.ChildNodes[0]);
                    tripType = new SetType(setValueType);
                }
                else if (containerTypeNode.Term.Name == IdlGrammar.NTNAME_TLIST_TYPE)
                {
                    var listValueType = BuildFieldType(containerTypeNode.ChildNodes[0]);
                    tripType = new ListType(listValueType);
                }
            }

            return tripType;
        }