Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.compilers > #1655
| Path | csiph.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!news.misty.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end |
|---|---|
| From | Kaz Kylheku <kaz@kylheku.com> |
| Newsgroups | comp.compilers |
| Subject | Re: stop yyparse() at <<EOF>> |
| Date | Sun, 27 Dec 2015 10:59:48 -0500 (EST) |
| Organization | Aioe.org NNTP Server |
| Lines | 32 |
| Sender | news@iecc.com |
| Approved | comp.compilers@iecc.com |
| Message-ID | <15-12-008@comp.compilers> (permalink) |
| References | <15-12-007@comp.compilers> |
| Injection-Info | miucha.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="30871"; mail-complaints-to="abuse@iecc.com" |
| Keywords | lex, debug, comment |
| Posted-Date | 27 Dec 2015 10:59:48 EST |
| X-submission-address | compilers@iecc.com |
| X-moderator-address | compilers-request@iecc.com |
| X-FAQ-and-archives | http://compilers.iecc.com |
| Xref | csiph.com comp.compilers:1655 |
Show key headers only | View raw
On 2015-12-22, Jens Kallup <jkallup@web.de> wrote:
> (\"([a-zA-Z0-9_])*\")* {
> printf("1: %s\n",yytext); strcpy(yytext,"");
> BEGIN(STRINGER);
> strcpy(yytext,"");
[ snip ]
>
> Is that a Bug, or my mistakes?
Not saying this is the crash, but do not modify yytext; it is (or may
be) a pointer directly into the lexical analyzer's buffer, and not a
copy.
You might be confusing the flex scanner somehow by putting a null in
there.
> string_expr
> : _STRING_ { printf("---> %s\n",yylval.text); }
> ;
You haven't shown any lexer code which sets up yylval.text and returns
the _STRING_ token.
The lex rules you have surrounding your STRINGER state don't return
anything.
[Good points. In recent versoins of flex, yytext points into the
input buffer and chaning what it points to is asking for trouble.
If you need to change it, make a copy.
Also, there's no BEGIN(INITIAL) to reset the start states. -John]
Back to comp.compilers | Previous | Next — Previous in thread | Find similar | Unroll thread
stop yyparse() at <<EOF>> Jens Kallup <jkallup@web.de> - 2015-12-22 16:29 +0100 Re: stop yyparse() at <<EOF>> Kaz Kylheku <kaz@kylheku.com> - 2015-12-27 10:59 -0500
csiph-web