mercredi 29 juillet 2015

Which pattern should I choose when writing a node-file parser lib?

I am writing a file-parser (in fact 2 parsers). There are two node types as follow.

node struct 1

[nodeName]
    param1 = v1;
    param2 = v2;

node struct 2

nodeName=
    (param1 = (param2=v2)(param3=v3)
    )

When I wrote two parsers, I found they have same loadFile, insertNode, deleteNode, updateNode, isNodeExist function. The difference between two parser is the core parser and serializer.

So, can I user any pattern to remove redundant?

Thanks!

Aucun commentaire:

Enregistrer un commentaire