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

Function yy_scan_bytes

src/parser/ds2_lexer.cpp:4200–4228  ·  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

4198 * @return the newly allocated buffer state object.
4199 */
4200YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len , yyscan_t yyscanner)
4201{
4202 YY_BUFFER_STATE b;
4203 char *buf;
4204 yy_size_t n;
4205 int i;
4206
4207 /* Get memory for full buffer, including space for trailing EOB's. */
4208 n = (yy_size_t) (_yybytes_len + 2);
4209 buf = (char *) yyalloc( n , yyscanner );
4210 if ( ! buf )
4211 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
4212
4213 for ( i = 0; i < _yybytes_len; ++i )
4214 buf[i] = yybytes[i];
4215
4216 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
4217
4218 b = yy_scan_buffer( buf, n , yyscanner);
4219 if ( ! b )
4220 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
4221
4222 /* It's okay to grow etc. this buffer, and we should throw it
4223 * away when we're done.
4224 */
4225 b->yy_is_our_buffer = 1;
4226
4227 return b;
4228}
4229
4230#ifndef YY_EXIT_FAILURE
4231#define YY_EXIT_FAILURE 2

Callers 4

ds2_lexer.cppFile · 0.70
yy_scan_stringFunction · 0.70
das2_accept_sequenceFunction · 0.70
das2_yybeginFunction · 0.70

Calls 2

yyallocFunction · 0.70
yy_scan_bufferFunction · 0.70

Tested by

no test coverage detected