public override BlockState TryContinue(BlockProcessor processor, Block?block) { if (!processor.IsCodeIndent || processor.IsBlankLine) { if (block is null || !processor.IsBlankLine) { if (block != null) { var codeBlock = (CodeBlock)block; // add trailing blank lines to blank lines stack of processor for (int i = codeBlock.Lines.Count - 1; i >= 0; i--) { var line = codeBlock.Lines.Lines[i]; if (line.Slice.IsEmpty) { codeBlock.Lines.RemoveAt(i); if (processor.TrackTrivia) { processor.LinesBefore ??= new List <StringSlice>(); processor.LinesBefore.Add(line.Slice); } } else { break; } } } return(BlockState.None); } } // If we don't have a blank line, we reset to the indent if (processor.Indent > 4) { processor.GoToCodeIndent(); } if (block != null) { block.UpdateSpanEnd(processor.Line.End); // lines var cb = (CodeBlock)block; var codeBlockLine = new CodeBlockLine(); cb.CodeBlockLines.Add(codeBlockLine); if (processor.TrackTrivia) { codeBlockLine.TriviaBefore = processor.UseTrivia(processor.Start - 1); cb.NewLine = processor.Line.NewLine; // ensure block newline is last newline } } return(BlockState.Continue); }
public override BlockState TryContinue(BlockProcessor processor, Block block) { if (!processor.IsCodeIndent || processor.IsBlankLine) { if (block == null || !processor.IsBlankLine) { return(BlockState.None); } } // If we don't have a blank line, we reset to the indent if (processor.Indent > 4) { processor.GoToCodeIndent(); } if (block != null) { block.UpdateSpanEnd(processor.Line.End); } return(BlockState.Continue); }