diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-11-10 20:12:27 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-11-10 20:12:27 +0100 |
commit | b57f9c4f93c0850da02f4e6c2aba8298c1801d2b (patch) | |
tree | 7546099601105cab91a49db192be18ecf882c5e1 /src/mds-kbdc | |
parent | mds-kbdc: small fixes to end, add support for information, and create tree strak (diff) | |
download | mds-b57f9c4f93c0850da02f4e6c2aba8298c1801d2b.tar.gz mds-b57f9c4f93c0850da02f4e6c2aba8298c1801d2b.tar.bz2 mds-b57f9c4f93c0850da02f4e6c2aba8298c1801d2b.tar.xz |
mds-kbdc: add support for assumption
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/mds-kbdc')
-rw-r--r-- | src/mds-kbdc/make-tree.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/mds-kbdc/make-tree.c b/src/mds-kbdc/make-tree.c index 5b8cfcc..2e31bfc 100644 --- a/src/mds-kbdc/make-tree.c +++ b/src/mds-kbdc/make-tree.c @@ -146,13 +146,30 @@ int parse_to_tree(const char* restrict filename, mds_kbdc_tree_t** restrict resu tree_stack[stack_ptr + 1] = &(tree->inner); keyword_stack[stack_ptr++] = "information"; } + else if (!strcmp(line, "assumption")) + { + mds_kbdc_tree_assumption_t* tree; + fail_if (xcalloc(tree, 1, mds_kbdc_tree_assumption_t)); + line += strlen(line); + *end = prev_end_char, prev_end_char = '\0'; + while (*line && (*line == ' ')) + line++; + if (*line) + { + end = line + strlen(line); + NEW_ERROR(1, ERROR, "extra token after ‘assumption’"); + } + tree->type = MDS_KBDC_TREE_TYPE_ASSUMPTION; + *(tree_stack[stack_ptr]) = (mds_kbdc_tree_t*)tree; + tree_stack[stack_ptr + 1] = &(tree->inner); + keyword_stack[stack_ptr++] = "assumption"; + } else if (!strcmp(line, "language")) ; else if (!strcmp(line, "country")) ; else if (!strcmp(line, "variant")) ; else if (!strcmp(line, "include")) ; else if (!strcmp(line, "function")) ; else if (!strcmp(line, "macro")) ; - else if (!strcmp(line, "assumption")) ; else if (!strcmp(line, "if")) ; else if (!strcmp(line, "else")) ; else if (!strcmp(line, "for")) ; |