Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Is it applicable to parsing markdown? #48

Open
codemonc opened this issue Jun 14, 2022 · 2 comments
Open

[Question] Is it applicable to parsing markdown? #48

codemonc opened this issue Jun 14, 2022 · 2 comments

Comments

@codemonc
Copy link

codemonc commented Jun 14, 2022

I want to convert between 2 similar formats (DokuWiki -> Obsidian).
But I fail to describe a term "arbitrary text that is not matched by any terms, but surrounded by any recognizable terms". Like, ** any such text // and another one//**, where "**" and "//" are terms properly described to the parser generator.

@CamelCaseCam
Copy link

I've solved this by having open and closed term blocks. I'll have a rule where there's a nterm OPEN_BLOCK with the rules OPEN_BLOCK(OPEN_BLOCK, GENERIC_TERM) and OPEN_BLOCK(OPENING_TERM, GENERIC_TERM). In this case, GENERIC_TERM matches everything, but with very low precedence. I'm also working on adding a wildcard term, though. You could create GENERIC_TERM as a regex_term with the search string \S* or something like that. Then just add terms for spaces and/or newlines

@CamelCaseCam
Copy link

Oh yeah, and you'd close OPEN_BLOCK by having the nterm BLOCK with the rule BLOCK(OPEN_BLOCK, CLOSING_TERM)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants