The ezr² Project 0.1.1
The codebase for the ezr² programming language.
Loading...
Searching...
No Matches
EzrSquared.Util.Utils Class Reference

Utilities functions used in ezrSquared. More...

Static Public Member Functions

static long GetNextUniqueId ()
 Generates an incremental unique identifier.
 
static int IndexToFlag (int index)
 Converts an index to a power of two, so that the index can be used like an enum flag.
 
static int string SourceWithUnderline SourceWithUnderline (Position startPosition, Position endPosition)
 
static string PascalToSnakeCase (string text)
 Converts a string from PascalCase to snake_case.
 

Static Public Attributes

static int AdjustedLineNumber
 Creates formatted text which contains the text between startPosition and endPosition , underlined with tilde (~) symbols.
 

Static Private Attributes

static long s_currentId = 0
 long value for the last generated unique identifier.
 

Detailed Description

Utilities functions used in ezrSquared.

Member Function Documentation

◆ GetNextUniqueId()

static long EzrSquared.Util.Utils.GetNextUniqueId ( )
static

Generates an incremental unique identifier.

Returns
A new unique identifier.

◆ IndexToFlag()

static int EzrSquared.Util.Utils.IndexToFlag ( int index)
static

Converts an index to a power of two, so that the index can be used like an enum flag.

This function is used to check if all arguments have been provided to Runtime.Types.CSharpWrappers.SourceWrappers.EzrSharpSourceExecutableWrapper and Runtime.Types.EzrRuntimeExecutable types.
The indices of the given arguments are converted to powers of two and bitwise-ored together, then bitwise-anded with the index of a defined parameter which is also converted to a power of two.
Finally, if the result is the same as the power of two of the parameter's index, this tells the interpreter that the particular required parameter has been provided.

Parameters
indexThe index to be converted.
Returns
The power of two.

◆ PascalToSnakeCase()

static string EzrSquared.Util.Utils.PascalToSnakeCase ( string text)
static

Converts a string from PascalCase to snake_case.

Parameters
textThe text to convert in PascalCase.
Returns
The converted text in snake_case.

Member Data Documentation

◆ AdjustedLineNumber

int EzrSquared.Util.Utils.AdjustedLineNumber
static

Creates formatted text which contains the text between startPosition and endPosition , underlined with tilde (~) symbols.

Returns
The formatted text.

The documentation for this class was generated from the following file: