Path: utzoo!attcan!uunet!jarthur!watson!ssdken From: ssdken@watson.Claremont.EDU (Ken Nelson) Newsgroups: comp.lang.c Subject: Re: lex & yacc questions Keywords: lex, yacc Message-ID: <8144@jarthur.Claremont.EDU> Date: 20 Aug 90 17:39:10 GMT References: <266@cti1.UUCP> Sender: news@jarthur.Claremont.EDU Reply-To: ssdken@watson.Claremont.EDU (Ken Nelson) Distribution: comp Lines: 37 > PROBLEM 3 ------------------------------------ :-( > I asked this before but did'nt get a response. I'm trying to write a > grammer for a context, case-insensitive grammer (Unify RDBMS command > language). I know that you can specify lower or upper case letters > by defining letters in the lex rules section. In my example > I am using letters [A-Za-z'_'] to match upper or lower case characters > and possibly the underscore. My question is this, how can you get > lex to match a reserved word you have declared, whether it's upper case > or not. For example, Unify has the reserved command word "application". > I wish to scan for this word using lex and return to yyparse() whether > the reserved word "application" is found as "application", "APPLICATION", > "Application", "APPlication", etc. What do you specify in lex to do > this. I tried using "APPLICATION" in the rules section (e.g. > "APPLICATION" { return(APP); } where APP is a #define). However, this > only works if the token found is already capitalized. Try this: [Aa][Pp][Pp][Ll][Ii][Cc][Aa][Tt][Ii][Oo][Nn] { return _APPLICATION; } this will match no matter what combination of case is used. Hope this helps. Ken Nelson Principal Engineer Software Systems Design 3627 Padua Av. Claremont, CA 91711 (714) 624-3402