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 <stdlib.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <locale.h>
|
||||||
#define BRACKETS_NUM 100
|
#define BRACKETS_NUM 100
|
||||||
|
|
||||||
typedef struct Node{
|
typedef struct Node{
|
||||||
@ -79,7 +81,11 @@ void read_input(LinkedNode** head){
|
|||||||
}
|
}
|
||||||
char popped = pop(head);
|
char popped = pop(head);
|
||||||
if (!compare(popped, buff[i]))
|
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("Read: %s\n", buff);
|
||||||
printf("Crossed bracket %c", buff[i]);
|
printf("Crossed bracket %c", buff[i]);
|
||||||
@ -179,7 +185,17 @@ void read_input(LinkedNode** head){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if(*head != NULL){
|
||||||
|
if (buff[i] == '[')
|
||||||
|
{
|
||||||
|
printf("Read: %sMissing closing bracket: ]\n", buff);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user