MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / yy_get_next_buffer

Function yy_get_next_buffer

Engine/source/console/CMDscan.cpp:1431–1556  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1429 */
1430
1431static int yy_get_next_buffer()
1432 {
1433 char *dest = yy_current_buffer->yy_ch_buf;
1434 char *source = yytext_ptr;
1435 int number_to_move, i;
1436 int ret_val;
1437
1438 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
1439 YY_FATAL_ERROR(
1440 "fatal flex scanner internal error--end of buffer missed" );
1441
1442 if ( yy_current_buffer->yy_fill_buffer == 0 )
1443 { /* Don't try to fill the buffer, so this is an EOF. */
1444 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
1445 {
1446 /* We matched a singled characater, the EOB, so
1447 * treat this as a final EOF.
1448 */
1449 return EOB_ACT_END_OF_FILE;
1450 }
1451
1452 else
1453 {
1454 /* We matched some text prior to the EOB, first
1455 * process it.
1456 */
1457 return EOB_ACT_LAST_MATCH;
1458 }
1459 }
1460
1461 /* Try to read more data. */
1462
1463 /* First move last chars to start of buffer. */
1464 number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
1465
1466 for ( i = 0; i < number_to_move; ++i )
1467 *(dest++) = *(source++);
1468
1469 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1470 /* don't do the read, it's not guaranteed to return an EOF,
1471 * just force an EOF
1472 */
1473 yy_n_chars = 0;
1474
1475 else
1476 {
1477 int num_to_read =
1478 yy_current_buffer->yy_buf_size - number_to_move - 1;
1479
1480 while ( num_to_read <= 0 )
1481 { /* Not enough room in the buffer - grow it. */
1482#ifdef YY_USES_REJECT
1483 YY_FATAL_ERROR(
1484"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1485#else
1486
1487 /* just a shorter name for the current buffer */
1488 YY_BUFFER_STATE b = yy_current_buffer;

Callers 2

CMDscan.cppFile · 0.85
inputFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected