Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!samsung!crackers!cpoint!frog!bill From: bill@frog.UUCP (Bill Masek) Newsgroups: comp.unix.questions Subject: Re: lex & yacc questions Keywords: lex, yacc Message-ID: <18027@frog.UUCP> Date: 21 Aug 90 21:10:00 GMT References: <265@cti1.UUCP> Reply-To: bill@frog.UUCP (PUT YOUR NAME HERE) Distribution: comp Organization: Charles River Data Systems Lines: 25 In article <265@cti1.UUCP> mpledger@cti1.UUCP (Mark Pledger) writes: > >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 [Aa][Pp][Pp][Ll][Ii][Cc][Aa][Tt][Ii][Oo][Nn] for application. Define a regular expression that matches what you want. -- bill masek charles river data systems, inc (617) 491-5320 (h) (508) 626-1122 (w)