#define LAB_DEFINED 1 |
whether label has been defined or is defined by this call
Referenced by check_labels(), do_NamedWfPattern(), do_XMLTag(), and simulate().
#define LAB_RDAT 8 |
name space #2 used for s-attribute region boundaries by query engine
Referenced by do_XMLTag(), findlabel(), labellookup(), simulate(), and symbol_table_new_iterator().
#define LAB_SPECIAL 4 |
special labels must not be set/modified by user; defined/used consistency isn't checked for special labels
Referenced by check_labels(), do_IDReference(), do_LabelReference(), do_NamedWfPattern(), and labellookup().
#define LAB_USED 2 |
whether label has been used (i.e.
read out) or is used by this call
Referenced by check_labels(), do_IDReference(), do_LabelReference(), do_NamedWfPattern(), do_XMLTag(), and simulate().
typedef struct _label_entry * LabelEntry |
LabelEntry: the symbol tables are made up of two linked lists of.
typedef struct _symbol_table * SymbolTable |
The SymbolTable object.
cqp-2.2 uses a global symbol table to store label references which gives erroneous results for queries that contain optional elements. A proper treatment of labels requires each of the simulations traversing the NFA in parallel to have its own symbol table. Since the actual symbols are the same for all states, it is more efficient to split the symbol tables into symbol lookup and the actual data. Each simulation has its own data array (which stores corpus positions), but symbol lookup is shared between all simulations and returns an _index_ into the data array. If a simulation branches -- which happens at the left edge of alternatives or optional elements -- the symbol data array must be duplicated.
A symbol table now contains multiple namespaces (accessed by flags such as LAB_RDAT
int check_labels | ( | SymbolTable | st | ) |
References cqpmessage(), _label_entry::flags, LAB_DEFINED, LAB_SPECIAL, LAB_USED, _label_entry::name, _label_entry::next, _symbol_table::user, and Warning.
Referenced by do_SearchPattern().
void delete_reftab | ( | RefTab | rt | ) |
References _RefTab::data.
Referenced by check_alignment_constraints(), and simulate_dfa().
void delete_symbol_table | ( | SymbolTable | st | ) |
References free_labellist(), _symbol_table::rdat, and _symbol_table::user.
Referenced by free_environment().
void droplabel | ( | SymbolTable | st, | |
LabelEntry | l | |||
) |
References _RefTab::data, and _RefTab::size.
Referenced by eval_constraint(), and simulate().
LabelEntry findlabel | ( | SymbolTable | st, | |
char * | s, | |||
int | flags | |||
) |
References LAB_RDAT, _label_entry::name, _label_entry::next, _symbol_table::rdat, and _symbol_table::user.
Referenced by do_XMLTag(), and labellookup().
int get_reftab | ( | RefTab | rt, | |
int | index, | |||
int | cpos | |||
) |
References _RefTab::data, and _RefTab::size.
Referenced by eval_constraint(), get_label_referenced_position(), print_label_values(), and simulate().
LabelEntry labellookup | ( | SymbolTable | st, | |
char * | s, | |||
int | flags, | |||
int | create | |||
) |
References cl_malloc(), cl_strdup(), field_name_to_type(), findlabel(), _label_entry::flags, LAB_RDAT, LAB_SPECIAL, _label_entry::name, _label_entry::next, _symbol_table::next_index, NoField, _symbol_table::rdat, _label_entry::ref, and _symbol_table::user.
Referenced by do_IDReference(), do_LabelReference(), do_NamedWfPattern(), and do_XMLTag().
RefTab new_reftab | ( | SymbolTable | st | ) |
References cl_malloc(), _RefTab::data, _symbol_table::next_index, and _RefTab::size.
Referenced by check_alignment_constraints(), and simulate_dfa().
SymbolTable new_symbol_table | ( | ) |
References cl_malloc(), _symbol_table::next_index, _symbol_table::rdat, and _symbol_table::user.
Referenced by next_environment().
void print_label_values | ( | SymbolTable | st, | |
RefTab | rt, | |||
int | cpos | |||
) |
Prints the current label values (for debugging).
st | The SymbolTable | |
rt | ||
cpos | The corpus position |
References get_reftab(), _label_entry::name, _label_entry::next, _symbol_table::next_index, _symbol_table::rdat, _label_entry::ref, _RefTab::size, and _symbol_table::user.
Referenced by simulate().
void print_symbol_table | ( | SymbolTable | st | ) |
References _label_entry::flags, _label_entry::name, _label_entry::next, _symbol_table::rdat, _label_entry::ref, and _symbol_table::user.
Referenced by simulate_dfa().
void reset_reftab | ( | RefTab | rt | ) |
References _RefTab::data, and _RefTab::size.
Referenced by simulate(), and simulate_dfa().
void set_reftab | ( | RefTab | rt, | |
int | index, | |||
int | value | |||
) |
References cqpmessage(), _RefTab::data, Error, and _RefTab::size.
Referenced by eval_bool(), eval_constraint(), get_leaf_value(), and simulate().
LabelEntry symbol_table_iterator | ( | LabelEntry | prev, | |
int | flags | |||
) |
References _label_entry::flags, and _label_entry::next.
Referenced by simulate(), and symbol_table_new_iterator().
LabelEntry symbol_table_new_iterator | ( | SymbolTable | st, | |
int | flags | |||
) |
References _label_entry::flags, LAB_RDAT, _symbol_table::rdat, symbol_table_iterator(), and _symbol_table::user.
Referenced by simulate().