Enhanced C#
Language of your choice: library documentation
Public Member Functions | Protected Member Functions | List of all members
Loyc.Ecs.Parser.EcsTriviaInjector Class Reference

Trivia injector customized for Enhanced C#. More...


Source file:
Inheritance diagram for Loyc.Ecs.Parser.EcsTriviaInjector:
Loyc.Syntax.StandardTriviaInjector Loyc.Syntax.AbstractTriviaInjector< Token >

Remarks

Trivia injector customized for Enhanced C#.

How newline trivia works in EC# (mostly this is the same as StandardTriviaInjector):

Public Member Functions

 EcsTriviaInjector (IListSource< Token > sortedTrivia, ISourceFile sourceFile, int newlineTypeInt, string mlCommentPrefix, string mlCommentSuffix, string slCommentPrefix)
 
- Public Member Functions inherited from Loyc.Syntax.StandardTriviaInjector
 StandardTriviaInjector (IListSource< Token > sortedTrivia, ISourceFile sourceFile, int newlineTypeInt, string mlCommentPrefix, string mlCommentSuffix, string slCommentPrefix)
 Initializes StandardTriviaInjector. More...
 
- Public Member Functions inherited from Loyc.Syntax.AbstractTriviaInjector< Token >
 AbstractTriviaInjector (IListSource< Trivia > sortedTrivia)
 Initializes the SortedTrivia property. More...
 
IEnumerator< LNodeRun (IEnumerator< LNode > nodes)
 Attaches trivia to the input nodes provided. More...
 

Protected Member Functions

override VList< LNodeAttachTriviaTo (ref LNode node, IListSource< Token > trivia, TriviaLocation loc, LNode parent, int indexInParent)
 
override LNode DoneAttaching (LNode node, LNode parent, int indexInParent)
 This method is called after a node has been processed and any applicable trivia was attached. More...
 
- Protected Member Functions inherited from Loyc.Syntax.StandardTriviaInjector
override VList< LNodeAttachTriviaTo (ref LNode node, IListSource< Token > trivia, TriviaLocation loc, LNode parent, int indexInParent)
 
virtual bool HasImplicitLeadingNewline (LNode child, LNode parent, int childIndex)
 Called to find out if a newline is to be added implicitly before the current child of the specified node. More...
 
virtual LNode MakeTriviaAttribute (Token t)
 Called to transform a trivia token into a trivia attribute. More...
 
override bool IsNewline (Token trivia)
 
override SourceRange GetRange (Token trivia)
 
- Protected Member Functions inherited from Loyc.Syntax.AbstractTriviaInjector< Token >
abstract VList< LNodeAttachTriviaTo (ref LNode node, IListSource< Trivia > trivia, TriviaLocation loc, LNode parent, int indexInParent)
 Derived class should associate the given list of trivia with the specified node. Leading trivia will be attached to a given node before trailing trivia. More...
 
virtual void MarkOneLiner (ref LNode node)
 This method is called when a node has no newlines or comments within it (although the node may still have a leading or trailing comment). It informs the derived class that AbstractTriviaInjector<Trivia> will not traverse into the node. More...
 
abstract SourceRange GetRange (Trivia trivia)
 Gets the SourceRange for an element of trivia. More...
 
abstract bool IsNewline (Trivia trivia)
 Returns true if the trivia represents a newline, false otherwise. More...
 
virtual LNode GetEmptyResultSet ()
 A method called to create a virtual node to apply trivia to an empty source file. More...
 
IEnumerator< Pair< LNode, int > > RunCore (IEnumerator< Pair< LNode, int >> nodes, LNode parent)
 Core trivia associaton algorithm. More...
 

Additional Inherited Members

- Properties inherited from Loyc.Syntax.StandardTriviaInjector
ISourceFile SourceFile [get, set]
 
int NewlineTypeInt [get, set]
 
string SLCommentPrefix [get, set]
 
string SLCommentSuffix [get, set]
 
string MLCommentPrefix [get, set]
 
string MLCommentSuffix [get, set]
 
- Properties inherited from Loyc.Syntax.AbstractTriviaInjector< Token >
IListSource< Trivia > SortedTrivia [get, set]
 List of trivia to be injected by Run. Must be sorted. More...
 
int NextIndex [get, set]
 Index of next trivia to be injected. More...
 
- Static Protected Member Functions inherited from Loyc.Syntax.AbstractTriviaInjector< Token >
static IEnumerator< Pair< T, int > > WithIndexes< T > (IEnumerator< T > e)
 

Member Function Documentation

override LNode Loyc.Ecs.Parser.EcsTriviaInjector.DoneAttaching ( LNode  node,
LNode  parent,
int  indexInParent 
)
inlineprotectedvirtual

This method is called after a node has been processed and any applicable trivia was attached.

Parameters
nodeNode (after trivia attached)
parentParent of node (old version, before changes to children are applied)
indexInParentIndex of node within parent.
Returns
Should return node or an altered version of node.

This method gives the derived class one final chance to rearrange or alter the interpretation of the attached trivia. Note that this method may be called on some nodes to which trivia was not attached, when siblings of the same parent had trivia attached.

Reimplemented from Loyc.Syntax.AbstractTriviaInjector< Token >.

References Loyc.Syntax.LNode.Args, Loyc.Syntax.LNode.Calls(), Loyc.Syntax.LNode.CallsMin(), Loyc.Syntax.LNode.Range, and Loyc.Syntax.LNode.Target.