Enhanced C#
Language of your choice: library documentation
Properties | Public Member Functions | List of all members
Loyc.Syntax.Lexing.TokenListAsLexer Class Reference

Adapter: converts IEnumerable(Token) to the ILexer<Token> interface. More...


Source file:
Inheritance diagram for Loyc.Syntax.Lexing.TokenListAsLexer:
Loyc.Syntax.Lexing.ILexer< Token > Loyc.Syntax.IIndexToLine Loyc.Syntax.IHasFileName

Remarks

Adapter: converts IEnumerable(Token) to the ILexer<Token> interface.

The LineNumber property is computed on-demand by the ISourceFile provided.

TODO: IndentLevel, IndentString do not work.

Properties

Loyc.Syntax.ISourceFile SourceFile [get]
 
Loyc.IMessageSink ErrorSink [get, set]
 
int IndentLevel [get]
 
UString IndentString [get]
 
int LineNumber [get]
 
int InputPosition [get]
 
Token Current [get]
 
string FileName [get]
 
- Properties inherited from Loyc.Syntax.Lexing.ILexer< Token >
ISourceFile SourceFile [get]
 The file being lexed. More...
 
IMessageSink ErrorSink [get, set]
 Event handler for errors. More...
 
int IndentLevel [get]
 Indentation level of the current line. This is updated after scanning the first whitespaces on a new line, and may be reset to zero when NextToken() returns a newline. More...
 
UString IndentString [get]
 Gets a string slice that holds the spaces or tabs that were used to indent the current line. More...
 
int LineNumber [get]
 Current line number (1 for the first line). More...
 
int InputPosition [get]
 Current input position (an index into SourceFile.Text). More...
 
- Properties inherited from Loyc.Syntax.IHasFileName
string FileName [get]
 

Public Member Functions

 TokenListAsLexer (IEnumerable< Token > tokenList, ISourceFile sourceFile)
 
 TokenListAsLexer (IEnumerator< Token > tokenList, ISourceFile sourceFile)
 
Maybe< TokenNextToken ()
 Scans the next token and returns information about it. More...
 
bool MoveNext ()
 
ILineColumnFile IndexToLine (int index)
 Returns the position in a source file of the specified index. More...
 

Member Function Documentation

◆ IndexToLine()

ILineColumnFile Loyc.Syntax.Lexing.TokenListAsLexer.IndexToLine ( int  index)
inline

Returns the position in a source file of the specified index.

If index is negative, this should return a SourcePos where Line and PosInLine are zero (signifying an unknown location). If index is beyond the end of the file, this should retun the final position in the file.

Implements Loyc.Syntax.IIndexToLine.

References Loyc.Syntax.IndexPositionMapper< CharSource >.IndexToLine().

◆ NextToken()

Maybe<Token> Loyc.Syntax.Lexing.TokenListAsLexer.NextToken ( )
inline

Scans the next token and returns information about it.

Returns
The next token, or null at the end of the source file.

Implements Loyc.Syntax.Lexing.ILexer< Token >.