mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2026-12-02 15:17:33 -06:00
refactor and extra regex
This commit is contained in:
+15
-11
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user