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

Use a lexer/parser lib like ANTLR #51

Open
Khaos66 opened this issue Dec 21, 2022 · 2 comments
Open

Use a lexer/parser lib like ANTLR #51

Khaos66 opened this issue Dec 21, 2022 · 2 comments

Comments

@Khaos66
Copy link

Khaos66 commented Dec 21, 2022

Instead of spliting all strings by yourself you should use a lexer like ANTLR.
This has many benefits:

  • There might already be a markdown language definition for ANTLR on the internet.
  • You will get a stream of tokens, that can be parsed way more easy
  • Parsing might be even faster (ANTLR4 is highly optimized)
  • For each token you know the exact index of the original string, that it originates of. Helpfull for New Plugin: CheckBox #50
@Khaos66
Copy link
Author

Khaos66 commented Dec 22, 2022

https://github.com/mar9000/antmark is an ANTLR markdown grammar from 8 years ago...
There is a request for a standard grammar on the ANTLR repo antlr/grammars-v4#472
Also they mention this article http://roopc.net/posts/2014/markdown-cfg/ which nullifies all of this =/

@Rast1234
Copy link

Rast1234 commented Jul 3, 2023

if anyone is interested, there is a more or less standartized spec now and and it comes with a test suite https://commonmark.org/

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