This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 221028 - CSS3 calc() value treated as parse error in editor
Summary: CSS3 calc() value treated as parse error in editor
Status: NEW
Alias: None
Product: web
Classification: Unclassified
Component: CSS Editor (show other bugs)
Version: 7.2
Hardware: Macintosh (x86) Mac OS X
: P4 normal (vote)
Assignee: Milutin Kristofic
Depends on:
Reported: 2012-10-29 14:17 UTC by MacDada
Modified: 2014-10-06 13:25 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description MacDada 2012-10-29 14:17:34 UTC
I use this code:

.class {
        width: -webkit-calc(100% + 28px);
        width:    -moz-calc(100% + 28px);
        width:         calc(100% + 28px);

NetBeans editor gives me these error on the second line:

Unexpected token WS found
Unexpected token LENGTH found
Unexpected token RPAREN found
Unexpected value token -webkit-calc
Comment 1 Vladimir Riha 2012-10-30 08:22:45 UTC
partially reproducible in 7.3. The sample gives 2 errors:

Unexpected token WS found
Unexpected token LENGTH found

Product Version: NetBeans IDE Dev (Build 201210300001)
Comment 2 Marek Fukala 2012-11-01 15:34:55 UTC

nice sample at

width: calc(100%/3 - 2*1em - 2*1px);
Comment 3 Marek Fukala 2012-11-30 08:46:44 UTC
improved in web-main#dcd6266c373a

though not fully fixed.  Calc in calc will be still flagged as erroneous: width: calc(10% + calc(1 + 1));

The fix is mostly a workaround as there are some infrastructure flaws preventing me to fix this properly:

1) GrammarParser doesn't allow elements recursion. So as calc can contain calc this is really a problem.
2) No support for "custom content resolver" - that would be the most elegant fix IMO - introduce a possibility to register a custom content resolver which would act similar as GroupGrammarElement but it would accept or reject input tokens based on its internals - the logic wouldn't be described in a grammar form but hardcoded in some acceptInput(...) method.

As none of the options is safe so close to CF, I'm pushing just the workaround and keeping the issue opened.
Comment 4 Quality Engineering 2012-12-01 02:56:26 UTC
Integrated into 'main-golden', will be available in build *201212010001* on (upload may still be in progress)
User: Marek Fukala <>
Log: #221028 - CSS3 calc() value treated as parse error in editor