tweaks: move a syntax check to a better place, to reduce duplication
parent
0e94575c6b
commit
03692363a2
27
src/rcfile.c
27
src/rcfile.c
|
@ -716,12 +716,6 @@ void parse_colors(char *ptr, int rex_flags)
|
||||||
int attributes;
|
int attributes;
|
||||||
char *item;
|
char *item;
|
||||||
|
|
||||||
if (!opensyntax) {
|
|
||||||
rcfile_error(N_("A '%s' command requires a preceding 'syntax' command"),
|
|
||||||
"color");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*ptr == '\0') {
|
if (*ptr == '\0') {
|
||||||
rcfile_error(N_("Missing color name"));
|
rcfile_error(N_("Missing color name"));
|
||||||
return;
|
return;
|
||||||
|
@ -908,12 +902,6 @@ void grab_and_store(const char *kind, char *ptr, regexlisttype **storage)
|
||||||
/* Gather and store the string after a comment/linter command. */
|
/* Gather and store the string after a comment/linter command. */
|
||||||
void pick_up_name(const char *kind, char *ptr, char **storage)
|
void pick_up_name(const char *kind, char *ptr, char **storage)
|
||||||
{
|
{
|
||||||
if (!opensyntax) {
|
|
||||||
rcfile_error(
|
|
||||||
N_("A '%s' command requires a preceding 'syntax' command"), kind);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*ptr == '\0') {
|
if (*ptr == '\0') {
|
||||||
rcfile_error(N_("Missing argument after '%s'"), kind);
|
rcfile_error(N_("Missing argument after '%s'"), kind);
|
||||||
return;
|
return;
|
||||||
|
@ -1097,14 +1085,15 @@ void parse_rcfile(FILE *rcstream, bool just_syntax, bool intros_only)
|
||||||
keyword);
|
keyword);
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
} else if (intros_only && opensyntax &&
|
} else if (intros_only && (strcasecmp(keyword, "color") == 0 ||
|
||||||
(strcasecmp(keyword, "color") == 0 ||
|
strcasecmp(keyword, "icolor") == 0 ||
|
||||||
strcasecmp(keyword, "icolor") == 0)) {
|
strcasecmp(keyword, "comment") == 0 ||
|
||||||
seen_color_command = TRUE;
|
|
||||||
continue;
|
|
||||||
} else if (intros_only && opensyntax &&
|
|
||||||
(strcasecmp(keyword, "comment") == 0 ||
|
|
||||||
strcasecmp(keyword, "linter") == 0)) {
|
strcasecmp(keyword, "linter") == 0)) {
|
||||||
|
if (!opensyntax)
|
||||||
|
rcfile_error(N_("A '%s' command requires a preceding "
|
||||||
|
"'syntax' command"), keyword);
|
||||||
|
if (strcasestr("icolor", keyword))
|
||||||
|
seen_color_command = TRUE;
|
||||||
continue;
|
continue;
|
||||||
} else if (parse_syntax_commands(keyword, ptr))
|
} else if (parse_syntax_commands(keyword, ptr))
|
||||||
;
|
;
|
||||||
|
|
Loading…
Reference in New Issue