Class ProgramIndenter
- Namespace
- RDCore.SDK.Formatting
- Assembly
- RDCore.SDK.dll
Indents the lines of a program of the platform's BASIC (BasicProgramText) as ModuleIndenter indents a module: a statement is
indented one level for each block it is in - an If, a Select Case, a loop, a With.
public static class ProgramIndenter
- Inheritance
-
ProgramIndenter
- Inherited Members
Remarks
A program's lines are the body of a procedure its text does not write (EntryPointName): the lines that are in no block are at the left, whatever IndentEntireProcedureBody says, and there is no procedure to space from another.
A line's number is not part of its indentation. A shell lists a program with its numbers right-aligned to the widest, so that the statements line up whatever the numbering: the indentation is that of the statement, after its number and the space that follows it.
Methods
Indent(IReadOnlyList<string>, Func<string, ModuleParseResult>, CodeFormattingOptions)
The statements of a program, each indented by the blocks it is in.
public static IReadOnlyList<string> Indent(IReadOnlyList<string> statements, Func<string, ModuleParseResult> parse, CodeFormattingOptions options)
Parameters
statementsIReadOnlyList<string>The statements, in the order of their line numbers, without their numbers; what whitespace they start with is not kept.
parseFunc<string, ModuleParseResult>Parses the text of a module: the program's statements as the body of its procedure.
optionsCodeFormattingOptionsHow code is indented.
Returns
- IReadOnlyList<string>
The statements, as many as there are and in their order, each with the indentation it has and its trailing text as it was; a program whose edits are not of its lines as they are - one that spans two lines - is returned as it was given.
Exceptions
- ArgumentNullException
statements,parseoroptionsis null.