MCPcopy Create free account
hub / github.com/Singular/Singular / yy_get_next_buffer

Function yy_get_next_buffer

Singular/scanner.cc:1550–1677  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1548 */
1549
1550static int yy_get_next_buffer()
1551 {
1552 REGISTER char *dest = yy_current_buffer->yy_ch_buf;
1553 REGISTER char *source = yytext_ptr;
1554 REGISTER int number_to_move, i;
1555 int ret_val;
1556
1557 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
1558 YY_FATAL_ERROR(
1559 "fatal flex scanner internal error--end of buffer missed" );
1560
1561 if ( yy_current_buffer->yy_fill_buffer == 0 )
1562 { /* Don't try to fill the buffer, so this is an EOF. */
1563 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
1564 {
1565 /* We matched a single character, the EOB, so
1566 * treat this as a final EOF.
1567 */
1568 return EOB_ACT_END_OF_FILE;
1569 }
1570
1571 else
1572 {
1573 /* We matched some text prior to the EOB, first
1574 * process it.
1575 */
1576 return EOB_ACT_LAST_MATCH;
1577 }
1578 }
1579
1580 /* Try to read more data. */
1581
1582 /* First move last chars to start of buffer. */
1583 number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
1584
1585 for ( i = 0; i < number_to_move; ++i )
1586 *(dest++) = *(source++);
1587
1588 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1589 /* don't do the read, it's not guaranteed to return an EOF,
1590 * just force an EOF
1591 */
1592 yy_current_buffer->yy_n_chars = yy_n_chars = 0;
1593
1594 else
1595 {
1596 int num_to_read =
1597 yy_current_buffer->yy_buf_size - number_to_move - 1;
1598
1599 while ( num_to_read <= 0 )
1600 { /* Not enough room in the buffer - grow it. */
1601#ifdef YY_USES_REJECT
1602 YY_FATAL_ERROR(
1603"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1604#else
1605
1606 /* just a shorter name for the current buffer */
1607 YY_BUFFER_STATE b = yy_current_buffer;

Callers 2

scanner.ccFile · 0.70
inputFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected