MCPcopy Create free account
hub / github.com/Kitware/CMake / yy_get_next_buffer

Function yy_get_next_buffer

Source/LexerParser/cmListFileLexer.c:1525–1660  ·  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

1523 * EOB_ACT_END_OF_FILE - end of file
1524 */
1525static int yy_get_next_buffer (yyscan_t yyscanner)
1526{
1527 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1528 char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1529 char *source = yyg->yytext_ptr;
1530 int number_to_move, i;
1531 int ret_val;
1532
1533 if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
1534 YY_FATAL_ERROR(
1535 "fatal flex scanner internal error--end of buffer missed" );
1536
1537 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1538 { /* Don't try to fill the buffer, so this is an EOF. */
1539 if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
1540 {
1541 /* We matched a single character, the EOB, so
1542 * treat this as a final EOF.
1543 */
1544 return EOB_ACT_END_OF_FILE;
1545 }
1546
1547 else
1548 {
1549 /* We matched some text prior to the EOB, first
1550 * process it.
1551 */
1552 return EOB_ACT_LAST_MATCH;
1553 }
1554 }
1555
1556 /* Try to read more data. */
1557
1558 /* First move last chars to start of buffer. */
1559 number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr - 1);
1560
1561 for ( i = 0; i < number_to_move; ++i )
1562 *(dest++) = *(source++);
1563
1564 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1565 /* don't do the read, it's not guaranteed to return an EOF,
1566 * just force an EOF
1567 */
1568 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
1569
1570 else
1571 {
1572 int num_to_read =
1573 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1574
1575 while ( num_to_read <= 0 )
1576 { /* Not enough room in the buffer - grow it. */
1577
1578 /* just a shorter name for the current buffer */
1579 YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
1580
1581 int yy_c_buf_p_offset =
1582 (int) (yyg->yy_c_buf_p - b->yy_ch_buf);

Callers 2

cmListFileLexer.cFile · 0.70
inputFunction · 0.70

Calls 2

yyreallocFunction · 0.70
yyrestartFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…