#include <stdio.h>
#include <yyast/types.h>
Go to the source code of this file.
Defines | |
| #define | _GNU_SOURCE |
| #define | YA_BRANCH(name,...) ya_branch(name, __VA_ARGS__, NULL) |
| Define a new node. | |
| #define | YA_EMPTYBRANCH(name) ya_branch(name, NULL) |
| A branch that is empty. | |
| #define | YA_LIST(...) ya_list("@list", __VA_ARGS__, NULL) |
| Define a list of nodes. | |
| #define | YA_EMPTYLIST ya_list("@list", NULL) |
| An empty list contains no nodes, but can be used to start a sequence of nodes in the grammar. | |
Functions | |
| ya_t | ya_branch (const char *restrict name,...) |
| Create an ya node. | |
| ya_t | ya_list (const char *restrict name,...) |
| Create an ya node. | |
| void | ya_node_save (FILE *output_file, ya_t *node) |
| Save the node to a file. | |
| #define YA_BRANCH | ( | name, | |||
| ... | ) | ya_branch(name, __VA_ARGS__, NULL) |
Define a new node.
Used in a yacc action to start a new node. If a list is added to a branch, then the nodes of the list are added to the created node, instead of the list itself.
| name | Name of the node | |
| ... | A set of nodes, leaves or lists to be included in this node. |
Definition at line 41 of file node.h.
Referenced by ya_get_filenames(), and ya_header().
| #define YA_EMPTYBRANCH | ( | name | ) | ya_branch(name, NULL) |
| #define YA_EMPTYLIST ya_list("@list", NULL) |
An empty list contains no nodes, but can be used to start a sequence of nodes in the grammar.
Definition at line 62 of file node.h.
Referenced by ya_get_filenames().
| #define YA_LIST | ( | ... | ) | ya_list("@list", __VA_ARGS__, NULL) |
Define a list of nodes.
Used in yacc to create a list of nodes. When adding a list to an other list or node, the contents of the list is appended to the node and list.
| ... | A list of literals to be included in this node. |
Definition at line 58 of file node.h.
Referenced by ya_get_filenames().
| ya_t ya_branch | ( | const char *restrict | name, | |
| ... | ||||
| ) |
Create an ya node.
Create a node from subnodes. This will free memory used by the subnodes. If a list is added to a branch, then the nodes of the list are added to the created node, instead of the list itself.
| name | Name of the node. | |
| ... | The subnodes, ending with NULL |
Definition at line 151 of file node.c.
References ya_generic_nodev(), and YA_NODE_TYPE_BRANCH.
| ya_t ya_list | ( | const char *restrict | name, | |
| ... | ||||
| ) |
Create an ya node.
Create a list of subnodes, when included in a list or node, it expands as if the contents was passed as seperate items. This also free memory used by the subnodes.
| name | Name of the node. This should be '@list' because this function is called from the YA_LIST macro. | |
| ... | The subnodes, ending with NULL |
Definition at line 163 of file node.c.
References ya_generic_nodev(), and YA_NODE_TYPE_LIST.
| void ya_node_save | ( | FILE * | output_file, | |
| ya_t * | node | |||
| ) |
Save the node to a file.
| output_file | A file pointer of an file open for writing. | |
| node | The node to be saved to file. |
Definition at line 175 of file node.c.
References ya_t::node, and ya_t::size.
Referenced by ya_main().
1.5.6