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

Using Oniguruma library (optionally) #81

Merged
merged 3 commits into from Jan 29, 2022

Conversation

data-man
Copy link
Contributor

@data-man data-man commented Jan 24, 2022

Can be tested by $ make USE_ONIGURUMA=1. Of course Oniguruma should be installed, e.g. $ sudo apt install libonig-dev.
I only tested on Linux. ;)

@data-man data-man mentioned this pull request Jan 24, 2022
13 tasks
Copy link
Owner

@tavianator tavianator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this! Just some minor comments for now, but I'm excited to see it support other regex types.

Makefile Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
regexp.h Outdated Show resolved Hide resolved
@data-man
Copy link
Contributor Author

@tavianator What else can I do in this PR?

@tavianator
Copy link
Owner

Mostly I just need to try it out myself, haven't gotten to it yet. Also, even if it's incomplete, if you have an example of how it would enable a new regex flavour that would be good to see.

@data-man
Copy link
Contributor Author

if you have an example of how it would enable a new regex flavour

First we need to define a switches for RE dialects.
Maybe #21 is the best place for that.

@tavianator
Copy link
Owner

There's already -regextype. It would be nice to get close to full compatibility with GNU find there.

@data-man
Copy link
Contributor Author

Ok, got it!
I assumed you would do a new release with this PR. So that users could test it. ;)

@tavianator
Copy link
Owner

I'm open to a release that just adds the library without the new regex flavours, but I'd like to see that it's at least possible to implement them with this library

@data-man
Copy link
Contributor Author

I'd like to see that it's at least possible to implement them with this library

https://github.com/kkos/oniguruma/blob/a2ac402a3549713e6c909752937b7a54f559beb8/src/oniguruma.h#L433-L445

/* predefined syntaxes (see regsyntax.c) */
#define ONIG_SYNTAX_ASIS               (&OnigSyntaxASIS)
#define ONIG_SYNTAX_POSIX_BASIC        (&OnigSyntaxPosixBasic)
#define ONIG_SYNTAX_POSIX_EXTENDED     (&OnigSyntaxPosixExtended)
#define ONIG_SYNTAX_EMACS              (&OnigSyntaxEmacs)
#define ONIG_SYNTAX_GREP               (&OnigSyntaxGrep)
#define ONIG_SYNTAX_GNU_REGEX          (&OnigSyntaxGnuRegex)
#define ONIG_SYNTAX_JAVA               (&OnigSyntaxJava)
#define ONIG_SYNTAX_PERL               (&OnigSyntaxPerl)
#define ONIG_SYNTAX_PERL_NG            (&OnigSyntaxPerl_NG)
#define ONIG_SYNTAX_RUBY               (&OnigSyntaxRuby)
#define ONIG_SYNTAX_PYTHON             (&OnigSyntaxPython)
#define ONIG_SYNTAX_ONIGURUMA          (&OnigSyntaxOniguruma)

@tavianator tavianator merged commit e89b125 into tavianator:main Jan 29, 2022
@data-man data-man deleted the oniguruma_1 branch January 29, 2022 21:43
@data-man
Copy link
Contributor Author

Thanks!
Now I can start working on a better Oniguruma integration! :)

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

Successfully merging this pull request may close these issues.

None yet

2 participants