Ya that's a perfectly reasonable way to do it. I'd like to design ragel for the most common case. I *think* making pe, pe and eof local is more common, but I could be wrong.

-Adrian

On 11-04-25 09:02 PM, Brian Maher wrote:
If it makes a difference, I actually keep p, pe, and eof in my
"struct" for managing ragel state, so if %access defined a prefix for
*all* state variables, then it would be a welcome change from my
perspective.

Although Adrian is right about p, pe, and eof being rather
"transient", I find it easier to write functions that take a single
"struct" argument that manages the ragel state.  This way I can write
a function called state_machine that encapsulates all my actions for
the state machine, but ends up delegating each action to a function
that takes the "struct" as an argument.  I just find this way of
writing code is easier for me and my editor to digest.

Cheers,
-Brian

On Mon, Apr 25, 2011 at 9:06 AM, Adrian Thurston<[email protected]>  wrote:
Hi,

The p, pe, and eof variables are not modified because they do not need to be
maintained across partial executions of state machines. They are normally
declared as local variables in the function that contains the write exec.

The cs variable should be modified. If you are finding it isn't for some
language, then that would definitely be a bug.

-Adrian

On 11-04-25 12:37 AM, ygrek wrote:

Hello,

  Is there any reason why %access defines prefix for all state variables
except some (p,pe,cs,eof)?
  I think it would be useful to specify prefix for all state variables (and
then override some variables if
  needed with individual %variable declarations).


--
Dr. Adrian D. Thurston
http://www.complang.org/thurston/

_______________________________________________
ragel-users mailing list
[email protected]
http://www.complang.org/mailman/listinfo/ragel-users





_______________________________________________
ragel-users mailing list
[email protected]
http://www.complang.org/mailman/listinfo/ragel-users

Reply via email to