Class SequenceRule
Denotes a rule that other rules occur in sequence
public class SequenceRule : Rule
- Inheritance
-
SequenceRule
- Derived
- Inherited Members
Constructors
SequenceRule()
Creates a new instance
public SequenceRule()
SequenceRule(params FormattedRule[])
Creates a new instance
public SequenceRule(params FormattedRule[] rules)
Parameters
rulesFormattedRule[]The rules that should occur in sequence
Properties
Rules
The rules that should occur in sequence
public FormattedRule[] Rules { get; set; }
Property Value
Methods
Accept(ref RuleApplication, List<RuleApplication>, ParseContext)
Decides whether the provided rule application shall be accepted
protected bool Accept(ref 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
CreateRuleApplication(ParsePosition, List<RuleApplication>, ParsePositionDelta, ParsePositionDelta, object)
Creates a rule application for a success
protected virtual RuleApplication CreateRuleApplication(ParsePosition currentPosition, List<RuleApplication> inner, ParsePositionDelta length, ParsePositionDelta examined, object semanticElement = null)
Parameters
currentPositionParsePositionthe current parser position
innerList<RuleApplication>the inner list of rule applications
lengthParsePositionDeltathe length of the match
examinedParsePositionDeltathe amount of text examined
semanticElementobjectan already existing semantic model element
Returns
- RuleApplication
a new rule application
CreateSynthesisRequirements()
Creates a collection of requirements for synthesis
public override IEnumerable<SynthesisRequirement> CreateSynthesisRequirements()
Returns
- IEnumerable<SynthesisRequirement>
A collection of synthesis requirements
GetOrCreateSynthesisRequirements()
Gets or creates synthesis requirements for the individual rules
protected IEnumerable<SynthesisRequirement>[] GetOrCreateSynthesisRequirements()
Returns
- IEnumerable<SynthesisRequirement>[]
An array with the synthesis requirements for the individual rules of the sequence
HasFoldingKind(out string)
Returns the folding kind for a rule if one is defined for the rule
public override bool HasFoldingKind(out string kind)
Parameters
kindstringThe folding kind of the rule
Returns
- bool
True, if a folding kind is defined for the rule
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
IsFoldable()
True, if the application of this rule can be folded away (hidden)
public override bool IsFoldable()
Returns
IsMatchingEndLiteral(string, string)
Checks if a given pair of start and end literal match
public virtual bool IsMatchingEndLiteral(string literal, string startLiteral)
Parameters
Returns
- bool
True, if the given literal is a matching end literal for a given start literal
IsRangeStartLiteral(string)
Checks if a given literal denotes the start of a generic folding range
public virtual bool IsRangeStartLiteral(string literal)
Parameters
literalstring
Returns
- bool
True, if the given literal denotes the start of a generic foldable range
IsRegion()
Determines whether the current rule represents a region
public virtual bool IsRegion()
Returns
- bool
true, if it represents a region, otherwise false
IsRegionStartLiteral(string)
Checks if a literal denotes the start of a region
public virtual bool IsRegionStartLiteral(string literal)
Parameters
literalstringThe start literal
Returns
- bool
True, if the given literal denotes the start of a region
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
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.