diff --git a/Upsilon/Parser/Lexer.cs b/Upsilon/Parser/Lexer.cs index 22b65fe..03d6050 100644 --- a/Upsilon/Parser/Lexer.cs +++ b/Upsilon/Parser/Lexer.cs @@ -107,7 +107,8 @@ namespace Upsilon.Parser case '^': return new SyntaxToken(SyntaxKind.RoofSign, _position, "^", null); case '"': - return LexString(); + case '\'': + return LexString(Current); case '=': if (Next == '=') { @@ -174,26 +175,26 @@ namespace Upsilon.Parser return new SyntaxToken(SyntaxKind.Number, start, numStr.ToString(), o); } - private SyntaxToken LexString() + private SyntaxToken LexString(char current) { var start = _position; var sb = new StringBuilder(); while (_position < _text.Length) { _position++; - if (Current == '\\' && Next == '"') + if (Current == '\\' && Next == current) { - sb.Append("\""); + sb.Append(current); _position += 2; } - if (Current == '"') + if (Current == current) break; sb.Append(Current); } - if (Current != '"') + if (Current != current) { - _diagnostics.LogBadCharacter(new TextSpan(_position, 1), '"', Current); + _diagnostics.LogBadCharacter(new TextSpan(_position, 1), current, Current); } var res = sb.ToString();