diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-12-07 22:46:41 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-12-07 22:46:41 +0100 |
commit | 07acde13ba36189d9dfed7354d12459cb409f6b5 (patch) | |
tree | e05050912a210276e12306e41f71b7baf6286c1a /src/mds-kbdc | |
parent | mds-kbdc: compile-layout: bug fixes (diff) | |
download | mds-07acde13ba36189d9dfed7354d12459cb409f6b5.tar.gz mds-07acde13ba36189d9dfed7354d12459cb409f6b5.tar.bz2 mds-07acde13ba36189d9dfed7354d12459cb409f6b5.tar.xz |
mds-kbdc: test call to undefined callables and mark the entire macro call if the macro does not exist
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r-- | src/mds-kbdc/compile-layout.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mds-kbdc/compile-layout.c b/src/mds-kbdc/compile-layout.c index 1eb1dfc..e9d16c5 100644 --- a/src/mds-kbdc/compile-layout.c +++ b/src/mds-kbdc/compile-layout.c @@ -1199,15 +1199,22 @@ static int get_macro(mds_kbdc_tree_macro_call_t* restrict macro_call, mds_kbdc_tree_macro_t** restrict macro, mds_kbdc_include_stack_t** restrict macro_include_stack) { + char* code = result->source_code->lines[macro_call->loc_line]; + char* end = code + strlen(code) - 1; + get_macro_lax(macro_call->name, macro, macro_include_stack); if (*macro == NULL) { NEW_ERROR(macro_call, ERROR, "macro ‘%s’ has not been defined yet", macro_call->name); + while (*end == ' ') + end--; + error->end = (size_t)(++end - code); macro_call->processed = PROCESS_LEVEL; return 0; } if ((*macro)->processed == PROCESS_LEVEL) *macro = NULL; + return 0; pfail: return -1; |