ack -w warnings

2 views
Skip to first unread message

Andy Lester

unread,
Apr 24, 2017, 12:27:02 AM4/24/17
to ack development
I added code on the dev branch to warn if you try to use -w when you shouldn't.

Here's the test data from t/ack-w.t. Any other examples I should be adding? Like detecting \A and \Z along with ^ and $?

Thanks,
Andy


# Anchors
BAD $foo
BAD foo^
BAD ^foo
BAD foo$

# Dot
OK foo.
OK .foo

# Parentheses
OK (set|get)_foo
OK foo_(id|name)
OK func()
OK (all in one group)
BAD )start with closing paren
BAD end with opening paren(
BAD end with an escaped closing paren\)

# Character classes
OK [sg]et
OK foo[lt]
OK [one big character class]
OK [multiple][character][classes]
BAD ]starting with a closing bracket
BAD ending with a opening bracket[
BAD ending with an escaped closing bracket \]

# Quantifiers
OK thpppt{1,5}
BAD }starting with an closing curly brace
BAD ending with an opening curly brace{
BAD ending with an escaped closing curly brace\}

OK foo+
BAD foo\+
BAD +foo
OK foo*
BAD foo\*
BAD *foo
OK foo?
BAD foo\?
BAD ?foo

# Miscellaneous debris
BAD -foo
BAD foo-
BAD &mpersand
BAD ampersand&
BAD function(
BAD ->method
BAD <header.h>
BAD =14
BAD /slashes/
BAD ::Class::Whatever
BAD Class::Whatever::
OK Class::Whatever



--
Andy Lester => www.petdance.com

Reply all
Reply to author
Forward
0 new messages