Skip to content

Commit

Permalink
(#271) eps and conc Lexemes for bregex
Browse files Browse the repository at this point in the history
  • Loading branch information
xendalm committed Nov 6, 2023
1 parent f0fe391 commit c796275
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions libs/Objects/src/AlgExpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,20 +321,24 @@ vector<AlgExpression::Lexeme> AlgExpression::parse_string(string str) {
// AlgExpression::Lexeme left
lexemes.back().type == Lexeme::Type::symb ||
lexemes.back().type == Lexeme::Type::star ||
lexemes.back().type == Lexeme::Type::parR) &&
lexemes.back().type == Lexeme::Type::parR ||
lexemes.back().type == Lexeme::Type::squareBrR ||
lexemes.back().type == Lexeme::Type::ref) &&
(
// AlgExpression::Lexeme right
lexeme.type == Lexeme::Type::symb || lexeme.type == Lexeme::Type::parL)) {

lexeme.type == Lexeme::Type::symb || lexeme.type == Lexeme::Type::parL ||
lexeme.type == Lexeme::Type::squareBrL || lexeme.type == Lexeme::Type::ref)) {
// We place . between
lexemes.emplace_back(Lexeme::Type::conc);
}

if (!lexemes.empty() &&
((lexemes.back().type == Lexeme::Type::parL &&
(lexeme.type == Lexeme::Type::parR || lexeme.type == Lexeme::Type::alt)) ||
(lexemes.back().type == Lexeme::Type::alt && lexeme.type == Lexeme::Type::parR) ||
(lexemes.back().type == Lexeme::Type::alt && lexeme.type == Lexeme::Type::alt))) {
((lexeme.type == Lexeme::Type::alt &&
(lexemes.back().type == Lexeme::Type::parL ||
lexemes.back().type == Lexeme::Type::squareBrL)) ||
(lexemes.back().type == Lexeme::Type::alt &&
(lexeme.type == Lexeme::Type::parR || lexeme.type == Lexeme::Type::squareBrR ||
lexeme.type == Lexeme::Type::alt)))) {
// We place eps between
lexemes.emplace_back(Lexeme::Type::eps);
}
Expand Down

0 comments on commit c796275

Please sign in to comment.