Add eb_add_tag()

* add `eb_add_tag(b, offset, name)`:
  * check for duplicate definitions
  * duplicate string argument
* use `ab_add_tag()` instead of `eb_add_property()` from language colorizers
* fix `get_js_identifier()` for `c == 0` case.
This commit is contained in:
Charlie Gordon 2024-07-18 19:18:58 +02:00
commit 6e2b6e24c2
6 changed files with 26 additions and 36 deletions

View file

@ -282,8 +282,7 @@ static void python_colorize_line(QEColorizeContext *cp,
style = PYTHON_STYLE_FUNCTION;
if (tag) {
/* tag function definition */
eb_add_property(cp->b, cp->offset + start,
QE_PROP_TAG, qe_strdup(kbuf));
eb_add_tag(cp->b, cp->offset + start, kbuf);
tag = 0;
}
break;
@ -293,8 +292,7 @@ static void python_colorize_line(QEColorizeContext *cp,
continue;
if (qe_findchar(",=", str[i1])) {
/* tag variable definition */
eb_add_property(cp->b, cp->offset + start,
QE_PROP_TAG, qe_strdup(kbuf));
eb_add_tag(cp->b, cp->offset + start, kbuf);
/* XXX: should colorize variable definition */
}
}