dcsimg
exception lost when thrown in Parser::match(int t) function
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Muneer_Shareiff
Posted On:   Monday, May 13, 2002 01:29 PM

The following is my specification of my lexer and parser.. options {language = "Cpp";} class ASLParser extends Parser; options { exportVocab = ASL; buildAST=true; defaultErrorHandler = false; k = 3; } class ASLLexer extends Lexer; options { charVocabulary = '3'..'377'; exportVocab = ASL; k = 10; testLiterals = false; caseSensitiveLiterals = false; } The following is my main function... try { ASLLexer lexer(infile); ASLParser parser(lexer); pars   More>>

The following is my specification of my lexer and parser..

options {language = "Cpp";}

class ASLParser extends Parser;

options

{

exportVocab = ASL;

buildAST=true;

defaultErrorHandler = false;

k = 3;

}

class ASLLexer extends Lexer;

options
{

charVocabulary = '3'..'377';

exportVocab = ASL;

k = 10;

testLiterals = false;

caseSensitiveLiterals = false;

}



The following is my main function...

try

{

ASLLexer lexer(infile);

ASLParser parser(lexer);

parser.stmt_list();

RefASLNodeAST root = RefASLNodeAST(parser.getAST());

root -> Parsing();

}


catch (RecognitionException& ex)

{

cout < < "Error detected.." < < endl;

}



it seems that when an exception is thrown in ASLParser.cpp (NoViableAltException type), it is being caught in the above catch statement. but when it is thrown from the match function in Parser.cpp (MismatchedTokenException type), it gets lost somewhere and not caught... any idea what is going on??? by the way, the language i use is C++.



thanx.....

   <<Less
About | Sitemap | Contact