50 afw_compile_parse_List(
66 afw_compile_save_cursor(start_offset);
67 afw_compile_get_token();
68 if (!afw_compile_token_is(open_bracket)) {
69 afw_compile_reuse_token();
78 afw_compile_get_token();
79 if (!afw_compile_token_is(close_bracket)) {
80 afw_compile_reuse_token();
84 afw_compile_get_token();
85 if (allow_expression && afw_compile_token_is(ellipsis)) {
86 if ((parser)->compile_type == afw_compile_type_json ||
87 (parser)->compile_type == afw_compile_type_relaxed_json)
90 "'...' is not allowed as json list entry");
95 afw_compile_create_contextual_to_cursor(start_offset),
96 afw_compile_parse_Expression(parser),
97 parser->p, parser->xctx);
102 afw_compile_reuse_token();
105 if (allow_expression) {
106 entry = afw_compile_parse_Expression(parser);
108 else if (allow_enhanced_literals) {
109 entry = afw_compile_parse_Literal(parser,
113 entry = afw_compile_parse_Json(parser);
122 args = afw_compile_args_create(parser);
123 afw_compile_args_add_value(args,
128 for (iterator = NULL;;) {
130 parser->p, parser->xctx);
134 afw_compile_args_add_value(args, value);
142 afw_compile_args_add_value(args, entry);
159 afw_compile_get_token();
160 if (afw_compile_token_is(comma)) {
161 if (!parser->strict) {
162 afw_compile_get_token();
163 if (afw_compile_token_is(close_bracket)) {
166 afw_compile_reuse_token();
172 if (afw_compile_token_is(close_bracket)) {
178 "Array values must be separated with a comma");
184 afw_compile_args_finalize(args, &argc, &argv);
186 afw_compile_create_contextual_to_cursor(start_offset),
187 argc - 1, argv, parser->p, parser->xctx);
259 afw_compile_parse_Object(
278 afw_compile_save_cursor(start_offset);
279 afw_compile_get_token();
280 if (!afw_compile_token_is(open_brace)) {
281 afw_compile_reuse_token();
288 parser->embedding_object,
289 parser->property_name,
290 parser->doing_object_spread,
291 parser->cede_p, parser->p, parser->xctx);
295 is_object_expression =
false;
302 embedding_object = parser->embedding_object;
303 parser->embedding_object = obj;
304 property_name = parser->property_name;
305 parser->property_name = NULL;
308 afw_compile_get_token();
309 if (!afw_compile_token_is(close_brace)) {
310 afw_compile_reuse_token();
313 afw_compile_get_token();
314 parser->property_name = NULL;
316 if (parser->strict) {
317 if (afw_compile_token_is(utf8_string) &&
318 parser->token->string_quote_character ==
'"')
320 parser->property_name = parser->token->string;
324 else if (afw_compile_token_is(utf8_string)) {
325 parser->property_name = parser->token->string;
328 else if (afw_compile_token_is(identifier) &&
329 !parser->token->identifier_qualifier)
331 parser->property_name = parser->token->identifier_name;
335 if (allow_expression && afw_compile_token_is(ellipsis)) {
341 args = afw_compile_args_create(parser);
342 afw_compile_args_add_value(args,
344 if (is_object_expression) {
346 afw_compile_create_contextual_to_cursor(start_offset),
347 obj, parser->p, parser->xctx);
352 afw_compile_args_add_value(args, result);
353 is_object_expression =
false;
357 save_doing_object_spread = parser->doing_object_spread;
358 parser->doing_object_spread =
true;
359 v = afw_compile_parse_Expression(parser);
360 parser->doing_object_spread = save_doing_object_spread;
361 afw_compile_args_add_value(args, v);
369 if (!parser->property_name) {
374 afw_compile_get_token();
375 if (!afw_compile_token_is(colon)) {
377 "Name of an object value must be followed by a colon");
381 if (allow_expression) {
382 v = afw_compile_parse_Expression(parser);
384 else if (allow_enhanced_literals) {
385 v = afw_compile_parse_Literal(parser,
389 v = afw_compile_parse_Json(parser);
396 "_meta_ property must be an object");
409 parser->p, parser->xctx);
410 afw_compile_args_add_value(args,
412 parser->p, parser->xctx));
417 is_object_expression =
true;
427 afw_compile_get_token();
428 if (afw_compile_token_is(comma)) {
429 if (!parser->strict) {
430 afw_compile_get_token();
431 if (afw_compile_token_is(close_brace)) {
434 afw_compile_reuse_token();
440 if (afw_compile_token_is(close_brace))
break;
444 "Name/Value pairs must be separated with a comma");
450 afw_compile_args_finalize(args, &argc, &argv);
452 afw_compile_create_contextual_to_cursor(start_offset),
453 argc - 1, argv, parser->p, parser->xctx);
457 else if (is_object_expression) {
459 afw_compile_create_contextual_to_cursor(start_offset),
460 obj, parser->p, parser->xctx);
470 parser->embedding_object = embedding_object;
471 parser->property_name = property_name;
493 afw_compile_get_token();
495 switch (parser->token->type) {
497 case afw_compile_token_type_end:
500 case afw_compile_token_type_open_brace:
501 afw_compile_reuse_token();
502 value = afw_compile_parse_Object(parser,
false,
false);
505 case afw_compile_token_type_open_bracket:
506 afw_compile_reuse_token();
507 value = afw_compile_parse_List(parser,
false,
false);
510 case afw_compile_token_type_boolean:
511 value = (parser->token->boolean)
516 case afw_compile_token_type_integer:
518 parser->token->integer,
519 parser->p, parser->xctx);
522 case afw_compile_token_type_number:
524 parser->token->number,
525 parser->p, parser->xctx);
528 case afw_compile_token_type_utf8_string:
530 parser->p, parser->xctx);
533 case afw_compile_token_type_null:
537 case afw_compile_token_type_invalid:
544 afw_compile_reuse_token();
561 afw_compile_parse_Literal(
570 matches_production =
false;
573 afw_compile_get_token();
575 switch (parser->token->type) {
577 case afw_compile_token_type_end:
580 case afw_compile_token_type_open_brace:
581 afw_compile_reuse_token();
585 matches_production =
true;
586 value = afw_compile_parse_Object(parser,
false,
true);
589 case afw_compile_token_type_open_bracket:
590 afw_compile_reuse_token();
594 matches_production =
true;
595 value = afw_compile_parse_List(parser,
false,
true);
598 case afw_compile_token_type_boolean:
599 matches_production =
true;
600 value = (parser->token->boolean)
605 case afw_compile_token_type_integer:
606 matches_production =
true;
608 parser->token->integer,
609 parser->p, parser->xctx);
612 case afw_compile_token_type_number:
613 matches_production =
true;
615 parser->token->number,
616 parser->p, parser->xctx);
619 case afw_compile_token_type_utf8_string:
620 matches_production =
true;
622 parser->p, parser->xctx);
625 case afw_compile_token_type_null:
626 matches_production =
true;
630 case afw_compile_token_type_undefined:
631 matches_production =
true;
641 *is_Literal = matches_production;
645 if (must_be_literal && !matches_production) {
650 if (!matches_production) {
651 afw_compile_reuse_token();
682 value = afw_compile_parse_List(parser,
true,
true);
688 value = afw_compile_parse_Object(parser,
true,
true);
694 value = afw_compile_parse_Literal(parser, &is_Literal,
false,
true);
700 value = afw_compile_parse_Evaluation(parser);
706 if (afw_compile_peek_next_token_is(open_parenthesis)) {
707 value = afw_compile_parse_ParenthesizedExpression(parser);
712 if (afw_compile_peek_next_token_is(grave)) {
713 value = afw_compile_parse_TemplateString(parser);
#define AFW_DEFINE_INTERNAL(type)
Define an internal function for /src/afw/ source*.c files.
Adaptive Framework Core Internal.
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.
#define afw_value_is_object(A_VALUE)
Macro to determine if value is evaluated object.
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.
struct afw_iterator_s afw_iterator_t
struct afw_compile_internal_args_s afw_compile_args_t
apr_size_t afw_size_t
size_t.
#define AFW_COMPILE_THROW_ERROR_Z(message_z)
afw_function_definition_list
Adaptive Function length<list>
afw_function_definition_add_properties
Function definition add_properties.
#define afw_list_get_next_value(instance, iterator, p, xctx)
Call method get_next_value of interface afw_list.
#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_OBJECT_CREATE_ENTITY_OR_EMBEDDED(result, embedding_object, property_name, always_create_unmanaged, cede_p, entity_p, xctx)
Helper macro to create a new entity or embedded object.
#define afw_object_create(p, xctx)
Create an empty unmanaged object in memory.
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.
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.
afw_value_create_list_expression(const afw_compile_value_contextual_t *contextual, const afw_value_t *internal, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for list expression value.
afw_value_false
Adaptive value false.
#define afw_value_is_defined_and_evaluated(A_VALUE)
Macro to determine if value is defined and evaluated.
const afw_value_t * afw_value_call_built_in_function_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_built_in_function value.
afw_value_null
Adaptive value null.
afw_value_create_object_expression(const afw_compile_value_contextual_t *contextual, const afw_object_t *internal, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for object expression value.
afw_value_true
Adaptive value true.
Interface afw_list public struct.
Interface afw_object public struct.
NFC normalized UTF-8 string.
struct for data type object values.
Interface afw_value public struct.