import { LineResults } from "../LineResults" ; import { CommandNames } from "../Names/CommandNames" ; import { Command } from "./Command" ; import { CommandResult } from "./CommandResult" ; import { CommandMetadata } from "./Metadata/CommandMetadata" ; import { addLineEnder } from "./Utilities" ; /**
 * Starts an else statement.
 */ export class ElseStartCommand extends Command { /**
     * Metadata on the command.
     */ private static metadata : CommandMetadata = new CommandMetadata ( CommandNames . ElseStart ) . withDescription ( "Starts an else statement" ) . withIndentation ( [ - 1 , 1 ] ) ; returns public getMetadata ( ) { return ElseStartCommand . metadata ; } param parameters returns public render ( parameters ) { const lines = [ new CommandResult ( "" , - 1 ) ] ; if ( ! this . language . syntax . style . separateBraceLines ) { lines [ 0 ] . text = "\0" ; lines . push ( new CommandResult ( "" , 0 ) ) ; } addLineEnder ( lines , this . language . syntax . conditionals . continueLeft , 0 ) ; lines [ lines . length - 1 ] . text += this . language . syntax . conditionals . else ; if ( this . language . syntax . style . separateBraceLines ) { lines . push ( new CommandResult ( "" , 1 ) ) ; } else { lines [ lines . length - 1 ] . indentation = 1 ; } lines [ lines . length - 1 ] . text += this . language . syntax . conditionals . continueRight ; return new LineResults ( lines ) ; } }