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

A small helper class for languages such as C# and C++ that permit the locations reported by error messages to be remapped. This class stores and applies such commands (#line in C#/C++) More...


Source file:

Remarks

A small helper class for languages such as C# and C++ that permit the locations reported by error messages to be remapped. This class stores and applies such commands (#line in C#/C++)

This is part of SourceFileWithLineRemaps. One LineRemapper should be created per real source file.

Public Member Functions

void AddRemap (int realLine, int reportLine, string reportFileName=null)
 Adds a mapping that starts on the specified real line. More...
 
void EndRemap (int realLine)
 Corresponds to #line default in C#. More...
 
bool Remap (ref int line, ref string fileName)
 Remaps the specified line number, if a remapping has been created that applies to it. More...
 

Member Function Documentation

void Loyc.Syntax.LineRemapper.AddRemap ( int  realLine,
int  reportLine,
string  reportFileName = null 
)
inline

Adds a mapping that starts on the specified real line.

In C++ and C#, a directive like "#line 200" affects the line after the preprocessor directive. So if "#line 200" is on line 10, you'd call AddRemap(11, 200) or possibly AddRemap(10, 199).

void Loyc.Syntax.LineRemapper.EndRemap ( int  realLine)
inline

Corresponds to #line default in C#.

bool Loyc.Syntax.LineRemapper.Remap ( ref int  line,
ref string  fileName 
)
inline

Remaps the specified line number, if a remapping has been created that applies to it.

Parameters
lineOn entry, a real line number. On exit, a remapped line number
fileNameThis is changed to the user-specified file name string, if and only if a file-name remapping exists and applies here.
Returns
true if a remapping exists and was applied, false if not.

References Loyc.Collections.BDictionary< K, V >.FindUpperBound().