diff --git a/src/xkbcomp/rules.c b/src/xkbcomp/rules.c index 918fe318a..5bcfa22a3 100644 --- a/src/xkbcomp/rules.c +++ b/src/xkbcomp/rules.c @@ -978,6 +978,14 @@ matcher_match(struct matcher *m, struct scanner *s, switch (tok = gettok(m, s)) { case TOK_IDENTIFIER: matcher_include(m, s, include_depth, m->val.string); + goto include_statement_end; + default: + goto unexpected; + } + +include_statement_end: + switch (tok = gettok(m, s)) { + case TOK_END_OF_LINE: goto initial; default: goto unexpected; diff --git a/test/data/rules/inc-no-newline b/test/data/rules/inc-no-newline new file mode 100644 index 000000000..895c314b2 --- /dev/null +++ b/test/data/rules/inc-no-newline @@ -0,0 +1 @@ +! include %S/inc-dst-simple !include %S/inc-dst-simple ! layout = symbols diff --git a/test/rules-file-includes.c b/test/rules-file-includes.c index 006449c77..17438fd95 100644 --- a/test/rules-file-includes.c +++ b/test/rules-file-includes.c @@ -159,6 +159,12 @@ main(int argc, char *argv[]) }; assert(test_rules(ctx, &test6)); + struct test_data test7 = { + .rules = "inc-no-newline", + .should_fail = true, + }; + assert(test_rules(ctx, &test7)); + xkb_context_unref(ctx); return 0; }