int eof; /* End of file encountered. */
int nrec; /* Number of records. */
size_t case_size; /* Case size in bytes. */
+ int delim; /* Specified delimeter */
};
static int parse_fixed (struct data_list_pgm *);
dls->end = NULL;
dls->eof = 0;
dls->nrec = 0;
+ dls->delim=0;
dls->first = dls->last = NULL;
while (token != '/')
else
table = index - 3;
}
+ else if (token=='(') {
+ lex_get();
+ if (lex_match_id ("TAB")) {
+ dls->delim='\t';
+ }
+ lex_get();
+ }
else
{
lex_error (NULL);
return 0;
ep = cp + len;
+ if (dls->delim != 0) {
+ if (*cp==dls->delim) {
+ cp++;
+ }
+ } else {
- /* Skip leading whitespace and commas. */
- while ((isspace ((unsigned char) *cp) || *cp == ',') && cp < ep)
- cp++;
+ /* Skip leading whitespace and commas. */
+ while ((isspace ((unsigned char) *cp) || *cp == ',') && cp < ep)
+ cp++;
+ }
if (cp >= ep)
return 0;
*ret_cp = ++cp;
while (cp < ep && *cp != quote)
cp++;
+ if (dls->delim!=0) {
+ while(cp<ep && *cp!=dls->delim) {
+ cp++;
+ }
+ }
*ret_len = cp - *ret_cp;
if (cp < ep)
cp++;
else
- msg (SW, _("Scope of string exceeds line."));
+ msg (SW, _("Scope of string exceeds line."));
}
else
{
*ret_cp = cp;
- while (cp < ep && !isspace ((unsigned char) *cp) && *cp != ',')
- cp++;
+ if (dls->delim!=0) {
+ while(cp<ep && *cp!=dls->delim) {
+ cp++;
+ }
+ } else {
+
+ while (cp < ep && !isspace ((unsigned char) *cp) && *cp != ',')
+ cp++;
+ }
*ret_len = cp - *ret_cp;
}