Before continuing any further, we should test our parser in order to be sure that it works as expected.
To do this, we can use the following configuration file:
nameMyComponent 1 textHelloWorld 0
If everything works as expected, we should have a name metadata with the value MyComponent
and a property named text with the value HelloWorld.
Let's write a simple test class:
class ComponentImpl { public static function main(): Void { var comp = ComponentParser.parseConfigurationFile("conf.txt"); trace(comp.properties.get("text")); trace(comp.metadata.get("name")); } }
Now, if everything went well, while running this program, you should get the following output:
ComponentImpl.hx:6: HelloWorld ComponentImpl.hx:7: MyComponent