Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cmcl2!rutgers!galaxy!andromeda!dave From: dave@andromeda.rutgers.edu (Dave Bloom) Newsgroups: comp.unix.wizards Subject: LEX Questions Message-ID: <274@galaxy> Date: Fri, 13-Nov-87 11:25:56 EST Article-I.D.: galaxy.274 Posted: Fri Nov 13 11:25:56 1987 Date-Received: Sun, 15-Nov-87 10:09:18 EST Sender: news@galaxy Reply-To: dave@andromeda (Dave Bloom) Organization: Rutgers University, Newark, NJ Lines: 42 Keywords: yymore start-conditions Two Questions concerning the use of lex: (1) What is it PRECISELY that yymore() does? Does it: continue reading characters in the current rule until it finds a match, and then keeps the whole string in yytext? (This is how I see it, but the documentation is not very specific.) If it doesn't find a match, does the WHOLE STRING get checked in later rules? (2) From what I understand, you're always in START condition 0 unless you hit a BEGIN Q. (Where Q is a previously defined start condition) You finish the action where you hit the BEGIN Q statement and then start on a new token, but now all the patterns starting with a are available. Is this true? Is it true that a pattern that starts with can never be checked unless you hit a BEGIN Q in some previous action? I ask these questions because I am trying to recognize strings as anything between two " symbols including \" . This is what I have that doesn't work: \"[^"]*\" { if(yytext[yyleng-2] == '\\') { BEGIN Q; yymore(); } else return(STRING); } [^"]*\" { if(yytext[yyleng-2] == '\\') { BEGIN Q; yymore(); } else return(STRING); } I am more concerned whith what I'm doing wrong than how to do it right. If you have any ideas, please reply by email. (I rarely read this group.) Thanx. seismo \ pyramid \ Dave Bloom ihnp4!packard >!rutgers >!andromeda!dave Office: (201) 648-5083 allegra / hoxna /