Problem with CSS parsing when it contains constants or css class names with "_" in the middle of the name.

862 views
Skip to first unread message

Arkady

unread,
Jan 19, 2010, 1:56:02 PM1/19/10
to Google Web Toolkit
Hello,

I am trying to define a constant in the css file with name CPU_COLOR,
similarly to the example given in the ClientBundle documentation (@def
CPU_COLOR #99cc00;). When I am trying to compile I get an error:

[java] Preparing method css
[java] The following problems were detected
[java] [WARN] Line 1 column 12: encountered
"_". Was expecting one of: "}" "+" "-" "," ";" "/" <STRING> <IDENT>
<NUMBER> <URL> <PERCENTAGE> <PT> <MM> <CM> <PC> <IN> <PX> <EMS> <EXS>
<DEG> <RAD> <GRAD> <MS> <SECOND>
<HZ> <KHZ> <DIMEN> <HASH> <IMPORTANT_SYM> <UNICODERANGE> <FUNCTION>
[java] Parsing CSS stylesheet file:/C:/.../
dmc.css
[java] [ERROR] Unable to parse CSS
[java] org.w3c.css.sac.CSSException: @def rules must specify an
identifier
and one or more values
[java] at com.google.gwt.resources.css.GenerateCssAst
$GenerationHandler
.parseDef(GenerateCssAst.java:346)

If I remove the "_" from the constant name the compilation succeeds.
The same problem I had before when I tried to define a css class name
with "_" in the middle of the name.

Am I doing something illegal or is it a GWT compiler bug?

Any help will be greatly appreciated.

Best regards,

Arkady.

PKolenic

unread,
Jan 19, 2010, 7:59:51 PM1/19/10
to Google Web Toolkit
Similarly I have an issue with setting transparency.

Outside of using Uibinding I would use the following css class:

.inactiveArrow{filter: alpha(opacity=40); opacity: 0.4;}

However when I try to compile it with a UiBinding I get the same
message:


[java] The following problems were detected

[java] [WARN] Line 4 column 52: encountered
"=". Was expecting one of: "+" "-" "," "/" ")" <STRING> <IDENT>


<NUMBER> <URL> <PERCENTAGE> <PT> <MM> <CM> <PC> <IN> <PX> <EMS> <EXS>
<DEG> <RAD> <GRAD> <MS> <SECOND> <HZ> <KHZ> <DIMEN> <HASH>

<UNICODERANGE> <FUNCTION>
[java] [WARN] Line 6 column 47: encountered
"=". Was expecting one of: "+" "-" "," "/" ")" <STRING> <IDENT>


<NUMBER> <URL> <PERCENTAGE> <PT> <MM> <CM> <PC> <IN> <PX> <EMS> <EXS>
<DEG> <RAD> <GRAD> <MS> <SECOND> <HZ> <KHZ> <DIMEN> <HASH>

<UNICODERANGE> <FUNCTION>

It is valid css, and needed to get the same behaviour on IE as in
Firefox.

I can work around not having '_' in my classnames, but how do you work
around not being able to have '=' in the rules?

Thomas Broyer

unread,
Jan 19, 2010, 9:00:46 PM1/19/10
to Google Web Toolkit

http://code.google.com/p/google-web-toolkit/issues/detail?id=3946

Will be fixed in 2.0.1 (well, the "underscore in css class name" will
be for sure, and I believe the "underscore in @def name" too though I
can't say for sure)

Thomas Broyer

unread,
Jan 19, 2010, 9:02:37 PM1/19/10
to Google Web Toolkit

On 20 jan, 01:59, PKolenic <pkole...@gmail.com> wrote:
> Similarly I have an issue with setting transparency.
>
> Outside of using Uibinding I would use the following css class:
>
> .inactiveArrow{filter: alpha(opacity=40); opacity: 0.4;}
>
> However when I try to compile it with a UiBinding I get the same
> message:
>      [java]                The following problems were detected
>      [java]                   [WARN] Line 4 column 52: encountered
> "=". Was expecting one of: "+" "-" "," "/" ")" <STRING> <IDENT>
> <NUMBER> <URL> <PERCENTAGE> <PT> <MM> <CM> <PC> <IN> <PX> <EMS> <EXS>
> <DEG> <RAD> <GRAD> <MS> <SECOND> <HZ> <KHZ> <DIMEN> <HASH>
> <UNICODERANGE> <FUNCTION>
>      [java]                   [WARN] Line 6 column 47: encountered
> "=". Was expecting one of: "+" "-" "," "/" ")" <STRING> <IDENT>
> <NUMBER> <URL> <PERCENTAGE> <PT> <MM> <CM> <PC> <IN> <PX> <EMS> <EXS>
> <DEG> <RAD> <GRAD> <MS> <SECOND> <HZ> <KHZ> <DIMEN> <HASH>
> <UNICODERANGE> <FUNCTION>
>
> It is valid css, and needed to get the same behaviour on IE as in
> Firefox.

Actually it's not. the "=" is not valid CSS (as the warning says)

> I can work around not having '_' in my classnames, but how do you work
> around not being able to have '=' in the rules?

http://code.google.com/p/google-web-toolkit/issues/detail?id=3946

literal("alpha(opacity=40)")

Reply all
Reply to author
Forward
0 new messages