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

Summary: CSS3 calc() value treated as parse error in editor
Product: web Reporter: MacDada
Component: CSS EditorAssignee: Milutin Kristofic <mkristofic>
Status: NEW ---    
Severity: normal CC: vriha
Priority: P4    
Version: 7.2   
Hardware: Macintosh (x86)   
OS: Mac OS X   
Issue Type: DEFECT Exception Reporter:

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

http://caniuse.com/#feat=calc
http://www.w3.org/TR/css3-values/#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
reproducible, 

nice sample at http://www.w3.org/TR/css3-values/#calc:

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 http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/dcd6266c373a
User: Marek Fukala <mfukala@netbeans.org>
Log: #221028 - CSS3 calc() value treated as parse error in editor