Created
May 23, 2014 09:17
-
-
Save nachivpn/3fff536f2e78c00a2bee to your computer and use it in GitHub Desktop.
Custom usage of yywrap() in a LEX program
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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