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
semanticElement
objectthe semantic element
context
ParseContextthe context in which the rule is synthesized
synthesisPlan
SynthesisPlanthe 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
text
stringthe input text
context
ParseContextthe 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
semanticElement
Tthe semantic element
context
ParseContextthe 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
matched
stringthe matched string content
position
ParsePositionthe position where the rule matched
examined
ParsePositionDeltathe examined length of text
context
ParseContextthe 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
semanticElement
objectposition
ParsePositionthe parse position at which the element should be synthesized
context
ParseContextthe parse context
Returns
- RuleApplication
a rule application