Enhanced C#
Language of your choice: library documentation
List of all members
Loyc.LLParserGenerator.LLParserGenerator.GetCanonical Class Reference

Computes the "canonical" interpretation of a position for prediction purposes, so that ConsolidateDuplicatePositions can detect duplicates reliably. Call Do() to use. More...


Source file:
Inheritance diagram for Loyc.LLParserGenerator.LLParserGenerator.GetCanonical:
Loyc.LLParserGenerator.PredVisitor

Remarks

Computes the "canonical" interpretation of a position for prediction purposes, so that ConsolidateDuplicatePositions can detect duplicates reliably. Call Do() to use.

GrammarPos Do (GrammarPos input)
 Computes the "canonical" interpretation of a position. More...
 
override void Visit (Seq seq)
 
override void Visit (Gate gate)
 
override void Visit (ActionPred pred)
 
override void Visit (EndOfRule end)
 
override void VisitOther (Pred pred)
 

Additional Inherited Members

- Public Member Functions inherited from Loyc.LLParserGenerator.PredVisitor
void Visit (Pred pred)
 
virtual void Visit (TerminalPred term)
 
virtual void Visit (RuleRef rref)
 
virtual void Visit (Alts alts)
 
virtual void Visit (AndPred and)
 
void VisitChildrenOf (Seq pred)
 
void VisitChildrenOf (AndPred pred)
 
void VisitChildrenOf (Gate pred)
 
void VisitChildrenOf (Alts pred, bool includeError)
 

Member Function Documentation

◆ Do()

GrammarPos Loyc.LLParserGenerator.LLParserGenerator.GetCanonical.Do ( GrammarPos  input)
inline

Computes the "canonical" interpretation of a position.

For example, given

rule X 'a' Y 'z' };
rule Y 'a'..'y' 'b'..'z' };

The position before the sequence 'a' Y 'z' is equivalent to the position before 'a', so the result points to 'a' rather than to the sequence itself.

The position after 'b'..'z' is equivalent to the position before 'z', if Y was called from X. Therefore, given the position after 'b'..'z' (a pointer to EndOfRule), and return address before 'z', this method returns the position before 'z'.