Fix issues with identifier spans
This commit is contained in:
parent
1e7fc7629e
commit
d341318989
|
@ -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)
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue