Skip to content

Parsing a markup language #292

Answered by joshmarinacci
nik-lus asked this question in Help
Mar 28, 2021 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

Yeah, Ohm really needs more examples. For of my projects I needed to pull docs out of source code. Here's the code that does it. I really need to write a blog on it, but the short version is I broke it up into two phases. Phase ONE just looks for the embedded blocks based on the delimiter. /** and */ in my case. The semantics returns an array of blocks for the document. Phase TWO then parses the structure inside of the markup.

In your case you'd need to look for the ^^ in phase one, then do a separate pass for what's inside. I've also done markdown parsers that work similarly.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@nik-lus
Comment options

@pdubroy
Comment options

Answer selected by nik-lus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants