CodeHighlighter
继承: SyntaxHighlighter
< Resource
< RefCounted
< Object
A syntax highlighter intended for code.
描述
By adjusting various properties of this resource, you can change the colors of strings, comments, numbers, and other text patterns inside a TextEdit
control.
属性
Dictionary | color_regions |
Color | function_color |
Dictionary | keyword_colors |
Dictionary | member_keyword_colors |
Color | member_variable_color |
Color | number_color |
Color | symbol_color |
方法
void | add_color_region ( start_key: String , end_key: String , color: Color , line_only: bool = false ) |
void | add_keyword_color ( keyword: String , color: Color ) |
void | add_member_keyword_color ( member_keyword: String , color: Color ) |
void | clear_color_regions ( ) |
void | clear_keyword_colors ( ) |
void | clear_member_keyword_colors ( ) |
Color | get_keyword_color ( keyword: String ) const1 |
Color | get_member_keyword_color ( member_keyword: String ) const1 |
bool | has_color_region ( start_key: String ) const1 |
bool | has_keyword_color ( keyword: String ) const1 |
bool | has_member_keyword_color ( member_keyword: String ) const1 |
void | remove_color_region ( start_key: String ) |
void | remove_keyword_color ( keyword: String ) |
void | remove_member_keyword_color ( member_keyword: String ) |
属性说明
Dictionary
color_regions = {}
void
set_color_regions ( value:Dictionary
)Dictionary
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.
Color
function_color = Color(0, 0, 0, 1)
Sets color for functions. A function is a non-keyword string followed by a '('.
Dictionary
keyword_colors = {}
void
set_keyword_colors ( value:Dictionary
)Dictionary
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.
Dictionary
member_keyword_colors = {}
void
set_member_keyword_colors ( value:Dictionary
)Dictionary
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 = Color(0, 0, 0, 1)
Sets color for member variables. A member variable is non-keyword, non-function string proceeded with a '.'.
Color
number_color = Color(0, 0, 0, 1)
Sets the color for numbers.
Color
symbol_color = Color(0, 0, 0, 1)
Sets the color for symbols.
方法说明
void
add_color_region ( start_key: String
, end_key: String
, color: Color
, line_only: bool
= false )
Adds a color region (such as for comments or strings) from start_key
to end_key
. Both keys should be symbols, and start_key
must not be shared with other delimiters.
If line_only
is true
or end_key
is an empty String
, the region does not carry over to the next line.
void
add_keyword_color ( keyword: String
, color: Color
)
Sets the color for a keyword.
The keyword cannot contain any symbols except '_'.
void
add_member_keyword_color ( member_keyword: String
, 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.
Color
get_keyword_color ( keyword: String
) const1
Returns the color for a keyword.
Color
get_member_keyword_color ( member_keyword: String
) const1
Returns the color for a member keyword.
bool
has_color_region ( start_key: String
) const1
Returns true
if the start key exists, else false
.
bool
has_keyword_color ( keyword: String
) const1
Returns true
if the keyword exists, else false
.
bool
has_member_keyword_color ( member_keyword: String
) const1
Returns true
if the member keyword exists, else false
.
void
remove_color_region ( start_key: String
)
Removes the color region that uses that start key.
void
remove_keyword_color ( keyword: String
)
Removes the keyword.
void
remove_member_keyword_color ( member_keyword: String
)
Removes the member keyword.
本方法通常需要用户覆盖才能生效。
本方法无副作用,不会修改该实例的任何成员变量。
本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。
本方法用于构造某个类型。
调用本方法无需实例,可直接使用类名进行调用。
本方法描述的是使用本类型作为左操作数的有效运算符。
这个值是由下列位标志构成位掩码的整数。
无返回值。