mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
Merge pull request #465 from LeGmask/infinity
[poincare/parser] Use infinity symbol
This commit is contained in:
@@ -25,6 +25,7 @@ const ToolboxMessageTree calculChildren[] = {
|
||||
ToolboxMessageTree::Leaf(I18n::Message::IntCommandWithArg, I18n::Message::Integral, false, I18n::Message::IntCommand),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::SumCommandWithArg, I18n::Message::Sum, false, I18n::Message::SumCommand),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::ProductCommandWithArg, I18n::Message::Product, false, I18n::Message::ProductCommand),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::Infinity, I18n::Message::InfinityMessage, false, I18n::Message::Infinity),
|
||||
};
|
||||
|
||||
const ToolboxMessageTree complexChildren[] = {
|
||||
|
||||
@@ -134,6 +134,7 @@ GcdCommandWithArg = "gcd(p,q)"
|
||||
Gon = "gon"
|
||||
ImCommandWithArg = "im(z)"
|
||||
IndentityCommandWithArg = "identity(n)"
|
||||
Infinity = "infinity"
|
||||
IntCommand = "int(\x11,x,\x11,\x11)"
|
||||
IntCommandWithArg = "int(f(x),x,a,b)"
|
||||
InvBinomialCommandWithArg = "invbinom(a,n,p)"
|
||||
|
||||
@@ -109,6 +109,7 @@ Identity = "Einheitsmatrix der Größe n"
|
||||
Lists = "Listen"
|
||||
HyperbolicTrigonometry = "Hyperbelfunktionen"
|
||||
Fluctuation = "Konfidenzintervall"
|
||||
InfinityMessage = "Unendlich"
|
||||
DerivateNumber = "Ableitung"
|
||||
Integral = "Integral"
|
||||
Sum = "Summe"
|
||||
|
||||
@@ -110,6 +110,7 @@ Identity = "Identity matrix of size n"
|
||||
Lists = "List"
|
||||
HyperbolicTrigonometry = "Hyperbolic trigonometry"
|
||||
Fluctuation = "Prediction Interval"
|
||||
InfinityMessage = "Infinity"
|
||||
DerivateNumber = "Derivative"
|
||||
Integral = "Integral"
|
||||
Sum = "Sum"
|
||||
|
||||
@@ -108,6 +108,7 @@ Identity = "Matriz identidad de tamaño n"
|
||||
Lists = "Listas"
|
||||
HyperbolicTrigonometry = "Trigonometría hiperbólica"
|
||||
Fluctuation = "Interval de predicción"
|
||||
InfinityMessage = "Infinito"
|
||||
DerivateNumber = "Derivada"
|
||||
Integral = "Integral"
|
||||
Sum = "Suma"
|
||||
|
||||
@@ -114,6 +114,7 @@ Identity = "Matrice identité de taille n"
|
||||
Lists = "Listes"
|
||||
HyperbolicTrigonometry = "Trigonométrie hyperbolique"
|
||||
Fluctuation = "Intervalle de fluctuation"
|
||||
InfinityMessage = "Infini"
|
||||
DerivateNumber = "Nombre derivé de f en a"
|
||||
Integral = "Intégrale de f sur [a;b]"
|
||||
Sum = "Somme"
|
||||
|
||||
@@ -122,6 +122,7 @@ Identity = "n méretü azonosító mátrix"
|
||||
Lists = "Lista"
|
||||
HyperbolicTrigonometry = "Hiperbolikus trigonometria"
|
||||
Fluctuation = "Jósolt intervallum"
|
||||
InfinityMessage = "Végtelen"
|
||||
DerivateNumber = "Származékos"
|
||||
Integral = "Integral"
|
||||
Sum = "Összeg"
|
||||
|
||||
@@ -110,6 +110,7 @@ Identity = "Matrice identità di dimensione n"
|
||||
Lists = "Elenchi"
|
||||
HyperbolicTrigonometry = "Funzioni iperboliche"
|
||||
Fluctuation = "Intervallo di previsione"
|
||||
InfinityMessage = "Infinito"
|
||||
DerivateNumber = "Derivata"
|
||||
Integral = "Integrale"
|
||||
Sum = "Somma"
|
||||
|
||||
@@ -110,6 +110,7 @@ Identity = "Eenheidsmatrix van formaat n"
|
||||
Lists = "Lijst"
|
||||
HyperbolicTrigonometry = "Hyperbolische functies"
|
||||
Fluctuation = "Statistische intervallen"
|
||||
InfinityMessage = "Eindeloos"
|
||||
DerivateNumber = "Afgeleide"
|
||||
Integral = "Integraal"
|
||||
Sum = "Som"
|
||||
|
||||
@@ -110,6 +110,7 @@ Identity = "Matriz identidade de ordem n"
|
||||
Lists = "Listas"
|
||||
HyperbolicTrigonometry = "Funções hiperbólicas"
|
||||
Fluctuation = "Intervalo de confiança"
|
||||
InfinityMessage = "Infinito"
|
||||
DerivateNumber = "Derivada"
|
||||
Integral = "Integral"
|
||||
Sum = "Somatório"
|
||||
|
||||
@@ -66,5 +66,6 @@ static constexpr CodePoint UCodePointNArySummation = 0x2211; // ∑
|
||||
static constexpr CodePoint UCodePointSquareRoot = 0x221a; // √
|
||||
static constexpr CodePoint UCodePointIntegral = 0x222b; // ∫
|
||||
static constexpr CodePoint UCodePointMathematicalBoldSmallI = 0x1d422; // 𝐢
|
||||
static constexpr CodePoint UCodePointInfinity = 0x221e; // ∞
|
||||
|
||||
#endif
|
||||
|
||||
@@ -143,6 +143,7 @@ uint32_t CodePoints[] = {
|
||||
0x2192, // → // RIGHTWARDS ARROW
|
||||
0x2211, // ∑ // N-ARY SUMMATION
|
||||
0x221a, // √ // SQUARE ROOT
|
||||
0x221e, // ∞ // INFINITY
|
||||
0x222b, // ∫ // INTEGRAL
|
||||
0x2248, // ≈ // ALMOST EQUAL TO
|
||||
0x2264, // ≤ // LESS-THAN OR EQUAL TO
|
||||
|
||||
@@ -56,7 +56,7 @@ public:
|
||||
static Infinity Builder(bool negative);
|
||||
Expression setSign(ExpressionNode::Sign s);
|
||||
static const char * Name() {
|
||||
return "inf";
|
||||
return "∞";
|
||||
}
|
||||
static int NameSize() {
|
||||
return 4;
|
||||
|
||||
@@ -44,6 +44,9 @@ bool Parser::IsSpecialIdentifierName(const char * name, size_t nameLength) {
|
||||
return (
|
||||
Token::CompareNonNullTerminatedName(name, nameLength, Symbol::k_ans) == 0 ||
|
||||
Token::CompareNonNullTerminatedName(name, nameLength, Infinity::Name()) == 0 ||
|
||||
Token::CompareNonNullTerminatedName(name, nameLength, "inf") == 0 ||
|
||||
Token::CompareNonNullTerminatedName(name, nameLength, "infinity") == 0 ||
|
||||
Token::CompareNonNullTerminatedName(name, nameLength, "oo") == 0 ||
|
||||
Token::CompareNonNullTerminatedName(name, nameLength, Undefined::Name()) == 0 ||
|
||||
Token::CompareNonNullTerminatedName(name, nameLength, Unreal::Name()) == 0 ||
|
||||
Token::CompareNonNullTerminatedName(name, nameLength, "u") == 0 ||
|
||||
@@ -426,7 +429,14 @@ void Parser::parseSequence(Expression & leftHandSide, const char * name, Token::
|
||||
void Parser::parseSpecialIdentifier(Expression & leftHandSide) {
|
||||
if (m_currentToken.compareTo(Symbol::k_ans) == 0) {
|
||||
leftHandSide = Symbol::Ans();
|
||||
} else if (m_currentToken.compareTo(Infinity::Name()) == 0) {
|
||||
} else if (m_currentToken.compareTo(Infinity::Name()) == 0 ||
|
||||
m_currentToken.compareTo("inf") == 0 ||
|
||||
m_currentToken.compareTo("infinity") == 0 ||
|
||||
m_currentToken.compareTo("oo") == 0
|
||||
) {
|
||||
|
||||
leftHandSide = Infinity::Builder(false);
|
||||
} else if (m_currentToken.compareTo("inf") == 0) {
|
||||
leftHandSide = Infinity::Builder(false);
|
||||
} else if (m_currentToken.compareTo(Undefined::Name()) == 0) {
|
||||
leftHandSide = Undefined::Builder();
|
||||
|
||||
@@ -224,7 +224,7 @@ Token Tokenizer::popToken() {
|
||||
if (c == '}') {
|
||||
return Token(Token::RightBrace);
|
||||
}
|
||||
if (c == UCodePointSquareRoot) {
|
||||
if (c == UCodePointSquareRoot || c == UCodePointInfinity) {
|
||||
Token result(Token::Identifier);
|
||||
result.setString(start, UTF8Decoder::CharSizeOfCodePoint(c));
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user