Remove subclasses of Symbol for terminals and non-terminals
This commit is contained in:
parent
ed80d9cf52
commit
29c81167c0
23 changed files with 88 additions and 191 deletions
|
|
@ -14,19 +14,19 @@ describe("building parse and lex tables", []() {
|
|||
{ "expression", choice({
|
||||
seq({
|
||||
sym("term"),
|
||||
token("plus-token"),
|
||||
sym("plus-token"),
|
||||
sym("term") }),
|
||||
sym("term") }) },
|
||||
{ "term", choice({
|
||||
sym("variable"),
|
||||
sym("number"),
|
||||
seq({
|
||||
token("left-paren-token"),
|
||||
sym("left-paren-token"),
|
||||
sym("expression"),
|
||||
token("right-paren-token")
|
||||
sym("right-paren-token")
|
||||
}) }) },
|
||||
{ "variable", token("variable-token") },
|
||||
{ "number", token("number-token") }
|
||||
{ "variable", sym("variable-token") },
|
||||
{ "number", sym("number-token") }
|
||||
});
|
||||
|
||||
Grammar lex_grammar({
|
||||
|
|
@ -64,8 +64,8 @@ describe("building parse and lex tables", []() {
|
|||
|
||||
AssertThat(lex_state(0).actions, Equals(unordered_map<CharMatch, lex_actions>({
|
||||
{ CharMatchSpecific('('), lex_actions({ LexAction::Advance(1) }) },
|
||||
{ CharMatchClass(CharClassWord), lex_actions({ LexAction::Advance(2) }) },
|
||||
{ CharMatchClass(CharClassDigit), lex_actions({ LexAction::Advance(3) }) },
|
||||
{ CharMatchClass(CharClassDigit), lex_actions({ LexAction::Advance(2) }) },
|
||||
{ CharMatchClass(CharClassWord), lex_actions({ LexAction::Advance(3) }) },
|
||||
})));
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue