diff --git a/parser.c b/parser.c index 0902a34..5b774d9 100644 --- a/parser.c +++ b/parser.c @@ -70,7 +70,7 @@ static bool parser_append_tok_ch(struct kanshi_parser *parser, char ch) { return true; } -static bool parser_read_quoted(struct kanshi_parser *parser) { +static bool parser_read_quoted(struct kanshi_parser *parser, char quote_char) { while (1) { int ch = parser_read_char(parser); if (ch < 0) { @@ -80,7 +80,7 @@ static bool parser_read_quoted(struct kanshi_parser *parser) { return false; } - if (ch == '"') { + if (ch == quote_char) { parser->tok_str[parser->tok_str_len] = '\0'; return true; } @@ -158,10 +158,10 @@ static bool parser_next_token(struct kanshi_parser *parser) { return true; } else if (isspace(ch)) { continue; - } else if (ch == '"') { + } else if (ch == '"' || ch == '\'') { parser->tok_type = KANSHI_TOKEN_STR; parser->tok_str_len = 0; - return parser_read_quoted(parser); + return parser_read_quoted(parser, ch); } else if (ch == '#') { parser_ignore_line(parser); parser->tok_type = KANSHI_TOKEN_NEWLINE;