#include "components/subresource_filter/tools/rule_parser/rule_parser.h"
#include <map>
#include <string_view>
#include <utility>
#include <vector>
#include "base/check.h"
#include "base/check_op.h"
#include "base/logging.h"
#include "base/not_fatal_until.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "components/subresource_filter/tools/rule_parser/rule_options.h"
#include "components/url_pattern_index/proto/rules.pb.h"
namespace subresource_filter {
namespace {
class KeywordMap { … };
KeywordMap::KeywordMap() { … }
KeywordMap::~KeywordMap() = default;
const KeywordMap::OptionDetails* KeywordMap::Lookup(
std::string_view name) const { … }
void KeywordMap::AddOption(std::string_view name,
const OptionDetails& details) { … }
KeywordMap* GetKeywordsMapSingleton() { … }
}
RuleParser::ParseError::ParseError() = default;
RuleParser::ParseError::~ParseError() = default;
RuleParser::RuleParser() = default;
RuleParser::~RuleParser() = default;
const char* RuleParser::GetParseErrorCodeDescription(
ParseError::ErrorCode code) { … }
RuleType RuleParser::Parse(std::string_view line) { … }
RuleType RuleParser::ParseUrlRule(std::string_view origin,
std::string_view part) { … }
bool RuleParser::ParseUrlRuleOptions(std::string_view origin,
std::string_view options) { … }
RuleType RuleParser::ParseCssRule(std::string_view origin,
std::string_view part,
size_t css_section_start) { … }
void RuleParser::SetParseError(ParseError::ErrorCode code,
std::string_view origin,
const char* error_begin) { … }
std::ostream& operator<<(std::ostream& out,
const RuleParser::ParseError& error) { … }
}