Functions for querying properties of strings, such as whether they are valid local variable names, constant names, or method names.
More...
#include "prism/compiler/exported.h"
#include "prism/compiler/nonnull.h"
#include <stddef.h>
#include <stdint.h>
Go to the source code of this file.
|
| PRISM_EXPORTED_FUNCTION pm_string_query_t | pm_string_query_local (const uint8_t *source, size_t length, const char *encoding_name, const char *version) PRISM_NONNULL(1 |
| | Check that the slice is a valid local variable name.
|
| PRISM_EXPORTED_FUNCTION pm_string_query_t PRISM_EXPORTED_FUNCTION pm_string_query_t | pm_string_query_constant (const uint8_t *source, size_t length, const char *encoding_name, const char *version) PRISM_NONNULL(1 |
| | Check that the slice is a valid constant name.
|
| PRISM_EXPORTED_FUNCTION pm_string_query_t PRISM_EXPORTED_FUNCTION pm_string_query_t PRISM_EXPORTED_FUNCTION pm_string_query_t | pm_string_query_method_name (const uint8_t *source, size_t length, const char *encoding_name, const char *version) PRISM_NONNULL(1 |
| | Check that the slice is a valid method name.
|
| PRISM_EXPORTED_FUNCTION pm_string_query_t PRISM_EXPORTED_FUNCTION pm_string_query_t PRISM_EXPORTED_FUNCTION pm_string_query_t PRISM_EXPORTED_FUNCTION pm_string_query_t | pm_string_query_keyword (const uint8_t *source, size_t length, const char *encoding_name, const char *version) PRISM_NONNULL(1 |
| | Check that the slice is a keyword.
|
Functions for querying properties of strings, such as whether they are valid local variable names, constant names, or method names.
◆ pm_string_query_t
Represents the results of a slice query.
| Enumerator |
|---|
| PM_STRING_QUERY_ERROR_VERSION | Returned if the version given to a slice query was invalid.
|
| PM_STRING_QUERY_ERROR | Returned if the encoding given to a slice query was invalid.
|
| PM_STRING_QUERY_FALSE | Returned if the result of the slice query is false.
|
| PM_STRING_QUERY_TRUE | Returned if the result of the slice query is true.
|
◆ pm_string_query_local()
| PRISM_EXPORTED_FUNCTION pm_string_query_t pm_string_query_local |
( |
const uint8_t * | source, |
|
|
size_t | length, |
|
|
const char * | encoding_name, |
|
|
const char * | version ) |
Check that the slice is a valid local variable name.
- Parameters
-
| source | The source to check. |
| length | The length of the source. |
| encoding_name | The name of the encoding of the source. |
| version | The version of Ruby to answer for, as pm_options_version_set reads it, such as "3.4" or "latest". NULL is the latest version. |
- Returns
- PM_STRING_QUERY_TRUE if the query is true, PM_STRING_QUERY_FALSE if the query is false, PM_STRING_QUERY_ERROR if the encoding was invalid, and PM_STRING_QUERY_ERROR_VERSION if the version was invalid.
◆ pm_string_query_constant()
| PRISM_EXPORTED_FUNCTION pm_string_query_t PRISM_EXPORTED_FUNCTION pm_string_query_t pm_string_query_constant |
( |
const uint8_t * | source, |
|
|
size_t | length, |
|
|
const char * | encoding_name, |
|
|
const char * | version ) |
Check that the slice is a valid constant name.
- Parameters
-
| source | The source to check. |
| length | The length of the source. |
| encoding_name | The name of the encoding of the source. |
| version | The version of Ruby to answer for, as pm_options_version_set reads it, such as "3.4" or "latest". NULL is the latest version. |
- Returns
- PM_STRING_QUERY_TRUE if the query is true, PM_STRING_QUERY_FALSE if the query is false, PM_STRING_QUERY_ERROR if the encoding was invalid, and PM_STRING_QUERY_ERROR_VERSION if the version was invalid.
◆ pm_string_query_method_name()
Check that the slice is a valid method name.
- Parameters
-
| source | The source to check. |
| length | The length of the source. |
| encoding_name | The name of the encoding of the source. |
| version | The version of Ruby to answer for, as pm_options_version_set reads it, such as "3.4" or "latest". NULL is the latest version. |
- Returns
- PM_STRING_QUERY_TRUE if the query is true, PM_STRING_QUERY_FALSE if the query is false, PM_STRING_QUERY_ERROR if the encoding was invalid, and PM_STRING_QUERY_ERROR_VERSION if the version was invalid.
◆ pm_string_query_keyword()
Check that the slice is a keyword.
- Parameters
-
| source | The source to check. |
| length | The length of the source. |
| encoding_name | The name of the encoding of the source. |
| version | The version of Ruby to answer for, as pm_options_version_set reads it, such as "3.4" or "latest". NULL is the latest version. |
- Returns
- PM_STRING_QUERY_TRUE if the query is true, PM_STRING_QUERY_FALSE if the query is false, PM_STRING_QUERY_ERROR if the encoding was invalid, and PM_STRING_QUERY_ERROR_VERSION if the version was invalid.