63 afw_compile_create_contextual(
83 afw_compile_create_source_location_impl(
94 parser->full_source, start_offset,
117 afw_compile_parse_reference_create(
130 &qualifier, &name, parser->xctx);
131 if (qualifier.len == 0) {
132 symbol = afw_compile_parse_get_symbol_entry(parser, &name);
135 contextual, symbol, parser->p, parser->xctx);
142 &name, parser->xctx);
144 if (qualifier.len == 0) {
145 AFW_COMPILE_THROW_ERROR_FZ(
150 AFW_COMPILE_THROW_ERROR_FZ(
156 contextual, &qualifier, &name,
157 parser->p, parser->xctx);
168 afw_compile_parse_set_error_z(
176 afw_compile_set_contextual();
179 parser->full_source, parser->token->token_source_offset,
182 afw_error_set_fz(afw_error_code_syntax,
183 source_z, parser->xctx,
184 "Parse error at offset "
191 parser->token->token_source_offset, line, column, message_z);
200 afw_compile_parse_set_error_fz(
208 va_start(ap, format_z);
210 parser->p, parser->xctx);
213 afw_compile_parse_set_error_z(parser, source_z, message_z);
218 afw_compile_parse_variable_reference_create(
226 if (assignment_type == afw_compile_assignment_type_loc) {
227 symbol = afw_compile_parse_add_symbol_entry(parser, identifier);
229 else if (assignment_type == afw_compile_assignment_type_const) {
230 symbol = afw_compile_parse_add_symbol_entry(parser, identifier);
232 else if (assignment_type == afw_compile_assignment_type_reference_only) {
233 symbol = afw_compile_parse_get_symbol_entry(parser, identifier);
235 AFW_COMPILE_THROW_ERROR_FZ(
241 symbol = afw_compile_parse_get_symbol_entry(parser, identifier);
243 AFW_COMPILE_THROW_ERROR_FZ(
251 contextual, symbol, parser->p, parser->xctx);
257 afw_compile_parse_get_symbol_entry(
264 for (block = parser->compiled_value->current_block;
266 block = block->parent_block)
268 for (entry = block->first_entry; entry; entry = entry->next_entry)
282 afw_compile_parse_get_local_symbol_entry(
288 for (entry = parser->compiled_value->current_block->first_entry;
290 entry = entry->next_entry)
303 afw_compile_parse_add_symbol_entry(
309 if (afw_compile_parse_get_local_symbol_entry(parser, name)) {
310 AFW_COMPILE_THROW_ERROR_FZ(
"%" AFW_UTF8_FMT " already defined",
317 entry->parent_block = parser->compiled_value->current_block;
318 if (!parser->compiled_value->current_block->first_entry) {
319 parser->compiled_value->current_block->first_entry = entry;
320 parser->compiled_value->current_block->final_entry = entry;
323 entry->index = parser->compiled_value->current_block->entry_count;
324 parser->compiled_value->current_block->final_entry->next_entry = entry;
325 parser->compiled_value->current_block->final_entry = entry;
327 parser->compiled_value->current_block->entry_count++;
335 afw_compile_parse_link_new_value_block(
342 contextual = afw_compile_create_contextual_to_cursor(start_offset);
346 parser->compiled_value,
347 &parser->block_count,
348 parser->p, parser->xctx);
356 afw_compile_parse_check_symbol(
393 if (afw_compile_next_raw_starts_with_z(
"#!")) {
394 afw_compile_get_raw_line(&line);
399 "Shebang line must contain afw or maluba to be "
400 "recognized as an adaptive script in a hybrid value");
407 return afw_compile_parse_list_of_statements(parser,
false,
true);
411 cp = afw_compile_peek_code_point(parser);
426 return afw_compile_parse_ExpressionTuple(parser);
434 parser->residual_check = afw_compile_residual_check_none;
435 parser->callback = NULL;
439 return afw_compile_parse_Template(parser);
#define AFW_DEFINE_INTERNAL(type)
Define an internal function for /src/afw/ source*.c files.
Adaptive Framework Core Internal.
#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.
afw_int32_t afw_code_point_t
Unicode code point.
afw_utf8_octet_t afw_utf8_z_t
NFC normalized UTF-8 null terminated string.
apr_size_t afw_size_t
size_t.
#define AFW_SIZE_T_FMT
Format string specifier used for afw_size_t.
afw_compile_internal_assignment_type_t
Enum for assignment types.
#define AFW_COMPILE_THROW_ERROR_Z(message_z)
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.
#define afw_pool_calloc_type(instance, type, xctx)
Macro to allocate cleared memory to hold type in pool.
#define afw_pool_malloc_type(instance, type, xctx)
Macro to allocate uncleared memory to hold type in pool.
afw_utf8_z_printf_v(const afw_utf8_z_t *format_z, va_list ap, const afw_pool_t *p, afw_xctx_t *xctx)
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_utf8_line_column_of_offset(afw_size_t *line_number, afw_size_t *column_number, const afw_utf8_t *s, afw_size_t offset, int tab_size, afw_xctx_t *xctx)
Determine the line and column of an offset in a string.
afw_utf8_printf(const afw_pool_t *p, afw_xctx_t *xctx, const afw_utf8_z_t *format,...)
Create a utf-8 string using a c format string in specified pool.
afw_utf8_contains(const afw_utf8_t *s1, const afw_utf8_t *s2)
Check to see if a string contains another string.
afw_value_empty_string
Adaptive value empty string.
const afw_value_t * afw_value_variable_reference_create(const afw_compile_value_contextual_t *contextual, const afw_value_block_symbol_t *symbol, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for variable reference value.
const afw_value_block_t * afw_value_block_allocated_and_link(const afw_compile_value_contextual_t *contextual, afw_value_compiled_value_t *compiled_value, afw_size_t *block_count, const afw_pool_t *p, afw_xctx_t *xctx)
Create and link a new block.
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.
afw_size_t value_size
Size in full_source of value source.
const afw_utf8_t * source_location
Source location.
const afw_value_compiled_value_t * compiled_value
Compiled value this value is part of.
afw_size_t value_offset
Offset in full source of compiled value to this value.
const afw_utf8_t * parser_source
If syntax error, this is partial/full source or NULL.
NFC normalized UTF-8 string.
struct for afw_value_block_t
struct for afw_value_block_symbol_t
const afw_utf8_t * full_source_type
The type of the full source.
Interface afw_value public struct.