help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: token value return in custom yylex()


From: Nils Hasler
Subject: Re: token value return in custom yylex()
Date: Wed, 04 Dec 2002 09:52:19 +0100
User-agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.0.0) Gecko/20020530

hi bernd.

you need some check for end-of-string in your for()-loop. the easiest would be somthing like:

  for (i = 0; clone[0] && (strchr(delimiters, clone[0])==NULL); i++) {
     if (clone[0] == '\\') {   // escape next character
       clone++;
     }
     yytext[i] = clone[0];
     clone++;
  }

the (i < length) construct doesn't work, because you increase the base-pointer (clone) without reducing the length. the other solution to your problem would be to --length whereever you ++clone.

nils






reply via email to

[Prev in Thread] Current Thread [Next in Thread]