diff options
author | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2021-04-08 16:12:22 +0200 |
---|---|---|
committer | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2021-05-05 22:38:12 +0200 |
commit | e905e8f145ef5d91aa6f8200bf415569e28d5967 (patch) | |
tree | 8cc9416776879b9f719b2efdb402248ea5bb278d /modules/mono | |
parent | 758bccf364729474f8ffbcf15a0bb6e9bad02d9c (diff) |
Highlight control flow keywords with a different color
This makes them easier to distinguish from other keywords.
Diffstat (limited to 'modules/mono')
-rw-r--r-- | modules/mono/csharp_script.cpp | 20 | ||||
-rw-r--r-- | modules/mono/csharp_script.h | 1 |
2 files changed, 21 insertions, 0 deletions
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index 09f3ea1f50..ffb04bfd37 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -304,6 +304,26 @@ void CSharpLanguage::get_reserved_words(List<String> *p_words) const { } } +bool CSharpLanguage::is_control_flow_keyword(String p_keyword) const { + return p_keyword == "break" || + p_keyword == "case" || + p_keyword == "catch" || + p_keyword == "continue" || + p_keyword == "default" || + p_keyword == "do" || + p_keyword == "else" || + p_keyword == "finally" || + p_keyword == "for" || + p_keyword == "foreach" || + p_keyword == "goto" || + p_keyword == "if" || + p_keyword == "return" || + p_keyword == "switch" || + p_keyword == "throw" || + p_keyword == "try" || + p_keyword == "while"; +} + void CSharpLanguage::get_comment_delimiters(List<String> *p_delimiters) const { p_delimiters->push_back("//"); // single-line comment p_delimiters->push_back("/* */"); // delimited comment diff --git a/modules/mono/csharp_script.h b/modules/mono/csharp_script.h index dd93a86d7a..992c7e93c8 100644 --- a/modules/mono/csharp_script.h +++ b/modules/mono/csharp_script.h @@ -470,6 +470,7 @@ public: /* EDITOR FUNCTIONS */ void get_reserved_words(List<String> *p_words) const override; + bool is_control_flow_keyword(String p_keyword) const; void get_comment_delimiters(List<String> *p_delimiters) const override; void get_string_delimiters(List<String> *p_delimiters) const override; Ref<Script> get_template(const String &p_class_name, const String &p_base_class_name) const override; |