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
15namespace orcus {
16
17class cell_buffer;
18
19enum 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};
52
53ORCUS_PSR_DLLPUBLIC bool is_blank(char c);
54ORCUS_PSR_DLLPUBLIC bool is_alpha(char c);
55ORCUS_PSR_DLLPUBLIC bool is_name_char(char c);
56ORCUS_PSR_DLLPUBLIC bool is_numeric(char c);
57
69ORCUS_PSR_DLLPUBLIC bool is_in(char c, const char* allowed, size_t n_allowed);
70
71ORCUS_PSR_DLLPUBLIC void write_to(std::ostringstream& os, const char* p, size_t n);
72
73ORCUS_PSR_DLLPUBLIC double parse_numeric(const char*& p, size_t max_length);
74
75ORCUS_PSR_DLLPUBLIC long parse_integer(const char*& p, size_t max_length);
76
80ORCUS_PSR_DLLPUBLIC parse_quoted_string_state parse_single_quoted_string(
81 const char*& p, size_t max_length, cell_buffer& buffer);
82
94ORCUS_PSR_DLLPUBLIC const char* parse_to_closing_single_quote(
95 const char* p, size_t max_length);
96
97ORCUS_PSR_DLLPUBLIC parse_quoted_string_state parse_double_quoted_string(
98 const char*& p, size_t max_length, cell_buffer& buffer);
99
111ORCUS_PSR_DLLPUBLIC const char* parse_to_closing_double_quote(
112 const char* p, size_t max_length);
113
123ORCUS_PSR_DLLPUBLIC string_escape_char_t get_string_escape_char_type(char c);
124
134ORCUS_PSR_DLLPUBLIC double clip(double input, double low, double high);
135
136}
137
138#endif
139/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition: cell_buffer.hpp:22
Definition: parser_global.hpp:33