Class ConvertRule<T>
Denotes a rule that applies custom conversions
public class ConvertRule<T> : RegexRule
Type Parameters
T
- Inheritance
-
ConvertRule<T>
- Derived
- Inherited Members
Methods
CanSynthesize(object, ParseContext, SynthesisPlan)
Determines whether the current rule can synthesize rule applications for the given semantic element
public override bool CanSynthesize(object semanticElement, ParseContext context, SynthesisPlan synthesisPlan)
Parameters
semanticElementobjectthe semantic element
contextParseContextthe context in which the rule is synthesized
synthesisPlanSynthesisPlanthe plan of the synthesis
Returns
- bool
true, if a rule application can be synthesized, otherwise false
Convert(string, ParseContext)
Converts the provided text to an element of type TElement
public virtual T Convert(string text, ParseContext context)
Parameters
textstringthe input text
contextParseContextthe parse context
Returns
- T
the parsed element
ConvertToString(T, ParseContext)
Converts the provided element to text
public virtual string ConvertToString(T semanticElement, ParseContext context)
Parameters
semanticElementTthe semantic element
contextParseContextthe parse context
Returns
- string
the input text
CreateRuleApplication(string, ParsePosition, ParsePositionDelta, ParseContext)
Creates a new rule application
public override RuleApplication CreateRuleApplication(string matched, ParsePosition position, ParsePositionDelta examined, ParseContext context)
Parameters
matchedstringthe matched string content
positionParsePositionthe position where the rule matched
examinedParsePositionDeltathe examined length of text
contextParseContextthe parse context
Returns
- RuleApplication
a rule application
Synthesize(object, ParsePosition, ParseContext)
Synthesizes a rule application for the given semantic element
public override RuleApplication Synthesize(object semanticElement, ParsePosition position, ParseContext context)
Parameters
semanticElementobjectpositionParsePositionthe parse position at which the element should be synthesized
contextParseContextthe parse context
Returns
- RuleApplication
a rule application