Sophie

Sophie

distrib > Fedora > 18 > x86_64 > by-pkgid > 5f2aa7a9df0831bf9db9ab38e75779bb > files > 17

erlang-neotoma-1.6.0-1.fc18.x86_64.rpm

rows <- head:row tail:(crlf row)* / '' 
`
case Node of
  [] -> [];
  [""] -> [];
  _ ->
    Head = proplists:get_value(head, Node),
    Tail = [R || [_,R] <- proplists:get_value(tail, Node)],
    [Head|Tail]
end
`;

row <- head:field tail:(field_sep field)* / ''
`
case Node of
  [] -> [];
  [""] -> [];
  _ ->
    Head = proplists:get_value(head, Node),
    Tail = [F || [_,F] <- proplists:get_value(tail, Node)],
    [Head|Tail]
end
`;
field <- quoted_field / (!field_sep !crlf .)* `iolist_to_binary(Node)`;
quoted_field <- '"' string:('""' / (!'"' .))* '"'
`
  String = proplists:get_value(string, Node),
  re:replace(String, "[\"]{2}", "\"",[global, {return, binary}])
`;
field_sep <- ',' ~;
crlf <- [\r]? [\n] ~;