25 static void impl_parse_ExpressionTupleValues(
31 impl_parse_tuple_operation_expression_tuple_with_variables(
36 impl_parse_tuple_operation_lambda_function(
51 impl_parse_tuple_operation_list(
56 impl_parse_tuple_operation_object(
61 impl_parse_tuple_operation_property_reference(
66 impl_parse_tuple_operation_template(
71 impl_parse_tuple_operation_variable_reference(
76 impl_parse_tuple_operation_expression(
114 afw_compile_save_cursor(start_offset);
116 afw_compile_get_token();
118 if (!afw_compile_token_is(open_bracket)) {
122 save_hybrid_start_offset = parser->hybrid_start_offset;
123 parser->hybrid_start_offset = parser->cursor - 1;
126 annotation = afw_compile_parse_ExpressionTupleAnnotation(parser);
129 result = afw_compile_parse_ExpressionTupleOperation(parser);
134 afw_compile_create_contextual_to_cursor(start_offset),
137 parser->p, parser->xctx);
141 afw_compile_get_token();
142 if (!afw_compile_token_is(close_bracket)) {
147 parser->hybrid_start_offset = save_hybrid_start_offset;
162 afw_compile_get_token();
164 if (afw_compile_token_is(
null)) {
168 if (afw_compile_token_is(open_brace)) {
169 afw_compile_reuse_token();
170 return afw_compile_parse_Object(parser,
true,
true);
190 impl_parse_tuple_operation_expression_tuple_with_variables(
199 start_offset = parser->hybrid_start_offset;
200 start_nelts = parser->values->nelts;
202 afw_compile_get_token();
203 if (!afw_compile_token_is(comma)) {
207 afw_compile_get_token();
208 if (!afw_compile_token_is(open_bracket)) {
212 afw_compile_get_token();
213 if (!afw_compile_token_is(close_bracket)) {
216 if (!afw_compile_token_is(utf8_string)) {
226 parser->p, parser->xctx);
228 afw_compile_get_token();
229 if (!afw_compile_token_is(comma)) {
234 afw_compile_parse_ExpressionTupleValue(parser);
236 afw_compile_get_token();
237 if (afw_compile_token_is(close_bracket)) {
240 if (!afw_compile_token_is(comma)) {
243 afw_compile_get_token();
249 (parser->values->nelts - start_nelts) *
252 memcpy((
void *)assignments,
254 (parser->values->nelts - start_nelts) *
256 parser->values->nelts = start_nelts;
258 afw_compile_get_token();
259 if (!afw_compile_token_is(comma)) {
263 expression_tuple = afw_compile_parse_ExpressionTupleValue(parser);
266 afw_compile_create_contextual_to_cursor(start_offset),
267 assignments, expression_tuple,
268 parser->p, parser->xctx);
286 afw_compile_get_token();
287 if (!afw_compile_token_is(utf8_string)) {
294 s = parser->token->string->s;
295 len = parser->token->string->len;
296 memset(&s2, 0,
sizeof(s2));
297 for (s1.s = s; len > 0 && *s !=
' '; s++, len--);
301 for (s2.s = s; len > 0 && *s !=
' '; s++, len--);
314 parameter->type = type;
316 data_type_id, parser->xctx);
341 start_nelts = parser->values->nelts;
342 afw_compile_save_offset(start_offset);
344 afw_compile_get_token();
345 if (!afw_compile_token_is(open_bracket)) {
349 afw_compile_get_token();
350 if (!afw_compile_token_is(close_bracket)) {
351 afw_compile_parse_link_new_value_block(parser, start_offset);
352 afw_compile_reuse_token();
354 parameter = impl_parse_tuple_lambda_type(parser);
356 afw_compile_get_token();
357 if (!afw_compile_token_is(comma)) {
361 afw_compile_get_token();
362 if (!afw_compile_token_is(utf8_string)) {
367 parser->p, parser->xctx);
369 afw_compile_parse_add_symbol_entry(parser,
370 parser->token->string);
375 afw_compile_get_token();
376 if (afw_compile_token_is(close_bracket)) {
380 if (!afw_compile_token_is(comma)) {
386 *count = parser->values->nelts - start_nelts;
397 parser->values->nelts = start_nelts;
416 impl_parse_tuple_operation_lambda_function(
425 start_offset = parser->hybrid_start_offset;
427 afw_compile_get_token();
428 if (!afw_compile_token_is(comma)) {
432 returns = impl_parse_tuple_lambda_type(parser);
434 afw_compile_get_token();
435 if (!afw_compile_token_is(comma)) {
439 impl_parse_tuple_lambda_parameters(parser, &count, ¶meters);
441 afw_compile_get_token();
442 if (!afw_compile_token_is(comma)) {
446 body = afw_compile_parse_ExpressionTupleValue(parser);
449 afw_compile_parse_pop_value_block(parser);
453 afw_compile_create_contextual_to_cursor(start_offset),
454 returns->type, count, parameters, body, parser->p, parser->xctx);
469 impl_parse_tuple_operation_list(
483 afw_compile_get_token();
484 if (afw_compile_token_is(close_bracket)) {
485 afw_compile_reuse_token();
490 if (!afw_compile_token_is(comma)) {
495 value = afw_compile_parse_ExpressionTupleValue(parser);
519 impl_parse_tuple_operation_object(
534 afw_compile_get_token();
535 if (afw_compile_token_is(close_bracket)) {
536 afw_compile_reuse_token();
539 if (!afw_compile_token_is(comma)) {
544 afw_compile_get_token();
545 if (!afw_compile_token_is(utf8_string)) {
549 parser->p, parser->xctx);
552 afw_compile_get_token();
553 if (!afw_compile_token_is(comma)) {
558 value = afw_compile_parse_ExpressionTupleValue(parser);
585 impl_parse_tuple_operation_property_reference(
593 start_offset = parser->hybrid_start_offset;
596 afw_compile_get_token();
597 if (!afw_compile_token_is(comma)) {
603 afw_compile_get_token();
604 if (afw_compile_token_is(utf8_string)) {
606 parser->p, parser->xctx);
609 afw_compile_reuse_token();
610 key = afw_compile_parse_ExpressionTupleValue(parser);
614 afw_compile_get_token();
615 if (!afw_compile_token_is(comma)) {
620 object_value = afw_compile_parse_ExpressionTupleObject(parser);
624 afw_compile_create_contextual_to_cursor(start_offset),
625 object_value, key, parser->p, parser->xctx);
641 impl_parse_tuple_operation_script(
644 afw_compile_get_token();
645 if (!afw_compile_token_is(comma)) {
649 afw_compile_get_token();
650 if (!afw_compile_token_is(utf8_string)) {
657 afw_compile_type_script,
658 parser->compiled_value, parser->shared, NULL, parser->xctx);
673 impl_parse_tuple_operation_template(
676 afw_compile_get_token();
677 if (!afw_compile_token_is(comma)) {
681 afw_compile_get_token();
682 if (!afw_compile_token_is(utf8_string)) {
689 afw_compile_type_template,
690 parser->compiled_value, parser->shared, NULL, parser->xctx);
706 impl_parse_tuple_operation_variable_reference(
715 start_offset = parser->hybrid_start_offset;
717 afw_compile_get_token();
718 if (!afw_compile_token_is(comma)) {
722 afw_compile_get_token();
723 if (!afw_compile_token_is(utf8_string)) {
727 memset(&qualifier, 0,
sizeof(qualifier));
728 for (s = name.s, len = name.len; len > 0; len--, s++) {
730 if (len < 2 || *(s + 1) !=
':') {
733 qualifier.len = s - name.s;
734 qualifier.s = name.s;
736 name.len -= qualifier.len + 2;
742 afw_compile_create_contextual_to_cursor(start_offset),
743 &qualifier, &name, parser->p, parser->xctx);
759 impl_parse_tuple_operation_expression(
762 afw_compile_get_token();
763 if (!afw_compile_token_is(comma)) {
767 afw_compile_get_token();
768 if (!afw_compile_token_is(utf8_string)) {
775 afw_compile_type_expression,
776 parser->compiled_value, parser->shared, NULL, parser->xctx);
795 afw_compile_get_token();
796 if (afw_compile_token_is(open_brace)) {
797 afw_compile_reuse_token();
798 result = afw_compile_parse_Object(parser,
true,
true);
801 afw_compile_reuse_token();
802 result = afw_compile_parse_ExpressionTuple(parser);
840 afw_compile_get_token();
841 if (!afw_compile_token_is(comma)) {
845 afw_compile_get_token();
846 if (!afw_compile_token_is(utf8_string)) {
850 if (parser->token->string->len < 1) {
864 &afw_s_a_tuple_operation_call_adaptive_function))
866 contextual = afw_compile_create_contextual_to_cursor(parser->hybrid_start_offset);
867 afw_compile_get_token();
868 if (!afw_compile_token_is(comma)) {
873 afw_compile_get_token();
874 if (!afw_compile_token_is(utf8_string)) {
878 &qualifier, &name, parser->xctx);
881 &qualifier, &name, parser->xctx);
882 if (!function_value) {
883 AFW_COMPILE_THROW_ERROR_FZ(
889 impl_parse_ExpressionTupleValues(parser, function_value, &argc, &argv);
891 parser->p, parser->xctx);
908 &afw_s_a_tuple_operation_call))
910 contextual = afw_compile_create_contextual_to_cursor(parser->hybrid_start_offset);
911 afw_compile_get_token();
912 if (!afw_compile_token_is(comma)) {
920 afw_compile_get_token();
921 if (afw_compile_token_is(utf8_string)) {
922 function_value = afw_compile_parse_reference_create(parser,
923 contextual, parser->token->string);
928 function_value = afw_compile_parse_ExpressionTuple(parser);
932 impl_parse_ExpressionTupleValues(parser, function_value, &argc, &argv);
934 parser->p, parser->xctx);
947 &afw_s_a_tuple_operation_call_lambda_function))
949 contextual = afw_compile_create_contextual_to_cursor(parser->hybrid_start_offset);
950 afw_compile_get_token();
951 if (!afw_compile_token_is(comma)) {
956 afw_compile_get_token();
957 if (afw_compile_token_is(utf8_string)) {
958 function_value = afw_compile_parse_reference_create(parser,
959 contextual, parser->token->string);
961 AFW_COMPILE_THROW_ERROR_FZ(
962 "Use call or callA to call built-in function %"
970 function_value = afw_compile_parse_ExpressionTuple(parser);
974 impl_parse_ExpressionTupleValues(parser, function_value, &argc, &argv);
976 parser->p, parser->xctx);
981 &afw_s_a_tuple_operation_expression_tuple_with_variables))
984 impl_parse_tuple_operation_expression_tuple_with_variables(parser);
989 &afw_s_a_tuple_operation_lambda_function))
991 result = impl_parse_tuple_operation_lambda_function(parser);
996 &afw_s_a_tuple_operation_list))
998 result = impl_parse_tuple_operation_list(parser);
1003 &afw_s_a_tuple_operation_object))
1005 result = impl_parse_tuple_operation_object(parser);
1010 &afw_s_a_tuple_operation_property_reference))
1012 result = impl_parse_tuple_operation_property_reference(parser);
1017 &afw_s_a_tuple_operation_script))
1019 result = impl_parse_tuple_operation_script(parser);
1024 &afw_s_a_tuple_operation_template))
1026 result = impl_parse_tuple_operation_template(parser);
1031 &afw_s_a_tuple_operation_variable_reference))
1033 result = impl_parse_tuple_operation_variable_reference(parser);
1038 &afw_s_a_tuple_operation_expression))
1040 result = impl_parse_tuple_operation_expression(parser);
1069 start_nelts = parser->values->nelts;
1070 if (function_value) {
1071 APR_ARRAY_PUSH(parser->values,
const afw_value_t *) = function_value;
1074 afw_compile_get_token();
1075 if (afw_compile_token_is(close_bracket)) {
1076 afw_compile_reuse_token();
1079 if (!afw_compile_token_is(comma)) {
1082 APR_ARRAY_PUSH(parser->values,
const afw_value_t *) =
1083 afw_compile_parse_ExpressionTupleValue(parser);
1085 *argc = parser->values->nelts - start_nelts;
1091 ((
afw_value_t **)parser->values->elts) + start_nelts,
1095 parser->values->nelts = start_nelts;
1098 if (function_value) {
1110 afw_compile_get_token();
1112 if (afw_compile_token_is(open_bracket)) {
1113 afw_compile_reuse_token();
1114 result = afw_compile_parse_ExpressionTuple(parser);
1117 else if (afw_compile_token_is(open_brace)) {
1118 afw_compile_reuse_token();
1119 result = afw_compile_parse_Object(parser,
true,
true);
1122 else if (afw_compile_token_is(utf8_string)) {
1124 parser->token->string, parser->p, parser->xctx);
1127 else if (afw_compile_token_is(integer)) {
1129 parser->token->integer, parser->p, parser->xctx);
1132 else if (afw_compile_token_is(number)) {
1134 parser->token->number, parser->p, parser->xctx);
1137 else if (afw_compile_token_is(
boolean)) {
1139 parser->token->boolean, parser->p, parser->xctx);
1142 else if (afw_compile_token_is(
null)) {
1144 parser->token->null, parser->p, parser->xctx);
#define AFW_DEFINE_INTERNAL(type)
Define an internal function for /src/afw/ source*.c files.
Adaptive Framework Core Internal.
afw_value_create_boolean(afw_boolean_t internal, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for unmanaged data type boolean value.
afw_value_create_double(double internal, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for unmanaged data type double value.
afw_value_create_integer(afw_integer_t internal, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for unmanaged data type integer value.
afw_value_create_list(const afw_list_t *internal, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for unmanaged data type list value.
afw_value_create_null(void *internal, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for unmanaged data type null value.
afw_value_create_object(const afw_object_t *internal, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for unmanaged data type object value.
afw_value_create_string(const afw_utf8_t *internal, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for unmanaged data type string value.
#define AFW_UTF8_FMT_ARG(A_STRING)
Convenience Macro for use with AFW_UTF8_FMT to specify arg.
#define AFW_UTF8_FMT
Format string specifier used for afw_utf8_t.
char afw_utf8_octet_t
8 bits of utf-8 codepoint.
apr_size_t afw_size_t
size_t.
#define AFW_COMPILE_THROW_ERROR_Z(message_z)
#define afw_compile_to_value(string, source_location, compile_type, parent, shared, p, xctx)
Compile string to adaptive value.
afw_compile_split_qualified_name(const afw_utf8_t *qualified_name, afw_utf8_t *qualifier, afw_utf8_t *name, afw_xctx_t *xctx)
Split name with optional qualifier.
afw_environment_get_qualified_function(const afw_utf8_t *qualifier, const afw_utf8_t *name, afw_xctx_t *xctx)
Get the qualified function instance.
const afw_data_type_t * afw_environment_get_data_type(const afw_utf8_t *type, afw_xctx_t *xctx)
Get the data_type associated with configuration entry type.
#define afw_list_create_generic(p, xctx)
Create an value list in memory.
afw_list_add_value(const afw_list_t *instance, const afw_value_t *value, afw_xctx_t *xctx)
Call method add_value of interface afw_list_setter.
#define afw_memory_copy(to, from)
Copy to preallocated memory of same type.
#define afw_object_create_managed(p, xctx)
Create an empty entity object in its own pool.
afw_object_set_property(const afw_object_t *instance, const afw_utf8_t *property_name, const afw_value_t *value, afw_xctx_t *xctx)
Set the value of an object's property.
#define afw_pool_malloc(instance, size, xctx)
Call method malloc of interface afw_pool.
#define afw_pool_calloc_type(instance, type, xctx)
Macro to allocate cleared memory to hold type in pool.
afw_boolean_t afw_utf8_equal(const afw_utf8_t *s1, const afw_utf8_t *s2)
Check to see if a string equals another string.
const afw_utf8_t * afw_utf8_clone(const afw_utf8_t *string, const afw_pool_t *p, afw_xctx_t *xctx)
Clone a utf-8 string into a specific pool.
const afw_value_t * afw_value_expression_definition_create(const afw_compile_value_contextual_t *contextual, const afw_value_assignment_t *const *assignments, const afw_value_t *value, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for expression definition value.
const afw_value_t * afw_value_annotated_create(const afw_compile_value_contextual_t *contextual, const afw_value_t *value, const afw_object_t *annotation, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for annotated value.
const afw_value_t * afw_value_script_function_definition_create(const afw_compile_value_contextual_t *contextual, const afw_value_type_t *returns, afw_size_t count, const afw_value_script_function_parameter_t **parameters, const afw_value_t *body, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for lambda definition value.
#define afw_value_is_function_definition(A_VALUE)
Macro to determine if value is a function definition.
const afw_value_t * afw_value_call_create(const afw_compile_value_contextual_t *contextual, afw_size_t argc, const afw_value_t *const *argv, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for call value.
const afw_value_t * afw_value_reference_by_key_create(const afw_compile_value_contextual_t *contextual, const afw_value_t *aggregate_value, const afw_value_t *key, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for reference_by_key value.
const afw_value_t * afw_value_qualified_variable_reference_create(const afw_compile_value_contextual_t *contextual, const afw_utf8_t *qualifier, const afw_utf8_t *name, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for variable reference value.
Contextual information provided in some values.
const afw_utf8_t * source_location
Source location.
Interface afw_list public struct.
Interface afw_object public struct.
NFC normalized UTF-8 string.
Struct for value assignment.
struct for data type object values.
Interface afw_value public struct.
Struct for script function parameter.
Type meta (data type, data type parameters, and value meta object.
const afw_data_type_t * data_type
data type or NULL.