A11 (C++ runtime)
Native C++ implementation of the A11 streaming action runtime
Loading...
Searching...
No Matches
escape.h
Go to the documentation of this file.
1// Copyright 2026 The A11 Authors
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#ifndef A11_FLOW_ESCAPE_H_
16#define A11_FLOW_ESCAPE_H_
17
18#include <cstddef>
19#include <optional>
20#include <string>
21#include <string_view>
22
23namespace a11::flow {
24
26
29 size_t start;
30 size_t end;
31 std::string message;
32};
33
35 std::string value;
36 std::optional<EscapeFailure> failure;
37};
38
40EscapeResult DecodeLiteralBody(std::string_view body, bool bytes, bool raw);
41
43size_t EscapeWidth(std::string_view body, size_t at);
44
46std::string EscapeLiteralBody(std::string_view value, bool bytes);
47
48} // namespace a11::flow
49
50#endif // A11_FLOW_ESCAPE_H_
Definition casefold.cc:28
EscapeResult DecodeLiteralBody(std::string_view body, bool bytes, bool raw)
Decode the body of a Flow literal. Text results must be valid UTF-8.
Definition escape.cc:80
size_t EscapeWidth(std::string_view body, size_t at)
A complete source escape's width, including its backslash.
Definition escape.cc:56
std::string EscapeLiteralBody(std::string_view value, bool bytes)
An ASCII literal body safe between either kind of Flow quotes.
Definition escape.cc:204
EscapeProblem
Definition escape.h:25
@ kMalformed
Definition escape.h:25
@ kInvalidUtf8
Definition escape.h:25
@ kNonAsciiByte
Definition escape.h:25
Definition escape.h:27
std::string message
Definition escape.h:31
EscapeProblem problem
Definition escape.h:28
size_t end
Definition escape.h:30
size_t start
Definition escape.h:29
Definition escape.h:34
std::string value
Definition escape.h:35
std::optional< EscapeFailure > failure
Definition escape.h:36