Skip to content

Commit 77c8908

Browse files
committed
Added a SyntaxTokenFactory in preparation for the token redesign.
1 parent f630631 commit 77c8908

File tree

2 files changed

+79
-0
lines changed

2 files changed

+79
-0
lines changed

Common/Common.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
<Reference Include="System.Xml" />
4949
</ItemGroup>
5050
<ItemGroup>
51+
<Compile Include="Grammar\SyntaxTokenFactory.cs" />
5152
<Compile Include="Syntax\ISyntaxHighlightingGuide.cs" />
5253
<Compile Include="Extensions\TokenInterfaceExtensionMethods.cs" />
5354
<Compile Include="Grammar\Place.cs" />
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
#region BSD 3-Clause License
2+
// <copyright file="SyntaxTokenFactory.cs" company="Edgerunner.org">
3+
// Copyright 2022 Thaddeus Ryker
4+
// </copyright>
5+
//
6+
// BSD 3-Clause License
7+
//
8+
// Copyright (c) 2022, Thaddeus Ryker
9+
// All rights reserved.
10+
//
11+
// Redistribution and use in source and binary forms, with or without
12+
// modification, are permitted provided that the following conditions are met:
13+
//
14+
// 1. Redistributions of source code must retain the above copyright notice, this
15+
// list of conditions and the following disclaimer.
16+
//
17+
// 2. Redistributions in binary form must reproduce the above copyright notice,
18+
// this list of conditions and the following disclaimer in the documentation
19+
// and/or other materials provided with the distribution.
20+
//
21+
// 3. Neither the name of the copyright holder nor the names of its
22+
// contributors may be used to endorse or promote products derived from
23+
// this software without specific prior written permission.
24+
//
25+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26+
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27+
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
28+
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
29+
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30+
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
31+
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32+
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
33+
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35+
#endregion
36+
37+
using System;
38+
39+
using Antlr4.Runtime;
40+
41+
// ReSharper disable TooManyArguments
42+
namespace Org.Edgerunner.ANTLR4.Tools.Common.Grammar
43+
{
44+
/// <summary>
45+
/// Class responsible for creating a <see cref="SyntaxToken"/>.
46+
/// Implements the <see cref="Antlr4.Runtime.ITokenFactory" />
47+
/// </summary>
48+
/// <seealso cref="Antlr4.Runtime.ITokenFactory" />
49+
public class SyntaxTokenFactory : ITokenFactory
50+
{
51+
IToken ITokenFactory.Create(Tuple<ITokenSource, ICharStream> source, int type, string text, int channel, int start, int stop, int line, int charPositionInLine)
52+
{
53+
throw new NotImplementedException();
54+
}
55+
56+
IToken ITokenFactory.Create(int type, string text)
57+
{
58+
throw new NotImplementedException();
59+
}
60+
61+
/// <summary>
62+
/// Creates the specified source.
63+
/// </summary>
64+
/// <param name="source">The source of the token.</param>
65+
/// <param name="type">The token type.</param>
66+
/// <param name="text">The token text.</param>
67+
/// <param name="channel">The token channel.</param>
68+
/// <param name="start">The token start.</param>
69+
/// <param name="stop">The token stop.</param>
70+
/// <param name="line">The token line.</param>
71+
/// <param name="charPositionInLine">The character position in line.</param>
72+
/// <returns>A new SyntaxToken instance.</returns>
73+
public SyntaxToken Create(Tuple<ITokenSource, ICharStream> source, int type, string text, int channel, int start, int stop, int line, int charPositionInLine)
74+
{
75+
throw new NotImplementedException();
76+
}
77+
}
78+
}

0 commit comments

Comments
 (0)