From 1facf3f30476fbff54a7a7acb64f79ce5efe5186 Mon Sep 17 00:00:00 2001 From: BlueSkeye_cp <7a9a8e0be1356805ba39aaefd2f72a2ce9bd2015XwR8pJkz> Date: Mon, 8 Oct 2012 17:15:50 +0000 Subject: [PATCH] Add signed integer multiplication support to X# compiler. Documentation not yet updated. --- source2/Compiler/Cosmos.XSharp/TokenPatterns.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source2/Compiler/Cosmos.XSharp/TokenPatterns.cs b/source2/Compiler/Cosmos.XSharp/TokenPatterns.cs index 02c7be2d8..88f44ab5e 100644 --- a/source2/Compiler/Cosmos.XSharp/TokenPatterns.cs +++ b/source2/Compiler/Cosmos.XSharp/TokenPatterns.cs @@ -624,6 +624,10 @@ namespace Cosmos.Compiler.XSharp { "_REG - 1", "_REG - _REG" }, "Sub {0}, {2}"); + AddPattern(new string[] { + "_REG * 1", + "_REG * _REG" + }, "Imul {0}, {2}"); AddPattern("_REG++", "Inc {0}"); AddPattern("_REG--", "Dec {0}"); @@ -818,7 +822,7 @@ namespace Cosmos.Compiler.XSharp { /// The associated code transformation handler. protected void AddPattern(string aPattern, CodeFunc aCode) { Parser xParser = null; - try { new Parser(aPattern, 1, false, true); } + try { xParser = new Parser(aPattern, 1, false, true); } catch (Exception e) { throw new Exception(string.Format("Invalid pattern '{0}'", aPattern ?? "NULL"), e);