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 Loyc.Syntax.IHasFileName

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 Synthetic = new EmptySourceFile("Synthetic".Localized())
 
static readonly EmptySourceFile Unknown = new EmptySourceFile("Unknown".Localized())
 

Properties

string FileName [get]
 
ICharSource Text [get]
 
- Properties inherited from Loyc.Syntax.ISourceFile
ICharSource Text [get]
 
- Properties inherited from Loyc.Syntax.IHasFileName
string FileName [get]
 

Public Member Functions

 EmptySourceFile (string fileName)
 
LineColumnFile 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 (ILineAndColumn pos)
 

Member Function Documentation

◆ IndexToLine()

LineColumnFile 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.

◆ LineToIndex()

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.