CodeFormatter

commands. CodeFormatter

A formatter for command code. Inherit from this class and override the desired methods to adjust the formatting.

Constructor

new CodeFormatter()

Source:

Methods

format(code) → {string}

Source:

Formats command code.

Parameters:
Name Type Description
code string

Command code to format.

Returns:

The formatted command code.

Type
string

formatCommand(text) → {string}

Source:

Formats a command name.

Parameters:
Name Type Description
text string

Command name.

Returns:

Formatted command name.

Type
string

formatComment(text) → {string}

Source:

Formats a comment.

Parameters:
Name Type Description
text string

Comment text.

Returns:

Formatted comment.

Type
string

formatIdentifier(text) → {string}

Source:

Formats an identifier.

Parameters:
Name Type Description
text string

Identifier.

Returns:

Formatted identifier.

Type
string

formatNumber(num) → {string}

Source:

Formats a number.

Parameters:
Name Type Description
num number

Number.

Returns:

Formatted number.

Type
string

formatParens(text) → {string}

Source:

Formats parenthesis.

Parameters:
Name Type Description
text string

Opening or closing parenthesis.

Returns:

Formatted parenthesis.

Type
string

formatSpace(text) → {string}

Source:

Formats a space (blanks or newlines).

Parameters:
Name Type Description
text string

Space.

Returns:

Formatted space.

Type
string

formatString(text) → {string}

Source:

Formats a string.

Parameters:
Name Type Description
text string

String.

Returns:

Formatted string.

Type
string

formatVariable(text) → {string}

Source:

Formats a variable.

Parameters:
Name Type Description
text string

Variable.

Returns:

Formatted variable.

Type
string