Class FormattingConfigBasedStream
- java.lang.Object
-
- org.eclipse.xtext.formatting.impl.AbstractTokenStream
-
- org.eclipse.xtext.formatting.impl.BaseTokenStream
-
- org.eclipse.xtext.formatting.impl.FormattingConfigBasedStream
-
- All Implemented Interfaces:
ITokenStream
,ITokenStreamExtension
public class FormattingConfigBasedStream extends BaseTokenStream
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
FormattingConfigBasedStream.Line
protected class
FormattingConfigBasedStream.LineEntry
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Set<AbstractFormattingConfig.ElementLocator>
activeRangeLocators
protected FormattingConfig
cfg
protected FormattingConfigBasedStream.Line
currentLine
protected IHiddenTokenHelper
hiddenTokenHelper
protected int
indentationLevel
protected java.lang.String
indentationPrefix
protected org.eclipse.emf.ecore.EObject
last
protected IElementMatcherProvider.IElementMatcher<AbstractFormattingConfig.ElementPattern>
matcher
protected java.lang.String
preservedWS
protected boolean
preserveSpaces
-
Fields inherited from class org.eclipse.xtext.formatting.impl.BaseTokenStream
out
-
-
Constructor Summary
Constructors Constructor Description FormattingConfigBasedStream(ITokenStream out, java.lang.String initialIndentation, FormattingConfig cfg, IElementMatcherProvider.IElementMatcher<AbstractFormattingConfig.ElementPattern> matcher, IHiddenTokenHelper hiddenTokenHelper, boolean preserveSpaces)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addLineEntry(org.eclipse.emf.ecore.EObject grammarElement, java.lang.String value, boolean isHidden)
protected java.util.Set<AbstractFormattingConfig.ElementLocator>
collectLocators(org.eclipse.emf.ecore.EObject ele)
protected java.util.Set<AbstractFormattingConfig.ElementLocator>
collectLocatorsForComments(java.util.Collection<AbstractFormattingConfig.ElementLocator> semanticLocators, org.eclipse.emf.ecore.EObject left, org.eclipse.emf.ecore.EObject right)
protected FormattingConfigBasedStream.Line
createLine()
protected FormattingConfigBasedStream.Line
createLine(int leftover)
protected FormattingConfigBasedStream.Line
createLine(java.util.List<FormattingConfigBasedStream.LineEntry> entries)
protected FormattingConfigBasedStream.Line
createLine(java.util.List<FormattingConfigBasedStream.LineEntry> initialEntries, int leftover)
FormattingConfigBasedStream.LineEntry
createLineEntry(org.eclipse.emf.ecore.EObject grammarElement, java.lang.String value, boolean isHidden, java.util.Set<AbstractFormattingConfig.ElementLocator> beforeLocators, java.lang.String leadingWS, int indent, ParserRule hiddenTokenDefition)
protected org.eclipse.xtext.util.Pair<java.lang.Integer,RuleCall>
findTopmostHiddenTokenDef()
void
flush()
protected java.lang.String
getLineSeparator()
protected java.lang.String
harmonizeLineSeparator(java.lang.String value)
void
init(ParserRule startRule)
void
writeHidden(org.eclipse.emf.ecore.EObject grammarElement, java.lang.String value)
void
writeSemantic(org.eclipse.emf.ecore.EObject grammarElement, java.lang.String value)
-
-
-
Field Detail
-
activeRangeLocators
protected java.util.Set<AbstractFormattingConfig.ElementLocator> activeRangeLocators
-
cfg
protected FormattingConfig cfg
-
currentLine
protected FormattingConfigBasedStream.Line currentLine
-
hiddenTokenHelper
protected IHiddenTokenHelper hiddenTokenHelper
-
indentationLevel
protected int indentationLevel
-
indentationPrefix
protected java.lang.String indentationPrefix
-
last
protected org.eclipse.emf.ecore.EObject last
-
matcher
protected IElementMatcherProvider.IElementMatcher<AbstractFormattingConfig.ElementPattern> matcher
-
preservedWS
protected java.lang.String preservedWS
-
preserveSpaces
protected boolean preserveSpaces
-
-
Constructor Detail
-
FormattingConfigBasedStream
public FormattingConfigBasedStream(ITokenStream out, java.lang.String initialIndentation, FormattingConfig cfg, IElementMatcherProvider.IElementMatcher<AbstractFormattingConfig.ElementPattern> matcher, IHiddenTokenHelper hiddenTokenHelper, boolean preserveSpaces)
-
-
Method Detail
-
getLineSeparator
protected java.lang.String getLineSeparator()
- Since:
- 2.3
-
addLineEntry
protected void addLineEntry(org.eclipse.emf.ecore.EObject grammarElement, java.lang.String value, boolean isHidden) throws java.io.IOException
- Throws:
java.io.IOException
-
collectLocators
protected java.util.Set<AbstractFormattingConfig.ElementLocator> collectLocators(org.eclipse.emf.ecore.EObject ele)
-
collectLocatorsForComments
protected java.util.Set<AbstractFormattingConfig.ElementLocator> collectLocatorsForComments(java.util.Collection<AbstractFormattingConfig.ElementLocator> semanticLocators, org.eclipse.emf.ecore.EObject left, org.eclipse.emf.ecore.EObject right)
-
createLine
protected FormattingConfigBasedStream.Line createLine()
-
createLine
protected FormattingConfigBasedStream.Line createLine(int leftover)
-
createLine
protected FormattingConfigBasedStream.Line createLine(java.util.List<FormattingConfigBasedStream.LineEntry> entries)
-
createLine
protected FormattingConfigBasedStream.Line createLine(java.util.List<FormattingConfigBasedStream.LineEntry> initialEntries, int leftover)
-
createLineEntry
public FormattingConfigBasedStream.LineEntry createLineEntry(org.eclipse.emf.ecore.EObject grammarElement, java.lang.String value, boolean isHidden, java.util.Set<AbstractFormattingConfig.ElementLocator> beforeLocators, java.lang.String leadingWS, int indent, ParserRule hiddenTokenDefition)
-
findTopmostHiddenTokenDef
protected org.eclipse.xtext.util.Pair<java.lang.Integer,RuleCall> findTopmostHiddenTokenDef()
-
flush
public void flush() throws java.io.IOException
- Specified by:
flush
in interfaceITokenStream
- Overrides:
flush
in classBaseTokenStream
- Throws:
java.io.IOException
-
init
public void init(ParserRule startRule)
- Specified by:
init
in interfaceITokenStreamExtension
- Overrides:
init
in classBaseTokenStream
-
writeHidden
public void writeHidden(org.eclipse.emf.ecore.EObject grammarElement, java.lang.String value) throws java.io.IOException
- Specified by:
writeHidden
in interfaceITokenStream
- Overrides:
writeHidden
in classAbstractTokenStream
- Throws:
java.io.IOException
-
writeSemantic
public void writeSemantic(org.eclipse.emf.ecore.EObject grammarElement, java.lang.String value) throws java.io.IOException
- Specified by:
writeSemantic
in interfaceITokenStream
- Overrides:
writeSemantic
in classAbstractTokenStream
- Throws:
java.io.IOException
-
harmonizeLineSeparator
protected java.lang.String harmonizeLineSeparator(java.lang.String value)
- Since:
- 2.22
-
-