1

Ive created a very large PyParsing tree from reading ISB Bind9 named.conf file.

Now I wish to redirect my attention to generating an output back to the way it was syntactically read and created from.

I see a close answer and example for a JSON output in StackOverflow.

Is there a small working example for a custom output/generator Python class, mostly to support recreation from what was read into the tree?

1
  • Interesting question. I would not see much value in having pyparsing just regenerate the original text, but what if you used your parser to normalize the input syntax into a more standardized form? Can you post some example input text, and how you would like to see it reconstructed after running through pyparsing? (My initial thoughts at implementing such a thing would be to use parse actions to create structured data objects, and then have a method on those classes to emit their contents in the standard form.) Commented Apr 1, 2024 at 15:08

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.