orbitalquark / scintillua

Scintillua enables Scintilla lexers to be written in Lua, particularly using LPeg. It can also be used as a standalone Lua library for syntax highlighting support.
https://orbitalquark.github.io/scintillua
MIT License
52 stars 22 forks source link

Replace `man` lexer by improved `troff` one #84

Closed Eolien55 closed 1 year ago

Eolien55 commented 1 year ago

As the title suggests, I wrote an improved version of the man lexer, while still retaining most of its features. -man headers highlighting have been kept, and the rest is way more generic (strings, all-caps/all-lowercase macros, etc.). It should also be noted that this lexer incorporates groff-specific elements, such as whiles and other structured programming.

What's been added :

What could be improved :

Eolien55 commented 1 year ago

I've migrated the lexer as you asked; is the result acceptable?

orbitalquark commented 1 year ago

This looks better. I'll have a more thorough look when I have some time and get back to you. Thanks!

Eolien55 commented 1 year ago

I believe I've gone over all your change requests

Eolien55 commented 1 year ago

I believe the lexer works correctly, and is complete.

If you can get it to lex everything man does and more

I have this test file, and my lexer effectively lexes everything man does, and more.

.NH 1 \" ms's way of declaring headings
A \fBHeading\fP
.so included.1
.PP
Wonderful\*[SUP]Mom macro set's way of making supertext\*[SUPX]
.PS
\" I don't know how pic works
.PE

\[some random escaped text]

\s+(88
.HEADING 1 "First-level heading" \" Mom macro's headings

As a sidenote, I find it quite funny that even Github doesn't highlight troff code correctly.

orbitalquark commented 1 year ago

Added via https://github.com/orbitalquark/scintillua/commit/369ee2bb1b6e8c6a613c45e1ee88779e28060e85. Thanks for your time and patience!