Documenting ackmate format
masad-frost opened this issue · comments
Since the "parseable ackmate format" does not have any documentation on what the format is, I thought I'd do the world a favor and document those here.
A. Lines that look like this :string
are filename matches, maps to :filepath
B. Lines that look like this number:string
are context lines with no matches, it maps to lineNumber:lineContent
C. Lines that look like this number;number number:string
are lines with matches, it maps to lineNumber:matchStartIndex matchLength:lineContent
D. Lines can contain multiple matches, and it looks like number;number number{,number number}+:string
, which basically means you'll have multiple matchStartIndex matchLength
that are comma separated. Here's regex ^(\d+);((\d+ \d+)(,\d+ \d+)*):(.*)$
E. Lines that look like number;string
(not to be confused with B which has a colon, this is a semi-colon) is used when there is a multline line match, this maps to lineNumber;lineContent
, the match will found at the first match line (see C) spanning from the first E, the matchStartIndex
will be referring to the index in the first matched line. Wild.
F. Lines that look like --
are context group separators, can be ignored.
Worth noting that multiline matches don't work when there's an existing match on the beginning of the match.
This was hastily written feel free to ask for clarification.
Here's an example with a context of 1 matching against string wow
:myproject/filename.ext
1:hello
2;0 3:wow
3:friend
--
7:eyy
8;4 7,10 13:abcdwowabcwow
9:byebye
Here's an example with a context of 0 matching against string hello\nworld
:myproject/filename.ext
2;sup hello
3;4 11:world