regexp-tree
regexp-tree copied to clipboard
Separate \w, \d, ... into separate node type
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.
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).
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.
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).