Package daikon
Class FileIO.ParseState
- Object
-
- ParseState
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
- Enclosing class:
- FileIO
@UsesObjectEquals public static class FileIO.ParseState extends Object implements Closeable
ParseState indicates:- Some global information about the state of the parser while reading a decl or dtrace file.
- The record that was most recently read; thus, ParseState is essentially a discriminated union whose tag is a RecordType. (TODO: These are poor names that should probably be swapped!) ParseState is what is returned (actually, side-effected) by method read_data_trace_record when it reads a record.
-
-
Field Summary
Fields Modifier and Type Field Description PptMap
all_ppts
All of the ppts seen so far.String
filename
Name of input file.boolean
is_decl_file
True if the current file is a declaration file.@Nullable Integer
nonce
The current nonce.@Nullable Object
payload
Miscellaneous text in the parsed item.@Nullable PptTopLevel
ppt
Current ppt.boolean
ppts_may_be_new
True if ppts may be new.LineNumberReader
reader
Input stream.FileIO.RecordType
rtype
long
total_lines
Total number of lines in the input file.int
varcomp_format
Comparability format, either VarComparability.IMPLICIT or VarComparability.NONE.@Nullable ValueTuple
vt
The current set of values.
-
Constructor Summary
Constructors Constructor Description ParseState(String raw_filename, boolean decl_file_p, boolean ppts_may_be_new, PptMap ppts)
Start parsing the given file.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Releases resources held by this.int
get_linenum()
Returns the current line number in the input file, or -1 if not available.String
line_file_message()
String
reading_message()
-
-
-
Field Detail
-
is_decl_file
public boolean is_decl_file
True if the current file is a declaration file.
-
ppts_may_be_new
public boolean ppts_may_be_new
True if ppts may be new. If a duplicate is seen, it must match a previous point exactly. If false, the previous ppt is used without checking for a match.
-
reader
public final LineNumberReader reader
Input stream.
-
total_lines
public long total_lines
Total number of lines in the input file.
-
varcomp_format
public int varcomp_format
Comparability format, either VarComparability.IMPLICIT or VarComparability.NONE.
-
rtype
public FileIO.RecordType rtype
-
ppt
public @Nullable PptTopLevel ppt
Current ppt. Used when status=DECL or SAMPLE. Can be null if this declaration was skipped because of --ppt-select-pattern or --ppt-omit-pattern.
-
vt
public @Nullable ValueTuple vt
The current set of values. Used when status=SAMPLE.
-
-
Constructor Detail
-
ParseState
public ParseState(String raw_filename, boolean decl_file_p, boolean ppts_may_be_new, PptMap ppts) throws IOException
Start parsing the given file.- Parameters:
raw_filename
- the file name supplied by the user; may be "-" or "+"decl_file_p
- true if the file is a declaration fileppts_may_be_new
- true if declarations of ppts read from the data trace file are new (and thus are not in all_ppts). false if the ppts may already be there.ppts
- the program points- Throws:
IOException
- if there is a problem reading or writing a file
-
-
Method Detail
-
close
public void close(@GuardSatisfied FileIO.ParseState this)
Releases resources held by this.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
get_linenum
public int get_linenum()
Returns the current line number in the input file, or -1 if not available.- Returns:
- the current line number in the input file, or -1 if not available
-
reading_message
public String reading_message()
-
line_file_message
public String line_file_message()
-
-