Package ghidra.sleigh.grammar
Class SourceFileIndexer
- java.lang.Object
-
- ghidra.sleigh.grammar.SourceFileIndexer
-
public class SourceFileIndexer extends java.lang.ObjectThis 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
Constructors Constructor Description SourceFileIndexer()Creates a {code SourceFileIndexer} object with an empty index.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetFileName(java.lang.Integer index)Returns the file name at a given indexjava.lang.IntegergetIndex(java.lang.String filename)Returns the index for a filenamejava.lang.Integerindex(Location loc)Adds the filename of a location to the index if it is not already present.voidrestoreXml(XmlPullParser parser)Restore an index saved as to XMLvoidsaveXml(java.io.PrintStream s)Save the index as XML
-
-
-
Method Detail
-
index
public java.lang.Integer index(Location loc)
Adds the filename of a location to the index if it is not already present.
-
getIndex
public java.lang.Integer getIndex(java.lang.String filename)
Returns the index for a filename- Parameters:
filename- file- Returns:
- index or
nulliffilenameis not in the index.
-
getFileName
public java.lang.String getFileName(java.lang.Integer index)
Returns the file name at a given index- Parameters:
index- index- Returns:
- file name or
nullif there is no file with that index
-
saveXml
public void saveXml(java.io.PrintStream s)
Save the index as XML- Parameters:
s- stream to write to
-
restoreXml
public void restoreXml(XmlPullParser parser)
Restore an index saved as to XML- Parameters:
parser- xml parser
-
-