ecs_parse_term

Function ecs_parse_term 

Source
pub unsafe extern "C" fn ecs_parse_term(
    world: *const ecs_world_t,
    name: *const c_char,
    expr: *const c_char,
    ptr: *const c_char,
    term_out: *mut ecs_term_t,
) -> *mut c_char
Expand description

Parse term in expression. This operation parses a single term in an expression and returns a pointer to the next term expression.

If the returned pointer points to the 0-terminator, the expression is fully parsed. The function would typically be called in a while loop:

const char *ptr = expr; while (ptr[0] && (ptr = ecs_parse_term(world, name, expr, ptr, &term))) { }

The operation does not attempt to find entity ids from the names in the expression. Use the ecs_term_resolve_ids function to resolve the identifiers in the parsed term.

The returned term will in most cases contain allocated resources, which should freed (or used) by the application. To free the resources for a term, use the ecs_term_free function.

The parser accepts expressions in the legacy string format.

@param world The world. @param name The name of the expression (optional, improves error logs) @param expr The expression to parse (optional, improves error logs) @param ptr The pointer to the current term (must be in expr). @param term_out Out parameter for the term. @return pointer to next term if successful, NULL if failed.