summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEevee (Alex Munroe) <eevee.git@veekun.com>2014-08-29 16:39:49 -0700
committerEevee (Alex Munroe) <eevee.git@veekun.com>2014-08-29 17:07:52 -0700
commita42962221824dfe7af5067ca05da8a2858fc0dbf (patch)
tree792059bad2468ee3244437efc1950585403dba79
parentea076cc40dfeb0ac373376c3a912285595e2058e (diff)
downloadpyscss-a42962221824dfe7af5067ca05da8a2858fc0dbf.tar.gz
Make the C block locator aware of escape sequences.
-rw-r--r--scss/src/block_locator.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/scss/src/block_locator.c b/scss/src/block_locator.c
index e081d84..193b62c 100644
--- a/scss/src/block_locator.c
+++ b/scss/src/block_locator.c
@@ -222,6 +222,11 @@ init_function_map(void) {
for (i = 0; i < 256 * 256 * 2 * 3; i++) {
scss_function_map[i] = NULL;
}
+ /* TODO this seems unnecessarily complicated */
+ /* TODO why does this care about parentheses? */
+ /* TODO it's possible to nest a string inside another string, using #{!
+ * should just have a general stack of the current context i think
+ */
scss_function_map[(int)'\"' + 256*0 + 256*256*0 + 256*256*2*0] = _BlockLocator_start_string;
scss_function_map[(int)'\'' + 256*0 + 256*256*0 + 256*256*2*0] = _BlockLocator_start_string;
scss_function_map[(int)'\"' + 256*0 + 256*256*1 + 256*256*2*0] = _BlockLocator_start_string;
@@ -384,18 +389,18 @@ BlockLocator_iternext(BlockLocator *self)
while (self->codestr_ptr < codestr_end) {
c = *(self->codestr_ptr);
- if (!c) {
- self->codestr_ptr++;
- continue;
- }
if (c == '\n') {
self->lineno++;
}
repeat:
+ if (c == '\\') {
+ /* Start of an escape sequence; ignore next character */
+ self->codestr_ptr++;
+ }
/* only ASCII is special syntactically */
- if (c < 256) {
+ else if (c < 256) {
fn = scss_function_map[
(int)c +
256 * self->instr +