A specification constructed by Reflex has the following structure:
%{ YYSTYPE Block SETPOS Block LITBLOCK Block %} LEXDEF Block %% Token Section COMMENTS Block LAYOUT Block ILLEGAL Block %% LEXFUNC Block YYWRAP BlockThe block YYSTYPE has the form
#include "gen.h" extern YYSTYPE yylval;The block SETPOS has the form
extern long yypos; #define yysetpos() { yylval.attr[0] = yypos; yypos += yyleng; }The blocks LITBLOCK and LEXDEF are empty.
The Token Section contains, for each token "alpha" appearing literally in the Gentle specification a Lex rule of the form
"alpha" { yysetpos(); return token_code; }These rules are followed by the rules appearing in the token description files.
The block COMMENTS and LAYOUT are described above.
The block ILLEGAL has the form
. { yysetpos(); yyerror("illegal token"); }The block LEXFUNC is empty.
The block YYWRAP has the form.
#ifndef yywrap yywrap() { return 1; } #endif