| 201 | } |
| 202 | |
| 203 | bool GDScriptTokenizer::Token::is_identifier() const { |
| 204 | /// @note Most keywords should not be recognized as identifiers. |
| 205 | /// These are only exceptions for stuff that already is on the engine's API. |
| 206 | switch (type) { |
| 207 | case IDENTIFIER: |
| 208 | case MATCH: // Used in String.match(). |
| 209 | case WHEN: // New keyword, avoid breaking existing code. |
| 210 | // Allow constants to be treated as regular identifiers. |
| 211 | case CONST_PI: |
| 212 | case CONST_INF: |
| 213 | case CONST_NAN: |
| 214 | case CONST_TAU: |
| 215 | return true; |
| 216 | default: |
| 217 | return false; |
| 218 | } |
| 219 | } |
| 220 | |
| 221 | bool GDScriptTokenizer::Token::is_node_name() const { |
| 222 | // This is meant to allow keywords with the $ notation, but not as general identifiers. |
no outgoing calls
no test coverage detected