org.eclipse.xtext.parsetree.reconstr.impl
Class AbstractParseTreeConstructor

java.lang.Object
  extended by org.eclipse.xtext.parsetree.reconstr.impl.AbstractParseTreeConstructor
All Implemented Interfaces:
IParseTreeConstructor
Direct Known Subclasses:
CodetemplatesParsetreeConstructor, PureXbaseParsetreeConstructor, SimpleAntlrParsetreeConstructor, SimpleExpressionsParsetreeConstructor, SingleCodetemplateParsetreeConstructor, TerminalsParsetreeConstructor, XtextParsetreeConstructor

public abstract class AbstractParseTreeConstructor
extends java.lang.Object
implements IParseTreeConstructor

TODO: Extract WsMergerStream to a different class

Author:
Moritz Eysholdt - Initial contribution and API, Jan Koehnlein

Nested Class Summary
 class AbstractParseTreeConstructor.AbstractToken
           
 class AbstractParseTreeConstructor.ActionToken
           
 class AbstractParseTreeConstructor.AlternativesToken
           
 class AbstractParseTreeConstructor.AssignmentToken
           
static class AbstractParseTreeConstructor.AssignmentType
           
protected  class AbstractParseTreeConstructor.CommentToken
           
 class AbstractParseTreeConstructor.GroupToken
           
 class AbstractParseTreeConstructor.KeywordToken
           
 class AbstractParseTreeConstructor.RootToken
           
 class AbstractParseTreeConstructor.RuleCallToken
           
 class AbstractParseTreeConstructor.UnassignedTextToken
           
 class AbstractParseTreeConstructor.UnorderedGroupToken
           
protected  class AbstractParseTreeConstructor.WsMergerStream
           
 
Nested classes/interfaces inherited from interface org.eclipse.xtext.parsetree.reconstr.IParseTreeConstructor
IParseTreeConstructor.TreeConstructionDiagnostic, IParseTreeConstructor.TreeConstructionReport
 
Field Summary
protected  ICommentAssociater commentAssociater
           
protected  ITokenSerializer.ICrossReferenceSerializer crossRefSerializer
           
protected  ITokenSerializer.IEnumLiteralSerializer enumLitSerializer
           
protected  IHiddenTokenHelper hiddenTokenHelper
           
protected  ITokenSerializer.IKeywordSerializer keywordSerializer
           
protected  TokenUtil tokenUtil
           
protected  com.google.inject.Provider<TreeConstructionReportImpl> treeConstructionReportProvider
           
protected  ITransientValueService tvService
           
protected  ITokenSerializer.IValueSerializer valueSerializer
           
 
Constructor Summary
AbstractParseTreeConstructor()
           
 
Method Summary
protected  void assignComment(ILeafNode comment, java.util.Map<org.eclipse.emf.ecore.EObject,AbstractParseTreeConstructor.AbstractToken> eObject2Token, java.util.Map<ILeafNode,org.eclipse.emf.ecore.EObject> comments)
           
protected  void assignNodesByMatching(java.util.Map<org.eclipse.emf.ecore.EObject,AbstractParseTreeConstructor.AbstractToken> eObject2Token, ICompositeNode rootNode, java.util.Map<ILeafNode,org.eclipse.emf.ecore.EObject> comments)
           
protected  void assignTokenByMatcher(INode node, AbstractParseTreeConstructor.AbstractToken token, boolean recursive)
           
protected  void assignTokenByMatcher(INode node, java.util.Map<org.eclipse.emf.ecore.EObject,AbstractParseTreeConstructor.AbstractToken> eObject2Token)
           
protected  boolean assignTokenDirect(INode node, java.util.Map<org.eclipse.emf.ecore.EObject,AbstractParseTreeConstructor.AbstractToken> eObject2Token)
           
protected  void collectRootsAndEObjects(AbstractParseTreeConstructor.AbstractToken token, java.util.Map<org.eclipse.emf.ecore.EObject,AbstractParseTreeConstructor.AbstractToken> obj2token, java.util.Set<ICompositeNode> roots)
           
protected  boolean containsNodeOrAnyParent(java.util.Set<ICompositeNode> nodes, INode node)
           
protected  IEObjectConsumer createEObjectConsumer(org.eclipse.emf.ecore.EObject obj)
           
protected  TreeConstructionReportImpl createReport(org.eclipse.emf.ecore.EObject root)
           
protected  java.lang.String debug(AbstractParseTreeConstructor.AbstractToken t, IEObjectConsumer i)
           
protected  void dump(java.lang.String indent, AbstractParseTreeConstructor.AbstractToken token)
           
protected  java.lang.String dumpNode(INode node)
           
protected abstract  AbstractParseTreeConstructor.AbstractToken getRootToken(IEObjectConsumer inst)
           
protected  void initStream(AbstractParseTreeConstructor.AbstractToken token, AbstractParseTreeConstructor.WsMergerStream out)
           
protected  AbstractParseTreeConstructor.AbstractToken serialize(org.eclipse.emf.ecore.EObject object, AbstractParseTreeConstructor.AbstractToken currentToken, TreeConstructionReportImpl rep)
           
protected  AbstractParseTreeConstructor.AbstractToken serialize(org.eclipse.emf.ecore.EObject object, TreeConstructionReportImpl rep)
           
 IParseTreeConstructor.TreeConstructionReport serializeSubtree(org.eclipse.emf.ecore.EObject object, ITokenStream out)
           
