Class OneOrMoreRule
Denotes a rule that is matched at least once
public class OneOrMoreRule : Rule
- Inheritance
-
OneOrMoreRule
- Inherited Members
Constructors
OneOrMoreRule()
Creates a new instance
public OneOrMoreRule()
OneOrMoreRule(FormattedRule)
Creates a new instance
public OneOrMoreRule(FormattedRule innerRule)
Parameters
innerRuleFormattedRulethe inner rule
OneOrMoreRule(Rule)
Creates a new instance
public OneOrMoreRule(Rule innerRule)
Parameters
innerRuleRulethe inner rule
Properties
FormattingInstructions
Gets or sets the formatting instructions
public FormattingInstruction[] FormattingInstructions { get; set; }
Property Value
InnerRule
Gets or sets the inner rule
public Rule InnerRule { get; set; }
Property Value
Methods
Accept(RuleApplication, List<RuleApplication>, ParseContext)
Decides whether the provided rule application shall be accepted
protected bool Accept(RuleApplication ruleApplication, List<RuleApplication> ruleApplications, ParseContext context)
Parameters
ruleApplicationRuleApplicationthe rule application that shall be accepted
ruleApplicationsList<RuleApplication>the rule applications accepted so far
contextParseContextthe parse context in which the rule applications shall be accepted
Returns
- bool
true, if the rule application shall be accepted, otherwise false
AddLeftRecursionRules(List<Rule>, List<RecursiveContinuation>)
Adds rules to the given left recursion trace
protected override void AddLeftRecursionRules(List<Rule> trace, List<RecursiveContinuation> continuations)
Parameters
traceList<Rule>the trace
continuationsList<RecursiveContinuation>a collection of recursion continuations
CanStartWith(Rule, List<Rule>)
Indicates whether the rule could start with the given other rule
protected override bool CanStartWith(Rule rule, List<Rule> trace)
Parameters
Returns
- bool
true, if the rule could start with the given other rule, otherwise false
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
CreateSynthesisRequirements()
Creates a collection of requirements for synthesis
public override IEnumerable<SynthesisRequirement> CreateSynthesisRequirements()
Returns
- IEnumerable<SynthesisRequirement>
A collection of synthesis requirements
IsEpsilonAllowed(List<Rule>)
Determines whether the rule could capture empty input
protected override bool IsEpsilonAllowed(List<Rule> trace)
Parameters
Returns
- bool
true, if the rule can be expanded to an empty string, otherwise false
Match(ParseContext, RecursionContext, ref ParsePosition)
Matches the the context at the provided position
public override RuleApplication Match(ParseContext context, RecursionContext recursionContext, ref ParsePosition position)
Parameters
contextParseContextthe context in which the rule is matched
recursionContextRecursionContextthe recursion context of the matching
positionParsePositionthe position in the input
Returns
- RuleApplication
the rule application for the provided position
Recover(RuleApplication, RuleApplication, RuleApplication, ParseContext, out ParsePosition)
Recovers from the given inner failed rule application
protected override RuleApplication Recover(RuleApplication ruleApplication, RuleApplication failedRuleApplication, RuleApplication currentRoot, ParseContext context, out ParsePosition position)
Parameters
ruleApplicationRuleApplicationthe rule application that should be recovered
failedRuleApplicationRuleApplicationthe inner rule application that caused the failure
currentRootRuleApplicationthe current root rule application
contextParseContextthe parse context in which the rule application is recovered
positionParsePositionthe position after the recovery
Returns
- RuleApplication
the recovered rule application if the recovery was successful or the old rule application if not
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
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.