regexp-tree icon indicating copy to clipboard operation
regexp-tree copied to clipboard

Separate \w, \d, ... into separate node type

Open RReverser opened this issue 7 years ago • 3 comments

All the other character types allow to match exactly a single character (as the node type Character suggests), but \w, \d, ... are mixed with single-char escapes under meta kind.

It seems reasonable to separate them into their own node type as they're something very different than a single char.

RReverser avatar Jun 29 '17 18:06 RReverser

Yes, potentially we can move them to a separate node type. Since it'll be a breaking change, we'll need to have a good use-case for it. Initially I tried to make a simple AST format, but I'm open to reconsider it if there is a use-case (we'll also need to update all the docs, plugins, etc).

DmitrySoshnikov avatar Jun 30 '17 07:06 DmitrySoshnikov

Mostly useful for analysis of a regexp (complexity and such). It's useful to rely on Character to be a single character, no matter what kind it is, while these classes break this assumption.

And just in general, it seems semantically correct to have them as a different node type.

RReverser avatar Jun 30 '17 12:06 RReverser

OK, I think it might make sense, I think we can go with this (that's said, we'll need to update all the related docs, etc).

DmitrySoshnikov avatar Jul 01 '17 07:07 DmitrySoshnikov