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

Use native rust regex? #12

Closed
TyOverby opened this issue Jul 11, 2016 · 10 comments
Closed

Use native rust regex? #12

TyOverby opened this issue Jul 11, 2016 · 10 comments

Comments

@TyOverby
Copy link
Contributor

Having a dependency on a cmake and a C compiler makes it hard to use this project due to the dependency libonig. Would it be possible to switch over to the official rust regex package?

@trishume
Copy link
Owner

No, because Sublime syntaxes use all sorts of fancy features like back-references. It might be possible to switch to fancy-regex from the pulldown-cmark repo with some extra work on that library though. That library isn't quite good enough yet but it might be with a bit of work.

@TyOverby
Copy link
Contributor Author

Oh interesting, I expected some missing feature to be the reason that you didn't use the official rust regex crate.

Fancy-regex looks interesting, they even mention sublime-text syntax files as being a use case. Are they using it to highlight source files as well?

@trishume
Copy link
Owner

It was written by the author of https://github.com/google/xi-editor in anticipation of him writing a highlighter for Sublime Text syntax files, I just got to it first. It's currently mostly but not completely finished, and not used by anything as far as I know.

@DemiMarie
Copy link

@trishume The regex crate could still be used (and be a performance win) on regexps that it supports.

@anowell
Copy link

anowell commented Jan 30, 2017

+1. I was experimenting with syntect in a project targeting emscripten (basically using syntect in the browser as an alternative to highlight.js), but it chokes on building onig_sys.

@trishume
Copy link
Owner

@anowell I seem to remember that the regex crate also doesn't work with emscripten yet, so that wouldn't be much help. Has that changed? Or possibly am I misremembering this and it has always worked with emscripten?

@anowell
Copy link

anowell commented Jan 31, 2017

Looks like it should work as of regex 0.2 (see rust-lang/regex#307). I just tried a very basic match to confirm and had success.

fancy-regex on the other hand currently leverages regex = "0.1.63" for its NFA regex instructions (and panics accordingly for the same basic match), so at the very least, it'd take bumping the regex dependency there to target emscripten.

@kornelski
Copy link
Contributor

It'd be great to have a better regex library. I've been getting segfaults in Oniguruma.

@trishume
Copy link
Owner

See #34, work on this has stalled since I'm busy/interested in other things. I still maintain syntect but don't actively work on new features myself anymore. But if someone else volunteers to work on getting #34 up to date and high quality then I'm happy to mentor and code review.

@Enselic
Copy link
Collaborator

Enselic commented Oct 4, 2021

This issue can be closed with the motivation:

Fixed in https://github.com/trishume/syntect/releases/tag/v4.0.0

(Maybe someone with Collaborator privileges can help me clean the syntect issue inbox? This is one of a handful cleanup actions we can take. I will happily point out more if someone is interested in helping me out.)

varungandhi-src pushed a commit to varungandhi-src/syntect that referenced this issue Dec 27, 2021
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

7 participants