Add 'line' as a configuration parsing primitive
…and use it for ignoring comment lines, so that quotes in them doesn't cause problems anymore.
This commit is contained in:
parent
82b59788ac
commit
7f5a18e093
|
@ -49,7 +49,7 @@ state INITIAL:
|
||||||
|
|
||||||
# We ignore comments and 'set' lines (variables).
|
# We ignore comments and 'set' lines (variables).
|
||||||
state IGNORE_LINE:
|
state IGNORE_LINE:
|
||||||
end, string
|
line
|
||||||
-> INITIAL
|
-> INITIAL
|
||||||
|
|
||||||
# floating_minimum_size <width> x <height>
|
# floating_minimum_size <width> x <height>
|
||||||
|
@ -311,7 +311,7 @@ state MODE:
|
||||||
|
|
||||||
# We ignore comments and 'set' lines (variables).
|
# We ignore comments and 'set' lines (variables).
|
||||||
state MODE_IGNORE_LINE:
|
state MODE_IGNORE_LINE:
|
||||||
end, string
|
line
|
||||||
-> MODE
|
-> MODE
|
||||||
|
|
||||||
state MODE_BINDING:
|
state MODE_BINDING:
|
||||||
|
@ -362,7 +362,7 @@ state BAR:
|
||||||
|
|
||||||
# We ignore comments and 'set' lines (variables).
|
# We ignore comments and 'set' lines (variables).
|
||||||
state BAR_IGNORE_LINE:
|
state BAR_IGNORE_LINE:
|
||||||
end, string
|
line
|
||||||
-> BAR
|
-> BAR
|
||||||
|
|
||||||
state BAR_BAR_COMMAND:
|
state BAR_BAR_COMMAND:
|
||||||
|
@ -428,7 +428,7 @@ state BAR_COLORS:
|
||||||
|
|
||||||
# We ignore comments and 'set' lines (variables).
|
# We ignore comments and 'set' lines (variables).
|
||||||
state BAR_COLORS_IGNORE_LINE:
|
state BAR_COLORS_IGNORE_LINE:
|
||||||
end, string
|
line
|
||||||
-> BAR_COLORS
|
-> BAR_COLORS
|
||||||
|
|
||||||
state BAR_COLORS_SINGLE:
|
state BAR_COLORS_SINGLE:
|
||||||
|
|
|
@ -446,6 +446,16 @@ struct ConfigResult *parse_config(const char *input, struct context *context) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strcmp(token->name, "line") == 0) {
|
||||||
|
while (*walk != '\0' && *walk != '\n' && *walk != '\r')
|
||||||
|
walk++;
|
||||||
|
next_state(token);
|
||||||
|
token_handled = true;
|
||||||
|
linecnt++;
|
||||||
|
walk++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (strcmp(token->name, "end") == 0) {
|
if (strcmp(token->name, "end") == 0) {
|
||||||
//printf("checking for end: *%s*\n", walk);
|
//printf("checking for end: *%s*\n", walk);
|
||||||
if (*walk == '\0' || *walk == '\n' || *walk == '\r') {
|
if (*walk == '\0' || *walk == '\n' || *walk == '\r') {
|
||||||
|
|
Loading…
Reference in New Issue