diff options
| author | Rémi Verschelde <rverschelde@gmail.com> | 2020-08-18 23:18:40 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-18 23:18:40 +0200 |
| commit | e2fb55471c0bdd4f25ed6448e5e8eff99882afa8 (patch) | |
| tree | 74976c55f9165fddb01ae52b587e3578f52a54d7 /modules/gdscript/gdscript_tokenizer.cpp | |
| parent | 65730ab9f6fbae34bb161113161b43f8b3fcd4d2 (diff) | |
| parent | 35176247af80626684ff6bb1a1eb3bc031857b1c (diff) | |
| download | redot-engine-e2fb55471c0bdd4f25ed6448e5e8eff99882afa8.tar.gz | |
Merge pull request #41359 from vnen/gdscript-2-fixes
Assorted fixes for GDScript bugs
Diffstat (limited to 'modules/gdscript/gdscript_tokenizer.cpp')
| -rw-r--r-- | modules/gdscript/gdscript_tokenizer.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript_tokenizer.cpp b/modules/gdscript/gdscript_tokenizer.cpp index 7a4bdd88ba..8ced06e2fd 100644 --- a/modules/gdscript/gdscript_tokenizer.cpp +++ b/modules/gdscript/gdscript_tokenizer.cpp @@ -156,6 +156,18 @@ const char *GDScriptTokenizer::Token::get_name() const { return token_names[type]; } +bool GDScriptTokenizer::Token::is_identifier() const { + // Note: Most keywords should not be recognized as identifiers. + // These are only exceptions for stuff that already is on the engine's API. + switch (type) { + case IDENTIFIER: + case MATCH: // Used in String.match(). + return true; + default: + return false; + } +} + String GDScriptTokenizer::get_token_name(Token::Type p_token_type) { ERR_FAIL_INDEX_V_MSG(p_token_type, Token::TK_MAX, "<error>", "Using token type out of the enum."); return token_names[p_token_type]; |
