Extract public compiler API into its own header file

This commit is contained in:
Max Brunsfeld 2014-02-16 22:13:08 -08:00
parent 0b4e1c8d0d
commit 9e2dc14182
53 changed files with 466 additions and 409 deletions

View file

@ -19,7 +19,7 @@ static set<Symbol> keys(const map<Symbol, parse_actions> &map) {
START_TEST
describe("building parse and lex tables", []() {
Grammar grammar({
Grammar grammar("expression", {
{ "expression", choice({
seq({
sym("term"),
@ -36,7 +36,7 @@ describe("building parse and lex tables", []() {
}) }) }
});
Grammar lex_grammar({
Grammar lex_grammar("", {
{ "plus", str("+") },
{ "variable", pattern("\\w+") },
{ "number", pattern("\\d+") },
@ -72,9 +72,9 @@ describe("building parse and lex tables", []() {
})));
AssertThat(lex_state(0).expected_inputs(), Equals(set<CharacterSet>({
CharacterSet({ '(' }, true),
CharacterSet({ {'0', '9'} }, true),
CharacterSet({ {'a', 'z'}, {'A', 'Z'} }, true),
CharacterSet({ '(' }),
CharacterSet({ CharacterRange('0', '9') }),
CharacterSet({ {'a', 'z'}, {'A', 'Z'} }),
})));
});
});