blob: 8a0931018d1875fcc97252650a32acd47acaa426 (
plain)
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
|
// Copyright (C) 2025 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
namespace QtVsTools.SyntaxAnalysis
{
using static CharClass;
public abstract partial class RegExpr
{
/// <summary><![CDATA[
/// Equivalent to: [\w]
/// ]]></summary>
public static CharClassLiteral CharWord => new() { LiteralChars = @"\w" };
/// <summary><![CDATA[
/// Equivalent to: [\w]*
/// ]]></summary>
public static RegExpr Word => CharWord.Repeat();
/// <summary><![CDATA[
/// Equivalent to: [\b]
/// ]]></summary>
public static RegExprLiteral WordBoundary => new() { LiteralExpr = @"\b" };
/// <summary><![CDATA[
/// Equivalent to: [\d]
/// ]]></summary>
public static CharClassLiteral CharDigit => new() { LiteralChars = @"\d" };
/// <summary><![CDATA[
/// Equivalent to: [\d]*
/// ]]></summary>
public static RegExpr Number => CharDigit.Repeat();
/// <summary><![CDATA[
/// Equivalent to: [\r]
/// ]]></summary>
public static CharClassLiteral CharCr => new() { LiteralChars = @"\r" };
/// <summary><![CDATA[
/// Equivalent to: [\n]
/// ]]></summary>
public static CharClassLiteral CharLf => new() { LiteralChars = @"\n" };
/// <summary><![CDATA[
/// Equivalent to: [\s]
/// ]]></summary>
public static CharClassLiteral CharSpace => new() { LiteralChars = @"\s" };
/// <summary><![CDATA[
/// Equivalent to: [\S]
/// ]]></summary>
private static CharClassLiteral CharNonSpace => new() { LiteralChars = @"\S" };
/// <summary><![CDATA[
/// Equivalent to: [\r\n]
/// ]]></summary>
public static CharClassSet CharVertSpace => CharSet[CharCr + CharLf];
/// <summary><![CDATA[
/// Equivalent to: [^\S\r\n]
/// ]]></summary>
public static CharClassSet CharHorizSpace => CharSet[~(CharNonSpace + CharVertSpace)];
/// <summary><![CDATA[
/// Equivalent to: .
/// ]]></summary>
public static RegExprLiteral AnyChar => new() { LiteralExpr = "." };
/// <summary><![CDATA[
/// Equivalent to: ^
/// ]]></summary>
public static RegExprLiteral StartOfLine => new() { LiteralExpr = "^" };
/// <summary><![CDATA[
/// Equivalent to: $
/// ]]></summary>
public static RegExprLiteral EndOfLine => new() { LiteralExpr = "$" };
/// <summary><![CDATA[
/// Equivalent to: \A
/// ]]></summary>
public static RegExprLiteral StartOfFile => new() { LiteralExpr = @"\A" };
/// <summary><![CDATA[
/// Equivalent to: \z
/// ]]></summary>
public static RegExprLiteral EndOfFile => new() { LiteralExpr = @"\z" };
/// <summary><![CDATA[
/// Equivalent to: \r?\n
/// ]]></summary>
public static RegExprSequence LineBreak => CharCr.Optional() & CharLf;
/// <summary><![CDATA[
/// Equivalent to: [\s]*
/// ]]></summary>
public static RegExpr Space => CharSpace.Repeat();
/// <summary><![CDATA[
/// Equivalent to: [\S]*
/// ]]></summary>
public static RegExpr NonSpace => CharNonSpace.Repeat();
/// <summary><![CDATA[
/// Equivalent to: [\r\n]*
/// ]]></summary>
public static RegExpr VertSpace => CharVertSpace.Repeat();
/// <summary><![CDATA[
/// Equivalent to: [^\S\r\n]*
/// ]]></summary>
public static RegExpr HorizSpace => CharHorizSpace.Repeat();
/// <summary><![CDATA[
/// Equivalent to: [^\r\n]*
/// ]]></summary>
public static RegExpr Line => CharSet[~CharVertSpace].Repeat();
/// <summary><![CDATA[
/// Equivalent to: (?i)
/// ]]></summary>
public static RegExprLiteral CaseInsensitive => new() { LiteralExpr = @"(?i)" };
/// <summary><![CDATA[
/// Equivalent to: (?-i)
/// ]]></summary>
public static RegExprLiteral CaseSensitive => new() { LiteralExpr = @"(?-i)" };
/// <summary>
/// Applies the same whitespace skipping rules as tokens, but does not capture any text.
/// </summary>
public static RegExpr SkipWs => new Token();
public static CharExprBuilder Char { get; } = new();
public static CharExprBuilder Chars => Char;
public static CharSetExprBuilder CharSet { get; } = new();
public static CharSetRawExprBuilder CharSetRaw { get; } = new();
public static AssertExprBuilder LookAhead { get; } = new(AssertLookAhead);
public static AssertExprBuilder LookBehind { get; } = new(AssertLookBehind);
public const SkipWhitespace SkipWs_Disable = SkipWhitespace.Disable;
}
}
|