tree-sitter/src/compiler/build_tables/first_set.h
Max Brunsfeld 33d781f492 Refactor bookkeeping of token starts in lexical rules
- Move lex items and parse items into their own files
2014-04-17 13:33:34 -07:00

30 lines
882 B
C++

#ifndef COMPILER_BUILD_TABLES_FIRST_SET_H_
#define COMPILER_BUILD_TABLES_FIRST_SET_H_
#include <set>
#include "compiler/build_tables/parse_item.h"
#include "compiler/rules/symbol.h"
namespace tree_sitter {
class PreparedGrammar;
namespace build_tables {
/*
* Returns the set of terminal symbols that can appear at
* the beginning of a string derivable from a given rule,
* in a given gramamr.
*/
std::set<rules::Symbol>
first_set(const rules::rule_ptr &rule, const PreparedGrammar &grammar);
/*
* Returns the set of terminal symbols that can appear at
* the beginning of any item in the given set.
*/
std::set<rules::Symbol>
first_set(const ParseItemSet &item_set, const PreparedGrammar &grammar);
}
}
#endif // COMPILER_BUILD_TABLES_FIRST_SET_H_