MPE/iX Shell and Utilities Reference Manual, Vol 2
lex(3) MPE/iX Shell and Utilities lex(3)
yygetc is a macro called by yylex() to obtain characters. Currently, this is de-
fined as
#define yygetc() getc(yyin)
A new version can be defined for special purposes, by first using #undef to
remove the current macro definition.
input is a function which returns the next character from the
LEX input stream.
(This means that LEX does not see it.) This function properly accounts for
any look-ahead that LEX may require.
unput is a function which may be called to make the argument character c the next
character to be read by input(), and hence by yylex()The characters
are placed in a push-back buffer.
yywrap is a function called by yylex() when it gets EOF from yygetc()The de-
fault version of yywrap() returns 1, which indicates no more input is
available. yylex() then returns 0 indicating end of file. If the user wishes
to supply more input, a yywrap() should be provided that sets up the new
input (possibly by assigning a new file stream to yyin), then returns 0 to in-
dicate that more input is available.
yyerror is a function used by routines that generate diagnostics. A version of
yyerror() is provided in the library; it simply passes its arguments to
vfprintf() with output to the error stream stderr. A newline is writ-
ten following the message. A replacement may be provided by the user.
yycomment is a function that a translation may call when
LEX recognizes the sequence of
characters which mark the start of a comment in the given syntax. It takes a
sequence of characters which mark the end of a comment, and skips over
characters in the input stream until this sequence is found. Newlines found
while skipping characters increment the external yylinenoAn unexpected
end-of-file produces a suitable diagnostic (using yyerror().) The follow-
ing lex rules match C and shell-style comments.
"/*" yycomment("*/");
#.*\n ;
Note that a
LEX pattern is more efficient at recognizing a newline-terminated
comment, while the yycomment function can handle comments longer
than YYLMAX.
yymapch is a function which may be used to process C-style character constants or
strings. It returns the next string character from the input, or –1 when the
character delim, is reached. The usual C escapes are recognized; esc is the
escape character to use: for C it would be backslash.
Miscellaneous Information 3-7