protected  ITextRegion write(AbstractParseTreeConstructor.AbstractToken token, AbstractParseTreeConstructor.WsMergerStream out, ITextRegion location)
           
protected  void writeComments(java.lang.Iterable<ILeafNode> comments, AbstractParseTreeConstructor.WsMergerStream out, java.util.Set<INode> consumedComments)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

commentAssociater

@Inject
protected ICommentAssociater commentAssociater

crossRefSerializer

@Inject
protected ITokenSerializer.ICrossReferenceSerializer crossRefSerializer

enumLitSerializer

@Inject
protected ITokenSerializer.IEnumLiteralSerializer enumLitSerializer

hiddenTokenHelper

@Inject
protected IHiddenTokenHelper hiddenTokenHelper

keywordSerializer

@Inject
protected ITokenSerializer.IKeywordSerializer keywordSerializer

tokenUtil

@Inject
protected TokenUtil tokenUtil

treeConstructionReportProvider

@Inject
protected com.google.inject.Provider<TreeConstructionReportImpl> treeConstructionReportProvider

tvService

@Inject
protected ITransientValueService tvService

valueSerializer

@Inject
protected ITokenSerializer.IValueSerializer valueSerializer
Constructor Detail

AbstractParseTreeConstructor

public AbstractParseTreeConstructor()
Method Detail

assignComment

protected void assignComment(ILeafNode comment,
                             java.util.Map<org.eclipse.emf.ecore.EObject,AbstractParseTreeConstructor.AbstractToken> eObject2Token,
                             java.util.Map<ILeafNode,org.eclipse.emf.ecore.EObject> comments)

assignNodesByMatching

protected void assignNodesByMatching(java.util.Map<org.eclipse.emf.ecore.EObject,AbstractParseTreeConstructor.AbstractToken> eObject2Token,
                                     ICompositeNode rootNode,
                                     java.util.Map<ILeafNode,org.eclipse.emf.ecore.EObject> comments)
                              throws java.io.IOException
Throws:
java.io.IOException

assignTokenByMatcher

protected void assignTokenByMatcher(INode node,
                                    AbstractParseTreeConstructor.AbstractToken token,
                                    boolean recursive)

assignTokenByMatcher

protected void assignTokenByMatcher(INode node,
                                    java.util.Map<org.eclipse.emf.ecore.EObject,AbstractParseTreeConstructor.AbstractToken> eObject2Token)

assignTokenDirect

protected boolean assignTokenDirect(INode node,
                                    java.util.Map<org.eclipse.emf.ecore.EObject,AbstractParseTreeConstructor.AbstractToken> eObject2Token)

collectRootsAndEObjects

protected void collectRootsAndEObjects(AbstractParseTreeConstructor.AbstractToken token,
                                       java.util.Map<org.eclipse.emf.ecore.EObject,AbstractParseTreeConstructor.AbstractToken> obj2token,
                                       java.util.Set<ICompositeNode> roots)

containsNodeOrAnyParent

protected boolean containsNodeOrAnyParent(java.util.Set<ICompositeNode> nodes,
                                          INode node)

createEObjectConsumer

protected IEObjectConsumer createEObjectConsumer(org.eclipse.emf.ecore.EObject obj)

createReport

protected TreeConstructionReportImpl createReport(org.eclipse.emf.ecore.EObject root)

debug

protected java.lang.String debug(AbstractParseTreeConstructor.AbstractToken t,
                                 IEObjectConsumer i)

dump

protected void dump(java.lang.String indent,
                    AbstractParseTreeConstructor.AbstractToken token)

dumpNode

protected java.lang.String dumpNode(INode node)

getRootToken

protected abstract AbstractParseTreeConstructor.AbstractToken getRootToken(IEObjectConsumer inst)

serialize

protected AbstractParseTreeConstructor.AbstractToken serialize(org.eclipse.emf.ecore.EObject object,
                                                               AbstractParseTreeConstructor.AbstractToken currentToken,
                                                               TreeConstructionReportImpl rep)

serialize

protected AbstractParseTreeConstructor.AbstractToken serialize(org.eclipse.emf.ecore.EObject object,
                                                               TreeConstructionReportImpl rep)

serializeSubtree

public IParseTreeConstructor.TreeConstructionReport serializeSubtree(org.eclipse.emf.ecore.EObject object,
                                                                     ITokenStream out)
                                                              throws java.io.IOException
Specified by:
serializeSubtree in interface IParseTreeConstructor
Throws:
java.io.IOException

initStream

protected void initStream(AbstractParseTreeConstructor.AbstractToken token,
                          AbstractParseTreeConstructor.WsMergerStream out)
Since:
2.0

write

protected ITextRegion write(AbstractParseTreeConstructor.AbstractToken token,
                            AbstractParseTreeConstructor.WsMergerStream out,
                            ITextRegion location)
                     throws java.io.IOException
Throws:
java.io.IOException

writeComments

protected void writeComments(java.lang.Iterable<ILeafNode> comments,
                             AbstractParseTreeConstructor.WsMergerStream out,
                             java.util.Set<INode> consumedComments)
                      throws java.io.IOException
Throws:
java.io.IOException