blob: 0dbcb92b7b9f2a6294b4351dd2eba5bae719a238 (
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
|
/***************************************************************************************************
Copyright (C) 2024 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");
}
}
}
|