refactor and extra regex

This commit is contained in:
Partouf
2018-04-22 15:15:50 +02:00
parent d3720438fc
commit 072a63c846
+15 -11
View File
@@ -45,6 +45,17 @@ class Demangler {
this.labelDef = /^([.a-z_$][a-z0-9$_@.]*):/i;
this.jumpDef = /j.+\s+([.a-z_$][a-z0-9$_@.]*)/i;
this.callDef = /call[q]?\s+([.a-z_$][a-z0-9$_@.]*)/i;
// symbols in a mov or lea command starting with an underscore
this.movUnderscoreDef = /mov.*\s(_[a-z0-9$_@.]*)/i;
this.leaUnderscoreDef = /lea.*\s(_[a-z0-9$_@.]*)/i
}
AddMatchToOtherSymbols(matches) {
if (matches) {
const midx = matches.length - 1;
this.othersymbols.Add(matches[midx], matches[midx]);
}
}
CollectLabels() {
@@ -57,17 +68,10 @@ class Demangler {
this.symbolstore.Add(matches[midx], matches[midx]);
}
matches = line.match(this.jumpDef);
if (matches) {
const midx = matches.length - 1;
this.othersymbols.Add(matches[midx], matches[midx]);
}
matches = line.match(this.callDef);
if (matches) {
const midx = matches.length - 1;
this.othersymbols.Add(matches[midx], matches[midx]);
}
this.AddMatchToOtherSymbols(line.match(this.jumpDef));
this.AddMatchToOtherSymbols(line.match(this.callDef));
this.AddMatchToOtherSymbols(line.match(this.movUnderscoreDef));
this.AddMatchToOtherSymbols(line.match(this.leaUnderscoreDef));
}
this.othersymbols.Exclude(this.symbolstore);