Fixes string not checking if it ends with a quotation mark
This commit is contained in:
parent
8f91b7f550
commit
2111f4080c
|
@ -34,6 +34,11 @@ namespace Upsilon
|
|||
{
|
||||
LogError($"Invalid character found. Expected: '{expectedToken}'", location);
|
||||
}
|
||||
public void LogBadCharacter(TextSpan location, char expected, char actual)
|
||||
{
|
||||
LogError($"Invalid character found. Expected: '{expected}', Got: '{actual}'", location);
|
||||
}
|
||||
|
||||
public void LogBadCharacter(TextSpan location)
|
||||
{
|
||||
LogError($"Invalid character found.", location);
|
||||
|
|
|
@ -151,6 +151,11 @@ namespace Upsilon.Parser
|
|||
sb.Append(Current);
|
||||
}
|
||||
|
||||
if (Current != '"')
|
||||
{
|
||||
_diagnostics.LogBadCharacter(new TextSpan(_position, 1), '"', Current);
|
||||
}
|
||||
|
||||
var res = sb.ToString();
|
||||
return new SyntaxToken(SyntaxKind.String, start, $"\"{res}\"", res);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue