lex & yacc questions

Bill Masek bill at frog.UUCP
Wed Aug 22 07:10:00 AEST 1990


In article <265 at cti1.UUCP> mpledger at 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)



More information about the Comp.unix.questions mailing list