mấy cái chỗ
sBuffer = Regex.Replace(sBuffer, @"(?<number>\d+(\.\d+)?)", " ${number} ");
sBuffer = Regex.Replace(sBuffer, @"(?<ops>[+\-*/^()])", " ${ops} ");
mình k hiểu sao lại viết đc như vậy
public void Parse(string Expression)
{
output = new Queue();
ops = new Stack();
sOriginalExpression = Expression;
string sBuffer = Expression.ToLower();
// captures numbers. Anything like 11 or 22.34 is captured
sBuffer = Regex.Replace(sBuffer, @"(?<number>\d+(\.\d+)?)", " ${number} ");
// captures these symbols: + - * / ^ ( )
sBuffer = Regex.Replace(sBuffer, @"(?<ops>[+\-*/^()])", " ${ops} ");
// captures alphabets. Currently captures the two math constants PI and E,
// and the 3 basic trigonometry functions, sine, cosine and tangent
sBuffer = Regex.Replace(sBuffer, "(?<alpha>(pi|e|sin|cos|tan))", " ${alpha} ");
// trims up consecutive spaces and replace it with just one space
sBuffer = Regex.Replace(sBuffer, @"\s+", " ").Trim();