Fix issues with identifier spans

This commit is contained in:
Deukhoofd committed 2019-01-17 17:33:53 +01:00
1 parent 1e7fc7629e
commit d341318989
3 files changed
+2 -16

No files matched your search

+1 -1
View File
@@ -250,7 +250,7 @@ namespace Upsilon.Parser
var str = stringBuilder.ToString();
if (kind == SyntaxKind.Identifier)
{
return new IdentifierToken(str, new TextSpan(startLine, start, _linePosition, _position));
return new IdentifierToken(str, new TextSpan(startLine, start, _linePosition, _position + 1));
}
if (kind == SyntaxKind.ReturnKeyword)
+1
View File
@@ -17,6 +17,7 @@ namespace Upsilon.Text
if (startPosition < 0) startPosition = 0;
if (startLine == endLine)
{
if (endPosition > _text[startLine].Length) endPosition = _text[startLine].Length;
return _text[startLine].Substring(startPosition, endPosition - startPosition);
}
var sb = new StringBuilder();
-15
View File
@@ -1,15 +0,0 @@
namespace Upsilon.Text
{
public struct SourceTextLine
{
public SourceTextLine(int start, int lineLength)
{
Start = start;
LineLength = lineLength;
}
public int Start { get; }
public int LineLength { get; }
public int End => Start + LineLength;
}
}