Package ghidra.sleigh.grammar
Class SourceFileIndexer
java.lang.Object
ghidra.sleigh.grammar.SourceFileIndexer
This class is used to index source files in a SLEIGH language module.
The SLEIGH compiler records the index of the source file for a constructor rather
than the file name. This is an optimization to avoid repeating the file name in
the .sla files.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a {code SourceFileIndexer} object with an empty index. -
Method Summary
Modifier and TypeMethodDescriptiongetFileName
(Integer index) Returns the file name at a given indexReturns the index for a filenameAdds the filename of a location to the index if it is not already present.void
restoreXml
(XmlPullParser parser) Restore an index saved as to XMLvoid
Save the index as XML
-
Constructor Details
-
SourceFileIndexer
public SourceFileIndexer()Creates a {code SourceFileIndexer} object with an empty index.
-
-
Method Details
-
index
Adds the filename of a location to the index if it is not already present. -
getIndex
Returns the index for a filename- Parameters:
filename
- file- Returns:
- index or
null
iffilename
is not in the index.
-
getFileName
Returns the file name at a given index- Parameters:
index
- index- Returns:
- file name or
null
if there is no file with that index
-
saveXml
Save the index as XML- Parameters:
s
- stream to write to
-
restoreXml
Restore an index saved as to XML- Parameters:
parser
- xml parser
-