diff parser_old.rhope @ 62:b218af069da7

merge
author Mike Pavone <pavone@retrodev.com>
date Sat, 10 Oct 2009 16:43:37 -0400
parents 789a146a48e1
children aabda74c7a88
line wrap: on
line diff
--- a/parser_old.rhope	Thu Oct 08 23:16:26 2009 -0400
+++ b/parser_old.rhope	Sat Oct 10 16:43:37 2009 -0400
@@ -666,14 +666,39 @@
 	out <- [[Build["Blueprint Field"]]Name <<[name]]Type <<[type]
 }
 
-Process Blueprint Field[list,field,delim:out]
+Process Blueprint Field[list,field,params:out]
 {
-	parts <- [field]Split[delim]
-	If[[[parts]Length] > [1]]
+	,name <- [field]Get DString[[params]List Begin >>]
 	{
-		out <- [list]Append[New@Blueprint Field[[parts]Index[1], [parts]Index[0]]]
-	}{
-		out <- [list]Append[New@Blueprint Field[[parts]Index[0], "Any Type"]]
+		type info <- Parse List[~,params,()]
+		type <- [type info]Index[0]
+		{
+			If[[Type Of[~]] = ["Named Pipe Node"]]
+			{
+				before variant <- Type Instance[[type]Name >>]
+			}{
+				before variant <-  [type]Params <<[ Map[[type]Params >>, "Remove Named Pipe Node"] ]
+			}
+			variant <- [type info]Index[1]
+			{
+				,warn <- If[[Type Of[~]] = ["Named Pipe Node"]]
+				{
+					fieldtype,warn <- [before variant]Set Variant[[variant]Name >>]
+				}
+				Val[warn]
+				{
+					Print[[[["Warning: Invalid variant for type "]Append[[before variant]Name >>]]Append[" on field "]]Append[name]]
+					fieldtype <- Val[before variant]
+				}
+			}{
+				fieldtype <- Val[before variant]
+			}
+		}{
+			fieldtype <- Type Instance["Any Type"]
+		}
+		out <- [list]Append[New@Blueprint Field[name, fieldtype]]
+	} {} {} {
+		out <- [list]Append[New@Blueprint Field[name, Type Instance["Any Type"]]]
 	}
 }
 
@@ -779,7 +804,7 @@
 		{
 			body lines <- [body]Split["\n"]
 			more lines <- [[[body lines]Length] - [1]] + [name lines]
-			fields <- Fold[["Process Blueprint Field"]Set Input[2, [params]Blueprint Type Delim >>], New@List[], Filter[Map[body lines, ["Trim"]Set Input[1,"\n\r\t "]], "Filter Empty"]]
+			fields <- Fold[["Process Blueprint Field"]Set Input[2, params], New@List[], Filter[Map[body lines, ["Trim"]Set Input[1,"\n\r\t "]], "Filter Empty"]]
 			new tree <- [tree]Blueprints << [ [[tree]Blueprints >>]Set[name, New@Blueprint Definition[name, fields]] ]
 			out <- Null[~, params, new tree, [lines] + [more lines]]
 		} {} {