C# Class Loyc.LLParserGenerator.AutoValueSaverVisitor

Helper class invoked just after StageTwoParser. Its job is to create variables referenced by labels (label:item) and by code blocks ($RuleName), to modify the code blocks to remove the $ operator, and to update the ResultSaver of each labeled predicate. Also supports $result.
Labels and $substitutions can also be used with Preds constructed by hand, except that referencing tokens directly from code blocks (e.g. $'#') won't work unless the corresponding grammar Pred has a Pred.Basis is an equal syntax tree.
Inheritance: Loyc.LLParserGenerator.RecursivePredVisitor
Exibir arquivo Open project: qwertie/ecsharp Class Usage Examples

Public Methods

Method Description
Run ( Rule rule, IMessageSink sink, Rule>.IDictionary rules, IPGCodeGenHelper codeGen ) : void
Visit ( RuleRef pred ) : void
VisitOther ( Pred pred ) : void

Private Methods

Method Description
AutoValueSaverVisitor ( DataGatheringVisitor data, IMessageSink sink, Rule>.IDictionary rules, IPGCodeGenHelper codeGen ) : System
LiteralToIdent ( object literal ) : string
LiteralToVarName ( object literal ) : Symbol
MaybeCreateVariableFor ( Pred pred, Symbol varName, LNode primType ) : void
PickVarNameForLNode ( LNode label ) : Symbol
PickVarNameForRuleName ( Symbol name ) : Symbol
Process ( Rule rule ) : void
ReplaceSubstitutionsIn ( LNode code ) : LNode
ReplaceSubstitutionsInCodeBlocks ( ) : void

Method Details

Run() public static method

public static Run ( Rule rule, IMessageSink sink, Rule>.IDictionary rules, IPGCodeGenHelper codeGen ) : void
rule Rule
sink IMessageSink
rules Rule>.IDictionary
codeGen IPGCodeGenHelper
return void

Visit() public method

public Visit ( RuleRef pred ) : void
pred RuleRef
return void

VisitOther() public method

public VisitOther ( Pred pred ) : void
pred Pred
return void