]> git.saurik.com Git - bison.git/blame - src/closure.h
* src/lalr.c (state_lookahead_tokens_count): For code readability,
[bison.git] / src / closure.h
CommitLineData
c29240e7 1/* Subroutines for bison
81ebdef9 2
75ad86ee 3 Copyright (C) 1984, 1989, 2000, 2001, 2002, 2007 Free Software
81ebdef9 4 Foundation, Inc.
c29240e7
AD
5
6 This file is part of Bison, the GNU Compiler Compiler.
7
8 Bison is free software; you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 Bison is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with Bison; see the file COPYING. If not, write to the Free
0fb669f9
PE
20 Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 02110-1301, USA. */
c29240e7 22
340ef489
AD
23#ifndef CLOSURE_H_
24# define CLOSURE_H_
c29240e7 25
81ebdef9
PE
26# include "gram.h"
27
c29240e7
AD
28/* Allocates the itemset and ruleset vectors, and precomputes useful
29 data so that closure can be called. n is the number of elements to
30 allocate for itemset. */
31
da2a7671 32void new_closure (unsigned int n);
c29240e7
AD
33
34
b2872512 35/* Given the kernel (aka core) of a state (a vector of item numbers
8b3df748 36 ITEMS, of length N), set up RULESET and ITEMSET to indicate what
b2872512
AD
37 rules could be run and which items could be accepted when those
38 items are the active ones.
c29240e7 39
8b3df748 40 RULESET contains a bit for each rule. CLOSURE sets the bits for
c29240e7
AD
41 all rules which could potentially describe the next input to be
42 read.
43
b2872512 44 ITEMSET is a vector of item numbers; NITEMSET is its size
8b3df748
AD
45 (actually, points to just beyond the end of the part of it that is
46 significant). CLOSURE places there the indices of all items which
b2872512 47 represent units of input that could arrive next. */
c29240e7 48
f6fbd3da 49void closure (item_number *items, size_t n);
c29240e7
AD
50
51
8b3df748 52/* Frees ITEMSET, RULESET and internal data. */
c29240e7 53
d33cb3ae 54void free_closure (void);
340ef489 55
81ebdef9 56extern item_number *itemset;
b09f4f48 57extern size_t nitemset;
340ef489
AD
58
59#endif /* !CLOSURE_H_ */