<div>Epic formatting fail. I hope it will be better this time. Sorry ..</div><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>Additionally, I've seen in the documentation that getkey could be</div><div>employed to change the buffer input. Is there an example using</div>
<div>standard c++ istreams ?</div><div><br></div><div>-- </div><div>Maël Nison</div><div>Epitech 2014, Paris - Astek</div><div><br></div>