Skip to content
This repository has been archived by the owner on Jul 9, 2020. It is now read-only.

Immediate child selector (">") breaks parsing #24

Open
ghost opened this issue Dec 9, 2011 · 3 comments
Open

Immediate child selector (">") breaks parsing #24

ghost opened this issue Dec 9, 2011 · 3 comments

Comments

@ghost
Copy link

ghost commented Dec 9, 2011

According to the docs, this should work:

.some-class {
  > div {
    color: white;
  }
}

However, the parser raises an error:

.some-class {
^
Expected end of text (at char 0), (line:1, col:1)

Simply removing the immediate child selector will make the parser not have any problems, however this then precludes the use of said selector.

This is python-scss version 0.8.71 on Fedora Core 13

@chriscauley
Copy link

TLDR; replace " > " with " >" (no space after greater than)

I tried to play with this a bit but I don't understand pyparsing enough to fix it. I tried a few test cases, and every time it would work if I was lazy, like "i>b{color: red}" and fail when I was not lazy, like "i > b { color: red }". After a bit of trial and error I found that the error is caused by "greater-than space". I then did a find and replace, removing every "> " with ">" and the problem went away. Note, the file I used contains 17 immediate child selectors, so it was tested with a variety of combinations. Hope that holds you over till they fix it.

@homeworkprod
Copy link

I can reproduce that.

nav.top,
body > footer {
  color: #e7e7e7;
}

blows up complaining:

nav.top,
   ^
Expected end of text (at char 3), (line:1, col:4)

while this doesn't:

nav.top,
body >footer {
  color: #e7e7e7;
}

Another example:

body > footer {
  clear: both;
}

yields:

body > footer {
              ^
Expected end of text (at char 14), (line:1, col:15)

Even worse:

#foobar,
body > footer {
  clear: both;
}

This results in a misleading error message that doesn't even point to a certain line:

invalid literal for int() with base 16: 'fo'

This is quite annoying and hurts readability. Also, that's quite an adoption stopper (I encountered it before my stylesheet compiled even once; pyScss had no problem with this, BTW). Please fix this.

@klen
Copy link
Owner

klen commented Jan 23, 2012

Sorry, I not supported python-scss anymore. Use https://github.com/Kronuz/pyScss

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants