Enhanced C#
Loyc library documentation
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
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< Trivia >

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, bool topLevelIsBlock)
 
- Public Member Functions inherited from Loyc.Syntax.StandardTriviaInjector
 StandardTriviaInjector (IListSource< Token > sortedTrivia, ISourceFile sourceFile, int newlineTypeInt, string mlCommentPrefix, string mlCommentSuffix, string slCommentPrefix, bool topLevelIsBlock=true)
 Initializes StandardTriviaInjector. More...
 
- Public Member Functions inherited from Loyc.Syntax.AbstractTriviaInjector< Trivia >
 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 LNodeList GetTriviaToAttach (LNode node, IListSource< Token > trivia, TriviaLocation loc, LNode parent, int indexInParent)
 
override LNode MakeTriviaAttribute (Token t)
 Called to transform a trivia token into a trivia attribute. More...
 
override LNode DoneAttaching (LNode node, LNode parent, int indexInParent)
 
- Protected Member Functions inherited from Loyc.Syntax.StandardTriviaInjector
override LNodeList GetTriviaToAttach (LNode node, IListSource< Token > trivia, TriviaLocation loc, LNode?parent, int indexInParent)
 
virtual bool HasImplicitLeadingNewline (LNode child, LNode?parent, int indexInParent)
 Called to find out if a newline is to be added implicitly before the current child of the specified node. More...
 
override bool IsNewline (Token trivia)
 
override SourceRange GetRange (Token trivia)
 
- Protected Member Functions inherited from Loyc.Syntax.AbstractTriviaInjector< Trivia >
abstract LNodeList GetTriviaToAttach (LNode node, IListSource< Trivia > trivia, TriviaLocation loc, LNode?parent, int indexInParent)
 Derived class translates a list of trivia (tokens) into appropriate trivia attributes. This will be called for leading trivia before trailing trivia. More...
 
virtual void ProcessChildrenOfOneLiner (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). The method should add appendStatement trivia inside blocks in the node, if necessary. 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, in order to apply trivia to a source file that is completely empty except for trivia. More...
 
virtual 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...
 
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]
 
bool TopLevelIsBlock [get, set]
 
- Properties inherited from Loyc.Syntax.AbstractTriviaInjector< Trivia >
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...
 
- Protected Types inherited from Loyc.Syntax.AbstractTriviaInjector< Trivia >
enum  TriviaLocation {
  TriviaLocation.Leading = 0, TriviaLocation.Trailing = 1, TriviaLocation.TrailingExtra = 2,
  TriviaLocation.Ambiguous = 3
}
 
- Static Protected Member Functions inherited from Loyc.Syntax.AbstractTriviaInjector< Trivia >
static IEnumerator< Pair< T,
int > > 
WithIndexes< T > (IEnumerator< T > e)
 

Member Function Documentation

override LNode Loyc.Ecs.Parser.EcsTriviaInjector.MakeTriviaAttribute ( Token  t)
inlineprotectedvirtual

Called to transform a trivia token into a trivia attribute.

If a trivia token is not recognized, null is returned to ignore the trivia.

Reimplemented from Loyc.Syntax.StandardTriviaInjector.

References Loyc.Syntax.Lexing.Token.Value.