Skip to content

Instantly share code, notes, and snippets.

@nachivpn
Created May 23, 2014 09:17
Show Gist options
  • Save nachivpn/3fff536f2e78c00a2bee to your computer and use it in GitHub Desktop.
Save nachivpn/3fff536f2e78c00a2bee to your computer and use it in GitHub Desktop.
Custom usage of yywrap() in a LEX program
/* Declarations */
%%
/* Rules */
%%
int yywrap()
{
FILE *newfile_pointer;
newfile_pointer = fopen("input_file_2.l","r");
if(yyin != newfile_pointer)
{
yyin = newfile_pointer;
return 0;
}
else
return 1;
}
int main()
{
yyin = fopen("input_file.l","r");
yylex();
return 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment