Replies: 1 comment 4 replies
-
It's a pretty good start, you were almost there. The main issue was that your attributes needed to be parsed into a slice. Here's working code that parses all the example inputs you gave. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am willing to create a F5 configuration parser using participle.
I start with simple object (ltm node, as described here https://clouddocs.f5.com/cli/tmsh-reference/latest/modules/ltm/ltm_node.html).
I have no experience in writing parsers and the existing examples do not cover complexe cases (or I didn't understand it :-) ).
For now I am testing a basic subset of ltm node with:
and
For code simplicity and usage I already split each config block in a single string to process on its own (in other word I do not want the parser to process the whole file, but just some parts of it)
I started with a stateless lexer but I quickly ended up with some errors mainly because of description strings which can confuse other tokens.
I guess having a stateful parser will help but I am not able to define it correctly.
Any help would be highly appreciated.
Once I have a simple working example I can do all other parts.
Thanks in advance.
Here is my stateless attempt:
In the same vain here is a statefull attempt:
Beta Was this translation helpful? Give feedback.
All reactions