From 4cf0cb606ad32a04774a0a3ca9186e238bf61c1f Mon Sep 17 00:00:00 2001 From: Martin Natano Date: Thu, 29 Sep 2016 16:22:22 +0200 Subject: 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 --- scss/src/block_locator.c | 6 ++++++ 1 file changed, 6 insertions(+) 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) { -- cgit v1.2.1