[antlr-interest] problem with literal match

Ruslan Zasukhin sunshine at public.kherson.ua
Wed Oct 3 13:22:12 PDT 2001


on 10/3/01 22:35, Ruslan Zasukhin at sunshine at public.kherson.ua wrote:

I wonder that may be problem is hidden that the next function is EMPTY in
generated code? 

void OBL_SQL_Lexer::initLiterals()
{
}

But then I wonder why I must init table of Literals by hands ???
And how to do this ?
I don't see nothing helpful in examples and docs.


> Hi All,
> 
> I have in grammar rule as:
> 
> -------------------------------------------------
> drop_table_statement
> :    "drop"! "table"! table_name drop_behavior
> ;
> 
> 
> in generated parser I see that in table ANTLR put literals with ""
> -------------------------------------------------
> const char* OBL_SQL_Parser::tokenNames[] = {
> "<0>",
> "EOF",
> ........       
> "\"drop\"",
> "\"table\"",
> "\"cascade\"",
> "\"restrict\"",
> 0
> };
> 
> 
> Now I try to pass to Parser test string "DROP TABLE errors"
> I see in debugger that function
> 
> int CharScanner::testLiteralsTable(int ttype) const
> {
> STD::map<STD::string,int,CharScannerLiteralsLess>::const_iterator i =
> literals.find(text);
> if (i != literals.end())
> ttype = (*i).second;
> return ttype;
> }
> 
> DO NOT FIND first word 'DROP' in my test string.
> 
> NOTES:
> ** CASE is not sensitive.
> ** I did try testLiterals as true so false.
> 
> WHERE IS PROBLEM ???

-- 
Best regards,
Ruslan Zasukhin

-------------------------
Paradigma.

e-mail: ruslan at paradigmasoft.com
web   : http://www.paradigmasoft.com

To subscribe to the Valentina mail list
send a letter to valentina-on at lists.macserve.net



 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list