Allow Character rules to handle arbitrary character sets
This commit is contained in:
parent
bc1d115ee2
commit
7f62e752be
16 changed files with 322 additions and 309 deletions
|
|
@ -16,8 +16,8 @@ static unordered_set<Symbol> keys(const unordered_map<Symbol, parse_actions> &ma
|
|||
return result;
|
||||
}
|
||||
|
||||
static unordered_set<CharMatch> keys(const unordered_map<CharMatch, lex_actions> &map) {
|
||||
unordered_set<CharMatch> result;
|
||||
static unordered_set<Character> keys(const unordered_map<Character, lex_actions> &map) {
|
||||
unordered_set<Character> result;
|
||||
for (auto pair : map) {
|
||||
result.insert(pair.first);
|
||||
}
|
||||
|
|
@ -79,16 +79,16 @@ describe("building parse and lex tables", []() {
|
|||
Symbol("left-paren"),
|
||||
})));
|
||||
|
||||
AssertThat(keys(lex_state(0).actions), Equals(unordered_set<CharMatch>({
|
||||
CharMatchSpecific('('),
|
||||
CharMatchClass(CharClassDigit),
|
||||
CharMatchClass(CharClassWord),
|
||||
AssertThat(keys(lex_state(0).actions), Equals(unordered_set<Character>({
|
||||
Character('('),
|
||||
Character(CharClassDigit),
|
||||
Character(CharClassWord),
|
||||
})));
|
||||
|
||||
AssertThat(lex_state(0).expected_inputs(), Equals(unordered_set<CharMatch>({
|
||||
CharMatchSpecific('('),
|
||||
CharMatchClass(CharClassDigit),
|
||||
CharMatchClass(CharClassWord),
|
||||
AssertThat(lex_state(0).expected_inputs(), Equals(unordered_set<Character>({
|
||||
Character('('),
|
||||
Character(CharClassDigit),
|
||||
Character(CharClassWord),
|
||||
})));
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue