diff options
author | leo <leo@azuminha.com> | 2024-04-18 18:00:40 -0300 |
---|---|---|
committer | leo <leo@azuminha.com> | 2024-04-18 18:00:40 -0300 |
commit | 954fc6b9d4bfee8b2eb1af11f4e62a66b9e8da57 (patch) | |
tree | 2e54bccfcb9507f4919b67ddb0a4996f91dd608c /lexical.c | |
parent | 0d530f0e84c15387cd22ae1608c284befff8e87f (diff) |
finalizado?
Diffstat (limited to 'lexical.c')
-rw-r--r-- | lexical.c | 19 |
1 files changed, 16 insertions, 3 deletions
@@ -1,3 +1,8 @@ +/* + * Nome: Leonardo Koosuke Azuma + * SO: Arch Linux x86_64 + * Compilador: gcc (GCC) 13.2.1 20230801 + */ #include <stdio.h> #include <stdlib.h> #include "include/map.h" @@ -7,6 +12,8 @@ char proximo = '\n'; int is_EOF = 0; int linha = 1; // Numero da linha atual) int identificador_num = 1; + +FILE *fout; string_map special_char; string_map simbolos_especiais; @@ -88,9 +95,11 @@ void PROXIMO(FILE *fp){ } if(proximo == '\n'){ printf("\n"); + fprintf(fout, "\n"); PROXIMO(fp); linha++; printf("linha %d: ", linha); + fprintf(fout, "linha %d: ", linha); } return ; @@ -117,9 +126,13 @@ char* CODIGO(char *cod){ return NULL; } -void ERRO(int error_code){ +void ERRO(enum error_type error_code){ fprintf(stderr, "Erro na linha %d\n", linha); - if(error_code == 1) fprintf(stderr, "primerio erro\n"); - else fprintf(stderr, "segundo erro\n"); + if(error_code == SIMBOLO_ESPECIAL_DESCONHECIDO){ + fprintf(stderr, "ERRO: Simbolo especial desconhecido\n"); + } + else{ + fprintf(stderr, "ERRO: Identificador ou numero mal formado\n"); + } exit(1); } |