aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/syntax.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/syntax.c')
-rw-r--r--src/nvim/syntax.c287
1 files changed, 142 insertions, 145 deletions
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index 1e14f988f1..504d1cd16e 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -929,9 +929,9 @@ static void syn_update_ends(bool startofline)
stateitem_T *cur_si;
if (startofline) {
- /* Check for a match carried over from a previous line with a
- * contained region. The match ends as soon as the region ends. */
- for (int i = 0; i < current_state.ga_len; ++i) {
+ // Check for a match carried over from a previous line with a
+ // contained region. The match ends as soon as the region ends.
+ for (int i = 0; i < current_state.ga_len; i++) {
cur_si = &CUR_STATE(i);
if (cur_si->si_idx >= 0
&& (SYN_ITEMS(syn_block)[cur_si->si_idx]).sp_type
@@ -1082,7 +1082,6 @@ static void syn_stack_alloc(void)
// Make sure that all valid entries fit in the new array.
while (syn_block->b_sst_len - syn_block->b_sst_freecount + 2 > len
&& syn_stack_cleanup()) {
- ;
}
if (len < syn_block->b_sst_len - syn_block->b_sst_freecount + 2) {
len = syn_block->b_sst_len - syn_block->b_sst_freecount + 2;
@@ -1335,8 +1334,8 @@ static synstate_T *store_current_state(void)
if (syn_block->b_sst_freecount == 0) {
sp = NULL;
} else {
- /* Take the first item from the free list and put it in the used
- * list, after *sp */
+ // Take the first item from the free list and put it in the used
+ // list, after *sp
p = syn_block->b_sst_firstfree;
syn_block->b_sst_firstfree = p->sst_next;
--syn_block->b_sst_freecount;
@@ -1359,8 +1358,8 @@ static synstate_T *store_current_state(void)
clear_syn_state(sp);
sp->sst_stacksize = current_state.ga_len;
if (current_state.ga_len > SST_FIX_STATES) {
- /* Need to clear it, might be something remaining from when the
- * length was less than SST_FIX_STATES. */
+ // Need to clear it, might be something remaining from when the
+ // length was less than SST_FIX_STATES.
ga_init(&sp->sst_union.sst_ga, (int)sizeof(bufstate_T), 1);
ga_grow(&sp->sst_union.sst_ga, current_state.ga_len);
sp->sst_union.sst_ga.ga_len = current_state.ga_len;
@@ -1458,24 +1457,24 @@ static bool syn_stack_equal(synstate_T *sp)
if (bp[i].bs_extmatch == CUR_STATE(i).si_extmatch) {
continue;
}
- /* When the extmatch pointers are different, the strings in
- * them can still be the same. Check if the extmatch
- * references are equal. */
+ // When the extmatch pointers are different, the strings in
+ // them can still be the same. Check if the extmatch
+ // references are equal.
bsx = bp[i].bs_extmatch;
six = CUR_STATE(i).si_extmatch;
- /* If one of the extmatch pointers is NULL the states are
- * different. */
+ // If one of the extmatch pointers is NULL the states are
+ // different.
if (bsx == NULL || six == NULL) {
break;
}
int j;
- for (j = 0; j < NSUBEXP; ++j) {
- /* Check each referenced match string. They must all be
- * equal. */
+ for (j = 0; j < NSUBEXP; j++) {
+ // Check each referenced match string. They must all be
+ // equal.
if (bsx->matches[j] != six->matches[j]) {
- /* If the pointer is different it can still be the
- * same text. Compare the strings, ignore case when
- * the start item has the sp_ic flag set. */
+ // If the pointer is different it can still be the
+ // same text. Compare the strings, ignore case when
+ // the start item has the sp_ic flag set.
if (bsx->matches[j] == NULL || six->matches[j] == NULL) {
break;
}
@@ -1749,8 +1748,8 @@ static int syn_current_attr(const bool syncing, const bool displaying, bool *con
&& (syn_block->b_keywtab.ht_used > 0
|| syn_block->b_keywtab_ic.ht_used > 0);
- /* Init the list of zero-width matches with a nextlist. This is used to
- * avoid matching the same item in the same position twice. */
+ // Init the list of zero-width matches with a nextlist. This is used to
+ // avoid matching the same item in the same position twice.
ga_init(&zero_width_next_ga, (int)sizeof(int), 10);
// use syntax iskeyword option
@@ -1867,9 +1866,9 @@ static int syn_current_attr(const bool syncing, const bool displaying, bool *con
: in_id_list(cur_si,
cur_si->si_cont_list, &spp->sp_syn,
spp->sp_flags & HL_CONTAINED)))) {
- /* If we already tried matching in this line, and
- * there isn't a match before next_match_col, skip
- * this item. */
+ // If we already tried matching in this line, and
+ // there isn't a match before next_match_col, skip
+ // this item.
if (spp->sp_line_id == current_line_id
&& spp->sp_startcol >= next_match_col) {
continue;
@@ -2037,9 +2036,9 @@ static int syn_current_attr(const bool syncing, const bool displaying, bool *con
keep_next_list = true;
zero_width_next_list = true;
- /* Add the index to a list, so that we can check
- * later that we don't match it again (and cause an
- * endless loop). */
+ // Add the index to a list, so that we can check
+ // later that we don't match it again (and cause an
+ // endless loop).
GA_APPEND(int, &zero_width_next_ga, next_match_idx);
next_match_idx = -1;
} else {
@@ -2136,10 +2135,10 @@ static int syn_current_attr(const bool syncing, const bool displaying, bool *con
*can_spell = !in_id_list(sip, sip->si_cont_list, &sps, 0);
}
} else {
- /* The @Spell cluster is defined: Do spelling in items with
- * the @Spell cluster. But not when @NoSpell is also there.
- * At the toplevel only spell check when ":syn spell toplevel"
- * was used. */
+ // The @Spell cluster is defined: Do spelling in items with
+ // the @Spell cluster. But not when @NoSpell is also there.
+ // At the toplevel only spell check when ":syn spell toplevel"
+ // was used.
if (current_trans_id == 0) {
*can_spell = (syn_block->b_syn_spell == SYNSPL_TOP);
} else {
@@ -2216,8 +2215,8 @@ static bool did_match_already(int idx, garray_T *gap)
}
}
- /* Zero-width matches with a nextgroup argument are not put on the syntax
- * stack, and can only be matched once anyway. */
+ // Zero-width matches with a nextgroup argument are not put on the syntax
+ // stack, and can only be matched once anyway.
for (int i = gap->ga_len; --i >= 0; ) {
if (((int *)(gap->ga_data))[i] == idx) {
return true;
@@ -2353,8 +2352,8 @@ static void check_state_ends(void)
next_match_col = MAXCOL;
break;
} else {
- /* handle next_list, unless at end of line and no "skipnl" or
- * "skipempty" */
+ // handle next_list, unless at end of line and no "skipnl" or
+ // "skipempty"
current_next_list = cur_si->si_next_list;
current_next_flags = cur_si->si_flags;
if (!(current_next_flags & (HL_SKIPNL | HL_SKIPEMPTY))
@@ -3006,7 +3005,7 @@ static int syn_regexec(regmmatch_T *rmp, linenr_T lnum, colnr_T col, syn_time_T
}
if (timed_out && !syn_win->w_s->b_syn_slow) {
syn_win->w_s->b_syn_slow = true;
- MSG(_("'redrawtime' exceeded, syntax highlighting disabled"));
+ msg(_("'redrawtime' exceeded, syntax highlighting disabled"));
}
if (r > 0) {
@@ -3111,16 +3110,16 @@ static void syn_cmd_conceal(exarg_T *eap, int syncing)
next = skiptowhite(arg);
if (*arg == NUL) {
if (curwin->w_s->b_syn_conceal) {
- MSG(_("syntax conceal on"));
+ msg(_("syntax conceal on"));
} else {
- MSG(_("syntax conceal off"));
+ msg(_("syntax conceal off"));
}
} else if (STRNICMP(arg, "on", 2) == 0 && next - arg == 2) {
curwin->w_s->b_syn_conceal = true;
} else if (STRNICMP(arg, "off", 3) == 0 && next - arg == 3) {
curwin->w_s->b_syn_conceal = false;
} else {
- EMSG2(_(e_illegal_arg), arg);
+ semsg(_(e_illegal_arg), arg);
}
}
@@ -3140,16 +3139,16 @@ static void syn_cmd_case(exarg_T *eap, int syncing)
next = skiptowhite(arg);
if (*arg == NUL) {
if (curwin->w_s->b_syn_ic) {
- MSG(_("syntax case ignore"));
+ msg(_("syntax case ignore"));
} else {
- MSG(_("syntax case match"));
+ msg(_("syntax case match"));
}
} else if (STRNICMP(arg, "match", 5) == 0 && next - arg == 5) {
curwin->w_s->b_syn_ic = false;
} else if (STRNICMP(arg, "ignore", 6) == 0 && next - arg == 6) {
curwin->w_s->b_syn_ic = true;
} else {
- EMSG2(_(e_illegal_arg), arg);
+ semsg(_(e_illegal_arg), arg);
}
}
@@ -3167,9 +3166,9 @@ static void syn_cmd_foldlevel(exarg_T *eap, int syncing)
if (*arg == NUL) {
switch (curwin->w_s->b_syn_foldlevel) {
case SYNFLD_START:
- MSG(_("syntax foldlevel start")); break;
+ msg(_("syntax foldlevel start")); break;
case SYNFLD_MINIMUM:
- MSG(_("syntax foldlevel minimum")); break;
+ msg(_("syntax foldlevel minimum")); break;
default:
break;
}
@@ -3182,13 +3181,13 @@ static void syn_cmd_foldlevel(exarg_T *eap, int syncing)
} else if (STRNICMP(arg, "minimum", 7) == 0 && arg_end - arg == 7) {
curwin->w_s->b_syn_foldlevel = SYNFLD_MINIMUM;
} else {
- EMSG2(_(e_illegal_arg), arg);
+ semsg(_(e_illegal_arg), arg);
return;
}
arg = skipwhite(arg_end);
if (*arg != NUL) {
- EMSG2(_(e_illegal_arg), arg);
+ semsg(_(e_illegal_arg), arg);
}
}
@@ -3208,11 +3207,11 @@ static void syn_cmd_spell(exarg_T *eap, int syncing)
next = skiptowhite(arg);
if (*arg == NUL) {
if (curwin->w_s->b_syn_spell == SYNSPL_TOP) {
- MSG(_("syntax spell toplevel"));
+ msg(_("syntax spell toplevel"));
} else if (curwin->w_s->b_syn_spell == SYNSPL_NOTOP) {
- MSG(_("syntax spell notoplevel"));
+ msg(_("syntax spell notoplevel"));
} else {
- MSG(_("syntax spell default"));
+ msg(_("syntax spell default"));
}
} else if (STRNICMP(arg, "toplevel", 8) == 0 && next - arg == 8) {
curwin->w_s->b_syn_spell = SYNSPL_TOP;
@@ -3221,7 +3220,7 @@ static void syn_cmd_spell(exarg_T *eap, int syncing)
} else if (STRNICMP(arg, "default", 7) == 0 && next - arg == 7) {
curwin->w_s->b_syn_spell = SYNSPL_DEFAULT;
} else {
- EMSG2(_(e_illegal_arg), arg);
+ semsg(_(e_illegal_arg), arg);
return;
}
@@ -3242,9 +3241,9 @@ static void syn_cmd_iskeyword(exarg_T *eap, int syncing)
arg = skipwhite(arg);
if (*arg == NUL) {
- MSG_PUTS("\n");
+ msg_puts("\n");
if (curwin->w_s->b_syn_isk != empty_option) {
- MSG_PUTS(_("syntax iskeyword "));
+ msg_puts(_("syntax iskeyword "));
msg_outtrans(curwin->w_s->b_syn_isk);
} else {
msg_outtrans((char_u *)_("syntax iskeyword not set"));
@@ -3445,7 +3444,7 @@ static void syn_cmd_clear(exarg_T *eap, int syncing)
if (*arg == '@') {
id = syn_scl_namen2id(arg + 1, (int)(arg_end - arg - 1));
if (id == 0) {
- EMSG2(_("E391: No such syntax cluster: %s"), arg);
+ semsg(_("E391: No such syntax cluster: %s"), arg);
break;
} else {
// We can't physically delete a cluster without changing
@@ -3458,7 +3457,7 @@ static void syn_cmd_clear(exarg_T *eap, int syncing)
} else {
id = syn_name2id_len(arg, (int)(arg_end - arg));
if (id == 0) {
- EMSG2(_(e_nogroup), arg);
+ semsg(_(e_nogroup), arg);
break;
} else {
syn_clear_one(id, syncing);
@@ -3567,41 +3566,41 @@ static void syn_cmd_list(exarg_T *eap, int syncing)
}
if (!syntax_present(curwin)) {
- MSG(_(msg_no_items));
+ msg(_(msg_no_items));
return;
}
if (syncing) {
if (curwin->w_s->b_syn_sync_flags & SF_CCOMMENT) {
- MSG_PUTS(_("syncing on C-style comments"));
+ msg_puts(_("syncing on C-style comments"));
syn_lines_msg();
syn_match_msg();
return;
} else if (!(curwin->w_s->b_syn_sync_flags & SF_MATCH)) {
if (curwin->w_s->b_syn_sync_minlines == 0) {
- MSG_PUTS(_("no syncing"));
+ msg_puts(_("no syncing"));
} else {
if (curwin->w_s->b_syn_sync_minlines == MAXLNUM) {
- MSG_PUTS(_("syncing starts at the first line"));
+ msg_puts(_("syncing starts at the first line"));
} else {
- MSG_PUTS(_("syncing starts "));
+ msg_puts(_("syncing starts "));
msg_outnum(curwin->w_s->b_syn_sync_minlines);
- MSG_PUTS(_(" lines before top line"));
+ msg_puts(_(" lines before top line"));
}
syn_match_msg();
}
return;
}
- MSG_PUTS_TITLE(_("\n--- Syntax sync items ---"));
+ msg_puts_title(_("\n--- Syntax sync items ---"));
if (curwin->w_s->b_syn_sync_minlines > 0
|| curwin->w_s->b_syn_sync_maxlines > 0
|| curwin->w_s->b_syn_sync_linebreaks > 0) {
- MSG_PUTS(_("\nsyncing on items"));
+ msg_puts(_("\nsyncing on items"));
syn_lines_msg();
syn_match_msg();
}
} else {
- MSG_PUTS_TITLE(_("\n--- Syntax items ---"));
+ msg_puts_title(_("\n--- Syntax items ---"));
}
if (ends_excmd(*arg)) {
/*
@@ -3622,14 +3621,14 @@ static void syn_cmd_list(exarg_T *eap, int syncing)
if (*arg == '@') {
int id = syn_scl_namen2id(arg + 1, (int)(arg_end - arg - 1));
if (id == 0) {
- EMSG2(_("E392: No such syntax cluster: %s"), arg);
+ semsg(_("E392: No such syntax cluster: %s"), arg);
} else {
syn_list_cluster(id - SYNID_CLUSTER);
}
} else {
int id = syn_name2id_len(arg, (int)(arg_end - arg));
if (id == 0) {
- EMSG2(_(e_nogroup), arg);
+ semsg(_(e_nogroup), arg);
} else {
syn_list_one(id, syncing, true);
}
@@ -3644,22 +3643,22 @@ static void syn_lines_msg(void)
{
if (curwin->w_s->b_syn_sync_maxlines > 0
|| curwin->w_s->b_syn_sync_minlines > 0) {
- MSG_PUTS("; ");
+ msg_puts("; ");
if (curwin->w_s->b_syn_sync_minlines == MAXLNUM) {
- MSG_PUTS(_("from the first line"));
+ msg_puts(_("from the first line"));
} else {
if (curwin->w_s->b_syn_sync_minlines > 0) {
- MSG_PUTS(_("minimal "));
+ msg_puts(_("minimal "));
msg_outnum(curwin->w_s->b_syn_sync_minlines);
if (curwin->w_s->b_syn_sync_maxlines) {
- MSG_PUTS(", ");
+ msg_puts(", ");
}
}
if (curwin->w_s->b_syn_sync_maxlines > 0) {
- MSG_PUTS(_("maximal "));
+ msg_puts(_("maximal "));
msg_outnum(curwin->w_s->b_syn_sync_maxlines);
}
- MSG_PUTS(_(" lines before top line"));
+ msg_puts(_(" lines before top line"));
}
}
}
@@ -3667,9 +3666,9 @@ static void syn_lines_msg(void)
static void syn_match_msg(void)
{
if (curwin->w_s->b_syn_sync_linebreaks > 0) {
- MSG_PUTS(_("; match "));
+ msg_puts(_("; match "));
msg_outnum(curwin->w_s->b_syn_sync_linebreaks);
- MSG_PUTS(_(" line breaks"));
+ msg_puts(_(" line breaks"));
}
}
@@ -3768,7 +3767,7 @@ static void syn_list_one(const int id, const bool syncing, const bool link_only)
msg_outtrans(HL_TABLE()[SYN_ITEMS(curwin->w_s)
[spp->sp_sync_idx].sp_syn.id - 1].sg_name);
} else {
- MSG_PUTS("NONE");
+ msg_puts("NONE");
}
msg_putchar(' ');
}
@@ -4230,7 +4229,7 @@ static char_u *get_syn_options(char_u *arg, syn_opt_arg_T *opt, int *conceal_cha
if (flagtab[fidx].argtype == 1) {
if (!opt->has_cont_list) {
- EMSG(_("E395: contains argument not accepted here"));
+ emsg(_("E395: contains argument not accepted here"));
return NULL;
}
if (get_id_list(&arg, 8, &opt->cont_list, skip) == FAIL) {
@@ -4247,9 +4246,9 @@ static char_u *get_syn_options(char_u *arg, syn_opt_arg_T *opt, int *conceal_cha
} else if (flagtab[fidx].argtype == 11 && arg[5] == '=') {
// cchar=?
*conceal_char = utf_ptr2char(arg + 6);
- arg += mb_ptr2len(arg + 6) - 1;
+ arg += utfc_ptr2len(arg + 6) - 1;
if (!vim_isprintc_strict(*conceal_char)) {
- EMSG(_("E844: invalid cchar value"));
+ emsg(_("E844: invalid cchar value"));
return NULL;
}
arg = skipwhite(arg + 7);
@@ -4260,7 +4259,7 @@ static char_u *get_syn_options(char_u *arg, syn_opt_arg_T *opt, int *conceal_cha
if (flagtab[fidx].flags == HL_SYNC_HERE
|| flagtab[fidx].flags == HL_SYNC_THERE) {
if (opt->sync_idx == NULL) {
- EMSG(_("E393: group[t]here not accepted here"));
+ emsg(_("E393: group[t]here not accepted here"));
return NULL;
}
gname_start = arg;
@@ -4282,7 +4281,7 @@ static char_u *get_syn_options(char_u *arg, syn_opt_arg_T *opt, int *conceal_cha
}
}
if (i < 0) {
- EMSG2(_("E394: Didn't find region item for %s"), gname);
+ semsg(_("E394: Didn't find region item for %s"), gname);
xfree(gname);
return NULL;
}
@@ -4333,7 +4332,7 @@ static void syn_cmd_include(exarg_T *eap, int syncing)
int sgl_id = 1;
char_u *group_name_end;
char_u *rest;
- char_u *errormsg = NULL;
+ char *errormsg = NULL;
int prev_toplvl_grp;
int prev_syn_inc_tag;
bool source = false;
@@ -4347,7 +4346,7 @@ static void syn_cmd_include(exarg_T *eap, int syncing)
++arg;
rest = get_group_name(arg, &group_name_end);
if (rest == NULL) {
- EMSG((char_u *)_("E397: Filename required"));
+ emsg(_("E397: Filename required"));
return;
}
sgl_id = syn_check_cluster(arg, (int)(group_name_end - arg));
@@ -4371,7 +4370,7 @@ static void syn_cmd_include(exarg_T *eap, int syncing)
source = true;
if (expand_filename(eap, syn_cmdlinep, &errormsg) == FAIL) {
if (errormsg != NULL) {
- EMSG(errormsg);
+ emsg(errormsg);
}
return;
}
@@ -4382,7 +4381,7 @@ static void syn_cmd_include(exarg_T *eap, int syncing)
* include" tag around the actual inclusion.
*/
if (running_syn_inc_tag >= MAX_SYN_INC_TAG) {
- EMSG((char_u *)_("E847: Too many syntax includes"));
+ emsg(_("E847: Too many syntax includes"));
return;
}
prev_syn_inc_tag = current_syn_inc_tag;
@@ -4392,7 +4391,7 @@ static void syn_cmd_include(exarg_T *eap, int syncing)
if (source
? do_source((char *)eap->arg, false, DOSO_NONE) == FAIL
: source_runtime((char *)eap->arg, DIP_ALL) == FAIL) {
- EMSG2(_(e_notopen), eap->arg);
+ semsg(_(e_notopen), eap->arg);
}
curwin->w_s->b_syn_topgrp = prev_toplvl_grp;
current_syn_inc_tag = prev_syn_inc_tag;
@@ -4472,19 +4471,19 @@ static void syn_cmd_keyword(exarg_T *eap, int syncing)
break;
}
if (p[1] == NUL) {
- emsgf(_("E789: Missing ']': %s"), kw);
+ semsg(_("E789: Missing ']': %s"), kw);
goto error;
}
if (p[1] == ']') {
if (p[2] != NUL) {
- emsgf(_("E890: trailing char after ']': %s]%s"),
+ semsg(_("E890: trailing char after ']': %s]%s"),
kw, &p[2]);
goto error;
}
kw = p + 1;
break; // skip over the "]"
}
- const int l = (*mb_ptr2len)(p + 1);
+ const int l = utfc_ptr2len(p + 1);
memmove(p, p + 1, l);
p += l;
@@ -4502,7 +4501,7 @@ error:
if (rest != NULL) {
eap->nextcmd = check_nextcmd(rest);
} else {
- EMSG2(_(e_invarg2), arg);
+ semsg(_(e_invarg2), arg);
}
redraw_curbuf_later(SOME_VALID);
@@ -4604,7 +4603,7 @@ static void syn_cmd_match(exarg_T *eap, int syncing)
xfree(syn_opt_arg.next_list);
if (rest == NULL) {
- EMSG2(_(e_invarg2), arg);
+ semsg(_(e_invarg2), arg);
}
}
@@ -4692,7 +4691,7 @@ static void syn_cmd_region(exarg_T *eap, int syncing)
rest = skipwhite(key_end);
if (*rest != '=') {
rest = NULL;
- EMSG2(_("E398: Missing '=': %s"), arg);
+ semsg(_("E398: Missing '=': %s"), arg);
break;
}
rest = skipwhite(rest + 1);
@@ -4831,9 +4830,9 @@ static void syn_cmd_region(exarg_T *eap, int syncing)
xfree(syn_opt_arg.cont_in_list);
xfree(syn_opt_arg.next_list);
if (not_enough) {
- EMSG2(_("E399: Not enough arguments: syntax region %s"), arg);
+ semsg(_("E399: Not enough arguments: syntax region %s"), arg);
} else if (illegal || rest == NULL) {
- EMSG2(_(e_invarg2), arg);
+ semsg(_(e_invarg2), arg);
}
}
}
@@ -5030,7 +5029,7 @@ static int syn_add_cluster(char_u *name)
int len = curwin->w_s->b_syn_clusters.ga_len;
if (len >= MAX_CLUSTER_ID) {
- EMSG((char_u *)_("E848: Too many syntax clusters"));
+ emsg(_("E848: Too many syntax clusters"));
xfree(name);
return 0;
}
@@ -5098,7 +5097,7 @@ static void syn_cmd_cluster(exarg_T *eap, int syncing)
int16_t *clstr_list = NULL;
if (get_id_list(&rest, opt_len, &clstr_list, eap->skip) == FAIL) {
- EMSG2(_(e_invarg2), rest);
+ semsg(_(e_invarg2), rest);
break;
}
if (scl_id >= 0) {
@@ -5117,10 +5116,10 @@ static void syn_cmd_cluster(exarg_T *eap, int syncing)
}
if (!got_clstr) {
- EMSG(_("E400: No cluster specified"));
+ emsg(_("E400: No cluster specified"));
}
if (rest == NULL || !ends_excmd(*rest)) {
- EMSG2(_(e_invarg2), arg);
+ semsg(_(e_invarg2), arg);
}
}
@@ -5152,7 +5151,7 @@ static char_u *get_syn_pattern(char_u *arg, synpat_T *ci)
end = skip_regexp(arg + 1, *arg, TRUE, NULL);
if (*end != *arg) { // end delimiter not found
- EMSG2(_("E401: Pattern delimiter not found: %s"), arg);
+ semsg(_("E401: Pattern delimiter not found: %s"), arg);
return NULL;
}
// store the pattern and compiled regexp program
@@ -5224,7 +5223,7 @@ static char_u *get_syn_pattern(char_u *arg, synpat_T *ci)
} while (idx >= 0);
if (!ends_excmd(*end) && !ascii_iswhite(*end)) {
- EMSG2(_("E402: Garbage after pattern: %s"), arg);
+ semsg(_("E402: Garbage after pattern: %s"), arg);
return NULL;
}
return skipwhite(end);
@@ -5303,7 +5302,7 @@ static void syn_cmd_sync(exarg_T *eap, int syncing)
break;
}
if (curwin->w_s->b_syn_linecont_pat != NULL) {
- EMSG(_("E403: syntax sync: line continuations pattern specified twice"));
+ emsg(_("E403: syntax sync: line continuations pattern specified twice"));
finished = TRUE;
break;
}
@@ -5352,7 +5351,7 @@ static void syn_cmd_sync(exarg_T *eap, int syncing)
}
xfree(key);
if (illegal) {
- EMSG2(_("E404: Illegal arguments: %s"), arg_start);
+ semsg(_("E404: Illegal arguments: %s"), arg_start);
} else if (!finished) {
eap->nextcmd = check_nextcmd(arg_start);
redraw_curbuf_later(SOME_VALID);
@@ -5388,12 +5387,12 @@ static int get_id_list(char_u **const arg, const int keylen, int16_t **const lis
// skip "contains"
p = skipwhite(*arg + keylen);
if (*p != '=') {
- EMSG2(_("E405: Missing equal sign: %s"), *arg);
+ semsg(_("E405: Missing equal sign: %s"), *arg);
break;
}
p = skipwhite(p + 1);
if (ends_excmd(*p)) {
- EMSG2(_("E406: Empty argument: %s"), *arg);
+ semsg(_("E406: Empty argument: %s"), *arg);
break;
}
@@ -5409,13 +5408,13 @@ static int get_id_list(char_u **const arg, const int keylen, int16_t **const lis
|| STRCMP(name + 1, "TOP") == 0
|| STRCMP(name + 1, "CONTAINED") == 0) {
if (TOUPPER_ASC(**arg) != 'C') {
- EMSG2(_("E407: %s not allowed here"), name + 1);
+ semsg(_("E407: %s not allowed here"), name + 1);
failed = true;
xfree(name);
break;
}
if (count != 0) {
- EMSG2(_("E408: %s must be first in contains list"),
+ semsg(_("E408: %s must be first in contains list"),
name + 1);
failed = true;
xfree(name);
@@ -5480,7 +5479,7 @@ static int get_id_list(char_u **const arg, const int keylen, int16_t **const lis
}
xfree(name);
if (id == 0) {
- EMSG2(_("E409: Unknown group name: %s"), p);
+ semsg(_("E409: Unknown group name: %s"), p);
failed = true;
break;
}
@@ -5698,7 +5697,7 @@ void ex_syntax(exarg_T *eap)
}
for (int i = 0;; i++) {
if (subcommands[i].name == NULL) {
- EMSG2(_("E410: Invalid :syntax subcommand: %s"), subcmd_name);
+ semsg(_("E410: Invalid :syntax subcommand: %s"), subcmd_name);
break;
}
if (STRCMP(subcmd_name, (char_u *)subcommands[i].name) == 0) {
@@ -5770,7 +5769,7 @@ static enum {
EXP_SUBCMD, // expand ":syn" sub-commands
EXP_CASE, // expand ":syn case" arguments
EXP_SPELL, // expand ":syn spell" arguments
- EXP_SYNC // expand ":syn sync" arguments
+ EXP_SYNC, // expand ":syn sync" arguments
} expand_what;
/*
@@ -6003,7 +6002,7 @@ void ex_syntime(exarg_T *eap)
} else if (STRCMP(eap->arg, "report") == 0) {
syntime_report();
} else {
- EMSG2(_(e_invarg2), eap->arg);
+ semsg(_(e_invarg2), eap->arg);
}
}
@@ -6023,7 +6022,7 @@ static void syntime_clear(void)
synpat_T *spp;
if (!syntax_present(curwin)) {
- MSG(_(msg_no_items));
+ msg(_(msg_no_items));
return;
}
for (int idx = 0; idx < curwin->w_s->b_syn_patterns.ga_len; ++idx) {
@@ -6065,7 +6064,7 @@ static int syn_compare_syntime(const void *v1, const void *v2)
static void syntime_report(void)
{
if (!syntax_present(curwin)) {
- MSG(_(msg_no_items));
+ msg(_(msg_no_items));
return;
}
@@ -6099,28 +6098,28 @@ static void syntime_report(void)
syn_compare_syntime);
}
- MSG_PUTS_TITLE(_(" TOTAL COUNT MATCH SLOWEST AVERAGE NAME PATTERN"));
- MSG_PUTS("\n");
+ msg_puts_title(_(" TOTAL COUNT MATCH SLOWEST AVERAGE NAME PATTERN"));
+ msg_puts("\n");
for (int idx = 0; idx < ga.ga_len && !got_int; ++idx) {
p = ((time_entry_T *)ga.ga_data) + idx;
- MSG_PUTS(profile_msg(p->total));
- MSG_PUTS(" "); // make sure there is always a separating space
+ msg_puts(profile_msg(p->total));
+ msg_puts(" "); // make sure there is always a separating space
msg_advance(13);
msg_outnum(p->count);
- MSG_PUTS(" ");
+ msg_puts(" ");
msg_advance(20);
msg_outnum(p->match);
- MSG_PUTS(" ");
+ msg_puts(" ");
msg_advance(26);
- MSG_PUTS(profile_msg(p->slowest));
- MSG_PUTS(" ");
+ msg_puts(profile_msg(p->slowest));
+ msg_puts(" ");
msg_advance(38);
- MSG_PUTS(profile_msg(p->average));
- MSG_PUTS(" ");
+ msg_puts(profile_msg(p->average));
+ msg_puts(" ");
msg_advance(50);
msg_outtrans(HL_TABLE()[p->id - 1].sg_name);
- MSG_PUTS(" ");
+ msg_puts(" ");
msg_advance(69);
int len;
@@ -6133,15 +6132,15 @@ static void syntime_report(void)
len = (int)STRLEN(p->pattern);
}
msg_outtrans_len(p->pattern, len);
- MSG_PUTS("\n");
+ msg_puts("\n");
}
ga_clear(&ga);
if (!got_int) {
- MSG_PUTS("\n");
- MSG_PUTS(profile_msg(total_total));
+ msg_puts("\n");
+ msg_puts(profile_msg(total_total));
msg_advance(13);
msg_outnum(total_count);
- MSG_PUTS("\n");
+ msg_puts("\n");
}
}
@@ -6776,7 +6775,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
if (!doclear && !dolink && ends_excmd((uint8_t)(*linep))) {
id = syn_name2id_len((const char_u *)line, (int)(name_end - line));
if (id == 0) {
- emsgf(_("E411: highlight group not found: %s"), line);
+ semsg(_("E411: highlight group not found: %s"), line);
} else {
highlight_list_one(id);
}
@@ -6799,13 +6798,13 @@ void do_highlight(const char *line, const bool forceit, const bool init)
if (ends_excmd((uint8_t)(*from_start))
|| ends_excmd((uint8_t)(*to_start))) {
- emsgf(_("E412: Not enough arguments: \":highlight link %s\""),
+ semsg(_("E412: Not enough arguments: \":highlight link %s\""),
from_start);
return;
}
if (!ends_excmd(*skipwhite((const char_u *)to_end))) {
- emsgf(_("E413: Too many arguments: \":highlight link %s\""), from_start);
+ semsg(_("E413: Too many arguments: \":highlight link %s\""), from_start);
return;
}
@@ -6831,7 +6830,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
if (to_id > 0 && !forceit && !init
&& hl_has_settings(from_id - 1, dodefault)) {
if (sourcing_name == NULL && !dodefault) {
- EMSG(_("E414: group has settings, highlight link ignored"));
+ emsg(_("E414: group has settings, highlight link ignored"));
}
} else if (hlgroup->sg_link != to_id
|| hlgroup->sg_script_ctx.sc_sid != current_sctx.sc_sid
@@ -6903,7 +6902,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
while (!ends_excmd((uint8_t)(*linep))) {
key_start = linep;
if (*linep == '=') {
- emsgf(_("E415: unexpected equal sign: %s"), key_start);
+ semsg(_("E415: unexpected equal sign: %s"), key_start);
error = true;
break;
}
@@ -6930,7 +6929,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
// Check for the equal sign.
if (*linep != '=') {
- emsgf(_("E416: missing equal sign: %s"), key_start);
+ semsg(_("E416: missing equal sign: %s"), key_start);
error = true;
break;
}
@@ -6942,7 +6941,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
arg_start = ++linep;
linep = strchr(linep, '\'');
if (linep == NULL) {
- emsgf(_(e_invarg2), key_start);
+ semsg(_(e_invarg2), key_start);
error = true;
break;
}
@@ -6951,7 +6950,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
linep = (const char *)skiptowhite((const char_u *)linep);
}
if (linep == arg_start) {
- emsgf(_("E417: missing argument: %s"), key_start);
+ semsg(_("E417: missing argument: %s"), key_start);
error = true;
break;
}
@@ -6978,7 +6977,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
}
}
if (i < 0) {
- emsgf(_("E418: Illegal value: %s"), arg);
+ semsg(_("E418: Illegal value: %s"), arg);
error = true;
break;
}
@@ -7026,7 +7025,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
if (cterm_normal_fg_color) {
color = cterm_normal_fg_color - 1;
} else {
- EMSG(_("E419: FG color unknown"));
+ emsg(_("E419: FG color unknown"));
error = true;
break;
}
@@ -7034,7 +7033,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
if (cterm_normal_bg_color > 0) {
color = cterm_normal_bg_color - 1;
} else {
- EMSG(_("E420: BG color unknown"));
+ emsg(_("E420: BG color unknown"));
error = true;
break;
}
@@ -7048,7 +7047,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
}
}
if (i < 0) {
- emsgf(_("E421: Color name or number not recognized: %s"),
+ semsg(_("E421: Color name or number not recognized: %s"),
key_start);
error = true;
break;
@@ -7181,7 +7180,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
HL_TABLE()[idx].sg_blend = -1;
}
} else {
- emsgf(_("E423: Illegal argument: %s"), key_start);
+ semsg(_("E423: Illegal argument: %s"), key_start);
error = true;
break;
}
@@ -7417,8 +7416,8 @@ static bool highlight_list_arg(const int id, bool didh, const int type, int iarg
didh = true;
if (!got_int) {
if (*name != NUL) {
- MSG_PUTS_ATTR(name, HL_ATTR(HLF_D));
- MSG_PUTS_ATTR("=", HL_ATTR(HLF_D));
+ msg_puts_attr(name, HL_ATTR(HLF_D));
+ msg_puts_attr("=", HL_ATTR(HLF_D));
}
msg_outtrans((char_u *)ts);
}
@@ -7699,14 +7698,14 @@ static int syn_add_group(char_u *name)
// Check that the name is ASCII letters, digits and underscore.
for (p = name; *p != NUL; ++p) {
if (!vim_isprintc(*p)) {
- EMSG(_("E669: Unprintable character in group name"));
+ emsg(_("E669: Unprintable character in group name"));
xfree(name);
return 0;
} else if (!ASCII_ISALNUM(*p) && *p != '_') {
/* This is an error, but since there previously was no check only
* give a warning. */
msg_source(HL_ATTR(HLF_W));
- MSG(_("W18: Invalid character in group name"));
+ msg(_("W18: Invalid character in group name"));
break;
}
}
@@ -7720,7 +7719,7 @@ static int syn_add_group(char_u *name)
}
if (highlight_ga.ga_len >= MAX_HL_ID) {
- EMSG(_("E849: Too many highlight and syntax groups"));
+ emsg(_("E849: Too many highlight and syntax groups"));
xfree(name);
return 0;
}
@@ -7771,8 +7770,6 @@ int syn_id2attr(int hl_id)
}
-
-
/*
* Translate a group ID to the final group ID (following links).
*/