Skip to content

Error thrown on trailing !important following Function #25

@jwilsson

Description

@jwilsson

Originally reported at lesshint/lesshint#367

  • Node Version: 6.10.3
  • NPM Version: 4.5.0
  • postcss-values-parser Version: 1.2.1

This issue is regarding a problem with:

  • Standard CSS
  • LESS
  • SCSS
  • SASS

If you have a large amount of code to share which demonstrates the problem you're experiencing, please provide a link to your
repository rather than pasting code. Otherwise, please paste relevant short snippets below.

.blah(fade(rgb(0, 0, 0), 10%)) !important;
/Users/jwilsson/value-test/node_modules/postcss-values-parser/lib/parser.js:114
    throw new ParserError(message + ` at line: ${token[2]}, column ${token[3]}`);
    ^

ParserError: Expected opening parenthesis at line: 1, column 30
    at Parser.error (/Users/jwilsson/value-test/node_modules/postcss-values-parser/lib/parser.js:114:11)
    at Parser.parenClose (/Users/jwilsson/value-test/node_modules/postcss-values-parser/lib/parser.js:355:12)
    at Parser.parseTokens (/Users/jwilsson/value-test/node_modules/postcss-values-parser/lib/parser.js:222:14)
    at Parser.loop (/Users/jwilsson/value-test/node_modules/postcss-values-parser/lib/parser.js:119:12)
    at Parser.parse (/Users/jwilsson/value-test/node_modules/postcss-values-parser/lib/parser.js:48:17)
    at Object.<anonymous> (/Users/jwilsson/value-test/index.js:2:66)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)

Expected Behavior

Not throw an error and return a AST.

Actual Behavior

It throws the above error.

How can we reproduce the behavior?

Create and run a .js-file with this code in it:

const parser = require('postcss-values-parser');
const ast = parser('.blah(fade(rgb(0, 0, 0), 10%)) !important;').parse();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions