- const char *cp_value_start;
- const char *cp_value_end;
- const char *cp_pattern_start;
- const char *cp_pattern_end;
- const char *cp = line;
-
- while (*cp && strchr(" \t", *cp))
- cp++;
- cp_pattern_start = cp;
-
- while (*cp && !strchr(" \t\r\n=#", *cp))
- cp++;
- cp_pattern_end = cp;
- if (cp == cp_pattern_start)
- continue;
- while (*cp && strchr(" \t", *cp))
- cp++;
- if (*cp != '=')
+ yaz_tok_parse_t tp = yaz_tok_parse_buf(ct->tok_cfg, line);
+ int t;
+ wrbuf_rewind(ct->w);
+ t = yaz_tok_move(tp);
+ if (t == YAZ_TOK_STRING)
+ {
+ char * pattern = xstrdup(yaz_tok_parse_string(tp));
+ t = yaz_tok_move(tp);
+ if (t != '=')
+ {
+ yaz_tok_parse_destroy(tp);
+ cql_transform_close(ct);
+ return 0;
+ }
+ t = yaz_tok_move(tp);
+
+ while (t == YAZ_TOK_STRING)
+ {
+ /* attset type=value OR type=value */
+ wrbuf_puts(ct->w, yaz_tok_parse_string(tp));
+ t = yaz_tok_move(tp);
+ if (t == YAZ_TOK_EOF)
+ break;
+ if (t == YAZ_TOK_STRING)
+ {
+ wrbuf_puts(ct->w, " ");
+ wrbuf_puts(ct->w, yaz_tok_parse_string(tp));
+ t = yaz_tok_move(tp);
+ }
+ if (t != '=')
+ {
+ yaz_tok_parse_destroy(tp);
+ cql_transform_close(ct);
+ return 0;
+ }
+ t = yaz_tok_move(tp);
+ if (t != YAZ_TOK_STRING) /* value */
+ {
+ yaz_tok_parse_destroy(tp);
+ cql_transform_close(ct);
+ return 0;
+ }
+ wrbuf_puts(ct->w, "=");
+ wrbuf_puts(ct->w, yaz_tok_parse_string(tp));
+ t = yaz_tok_move(tp);
+ wrbuf_puts(ct->w, " ");
+ }
+ *pp = (struct cql_prop_entry *) xmalloc(sizeof(**pp));
+ (*pp)->pattern = pattern;
+ (*pp)->value = xstrdup(wrbuf_cstr(ct->w));
+ pp = &(*pp)->next;
+ }
+ else if (t != YAZ_TOK_EOF)