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

A dummy implementation of ISourceFile that has only a filename, no source text. Used as the source file of synthetic syntax nodes. More...


Source file:
Inheritance diagram for Loyc.Syntax.EmptySourceFile:
Loyc.Syntax.ISourceFile Loyc.Syntax.IIndexPositionMapper Loyc.Syntax.IIndexToLine

Remarks

A dummy implementation of ISourceFile that has only a filename, no source text. Used as the source file of synthetic syntax nodes.

Public static fields

static readonly EmptySourceFile Default = new EmptySourceFile("")
 
static readonly EmptySourceFile Unknown = new EmptySourceFile("Unknown")
 

Properties

string FileName [get]
 
ICharSource Text [get]
 
- Properties inherited from Loyc.Syntax.ISourceFile
ICharSource Text [get]
 
- Properties inherited from Loyc.Syntax.IIndexToLine
string FileName [get]
 Gets the file name used in results returned by IndexToLine(int). More...
 

Public Member Functions

 EmptySourceFile (string fileName)
 
SourcePos IndexToLine (int index)
 Returns the position in a source file of the specified index. More...
 
int LineToIndex (int lineNo)
 Returns the index in a source file of the beginning of the specified line, where the first line is number 1, not 0. More...
 
int LineToIndex (LineAndCol pos)
 

Member Function Documentation

SourcePos Loyc.Syntax.EmptySourceFile.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.

int Loyc.Syntax.EmptySourceFile.LineToIndex ( int  lineNo)
inline

Returns the index in a source file of the beginning of the specified line, where the first line is number 1, not 0.

If lineNo is zero, this method should return -1 (signifying an unknown location). If lineNo is larger than the largest line number, this method should return the index of end-of-file.

Implements Loyc.Syntax.IIndexPositionMapper.