public FormattingContext(AbstractFormatEngine engine, TokenStream tokenStream) { Contract.ThrowIfNull(engine); Contract.ThrowIfNull(tokenStream); _engine = engine; _tokenStream = tokenStream; _relativeIndentationTree = new ContextIntervalTree <RelativeIndentationData, FormattingContextIntervalIntrospector>(new FormattingContextIntervalIntrospector()); _indentationTree = new ContextIntervalTree <IndentationData, FormattingContextIntervalIntrospector>(new FormattingContextIntervalIntrospector()); _suppressWrappingTree = new ContextIntervalTree <SuppressWrappingData, SuppressIntervalIntrospector>(new SuppressIntervalIntrospector()); _suppressSpacingTree = new ContextIntervalTree <SuppressSpacingData, SuppressIntervalIntrospector>(new SuppressIntervalIntrospector()); _suppressFormattingTree = new ContextIntervalTree <SuppressSpacingData, SuppressIntervalIntrospector>(new SuppressIntervalIntrospector()); _anchorTree = new ContextIntervalTree <AnchorData, FormattingContextIntervalIntrospector>(new FormattingContextIntervalIntrospector()); _anchorBaseTokenMap = new Dictionary <SyntaxToken, AnchorData>(); _indentationMap = new HashSet <TextSpan>(); _suppressWrappingMap = new HashSet <TextSpan>(); _suppressSpacingMap = new HashSet <TextSpan>(); _suppressFormattingMap = new HashSet <TextSpan>(); _anchorMap = new HashSet <TextSpan>(); _initialIndentBlockOperations = new List <IndentBlockOperation>(); }
public FormattingContext(AbstractFormatEngine engine, TokenStream tokenStream, string language) { Contract.ThrowIfNull(engine); Contract.ThrowIfNull(tokenStream); this.engine = engine; this.tokenStream = tokenStream; this.language = language; this.relativeIndentationTree = new ContextIntervalTree <RelativeIndentationData>(this); this.indentationTree = new ContextIntervalTree <IndentationData>(this); this.suppressWrappingTree = new ContextIntervalTree <SuppressWrappingData>(SuppressIntervalIntrospector.Instance); this.suppressSpacingTree = new ContextIntervalTree <SuppressSpacingData>(SuppressIntervalIntrospector.Instance); this.anchorTree = new ContextIntervalTree <AnchorData>(this); this.anchorBaseTokenMap = new Dictionary <SyntaxToken, AnchorData>(); this.indentationMap = new HashSet <TextSpan>(); this.suppressWrappingMap = new HashSet <TextSpan>(); this.suppressSpacingMap = new HashSet <TextSpan>(); this.anchorMap = new HashSet <TextSpan>(); this.initialIndentBlockOperations = new List <IndentBlockOperation>(); }