Remove inheritance link btwn PreparedGrammar and Grammar
This commit is contained in:
parent
11acc7d087
commit
e105f5cebc
11 changed files with 70 additions and 53 deletions
|
|
@ -10,14 +10,11 @@ using namespace build_tables;
|
|||
START_TEST
|
||||
|
||||
describe("building parse tables", []() {
|
||||
PreparedGrammar parse_grammar({
|
||||
auto parse_grammar = PreparedGrammar({
|
||||
{ "rule0", choice({ i_sym(1), i_sym(2) }) },
|
||||
{ "rule1", i_token(0) },
|
||||
{ "rule2", i_token(1) },
|
||||
}, {}, PreparedGrammarOptions({
|
||||
// ubiquitous_tokens
|
||||
{ Symbol(2, SymbolOptionToken) }
|
||||
}));
|
||||
}, {}).ubiquitous_tokens({ Symbol(2, SymbolOptionToken) });
|
||||
|
||||
PreparedGrammar lex_grammar({
|
||||
{ "token0", pattern("[a-c]") },
|
||||
|
|
|
|||
|
|
@ -132,11 +132,9 @@ describe("extracting tokens from a grammar", []() {
|
|||
{ "rule_A", str("ab") },
|
||||
{ "rule_B", i_sym(0) },
|
||||
{ "rule_C", i_sym(1) },
|
||||
}, {}, PreparedGrammarOptions({
|
||||
{ Symbol(0) }
|
||||
})));
|
||||
}, {}).ubiquitous_tokens({ Symbol(0) }));
|
||||
|
||||
AssertThat(result.first.options.ubiquitous_tokens, Equals(vector<Symbol>({
|
||||
AssertThat(result.first.ubiquitous_tokens(), Equals(vector<Symbol>({
|
||||
{ Symbol(0, SymbolOptionToken) }
|
||||
})));
|
||||
});
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ describe("interning symbols in a grammar", []() {
|
|||
auto result = intern_symbols(grammar);
|
||||
|
||||
AssertThat(result.second, Equals((GrammarError *)nullptr));
|
||||
AssertThat(result.first.options.ubiquitous_tokens, Equals(vector<Symbol>({
|
||||
AssertThat(result.first.ubiquitous_tokens(), Equals(vector<Symbol>({
|
||||
Symbol(2)
|
||||
})));
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue