Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
123 lines (106 loc) · 3.47 KB

File metadata and controls

123 lines (106 loc) · 3.47 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
#include "ParserPch.h"
#if ENABLE_REGEX_CONFIG_OPTIONS
namespace UnifiedRegex
{
const char16* const DebugWriter::hex = _u("0123456789abcdef");
DebugWriter::DebugWriter() : indent(0), nlPending(false)
{
}
#define PRINT_DEBUG_WRITER() \
va_list argptr; \
va_start(argptr, form); \
int len = _vsnwprintf_s(buf, bufLen, _TRUNCATE, form, argptr); \
if (len < 0 || len >= bufLen - 1) \
Output::Print(_u("<not enough buffer space to format>")); \
else \
{ \
if (len > 0) \
CheckForNewline(); \
Output::Print(_u("%s"), buf); \
} \
va_end(argptr)
void __cdecl DebugWriter::Print(const Char *form, ...)
{
PRINT_DEBUG_WRITER();
}
void __cdecl DebugWriter::PrintEOL(const Char *form, ...)
{
PRINT_DEBUG_WRITER();
EOL();
}
void DebugWriter::PrintEscapedString(const Char* str, CharCount len)
{
Assert(str != 0);
CheckForNewline();
const Char* pl = str + len;
for (const Char* p = str; p < pl; p++)
{
if (*p == '"')
Output::Print(_u("\\\""));
else
PrintEscapedChar(*p);
}
}
void DebugWriter::PrintQuotedString(const Char* str, CharCount len)
{
CheckForNewline();
if (str == 0)
Output::Print(_u("null"));
else
{
Output::Print(_u("\""));
PrintEscapedString(str, len);
Output::Print(_u("\""));
}
}
void DebugWriter::PrintEscapedChar(const Char c)
{
CheckForNewline();
if (c > 0xff)
Output::Print(_u("\\u%lc%lc%lc%lc"), hex[c >> 12], hex[(c >> 8) & 0xf], hex[(c >> 4) & 0xf], hex[c & 0xf]);
else if (c == '-')
Output::Print(_u("\\x2d"));
else if (c < ' ' || c > '~')
Output::Print(_u("\\x%lc%lc"), hex[c >> 4], hex[c & 0xf]);
else
Output::Print(_u("%lc"), c);
}
void DebugWriter::PrintQuotedChar(const Char c)
{
CheckForNewline();
Output::Print(_u("'"));
if (c == '\'')
Output::Print(_u("\\'"));
else
PrintEscapedChar(c);
Output::Print(_u("'"));
}
void DebugWriter::EOL()
{
CheckForNewline();
nlPending = true;
}
void DebugWriter::Indent()
{
indent++;
}
void DebugWriter::Unindent()
{
indent--;
}
void DebugWriter::Flush()
{
Output::Print(_u("\n"));
Output::Flush();
nlPending = false;
}
void DebugWriter::BeginLine()
{
Output::Print(_u("\n%*s"), indent * 4, _u(""));
}
}
#endif
Morty Proxy This is a proxified and sanitized view of the page, visit original site.