ref: 6962d300a10351dcc545446cd1f2a902661d8cca
dir: /examples/localleg.leg/
%{ #define YY_CTX_LOCAL 1 #define YY_CTX_MEMBERS \ int count; %} Char = ('\n' | '\r\n' | '\r') { yy->count++ } | . %% #include <stdio.h> #include <string.h> int main() { yycontext yy; memset(&yy, 0, sizeof(yy)); while (yyparse(&yy)) ; printf("%d newlines\n", yy.count); yyrelease(&yy); return 0; }