s
This commit is contained in:
parent
a9c8eb5d28
commit
4dfd9de0cc
@ -3,7 +3,7 @@
|
||||
|
||||
int match(char open, char close) {
|
||||
return (open == '{' && close == '}') || (open == '[' && close == ']') ||
|
||||
(open == '(' && close == ')');
|
||||
(open == '(' && close == ')') || (open == '<' && close == '>');
|
||||
}
|
||||
|
||||
void check_brackets(const char *code) {
|
||||
@ -14,9 +14,9 @@ void check_brackets(const char *code) {
|
||||
|
||||
for (int i = 0; code[i] != '\0'; i++) {
|
||||
char c = code[i];
|
||||
if (c == '{' || c == '[' || c == '(') {
|
||||
if (c == '{' || c == '[' || c == '(' || c == '<') {
|
||||
stack[++top] = c;
|
||||
} else if (c == '}' || c == ']' || c == ')') {
|
||||
} else if (c == '}' || c == ']' || c == ')' || c == '>') {
|
||||
if (top == -1) {
|
||||
printf("Unexpected closing bracket %c in %d\n", c, i);
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user