which scans in place the buffer starting at base, consisting of size bytes, the last two bytes of which must be YY_END_OF_BUFFER_CHAR (ASCII NUL). These last two bytes are not scanned; thus, scanning consists of base[0] through base[size-2], inclusive.
If you fail to set up base in this manner (i.e., forget the final two YY_END_OF_BUFFER_CHAR bytes), then yy_scan_buffer() returns a NULL pointer instead of creating a new input buffer.
[^] # Re: YY_INPUT
Posté par scls19fr (site web personnel) . En réponse au message Parser une chaine de caractère en C avec Flex/Bison. Évalué à 1.
ok pour le \n .... je n'y avais vraiment pas pensé !!!!!
sinon je crois qu'il existe une fonction nommé yy_scan_string...
ne peut-elle pas servir à cet usage ?
http://flex.sourceforge.net/manual/Multiple-Input-Buffers.ht(...)
Function: YY_BUFFER_STATE yy_scan_buffer (char *base, yy_size_t size)
which scans in place the buffer starting at base, consisting of size bytes, the last two bytes of which must be YY_END_OF_BUFFER_CHAR (ASCII NUL). These last two bytes are not scanned; thus, scanning consists of base[0] through base[size-2], inclusive.
If you fail to set up base in this manner (i.e., forget the final two YY_END_OF_BUFFER_CHAR bytes), then yy_scan_buffer() returns a NULL pointer instead of creating a new input buffer.