Add a "inverseLCharacter" static function to tok
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
This commit is contained in:
parent
7cbb424416
commit
de2259b6ed
|
@ -17,6 +17,9 @@ struct tok {
|
|||
LCOMP = '>', RCOMP = '<',
|
||||
SQUOTE = '\'', ASTERISK = '*', STRING = '"',
|
||||
};
|
||||
static auto inverseLCharacter(const unsigned char& character) {
|
||||
return static_cast<unsigned char>(((character + 2) - (character == tok::LPAR)));
|
||||
};
|
||||
const type toktype;
|
||||
const std::string toktext;
|
||||
const unsigned long line;
|
||||
|
|
|
@ -62,7 +62,7 @@ namespace Parser {
|
|||
break;
|
||||
}
|
||||
case LPAR: case LBRACE: case LBRACKET: {
|
||||
const auto inverseCharacter = static_cast<tok::type>((current.toktype + 2) - (current.toktype == LPAR));
|
||||
const auto inverseCharacter = tok::inverseLCharacter(current.toktype);
|
||||
const auto closingCharacter = find_if(lexed.cbegin(), lexed.cend(), [&inverseCharacter](const tok& it){
|
||||
return it.toktype == inverseCharacter;
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue