summaryrefslogtreecommitdiff
path: root/inttest/neotoma1/src
diff options
context:
space:
mode:
Diffstat (limited to 'inttest/neotoma1/src')
-rw-r--r--inttest/neotoma1/src/csv.peg31
-rw-r--r--inttest/neotoma1/src/neotoma1.app.src6
2 files changed, 37 insertions, 0 deletions
diff --git a/inttest/neotoma1/src/csv.peg b/inttest/neotoma1/src/csv.peg
new file mode 100644
index 0000000..000c00f
--- /dev/null
+++ b/inttest/neotoma1/src/csv.peg
@@ -0,0 +1,31 @@
+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] ~;
diff --git a/inttest/neotoma1/src/neotoma1.app.src b/inttest/neotoma1/src/neotoma1.app.src
new file mode 100644
index 0000000..96a50e5
--- /dev/null
+++ b/inttest/neotoma1/src/neotoma1.app.src
@@ -0,0 +1,6 @@
+{application, neotoma1,
+ [{vsn, "1"},
+ {modules, []},
+ {registered, []},
+ {applications, [kernel, stdlib]}]}.
+