Skip to content

Syntax error on inline comment with Windows new line and single quotes #136

@life777

Description

@life777
  • Node Version: v10.15.1
  • NPM Version: 6.8.0
  • postcss Version: 7.0.14
  • postcss-less Version: 3.1.2

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.

The issue is part of this one, but it's reproducible only on Windows. Windows new line symbol consists of two symbols: \r\n.

screenshot from 2019-02-27 18-34-36

Here on screenshot Regex on line 14 doesn't work with "\r\n" new line symbol.

LESS

// it's first comment (this line should end with Windows new line symbols)
// it's second comment

Errors

Exception has occurred: CssSyntaxError
CssSyntaxError: <css input>:1:11: Unknown word
    at Input.error (/node_modules/postcss/lib/input.js:130:16)
    at LessParser.unknownWord (/node_modules/postcss/lib/parser.js:563:22)
    at LessParser.unknownWord (/node_modules/postcss-less/lib/LessParser.js:209:11)
    at LessParser.other (/node_modules/postcss/lib/parser.js:168:12)
    at LessParser.other (/node_modules/postcss-less/lib/LessParser.js:158:13)
    at LessParser.parse (/node_modules/postcss/lib/parser.js:77:16)
    at parse (/node_modules/postcss-less/lib/index.js:11:12)
    at new LazyResult (/node_modules/postcss/lib/lazy-result.js:60:16)
    at Processor.<anonymous> (/node_modules/postcss/lib/processor.js:138:12)
    at Processor.process (/node_modules/postcss/lib/processor.js:117:23)

Expected Behavior

It should parse this code

Actual Behavior

It throws error: "Unknown word"

How can we reproduce the behavior?

To reproduce this error you need to have to inline comments with single quote that end with \r\n.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions