Package daikon
Class FileIO.VarDefinition
- Object
-
- VarDefinition
-
- All Implemented Interfaces:
Serializable
,Cloneable
- Enclosing class:
- FileIO
public static class FileIO.VarDefinition extends Object implements Serializable, Cloneable
Class that holds information from the declaration record (in the file). Once collected, this information is used to create a VarInfo. This class is necessary because a VarInfo cannot be created until much of this information is present: the constructor requires all the information at the time of construction, and some of the fields are final.In general, each field has a one-to-one relation with the corresponding entry in the variable definition block in the trace file. More detailed information about each of the fields can be found in the 'Variable declarations' section of the 'File Formats' appendix of the Daikon developers manual. Specifics can also be found in the 'parse_[field]' methods of the class (eg, parse_var_kind, parse_enclosing_var_name, etc).
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description int
arr_dims
Number of array dimensions (0 or 1).VarComparability
comparability
Comparability of this variable (required.ProglangType
declared_type
Declared type of the variable as an arbitrary string (required)@Nullable String
enclosing_var_name
Name of variable that contains this variable (optional)EnumSet<VarInfo.VarFlags>
flags
Variable flags (optional)@Nullable List<String>
function_args
Non-null iff (vardef.kind == VarKind.FUNCTION).VarInfo.VarKind
kind
Type of the variable (required).EnumSet<VarInfo.LangFlags>
lang_flags
Language specific variable flags (optional)@Nullable Integer
max_length
Non-null if it is statically known that the array will have up to this many elements.@Nullable String
max_value
Non-null if it is statically known that the value of the variable will be always less than or equal to this value.@Nullable Integer
min_length
Non-null if it is statically known that the array will have at least this many elements.@Nullable String
min_value
Non-null if it is statically known that the value of the variable will be always greater than or equal to this value.String
name
Name of the variable (required).List<VarParent>
parents
Parent program points in ppt hierarchy (optional)VarInfo.RefType
ref_type
Type of reference for structure/class variables.@Nullable String
relative_name
the simple (not fully specified) name of this variable (optional)ProglangType
rep_type
The type of the variable as stored in the dtrace file (required)@Nullable @Interned Object
static_constant_value
Non-null if this 'variable' always has the same value (optional)@Nullable String
valid_values
Non-null if the set of valid values for the variable is statically known.
-
Constructor Summary
Constructors Constructor Description VarDefinition(FileIO.ParseState state, Scanner scanner)
Initialize from the 'variable name' record.VarDefinition(String name, VarInfo.VarKind kind, ProglangType type)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkRep()
Check representation invariants.void
clear_parent_relation()
Clears the parent relations, if any existed.FileIO.VarDefinition
clone()
FileIO.VarDefinition
copy()
@Interned String
need(Scanner scanner, String description)
Helper function, returns the next string token unescaped and interned.void
need_eol(Scanner scanner)
Throws Daikon.UserError if the scanner is not at end of linevoid
parse_array(Scanner scanner)
Parses the array record.void
parse_comparability(Scanner scanner)
Parses a comparability record.void
parse_constant(Scanner scanner)
Parse a constant record.void
parse_dec_type(Scanner scanner)
void
parse_enclosing_var_name(Scanner scanner)
Parses the enclosing-var record.<E extends Enum<E>>
Eparse_enum_val(Scanner scanner, Class<E> enum_class, String descr)
Looks up the next token as a member of enum_class.void
parse_flags(Scanner scanner)
Parse the flags record.void
parse_function_args(Scanner scanner)
Parses the function-args record.void
parse_lang_flags(Scanner scanner)
Parse the langauge specific flags record.void
parse_max_length(Scanner scanner)
Parse a maximum length record.void
parse_max_value(Scanner scanner)
Parse a maximum value record.void
parse_min_length(Scanner scanner)
Parse a minimum length record.void
parse_min_value(Scanner scanner)
Parse a minimum value record.void
parse_parent(Scanner scanner, List<FileIO.ParentRelation> ppt_parents)
Parse a parent ppt record.void
parse_reference_type(Scanner scanner)
Parses the reference-type record.void
parse_rep_type(Scanner scanner)
void
parse_valid_values(Scanner scanner)
Parse a valid values record.void
parse_var_kind(Scanner scanner)
Parse a var-kind record.
-
-
-
Field Detail
-
kind
public VarInfo.VarKind kind
Type of the variable (required).
-
enclosing_var_name
public @Nullable String enclosing_var_name
Name of variable that contains this variable (optional)
-
relative_name
public @Nullable String relative_name
the simple (not fully specified) name of this variable (optional)
-
ref_type
public VarInfo.RefType ref_type
Type of reference for structure/class variables.
-
arr_dims
public int arr_dims
Number of array dimensions (0 or 1).
-
function_args
public @Nullable List<String> function_args
Non-null iff (vardef.kind == VarKind.FUNCTION). The arguments that were used to create this function application.
-
rep_type
public ProglangType rep_type
The type of the variable as stored in the dtrace file (required)
-
declared_type
public ProglangType declared_type
Declared type of the variable as an arbitrary string (required)
-
flags
public EnumSet<VarInfo.VarFlags> flags
Variable flags (optional)
-
lang_flags
public EnumSet<VarInfo.LangFlags> lang_flags
Language specific variable flags (optional)
-
comparability
public VarComparability comparability
Comparability of this variable (required.
-
static_constant_value
public @Nullable @Interned Object static_constant_value
Non-null if this 'variable' always has the same value (optional)
-
min_value
public @Nullable String min_value
Non-null if it is statically known that the value of the variable will be always greater than or equal to this value.
-
max_value
public @Nullable String max_value
Non-null if it is statically known that the value of the variable will be always less than or equal to this value.
-
min_length
public @Nullable Integer min_length
Non-null if it is statically known that the array will have at least this many elements.
-
max_length
public @Nullable Integer max_length
Non-null if it is statically known that the array will have up to this many elements.
-
valid_values
public @Nullable String valid_values
Non-null if the set of valid values for the variable is statically known.
-
-
Constructor Detail
-
VarDefinition
public VarDefinition(FileIO.ParseState state, Scanner scanner)
Initialize from the 'variable name' record. Scanner should be pointing at name.
-
VarDefinition
public VarDefinition(String name, VarInfo.VarKind kind, ProglangType type)
-
-
Method Detail
-
checkRep
public void checkRep()
Check representation invariants.
-
clone
@SideEffectFree public FileIO.VarDefinition clone(@GuardSatisfied FileIO.VarDefinition this)
-
copy
public FileIO.VarDefinition copy()
-
clear_parent_relation
public void clear_parent_relation()
Clears the parent relations, if any existed.
-
parse_var_kind
public void parse_var_kind(Scanner scanner)
Parse a var-kind record. Scanner should be pointing at the variable kind.
-
parse_enclosing_var_name
public void parse_enclosing_var_name(Scanner scanner)
Parses the enclosing-var record.
-
parse_reference_type
public void parse_reference_type(Scanner scanner)
Parses the reference-type record.
-
parse_array
public void parse_array(Scanner scanner)
Parses the array record.
-
parse_function_args
public void parse_function_args(Scanner scanner)
Parses the function-args record.
-
parse_rep_type
public void parse_rep_type(Scanner scanner)
-
parse_dec_type
public void parse_dec_type(Scanner scanner)
-
parse_flags
public void parse_flags(Scanner scanner)
Parse the flags record. Multiple flags can be specified.
-
parse_lang_flags
public void parse_lang_flags(Scanner scanner)
Parse the langauge specific flags record. Multiple flags can be specified.
-
parse_comparability
public void parse_comparability(Scanner scanner)
Parses a comparability record.
-
parse_parent
public void parse_parent(Scanner scanner, List<FileIO.ParentRelation> ppt_parents) throws Daikon.ParseError
Parse a parent ppt record.- Throws:
Daikon.ParseError
-
parse_constant
public void parse_constant(Scanner scanner)
Parse a constant record.
-
parse_min_value
public void parse_min_value(Scanner scanner)
Parse a minimum value record.
-
parse_max_value
public void parse_max_value(Scanner scanner)
Parse a maximum value record.
-
parse_min_length
public void parse_min_length(Scanner scanner)
Parse a minimum length record.
-
parse_max_length
public void parse_max_length(Scanner scanner)
Parse a maximum length record.
-
parse_valid_values
public void parse_valid_values(Scanner scanner)
Parse a valid values record.
-
need
public @Interned String need(Scanner scanner, String description)
Helper function, returns the next string token unescaped and interned. Throw Daikon.UserError if there is no next token.
-
need_eol
public void need_eol(Scanner scanner)
Throws Daikon.UserError if the scanner is not at end of line
-
parse_enum_val
public <E extends Enum<E>> E parse_enum_val(Scanner scanner, Class<E> enum_class, String descr)
Looks up the next token as a member of enum_class. Throws Daikon.UserError if there is no token or if it is not valid member of the class. Enums are presumed to be in in upper case.
-
-