Fix error when character after string end

This commit is contained in:
Deukhoofd 2018-11-17 16:10:04 +01:00
parent 2baf2b223e
commit 46308557c8
No known key found for this signature in database
GPG Key ID: B4C087AC81641654
2 changed files with 3 additions and 6 deletions

View File

@ -31,10 +31,9 @@ namespace Upsilon.BaseTypes
return (Value != null ? Value.GetHashCode() : 0);
}
public bool Equals(LuaString s)
private bool Equals(LuaString s)
{
if (s == null) return false;
return string.Equals(s.Value, Value);
return s != null && string.Equals(s.Value, Value);
}
public static LuaString operator +(LuaString a, LuaType b)

View File

@ -141,7 +141,7 @@ namespace Upsilon.Parser
{
var start = _position;
var sb = new StringBuilder();
while (true)
while (_position < _text.Length)
{
_position++;
if (Current == '"')
@ -149,8 +149,6 @@ namespace Upsilon.Parser
sb.Append(Current);
}
_position++;
var res = sb.ToString();
return new SyntaxToken(SyntaxKind.String, start, $"\"{res}\"", res);
}