MCPcopy Create free account
hub / github.com/KDE/kdevelop / yy_get_next_buffer

Function yy_get_next_buffer

plugins/cmake/parser/cmListFileLexer.c:1346–1477  ·  view source on GitHub ↗

yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */

Source from the content-addressed store, hash-verified

1344 * EOB_ACT_END_OF_FILE - end of file
1345 */
1346static int yy_get_next_buffer (yyscan_t yyscanner)
1347{
1348 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1349 char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1350 char *source = yyg->yytext_ptr;
1351 yy_size_t number_to_move, i;
1352 int ret_val;
1353
1354 if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
1355 YY_FATAL_ERROR(
1356 "fatal flex scanner internal error--end of buffer missed" );
1357
1358 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1359 { /* Don't try to fill the buffer, so this is an EOF. */
1360 if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
1361 {
1362 /* We matched a single character, the EOB, so
1363 * treat this as a final EOF.
1364 */
1365 return EOB_ACT_END_OF_FILE;
1366 }
1367
1368 else
1369 {
1370 /* We matched some text prior to the EOB, first
1371 * process it.
1372 */
1373 return EOB_ACT_LAST_MATCH;
1374 }
1375 }
1376
1377 /* Try to read more data. */
1378
1379 /* First move last chars to start of buffer. */
1380 number_to_move = (yy_size_t) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
1381
1382 for ( i = 0; i < number_to_move; ++i )
1383 *(dest++) = *(source++);
1384
1385 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1386 /* don't do the read, it's not guaranteed to return an EOF,
1387 * just force an EOF
1388 */
1389 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
1390
1391 else
1392 {
1393 int num_to_read =
1394 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1395
1396 while ( num_to_read <= 0 )
1397 { /* Not enough room in the buffer - grow it. */
1398
1399 /* just a shorter name for the current buffer */
1400 YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
1401
1402 int yy_c_buf_p_offset =
1403 (int) (yyg->yy_c_buf_p - b->yy_ch_buf);

Callers 2

cmListFileLexer.cFile · 0.85
inputFunction · 0.85

Calls 2

Tested by

no test coverage detected