aboutsummaryrefslogtreecommitdiff
path: root/scope.h
blob: e3af747ce8cc62531b29375e85c9285724d964db (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
30
31
32
#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;
	int offset;
} 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*);

void print_scope(scope *);

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