Commit cf6c118d authored by Arthur Redondy's avatar Arthur Redondy

changement de quelques messages d'erreurs + corrections de quelques bugs

parent ab75fb6b
......@@ -16,19 +16,16 @@ const string Error::_EXPECT_EVENT_DEF = "expected %EventDef";
const string Error::_EXPECT_NAME_DEF = "the definition is not named";
const string Error::_EXPECT_ID_DEF = "the definition is not identified";
const string Error::_UNKNOWN_ID_DEF = "there is no definition with the identity: ";
const string Error::_EXTRA_TOKEN_IN_DEF = "there are too much token";
const string Error::_EXTRA_TOKEN = "extra token(s) ignored";
const string Error::_UNKNOWN_EVENT_DEF = "the following event doesn't match with any event known: ";
const string Error::_FIELD_TYPE_MISSING = "a field type is missing ";
const string Error::_FIELD_TYPE_UNKNOWN = "a field type is unknown ";
const string Error::_FIELD_TYPE_UNKNOWN = "the following field type is unknown: ";
const string Error::_EMPTY_DEF = "a definition line is empty";
const string Error::_INCOMPATIBLE_VALUE_IN_EVENT = "incompatible value: ";
const string Error::_UNKNOWN_TYPE_IN_EVENT = "unknown type : ";
const string Error::_UNKNOWN_EVENT_IN_PARSER_DEF_NOT_FOUND = "unknown event name: ";
const string Error::_BAD_FILE_EXTENSION = "the extension of the file is not .trace";
const string Error::_LINE_TOO_LONG_EVENT = "extra token(s)";
const string Error::_LINE_TOO_SHORT_EVENT = "missing field value(s) in an event";
const string Error::_UNKNOWN_CONTAINER_TYPE = "Unknown container type : ";
const string Error::_UNKNOWN_CONTAINER_TYPE = "Unknown container type: ";
const string Error::_UNKNOWN_CONTAINER = "Unknown container: ";
const string Error::_UNKNOWN_EVENT_TYPE = "Unknown event type: ";
const string Error::_UNKNOWN_EVENT = "Unknown event: ";
......
......@@ -95,9 +95,9 @@ public:
*/
const static std::string _UNKNOWN_ID_DEF;
/*!
* \brief Define the error when some extra characters are ignored at the end of a line in a definition.
* \brief Define the error when some extra tokens are ignored at the end of a line.
*/
const static std::string _EXTRA_TOKEN_IN_DEF;
const static std::string _EXTRA_TOKEN;
/*!
* \brief Define the error when an event doesn't match with the event with the same name know by the parser.
*/
......@@ -107,7 +107,7 @@ public:
*/
const static std::string _FIELD_TYPE_MISSING;
/*!
* \brief Define the error when the type of a field in a definition is not recognized by the parser.
* \brief Define the error when the type of a field in not recognized by the parser.
*/
const static std::string _FIELD_TYPE_UNKNOWN;
/*!
......@@ -118,22 +118,10 @@ public:
* \brief Define the error when a value don't match with its type.
*/
const static std::string _INCOMPATIBLE_VALUE_IN_EVENT;
/*!
* \brief Define the error when a type is not reconized by the parser.
*/
const static std::string _UNKNOWN_TYPE_IN_EVENT;
/*!
* \brief Define the error when an event is not reconized by the parser.
*/
const static std::string _UNKNOWN_EVENT_IN_PARSER_DEF_NOT_FOUND;
/*!
* \brief Define the error when the file which has to be parse doesn't have the right extension.
*/
const static std::string _BAD_FILE_EXTENSION;
/*!
* \brief Define the error when some extra characters are ignored at the end of the line event.
*/
const static std::string _LINE_TOO_LONG_EVENT;
/*!
* \brief Define the error when some field values are missing for an event.
*/
......
......@@ -42,7 +42,7 @@ void ParserDefinitionDecoder::enter_definition(Line &line){
_current_definition = definition_identity;
if(line.length() > 4){
Error::set_and_print(Error::_EXTRA_TOKEN_IN_DEF, line.get_line_count(), Error::_WARNING);
Error::set_and_print(Error::_EXTRA_TOKEN, line.get_line_count(), Error::_WARNING);
}
_state = _IN_A_DEFINITION;
......@@ -79,11 +79,16 @@ void ParserDefinitionDecoder::add_field_to_definition(std::string& first_token,L
if(field_type != "string" && field_type != "int" && field_type != "hex" &&
field_type != "date" && field_type != "double" && field_type != "color"){
Error::set_and_print(Error::_FIELD_TYPE_UNKNOWN, line.get_line_count(), Error::_ERROR);
Error::set_and_print(Error::_FIELD_TYPE_UNKNOWN + field_type, line.get_line_count(), Error::_ERROR);
return;
}
_definitions[_current_definition].store(first_token, field_type);
if(line.length() > 3){
Error::set_and_print(Error::_EXTRA_TOKEN, line.get_line_count(), Error::_WARNING);
}
}
void ParserDefinitionDecoder::store_definition(Line &line){
......@@ -100,7 +105,7 @@ void ParserDefinitionDecoder::store_definition(Line &line){
else if (first_token == "EndEventDef"){
leave_definition(line);
if(line.length() > 2){
Error::set_and_print(Error::_EXTRA_TOKEN_IN_DEF, line.get_line_count(), Error::_WARNING);
Error::set_and_print(Error::_EXTRA_TOKEN, line.get_line_count(), Error::_WARNING);
}
}
else{
......
......@@ -148,7 +148,7 @@ void ParserEventDecoder::store_event(const Definition &definition, Line &line, T
extra_fields[fields[i-1]._name] = new Color(value);
}
else {
Error::set_and_print(Error::_UNKNOWN_TYPE_IN_EVENT + fields[i-1]._type, line.get_line_count(), Error::_WARNING);
Error::set_and_print(Error::_FIELD_TYPE_UNKNOWN + fields[i-1]._type, line.get_line_count(), Error::_WARNING);
return;
}
}
......@@ -156,8 +156,8 @@ void ParserEventDecoder::store_event(const Definition &definition, Line &line, T
i ++;
}
if(line.length() > i+1) {
Error::set_and_print(Error::_LINE_TOO_LONG_EVENT, line.get_line_count(), Error::_WARNING);
if(line.length() > i) {
Error::set_and_print(Error::_EXTRA_TOKEN, line.get_line_count(), Error::_WARNING);
}
Name alias_name;
......@@ -247,7 +247,7 @@ void ParserEventDecoder::store_event(const Definition &definition, Line &line, T
}
else {
Error::set_and_print(Error::_UNKNOWN_EVENT_IN_PARSER_DEF_NOT_FOUND + event_name, line.get_line_count(), Error::_WARNING);
Error::set_and_print(Error::_UNKNOWN_EVENT_DEF + event_name, line.get_line_count(), Error::_WARNING);
return;
}
}
......
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