[fpc-pascal]absolute identifier

Jonas Maebe jonas at zeus.rug.ac.be
Wed Apr 10 15:52:11 CEST 2002


On dinsdag, maart 26, 2002, at 04:43 , ron wilson wrote:

> so in my application, yyleng is referencing the length of the string,
> yytext, by using the absolute identifier.  i thought i could change all
> references to yyleng to length(yytext), but the lexer often assigns 
> yyleng
> manually (ugh!), e.g. yyleng:=n; OR inc(yyleng);.

You can use setlength(yytext,n) and setlength(yytext,length(yytext)+1) 
in those cases. But when you're using ansistrings, make sure you do 
those length adaptions *before* you write anything past the previous 
end-of-string, since otherwise you'll get segmentation faults.


Jonas





More information about the fpc-pascal mailing list