git.droids-corp.org
/
protos
/
libecoli.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
15e2362
)
yaml: parse anchors
author
Olivier Matz
<zer0@droids-corp.org>
Thu, 7 Mar 2019 18:15:51 +0000
(19:15 +0100)
committer
Olivier Matz
<zer0@droids-corp.org>
Thu, 7 Mar 2019 18:15:51 +0000
(19:15 +0100)
src/ecoli_yaml.c
patch
|
blob
|
history
diff --git
a/src/ecoli_yaml.c
b/src/ecoli_yaml.c
index
8ac47eb
..
326af56
100644
(file)
--- a/
src/ecoli_yaml.c
+++ b/
src/ecoli_yaml.c
@@
-361,12
+361,19
@@
parse_ec_node(struct enode_table *table,
const char *key_str, *value_str;
struct ec_node *enode = NULL;
char *value_dup = NULL;
const char *key_str, *value_str;
struct ec_node *enode = NULL;
char *value_dup = NULL;
+ size_t i;
if (ynode->type != YAML_MAPPING_NODE) {
fprintf(stderr, "Ecoli node should be a yaml mapping node\n");
goto fail;
}
if (ynode->type != YAML_MAPPING_NODE) {
fprintf(stderr, "Ecoli node should be a yaml mapping node\n");
goto fail;
}
+ /* if it's an anchor, the node may be already parsed, reuse it */
+ for (i = 0; i < table->len; i++) {
+ if (table->pair[i].ynode == ynode)
+ return ec_node_clone(table->pair[i].enode);
+ }
+
for (pair = ynode->data.mapping.pairs.start;
pair < ynode->data.mapping.pairs.top; pair++) {
key = document->nodes.start + pair->key - 1; // XXX -1 ?
for (pair = ynode->data.mapping.pairs.start;
pair < ynode->data.mapping.pairs.top; pair++) {
key = document->nodes.start + pair->key - 1; // XXX -1 ?