public void Interpret(Context context) { if(context.Input.Length <= 1) { return; } if(context.Input.StartsWith(this.Colon())) { var secondPart = context.Input[1].ToString(); if (secondPart == this.ClosingBracket()) { context.Output = "Smiley face"; } else if (secondPart == this.OppeningBracket()) { context.Output = "Sad face"; } } else if(context.Input.StartsWith(this.Semicolon())) { var secondPart = context.Input[1].ToString(); if (secondPart == this.ClosingBracket()) { context.Output = "Winkey face"; } else if(secondPart == this.OppeningBracket()) { context.Output = "Crying face"; } } else { // The application will be extended to support all // possible emoji's :D throw new NotImplementedException(); } }
public void Interpret(Context context) { this.expression.Interpret(context); Console.WriteLine("Current context: Input = {0} Output = {1}", context.Input, context.Output); }