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 */
| 1662 | * EOB_ACT_END_OF_FILE - end of file |
| 1663 | */ |
| 1664 | static int yy_get_next_buffer (yyscan_t yyscanner) |
| 1665 | { |
| 1666 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
| 1667 | register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; |
| 1668 | register char *source = yyg->yytext_ptr; |
| 1669 | register int number_to_move, i; |
| 1670 | int ret_val; |
| 1671 | |
| 1672 | if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) |
| 1673 | YY_FATAL_ERROR( |
| 1674 | "fatal flex scanner internal error--end of buffer missed" ); |
| 1675 | |
| 1676 | if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) |
| 1677 | { /* Don't try to fill the buffer, so this is an EOF. */ |
| 1678 | if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 ) |
| 1679 | { |
| 1680 | /* We matched a single character, the EOB, so |
| 1681 | * treat this as a final EOF. |
| 1682 | */ |
| 1683 | return EOB_ACT_END_OF_FILE; |
| 1684 | } |
| 1685 | |
| 1686 | else |
| 1687 | { |
| 1688 | /* We matched some text prior to the EOB, first |
| 1689 | * process it. |
| 1690 | */ |
| 1691 | return EOB_ACT_LAST_MATCH; |
| 1692 | } |
| 1693 | } |
| 1694 | |
| 1695 | /* Try to read more data. */ |
| 1696 | |
| 1697 | /* First move last chars to start of buffer. */ |
| 1698 | number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1; |
| 1699 | |
| 1700 | for ( i = 0; i < number_to_move; ++i ) |
| 1701 | *(dest++) = *(source++); |
| 1702 | |
| 1703 | if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) |
| 1704 | /* don't do the read, it's not guaranteed to return an EOF, |
| 1705 | * just force an EOF |
| 1706 | */ |
| 1707 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0; |
| 1708 | |
| 1709 | else |
| 1710 | { |
| 1711 | int num_to_read = |
| 1712 | YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; |
| 1713 | |
| 1714 | while ( num_to_read <= 0 ) |
| 1715 | { /* Not enough room in the buffer - grow it. */ |
| 1716 | |
| 1717 | /* just a shorter name for the current buffer */ |
| 1718 | YY_BUFFER_STATE b = YY_CURRENT_BUFFER; |
| 1719 | |
| 1720 | int yy_c_buf_p_offset = |
| 1721 | (int) (yyg->yy_c_buf_p - b->yy_ch_buf); |
no test coverage detected