Package daikon

Class FileIO.ParseState

  • All Implemented Interfaces:
    Closeable, AutoCloseable
    Enclosing class:
    FileIO

    @UsesObjectEquals
    public static class FileIO.ParseState
    extends Object
    implements Closeable
    ParseState indicates:
    1. Some global information about the state of the parser while reading a decl or dtrace file.
    2. 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 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.
      • 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.
      • 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.
      • nonce

        public @Nullable Integer nonce
        The current nonce. Used when status=SAMPLE.
      • vt

        public @Nullable ValueTuple vt
        The current set of values. Used when status=SAMPLE.
      • payload

        public @Nullable Object payload
        Miscellaneous text in the parsed item.
    • 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 file
        ppts_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 interface AutoCloseable
        Specified by:
        close in interface Closeable
      • 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