Commit 9171a24c authored by Pascal Noisette's avatar Pascal Noisette

Distinction lexical (TokenSource) et syntaxique (Line)

parent 63cb25dd
......@@ -22,10 +22,11 @@ void Definition::store(std::string name, std::string value){
}
void Definition::print(){
cout << "Name : " << _event_name << endl;
cout << " Fields :" << endl;
cout << _event_name << endl;
for(unsigned int i = 0 ; i < _fields.size() ; i ++){
cout << _fields[i]._name << " | " << _fields[i]._type << endl;
cout << " " << _fields[i]._name << " " << _fields[i]._type << endl;
}
cout << "______" << endl;
}
......@@ -10,9 +10,9 @@ int ParserDefinitionDecoder::definitions_number(){
void ParserDefinitionDecoder::store_definition(Line &line){
//read the definition header
string &definition_name = line.item(1);
string &definition_name = line.item(2);
const char *definition_identity_string= line.item(2).c_str();
const char *definition_identity_string= line.item(3).c_str();
int definition_identity = atoi(definition_identity_string);
......@@ -24,11 +24,17 @@ void ParserDefinitionDecoder::store_definition(Line &line){
line.clear();
//read and store the parameters list
string final = "%EndEventDef";
string final = "EndEventDef";
while (!line.eof()){
line.newline();
if(line.starts_with(final))
//std::cout << "line " << line.item(0)<< " " << line.item(1);
if(line.item(1) == final)
{
//std::cout << "end" <<endl;
break;
}
else
;//std::cout << "continue"<< endl;
if (line.length()!=3)//verifier le % au lieu de tester le nombre de token
//ajouter un warning vers l'interface
......@@ -40,7 +46,8 @@ void ParserDefinitionDecoder::store_definition(Line &line){
line.clear();
}
line.clear();
_definitions.insert(pair<int,Definition>(definition_identity, current_definition));
_definitions.insert(pair<int,Definition>(definition_identity, current_definition));
}
Definition& ParserDefinitionDecoder::get_definition(int i){
......@@ -52,10 +59,10 @@ void ParserDefinitionDecoder::print_definitions(){
map<int,Definition>::iterator it;
for (it = _definitions.begin (); it != _definitions.end() ; ++ it){
// (*it).second represents the current definition
cout << "definition number = " << (*it).first << " :" << endl;
cout << "# " << (*it).first << endl;
(*it).second.print();
}
}
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