Commit 65f9980b241876c961cfe3d19d311f4bf04e2eff

Ran Benita 2013-10-14T19:05:24

rules: fix scanning of line-continuation without leading space We were failing to scan something like\ this correctly. Signed-off-by: Ran Benita <ran234@gmail.com>

diff --git a/src/xkbcomp/rules.c b/src/xkbcomp/rules.c
index 54468a0..de82d96 100644
--- a/src/xkbcomp/rules.c
+++ b/src/xkbcomp/rules.c
@@ -164,6 +164,12 @@ enum rules_token {
     log_warn((scanner)->ctx, "rules/%s:%d:%d: " fmt "\n", \
              (scanner)->file_name, (loc)->line, (loc)->column, __VA_ARGS__)
 
+static inline bool
+is_ident(char ch)
+{
+    return is_graph(ch) && ch != '\\';
+}
+
 static enum rules_token
 lex(struct scanner *s, union lvalue *val, struct location *loc)
 {
@@ -209,7 +215,7 @@ skip_more_whitespace_and_comments:
     if (chr(s, '$')) {
         val->string.start = s->s + s->pos;
         val->string.len = 0;
-        while (is_graph(peek(s))) {
+        while (is_ident(peek(s))) {
             next(s);
             val->string.len++;
         }
@@ -222,10 +228,10 @@ skip_more_whitespace_and_comments:
     }
 
     /* Identifier. */
-    if (is_graph(peek(s))) {
+    if (is_ident(peek(s))) {
         val->string.start = s->s + s->pos;
         val->string.len = 0;
-        while (is_graph(peek(s))) {
+        while (is_ident(peek(s))) {
             next(s);
             val->string.len++;
         }
diff --git a/test/data/rules/groups b/test/data/rules/groups
index d9de6ee..15dc3c5 100644
--- a/test/data/rules/groups
+++ b/test/data/rules/groups
@@ -1,4 +1,7 @@
-! $model_group = pc101  pc102    pc104           pc105
+! $model_group = pc101       pc102    \
+                 pc104\
+                 pc105\
+                 pc106
 ! $layout_group = ar br cr              us
 ! $variant_group =