Prism Ruby parser
Loading...
Searching...
No Matches
Enumerations | Functions
string_query.h File Reference

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>
Include dependency graph for string_query.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  pm_string_query_t { PM_STRING_QUERY_ERROR = -1 , PM_STRING_QUERY_FALSE , PM_STRING_QUERY_TRUE }
 Represents the results of a slice query. More...
 

Functions

PRISM_EXPORTED_FUNCTION pm_string_query_t pm_string_query_local (const uint8_t *source, size_t length, const char *encoding_name) 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) 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) PRISM_NONNULL(1
 Check that the slice is a valid method name.
 

Detailed Description

Functions for querying properties of strings, such as whether they are valid local variable names, constant names, or method names.

Enumeration Type Documentation

◆ pm_string_query_t

Represents the results of a slice query.

Enumerator
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.

Function Documentation

◆ 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 
)

Check that the slice is a valid local variable name.

Parameters
sourceThe source to check.
lengthThe length of the source.
encoding_nameThe name of the encoding of the source.
Returns
PM_STRING_QUERY_TRUE if the query is true, PM_STRING_QUERY_FALSE if the query is false, and PM_STRING_QUERY_ERROR if the encoding 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 
)

Check that the slice is a valid constant name.

Parameters
sourceThe source to check.
lengthThe length of the source.
encoding_nameThe name of the encoding of the source.
Returns
PM_STRING_QUERY_TRUE if the query is true, PM_STRING_QUERY_FALSE if the query is false, and PM_STRING_QUERY_ERROR if the encoding was invalid.

◆ pm_string_query_method_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 
)

Check that the slice is a valid method name.

Parameters
sourceThe source to check.
lengthThe length of the source.
encoding_nameThe name of the encoding of the source.
Returns
PM_STRING_QUERY_TRUE if the query is true, PM_STRING_QUERY_FALSE if the query is false, and PM_STRING_QUERY_ERROR if the encoding was invalid.