case lex_identifier: return _("identifier");
case lex_string: return _("string");
case lex_quoted_string: return _("quoted_string");
+ case lex_include: return _("include");
+ case lex_include_quoted_string: return _("include_quoted_string");
case lex_utf8_bom: return _("UTF-8 Byte Order Mark");
case lex_utf16_le_bom: return _("UTF-16le Byte Order Mark");
default: return "??????";
}
add_str(lf, ch);
break;
+ case lex_include_quoted_string:
+ if (ch == L_EOF) {
+ token = T_ERROR;
+ break;
+ }
+ if (esc_next) {
+ add_str(lf, ch);
+ esc_next = false;
+ break;
+ }
+ if (ch == '\\') {
+ esc_next = true;
+ break;
+ }
+ if (ch == '"') {
+ /* Keep the original LEX so we can print an error if the included file can't be opened. */
+ LEX* lfori = lf;
+ /* Skip the double quote when restarting parsing */
+ lex_get_char(lf);
+
+ lf->state = lex_none;
+ lf = lex_open_file(lf, lf->str, lf->scan_error);
+ if (lf == NULL) {
+ berrno be;
+ scan_err2(lfori, _("Cannot open included config file %s: %s\n"),
+ lfori->str, be.bstrerror());
+ return T_ERROR;
+ }
+ break;
+ }
+ add_str(lf, ch);
+ break;
case lex_include: /* scanning a filename */
if (ch == L_EOF) {
token = T_ERROR;
break;
}
+ if (ch == '"') {
+ lf->state = lex_include_quoted_string;
+ break;
+ }
+
+
if (B_ISSPACE(ch) || ch == '\n' || ch == L_EOL || ch == '}' || ch == '{' ||
ch == ';' || ch == ',' || ch == '"' || ch == '#') {
/* Keep the original LEX so we can print an error if the included file can't be opened. */
lex_identifier,
lex_string,
lex_quoted_string,
+ lex_include_quoted_string,
lex_include,
lex_utf8_bom, /* we are parsing out a utf8 byte order mark */
lex_utf16_le_bom /* we are parsing out a utf-16 (little endian) byte order mark */
General:
14Dec07
+kes Apply patch from Michael Stapelberg <michael@stapelberg.de>
+ that implements double quoting include names in conf files,
+ and also allows piping input by having the first character
+ be a vertical bar (|).
kes Apply patch from Bastian Friedrich <bastian.friedrich@collax.com>
that implement %f in RunScripts to pass the FileSet name.
kes Skip leading | when lex input comes from a pipe as suggested