Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %{
- /*
- Puts in uppercase the reserved words outside comments in a C program
- Keywords:
- auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|
- union|unsigned|void|volatile|while
- */
- #include <stdio.h>
- %}
- %%
- \/\/[^\n]* ECHO;
- \/\*[^\*\/]* ECHO;
- [^a-zA-Z0-9]auto[^a-zA-Z0-9]|[^a-zA-Z0-9]break[^a-zA-Z0-9]|[^a-zA-Z0-9]case[^a-zA-Z0-9]|[^a-zA-Z0-9]char[^a-zA-Z0-9]|[^a-zA-Z0-9]const[^a-zA-Z0-9]|[^a-zA-Z0-9]continue[^a-zA-Z0-9]|[^a-zA-Z0-9]default[^a-zA-Z0-9]|[^a-zA-Z0-9]do[^a-zA-Z0-9]|[^a-zA-Z0-9]double[^a-zA-Z0-9]|[^a-zA-Z0-9]else[^a-zA-Z0-9]|[^a-zA-Z0-9]enum[^a-zA-Z0-9]|[^a-zA-Z0-9]extern[^a-zA-Z0-9]|[^a-zA-Z0-9]float[^a-zA-Z0-9]|[^a-zA-Z0-9]for[^a-zA-Z0-9]|[^a-zA-Z0-9]goto[^a-zA-Z0-9]|[^a-zA-Z0-9]if[^a-zA-Z0-9]|[^a-zA-Z0-9]int[^a-zA-Z0-9]|[^a-zA-Z0-9]long[^a-zA-Z0-9]|[^a-zA-Z0-9]register[^a-zA-Z0-9]|[^a-zA-Z0-9]return[^a-zA-Z0-9]|[^a-zA-Z0-9]short[^a-zA-Z0-9]|[^a-zA-Z0-9]signed[^a-zA-Z0-9]|[^a-zA-Z0-9]sizeof[^a-zA-Z0-9]|[^a-zA-Z0-9]static[^a-zA-Z0-9]|[^a-zA-Z0-9]struct[^a-zA-Z0-9]|[^a-zA-Z0-9]switch[^a-zA-Z0-9]|[^a-zA-Z0-9]typedef[^a-zA-Z0-9]|[^a-zA-Z0-9]union[^a-zA-Z0-9]|[^a-zA-Z0-9]unsigned[^a-zA-Z0-9]|[^a-zA-Z0-9]void[^a-zA-Z0-9]|[^a-zA-Z0-9]volatile[^a-zA-Z0-9]|[^a-zA-Z0-9]while[^a-zA-Z0-9] {
- int i;
- for(i=0;i<yyleng;i++){
- char c = yytext[i];
- if(c>=97 && c<=122)
- printf("%c",toupper(c));
- else
- printf("%c",toupper(c));
- }
- }
- [^a-zA-Z0-9]auto|[^a-zA-Z0-9]break|[^a-zA-Z0-9]case|[^a-zA-Z0-9]char|[^a-zA-Z0-9]const|[^a-zA-Z0-9]continue|[^a-zA-Z0-9]default|[^a-zA-Z0-9]do|[^a-zA-Z0-9]double|[^a-zA-Z0-9]else|[^a-zA-Z0-9]enum|[^a-zA-Z0-9]extern|[^a-zA-Z0-9]float|[^a-zA-Z0-9]for|[^a-zA-Z0-9]goto|[^a-zA-Z0-9]if|[^a-zA-Z0-9]int|[^a-zA-Z0-9]long|[^a-zA-Z0-9]register|[^a-zA-Z0-9]return|[^a-zA-Z0-9]short|[^a-zA-Z0-9]signed|[^a-zA-Z0-9]sizeof|[^a-zA-Z0-9]static|[^a-zA-Z0-9]struct|[^a-zA-Z0-9]switch|[^a-zA-Z0-9]typedef|[^a-zA-Z0-9]union|[^a-zA-Z0-9]unsigned|[^a-zA-Z0-9]void|[^a-zA-Z0-9]volatile|[^a-zA-Z0-9]while {
- int i;
- for(i=0;i<yyleng;i++){
- char c = yytext[i];
- if(c>=97 && c<=122)
- printf("%c",toupper(c));
- else
- printf("%c",toupper(c));
- }
- }
- [\r\n|\n]auto[^a-zA-Z0-9]|[\r\n|\n]break[^a-zA-Z0-9]|[\r\n|\n]case[^a-zA-Z0-9]|[\r\n|\n]char[^a-zA-Z0-9]|[\r\n|\n]const[^a-zA-Z0-9]|[\r\n|\n]continue[^a-zA-Z0-9]|[\r\n|\n]default[^a-zA-Z0-9]|[\r\n|\n]do[^a-zA-Z0-9]|[\r\n|\n]double[^a-zA-Z0-9]|[\r\n|\n]else[^a-zA-Z0-9]|[\r\n|\n]enum[^a-zA-Z0-9]|[\r\n|\n]extern[^a-zA-Z0-9]|[\r\n|\n]float[^a-zA-Z0-9]|[\r\n|\n]for[^a-zA-Z0-9]|[\r\n|\n]goto[^a-zA-Z0-9]|[\r\n|\n]if[^a-zA-Z0-9]|[\r\n|\n]int[^a-zA-Z0-9]|[\r\n|\n]long[^a-zA-Z0-9]|[\r\n|\n]register[^a-zA-Z0-9]|[\r\n|\n]return[^a-zA-Z0-9]|[\r\n|\n]short[^a-zA-Z0-9]|[\r\n|\n]signed[^a-zA-Z0-9]|[\r\n|\n]sizeof[^a-zA-Z0-9]|[\r\n|\n]static[^a-zA-Z0-9]|[\r\n|\n]struct[^a-zA-Z0-9]|[\r\n|\n]switch[^a-zA-Z0-9]|[\r\n|\n]typedef[^a-zA-Z0-9]|[\r\n|\n]union[^a-zA-Z0-9]|[\r\n|\n]unsigned[^a-zA-Z0-9]|[\r\n|\n]void[^a-zA-Z0-9]|[\r\n|\n]volatile[^a-zA-Z0-9]|[\r\n|\n]while[^a-zA-Z0-9] {
- int i;
- for(i=0;i<yyleng;i++){
- char c = yytext[i];
- if(c>=97 && c<=122)
- printf("%c",toupper(c));
- else
- printf("%c",toupper(c));
- }
- }
- .|\n ECHO;
- %%
- /* recommended to always declara
- funcao yywrap() */
- int yywrap ();
- main()
- { yylex(); return 0; }
- int yywrap() {
- return 1;
- }
Add Comment
Please, Sign In to add comment