All checks were successful
Run the JSON parser tests / test (push) Has been skipped
29 lines
782 B
C#
29 lines
782 B
C#
namespace Jtr.Parsing;
|
|
|
|
public abstract partial class Lexer<TToken> where TToken : Enum
|
|
{
|
|
public class Context
|
|
{
|
|
public string File { get; }
|
|
public Source Source { get; }
|
|
public List<Token> Tokens { get; }
|
|
|
|
public Context(string file, Source source, List<Token> tokens)
|
|
{
|
|
File = file;
|
|
Source = source;
|
|
Tokens = tokens;
|
|
}
|
|
|
|
public void AddToken(TToken type, string lexeme, int line = -1, int column = -1)
|
|
{
|
|
Tokens.Add(new Token(
|
|
File,
|
|
type,
|
|
lexeme,
|
|
line == -1 ? Source.Line : line,
|
|
column == -1 ? Source.Column : column
|
|
));
|
|
}
|
|
}
|
|
} |