Пример #1
0
 public IndentEngine(IDocument document, TextEditorOptions textEditorOptions, CSharpFormattingOptions formattingOptions)
 {
     this.Document          = document;
     this.Options           = formattingOptions;
     this.TextEditorOptions = textEditorOptions;
     this.CurrentState      = IndentStateFactory.Default(this);
 }
Пример #2
0
        /// <summary>
        ///     Resets the engine.
        /// </summary>
        public void Reset()
        {
            CurrentState = IndentStateFactory.Default(this);
            ConditionalSymbols.Clear();
            IfDirectiveEvalResult = false;
            CurrentIndent.Length  = 0;

            offset       = 0;
            line         = 1;
            column       = 1;
            IsLineStart  = true;
            CurrentChar  = '\0';
            PreviousChar = '\0';
        }
Пример #3
0
        /// <summary>
        ///     Creates a new CSharpIndentEngine instance.
        /// </summary>
        /// <param name="document">
        ///     An instance of <see cref="IDocument"/> which is being parsed.
        /// </param>
        /// <param name="formattingOptions">
        ///     C# formatting options.
        /// </param>
        /// <param name="textEditorOptions">
        ///    Text editor options for indentation.
        /// </param>
        public CSharpIndentEngine(IDocument document, TextEditorOptions textEditorOptions, CSharpFormattingOptions formattingOptions)
        {
            this.formattingOptions = formattingOptions;
            this.textEditorOptions = textEditorOptions;
            this.document          = document;

            this.currentState = IndentStateFactory.Default(this);

            this.conditionalSymbols       = new HashSet <string>();
            this.customConditionalSymbols = new HashSet <string>();
            this.wordToken       = new StringBuilder();
            this.previousKeyword = string.Empty;
            this.newLineChar     = textEditorOptions.EolMarker[0];
        }
Пример #4
0
        /// <inheritdoc />
        public void Reset()
        {
            currentState = IndentStateFactory.Default(this);
            conditionalSymbols.Clear();
            ifDirectiveEvalResult.Clear();

            offset                          = 0;
            line                            = 1;
            column                          = 1;
            isLineStart                     = true;
            currentChar                     = '\0';
            previousChar                    = '\0';
            currentIndent.Length            = 0;
            lineBeganInsideMultiLineComment = false;
            lineBeganInsideVerbatimString   = false;
        }