Commit 57b8c607 authored by Arthur Redondy's avatar Arthur Redondy
Browse files

debugage du parser

parent e44cc9ae
......@@ -74,7 +74,7 @@ bool Definition::check_definition() const{
has_name_or_alias = true;
}
// We check if we have the container
else if(_fields[i]._name == "Container" && (_fields[i]._type == "string" || _fields[i]._type == "integer")){
else if(_fields[i]._name == "Container" && (_fields[i]._type == "string" || _fields[i]._type == "integer" || _fields[i]._type == "int")){
has_container = true;
}
// We check if we have the time
......@@ -82,7 +82,7 @@ bool Definition::check_definition() const{
has_time = true;
}
// We check if we have the type
else if(_fields[i]._name == "Type" && (_fields[i]._type == "string" || _fields[i]._type == "integer")){
else if(_fields[i]._name == "Type" && (_fields[i]._type == "string" || _fields[i]._type == "integer" || _fields[i]._type == "int")){
has_type = true;
}
// We return true if we have the compulsory fields and we don't care of others
......@@ -107,7 +107,7 @@ bool Definition::check_definition() const{
has_time = true;
}
// We check if we have the type
else if(_fields[i]._name == "Type" && (_fields[i]._type == "string" || _fields[i]._type == "integer")){
else if(_fields[i]._name == "Type" && (_fields[i]._type == "string" || _fields[i]._type == "integer" || _fields[i]._type == "int")){
has_type = true;
}
// We return true if we have the compulsory fields and we don't care of others
......@@ -184,11 +184,11 @@ bool Definition::check_definition() const{
has_time = true;
}
// We check if we have the type
else if(_fields[i]._name == "Type" && (_fields[i]._type == "string" || _fields[i]._type == "integer")){
else if(_fields[i]._name == "Type" && (_fields[i]._type == "string" || _fields[i]._type == "integer" || _fields[i]._type == "int")){
has_type = true;
}
// We check if we have the value
else if(_fields[i]._name == "Value" && (_fields[i]._type == "string" || _fields[i]._type == "integer")){
else if(_fields[i]._name == "Value" && (_fields[i]._type == "string" || _fields[i]._type == "integer" || _fields[i]._type == "int")){
has_Value = true;
} // We return true if we have the compulsory fields and we don't care of others
if(has_Container && has_time && has_type && has_Value){
......
......@@ -58,7 +58,7 @@ void ParserDefinitionDecoder::add_field_to_definition(std::string& first_token,L
string field_type;
DIE_IF(!line.item(2, field_type), "Error : a field type is missing");
DIE_IF(field_type!="string"&&field_type!="integer"&&field_type!="hex"&&field_type!="date"&&field_type!="double"&&field_type!="color", "Error : unknown type");
DIE_IF(field_type!="string"&&field_type!="int"&&field_type!="hex"&&field_type!="date"&&field_type!="double"&&field_type!="color", "Error : unknown type");
_definitions[_current_definition].store(first_token, field_type);
}
......
......@@ -136,7 +136,7 @@ void ParserEventDecoder::store_event(const Definition &definition, Line &line, T
}
extra_fields.push_back(&value);
}
else if(fields[i-1]._type == "integer") {
else if(fields[i-1]._type == "integer" || fields[i-1]._type == "int") {
Integer value;
if(!Integer::instantiate(current_value, value)) {
cout << "warning : incompatible value" << endl;
......@@ -161,7 +161,7 @@ void ParserEventDecoder::store_event(const Definition &definition, Line &line, T
i++;
}
if(line.length() > i) {
if(line.length() > i+1) {
cout << "warning : extra value(s)" << endl;
}
......@@ -235,11 +235,15 @@ void ParserEventDecoder::store_event(const Definition &definition, Line &line, T
}
else if(event_name == "PajeSubVariable") {
trace.add_variable(time, trace.search_variable_type(type), trace.search_container(container), value_double, extra_fields);
trace.sub_variable(time, trace.search_variable_type(type), trace.search_container(container), value_double, extra_fields);
}
else if(event_name == "PajeStartLink") {
//trace.add_variable(time, trace.search_link_type(type), trace.search_container(container), trace.search_container(source_container), trace.search_entity_value(value_string), key, extra_fields);
trace.start_link(time, trace.search_link_type(type), trace.search_container(container), trace.search_container(source_container), trace.search_entity_value(value_string), key, extra_fields);
}
else if(event_name == "PajeEndLink") {
trace.end_link(time, trace.search_link_type(type), trace.search_container(container), trace.search_container(dest_container), trace.search_entity_value(value_string), key, extra_fields);
}
else {
......
......@@ -242,18 +242,18 @@ void Trace::sub_variable(Date time, VariableType *type, Container *container, Do
}
void Trace::start_link(Date time, LinkType *type, Container *ancestor, Container *source, EntityValue value, Integer key, const vector<Value*> &opt){
void Trace::start_link(Date time, LinkType *type, Container *ancestor, Container *source, EntityValue *value, String key, const vector<Value*> &opt){
cout << "start_link "
<< time.to_string()
<< " "
<< type
<< *type
<< " "
<< ancestor
<< *ancestor
<< " "
<< source
<< *source
<< " "
<< value
<< *value
<< " "
<< key.to_string()
<< " "
......@@ -263,20 +263,20 @@ void Trace::start_link(Date time, LinkType *type, Container *ancestor, Container
void Trace::end_link(Date time, LinkType *type, Container *ancestor, Container *destination, EntityValue *value, Integer key, const vector<Value*> &opt){
void Trace::end_link(Date time, LinkType *type, Container *ancestor, Container *destination, EntityValue *value, String key, const vector<Value*> &opt){
cout << "start_link "
cout << "end_link "
<< time.to_string()
<< " "
<< type
<< *type
<< " "
<< ancestor
<< *ancestor
<< " "
<< destination
<< *destination
<< " "
<< value
<< *value
<< " "
<< key.to_string()
<< key.to_string()
<< " "
<< to_string(opt)
<< endl;
......@@ -318,29 +318,26 @@ void Trace::end_link(Date time, LinkType *type, Container *ancestor, Container *
Container *Trace::search_variable_type(String name) {
VariableType *Trace::search_variable_type(String name) {
res = "search(" + name.to_string() + ")";
return &res;
}
Container *Trace::search_link_type(String name) {
LinkType *Trace::search_link_type(String name) {
res = "search(" + name.to_string() + ")";
return &res;
}
Container *Trace::search_entity_value(String name) {
EntityValue *Trace::search_entity_value(String name) {
res = "search(" + name.to_string() + ")";
return &res;
}
Container *Trace::search_entity_type(String name)
{
EntityType *Trace::search_entity_type(String name){
res = "search(" + name.to_string() + ")";
return &res;
}
......@@ -245,7 +245,7 @@ public :
*\param String : the value of the variable
*
*/
void start_link(Date time, LinkType *type, Container *ancestor, Container *source, EntityValue value, Integer key, const std::vector<Value*> &opt);
void start_link(Date time, LinkType *type, Container *ancestor, Container *source, EntityValue *value, String key, const std::vector<Value*> &opt);
/*!
......@@ -260,7 +260,7 @@ public :
*\param String : the value of the variable
*
*/
void end_link(Date time, LinkType *type, Container *ancestor, Container *destination, EntityValue *value, Integer key, const std::vector<Value*> &opt);
void end_link(Date time, LinkType *type, Container *ancestor, Container *destination, EntityValue *value, String key, const std::vector<Value*> &opt);
/*!
......@@ -311,7 +311,7 @@ public :
* \brief search a variable type by his name or alias
*
*/
Container *search_variable_type(String name) ;
VariableType *search_variable_type(String name);
/*!
......@@ -320,15 +320,14 @@ public :
* \brief search a container by his name or alias
*
*/
VariableType *search_link_type(String name); /*!
LinkType *search_link_type(String name); /*!
*
* \fn search_entity_value
* \brief search a container by his name or alias
*
*/
Container *search_entity_value(String name) ;
Container *search_entity_type(String name) ;
EntityValue *search_entity_value(String name) ;
EntityType *search_entity_type(String name) ;
};//end class
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment