How to make a syntax highlighter using antlr+qscintilla?

97 views
Skip to first unread message

BPL

unread,
Jun 6, 2019, 12:35:03 PM6/6/19
to antlr-discussion
Hi, in the past I've used few different syntax highlighting libraries such as pygments, syntect, qt's syntax highlighter or qscintilla's lexers on top of QScintilla.

Right now I'd like to explore the idea of using Antlr to provide syntax highlighting on my text editor written in python+QScintilla.

Right now I've learned how to get all tokens + positions from the whole text and I think that could work with little chunks of texts on every keystroke. I'm afraid
doing that is not the right way to rehighlight text and I'd like to learn how to make proper syntax highlighting on large files using Antlr lexers/parsers.

Could anyone please explain me what'd be the algorithm/s to use here? Furthermore, scintilla support multi-cursor editing so it may happen
that you need to rehighlight the whole file (think about adding a multiline comment at the beginning of the file)... and if the file is big I'm not sure rehighlighting 
the whole text on each keystroke would the smartest choice here.

Thanks in advance

BPL

unread,
Jun 7, 2019, 12:46:02 PM6/7/19
to antlr-discussion
I've created a little question in SO tu support my previous abstract question... https://stackoverflow.com/questions/56498227/how-to-highlight-qscintilla-using-antlr4
hopefully you guys will be able to advice there ;)
Reply all
Reply to author
Forward
0 new messages