# HG changeset patch # User František Kučera # Date 1606412558 -3600 # Node ID b35baebf5005cc780c76f912fb81217c231f0892 # Parent 9187f0439ca9a94e105bb0a5e69a22fb15717004 prepare for multiple and configurable comment separators (e.g. „; comment“ and „# comment“) diff -r 9187f0439ca9 -r b35baebf5005 src/lib/INIReader.cpp --- a/src/lib/INIReader.cpp Thu Nov 26 18:28:27 2020 +0100 +++ b/src/lib/INIReader.cpp Thu Nov 26 18:42:38 2020 +0100 @@ -82,6 +82,16 @@ */ std::string keyValueSeparators = "="; + /** + * This might be configurable. + * + * Classic INI uses „; comment“ syntax. + * But many existing files contain „# comment“ lines. + * + * Only single character separators are supported (works same as keyValueSeparators). + */ + std::string commentSeparators = ";#"; + int lineNumber = 1; int eventNumber = 0; @@ -194,7 +204,7 @@ } bool isComment(char ch) { - return ch == '#' || ch == ';'; + return oneOf(ch, commentSeparators); } bool isQuote(char ch) {