It seems to work if I manually set p = te; just before returning, but I don't really know if it's a good practice.<br><br><div class="gmail_quote">On 5 January 2012 16:20, Maël Nison <span dir="ltr"><<a href="mailto:nison.mael@gmail.com">nison.mael@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>Epic formatting fail. I hope it will be better this time. Sorry ..</div><div><div class="h5"><div><br></div><div>
Hi,</div>
<div><br></div><div>I would like to write a very basic function taking a c++ char const *</div><div>&, and returning the first token type.</div>
<div>The reference would imply that the cstring pointer's target is, after</div><div>the function call, the very next character of the returned token.</div><div><br></div><div>Then I would be able to make :</div><div>


while ( token = getNextToken( foo ) )</div><div>  std::cout << token << std::endl;</div><div><br></div><div>I've tried to use something like that (example, probably does not</div><div>compile),  but the value of 'p' is not modified when returning</div>


<div>(infinite loop) :</div><div><br></div><div>#include "Token.hh"</div><div>%%machine foo;</div><div>%%write data;</div><div><br></div><div>int getNextToken( char const * & p ) {</div><div>  %%{</div><div>


    foo = "foo";</div><div>    main := |* foo => { return Foo; }; *|;</div><div>  }%%;</div><div><br></div><div>  int cs;</div><div>  int act;</div><div>  char const * ts;</div><div>  char const * te;</div><div>


  char const * eof;</div><div><br></div><div>  %% write init;</div><div>  %% write exec noend;</div><div>}</div><div><br></div></div></div><div>Additionally, I've seen in the documentation that getkey could be</div><div class="im HOEnZb">

<div>employed to change the buffer input. Is there an example using</div>
<div>standard c++ istreams ?</div><div><br></div></div><div class="HOEnZb"><div class="h5"><div>-- </div><div>Maël Nison</div><div>Epitech 2014, Paris - Astek</div><div><br></div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Maël Nison<br>Epitech 2014, Paris - Astek<br><br>