libmya 0.1.0
Library to parse Mya language.
|
Go to the source code of this file.
Functions | |
unsigned int | parse_statement (module_t *module, ast_node_t *parent, token_t *token) |
Parse a statement adding it as a children on parent AST node. | |
unsigned int | parse_statement_include (module_t *module, ast_node_t *parent, token_t *token) |
Parse a include statement adding it as a children on parent AST node. | |
unsigned int | parse_statement_set (module_t *module, ast_node_t *parent, token_t *token) |
Parse a set statement adding it as a children on parent AST node. | |
unsigned int | parse_statement_bitfield (module_t *module, ast_node_t *parent, token_t *token) |
Parse a bitfield statement adding it as a children on parent AST node. | |
unsigned int | parse_statement_register (module_t *module, ast_node_t *parent, token_t *token) |
Parse a register statement adding it as a children on parent AST node. | |
unsigned int | parse_statement_inst (module_t *module, ast_node_t *parent, token_t *token) |
Parse a inst statement adding it as a children on parent AST node. | |
unsigned int | parse_expression (module_t *module, ast_node_t *parent, token_t *token) |
Parse a mathematical expression adding it as a children on parent AST node. | |
unsigned int | parse_size_spec (module_t *module, ast_node_t *parent, token_t *token, const char *example) |
Parse a size specification in the format [ EXPRESSION ] adding it as a children on parent AST node. | |
unsigned int | parse_bitfield_spec (module_t *module, ast_node_t *parent, token_t *token) |
Parse a bitfield specification in the format Bitfield { FIELD_LIST } or Bitfield { EXPRESSION } adding it as a children on parent AST node. | |
unsigned int | parse_fieldlist_spec (module_t *module, ast_node_t *parent, token_t *token) |
Parse a field list specification in the format field = EXPRESSION, ... adding it as a children on parent AST node. | |
unsigned int | parse_advance (token_t *token, token_type_t *types, size_t ntypes) |
Finds the next token TK_EOF or any of the specified types and then returns the number of tokens traveled. | |
unsigned int parse_advance | ( | token_t * | token, |
token_type_t * | types, | ||
size_t | ntypes ) |
Finds the next token TK_EOF or any of the specified types and then returns the number of tokens traveled.
This function could be used to skip wrong tokens when a error as found on parsing a statement. So it's avoid a lot of useless error messages.
token | Pointer for the first token where to start searching. |
types | Array of token types to search. |
ntypes | Size of types array. |
Definition at line 125 of file parse_common.c.
unsigned int parse_bitfield_spec | ( | module_t * | module, |
ast_node_t * | parent, | ||
token_t * | token ) |
Parse a bitfield specification in the format Bitfield { FIELD_LIST }
or Bitfield { EXPRESSION }
adding it as a children on parent
AST node.
module | The module where the AST is. |
parent | The AST node parent for the bitfield specification. |
token | The token where to start parsing the bitfield specification. |
Definition at line 47 of file parse_common.c.
unsigned int parse_expression | ( | module_t * | module, |
ast_node_t * | parent, | ||
token_t * | token ) |
Parse a mathematical expression adding it as a children on parent
AST node.
module | The module where the AST is. |
parent | The AST node parent for the expression. |
token | The token where to start parsing the expression. |
Definition at line 17 of file parse_expression.c.
unsigned int parse_fieldlist_spec | ( | module_t * | module, |
ast_node_t * | parent, | ||
token_t * | token ) |
Parse a field list specification in the format field = EXPRESSION, ...
adding it as a children on parent
AST node.
module | The module where the AST is. |
parent | The AST node parent for the field list specification. |
token | The token where to start parsing the field list specification. It should be the open braces ({ ). |
Definition at line 106 of file parse_common.c.
unsigned int parse_size_spec | ( | module_t * | module, |
ast_node_t * | parent, | ||
token_t * | token, | ||
const char * | example ) |
Parse a size specification in the format [ EXPRESSION ]
adding it as a children on parent
AST node.
module | The module where the AST is. |
parent | The AST node parent for the size specification. |
token | The token where to start parsing the size specification. |
example | A code example printed on error messages when the size spec is syntactically wrong. |
Definition at line 7 of file parse_common.c.
unsigned int parse_statement | ( | module_t * | module, |
ast_node_t * | parent, | ||
token_t * | token ) |
Parse a statement adding it as a children on parent
AST node.
module | The module where the AST is. |
parent | The AST node parent for the statement. |
token | The token where to start parsing the statement. |
Definition at line 8 of file parse_statement.c.
unsigned int parse_statement_bitfield | ( | module_t * | module, |
ast_node_t * | parent, | ||
token_t * | token ) |
Parse a bitfield statement adding it as a children on parent
AST node.
module | The module where the AST is. |
parent | The AST node parent for the statement. |
token | The token where to start parsing the statement. |
Definition at line 10 of file parse_statement_bitfield.c.
unsigned int parse_statement_include | ( | module_t * | module, |
ast_node_t * | parent, | ||
token_t * | token ) |
Parse a include statement adding it as a children on parent
AST node.
module | The module where the AST is. |
parent | The AST node parent for the statement. |
token | The token where to start parsing the statement. |
Definition at line 6 of file parse_statement_include.c.
unsigned int parse_statement_inst | ( | module_t * | module, |
ast_node_t * | parent, | ||
token_t * | token ) |
Parse a inst statement adding it as a children on parent
AST node.
module | The module where the AST is. |
parent | The AST node parent for the statement. |
token | The token where to start parsing the statement. |
Definition at line 14 of file parse_statement_inst.c.
unsigned int parse_statement_register | ( | module_t * | module, |
ast_node_t * | parent, | ||
token_t * | token ) |
Parse a register statement adding it as a children on parent
AST node.
module | The module where the AST is. |
parent | The AST node parent for the statement. |
token | The token where to start parsing the statement. |
Definition at line 6 of file parse_statement_register.c.
unsigned int parse_statement_set | ( | module_t * | module, |
ast_node_t * | parent, | ||
token_t * | token ) |
Parse a set statement adding it as a children on parent
AST node.
module | The module where the AST is. |
parent | The AST node parent for the statement. |
token | The token where to start parsing the statement. |
Definition at line 6 of file parse_statement_set.c.