Hi Sergey,
Thanks for getting back to me.
I had a look at the link you sent me.
Since I was working with c#, the code did not translate exactly - which was fine.
I now have an implementation that is approached the same way - parses into a tree and then has a toHtml function that does the markup generation from that tree.
The only thing I did not implement was the $ operand.
The reason for this was I preferred to extend the library to have it bind with a collection of objects.
Assumption here is that the toString function of the underlying type would take care of any internal markup.
Ex:
public static class Zen
{
public static string toHtml(string zenStatement, IEnumerable[] collections)
{..}
}
public class program{
public static void main()
{
...
List<Entity1> _list1 = new List<Entity1>();
List<Entity2> _list2 = new List<Entity2>();
IEnumerable [] collections = {_list1,_list2};
//code to get your lists populated
// _list1.Count = 4 and _list2.Count = 2
...
Console.WriteLine(Zen.toHtml("div>p*4+(div>p*2)",collections);
}
}
----
I am now focusing on testing and ensuring that this library works correctly and also test from a performance point of view.
Have you in course of development now generated a set of test expressions and expected output that I could perhaps have a look at?
Cheers
Pradeep