summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/xkbcomp/rules.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/src/xkbcomp/rules.c b/src/xkbcomp/rules.c
index 47c2ff9..a6abd52 100644
--- a/src/xkbcomp/rules.c
+++ b/src/xkbcomp/rules.c
@@ -324,9 +324,6 @@ matcher_free(struct matcher *m)
free(m);
}
-#define matcher_err(matcher, fmt, ...) \
- scanner_err(&(matcher)->scanner, fmt, ## __VA_ARGS__)
-
static void
matcher_group_start_new(struct matcher *m, struct sval name)
{
@@ -386,14 +383,14 @@ matcher_mapping_set_mlvo(struct matcher *m, struct sval ident)
/* Not found. */
if (mlvo >= _MLVO_NUM_ENTRIES) {
- matcher_err(m, "invalid mapping: %.*s is not a valid value here; ignoring rule set",
+ scanner_err(&m->scanner, "invalid mapping: %.*s is not a valid value here; ignoring rule set",
ident.len, ident.start);
m->mapping.skip = true;
return;
}
if (m->mapping.defined_mlvo_mask & (1u << mlvo)) {
- matcher_err(m, "invalid mapping: %.*s appears twice on the same line; ignoring rule set",
+ scanner_err(&m->scanner, "invalid mapping: %.*s appears twice on the same line; ignoring rule set",
mlvo_sval.len, mlvo_sval.start);
m->mapping.skip = true;
return;
@@ -405,7 +402,7 @@ matcher_mapping_set_mlvo(struct matcher *m, struct sval ident)
int consumed = extract_layout_index(ident.start + mlvo_sval.len,
ident.len - mlvo_sval.len, &idx);
if ((int) (ident.len - mlvo_sval.len) != consumed) {
- matcher_err(m, "invalid mapping: \"%.*s\" may only be followed by a valid group index; ignoring rule set",
+ scanner_err(&m->scanner, "invalid mapping: \"%.*s\" may only be followed by a valid group index; ignoring rule set",
mlvo_sval.len, mlvo_sval.start);
m->mapping.skip = true;
return;
@@ -418,7 +415,7 @@ matcher_mapping_set_mlvo(struct matcher *m, struct sval ident)
m->mapping.variant_idx = idx;
}
else {
- matcher_err(m, "invalid mapping: \"%.*s\" cannot be followed by a group index; ignoring rule set",
+ scanner_err(&m->scanner, "invalid mapping: \"%.*s\" cannot be followed by a group index; ignoring rule set",
mlvo_sval.len, mlvo_sval.start);
m->mapping.skip = true;
return;
@@ -445,14 +442,14 @@ matcher_mapping_set_kccgst(struct matcher *m, struct sval ident)
/* Not found. */
if (kccgst >= _KCCGST_NUM_ENTRIES) {
- matcher_err(m, "invalid mapping: %.*s is not a valid value here; ignoring rule set",
+ scanner_err(&m->scanner, "invalid mapping: %.*s is not a valid value here; ignoring rule set",
ident.len, ident.start);
m->mapping.skip = true;
return;
}
if (m->mapping.defined_kccgst_mask & (1u << kccgst)) {
- matcher_err(m, "invalid mapping: %.*s appears twice on the same line; ignoring rule set",
+ scanner_err(&m->scanner, "invalid mapping: %.*s appears twice on the same line; ignoring rule set",
kccgst_sval.len, kccgst_sval.start);
m->mapping.skip = true;
return;
@@ -467,12 +464,12 @@ static void
matcher_mapping_verify(struct matcher *m)
{
if (m->mapping.num_mlvo == 0) {
- matcher_err(m, "invalid mapping: must have at least one value on the left hand side; ignoring rule set");
+ scanner_err(&m->scanner, "invalid mapping: must have at least one value on the left hand side; ignoring rule set");
goto skip;
}
if (m->mapping.num_kccgst == 0) {
- matcher_err(m, "invalid mapping: must have at least one value on the right hand side; ignoring rule set");
+ scanner_err(&m->scanner, "invalid mapping: must have at least one value on the right hand side; ignoring rule set");
goto skip;
}
@@ -523,7 +520,7 @@ matcher_rule_set_mlvo_common(struct matcher *m, struct sval ident,
enum mlvo_match_type match_type)
{
if (m->rule.num_mlvo_values + 1 > m->mapping.num_mlvo) {
- matcher_err(m, "invalid rule: has more values than the mapping line; ignoring rule");
+ scanner_err(&m->scanner, "invalid rule: has more values than the mapping line; ignoring rule");
m->rule.skip = true;
return;
}
@@ -555,7 +552,7 @@ static void
matcher_rule_set_kccgst(struct matcher *m, struct sval ident)
{
if (m->rule.num_kccgst_values + 1 > m->mapping.num_kccgst) {
- matcher_err(m, "invalid rule: has more values than the mapping line; ignoring rule");
+ scanner_err(&m->scanner, "invalid rule: has more values than the mapping line; ignoring rule");
m->rule.skip = true;
return;
}
@@ -669,7 +666,7 @@ append_expanded_kccgst_value(struct matcher *m, darray_char *to,
int consumed;
if (mlv != MLVO_LAYOUT && mlv != MLVO_VARIANT) {
- matcher_err(m, "invalid index in %%-expansion; may only index layout or variant");
+ scanner_err(&m->scanner, "invalid index in %%-expansion; may only index layout or variant");
goto error;
}
@@ -745,7 +742,7 @@ append_expanded_kccgst_value(struct matcher *m, darray_char *to,
error:
darray_free(expanded);
- matcher_err(m, "invalid %%-expansion in value; not used");
+ scanner_err(&m->scanner, "invalid %%-expansion in value; not used");
return false;
}
@@ -754,7 +751,7 @@ matcher_rule_verify(struct matcher *m)
{
if (m->rule.num_mlvo_values != m->mapping.num_mlvo ||
m->rule.num_kccgst_values != m->mapping.num_kccgst) {
- matcher_err(m, "invalid rule: must have same number of values as mapping line; ignoring rule");
+ scanner_err(&m->scanner, "invalid rule: must have same number of values as mapping line; ignoring rule");
m->rule.skip = true;
}
}
@@ -994,7 +991,7 @@ finish:
return true;
state_error:
- matcher_err(m, "unexpected token");
+ scanner_err(&m->scanner, "unexpected token");
error:
return false;
}