Skip to main content

Class BufferLexer

Namespace: OceanApocalypse.RSML.Language.Lexing
Assembly: RSML.Language.Lexing.dll

An implementation of a RSML lexer backed by a read-only or read-and-write buffer.

public class BufferLexer : Lexer, ILexer, IToolchainComponent, IDisposable

Inheritance

ObjectLexerBufferLexer

Implements

ILexer, IToolchainComponent, IDisposable

Inherited Members

Lexer.Configuration, Lexer.Inject(ToolchainConfigurations), Lexer.Lex(), Lexer.Dispose(), Lexer.Dispose(Boolean), Lexer.GetNextToken(), Object.Equals(Object?), Object.Equals(Object?, Object?), Object.GetHashCode(), Object.GetType(), Object.MemberwiseClone(), Object.ReferenceEquals(Object?, Object?), Object.ToString()

Constructors

BufferLexer(IBuffer, DiagnosticCollector)

An implementation of a RSML lexer backed by a read-only or read-and-write buffer.

public BufferLexer(IBuffer buffer, DiagnosticCollector diagnostics)

Parameters

buffer IBuffer

A buffer. Can be read-only (IBuffer) or read and write (IBuffer).

diagnostics DiagnosticCollector

A collector for all emitted diagnostics.

Methods

GetNextToken()

Returns the next token.

public override Result<Token> GetNextToken()

Returns

Result<Token>

The next token.

Remarks

Diagnostic output

This method does not add diagnostics to the collector (DiagnosticCollector): it only returns them when it proves necessary.

Lex()

Tokenizes a source passed to the lexer.

public override IEnumerable<Token> Lex()

Returns

IEnumerable<Token>

The tokens.