示例#1
0
        public static EnumerationBase Parse(string text)
        {
            var enumeration = SimpleIndex.Parse(text);

            if (enumeration != null)
            {
                return(enumeration);
            }
            return(ComplexEnumeration.Parse(text));
        }
示例#2
0
        public static Port Parse(Entity entity, string x)
        {
            Match pTypeMatch            = Regex.Match(x, PC.PortType);
            var   remainngWithValueType = x.Substring(pTypeMatch.Index + pTypeMatch.Length);
            var   vTypeM          = Regex.Match(remainngWithValueType, VHDLName);
            var   remaining       = remainngWithValueType.Substring(vTypeM.Index + vTypeM.Length);
            var   defaultPart     = Regex.Match(remaining, PC.Default).Value;
            var   portEnumeration = Regex.Match(remaining, PC.Enumeration).Value;
            var   port            = new Port(entity)
            {
                Name         = Regex.Match(x, PC.PortName).Value,
                PortType     = ParsePortType(pTypeMatch.Value),
                ValueType    = Regex.Match(remainngWithValueType, VHDLName).Value,
                DefaultValue = defaultPart != String.Empty ? Regex.Match(defaultPart, PC.DefaultValue).Value : null,
                Enumeration  = !String.IsNullOrWhiteSpace(portEnumeration) ? ComplexEnumeration.Parse(portEnumeration) : null
            };

            return(port);
        }