mirror of
https://github.com/chylex/Query.git
synced 2025-04-28 09:15:41 +02:00
19 lines
410 B
C#
19 lines
410 B
C#
namespace AppCalc;
|
|
|
|
static class Operators {
|
|
internal static readonly string[] With2Operands = [ "+", "-", "*", "/", "%", "^" ];
|
|
|
|
internal static int GetPrecedence(string token) {
|
|
return token switch {
|
|
"^" => 4,
|
|
"*" or "/" or "%" => 3,
|
|
"+" or "-" => 2,
|
|
_ => 1
|
|
};
|
|
}
|
|
|
|
internal static bool IsRightAssociative(string token) {
|
|
return token == "^";
|
|
}
|
|
}
|