# HG changeset patch # User František Kučera # Date 1607877266 -3600 # Node ID 3b81fbeb5f3baffac86d5e44114be2bf5168cfb4 # Parent 193c643f4ffeab880652790f2ae5c5a628597065 java-manifest-mf + improve unescaping diff -r 193c643f4ffe -r 3b81fbeb5f3b bash-completion.sh --- a/bash-completion.sh Sun Nov 29 10:50:16 2020 +0100 +++ b/bash-completion.sh Sun Dec 13 17:34:26 2020 +0100 @@ -45,6 +45,7 @@ DIALECTS=( "java-properties" + "java-manifest-mf" ); if [[ "$w1" == "--relation" && "x$w0" == "x" ]]; then COMPREPLY=("''") diff -r 193c643f4ffe -r 3b81fbeb5f3b src/INICommand.cpp --- a/src/INICommand.cpp Sun Nov 29 10:50:16 2020 +0100 +++ b/src/INICommand.cpp Sun Dec 13 17:34:26 2020 +0100 @@ -177,6 +177,7 @@ reader->addUnescapingProcessor(std::make_shared(), unescaping::JavaProperties, false); reader->addUnescapingProcessor(std::make_shared(), unescaping::Backspace, true); reader->addDialect(std::make_shared(), dialect::JavaProperties, false); + reader->addDialect(std::make_shared(), dialect::JavaManifestMF, false); reader->addHandler(&handler); // TODO: smart pointers vs. references: are we going to call addUnescapingProcessor() dynamically/conditionally or share instances? Then pointers will be better. for (ParserOptionRecipe option : configuration.parserOptions) reader->setOption(convertor.to_bytes(option.uri), convertor.to_bytes(option.value)); diff -r 193c643f4ffe -r 3b81fbeb5f3b src/lib/BasicUnescapingProcessor.h --- a/src/lib/BasicUnescapingProcessor.h Sun Nov 29 10:50:16 2020 +0100 +++ b/src/lib/BasicUnescapingProcessor.h Sun Dec 13 17:34:26 2020 +0100 @@ -43,6 +43,7 @@ else if (ch == 's') put(result, ' ', i); // TODO: Reconsider what is „basic“ escaping and should be supported. else if (ch == '"') put(result, ch, i); // The delimiters (\n,]",') are already unescaped during the first stage in the INIReader while parsing (the delimiter relevant to given environment is unescaped, e.g. \" in "quoted" value). else if (ch == '\'') put(result, ch, i); // So it does not necessary to do it here. But someone might write a="xxx\'zzz" however it is superfluous because a="xxx'zzz" will also work. + else if (ch == '[') put(result, ch, i); else if (ch == ']') put(result, ch, i); else if (ch == ':') put(result, ch, i); else if (ch == ';') put(result, ch, i); diff -r 193c643f4ffe -r 3b81fbeb5f3b src/lib/Dialect.h --- a/src/lib/Dialect.h Sun Nov 29 10:50:16 2020 +0100 +++ b/src/lib/Dialect.h Sun Dec 13 17:34:26 2020 +0100 @@ -18,8 +18,6 @@ #include "INIReader.h" -using namespace std; - namespace relpipe { namespace in { namespace ini { @@ -37,6 +35,9 @@ */ virtual void apply(INIReader& reader) = 0; + virtual ~Dialect() { + } + }; } diff -r 193c643f4ffe -r 3b81fbeb5f3b src/lib/UnescapingProcessor.h --- a/src/lib/UnescapingProcessor.h Sun Nov 29 10:50:16 2020 +0100 +++ b/src/lib/UnescapingProcessor.h Sun Dec 13 17:34:26 2020 +0100 @@ -20,8 +20,6 @@ #include "INIReader.h" -using namespace std; - namespace relpipe { namespace in { namespace ini { @@ -52,6 +50,8 @@ virtual std::string unescape(const std::string& s, const TextType type) = 0; + virtual ~UnescapingProcessor() { + } }; } diff -r 193c643f4ffe -r 3b81fbeb5f3b src/lib/uri.h --- a/src/lib/uri.h Sun Nov 29 10:50:16 2020 +0100 +++ b/src/lib/uri.h Sun Dec 13 17:34:26 2020 +0100 @@ -45,6 +45,7 @@ /** not options but a values of the dialect option */ namespace dialect { static const char* JavaProperties = "java-properties"; +static const char* JavaManifestMF = "java-manifest-mf"; } /** options for configuring the stage where events from the INI parser are converted to SAX events or DOM building */