kinnie
Loading...
Searching...
No Matches
parser.h
Go to the documentation of this file.
1#ifndef PARSER_H
2#define PARSER_H
3
4#include "kinnie.h"
5
7extern size_t function_count;
9extern size_t struct_count;
10
11// Returns the index of the closing `}` that matches the `{` depth starting at position start.
12size_t find_block_end(Token tokens[], size_t token_count, size_t start);
13
14// Copies tokens[start..end) into dst[] and appends a TOK_EOF sentinel; returns the number of tokens copied.
15size_t copy_block(Token tokens[], size_t start, size_t end, Token dst[]);
16
17// Scans tokens and populates the global functions[] array; struct bodies are skipped.
18void parse_functions(Token tokens[], size_t token_count);
19
20// Scans tokens and populates the global structs[] array with field and method definitions.
21void parse_structs(Token tokens[], size_t token_count);
22
23// Returns a pointer to the Function with the given name, or NULL if not found.
24Function *get_function(const char *name);
25
26#endif
#define MAX_FUNCTIONS
Definition kinnie.h:27
#define MAX_STRUCTS
Definition kinnie.h:32
size_t find_block_end(Token tokens[], size_t token_count, size_t start)
Definition parser.c:12
void parse_functions(Token tokens[], size_t token_count)
Definition parser.c:34
Function functions[MAX_FUNCTIONS]
Definition parser.c:7
Struct structs[MAX_STRUCTS]
Definition parser.c:9
void parse_structs(Token tokens[], size_t token_count)
Definition parser.c:99
Function * get_function(const char *name)
Definition parser.c:93
size_t struct_count
Definition parser.c:10
size_t function_count
Definition parser.c:8
size_t copy_block(Token tokens[], size_t start, size_t end, Token dst[])
Definition parser.c:26
Definition kinnie.h:58
Definition kinnie.h:66
Definition kinnie.h:53