diff options
author | Martin Natano <natano@natano.net> | 2016-09-29 16:22:22 +0200 |
---|---|---|
committer | Martin Natano <natano@natano.net> | 2016-09-29 16:31:01 +0200 |
commit | 4cf0cb606ad32a04774a0a3ca9186e238bf61c1f (patch) | |
tree | ee30835948669ca14a0ce71b5b994f21d9052654 | |
parent | c28b5879cfaa9bb5d485e60e78a4d5f1ae803333 (diff) | |
download | pyscss-4cf0cb606ad32a04774a0a3ca9186e238bf61c1f.tar.gz |
Let the speedup block locator complain about surplus closing braces.
This brings the behaviour of the speedup module more in line with the
behaviour of the locate_block() function as implemented in python.
e.g. try:
$ echo 'a{}}' | pyscss
-rw-r--r-- | scss/src/block_locator.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/scss/src/block_locator.c b/scss/src/block_locator.c index 193b62c..8e634a4 100644 --- a/scss/src/block_locator.c +++ b/scss/src/block_locator.c @@ -398,6 +398,12 @@ BlockLocator_iternext(BlockLocator *self) if (c == '\\') { /* Start of an escape sequence; ignore next character */ self->codestr_ptr++; + } else if (c == '}' && self->depth == 0) { + self->block.error = -1; + sprintf(self->exc, "Unexpected closing brace on line %d", self->lineno); + #ifdef DEBUG + fprintf(stderr, "\t%s\n", self->exc); + #endif } /* only ASCII is special syntactically */ else if (c < 256) { |