Skip to content

Commit ca01548

Browse files
committed
Added validation to JSON lexer for string literals.
1 parent 5bd9603 commit ca01548

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Pasper.Json/Parsing/JsonLexer.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,9 @@ private bool TryGetStringToken([NotNullWhen(true)] out IToken? token)
122122
var isProperty = Previous is BeginObjectToken or EndValueToken;
123123
token = isProperty
124124
? new PropertyNameToken(value)
125-
: new LiteralStringToken(value);
125+
: Previous is EndNameToken
126+
? new LiteralStringToken(value)
127+
: throw new UnexpectedTokenException(_lineNumber, _columnNumber, value);
126128

127129
_currentIndex = endIndex + 1;
128130
return true;

0 commit comments

Comments
 (0)