|
PatchworkOS
|
Tokens. More...
Data Structures | |
| struct | aml_token_props_t |
| Token Properties. More... | |
| struct | aml_token_t |
| Token. More... | |
Functions | |
| const char * | aml_token_type_to_string (aml_token_type_t type) |
| Convert a token type to a string. | |
| static const aml_token_props_t * | aml_token_lookup (aml_token_num_t num) |
| Lookup token properties. | |
| static void | aml_token_peek (aml_term_list_ctx_t *ctx, aml_token_t *out) |
| Attempt to read a token from the AML stream, without advancing the instruction pointer. | |
| static void | aml_token_read (aml_term_list_ctx_t *ctx, aml_token_t *out) |
| Attempt to read a token from the AML stream. | |
| static uint64_t | aml_token_expect (aml_term_list_ctx_t *ctx, aml_token_num_t expected) |
| Reads a token from the AML stream and verifies it matches the expected token. | |
Variables | |
| const aml_token_props_t | amlTokenProps [AML_MAX_TOKEN] |
Token properties array indexed by aml_token_num_t. | |
Tokens.
This module handles descriptions of all tokens that can be found in an AML byte stream, storing them and their properties.
The token type ends up, in most cases, being the smallest most fundamental type used in the parser (as in the type at the bottom of the recursive tree), but there are some exceptions, for example a ByteData object is not a token type simply because it can have any value (0x00 to 0xFF).
| enum aml_encoding_group_t |
| enum aml_token_num_t |
Token numbers.
All tokens stored an an enum, we also encode the extended tokens (those that make up two bytes) by assigning them certain token ranges.
| enum aml_token_type_t |
Token Type.
|
inlinestatic |
Reads a token from the AML stream and verifies it matches the expected token.
| state | Pointer to the current AML state. |
| expected | The expected token number. |
0. On failure, ERR and errno is set. Definition at line 353 of file token.h.
References aml_token_read(), EILSEQ, ERR, errno, and aml_token_t::num.
Referenced by aml_byte_const_read(), aml_debug_obj_read(), aml_def_acquire_read(), aml_def_alias_read(), aml_def_bank_field_read(), aml_def_break_read(), aml_def_buffer_read(), aml_def_cond_ref_of_read(), aml_def_continue_read(), aml_def_create_bit_field_read(), aml_def_create_field_read(), aml_def_create_field_read_helper(), aml_def_data_region_read(), aml_def_deref_of_read(), aml_def_device_read(), aml_def_divide_read(), aml_def_else_read(), aml_def_event_read(), aml_def_field_read(), aml_def_if_else_read(), aml_def_index_field_read(), aml_def_index_read(), aml_def_match_read(), aml_def_method_read(), aml_def_mod_read(), aml_def_mutex_read(), aml_def_name_read(), aml_def_noop_read(), aml_def_object_type_read(), aml_def_opregion_read(), aml_def_package_read(), aml_def_power_res_read(), aml_def_processor_read(), aml_def_release_read(), aml_def_return_read(), aml_def_scope_read(), aml_def_thermal_zone_read(), aml_def_timer_read(), aml_def_to_string_read(), aml_def_var_package_read(), aml_def_while_read(), aml_dual_name_path_read(), aml_dword_const_read(), aml_multi_name_path_read(), aml_null_name_read(), aml_op_data_data_target_read(), aml_op_operand_operand_read(), aml_op_operand_operand_target_read(), aml_op_operand_read(), aml_op_operand_shiftcount_target_read(), aml_op_operand_target_read(), aml_op_supername_read(), aml_op_termarg_simplename_read(), aml_op_termarg_supername_read(), aml_qword_const_read(), aml_reserved_field_read(), aml_revision_op_read(), aml_root_char_read(), aml_string_read(), and aml_word_const_read().
|
inlinestatic |
Lookup token properties.
| num | The token number to lookup. |
AML_UNKNOWN_TOKEN. Definition at line 278 of file token.h.
References AML_MAX_TOKEN, AML_UNKNOWN_TOKEN, amlTokenProps, aml_token_props_t::name, and NULL.
Referenced by aml_op_data_data_target_read(), aml_op_operand_operand_read(), aml_op_operand_operand_target_read(), aml_op_operand_read(), aml_op_operand_shiftcount_target_read(), aml_op_operand_target_read(), aml_op_supername_read(), aml_op_termarg_simplename_read(), and aml_op_termarg_supername_read().
|
inlinestatic |
Attempt to read a token from the AML stream, without advancing the instruction pointer.
If the stream is empty, the token will be set to AML_UNKNOWN_TOKEN and length 0.
| ctx | The AML term list context to parse from. |
Definition at line 301 of file token.h.
References AML_EXT_OP_PREFIX, AML_EXT_OP_PREFIX_BASE, AML_LGREATER_EQUAL_OP, AML_LNOT_EQUAL_OP, AML_LNOT_OP, AML_LNOT_OP_BASE, AML_UNKNOWN_TOKEN, amlTokenProps, aml_term_list_ctx_t::current, aml_term_list_ctx_t::end, aml_token_t::length, MIN, aml_token_t::num, and aml_token_t::props.
Referenced by aml_computational_data_read(), aml_data_object_read(), aml_def_if_else_read(), aml_def_object_type_read(), aml_expression_opcode_read(), aml_field_element_read(), aml_name_path_read(), aml_name_string_read(), aml_named_obj_read(), aml_namespace_modifier_obj_read(), aml_object_read(), aml_package_element_read(), aml_prefix_path_read(), aml_reference_type_opcode_read(), aml_simple_name_read_and_resolve(), aml_statement_opcode_read(), aml_super_name_read_and_resolve(), aml_target_read_and_resolve(), aml_term_arg_read(), aml_term_obj_read(), and aml_token_read().
|
inlinestatic |
Attempt to read a token from the AML stream.
| ctx | The AML term list context to parse from. |
| out | The token to read into. |
Definition at line 340 of file token.h.
References aml_token_peek(), aml_term_list_ctx_t::current, and aml_token_t::length.
Referenced by aml_arg_obj_read(), aml_const_obj_read(), aml_local_obj_read(), aml_name_seg_read(), and aml_token_expect().
| const char * aml_token_type_to_string | ( | aml_token_type_t | type | ) |
Convert a token type to a string.
| type | The token type to convert. |
Definition at line 139 of file token.c.
References AML_TOKEN_TYPE_ARG, AML_TOKEN_TYPE_COMPUTATIONAL, AML_TOKEN_TYPE_DEBUG, AML_TOKEN_TYPE_EXPRESSION, AML_TOKEN_TYPE_LOCAL, AML_TOKEN_TYPE_NAME, AML_TOKEN_TYPE_NAMED, AML_TOKEN_TYPE_NAMESPACE_MODIFIER, and AML_TOKEN_TYPE_STATEMENT.
Referenced by aml_object_read(), aml_simple_name_read_and_resolve(), and aml_super_name_read_and_resolve().
|
extern |
Token properties array indexed by aml_token_num_t.
Definition at line 5 of file token.c.
Referenced by aml_token_lookup(), and aml_token_peek().