As far as I know, it's a parser that we define grammar and verbs to parse some text You can.
I have successfully used my built-in JSON parser to parse some JSON strings, but I want to do more. I want to write a JSON format which can format JSON in beautiful print style.
But I do not know what to do. Do I have to build a tree for making some nodes and Jasnas purse? And how to do this?
I'm trying to see some samples, but I have not found it yet.
PetitParser does not help directly with your beautiful printing. Specifically you can write code that will cross the map and list the parser returns and print it as much as you want. Alternatively (for more complex grammar) you can sub-class Jasonjimarar and produce AST of custom parsing nodes. After this, you write a visitor or cross the nodes in order to format the data according to the results. For example it's absolutely fine. Petit Pars for Smalltalk comes with a small framework named PrettyPetit which keeps you well with a block leg engine, wrap and wire aligns ; But the process of generating such formatting instructions happens in the same way as when doing the manual described above.
No comments:
Post a Comment