Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Support Fennel. #530

Merged
merged 3 commits into from
Jul 16, 2021
Merged

Support Fennel. #530

merged 3 commits into from
Jul 16, 2021

Conversation

technomancy
Copy link
Contributor

This adds support for the Fennel programming language: https://fennel-lang.org

I couldn't find much explanation for what the different lexer rules
meant, so I based it off of Clojure's lexer since the two languages
share a very similar syntax.

I also included a program to generate a list of keywords from Fennel's
own listing, which will make it easier to update in the future.

This adds support for the Fennel programming language: https://fennel-lang.org

I couldn't find much explanation for what the different lexer rules
meant, so I based it off of Clojure's lexer since the two languages
share a very similar syntax.

I also included a program to generate a list of keywords from Fennel's
own listing, which will make it easier to update in the future.
@alecthomas
Copy link
Owner

Nice, thanks. Can you add some test data per the README in the lexers directory?

@technomancy
Copy link
Contributor Author

technomancy commented Jul 15, 2021

Sure; I'll give it a shot. I don't have the golang tooling installed on my machine and don't really want to go thru all that, so I'll push it out to CI and see if I can generate the .expected file from there.

Edit: ugh, for some reason CircleCI is blocking me from SSHing into the build so my plan to fix this won't work.

@technomancy
Copy link
Contributor Author

Got some help with generating the fennel.expected file, however, there are a lot of "error" entries in the listing. However, there's not really any context given about what the error actually is. Could you advise?

@alecthomas
Copy link
Owner

An error entry means that input text wasn't matched by any of the patterns.

@alecthomas
Copy link
Owner

BTW you should be able to install and run go automatically via ./bin/go

@technomancy
Copy link
Contributor Author

I see; so it sounds like maybe the problem is that whitespace needs to be listed explicitly then?

I was basing this off the Clojure lexer, which doesn't do this. But maybe the Clojure lexer is broken too? https://github.com/alecthomas/chroma/blob/master/lexers/c/clojure.go I don't see any tests for it so maybe it just got overlooked?

@alecthomas
Copy link
Owner

When I initially created Chroma there was no test data, so many lexers are missing them.

However Clojure does match whitespace here.

@technomancy
Copy link
Contributor Author

I see. But that treats whitespace as Text, which I think is wrong? Shouldn't it be classifying it as whitespace instead?

@alecthomas
Copy link
Owner

Linter is failing. I'll paste it in here so you don't have to login to Circle:

lexers/f/fennel.go:47: File is not gofmt-ed with -s (gofmt)

Just run ./bin/gofmt -w ./lexers/f/fennel.go

@technomancy
Copy link
Contributor Author

Looks like it doesn't support my machine.

~/src/chroma $ ./bin/gofmt -w ./lexers/f/fennel.go
Bootstrapping /home/phil/.cache/hermit/pkg/hermit@stable/hermit from https://github.com/cashapp/hermit/releases/download/stable
Downloading https://github.com/cashapp/hermit/releases/download/stable/hermit-linux-aarch64.gz to /home/phil/.cache/hermit/pkg/hermit@stable/hermit
curl: (22) The requested URL returned error: 404 

gzip: stdin: unexpected end of file

Maybe I can try it on another machine later.

@technomancy
Copy link
Contributor Author

Quicker to just replace the spaces with tabs manually I guess...

@alecthomas alecthomas merged commit d402102 into alecthomas:master Jul 16, 2021
@alecthomas
Copy link
Owner

Thanks for persisting.

Out of curiosity, what sort of machine are you running on?

@technomancy
Copy link
Contributor Author

Thanks for your help!

I'm developing on an MNT Reform. https://mntre.com/

@technomancy technomancy deleted the fennel-lexer branch July 16, 2021 02:03
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants