Setup the input buffer state to scan the given bytes. The next call to yylex() will * scan from a @e copy of @a bytes. * @param yybytes the byte buffer to scan * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */
| 2117 | * @return the newly allocated buffer state object. |
| 2118 | */ |
| 2119 | YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len , yyscan_t yyscanner) |
| 2120 | { |
| 2121 | YY_BUFFER_STATE b; |
| 2122 | char *buf; |
| 2123 | yy_size_t n; |
| 2124 | int i; |
| 2125 | |
| 2126 | /* Get memory for full buffer, including space for trailing EOB's. */ |
| 2127 | n = (yy_size_t) (_yybytes_len + 2); |
| 2128 | buf = (char *) yyalloc( n , yyscanner ); |
| 2129 | if ( ! buf ) |
| 2130 | YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); |
| 2131 | |
| 2132 | for ( i = 0; i < _yybytes_len; ++i ) |
| 2133 | buf[i] = yybytes[i]; |
| 2134 | |
| 2135 | buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; |
| 2136 | |
| 2137 | b = yy_scan_buffer( buf, n , yyscanner); |
| 2138 | if ( ! b ) |
| 2139 | YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); |
| 2140 | |
| 2141 | /* It's okay to grow etc. this buffer, and we should throw it |
| 2142 | * away when we're done. |
| 2143 | */ |
| 2144 | b->yy_is_our_buffer = 1; |
| 2145 | |
| 2146 | return b; |
| 2147 | } |
| 2148 | |
| 2149 | #ifndef YY_EXIT_FAILURE |
| 2150 | #define YY_EXIT_FAILURE 2 |
no test coverage detected