String To Haxecode (Without Macros)?

86 views
Skip to first unread message

AlienCoder

unread,
Dec 28, 2015, 12:46:24 PM12/28/15
to Haxe


Hello Community,

is there a method to parse a string to haxecode without using macros?

I want to link an xml structure to fields or functions. They should correspond with the xml dom on runtime (that's why I don't want to use macros).

I am also aware, that I could have a similar effect when I would link the dom as a method implemented in the source code. But I consider linking within an xml dom to be more reusable.

Linking from within xml should look a little bit like the following:

XML-Dom:

<root>
<xmlFile>c:dir/subDir01/subDir02</xmlFile>
<element01>
<subElement01>
<passOver objectName="myObject" fieldName="myField">content to be passed over</linkTo>
</subElement01>
</element01>
<root>

Haxe-Source-Code:

class Main
{
    static function main()
    {
var myObject : MyClass = new MyClass();
var xml : Xml = Xml.parse( <xmlFile> );
LinkToXML.link( xml );
   // This method is supposed to evaluate the dom and to pass over specific values.
 }
}


Of course, this is only a sketch.

But can I parse the string, safed in an XML element, as haxe code (e.g. a function call or a field access) on runtime?

Kind regards
Michael



Alexander Kuzmenko

unread,
Dec 28, 2015, 4:42:46 PM12/28/15
to Haxe
http://lib.haxe.org/p/hscript/

понедельник, 28 декабря 2015 г., 20:46:24 UTC+3 пользователь AlienCoder написал:
Message has been deleted

AlienCoder

unread,
Dec 29, 2015, 6:17:08 AM12/29/15
to Haxe
Hello Alexander,

thanks again for your answer. I've tried it out. It perfectly fits my needs...
:-)

Kind regards
Michael
Reply all
Reply to author
Forward
0 new messages