Fix parsing formulas with not canonical math symbols.
(cherry picked from commit 5672e616af
)
This commit is contained in:
parent
41e9f0c71a
commit
5defddfbb8
|
@ -1,5 +1,6 @@
|
|||
# Valentina 0.7.48 (unreleased)
|
||||
- [smart-pattern/valentina#129] Incorrect behavior of empty arc and elliptical arc.
|
||||
- Parsing formulas with not canonical math symbols.
|
||||
|
||||
# Version 0.7.47 May 13, 2021
|
||||
- [smart-pattern/valentina#118] Incorrect seam allowance.
|
||||
|
|
|
@ -80,17 +80,44 @@ void QmuFormulaBase::InitCharSets()
|
|||
Q_UNUSED(decimalPoint)
|
||||
Q_UNUSED(groupSeparator)
|
||||
|
||||
// Together with localized symbols, we always must include canonical symbols
|
||||
auto AddNotCanonical = [](QString &chars, const QChar &c, const QChar &canonical)
|
||||
{
|
||||
if (c != canonical)
|
||||
{
|
||||
chars += c;
|
||||
}
|
||||
};
|
||||
|
||||
// Defining identifier character sets
|
||||
const QString nameChars = QString() + sign0 + sign1 + sign2 + sign3 + sign4 + sign5 + sign6 + sign7 + sign8 +
|
||||
sign9 + QStringLiteral("\\_@#'") + symbolsStr;
|
||||
QString nameChars = QStringLiteral("0123456789\\_@#'") + symbolsStr;
|
||||
|
||||
AddNotCanonical(nameChars, sign0, '0');
|
||||
AddNotCanonical(nameChars, sign1, '1');
|
||||
AddNotCanonical(nameChars, sign2, '2');
|
||||
AddNotCanonical(nameChars, sign3, '3');
|
||||
AddNotCanonical(nameChars, sign4, '4');
|
||||
AddNotCanonical(nameChars, sign5, '5');
|
||||
AddNotCanonical(nameChars, sign6, '6');
|
||||
AddNotCanonical(nameChars, sign7, '7');
|
||||
AddNotCanonical(nameChars, sign8, '8');
|
||||
AddNotCanonical(nameChars, sign9, '9');
|
||||
|
||||
DefineNameChars(nameChars);
|
||||
|
||||
const QString opChars = QStringLiteral("*^/?<>=!$%&|~'_");
|
||||
const QString opChars = QStringLiteral("+-*^/?<>=!$%&|~'_");
|
||||
|
||||
QString oprtChars = symbolsStr + opChars;
|
||||
AddNotCanonical(oprtChars, positiveSign, '+');
|
||||
AddNotCanonical(oprtChars, negativeSign, '-');
|
||||
|
||||
const QString oprtChars = symbolsStr + positiveSign + negativeSign + opChars;
|
||||
DefineOprtChars(oprtChars);
|
||||
|
||||
const QString infixOprtChars = QString() + positiveSign + negativeSign + opChars;
|
||||
QString infixOprtChars = opChars;
|
||||
|
||||
AddNotCanonical(infixOprtChars, positiveSign, '+');
|
||||
AddNotCanonical(infixOprtChars, negativeSign, '-');
|
||||
|
||||
DefineInfixOprtChars(infixOprtChars);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user