aboutsummaryrefslogtreecommitdiff
blob: 5f1f232451f2a1796f475000fdc3c628ca17f476 (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
33
34
35
36
37
38
39
40
41
42
#ifndef SCOPE_H
#define SCOPE_H
/*
 * Symbol scoping is pretty simple.
 *
 * Copyright (C) 2003 Transmeta Corp.
 *               2003 Linus Torvalds
 *
 *  Licensed under the Open Software License version 1.1
 */

struct scope {
	struct token *token;		/* Scope start information */
	struct symbol_list *symbols;	/* List of symbols in this scope */
	struct scope *next;
};

extern struct scope
		*block_scope,
		*function_scope,
		*file_scope,
		*global_scope;

static inline int toplevel(struct scope *scope)
{
	return scope == file_scope || scope == global_scope;
}

extern void start_file_scope(void);
extern void end_file_scope(void);
extern void new_file_scope(void);

extern void start_symbol_scope(void);
extern void end_symbol_scope(void);

extern void start_function_scope(void);
extern void end_function_scope(void);

extern void bind_scope(struct symbol *, struct scope *);

extern int is_outer_scope(struct scope *);
#endif