So I have a simple carriage-return separated file that reads:
room(800,400)
place(desk, 5, 6)
place(chair, 8, 5)
place(bed, 6, 6)
place(closet, 1, 4)
I am trying to store the occurrence of each keywords (desk, chair, bed and closet) and the related x, y and store somewhere (not important!) and extract the room dimensions and again store somewhere. My code looks like:
#include <iostream>
#include <fstream>
#include <string>
using namepace std;
void Keyword(ifstream & stream, string token) {
    string line;
    while (getline(stream, line)) {
        if (line.find(token) != string::npos) {
            cout << line << endl;
            if(token == "room") {
                //store the numbers and string to somewhere
            }
            if (token == "table") {
                //store the numbers and string to somewhere
            }
        }
    }
    cout << token << " Not Found!" << endl;
}
int main()
{
    // Shape Grammar Parser  
    ifstream infile("shape.dat");
    Keyword(infile, "room");    
    return 0;
}
What I am trying to do is, when the parser sees place(chair, 8, 5) it stores in a data structure chair, 8, 5, or when it sees room it extracts room, 800, 400. 
However the above implementation is broken as with this implementation I can only extract chair and not the related numbers. How can that be done? I am totally inexperienced with regular expressions so I did not try it.
 
     
     
    