Orcus
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 
15 namespace orcus {
16 
17 class cell_buffer;
18 
19 enum class string_escape_char_t
20 {
21  invalid,
22  valid,
23  control_char
24 };
25 
33 {
34  ORCUS_PSR_DLLPUBLIC static const size_t error_no_closing_quote;
35  ORCUS_PSR_DLLPUBLIC static const size_t error_illegal_escape_char;
36 
37  const char* str;
38  size_t length;
39 
50  bool transient;
51 
57 };
58 
59 ORCUS_PSR_DLLPUBLIC bool is_blank(char c);
60 ORCUS_PSR_DLLPUBLIC bool is_alpha(char c);
61 ORCUS_PSR_DLLPUBLIC bool is_numeric(char c);
62 
73 ORCUS_PSR_DLLPUBLIC bool is_in(char c, std::string_view allowed);
74 
75 ORCUS_PSR_DLLPUBLIC double parse_numeric(const char*& p, size_t max_length);
76 
77 ORCUS_PSR_DLLPUBLIC long parse_integer(const char*& p, size_t max_length);
78 
82 ORCUS_PSR_DLLPUBLIC parse_quoted_string_state parse_single_quoted_string(
83  const char*& p, size_t max_length, cell_buffer& buffer);
84 
96 ORCUS_PSR_DLLPUBLIC const char* parse_to_closing_single_quote(
97  const char* p, size_t max_length);
98 
99 ORCUS_PSR_DLLPUBLIC parse_quoted_string_state parse_double_quoted_string(
100  const char*& p, size_t max_length, cell_buffer& buffer);
101 
113 ORCUS_PSR_DLLPUBLIC const char* parse_to_closing_double_quote(
114  const char* p, size_t max_length);
115 
125 ORCUS_PSR_DLLPUBLIC string_escape_char_t get_string_escape_char_type(char c);
126 
127 ORCUS_PSR_DLLPUBLIC std::string_view trim(std::string_view str);
128 
129 }
130 
131 #endif
132 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition: cell_buffer.hpp:22
Definition: parser_global.hpp:33
bool has_control_character
Definition: parser_global.hpp:56