iwillspeak / ironrure Goto Github PK
View Code? Open in Web Editor NEW.NET Bindings to the Rust Regex Crate
License: MIT License
.NET Bindings to the Rust Regex Crate
License: MIT License
Move the P/Invoke stuff into a separate assembly: IronRure.Batteries
or something.
At the moment we have two classes (Regex
and Error
) which are IDisposable wrappers around raw pointers. The IDisposable
implementations are pretty much the same for both. With the addition of captures it might be worth creating an abstract base class for this.
This would make logical sense to allow the user to enumerate the matches in a given capture group.
Could be as simple as a yield
-based custom iterator which loops through the capture indices and returns the matches one by one by doing self[i]
.
Currently if you target Any CPU the output directory will contain just one copy of the rure.dll
library. This can be worked around for different architectures by manually targetting the appropriate architecture's Runtime Identifier (win7-x64
etc).
For .NET Framework we can work around this at runtime by manually loading the correct library disk in the RureFfi
class's static-constructor. This should ensure the library is loaded before P/Invoke gets involved. For .NET core this shouldn't be needed as the appropriate library will be loaded from the runtimes
folder.
Looks like the switch to load based off the app context base directory has broken assembly loading in IIS.
The specific change appears to be this modification to the FFI Code
Captures support for regex searching and the ability to query captures information from the regex itself.
Add a Regex.Captures
method (or similar based on the naming scheme from .NET). This should provide a set of captures that can be directly queried by indexing with [uint]
, along with iteration support.
Given a regex instnace you should be able to convert a capture name into a capture index. Maybe use an indexer here again. E.g.: new Regex("(<foo>.)")["foo"] // => 1
.
Create a second package which wraps the main IronRure one and provides a 'drop-in' replacement for .NET Regex.
Currently the Regex
class can only be instantiated with a basic pattern. Add a constructor overload that takes an options object and flags integer.
The Options
object should itself be a managed wrapper around the rure_options
, handling the lifetime of that object. This should allow users to cache options between creating multiple Regex
instances.
Add the following methods to Regex
:
Replace
- replaces the first match.ReplaceAll
- replaces all matches.These should accept either constant strings, closures or IReplacer
instances in the same way that the rust regex and rust-onig do.
Update the constructor of Regex
to add an overload which takes flags but no options, similar to the RegexSet
. Ideally both should have the same set of constructors for 1.0.
Change the version of the rust regex crate that the batteries reference and upgrade the batteries in this project.
Should show a performance comparison between this lib and .NET Regex and RE2.NET.
The batteries were not published the first time that 1.1.2 was built https://ci.appveyor.com/project/iwillspeak/ironrure/build/1.0.148. The build still shows as green however.
Create a wrapper around rure_regex_set
. This should be really useful as it minimises the number of managed/unmanaged transitions required to match the regex.
Like the title says. Now regex 1.0 is a thing we should move to using it in this library.
Currently this defaults to WinAPI on windows. Should be C call.
Each of the DllImport
attributes in the RureFfi
class needs to have the calling convention set to the c calling convention (CallingConvention.Cdecl
).
https://docs.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.dllimportattribute.callingconvention?view=netcore-2.0
https://docs.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.callingconvention?view=netcore-2.0#Fields
Currently the package description and author are empty. Create package descriptions and add them to the .csproj
files.
add
new RegexSet(RureFlags flags, params string[] patterns);
new RegexSet(RureFlags flags, Options options, params string[] patterns);
Switchout the unmanaged resource with specific handle wrappers that inherit from SafeHandle
. This should bring some extra safety to the handle types as SafeHandle
s appear to work transparently with FFI.
Thread-local scratch space is only clearered when the regex is disposed. If regexes are used on the threadpool you can end up with quite a lot of memory usage quite quickly.
We could solve this by exposing the ability to clone the regex for each match.
I don't know what I was up to when I originally googled the satellite launch date used in the README but it isn't correct. Sputnik was launched in 1957. I've got the tee shirt and everything.
Update the README to correct the date of first satellite launch, and any places that depend on it.
Currently the projects and tests in IronRure work correctly, however consumers of the
IronRure package will not get the ContentFiles from the windows batteries. This can
be fixed by removing contentFiles from the 'dependency assets'.
This should just be a matter of adding the following to the batteries nuget reference:
<PrivateAssets>analyzers;build</PrivateAssets>
This repo's package doens't properly expose license information to NuGet
consumers. We should set the PackageLicenseExpression
to MIT.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.