aboutsummaryrefslogtreecommitdiff
path: root/scope.h
blob: 8a809fbc399b87a0c3b5690c1fdfef86de29af4e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#ifndef SCOPE_H
#define SCOPE_H

#include "node.h"

#define HASH_SIZE 211

typedef struct hash {
	node* table[HASH_SIZE];
	struct hash *prev;
	node* ret_var;
} scope;

scope* mkscope();
void free_scope(scope*);

/*stack routines*/
void pop_scope(scope**);
void push_scope(scope**);

/*helpers*/
node* scope_insert(scope*, char*);
node* scope_search_all(scope*, char*);
node* scope_search(scope*, char*);
node* scope_safe_search(scope*, char*);

/*hash function*/
int hashpjw(char*);
#endif