Coder Social home page Coder Social logo

Comments (6)

ffes avatar ffes commented on July 24, 2024

I am definitely not an expert when it comes to regular expression, but how does the syntax of POSIX regex differ from that of PRCE?

In other words, it this proposed change going to break anybody's .editorconfig file they have in their repo because a regex don't work anymore?

When I look at https://www.regular-expressions.info/refbasic.html and choose "PRCE2" and "POSIX BRE" I see for instance that a | is not supported in POSIX. Looking at other pages on the same site with the same flavors chosen I see a lot of differences.

from editorconfig-core-c.

craigbarnes avatar craigbarnes commented on July 24, 2024

... but how does the syntax of POSIX regex differ from that of PRCE

It lacks a few features that are Perl-specific extensions, but the code in ec_glob.c shouldn't actually need anything besides the basic POSIX features.

In other words, it this proposed change going to break anybody's .editorconfig file they have in their repo because a regex don't work anymore?

Not if done correctly, no. .editorconfig files don't use regex patterns directly -- they use a custom format similar to the ones used by POSIX glob() and fnmatch().

From the git history, it seems like the code used to rely on an actual fnmatch() implementation (taken from FreeBSD), but the pattern format was later extended (beyond the capabilities of fnmatch()) and the code was changed to instead convert the patterns to regex (and then use PCRE for matching, purely as an implementation detail).

... and "POSIX BRE" I see for instance that a | is not supported in POSIX

POSIX BRE is considered a legacy format -- only kept in the spec for historical reasons. All modern POSIX platforms also support the extended format (ERE), which supports the | operator.

from editorconfig-core-c.

ffes avatar ffes commented on July 24, 2024

Thanks for the clarification 👍

I think one of the maintainers of this repo can answer your original question 😉

from editorconfig-core-c.

xuhdev avatar xuhdev commented on July 24, 2024

What is the application in your case that makes installing PCRE so burdensome?

from editorconfig-core-c.

craigbarnes avatar craigbarnes commented on July 24, 2024

What is the application in your case that makes installing PCRE so burdensome?

My use case is static linking with musl libc. libpcre is about 400K of object code, which would triple the size of the binary I'm trying to add editorconfig support to, whereas musl's regex library is only about 20K.

Having an external library dependency also makes cross-compiling much more complicated vs. using a POSIX libc API.

from editorconfig-core-c.

craigbarnes avatar craigbarnes commented on July 24, 2024

I've done this in a separate implementation, instead of trying to shoehorn it into editorconfig-core-c. I guess no one else really cares about using POSIX regex, so closing the issue.

from editorconfig-core-c.

Related Issues (20)

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.