blob: be89e6520161458b0648ace665ae121613a4869e (
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
|
// Copyright (C) 2025 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace QtVsTools.Test.RegExpr
{
using static SyntaxAnalysis.RegExpr;
[TestClass]
public class Test_SubTokens
{
[TestMethod]
public void TestManyToMany()
{
var tokenA = new Token("A", "a");
var tokenB = new Token("B", "b" & tokenA);
var tokenC = new Token("C", "c" & tokenB);
var tokenX = new Token("X", (tokenA | tokenB | tokenC).Repeat());
var parser = tokenX.Render();
parser.Parse("abacba");
}
[TestMethod]
public void TestLookAhead()
{
var tokenA = new Token("A", "a");
var tokenB = new Token("B", "b" & !LookAhead[tokenA] & AnyChar);
var tokenX = new Token("X", (tokenA | tokenB).Repeat());
var parser = tokenX.Render();
parser.Parse("abc");
}
}
}
|