Tring harder
This commit is contained in:
parent
2cbfbb835f
commit
f705e90a84
18
a1/program.c
18
a1/program.c
@ -2,6 +2,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <locale.h>
|
||||
#define BRACKETS_NUM 100
|
||||
|
||||
typedef struct Node{
|
||||
@ -79,7 +81,11 @@ void read_input(LinkedNode** head){
|
||||
}
|
||||
char popped = pop(head);
|
||||
if (!compare(popped, buff[i]))
|
||||
{ if (popped == '[' && buff[i] == '>')
|
||||
{ if(popped == '[' && isalpha(buff[i])){
|
||||
printf("Read: %sMissing brackets: ]", buff);
|
||||
return;
|
||||
}
|
||||
if (popped == '[' && buff[i] == '>')
|
||||
{
|
||||
printf("Read: %s\n", buff);
|
||||
printf("Crossed bracket %c", buff[i]);
|
||||
@ -178,8 +184,18 @@ void read_input(LinkedNode** head){
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if(*head != NULL){
|
||||
if (buff[i] == '[')
|
||||
{
|
||||
printf("Read: %sMissing closing bracket: ]\n", buff);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
i++;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user