Function globsFileReader

Parse mime/globs file by line ignoring empty lines and comments.

auto auto globsFileReader(Range) (
  Range byLine
)
if (isInputRange!Range && is(ElementType!Range : string));

Returns

Range of GlobLine tuples.

Throws

MimeFileException on parsing error.

Example

string[] lines = ["#comment", "text/x-c++src:*.cpp", "text/x-csrc:*.c"];
auto expected = [GlobLine(defaultGlobWeight, "text/x-c++src", "*.cpp", false), GlobLine(defaultGlobWeight, "text/x-csrc", "*.c", false)];
assert(equal(globsFileReader(lines), expected));
assert(equal(globsFileReader(["text/plain:__NOGLOBS__"]), [GlobLine(0, "text/plain", "__NOGLOBS__", false)]));

assertThrown!MimeFileException(globsFileReader(["#comment", "text/plain:*.txt", "nocolon"]).array, "must throw");