public static Field Parse(Group fieldGroup) { var name = fieldGroup.Key; var signature = fieldGroup.GetValue("signature").DefaultTo(() => name); var optional = fieldGroup.GetValue("optional").Map(s => s == "true").DefaultTo(() => false); var typeName = fieldGroup.GetValue("type"); var type = typeName.Map(getType); return(new Field(name, signature, optional) { Type = type }); }
public static Parameter Parse(Group parameterGroup) { var name = parameterGroup.Key; var signature = parameterGroup.GetValue("signature").DefaultTo(() => name); var typeName = parameterGroup.GetValue("type").DefaultTo(() => "$string"); typeName = fixTypeName(typeName); var type = getType(typeName); var size = parameterGroup.GetValue("size").Map(s => s.ToInt()); var output = parameterGroup.GetValue("output").Map(s => s == "true").DefaultTo(() => false); var value = parameterGroup.GetValue("value"); var _default = parameterGroup.GetValue("default"); return(new Parameter(name, signature) { Type = type, Size = size, Output = output, Value = value, Default = _default }); }