Need urgent help please.

  • Thread starter Thread starter Srinivasa Parupalli
  • Start date Start date
S

Srinivasa Parupalli

Dear Friends,

I am struck up with logic. I am using one class(BMSLexer) which takes filename as arugument and the instance of the class is used my another class. example is shown below.

Now my requirement is parser should have a functionality in such a way that parser class should parse the file with the existing lexer funtionality and lexer class should have constructor with no arguments. Nxet when i call from Test calls by instancing the parser then i wil pass filename.

string inputFile = @"C:\test.txt";

System.IO.FileStream fs = new System.IO.FileStream(inputFile, System.IO.FileMode.Open);

Worksoft.Parsers.BMSLexer lexer = new Worksoft.Parsers.BMSLexer(fs);

Worksoft.Parsers.BMSParser parser = new Worksoft.Parsers.BMSParser(lexer);

string test = parser.parse();




--
Thanks & Regards,
P.Srinivasa Dinesh,
Developer,
ECMI.
Internet : (e-mail address removed)
(e-mail address removed)
Mobile No: +91-9850607089.
 
Hi,

You requirement is not clear but it seems not a hard thing??

let me go it this way

"lexer class should have constructor" OK

Worksoft.Parsers.BMSLexer lexer = new Worksoft.Parsers.BMSLexer(); //Fine right???

//If I assume that you need the fs in lexer as well..

lexer.setFileStream(fs);//Fine Right??

//As you said the lexer has some properties so depend on them you call methods in parser right

Worksoft.Parsers.BMSParser parser = new Worksoft.Parsers.BMSParser(lexer);

//I am not sure why you need the file name again here.. but if it is the requirement

string test = parser.parse(inputFile);

So ??? what is the problem??

Nirosh.
Dear Friends,

I am struck up with logic. I am using one class(BMSLexer) which takes filename as arugument and the instance of the class is used my another class. example is shown below.

Now my requirement is parser should have a functionality in such a way that parser class should parse the file with the existing lexer funtionality and lexer class should have constructor with no arguments. Nxet when i call from Test calls by instancing the parser then i wil pass filename.

string inputFile = @"C:\test.txt";

System.IO.FileStream fs = new System.IO.FileStream(inputFile, System.IO.FileMode.Open);

Worksoft.Parsers.BMSLexer lexer = new Worksoft.Parsers.BMSLexer(fs);

Worksoft.Parsers.BMSParser parser = new Worksoft.Parsers.BMSParser(lexer);

string test = parser.parse();




--
Thanks & Regards,
P.Srinivasa Dinesh,
Developer,
ECMI.
Internet : (e-mail address removed)
(e-mail address removed)
Mobile No: +91-9850607089.
 
Back
Top