Open System Services Shell and Utilities Reference Manual (G06.27+, H06.04+)
lex(1) OSS Shell and Utilities Reference Manual
yywrap() Returns 0 (zero) if there is more input to scan or 1 if there is not.
The default yywrap() always returns 1. It is implemented as a
macro.
yyterminate()
Can be used instead of a return statement in an action. It terminates
the scanner and returns a 0 (zero) to the scanner’s caller.
yyterminate() is automatically called when an End-of-File is
encountered. It is a macro and can be redefined.
yy_create_buffer(file, size)
Returns a YY_BUFFER_STATE handle to a new input buffer large
enough to accommodate size characters and associated with the
given file. When in doubt, use YY_BUF_SIZE for the size.
yy_switch_to_buffer(
new_buffer)
Switches the scanner’s processing to scan for tokens from the given
buffer, which must be a YY_BUFFER_STATE.
yy_delete_buffer(buffer)
Deletes the given buffer.
YY_NEW_FILE
Enables scanning to continue after the yyin variable has been
assigned a new file to process.
YY_DECL Controls how the scanning function, yylex(), is declared. By
default, it is int yylex() or, if prototypes are being used, int
yylex(void). This definition can be changed by redefining the
YY_DECL macro. This macro is expanded immediately before the
{...} (braces) that delimit the scanner function body.
YY_INPUT(buf,result,max_size)
Controls scanner input. By default, YY_INPUT reads from the
file-pointer yyin variable. Its action is to place up to max_size char-
acters in the character array buf and return in the integer variable
result either the number of characters read or the constant
YY_NULL to indicate EOF. Following is a sample redefinition of
YY_INPUT, in the definitions section of the input file:
%{
#undef YY_INPUT
#define YY_INPUT(buf,result,max_size)\
{\
int c = getchar();\
result = (c == EOF) ? YY_NULL : (buf[0] = c, 1);\
}
%}
When the scanner receives an End-of-File indication from
YY_INPUT, it checks the yywrap() function. If yywrap() returns
zero, it is assumed that the yyin has been set up to point to another
input file, and scanning continues. If it returns a nonzero value, then
the scanner terminates, returning zero to its caller.
5−56 Hewlett-Packard Company 527188-004