YYLess equivalent in JLex

"Binesh Bannerjee" <binesh@hex21.com>
12 Jun 1999 21:25:53 -0400

          From comp.compilers

Related articles
YYLess equivalent in JLex binesh@hex21.com (Binesh Bannerjee) (1999-06-12)
Re: YYLess equivalent in JLex lsf@gmx.net (Gerwin Klein) (1999-06-14)
Re: YYLess equivalent in JLex binesh@hex21.com (Binesh Bannerjee) (1999-06-19)
Re: YYLess equivalent in JLex lsf@gmx.net (Gerwin Klein) (1999-06-27)
| List of all articles for this month |

From: "Binesh Bannerjee" <binesh@hex21.com>
Newsgroups: comp.compilers
Date: 12 Jun 1999 21:25:53 -0400
Organization: Hex21 Inc.
Keywords: lex, Java

Hi...
Here's the problem... I'm trying to parse "tagged text" in java
using JLex, and I want the parser to return a token "text" whenever it
sees a segment of text that doesn't contain a "<"... So...


I don't want to do this: (extreme pseudocode)
(I admit tho, that I don't want to do this because of my experience w/
lex/flex... and overflowing buffers etc.


([^<]|[\ \t\r\n\f])* { return(TEXT); }
"<" { yybegin(TAGSTATE); return(open_angle); }


What I WANT to do is this:
<YYINITIAL> "<" {
yybegin(TAG_CONTEXT);
returnvalue = _internal_buffer;
yyless(1);
return(TEXT);
}
<YYINITIAL> (.|[\ \t\r\n\f]) { _internal_buffer += yytext(); }
<TAG_CONTEXT> "<" { return(open_angle); }


But, I don't know how to do a yyless in JLex... Any clues, hints, suggestions?
Thanks in advance,
Binesh Bannerjee


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.