aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorNicholas Noll <nbnoll@eml.cc>2020-04-28 13:43:51 -0700
committerNicholas Noll <nbnoll@eml.cc>2020-04-28 13:43:51 -0700
commita0bfa46946d1434f320cfbdd54c9f0cbcdcf815e (patch)
tree4f0a4039890be82216a0808be085e70c96bf43b3 /sys
parent46192472bd8df22548e22e13aa55b9ac76a14745 (diff)
fix: allow for quoted identifiers to contain any character
Diffstat (limited to 'sys')
-rw-r--r--sys/libbio/io/newick.c12
-rw-r--r--sys/libbio/phylo.c2
2 files changed, 12 insertions, 2 deletions
diff --git a/sys/libbio/io/newick.c b/sys/libbio/io/newick.c
index fb8e763..6370686 100644
--- a/sys/libbio/io/newick.c
+++ b/sys/libbio/io/newick.c
@@ -121,6 +121,17 @@ lex(io·Peeker s, void* fp)
tok.lit.x = atof(b);
return tok;
+ case '\"':
+ while ((*c) != '\"') {
+ *(++c) = s.get(fp);
+ }
+ Assert(c - b < 1024);
+
+ *c = '\0';
+ tok.kind = tok·ident;
+ tok.lit.s = b + 1;
+ return tok;
+
default:
IDENT:
while (isvalidchar(*c)) {
@@ -132,7 +143,6 @@ lex(io·Peeker s, void* fp)
*c = '\0';
tok.kind = tok·ident;
tok.lit.s = b;
- printf("setting name to '%s'\n", b);
return tok;
}
#undef isvalidchar
diff --git a/sys/libbio/phylo.c b/sys/libbio/phylo.c
index c5fd3ed..c1ace7a 100644
--- a/sys/libbio/phylo.c
+++ b/sys/libbio/phylo.c
@@ -52,7 +52,7 @@ phylo·countleafs(bio·Node *node, int *n)
error err;
bio·Node *child;
- if (node->nchild) {
+ if (!node->nchild) {
*n += 1;
}