From 74ffe8d105c70e0e205cccba360f832d83b4abda Mon Sep 17 00:00:00 2001 From: Pixel Date: Sun, 28 Oct 2012 22:32:50 -0700 Subject: Removing tabs. --- compil.lex | 190 ++++++++++++++++++++++++++++++------------------------------- 1 file changed, 95 insertions(+), 95 deletions(-) diff --git a/compil.lex b/compil.lex index ad24a2c..504eaaf 100644 --- a/compil.lex +++ b/compil.lex @@ -23,181 +23,181 @@ %% "" { - fprintf(yyout, "rooms_txts = {\n"); - BEGIN(I); + fprintf(yyout, "rooms_txts = {\n"); + BEGIN(I); } -.* { - fprintf(stderr, "Invalid file, must begin with \n"); - errstate = 1; +.* { + fprintf(stderr, "Invalid file, must begin with \n"); + errstate = 1; } -"\n\n\n" { - int d = atoi(yytext + 10); - if (got_ptr) { - fprintf(yyout, "\x5d\x5d },\n"); - } - fprintf(yyout, " [%i] = { \x5b\x5b", d); - got_ptr = 1; +"\n\n\n" { + int d = atoi(yytext + 10); + if (got_ptr) { + fprintf(yyout, "\x5d\x5d },\n"); + } + fprintf(yyout, " [%i] = { \x5b\x5b", d); + got_ptr = 1; } -"\n\n" { - putcode(1); +"\n\n" { + putcode(1); } -"" { - putcode1(3, 255); +"" { + putcode1(3, 255); } -"" { - int d = atoi(yytext + 9); - putcode1(3, d); +"" { + int d = atoi(yytext + 9); + putcode1(3, d); } -"" { - int d = atoi(yytext + 9); - putcode1(4, d); +"" { + int d = atoi(yytext + 9); + putcode1(4, d); } -"" { - putcode(5); +"" { + putcode(5); } -"" { - putcode1(7, 1); +"" { + putcode1(7, 1); } -"" { - int d = atoi(yytext + 9); - putcode1(7, d); +"" { + int d = atoi(yytext + 9); + putcode1(7, d); } -"" { - putcode1(8, 1); +"" { + putcode1(8, 1); } -"" { - int d = atoi(yytext + 9); - putcode1(8, d); +"" { + int d = atoi(yytext + 9); + putcode1(8, d); } -"" { - putcode2(19, 255, 255); +"" { + putcode2(19, 255, 255); } -"""a2=\""[[:digit:]]+"\"/>" { - int d = atoi(yytext + 4); - putcode2(19, arg1, d); - BEGIN(I); +

"a2=\""[[:digit:]]+"\"/>" { + int d = atoi(yytext + 4); + putcode2(19, arg1, d); + BEGIN(I); } -"" { - int d = atoi(yytext + 8); - putcode1(14, d); +"" { + int d = atoi(yytext + 8); + putcode1(14, d); } -"" { - int d = atoi(yytext + 7); - putcode(d); +"" { + int d = atoi(yytext + 7); + putcode(d); } -"""a1=\""[[:digit:]]+"\"/>" { - int d = atoi(yytext + 4); - putcode1(cmd, d); - BEGIN(I); +"a1=\""[[:digit:]]+"\"/>" { + int d = atoi(yytext + 4); + putcode1(cmd, d); + BEGIN(I); } -"""a1=\""[[:digit:]]+"\" " { - arg1 = atoi(yytext + 4); - BEGIN(U22); +"a1=\""[[:digit:]]+"\" " { + arg1 = atoi(yytext + 4); + BEGIN(U22); } -"a2=\""[[:digit:]]+"\"/>" { - int d = atoi(yytext + 4); - putcode2(cmd, arg1, d); - BEGIN(I); +"a2=\""[[:digit:]]+"\"/>" { + int d = atoi(yytext + 4); + putcode2(cmd, arg1, d); + BEGIN(I); } -"\n" { - putcode(0); +"\n" { + putcode(0); } -"\n" { - fprintf(yyout, "\x5d\x5d}\n}\n"); - BEGIN(E); +"\n" { + fprintf(yyout, "\x5d\x5d}\n}\n"); + BEGIN(E); } -"abcdef<"[^\>\n]*"/>" { - yytext[strlen(yytext) - 2] = 0; - fprintf(stderr, "Error: Invalid command: '%s'\n", yytext + 1); - errstate = 1; +"abcdef<"[^\>\n]*"/>" { + yytext[strlen(yytext) - 2] = 0; + fprintf(stderr, "Error: Invalid command: '%s'\n", yytext + 1); + errstate = 1; } -. { - fputc(*yytext, yyout); +. { + fputc(*yytext, yyout); } -. { - fprintf(stderr, "Hu uh, something's wrong...\n"); +. { + fprintf(stderr, "Hu uh, something's wrong...\n"); } %% -int yywrap(void) { +int yywrap(void) { exit(errstate ? -1 : 0); } -int main(int argc, char ** argv) { +int main(int argc, char ** argv) { if ((argc < 2) || (argc > 3)) { - fprintf(stderr, "Usage: %s [input]\n", argv[0]); - exit(-1); + fprintf(stderr, "Usage: %s [input]\n", argv[0]); + exit(-1); } if (!(yyout = fopen(argv[1], "wb"))) { - fprintf(stderr, "Error: can't open file %s\n", argv[1]); - exit(-1); + fprintf(stderr, "Error: can't open file %s\n", argv[1]); + exit(-1); } if (argc == 3) { - if (!(yyin = fopen(argv[2], "rb"))) { - fprintf(stderr, "Error: can't open file %s\n", argv[2]); - exit(-1); - } + if (!(yyin = fopen(argv[2], "rb"))) { + fprintf(stderr, "Error: can't open file %s\n", argv[2]); + exit(-1); + } } fprintf(stderr, "Creating file %s\n", argv[1]); yylex(); exit(errstate ? -1 : 0); } -void unputs(char * s) { +void unputs(char * s) { int l = strlen(s), i; - + for (i = l - 1; i >= 0; i--) { - unput(s[i]); + unput(s[i]); } } -void putcode(int code) { +void putcode(int code) { fprintf(yyout, "\x5d\x5d, { %i }, \x5b\x5b", code); } -void putcode1(int code, int arg) { +void putcode1(int code, int arg) { fprintf(yyout, "\x5d\x5d, { %i, %i }, \x5b\x5b", code, arg); } -void putcode2(int code, int arg1, int arg2) { +void putcode2(int code, int arg1, int arg2) { fprintf(yyout, "\x5d\x5d, { %i, %i, %i }, \x5b\x5b", code, arg1, arg2); } -- cgit v1.2.3