skip/pass-comments UT iterate

This commit is contained in:
John Kerl 2018-01-04 20:38:55 -05:00
parent 935498de5e
commit 094652bc1d
7 changed files with 0 additions and 164 deletions

View file

@ -202,18 +202,6 @@ static lrec_t* lrec_reader_mmap_csv_process(void* pvstate, void* pvhandle, conte
return NULL;
pstate->ilno++;
if (pstate->comment_string != NULL) {
if (pstate->pfields->phead != NULL) {
if (streqn(pstate->pfields->phead->value, pstate->comment_string, pstate->comment_string_length)) {
if (pstate->comment_handling == PASS_COMMENTS) {
// xxx fix me
}
rslls_reset(pstate->pfields);
continue;
}
}
}
slls_t* pheader_fields = slls_alloc();
int i = 0;
for (rsllse_t* pe = pstate->pfields->phead; i < pstate->pfields->length && pe != NULL; pe = pe->pnext, i++) {
@ -250,18 +238,6 @@ static lrec_t* lrec_reader_mmap_csv_process(void* pvstate, void* pvhandle, conte
if (rc == FALSE) // EOF
return NULL;
if (pstate->comment_string != NULL) {
if (pstate->pfields->phead != NULL) {
if (streqn(pstate->pfields->phead->value, pstate->comment_string, pstate->comment_string_length)) {
if (pstate->comment_handling == PASS_COMMENTS) {
// xxx fix me
}
rslls_reset(pstate->pfields);
continue;
}
}
}
lrec_t* prec = pstate->use_implicit_header
? paste_indices_and_data(pstate, pstate->pfields, pctx)
: paste_header_and_data(pstate, pstate->pfields, pctx);

View file

@ -231,16 +231,6 @@ static lrec_t* lrec_reader_stdio_csv_process(void* pvstate, void* pvhandle, cont
return NULL;
pstate->ilno++;
if (pstate->comment_string != NULL) {
if (pstate->pfields->phead != NULL) {
if (streqn(pstate->pfields->phead->value, pstate->comment_string, pstate->comment_string_length)) {
// xxx fix me -- doesn't do well with pass-through, post-parse ...
rslls_reset(pstate->pfields);
continue;
}
}
}
slls_t* pheader_fields = slls_alloc();
int i = 0;
for (rsllse_t* pe = pstate->pfields->phead; i < pstate->pfields->length && pe != NULL; pe = pe->pnext) {
@ -277,16 +267,6 @@ static lrec_t* lrec_reader_stdio_csv_process(void* pvstate, void* pvhandle, cont
if (rc == FALSE) // EOF
return NULL;
if (pstate->comment_string != NULL) {
if (pstate->pfields->phead != NULL) {
// xxx fix me
if (streqn(pstate->pfields->phead->value, pstate->comment_string, pstate->comment_string_length)) {
rslls_reset(pstate->pfields);
continue;
}
}
}
lrec_t* prec = pstate->use_implicit_header
? paste_indices_and_data(pstate, pstate->pfields, pctx)
: paste_header_and_data(pstate, pstate->pfields, pctx);

View file

@ -49952,85 +49952,6 @@ mlr --jlistwrap --json --jvstack cat ./reg_test/input/line-term-crlf-wrap.json
]
================================================================
SKIP-COMMENTS
---------------------------------------------------------------- CSV mmap
mlr --csv --mmap cat ./reg_test/input/without-comments.csv
a,b,c
1,2,3
4,5,6
mlr --csv --skip-comments --mmap cat ./reg_test/input/without-comments.csv
a,b,c
1,2,3
4,5,6
mlr --csv --mmap cat ./reg_test/input/with-comments.csv
mlr: Header/data length mismatch (1 != 3) at file "./reg_test/input/with-comments.csv" line 2.
mlr --csv --skip-comments --mmap cat ./reg_test/input/with-comments.csv
a,b,c
1,2,3
4,5,6
---------------------------------------------------------------- CSV stdio
mlr --csv --no-mmap cat ./reg_test/input/without-comments.csv
a,b,c
1,2,3
4,5,6
mlr --csv --skip-comments --no-mmap cat ./reg_test/input/without-comments.csv
a,b,c
1,2,3
4,5,6
mlr --csv --no-mmap cat ./reg_test/input/with-comments.csv
mlr: Header/data length mismatch (1 != 3) at file "./reg_test/input/with-comments.csv" line 2.
mlr --csv --skip-comments --no-mmap cat ./reg_test/input/with-comments.csv
a,b,c
1,2,3
4,5,6
---------------------------------------------------------------- CSVLITE mmap
mlr --csvlite --mmap cat ./reg_test/input/without-comments.csv
a,b,c
1,2,3
4,5,6
mlr --csvlite --skip-comments --mmap cat ./reg_test/input/without-comments.csv
a,b,c
1,2,3
4,5,6
mlr --csvlite --mmap cat ./reg_test/input/with-comments.csv
mlr: Header-data length mismatch in file ./reg_test/input/with-comments.csv at line 1.
---------------------------------------------------------------- CSVLITE stdio
mlr --csvlite --no-mmap cat ./reg_test/input/without-comments.csv
a,b,c
1,2,3
4,5,6
mlr --csvlite --skip-comments --no-mmap cat ./reg_test/input/without-comments.csv
a,b,c
1,2,3
4,5,6
mlr --csvlite --no-mmap cat ./reg_test/input/with-comments.csv
mlr: Header-data length mismatch in file ./reg_test/input/with-comments.csv at line 2.
mlr --csvlite --skip-comments --no-mmap cat ./reg_test/input/with-comments.csv
a,b,c
1,2,3
4,5,6
================================================================
USER-DEFINED FUNCTIONS AND SUBROUTINES

View file

@ -191,8 +191,6 @@ EXTRA_DIST= \
utf8-align.dkvp \
utf8-align.nidx \
valgrind.txt \
with-comments.csv \
without-comments.csv \
x0to10.dat \
xy40.dkvp \
xyz345 \

View file

@ -1,7 +0,0 @@
# hello
a,b,c
# hi
1,2,3
# there
4,5,6
# haha
1 # hello
2 a,b,c
3 # hi
4 1,2,3
5 # there
6 4,5,6
7 # haha

View file

@ -1,3 +0,0 @@
a,b,c
1,2,3
4,5,6
1 a b c
2 1 2 3
3 4 5 6

View file

@ -5631,35 +5631,6 @@ run_mlr --irs auto --ors lf --jlistwrap --json --jvstack cat $indir/line-term-cr
run_mlr --jlistwrap --json --jvstack cat $indir/line-term-lf-wrap.json
run_mlr --jlistwrap --json --jvstack cat $indir/line-term-crlf-wrap.json
# ----------------------------------------------------------------
announce SKIP-COMMENTS
mention CSV mmap
run_mlr --csv --mmap cat $indir/without-comments.csv
run_mlr --csv --skip-comments --mmap cat $indir/without-comments.csv
mlr_expect_fail --csv --mmap cat $indir/with-comments.csv
run_mlr --csv --skip-comments --mmap cat $indir/with-comments.csv
mention CSV stdio
run_mlr --csv --no-mmap cat $indir/without-comments.csv
run_mlr --csv --skip-comments --no-mmap cat $indir/without-comments.csv
mlr_expect_fail --csv --no-mmap cat $indir/with-comments.csv
run_mlr --csv --skip-comments --no-mmap cat $indir/with-comments.csv
mention CSVLITE mmap
run_mlr --csvlite --mmap cat $indir/without-comments.csv
run_mlr --csvlite --skip-comments --mmap cat $indir/without-comments.csv
mlr_expect_fail --csvlite --mmap cat $indir/with-comments.csv
# xxx fix me:
#run_mlr --csvlite --skip-comments --mmap cat $indir/with-comments.csv
mention CSVLITE stdio
run_mlr --csvlite --no-mmap cat $indir/without-comments.csv
run_mlr --csvlite --skip-comments --no-mmap cat $indir/without-comments.csv
mlr_expect_fail --csvlite --no-mmap cat $indir/with-comments.csv
run_mlr --csvlite --skip-comments --no-mmap cat $indir/with-comments.csv
# ----------------------------------------------------------------
announce USER-DEFINED FUNCTIONS AND SUBROUTINES