1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef INCLUDED_CSS_PARSER_BASE_HPP
#define INCLUDED_CSS_PARSER_BASE_HPP
#include "orcus/env.hpp"
#include "orcus/css_types.hpp"
#include "orcus/exception.hpp"
#include "orcus/parser_base.hpp"
#include <string>
#include <exception>
namespace orcus { namespace css {
class ORCUS_PSR_DLLPUBLIC parser_base : public ::orcus::parser_base
{
public:
parser_base(std::string_view content);
protected:
void identifier(const char*& p, size_t& len, std::string_view extra = std::string_view{});
uint8_t parse_uint8();
/**
* Parse an unquoted property value until one of non-value characters is
* reached.
*
* @return parsed value segment.
*/
std::string_view parse_value();
double parse_percent();
double parse_double_or_throw();
void literal(const char*& p, size_t& len, char quote);
void skip_to(const char*& p, size_t& len, char c);
/**
* Skip until one of specified characters or a blank character is reached.
*
* @param p pointer to the first character of the skipped character array.
* @param len length of the skipped character array.
* @param chars one or more characters that can end the skipping.
*/
void skip_to_or_blank(const char*& p, size_t& len, std::string_view chars);
void skip_blanks();
void skip_blanks_reverse();
void shrink_stream();
bool skip_comment();
void comment();
void skip_comments_and_blanks();
void set_combinator(char c, css::combinator_t combinator);
void reset_before_block();
protected:
size_t m_simple_selector_count;
combinator_t m_combinator;
};
}}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|