Orcus
Loading...
Searching...
No Matches
parser_global.hpp
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 */
7
8#ifndef ORCUS_PARSER_GLOBAL_HPP
9#define ORCUS_PARSER_GLOBAL_HPP
10
11#include "env.hpp"
12
13#include <sstream>
14
15namespace orcus {
16
17class cell_buffer;
18
22enum class string_escape_char_t
23{
24 invalid,
26 regular_char,
28 control_char,
30 unicode,
31};
32
40{
41 static constexpr std::size_t error_no_closing_quote = 1;
42 static constexpr std::size_t error_illegal_escape_char = 2;
43 static constexpr std::size_t error_invalid_hex_digits = 3;
44
45 const char* str;
46 std::size_t length;
47
59
65};
66
67ORCUS_PSR_DLLPUBLIC bool is_blank(char c);
68ORCUS_PSR_DLLPUBLIC bool is_alpha(char c);
69ORCUS_PSR_DLLPUBLIC bool is_numeric(char c);
70
81ORCUS_PSR_DLLPUBLIC bool is_in(char c, std::string_view allowed);
82
92ORCUS_PSR_DLLPUBLIC const char* parse_numeric(const char* p, const char* p_end, double& value);
93
106ORCUS_PSR_DLLPUBLIC const char* parse_integer(const char* p, const char* p_end, long& value);
107
111ORCUS_PSR_DLLPUBLIC parse_quoted_string_state parse_single_quoted_string(
112 const char*& p, std::size_t max_length, cell_buffer& buffer);
113
125ORCUS_PSR_DLLPUBLIC const char* parse_to_closing_single_quote(
126 const char* p, std::size_t max_length);
127
128ORCUS_PSR_DLLPUBLIC parse_quoted_string_state parse_double_quoted_string(
129 const char*& p, std::size_t max_length, cell_buffer& buffer);
130
142ORCUS_PSR_DLLPUBLIC const char* parse_to_closing_double_quote(
143 const char* p, std::size_t max_length);
144
154ORCUS_PSR_DLLPUBLIC string_escape_char_t get_string_escape_char_type(char c);
155
156ORCUS_PSR_DLLPUBLIC std::string_view trim(std::string_view str);
157
158}
159
160#endif
161/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition cell_buffer.hpp:22
Definition parser_global.hpp:40
bool has_control_character
Definition parser_global.hpp:64
bool transient
Definition parser_global.hpp:58