public CommandResult Execute(ConstantDeclaration declaration) { var constantSymbol = (Constant)declaration.Symbols.Single(s => s is Constant); if (ConstantsTable.ContainsKey(constantSymbol)) { throw new Exception("Already defined"); } var romanSymbol = (Roman)declaration.Symbols.Single(s => s is Roman); ConstantsTable.Add(constantSymbol, romanSymbol); return(new CommandResult { ResultText = String.Format("Information Registred: \"{0}\"", declaration), Sucess = true }); }
public void SaveToConstantTable(Expression constant, Expression roman) { ConstantsTable.Add(constant, roman); }