32 afw_compile_parse_AssignmentListDestructureTarget(
42 afw_compile_get_token();
43 if (!afw_compile_token_is(ellipsis)) {
44 afw_compile_reuse_token();
45 ld->assignment_element = e =
46 afw_compile_parse_AssignmentElement(parser, assignment_type);
48 afw_compile_get_token();
49 if (afw_compile_token_is(comma)) {
50 afw_compile_get_token();
51 if (afw_compile_token_is(ellipsis)) {
54 afw_compile_reuse_token();
55 new_e = afw_compile_parse_AssignmentElement(parser,
60 else if (afw_compile_token_is(close_bracket)) {
69 if (afw_compile_token_is(ellipsis)) {
70 afw_compile_parse_AssignmentBindingTarget(parser,
71 assignment_type, &ld->rest_type, &ld->rest);
72 afw_compile_get_token();
75 if (!afw_compile_token_is(close_bracket)) {
90 afw_compile_parse_AssignmentElement(
98 if (afw_compile_peek_next_token_is(comma)) {
101 afw_compile_parse_AssignmentBindingTarget(parser,
102 assignment_type, &e->type, &e->assignment_target);
103 afw_compile_get_token();
104 if (afw_compile_token_is(equal)) {
105 e->default_value = afw_compile_parse_Expression(parser);
108 afw_compile_reuse_token();
132 afw_compile_parse_AssignmentObjectDestructureTarget(
142 afw_compile_get_token();
143 if (!afw_compile_token_is(ellipsis)) {
144 afw_compile_reuse_token();
145 od->assignment_property = ap =
146 afw_compile_parse_AssignmentProperty(parser, assignment_type);
148 afw_compile_get_token();
149 if (afw_compile_token_is(comma)) {
150 afw_compile_get_token();
151 if (afw_compile_token_is(ellipsis)) {
154 afw_compile_reuse_token();
155 new_ap = afw_compile_parse_AssignmentProperty(parser,
160 else if (afw_compile_token_is(close_brace)) {
169 if (afw_compile_token_is(ellipsis)) {
170 afw_compile_parse_AssignmentBindingTarget(parser,
171 assignment_type, &od->rest_type, &od->rest);
172 afw_compile_get_token();
175 if (!afw_compile_token_is(close_brace)) {
193 afw_compile_parse_AssignmentProperty(
216 afw_compile_get_token();
219 if (!afw_compile_token_is_unqualified_identifier()) {
222 identifier = parser->token->identifier_name;
225 afw_compile_get_token();
226 if (afw_compile_token_is(colon)) {
227 ap->is_rename =
true;
228 ap->property_name = identifier;
229 ap->assignment_element = afw_compile_parse_AssignmentElement(
230 parser, assignment_type);
235 contextual = afw_compile_create_contextual_to_cursor(
236 parser->token->token_source_offset);
237 ap->variable_reference = afw_compile_parse_variable_reference_create(
238 parser, contextual, assignment_type, identifier);
239 if (afw_compile_token_is(equal)) {
240 ap->default_value = afw_compile_parse_Expression(parser);
243 afw_compile_reuse_token();
264 afw_compile_parse_AssignmentBindingTarget(
274 contextual = afw_compile_create_contextual_to_cursor(
275 parser->token->token_source_offset);
277 afw_compile_get_token();
280 if (afw_compile_token_is(open_bracket)) {
283 target->assignment_type = assignment_type;
284 target->target_type =
285 afw_compile_assignment_target_type_list_destructure;
286 target->list_destructure =
287 afw_compile_parse_AssignmentListDestructureTarget(
288 parser, target->assignment_type);
290 contextual, target, parser->p, parser->xctx);
294 else if (afw_compile_token_is(open_brace)) {
297 target->assignment_type = assignment_type;
298 target->target_type =
299 afw_compile_assignment_target_type_object_destructure;
300 target->object_destructure =
301 afw_compile_parse_AssignmentObjectDestructureTarget(
302 parser, target->assignment_type);
304 contextual, target, parser->p, parser->xctx);
308 else if (assignment_type == afw_compile_assignment_type_assign_only)
310 afw_compile_reuse_token();
311 *value = afw_compile_parse_Reference(parser);
318 else if (afw_compile_token_is_unqualified_identifier() ||
319 afw_compile_token_is(open_parenthesis))
321 if (!afw_compile_token_is_unqualified_identifier()) {
325 variable_name = parser->token->identifier_name;
326 if (afw_compile_is_reserved_word(parser, variable_name)) {
328 "Variable name can not be a reserved word");
331 if (assignment_type == afw_compile_assignment_type_loc ||
332 assignment_type == afw_compile_assignment_type_const)
338 afw_compile_parse_variable_reference_create(
339 parser, contextual, assignment_type,
361 afw_compile_parse_AssignmentTarget(
369 afw_compile_parse_AssignmentBindingTarget(parser,
370 assignment_type, &type, &result);
372 assignment_type != afw_compile_assignment_type_assign_only &&
377 target->assignment_type = assignment_type;
378 target->target_type =
379 afw_compile_assignment_target_type_variable_reference;
380 target->variable_type = type;
381 target->variable_reference =
384 target->variable_reference->contextual,
385 target, parser->p, parser->xctx);
#define AFW_DEFINE_INTERNAL(type)
Define an internal function for /src/afw/ source*.c files.
Adaptive Framework Core Internal.
afw_compile_parse_OptionalType(afw_compile_parser_t *parser, afw_boolean_t is_return)
afw_compile_internal_assignment_type_t
Enum for assignment types.
#define AFW_COMPILE_THROW_ERROR_Z(message_z)
#define afw_pool_calloc_type(instance, type, xctx)
Macro to allocate cleared memory to hold type in pool.
#define afw_value_is_variable_reference(A_VALUE)
Macro to determine if value is a variable reference.
#define afw_value_is_assignment_target(A_VALUE)
Macro to determine if value is an assignment target.
const afw_value_t * afw_value_assignment_target_create(const afw_compile_value_contextual_t *contextual, const afw_compile_assignment_target_t *assignment_target, const afw_pool_t *p, afw_xctx_t *xctx)
Create assignment target value.
Contextual information provided in some values.
NFC normalized UTF-8 string.
Interface afw_value public struct.
Type meta (data type, data type parameters, and value meta object.