diff --git a/doc/overview.xml b/doc/overview.xml index f7de2968c..dae3c808e 100644 --- a/doc/overview.xml +++ b/doc/overview.xml @@ -500,6 +500,9 @@ notify(vm); The # character introduces a comment that spans until the end of the line. + The ; character at the beginning of + a line makes the entire line a comment. + The option names are relative to the section names, so @@ -649,4 +652,4 @@ gui.accessibility.visual_bell=yes sgml-parent-document: ("program_options.xml" "section") sgml-set-face: t End: ---> \ No newline at end of file +--> diff --git a/src/config_file.cpp b/src/config_file.cpp index f2a57b4b8..89a1ea818 100644 --- a/src/config_file.cpp +++ b/src/config_file.cpp @@ -90,6 +90,9 @@ namespace boost { namespace program_options { namespace detail { // strip '#' comments and whitespace if ((n = s.find('#')) != string::npos) s = s.substr(0, n); + // if the first character is a ';' line is a comment + if (!s.empty() && ';' == s.at(0)) + s = ""; s = trim_ws(s); if (!s.empty()) { diff --git a/test/parsers_test.cpp b/test/parsers_test.cpp index cc1bdd3f2..2c1dbcc84 100644 --- a/test/parsers_test.cpp +++ b/test/parsers_test.cpp @@ -211,6 +211,7 @@ void test_config_file(const char* config_file) const char content1[] = " gv1 = 0#asd\n" + "; semi comment\n" "empty_value = \n" "plug3 = 7\n" "b = true\n"