MCPcopy Create free account
hub / github.com/KDE/kdevelop / cmListFileLexer_yy_scan_buffer

Function cmListFileLexer_yy_scan_buffer

plugins/cmake/parser/cmListFileLexer.c:1945–1972  ·  view source on GitHub ↗

Setup the input buffer state to scan directly from a user-specified character buffer. * @param base the character buffer * @param size the size in bytes of the character buffer * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */

Source from the content-addressed store, hash-verified

1943 * @return the newly allocated buffer state object.
1944 */
1945YY_BUFFER_STATE cmListFileLexer_yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
1946{
1947 YY_BUFFER_STATE b;
1948
1949 if ( size < 2 ||
1950 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1951 base[size-1] != YY_END_OF_BUFFER_CHAR )
1952 /* They forgot to leave room for the EOB's. */
1953 return NULL;
1954
1955 b = (YY_BUFFER_STATE) cmListFileLexer_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
1956 if ( ! b )
1957 YY_FATAL_ERROR( "out of dynamic memory in cmListFileLexer_yy_scan_buffer()" );
1958
1959 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1960 b->yy_buf_pos = b->yy_ch_buf = base;
1961 b->yy_is_our_buffer = 0;
1962 b->yy_input_file = NULL;
1963 b->yy_n_chars = b->yy_buf_size;
1964 b->yy_is_interactive = 0;
1965 b->yy_at_bol = 1;
1966 b->yy_fill_buffer = 0;
1967 b->yy_buffer_status = YY_BUFFER_NEW;
1968
1969 cmListFileLexer_yy_switch_to_buffer(b ,yyscanner );
1970
1971 return b;
1972}
1973
1974/** Setup the input buffer state to scan a string. The next call to cmListFileLexer_yylex() will
1975 * scan from a @e copy of @a str.

Callers 1

Calls 2

cmListFileLexer_yyallocFunction · 0.85

Tested by

no test coverage detected