From 04bc85883eb6b02eb9ce7df1422673222fcb95f5 Mon Sep 17 00:00:00 2001 From: kudzu_cp <6d05c8c8ef5431987001abfdb2eadc9593ac9498> Date: Mon, 18 Jun 2012 00:31:43 +0000 Subject: [PATCH] X# --- source2/Compiler/Cosmos.XSharp/TokenList.cs | 33 ++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/source2/Compiler/Cosmos.XSharp/TokenList.cs b/source2/Compiler/Cosmos.XSharp/TokenList.cs index 908f822bb..d88150ac6 100644 --- a/source2/Compiler/Cosmos.XSharp/TokenList.cs +++ b/source2/Compiler/Cosmos.XSharp/TokenList.cs @@ -40,7 +40,7 @@ namespace Cosmos.Compiler.XSharp { for (int i = 0; i < aObj.Count; i++) { var xThis = this[i]; var xThat = aObj[i]; - if (xThis.Type != aObj[i].Type) { + if (xThis.Type != xThat.Type) { return false; } else if (xThis.Type == TokenType.AlphaNum || xThat.Type == TokenType.Keyword) { if (xThis.Value == null || aObj[i].Value == null) { @@ -48,6 +48,37 @@ namespace Cosmos.Compiler.XSharp { return false; } } else if (xThis.Type == TokenType.Register) { + string xThisUpper = xThis.Value.ToUpper(); + string xThatUpper = xThat.Value.ToUpper(); + + if (xThisUpper == "_REG" || xThatUpper == "_REG") { + // true, ie continue + + } else if (xThisUpper == "_REG8" && xThatUpper == "_REG8") { + return false; + } else if (xThisUpper == "_REG8" && Parser.Registers8.Contains(xThatUpper)) { + return false; + } else if (xThatUpper == "_REG8" && Parser.Registers8.Contains(xThisUpper)) { + return false; + + } else if (xThisUpper == "_REG16" && xThatUpper == "_REG16") { + return false; + } else if (xThisUpper == "_REG16" && Parser.Registers8.Contains(xThatUpper)) { + return false; + } else if (xThatUpper == "_REG16" && Parser.Registers8.Contains(xThisUpper)) { + return false; + + } else if (xThisUpper == "_REG32" && xThatUpper == "_REG32") { + return false; + } else if (xThisUpper == "_REG32" && Parser.Registers8.Contains(xThatUpper)) { + return false; + } else if (xThatUpper == "_REG32" && Parser.Registers8.Contains(xThisUpper)) { + return false; + + } else if (xThisUpper != xThatUpper) { + // Must be last, after patterns + return false; + } } }