X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=scanner%2Fscanner.lex;h=07b162e1d3580e03ed393a3bc58e6c625447bc14;hb=d0e26f758ca87416181824fb7b4619af22ccc9a1;hp=b20091006473beb26dbb60233aeabefe7117c162;hpb=9fe002b59aa63b5b9e2531b909d4b6edc28e8e67;p=uebersetzerbau-ss10.git diff --git a/scanner/scanner.lex b/scanner/scanner.lex index b200910..07b162e 100644 --- a/scanner/scanner.lex +++ b/scanner/scanner.lex @@ -3,7 +3,7 @@ #include KEYWORD struct|end|method|var|if|then|else|while|do|return|not|or|this -SPECIAL_CHAR \;|\(|\)|\:=|\.|\-|\*|\<|\=|\. +SPECIAL_CHAR \;|\(|\)|\:=|\.|\-|\*|\<|\=|\, IDENTIFIER [a-zA-Z_][0-9a-zA-Z_]* NUMBER_HEX 0x[0-9A-Fa-f]+ NUMBER_DEC [0-9]+ @@ -20,7 +20,10 @@ COMMENT_END \*\/ {COMMENT_END} BEGIN(INITIAL); -<> { (void) fprintf(stderr, "kommentar nicht geschlossen\n"); exit(1); } +<> { + fprintf(stderr, "Kommentar nicht geschlossen\n"); + exit(1); +} (.|\n) /* alles im kommentar wird ignoriert */ @@ -32,17 +35,14 @@ COMMENT_END \*\/ {NUMBER_DEC} printf("num %lx\n", strtol(yytext, (char **)NULL, 10)); -{NUMBER_HEX} { -#if 0 - char *copy=strdup(yytext); - copy[strlen(copy)-1]='\0'; -#endif - printf("num %lx\n", strtol(yytext, (char **)NULL, 16)); -} +{NUMBER_HEX} printf("num %lx\n", strtol(yytext, (char **)NULL, 16)); {WHITESPACE} /* ignorieren */ -. { (void) fprintf(stderr, "Lexikalischer fehler auf Zeile %i\n", yylineno); exit(1); } +. { + fprintf(stderr, "Lexikalischer Fehler auf Zeile %i\n", yylineno); + exit(1); +} %%