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