Mercurial > repos > rhope
diff parser_old.rhope @ 40:789a146a48e1
Started adding support for naked values in user defined objects
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Fri, 09 Oct 2009 01:01:26 -0400 |
parents | 640f541e9116 |
children | aabda74c7a88 |
line wrap: on
line diff
--- a/parser_old.rhope Thu Oct 08 00:37:24 2009 -0400 +++ b/parser_old.rhope Fri Oct 09 01:01:26 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]] } {} {