Help with constructing an npeg parser

2021-04-07 Thread kaushalmodi
> Not sure why you're going via JSON to HTML though. May be you are wondering that based on the example above. The actual parsed object is more complex: It's nested objects and some of those objects have seq type members. I am thinking that JSON would be a good intermediate format. The final HT

Help with constructing an npeg parser

2021-04-07 Thread PMunch
You're welcome :) Npeg can be a bit tricky to get the hang of, but once you've got it it's a really nice library. And the speed of the resulting parser is really good considering how easy it is to use! To parse it into JSON all you need to do is change how the `Record` type is generated, should

Help with constructing an npeg parser

2021-04-06 Thread kaushalmodi
Thanks, that fix helped me instantly fix the parsing of a 55k lines log file. I really appreciate your prompt help. Your fixed version makes a lot of sense. I had been dabbling with putting the "random" in the record and also in the main "records" sequence, but I never came across the `+(record

Help with constructing an npeg parser

2021-04-06 Thread kaushalmodi
Thank you so much!

Help with constructing an npeg parser

2021-04-06 Thread PMunch
Here you go:

Help with constructing an npeg parser

2021-04-06 Thread kaushalmodi
Hello, I need help with constructing an npeg parser. I am able to create a parser that matches consecutive matches of a given pattern. But I am unable to create one that allows random text before/inbetween/after the pattern matches. You can see my attempts in this minimal reproducible example