CodeHighlighter

Inherits: SyntaxHighlighter < Resource < RefCounted < Object

A syntax highlighter for code.

Description

A syntax highlighter for code.

Properties

Dictionary

color_regions

{}

Color

function_color

Color(0, 0, 0, 1)

Dictionary

keyword_colors

{}

Dictionary

member_keyword_colors

{}

Color

member_variable_color

Color(0, 0, 0, 1)

Color

number_color

Color(0, 0, 0, 1)

Color

symbol_color

Color(0, 0, 0, 1)

Methods

void

add_color_region ( String start_key, String end_key, Color color, bool line_only=false )

void

add_keyword_color ( String keyword, Color color )

void

add_member_keyword_color ( String member_keyword, Color color )

void

clear_color_regions ( )

void

clear_keyword_colors ( )

void

clear_member_keyword_colors ( )

Color

get_keyword_color ( String keyword ) const

Color

get_member_keyword_color ( String member_keyword ) const

bool

has_color_region ( String start_key ) const

bool

has_keyword_color ( String keyword ) const

bool

has_member_keyword_color ( String member_keyword ) const

void

remove_color_region ( String start_key )

void

remove_keyword_color ( String keyword )

void

remove_member_keyword_color ( String member_keyword )

Property Descriptions

Default

{}

Setter

set_color_regions(value)

Getter

get_color_regions()

Sets the color regions. All existing regions will be removed. The Dictionary key is the region start and end key, separated by a space. The value is the region color.


Default

Color(0, 0, 0, 1)

Setter

set_function_color(value)

Getter

get_function_color()

Sets color for functions. A function is a non-keyword string followed by a '('.


Default

{}

Setter

set_keyword_colors(value)

Getter

get_keyword_colors()

Sets the keyword colors. All existing keywords will be removed. The Dictionary key is the keyword. The value is the keyword color.


Default

{}

Setter

set_member_keyword_colors(value)

Getter

get_member_keyword_colors()

Sets the member keyword colors. All existing member keyword will be removed. The Dictionary key is the member keyword. The value is the member keyword color.


  • Color member_variable_color

Default

Color(0, 0, 0, 1)

Setter

set_member_variable_color(value)

Getter

get_member_variable_color()

Sets color for member variables. A member variable is non-keyword, non-function string proceeded with a '.'.


Default

Color(0, 0, 0, 1)

Setter

set_number_color(value)

Getter

get_number_color()

Sets the color for numbers.


Default

Color(0, 0, 0, 1)

Setter

set_symbol_color(value)

Getter

get_symbol_color()

Sets the color for symbols.

Method Descriptions

Adds a color region such as comments or strings.

Both the start and end keys must be symbols. Only the start key has to be unique.

Line only denotes if the region should continue until the end of the line or carry over on to the next line. If the end key is blank this is automatically set to true.


  • void add_keyword_color ( String keyword, Color color )

Sets the color for a keyword.

The keyword cannot contain any symbols except '_'.


  • void add_member_keyword_color ( String member_keyword, Color color )

Sets the color for a member keyword.

The member keyword cannot contain any symbols except '_'.

It will not be highlighted if preceded by a '.'.


  • void clear_color_regions ( )

Removes all color regions.


  • void clear_keyword_colors ( )

Removes all keywords.


  • void clear_member_keyword_colors ( )

Removes all member keywords.


Returns the color for a keyword.


  • Color get_member_keyword_color ( String member_keyword ) const

Returns the color for a member keyword.


  • bool has_color_region ( String start_key ) const

Return true if the start key exists, else false.


Return true if the keyword exists, else false.


  • bool has_member_keyword_color ( String member_keyword ) const

Return true if the member keyword exists, else false.


  • void remove_color_region ( String start_key )

Removes the color region that uses that start key.


  • void remove_keyword_color ( String keyword )

Removes the keyword.


  • void remove_member_keyword_color ( String member_keyword )

Removes the member keyword.