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>
master
Ran Benita 2013-10-14 19:05:24 +03:00
parent dcdd4e1030
commit 65f9980b24
2 changed files with 13 additions and 4 deletions

View File

@ -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++;
}

View File

@ -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 =