summaryrefslogtreecommitdiff
path: root/lexical.c
diff options
context:
space:
mode:
authorleo <leo@azuminha.com>2024-04-18 18:00:40 -0300
committerleo <leo@azuminha.com>2024-04-18 18:00:40 -0300
commit954fc6b9d4bfee8b2eb1af11f4e62a66b9e8da57 (patch)
tree2e54bccfcb9507f4919b67ddb0a4996f91dd608c /lexical.c
parent0d530f0e84c15387cd22ae1608c284befff8e87f (diff)
finalizado?
Diffstat (limited to 'lexical.c')
-rw-r--r--lexical.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/lexical.c b/lexical.c
index 22d219b..b742311 100644
--- a/lexical.c
+++ b/lexical.c
@@ -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);
}