Added Token.Is<T>(..)

master
Harald Wolff 2020-11-24 23:27:10 +01:00
parent f6cc23d668
commit 3edeafc8cd
3 changed files with 12 additions and 3 deletions

View File

@ -57,7 +57,13 @@ namespace ln.parse.tests
[Test]
public void Test_0_Primitives()
public void Test_00_Token()
{
Assert.Pass();
}
[Test]
public void Test_10_Primitives()
{
foreach (KeyValuePair<string,Type> primTest in primitiveTests)
{
@ -81,7 +87,7 @@ namespace ln.parse.tests
string complexSource = null;
[Test]
public void Test_1_Complex()
public void Test_20_Complex()
{
using (StreamReader sr = new StreamReader("complex.txt"))
{

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<Version>0.0.4</Version>
<Version>0.0.5</Version>
<Authors>Harald Wolff-Thobaben</Authors>
<Company>l--n.de</Company>
</PropertyGroup>

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Text;
namespace ln.parse.tokenizer
@ -31,6 +32,8 @@ namespace ln.parse.tokenizer
public virtual object NativeValue { get; }
public bool Is<T>(String value) => (this is T) && Value.Equals(value);
public class IntegerToken : Token
{
public IntegerToken(SourceBuffer sourceBuffer, int start, int length, string value) : base(sourceBuffer, start, length, value) { }