From: Eelis van der Weegen Date: Mon, 1 Apr 2013 12:42:41 +0000 (+0200) Subject: Add 'line' as a configuration parsing primitive X-Git-Tag: 4.6~61 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7f5a18e093e8734e182bdb60f178324795e950f6;p=i3%2Fi3 Add 'line' as a configuration parsing primitive …and use it for ignoring comment lines, so that quotes in them doesn't cause problems anymore. --- diff --git a/parser-specs/config.spec b/parser-specs/config.spec index 6960510d..c6328a0e 100644 --- a/parser-specs/config.spec +++ b/parser-specs/config.spec @@ -49,7 +49,7 @@ state INITIAL: # We ignore comments and 'set' lines (variables). state IGNORE_LINE: - end, string + line -> INITIAL # floating_minimum_size x @@ -311,7 +311,7 @@ state MODE: # We ignore comments and 'set' lines (variables). state MODE_IGNORE_LINE: - end, string + line -> MODE state MODE_BINDING: @@ -362,7 +362,7 @@ state BAR: # We ignore comments and 'set' lines (variables). state BAR_IGNORE_LINE: - end, string + line -> BAR state BAR_BAR_COMMAND: @@ -428,7 +428,7 @@ state BAR_COLORS: # We ignore comments and 'set' lines (variables). state BAR_COLORS_IGNORE_LINE: - end, string + line -> BAR_COLORS state BAR_COLORS_SINGLE: diff --git a/src/config_parser.c b/src/config_parser.c index 1cdc7acb..f197c39d 100644 --- a/src/config_parser.c +++ b/src/config_parser.c @@ -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) { //printf("checking for end: *%s*\n", walk); if (*walk == '\0' || *walk == '\n' || *walk == '\r') {