Introduction
Introduction Statistics Contact Development Disclaimer Help
trset: ignore '(' inside brackets when counting groups - neatvi - [fork] simple…
git clone git://src.adamsgaard.dk/neatvi
Log
Files
Refs
README
---
commit e3d2ac66bd83987579f970043be6e6c31b29dd19
parent dd8c8d2fd76f346bd04e372076310a59554ba5e3
Author: Ali Gholami Rudi <[email protected]>
Date: Sun, 7 Jun 2015 11:32:17 +0430
rset: ignore '(' inside brackets when counting groups
Diffstat:
M rset.c | 11 +++++++++++
1 file changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/rset.c b/rset.c
t@@ -19,6 +19,17 @@ static int re_groupcount(char *s)
while (*s) {
if (s[0] == '(')
n++;
+ if (s[0] == '[') {
+ int dep = 0;
+ s += s[1] == '^' ? 3 : 2;
+ while (s[0] && (s[0] != ']' || dep)) {
+ if (s[0] == '[')
+ dep++;
+ if (s[0] == ']')
+ dep--;
+ s++;
+ }
+ }
if (s[0] == '\\' && s[1])
s++;
s++;
You are viewing proxied material from mx1.adamsgaard.dk. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.