google / closure-stylesheets

A CSS+ transpiler that lints, optimizes, and I18n-izes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Parse error with calc()

sgammon opened this issue · comments

I am running into a parse error when compiling a stylesheet that uses calc() with a custom var(). I don't precisely know why it's crashing.

This might be related to #136 (Parsing error with css calc and negative number) or #116, but my issue doesn't involve negative numbers. The declaration, in this case, that stopped the compiler, was:

  height: calc( 64px * var(--some-css-variable, 4) );
                                                   ^

Here is the stacktrace:

Compiler parsing error: Parse error in bazel-out/darwin-fastbuild/bin/bloombox/ui/style/app.css at line 18,596 column 71:
  height: calc( 64px * var(--some-css-variable, 4) );
                                                   ^

com.google.common.css.compiler.ast.GssParserException: Parse error in bazel-out/darwin-fastbuild/bin/bloombox/ui/style/app.css at line 18,596 column 71:
  height: calc( 64px * var(--some-css-variable, 4) );
                                                   ^

	at com.google.common.css.compiler.ast.GssParserCC.parse(GssParserCC.java:214)
	at com.google.common.css.compiler.ast.GssParserCC.parse(GssParserCC.java:234)
	at com.google.common.css.compiler.ast.AbstractGssParser.parseInternal(AbstractGssParser.java:56)
	at com.google.common.css.compiler.ast.GssParser.parse(GssParser.java:46)
	at com.google.common.css.compiler.ast.GssParser.parse(GssParser.java:42)
	at com.google.common.css.compiler.commandline.DefaultCommandLineCompiler.parseAndPrint(DefaultCommandLineCompiler.java:126)
	at com.google.common.css.compiler.commandline.DefaultCommandLineCompiler.compile(DefaultCommandLineCompiler.java:110)
	at com.google.common.css.compiler.commandline.DefaultCommandLineCompiler.execute(DefaultCommandLineCompiler.java:156)
	at com.google.common.css.compiler.commandline.ClosureCommandLineCompiler.executeJob(ClosureCommandLineCompiler.java:385)
	at com.google.common.css.compiler.commandline.ClosureCommandLineCompiler.main(ClosureCommandLineCompiler.java:451)
Caused by: com.google.common.css.compiler.ast.ParseException: Encountered " ")" ") "" at line 18596, column 71.
Was expecting one of:
    "*" ...
    "/" ...
    <S> ...
    
	at com.google.common.css.compiler.ast.GssParserCC.generateParseException(GssParserCC.java:5284)
	at com.google.common.css.compiler.ast.GssParserCC.jj_consume_token(GssParserCC.java:5149)
	at com.google.common.css.compiler.ast.GssParserCC.product(GssParserCC.java:2848)
	at com.google.common.css.compiler.ast.GssParserCC.sum(GssParserCC.java:2719)
	at com.google.common.css.compiler.ast.GssParserCC.calc(GssParserCC.java:2687)
	at com.google.common.css.compiler.ast.GssParserCC.term(GssParserCC.java:2107)
	at com.google.common.css.compiler.ast.GssParserCC.slash_term(GssParserCC.java:1843)
	at com.google.common.css.compiler.ast.GssParserCC.assign_term(GssParserCC.java:1794)
	at com.google.common.css.compiler.ast.GssParserCC.composite_term(GssParserCC.java:1744)
	at com.google.common.css.compiler.ast.GssParserCC.expr(GssParserCC.java:1716)
	at com.google.common.css.compiler.ast.GssParserCC.standardDeclaration(GssParserCC.java:1675)
	at com.google.common.css.compiler.ast.GssParserCC.declaration(GssParserCC.java:1543)
	at com.google.common.css.compiler.ast.GssParserCC.styleDeclaration(GssParserCC.java:1515)
	at com.google.common.css.compiler.ast.GssParserCC.ruleSet(GssParserCC.java:580)
	at com.google.common.css.compiler.ast.GssParserCC.block(GssParserCC.java:3827)
	at com.google.common.css.compiler.ast.GssParserCC.start(GssParserCC.java:3930)
	at com.google.common.css.compiler.ast.GssParserCC.parse(GssParserCC.java:209)
	... 9 more