Enhanced C#
Language of your choice: library documentation
|
This class's main job is to maintain a table of Precedence values for LES operators. When you ask about a new operator, its precedence is cached for future reference. More...
This class's main job is to maintain a table of Precedence values for LES operators. When you ask about a new operator, its precedence is cached for future reference.
Properties | |
static LesPrecedenceMap | Default [get] |
Public Member Functions | |
void | Reset () |
Forgets previously encountered operators to save memory. More... | |
Precedence | Find (OperatorShape shape, object op, bool cacheWordOp=true) |
Gets the precedence of a prefix, suffix, or infix operator in LES, under the assumption that the operator isn't surrounded in backticks (in which case its precedence is always Backtick). More... | |
Symbol | ToSuffixOpName (object symbol) |
Given a normal operator symbol like (Symbol)"++" , gets the suffix form of the name, such as (Symbol)"suf++" . More... | |
Static Public Member Functions | |
static bool | IsOpChar (char c) |
Returns true if this character is one of those that operators are normally made out of in LES. More... | |
static bool | IsNaturalOperator (Symbol s) |
Returns true if the given Symbol can be printed as an operator without escaping it. More... | |
static bool | IsSuffixOperatorName (Symbol name, out Symbol bareName, bool checkNatural) |
Decides whether the name appears to represent a suffix operator of the form sufOP or OP</c>. More... | |
Protected Member Functions | |
Precedence | FindPrecedence (MMap< object, Precedence > table, object symbol, Precedence @default, bool cacheWordOp) |
Protected static fields | |
static LesPrecedenceMap | _default |
static readonly Map< object, Precedence > | PredefinedPrefixPrecedence |
static readonly Map< object, Precedence > | PredefinedSuffixPrecedence |
static readonly Map< object, Precedence > | PredefinedInfixPrecedence |
|
inline |
Gets the precedence of a prefix, suffix, or infix operator in LES, under the assumption that the operator isn't surrounded in backticks (in which case its precedence is always Backtick).
op | Parsed form of the operator. op must be a Symbol, but the parameter has type object to avoid casting Token.Value in the parser. |
|
inlinestatic |
Returns true if the given Symbol can be printed as an operator without escaping it.
The parser should read something like +/*
as an operator with three characters, rather than "+" and a comment, but the printer should be conservative, so this function returns false in such a case: "Be liberal in what you accept, and conservative in what you produce."
|
inlinestatic |
Returns true if this character is one of those that operators are normally made out of in LES.
|
inlinestatic |
Decides whether the name appears to represent a suffix operator of the form sufOP
or OP</c>.
name | Potential operator name to evaluate. |
bareName | If the name starts with "suf", this is the same name without "suf", otherwise it is set to name itself. This output is calculated even if the function returns false. |
checkNatural | If true, part of the requirement for returning true will be that IsNaturalOperator(bareName) == true. |
References Loyc.Symbol.Name.
|
inline |
Forgets previously encountered operators to save memory.
|
inline |
|
staticprotected |
|
staticprotected |