awgn/cgrep

Pattern file and spaces in patterns

Closed this issue · 1 comments

Hi there.

Looking at the way pattern files are handled, I wonder how I can define a pattern including a space in a pattern file.

For example:

$ cat patterns
Sed etiam
$ cgrep -f patterns -d 2 test/test.erl
Cgrep 6.4.12!
options   : Options {file = "patterns", word_match = False, prefix_match = False, suffix_match = False, edit_dist = False, ignore_case = False, regex = False, code = False, comment = False, literal = False, semantic = False, identifier = False, keyword = False, directive = False, header = False, number = False, string = False, char = False, oper = False, no_filename = False, no_linenumber = False, lang = [], lang_maps = False, force_language = Nothing, jobs = 1, multiline = 1, recursive = False, deference_recursive = False, invert_match = False, max_count = 9223372036854775807, count = False, show_match = False, color = False, format = Nothing, json = False, xml = False, debug = 2, no_turbo = False, others = ["test/test.erl"]}
languages : []
pattern   : ["Sed","etiam"]
files     : ["test/test.erl"]
isTermIn  : False
isTermOut : False
strategy  : running string search on test/test.erl...
tokens    : [(197,"Sed"),(201,"etiam")]
tokens'   : [(197,"Sed"),(201,"etiam")]
test/test.erl:7:io:format("Sed etiam a suspendisse. \"Aliquam nulla erat risus.\"~n").

So how can I convey my intention of having spaces in patterns? I've tried using \s, but it acts weirdly, too, escaping the \ to \\, and I haven't tracked what happens next.

So before I'll try to think up a fix -- am I missing something?

Thanks a lot
Stephan

Resolved with #22. Thanks :)