Remove double file name
This commit is contained in:
@@ -55,16 +55,16 @@ public enum Symbol
|
||||
At,
|
||||
}
|
||||
|
||||
public abstract record Token(string FileName, SourceSpan Span);
|
||||
public abstract record Token(SourceSpan Span);
|
||||
|
||||
public record IdentifierToken(string FileName, SourceSpan Span, string Value) : Token(FileName, Span);
|
||||
public record IdentifierToken(SourceSpan Span, string Value) : Token(Span);
|
||||
|
||||
public record IntLiteralToken(string FileName, SourceSpan Span, string Value, int Base) : Token(FileName, Span);
|
||||
public record IntLiteralToken(SourceSpan Span, string Value, int Base) : Token(Span);
|
||||
|
||||
public record StringLiteralToken(string FileName, SourceSpan Span, string Value) : Token(FileName, Span);
|
||||
public record StringLiteralToken(SourceSpan Span, string Value) : Token(Span);
|
||||
|
||||
public record BoolLiteralToken(string FileName, SourceSpan Span, bool Value) : Token(FileName, Span);
|
||||
public record BoolLiteralToken(SourceSpan Span, bool Value) : Token(Span);
|
||||
|
||||
public record FloatLiteralToken(string FileName, SourceSpan Span, string Value) : Token(FileName, Span);
|
||||
public record FloatLiteralToken(SourceSpan Span, string Value) : Token(Span);
|
||||
|
||||
public record SymbolToken(string FileName, SourceSpan Span, Symbol Symbol) : Token(FileName, Span);
|
||||
public record SymbolToken(SourceSpan Span, Symbol Symbol) : Token(Span);
|
||||
@@ -142,15 +142,15 @@ public sealed class Tokenizer
|
||||
|
||||
if (Keywords.TryGetValue(buffer, out var keywordSymbol))
|
||||
{
|
||||
return new SymbolToken(_fileName, CreateSpan(lineStart, columnStart), keywordSymbol);
|
||||
return new SymbolToken(CreateSpan(lineStart, columnStart), keywordSymbol);
|
||||
}
|
||||
|
||||
if (buffer is "true" or "false")
|
||||
{
|
||||
return new BoolLiteralToken(_fileName, CreateSpan(lineStart, columnStart), Convert.ToBoolean(buffer));
|
||||
return new BoolLiteralToken(CreateSpan(lineStart, columnStart), Convert.ToBoolean(buffer));
|
||||
}
|
||||
|
||||
return new IdentifierToken(_fileName, CreateSpan(lineStart, columnStart), buffer);
|
||||
return new IdentifierToken(CreateSpan(lineStart, columnStart), buffer);
|
||||
}
|
||||
|
||||
if (char.IsDigit(current))
|
||||
@@ -176,7 +176,7 @@ public sealed class Tokenizer
|
||||
.Build());
|
||||
}
|
||||
|
||||
return new IntLiteralToken(_fileName, CreateSpan(lineStart, columnStart), buffer, 16);
|
||||
return new IntLiteralToken(CreateSpan(lineStart, columnStart), buffer, 16);
|
||||
}
|
||||
|
||||
if (current == '0' && Peek(1) is 'b')
|
||||
@@ -198,7 +198,7 @@ public sealed class Tokenizer
|
||||
.Build());
|
||||
}
|
||||
|
||||
return new IntLiteralToken(_fileName, CreateSpan(lineStart, columnStart), buffer, 2);
|
||||
return new IntLiteralToken(CreateSpan(lineStart, columnStart), buffer, 2);
|
||||
}
|
||||
|
||||
var isFloat = false;
|
||||
@@ -232,11 +232,11 @@ public sealed class Tokenizer
|
||||
|
||||
if (isFloat)
|
||||
{
|
||||
return new FloatLiteralToken(_fileName, CreateSpan(lineStart, columnStart), buffer);
|
||||
return new FloatLiteralToken(CreateSpan(lineStart, columnStart), buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new IntLiteralToken(_fileName, CreateSpan(lineStart, columnStart), buffer, 10);
|
||||
return new IntLiteralToken(CreateSpan(lineStart, columnStart), buffer, 10);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -272,7 +272,7 @@ public sealed class Tokenizer
|
||||
Next();
|
||||
}
|
||||
|
||||
return new StringLiteralToken(_fileName, CreateSpan(lineStart, columnStart), buffer);
|
||||
return new StringLiteralToken(CreateSpan(lineStart, columnStart), buffer);
|
||||
}
|
||||
|
||||
foreach (var (pattern, symbol) in OrderedSymbols)
|
||||
@@ -289,7 +289,7 @@ public sealed class Tokenizer
|
||||
Next();
|
||||
}
|
||||
|
||||
return new SymbolToken(_fileName, CreateSpan(lineStart, columnStart), symbol);
|
||||
return new SymbolToken(CreateSpan(lineStart, columnStart), symbol);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user