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

Function yy_get_next_buffer

Singular/libparse.cc:2597–2724  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2595 */
2596
2597static int yy_get_next_buffer()
2598 {
2599 REGISTER char *dest = yy_current_buffer->yy_ch_buf;
2600 REGISTER char *source = yytext_ptr;
2601 REGISTER int number_to_move, i;
2602 int ret_val;
2603
2604 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
2605 YY_FATAL_ERROR(
2606 "fatal flex scanner internal error--end of buffer missed" );
2607
2608 if ( yy_current_buffer->yy_fill_buffer == 0 )
2609 { /* Don't try to fill the buffer, so this is an EOF. */
2610 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
2611 {
2612 /* We matched a single character, the EOB, so
2613 * treat this as a final EOF.
2614 */
2615 return EOB_ACT_END_OF_FILE;
2616 }
2617
2618 else
2619 {
2620 /* We matched some text prior to the EOB, first
2621 * process it.
2622 */
2623 return EOB_ACT_LAST_MATCH;
2624 }
2625 }
2626
2627 /* Try to read more data. */
2628
2629 /* First move last chars to start of buffer. */
2630 number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
2631
2632 for ( i = 0; i < number_to_move; ++i )
2633 *(dest++) = *(source++);
2634
2635 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
2636 /* don't do the read, it's not guaranteed to return an EOF,
2637 * just force an EOF
2638 */
2639 yy_current_buffer->yy_n_chars = yy_n_chars = 0;
2640
2641 else
2642 {
2643 int num_to_read =
2644 yy_current_buffer->yy_buf_size - number_to_move - 1;
2645
2646 while ( num_to_read <= 0 )
2647 { /* Not enough room in the buffer - grow it. */
2648#ifdef YY_USES_REJECT
2649 YY_FATAL_ERROR(
2650"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
2651#else
2652
2653 /* just a shorter name for the current buffer */
2654 YY_BUFFER_STATE b = yy_current_buffer;

Callers 2

libparse.ccFile · 0.70
inputFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected