diff options
| author | German M. Bravo <german.mb@deipi.com> | 2012-01-09 13:02:20 -0600 |
|---|---|---|
| committer | German M. Bravo <german.mb@deipi.com> | 2012-01-09 13:02:20 -0600 |
| commit | 7bc4459a255703d0a5d82eff8235e952882f7090 (patch) | |
| tree | 9340ebca88f459d2369ddf8d57a042c358db3807 /scss/src | |
| parent | e814c0853fc9984d8ce754a9bf81c64e07e6b1e2 (diff) | |
| download | pyscss-7bc4459a255703d0a5d82eff8235e952882f7090.tar.gz | |
Fixed bug for bad line numbers
Diffstat (limited to 'scss/src')
| -rw-r--r-- | scss/src/block_locator.c | 9 | ||||
| -rwxr-xr-x | scss/src/block_locator.py | 7 |
2 files changed, 11 insertions, 5 deletions
diff --git a/scss/src/block_locator.c b/scss/src/block_locator.c index 86750fc..9fba3cf 100644 --- a/scss/src/block_locator.c +++ b/scss/src/block_locator.c @@ -29,9 +29,12 @@ int _strip(char *begin, char *end, int *lineno) { while (begin < end) { c = *begin; if (c == '\0') { - if (line == NULL) { - line = first; - if (lineno) { + if (lineno && line == NULL) { + line = first - 1; + do { + c = *++line; + } while (c == ' ' || c == '\t' || c == '\n' || c == ';'); + if (c != '\0') { sscanf(line, "%d", lineno); } } diff --git a/scss/src/block_locator.py b/scss/src/block_locator.py index 6c63f22..da455d8 100755 --- a/scss/src/block_locator.py +++ b/scss/src/block_locator.py @@ -74,8 +74,11 @@ def _strip_selprop(selprop, lineno): # line numbers that might still be there (from multiline selectors) _lineno, _sep, selprop = selprop.partition(SEPARATOR) if _sep == SEPARATOR: - _lineno = _lineno.strip() - lineno = int(_lineno) if _lineno else 0 + _lineno = _lineno.strip(' \t\n;') + try: + lineno = int(_lineno) + except ValueError: + pass else: selprop = _lineno selprop = _nl_num_re.sub('\n', selprop) |
