public AsmCompletionSource(ITextBuffer buffer) { this._buffer = buffer; this._icons = new Dictionary <TokenType, ImageSource>(); AsmDudeToolsStatic.getCompositionContainer().SatisfyImportsOnce(this); this.loadIcons(); #region Grammar experiment /* * // experimental * this._grammar = new Dictionary<string, string>(); * this._grammar["MOV"] = "<reg>,<reg>|<reg>,<mem>|<mem>,<reg>|<reg>,<const>|<mem>,<const>".ToUpper(); * this._grammar["LEA"] = "<reg32>,<mem>".ToUpper(); * this._grammar["PUSH"] = "<reg32>|<mem>|<const32>".ToUpper(); * this._grammar["POP"] = "<reg32>|<mem>".ToUpper(); * * this._grammar["MEM8"] = "byte ptr [<reg32>]|[<reg32>+<reg32>]|<reg32>+2*<reg32>|<reg32>+4*<reg32>|<reg32>+8*<reg32>".ToUpper(); * this._grammar["MEM32"] = "dword ptr [<reg32>]|[<reg32>+<reg32>]|<reg32>+2*<reg32>|<reg32>+4*<reg32>|<reg32>+8*<reg32>".ToUpper(); */ #endregion }
static char[] splitChars = { ' ', ',', '\t', '+', '-', '*', '[', ']' }; //TODO remove this to AsmDudeTools internal AsmTokenTagger(ITextBuffer buffer) { this._buffer = buffer; AsmDudeToolsStatic.getCompositionContainer().SatisfyImportsOnce(this); }
private void initData() { this._type = new Dictionary <string, TokenType>(); this._arch = new Dictionary <string, Arch>(); this._description = new Dictionary <string, string>(); // fill the dictionary with keywords AsmDudeToolsStatic.getCompositionContainer().SatisfyImportsOnce(this); XmlDocument xmlDoc = this.getXmlData(); foreach (XmlNode node in xmlDoc.SelectNodes("//misc")) { var nameAttribute = node.Attributes["name"]; if (nameAttribute == null) { Debug.WriteLine("WARNING: AsmTokenTagger: found misc with no name"); } else { string name = nameAttribute.Value.ToUpper(); //Debug.WriteLine("INFO: AsmTokenTagger: found misc " + name); this._type[name] = TokenType.Misc; this._arch[name] = this.retrieveArch(node); this._description[name] = retrieveDescription(node); } } foreach (XmlNode node in xmlDoc.SelectNodes("//directive")) { var nameAttribute = node.Attributes["name"]; if (nameAttribute == null) { Debug.WriteLine("WARNING: AsmTokenTagger: found directive with no name"); } else { string name = nameAttribute.Value.ToUpper(); //Debug.WriteLine("INFO: AsmTokenTagger: found directive " + name); this._type[name] = TokenType.Directive; this._arch[name] = this.retrieveArch(node); this._description[name] = retrieveDescription(node); } } foreach (XmlNode node in xmlDoc.SelectNodes("//mnemonic")) { var nameAttribute = node.Attributes["name"]; if (nameAttribute == null) { Debug.WriteLine("WARNING: AsmTokenTagger: found mnemonic with no name"); } else { string name = nameAttribute.Value.ToUpper(); //Debug.WriteLine("INFO: AsmTokenTagger: found mnemonic " + name); var typeAttribute = node.Attributes["type"]; if (typeAttribute == null) { this._type[name] = TokenType.Mnemonic; } else { if (typeAttribute.Value.ToUpper().Equals("JUMP")) { this._type[name] = TokenType.Jump; } else { this._type[name] = TokenType.Mnemonic; } } this._arch[name] = this.retrieveArch(node); this._description[name] = retrieveDescription(node); } } foreach (XmlNode node in xmlDoc.SelectNodes("//register")) { var nameAttribute = node.Attributes["name"]; if (nameAttribute == null) { Debug.WriteLine("WARNING: AsmTokenTagger: found register with no name"); } else { string name = nameAttribute.Value.ToUpper(); //Debug.WriteLine("INFO: AsmTokenTagger: found register " + name); this._type[name] = TokenType.Register; this._arch[name] = this.retrieveArch(node); this._description[name] = retrieveDescription(node); } } }
public AsmTokenTag(TokenType type) { this.type = type; AsmDudeToolsStatic.getCompositionContainer().SatisfyImportsOnce(this); }