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
53 stars 22 forks source link

Adding Factor lexer #119

Closed mrjbq7 closed 1 month ago

mrjbq7 commented 1 month ago

The Factor programming language project has had a copy of a lexer for Factor that should probably be upstreamed.

https://github.com/factor/factor/blob/881aa979b86034a9330db9f372e7c6cd10a313f8/misc/textadept/lexers/factor.lua

I pulled it out for upstreaming.

orbitalquark commented 1 month ago

Thanks for your contribution! This is a lexer written in a really old format that will need to be migrated before it can be added. There will be two-steps in this process. First:

https://github.com/orbitalquark/scintillua/blob/64f3a6a42493139c836238a6df2837739f739c48/lexers/lexer.lua#L460-L571

Then: https://orbitalquark.github.io/scintillua/api.html#migrating-legacy-lexers

I can do this for you, but it will be in my own time.

mrjbq7 commented 1 month ago

Okay great, I will do this in a week or so.

mrjbq7 commented 1 month ago

Okay, I updated the lexer from legacy, and added a test.

Perhaps a second pass would improve a few things about syntax highlighting for Factor but it's quite usable as-is.

Some comments:

1) tried to use make deps but it had an error checking the certificate for lpeg-1.1.0.tar.gz, so I briefly tried this:

-$(lpeg_tgz): ; $(WGET) http://www.inf.puc-rio.br/~roberto/lpeg/$@
+$(lpeg_tgz): ; $(WGET) --no-check-certificate http://www.inf.puc-rio.br/~roberto/lpeg/$@

2) but it didn't seem to build the deps properly, so I just switched to using luarocks install lpeg and luarocks install luafilesystem.

3) make tests only has a single failure in test_lua51 which is only because I don't have it installed on my system.

Is there anything else you need done to this?

mrjbq7 commented 1 month ago

And I just noticed the "second pass" request, which includes lexer.new(...), anyway I did that also.

orbitalquark commented 1 month ago

Thank you! I will review and add this when I have some time.

orbitalquark commented 1 month ago

Added in https://github.com/orbitalquark/scintillua/commit/043379192a3a96abe6968b14317c03c8bd00bd54