Skip to content

Commit

Permalink
unbalanced
Browse files Browse the repository at this point in the history
  • Loading branch information
douglascrockford committed Jan 7, 2012
1 parent dedaf51 commit 559be9d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion jsdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,9 @@ stuff()
get(FALSE);
if (peek() == '/') {
get(FALSE);
if (paren > 0) {
error("Unbalanced stuff");
}
return;
}
emit('*');
Expand All @@ -343,6 +346,13 @@ stuff()
error("Unterminated stuff.");
} else if (c == '\'' || c == '"' || c == '`') {
string(c, TRUE);
} else if (c == '(' || c == '{' || c == '[') {
paren += 1;
} else if (c == ')' || c == '}' || c == ']') {
paren -= 1;
if (paren < 0) {
error("Unbalanced stuff");
}
} else if (c == '/') {
if (peek() == '/' || peek() == '*') {
error("unexpected comment.");
Expand All @@ -362,7 +372,6 @@ static void
expand(int tag_nr)
{
int c;
int cond = FALSE;

c = peek();
if (c == '(') {
Expand Down

0 comments on commit 559be9d

Please sign in to comment.