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

Look into using Lua PEG #1

Open
alerque opened this issue Oct 22, 2019 · 2 comments
Open

Look into using Lua PEG #1

alerque opened this issue Oct 22, 2019 · 2 comments

Comments

@alerque
Copy link
Member

alerque commented Oct 22, 2019

Right now the syntax level supported by this plugin sucks. I can of course keep working on the regular expressions and make them a lot better. However before I do that it occurred to me...

Both vim an neovim support Lua based plugins, with the latter having very good support. SILE is written in Lua and the TeX-like grammar is already being parsed in PEG to an AST with position information.

Would it be possible to either call out to SILE or rip out the LPEG work and reuse it for this syntax plugin? The biggest issue that comes to mind is that any syntax errors will cause the whole thing to die. Are there other issues? Is there even a way to wire this up?

@alerque
Copy link
Member Author

alerque commented Oct 22, 2019

@pkulchenko I'm curious if you have any pointers for me given your experience with Lua and editors. Never-mind wining it up to vim, is doing syntax highlighting from a PEG grammar even feasible? Is this a hair-brained idea?

@pkulchenko
Copy link

@alerque, scintillua does this quite successfully, but it relies on Scintilla to do the actual rendering of the highlighted components (so it does the lexing itself and plugs into Scintilla to report the parts that need to be highlighted). I've integrated that into ZeroBrane Studio and also did custom LPEG-based lexers in Lua.

So, I think the answer to your question is "yes", it's possible, but you'd need to find a way to report the result of the parsing back to the editor for styling. It may even be possible to modify lexer.lua from scintillua to generate the structures that neovim expects.

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