MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / yy_scan_bytes

Function yy_scan_bytes

src/parser/ds_lexer.cpp:4633–4661  ·  view source on GitHub ↗

Setup the input buffer state to scan the given bytes. The next call to yylex() will * scan from a @e copy of @a bytes. * @param yybytes the byte buffer to scan * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */

Source from the content-addressed store, hash-verified

4631 * @return the newly allocated buffer state object.
4632 */
4633YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len , yyscan_t yyscanner)
4634{
4635 YY_BUFFER_STATE b;
4636 char *buf;
4637 yy_size_t n;
4638 int i;
4639
4640 /* Get memory for full buffer, including space for trailing EOB's. */
4641 n = (yy_size_t) (_yybytes_len + 2);
4642 buf = (char *) yyalloc( n , yyscanner );
4643 if ( ! buf )
4644 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
4645
4646 for ( i = 0; i < _yybytes_len; ++i )
4647 buf[i] = yybytes[i];
4648
4649 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
4650
4651 b = yy_scan_buffer( buf, n , yyscanner);
4652 if ( ! b )
4653 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
4654
4655 /* It's okay to grow etc. this buffer, and we should throw it
4656 * away when we're done.
4657 */
4658 b->yy_is_our_buffer = 1;
4659
4660 return b;
4661}
4662
4663#ifndef YY_EXIT_FAILURE
4664#define YY_EXIT_FAILURE 2

Callers 4

ds_lexer.cppFile · 0.70
yy_scan_stringFunction · 0.70
das_accept_sequenceFunction · 0.70
das_yybeginFunction · 0.70

Calls 2

yyallocFunction · 0.70
yy_scan_bufferFunction · 0.70

Tested by

no test coverage detected