#include <stdlib.h>
#include "ast.h"
#include "tkstack.h"
#include "types/err.h"
Go to the source code of this file.
◆ _tkstack_ensure_size()
void _tkstack_ensure_size |
( |
tkstack_t * | stack | ) |
|
Definition at line 61 of file tkstack.c.
62{
64 return;
65 }
66
69}
A struct representing a dynamic stack.
unsigned int length
Number of elements on the stack.
ast_node_t * values
Array of values on the stack.
unsigned int _size
Current number of elements that fits on the stack.
#define TKSTACK_LENGTH_INCREMENT
struct token token_t
Struct for a Mya token.
◆ tkstack_close()
Closes the given stack.
- Parameters
-
stack | The stack to be closed. |
Definition at line 20 of file tkstack.c.
◆ tkstack_init()
Initializes the given stack.
- Parameters
-
stack | The stack to be initialized. |
Definition at line 11 of file tkstack.c.
12{
14
17}
#define TKSTACK_INITIAL_LENGTH
◆ tkstack_isempty()
Check if the given stack is empty.
- Parameters
-
- Returns
- true on stack is empty.
-
false if stack has values.
Definition at line 55 of file tkstack.c.
◆ tkstack_peek()
Peeks the value on top of the stack without removing it.
- Parameters
-
stack | The stack to peek into. |
- Returns
- NULL if stack is empty.
-
Pointer to the top node in the stack.
Definition at line 45 of file tkstack.c.
46{
48 return NULL;
49 }
50
52}
bool tkstack_isempty(tkstack_t *stack)
Check if the given stack is empty.
◆ tkstack_pop()
Pop a value from the stack.
- Parameters
-
stack | The stack from where the value will be poped. |
value | Pointer for where the poped value will be saved. |
- Returns
- NULL when the queue is empty.
-
Pointer to the item.
Definition at line 35 of file tkstack.c.
36{
38 return NULL;
39 }
40
42}
◆ tkstack_push()
Push a new value on the stack.
- Parameters
-
stack | The stack where tbe value will be pushed. |
token | Pointer to a token to add on the stack. |
Definition at line 27 of file tkstack.c.
28{
30
32}
void _tkstack_ensure_size(tkstack_t *stack)