gnulib: update
[bison.git] / src / closure.h
bloba928144672dcfdef5db5a6dbf3fb0bec437c1c9a
1 /* Subroutines for bison
3 Copyright (C) 1984, 1989, 2000-2002, 2007, 2009-2015, 2018-2021 Free
4 Software Foundation, Inc.
6 This file is part of Bison, the GNU Compiler Compiler.
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <https://www.gnu.org/licenses/>. */
21 #ifndef CLOSURE_H_
22 # define CLOSURE_H_
24 # include "gram.h"
26 /* Allocates the itemset and ruleset vectors, and precomputes useful
27 data so that closure can be called. n is the number of elements to
28 allocate for itemset. */
30 void closure_new (int n);
33 /* Given the kernel (aka core) of a state (a sorted vector of item indices
34 ITEMS, of length N), set up RULESET and ITEMSET to indicate what
35 rules could be run and which items could be accepted when those
36 items are the active ones. */
38 void closure (item_index const *items, size_t n);
41 /* Free ITEMSET, RULESET and internal data. */
43 void closure_free (void);
46 /* ITEMSET is a sorted vector of item indices; NITEMSET is its size
47 (actually, points to just beyond the end of the part of it that is
48 significant). CLOSURE places there the indices of all items which
49 represent units of input that could arrive next. */
51 extern item_index *itemset;
52 extern size_t nitemset;
54 #endif /* !CLOSURE_H_ */