Skip to content

Commit

Permalink
Renamed token types.
Browse files Browse the repository at this point in the history
  • Loading branch information
tacosontitan committed Mar 30, 2024
1 parent 3ab36c8 commit 663f613
Show file tree
Hide file tree
Showing 23 changed files with 37 additions and 37 deletions.
8 changes: 4 additions & 4 deletions src/Pasper.Json/Parsing/JsonLexer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ private bool TryGetNextToken([NotNullWhen(true)] out IToken? token)
var currentCharacter = json[_currentIndex];
token = currentCharacter switch
{
'{' => new BeginObject(),
'}' => new EndObject(),
'[' => new BeginArray(),
']' => new EndArray(),
'{' => new BeginObjectToken(),
'}' => new EndObjectToken(),
'[' => new BeginArrayToken(),
']' => new EndArrayToken(),
_ => null
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Pasper.Json.Tokens;
/// <remarks>
/// This token is represented by the character <c>[</c>.
/// </remarks>
public sealed class BeginArray()
public sealed class BeginArrayToken()
: IToken
{
/// <inheritdoc/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Pasper.Json.Tokens;
/// <remarks>
/// This token is represented by the character <c>{</c>.
/// </remarks>
public sealed class BeginObject
public sealed class BeginObjectToken
: IToken
{
/// <inheritdoc/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Pasper.Json.Tokens;
/// Represents a token containing a comment.
/// </summary>
/// <param name="value">The value of the comment.</param>
public sealed class Comment(string value)
public sealed class CommentToken(string value)
: IToken
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Pasper.Json.Tokens;
/// <remarks>
/// This token is represented by the character <c>]</c>.
/// </remarks>
public sealed class EndArray
public sealed class EndArrayToken
: IToken
{
/// <inheritdoc/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Pasper.Json.Tokens;
/// <remarks>
/// This token is represented by the character <c>}</c>.
/// </remarks>
public sealed class EndObject
public sealed class EndObjectToken
: IToken
{
/// <inheritdoc/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Pasper.Json.Tokens;
/// <summary>
/// Represents a token containing the literal value <c>false</c>.
/// </summary>
public sealed class FalseLiteral
public sealed class LiteralFalseToken
: IToken
{
/// <inheritdoc/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Pasper.Json.Tokens;
/// <summary>
/// Represents a token that indicates the literal value <c>null</c>.
/// </summary>
public sealed class NullLiteral
public sealed class LiteralNullToken
: IToken
{
/// <inheritdoc/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Pasper.Json.Tokens;
/// <summary>
/// Represents a token containing a number.
/// </summary>
public sealed class NumberLiteral(string value)
public sealed class LiteralNumberToken(string value)
: IToken
{
/// <inheritdoc/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Pasper.Json.Tokens;
/// <summary>
/// Represents a token containing a value.
/// </summary>
public sealed class StringLiteral(string value)
public sealed class LiteralStringToken(string value)
: IToken
{
/// <inheritdoc/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Pasper.Json.Tokens;
/// <summary>
/// Represents a token that indicates the literal value <c>true</c>.
/// </summary>
public sealed class TrueLiteral
public sealed class LiteralTrueToken
: IToken
{
/// <inheritdoc/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Pasper.Json.Tokens;
/// <summary>
/// Represents a token containing a key.
/// </summary>
public sealed class PropertyName(string key)
public sealed class PropertyNameToken(string key)
: IToken
{
/// <inheritdoc/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

namespace Pasper.Json.Tests.Tokens;

public sealed class BeginArrayTests
public sealed class BeginArrayTokenTests
{
[Fact]
public void Value_ShouldBeOpenBracket()
{
const string expected = "[";
var token = new BeginArray();
var token = new BeginArrayToken();
Assert.Equal(expected, token.Value);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

namespace Pasper.Json.Tests.Tokens;

public class BeginObjectTests
public class BeginObjectTokenTests
{
[Fact]
public void Value_ShouldBeOpenBrace()
{
const string expected = "{";
var token = new BeginObject();
var token = new BeginObjectToken();
Assert.Equal(expected, token.Value);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

namespace Pasper.Json.Tests.Tokens;

public class CommentTests
public class CommentTokenTests
{
[Fact]
public void Value_ShouldBeSlashSlash()
{
const string expected = "abc";
var token = new Comment(expected);
var token = new CommentToken(expected);
Assert.Equal(expected, token.Value);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

namespace Pasper.Json.Tests.Tokens;

public class EndArrayTests
public class EndArrayTokenTests
{
[Fact]
public void Value_ShouldBeCloseBracket()
{
const string expected = "]";
var token = new EndArray();
var token = new EndArrayToken();
Assert.Equal(expected, token.Value);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

namespace Pasper.Json.Tests.Tokens;

public class EndObjectTests
public class EndObjectTokenTests
{
[Fact]
public void Value_ShouldBeCloseBrace()
{
const string expected = "}";
var token = new EndObject();
var token = new EndObjectToken();
Assert.Equal(expected, token.Value);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

namespace Pasper.Json.Tests.Tokens;

public class FalseLiteralTests
public class LiteralFalseTokenTests
{
[Fact]
public void Value_ShouldBeFalse()
{
const string expected = "false";
var token = new FalseLiteral();
var token = new LiteralFalseToken();
Assert.Equal(expected, token.Value);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

namespace Pasper.Json.Tests.Tokens;

public class NullLiteralTests
public class LiteralNullTokenTests
{
[Fact]
public void Value_ShouldBeNull()
{
const string expected = "null";
var token = new NullLiteral();
var token = new LiteralNullToken();
Assert.Equal(expected, token.Value);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

namespace Pasper.Json.Tests.Tokens;

public class NumberLiteralTests
public class LiteralNumberTokenTests
{
[Fact]
public void Value_ShouldBeNumber()
{
const string expected = "123";
var token = new NumberLiteral("123");
var token = new LiteralNumberToken("123");
Assert.Equal(expected, token.Value);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

namespace Pasper.Json.Tests.Tokens;

public class StringLiteralTests
public class LiteralStringTokenTests
{
[Fact]
public void Value_ShouldBeValue()
{
const string expected = "abc";
var token = new StringLiteral(expected);
var token = new LiteralStringToken(expected);
Assert.Equal(expected, token.Value);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

namespace Pasper.Json.Tests.Tokens;

public class TrueLiteralTests
public class LiteralTrueTokenTests
{
[Fact]
public void Value_ShouldBeTrue()
{
const string expected = "true";
var token = new TrueLiteral();
var token = new LiteralTrueToken();
Assert.Equal(expected, token.Value);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

namespace Pasper.Json.Tests.Tokens;

public class PropertyNameTests
public class PropertyNameTokenTests
{
[Fact]
public void Value_ShouldBeKey()
{
const string expected = "key";
var token = new PropertyName(expected);
var token = new PropertyNameToken(expected);
Assert.Equal(expected, token.Value);
}
}

0 comments on commit 663f613

Please sign in to comment.