Giter Site home page Giter Site logo

dmitryolshansky / rewind-regex Goto Github PK

View Code? Open in Web Editor NEW
10.0 4.0 0.0 163 KB

Rewind regex, radical effort to unleash std.regex from std library constraints to make it great again

License: Boost Software License 1.0

D 99.94% Shell 0.06%
regex fast dlang regexp dub streaming

rewind-regex's Introduction

REwind Regex

Build Status

REwind Regex is designed to be a simpler, more innovative alternative to std.regex library.

Unleashed from contraints of std.library REwind Regex aims to provide greater speeds and streaming capabilities, sacrificing complex features for more powerful use cases.

However most easy improvements that got battle tested in REwind Regex would eventually be backported.

In general - pick std.regex if:

  • need stability over performance
  • compile-time regex (if you have patience and RAM to afford it)
  • need backreferences
  • love helpers such as splitter, replaceFirst/replaceAll etc.

Try REwind Regex if your use case is:

  • grep-like tool or search engine
  • streaming with IOpipe library (related to previous point)
  • performance is more important then having e.g. backreference
  • hate useless cruft that you can easily implement yourself
  • 100% @nogc (in the future) once exceptions are tackled by the language

Technical details

TBD.

rewind-regex's People

Contributors

dmitryolshansky avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

rewind-regex's Issues

Use threaded-code interpreter

It turns out I might be able to get all of benefits of threaded-code w/o having computed goto or similar crap.
All I need is jump-call trivially doable with naked assembly + reseting stack pointer on each jump-call. In fact I could use my own separate stack area that is properly sized for the task.

Sensible prototype is my gists, but needs more care to adjust stack properly.

Build isn't working

I've tried to build the library locally. But it gave me some errors:

pry 0.4.0: building configuration "library"...
/ldc2-1.30.0-osx-arm64/bin/../import/std/uni/package.d(6545,39): Error: none of the overloads of template std.range.primitives.save are callable using argument types !()(SimpleStream!string)
/ldc2-1.30.0-osx-arm64/bin/../import/std/range/primitives.d(2256,22): Candidate is: save(T)(return scope inout(T)[] a)
../../../.dub/packages/pry-0.4.0/pry/src/pry/grammar/parser.d(35,26): Error: template instance std.uni.unicode.parseSet!(SimpleStream!string) error instantiating
../../../.dub/packages/pry-0.4.0/pry/src/pry/atoms.d(175,16): Error: none of the overloads of template std.uni.InversionList!(GcPolicy).InversionList.toString are callable using argument types !()(void delegate(const(char)[] s) pure nothrow @safe, FormatSpec!char)
/ldc2-1.30.0-osx-arm64/bin/../import/std/uni/package.d(2446,10): Candidate is: toString(Writer)(scope Writer sink, ref scope const FormatSpec!char fmt)
../../../.dub/packages/pry-0.4.0/pry/src/pry/atoms.d(200,10): Error: template instance pry.atoms.parsers!(SimpleStream!string).Set!(InversionList(CowArray([0u, 39u, 40u, 92u, 93u, 1114112u, 1u]))) error instantiating
../../../.dub/packages/pry-0.4.0/pry/src/pry/grammar/parser.d(70,5): instantiated from here: set!(InversionList(CowArray([0u, 39u, 40u, 92u, 93u, 1114112u, 1u])))
../../../.dub/packages/pry-0.4.0/pry/src/pry/atoms.d(175,16): Error: none of the overloads of template std.uni.InversionList!(GcPolicy).InversionList.toString are callable using argument types !()(void delegate(const(char)[] s) pure nothrow @safe, FormatSpec!char)
/ldc2-1.30.0-osx-arm64/bin/../import/std/uni/package.d(2446,10): Candidate is: toString(Writer)(scope Writer sink, ref scope const FormatSpec!char fmt)
../../../.dub/packages/pry-0.4.0/pry/src/pry/atoms.d(200,10): Error: template instance pry.atoms.parsers!(SimpleStream!string).Set!(InversionList(CowArray([48u, 58u, 65u, 71u, 97u, 103u, 1u]))) error instantiating
../../../.dub/packages/pry-0.4.0/pry/src/pry/grammar/parser.d(81,18): instantiated from here: set!(InversionList(CowArray([48u, 58u, 65u, 71u, 97u, 103u, 1u])))
../../../.dub/packages/pry-0.4.0/pry/src/pry/atoms.d(175,16): Error: none of the overloads of template std.uni.InversionList!(GcPolicy).InversionList.toString are callable using argument types !()(void delegate(const(char)[] s) pure nothrow @safe, FormatSpec!char)
/ldc2-1.30.0-osx-arm64/bin/../import/std/uni/package.d(2446,10): Candidate is: toString(Writer)(scope Writer sink, ref scope const FormatSpec!char fmt)
../../../.dub/packages/pry-0.4.0/pry/src/pry/atoms.d(200,10): Error: template instance pry.atoms.parsers!(SimpleStream!string).Set!(InversionList(CowArray([65u, 91u, 95u, 96u, 97u, 123u, 1u]))) error instantiating
../../../.dub/packages/pry-0.4.0/pry/src/pry/grammar/parser.d(100,14): instantiated from here: set!(InversionList(CowArray([65u, 91u, 95u, 96u, 97u, 123u, 1u])))
../../../.dub/packages/pry-0.4.0/pry/src/pry/atoms.d(175,16): Error: none of the overloads of template std.uni.InversionList!(GcPolicy).InversionList.toString are callable using argument types !()(void delegate(const(char)[] s) pure nothrow @safe, FormatSpec!char)
/ldc2-1.30.0-osx-arm64/bin/../import/std/uni/package.d(2446,10): Candidate is: toString(Writer)(scope Writer sink, ref scope const FormatSpec!char fmt)
../../../.dub/packages/pry-0.4.0/pry/src/pry/atoms.d(200,10): Error: template instance pry.atoms.parsers!(SimpleStream!string).Set!(InversionList(CowArray([48u, 58u, 65u, 91u, 95u, 96u, 97u, 123u, 1u]))) error instantiating
../../../.dub/packages/pry-0.4.0/pry/src/pry/grammar/parser.d(100,25): instantiated from here: set!(InversionList(CowArray([48u, 58u, 65u, 91u, 95u, 96u, 97u, 123u, 1u])))
/ldc2-1.30.0-osx-arm64/bin/ldc2 failed with exit code 1.

System: M1, macOS

It seems pry is outdated and conflicted with last std.uni changes.

Make a Dub package

Hi @DmitryOlshansky!

Do you think the package is ready for public real life usage?
If so, maybe you can add it to dub-registry (code.dlang.org website) so users will be able to use the package with just dub add rewind-ragex?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.