[ragel-users] Re: can't pull parse strings - BUG?

Adrian Thurston thurs... at cs.queensu.ca
Mon Feb 5 19:24:27 UTC 2007


Hi,

The variable "act" is needed by scanners when they must backtrack to the
last matched rule and the rule cannot be determined statically. You can just
add "int act;" alongside tokstart et al. Section 2.7 of the manual will help
you out.

Cheers,
 Adrian

Jason wrote:
> Great! Strings now work.
> 
> However :-(
> 
> I added in rules to distinguish between integers and floats (reals).
> 
> 	# Numbers
> 	digit+ => {
> 		ret_tok (TK_Integer); fbreak;
> 	};
> 
> 	digit+'.' digit+ => {
> 		ret_tok (TK_Real); fbreak;
> 	};
> 
> Those were OK but I also want to recognize numbers separated by commas
> (e.g. 1,299 and 1,299.987).
> 
> So I added these rules
> 
> 	digit{1,3} (',' digit{3})+ {
> 		ret_tok (TK_Integer); fbreak;
> 	};
> and
> 	digit{1,3} (',' digit{3})+ '.' digit+ {
> 		ret_tok (TK_Real); fbreak;
> 	};
> 
> But this reports the following error:
> 
> ragel pullscan.rl | rlcodegen -G2 -o pullscan.c
> gcc -pedantic -Wall -O3 -g -c -o pullscan.o pullscan.c
> pullscan.rl: In function 'scan':
> pullscan.rl:1: error: 'act' undeclared (first use in this function)
> pullscan.rl:1: error: (Each undeclared identifier is reported only
> once
> pullscan.rl:1: error: for each function it appears in.)
> make: *** [pullscan.o] Error 1
> 
> Any ideas?
> 
> thanks,
> Jason
> 
> 
> 



More information about the ragel-users mailing list