[antlr-interest] problem with literal match

John Lambert johnl at jbase.com
Wed Oct 3 13:34:59 PDT 2001


Ruslan,

What options do you have in the lexer header?

I have

options { 
	defaultErrorHandler=false;	
	testLiterals=true; 
	caseSensitive=false; 
	caseSensitiveLiterals=false;
	charVocabulary = '\3'..'\377'; 
}


and it generates

void SQLLexer::initLiterals()
{
	literals["option"] = 51;
	literals["index"] = 43;
	literals["public"] = 30;
	literals["selectany"] = 63;
	literals["link"] = 15;

... etc ....

John


-----Original Message-----
From: Ruslan Zasukhin [mailto:sunshine at public.kherson.ua]
Sent: Wednesday, October 03, 2001 1:22 PM
To: antlr-interest at yahoogroups.com
Subject: Re: [antlr-interest] problem with literal match


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/ 


 

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



More information about the antlr-interest mailing list