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); return (Value != null ? Value.GetHashCode() : 0);
} }
public bool Equals(LuaString s) private bool Equals(LuaString s)
{ {
if (s == null) return false; return s != null && string.Equals(s.Value, Value);
return string.Equals(s.Value, Value);
} }
public static LuaString operator +(LuaString a, LuaType b) public static LuaString operator +(LuaString a, LuaType b)

View File

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